summaryrefslogtreecommitdiff
path: root/2409/CH2/EX2.20/Ex2_20.sce
blob: 7c4788bb5c2def9b0fa3cdf3c623a3e491d3b94f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

//Variable Declaration

PI=-1280  //I component of range vector for a satellite(km)
PJ=-1278  //J component of range vector for a satellite(km)
PK=66     //K component of range vector for a satellite(km)
GST=240   //GST(degrees)
LE=48.42  //Latitude(Degrees)
PE=-89.26 //Longitude(Degrees)
H=200     //Height above mean sea level(metres)
aE=6378.1414 //Semimajor axis(km)
eE=0.08182   //Eccentricity


//Calculation

l=(aE/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*cos(LE*3.142/180)  
z=((aE*(1-eE**2))/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*sin(LE*3.142/180)  
SE=(atan(z/l))*180/3.142 //Geocentric latitude angle (degrees)
LST=240+PE


a=sin(SE*3.142/180)*cos(LST*3.142/180)
b=sin(SE*3.142/180)*sin(LST*3.142/180)
c=-cos(SE*3.142/180)
d=-sin(LST*3.142/180)
e=cos(LST*3.142/180)
f=0
g=cos(SE*3.142/180)*cos(LST*3.142/180)
h=cos(SE*3.142/180)*sin(LST*3.142/180)
i=sin(SE*3.142/180)

D = [a,b,c;d,e,f;g,h,i]

P=  [PI;PJ;PK]

R=D*P  //Components of range of earth station
Ro=sqrt(R(1,1)**2+R(2,1)**2+R(3,1)**2) //Magnitude of range of earth station(km)
El=asin(R(3,1)/Ro) //Antenna elevation angle for the earth station(radians) 
El= El*180/3.142   //Converting El to degrees
alpha=(atan(R(2,1)/R(3,1)))*180/3.142

if ( R(1,1)<0 & R(2,1)>0 ) then
   Aza=alpha
else
   Aza=0
end   
if ( R(1,1)>0 & R(2,1)>0 ) then
   Azb=180-alpha
else:
   Azb=0
end
   
if ( R(1,1)>0 & R(2,1)<0 ) then
   Azc=180+alpha
else
   Azc=0
end   
if ( R(1,1)<0 & R(2,1)<0 ) then
   Azd=360-alpha
else
   Azd=0
end   
Az= Aza+Azb+Azc+Azd   //Azimuth angle (degrees)

printf("The magnitude of range of earth station is %.0f km",Ro)
printf("\nThe antenna elevation angle for the earth station are %.f degrees",El)
printf("\nThe Azimuth angle for the earth station is %.2f degrees",Az)