Category : Science and Education
Archive   : EEPUB05.ZIP
Filename : SATELLIT.ASC

 
Output of file : SATELLIT.ASC contained in archive : EEPUB05.ZIP

1 GOSUB 5000
2 PI# = 3.141592653589794#
3 FOR I = 1 TO 10 : PRINT : NEXT I
5 DIM TN#(3),GR#(3),SO#(3),V#(3)
7 DIM PJ#(3),VT#(3),VS#(3)
9 AZ$ = "###.##-" : EL$ = "##.##-"
10 PRINT " PROGRAM FOR CALCULATION OF AZIMUTH AND ELEVATION FOR EARTH BASED"
12 PRINT " RECEIVING STATIONS TO ORBITING SATELLITES IN GEOCENTRIC ORBIT ONLY."
14 PRINT " AZIMUTH CLOCKWISE DEGREES FROM NORTH-ELEVATION IS FROM HORIZON PLANE"
15 FOR I = 1 TO 2000 : NEXT I
16 FLAG = 0
18 GOSUB 5000:INPUT "WANT DISPLAY OF USER COORDINATES - Y OR N";FLAG$
20 IF FLAG$="Y" OR FLAG$="y" THEN FLAG = 1
26 GOSUB 5000 : PRINT
28 INPUT "USER LATITUDE IN DEGREES";AD# : PRINT
30 IF AD# < 1 OR AD# > 89 GOTO 70
40 INPUT "USER LATITUDE IN MINUTES"; AM# : PRINT : PRINT
45 IF AM# < 1 OR AM# > 59 GOTO 70
50 INPUT "USER LONGITUDE IN DEGREES";OD# : PRINT :
55 IF OD# < 1 OR OD# > 179 GOTO 80
60 INPUT "USER LONGITUDE IN MINUTES"; OM#
65 IF OM# < 1 OR OM# > 59 GOTO 80
68 GOSUB 5000 : GOTO 90
70 PRINT "ILLEGAL LATITUDE - 1 < DEG < 89, 1 < MIN < 59"
72 GOTO 28
80 PRINT "ILLEGAL LONGITUDE - 1 < DEG < 179, 1 < MIN < 59"
82 GOTO 50
90 REM MAKE DECIMAL DEGREES
94 AM# = AM#/60
96 AD# = AD# + AM#
98 OM# = OM#/60
100 OD# = OD# + OM#
109 REM CONVERT DEGREES TO RADIANS
110 AD# = (AD#*PI#)/180
120 OD# = (OD#*PI#)/180
129 REM GET SPHERICAL COORDINATES
130 PH# = (PI#/2)-AD#
140 TH# = PI#-OD#
145 REM RADIUS EARTH (SM AT DSS-13)
150 RH# = 3959.94
160 IF FLAG = 1 THEN PRINT "SPHERICAL COORDINATES RHO,THETA,PHI
170 IF FLAG = 1 THEN PRINT RH#;TH#;PH#
180 REM CONVERT SPHERICAL COORDINATES TO CARTESIAN COORDINATES
190 X# = RH# * COS(TH#)*SIN(PH#)
200 Y# = RH# * SIN(TH#)*SIN(PH#)
210 Z# = RH# * COS(PH#)
220 IF FLAG = 1 THEN PRINT "CARTESIAN COORDINATES X,Y,Z"
230 IF FLAG = 1 THEN PRINT X#;Y#;Z#
240 REM PARAMETERIZE CIRCLE THRU USER COORDINATES
250 UR# = SQR(X#^2 + Y#^2)
260 IF FLAG = 1 THEN PRINT "PARAMETER RADIUS TO USER ";UR#
270 F1# = ATN((X#/UR#)/SQR(-(X#/UR#)*(X#/UR#)+1))
300 IF FLAG = 1 THEN PRINT "PARAMETER T RADIANS ";F1#
310 REM CALCULATE UNIT TANGENT VECTOR
320 TN#(1) = COS(F1#)
330 TN#(2) = -SIN(F1#)
340 TN#(3) = 0
350 IF FLAG = 1 THEN PRINT "TANGENT VECTOR T1,T2,T3"
360 IF FLAG = 1 THEN PRINT TN#(1);TN#(2);TN#(3)
370 REM CALCULATE GRADIENT VECTOR
380 GR#(1) = 2*X# : GR#(2) = 2*Y# : GR#(3) = 2*Z#
410 REM NORMALIZE GRADIENT VECTOR
420 LE# = SQR(GR#(1)^2 + GR#(2)^2 + GR#(3)^2)
430 FOR I = 1 TO 3
440 GR#(I) = GR#(I)/LE#
450 NEXT I
460 IF FLAG = 1 THEN PRINT "GRADIENT VECTOR G1,G2,G3,
470 IF FLAG = 1 THEN FOR I = 1 TO 3 : PRINT GR#(I); : NEXT I : PRINT
475 REM CROSS PRODUCT
480 SO#(1) = GR#(2)*TN#(3)-TN#(2)*GR#(3)
490 SO#(2) = GR#(3)*TN#(1)-TN#(3)*GR#(1)
500 SO#(3) = GR#(1)*TN#(2)-TN#(1)*GR#(2)
510 IF FLAG = 1 THEN PRINT "DIRECTLY SOUTH SO1,SO2,SO3,
512 IF FLAG = 1 THEN FOR I = 1 TO 3 : PRINT SO#(I); : NEXT I : PRINT
518 PRINT TAB(3);"SATELLITE";TAB(21);"DEG WEST";TAB(36);"AZIMUTH";TAB(51);"ELEVATION"
521 REM END SETUP AND ENTER MAIN LOOP
522 READ SAT$,SAT!
524 IF SAT$ = "END" GOTO 3000
530 REM GET VECTOR FROM CENTER OF EARTH TO SATELLITE
540 S1# = 22300 + 3956.67
550 S2# = PI#-((SAT!/180)*PI#)
560 S3# = PI#/2
570 REM CONVERT TO CARTESIAN
580 X1# = S1# * COS(S2#) * SIN(S3#)
590 X2# = S1# * SIN(S2#) * SIN(S3#)
600 X3# = S1# * COS(S3#)
610 REM PRINT "GEOCENTRIC VECTOR TO SATELLITE X1,X2,X3"
620 REM PRINT X1#;X2#;X3#; : PRINT
630 REM GET POINTER VECTOR FROM USER TO SATELLITE
640 V#(1) = X1# - X#
650 V#(2) = X2# - Y#
660 V#(3) = X3# - Z#
670 REM PRINT "POINTER VECTOR WITH RESPECT TO OLD BASIS"
680 REM FOR I = 1 TO 3 : PRINT V#(I); : NEXT I : PRINT
700 REM FIRST PROJECT V ON TN
710 DP# = 0
720 FOR I = 1 TO 3 : DP# = DP# + (V#(I)*TN#(I)) : NEXT I
730 FOR I = 1 TO 3 : VT#(I) = DP# * TN#(I) : NEXT I
740 REM NEXT PROJECT V ON SO
742 DP# = 0
750 FOR I = 1 TO 3 : DP# = DP# + (V#(I)*SO#(I)) : NEXT I
761 FOR I = 1 TO 3 : VS#(I) = DP# * SO#(I) : NEXT I
770 REM ADD TO GET PROJECTION VECTOR IN OLD SYS TERMS
780 FOR I = 1 TO 3 : PJ#(I) = VT#(I) + VS#(I) : NEXT I
790 REM TAKE ANGLE BETWEEN PJ AND SO AND GET AZIMUTH
800 DP# = 0 : LE# = 0
810 FOR I = 1 TO 3 : DP# = DP# + (PJ#(I)*SO#(I)): NEXT I
820 FOR I = 1 TO 3 : LE# = LE# + (PJ#(I)^2) : NEXT I
830 LE# =SQR(LE#)
840 DP# = DP#/LE#
845 IF ABS(ABS(DP#)-1) < .0001 THEN AZ# = 180 : GOTO 900
850 AZ# = -ATN(DP#/SQR(-DP#*DP#+1))+PI#/2
860 AZ# = (180*AZ#)/PI#
864 CP# = OD# : CP# = (CP#*180)/PI#
866 IF SAT! < CP# THEN AZ# = 180 - AZ# ELSE AZ# = 180 + AZ#
900 REM FIND ELEVATION
910 DP# = 0 : LE# = 0
920 FOR I = 1 TO 3 : DP# = DP# + (GR#(I)*V#(I)) : NEXT I
930 FOR I = 1 TO 3 : LE# = LE# + (V#(I)^2) : NEXT I
940 LE# = SQR(LE#)
950 DP# = DP#/LE#
960 EL# = -ATN(DP#/SQR(-DP#*DP#+1))+PI#/2
970 EL# = (180*EL#)/PI#
972 EL# = 90 - EL#
1010 PRINT TAB(3);SAT$;TAB(23);SAT!;
1020 PRINT TAB(36) : PRINT USING AZ$;AZ#;
1030 PRINT TAB(53) : PRINT USING EL$;EL#;
1032 IF EL# < 0 THEN PRINT TAB(60)"OUT OF RANGE"
1033 IF EL# > 0 THEN PRINT
1035 IF SAT$ = "XXX" THEN GOTO 3000
1040 GOTO 522
1770 DATA INTELSAT IV-F7,1,INTELSAT IV-F2,4,SYMPHONIE 2,11.5
1880 DATA STATSIONAR 4,14,SIRIO,15,INTELSAT IV-F3,19
1990 DATA INTELSAT IV-A-F1,24.5,STATSIONAR 8,25,INTELSAT IV-A-F2,29.5
1995 DATA INTELSAT IV-A-F4,34.5
2000 DATA COMSTAR III,87,WESTAR III,91,COMSTAR II,95,WESTAR I,99
2010 DATA ANIK A1,104,ANIK B1&A2,109,ANIK C1,112,ANIK A3,114
2020 DATA SATCOM II,119,WESTAR II,123.5,COMSTAR I,128,SATCOM I,135
2500 DATA END,9999
3000 INPUT"ANOTHER SATELLITE FOR SAME USER - Y OR N";WH$
3010 IF WH$="N" OR WH$="n" THEN END
3020 INPUT"WEST LONGITUDE OF GEOCENTRIC SAT";SAT!
3025 SAT$="XXX"
3030 GOTO 530
5000 PRINT CHR$(27);CHR$(69)
5001 RETURN

3020 INPUT"WEST LONGITUDE OF GEOCENTRIC SAT";SAT!
3025 SAT$="XXX"
3030 GOTO 530
5000 PRIN