home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 3
/
hamradioversion3.0examsandprograms1992.iso
/
misc
/
eme
/
eme.bas
Wrap
BASIC Source File
|
1987-05-06
|
13KB
|
387 lines
10 REM ************MOON COORDINATES *****************
1000 REM ************MOON COORDINATES *****************
1010 REM
1020 REM PRIMARILY FOR USE IN EARTH MON EARTH
1030 REM (EME) COMMUNICATIONS BY RADIO
1040 REM
1050 REM BASED ON PROGRAMS BY LANCE COLLISTER (WA1JXN/WA3GPL)
1060 REM AND JAY LIEBMANN (K5JL)
1070 REM SEE EIMAC PUBLICATIONS AS-49-6, AS-49-17 AND AS-49-24.
1080 REM VARIAN, EIMAC DIVISION
1090 REM 301 INDUSTRIAL WAY
1100 REM SAN CARLOS, CA 94070
1110 REM
1120 REM MODIFIED FOR MODEL 1 TRS-80 LEVEL 2 AND DISK BASIC
1130 REM WITH ENHANCED DISPLAYS AND ADDITIONS OF SIDEREAL TIME,
1140 REM RIGHT ASCENSION AND DISTANCES TO THE MOON (CONVERTED
1150 REM TO PATH-LOSS VARIATIONS IN DECIBELS)
1160 REM BY WARREN BUTLER (W2WD).
1170 REM
1180 REM INPUT DATA:LATITUDE,LONGITUDE, GMT DATE/TIME AT SITE.
1190 REM DATA FOR UP TO 31 DIFFERENT DAYS CAN BE INPUTTED AT
1200 REM ONE TIME. ENTER DATA IN THE FORMAT REQUESTED. AFTER
1210 REM THE LAST INPUT, INSERT ZEROS OR HIT <ENTER>
1220 REM
1230 REM OUTPUT DATA: GHA, DECLINATION, AZIMUTH AND ELEVATION OF
1240 REM MOON, SIDEREAL TIME (ST) AND LOCAL TIME, UNIVERSAL
1250 REM WINDOWS FOR EME COMMUNICATION, RIGHT ASCENSION OF MOON,
1260 REM PATH-LOSS VARIATIONS (DB)
1270 REM
1280 REM HARDCOPY OUTPUT CAN BE SELECTED IF PRINTER IS AVAILABLE.
1290 REM
1300 REM UNIVERSAL EME WINDOWS ARE SHOWN BY LETTERS FOLLOWING DEC.
1310 REM U = EUROPEAN UNIVERSAL WINDOW
1320 REM W = W/VE UNIVERSAL WINDOW
1330 REM J = J/VK/ZL UNIVERSAL WINDOW
1340 REM
1350 REM BE PATIENT, THE CALCULATIONS CAN TAKE SEVERAL MINUTES.
1360 REM
1370 PRINT
1380 PRINT
1390 PRINT
1400 DIM F(31), V(31), Y(31), Q(31), S(31)
1410 P5=2#*3.14159265358979#
1420 D5=360#/P5
1430 R5=P5/360#
1440 CLS
1450 GOTO 1730
1460 PRINT
1470 PRINT "MOON COORDINATE PROGRAM"
1480 PRINT "WARREN BUTLER "
1490 PRINT
1500 PRINT
1510 PRINT
1520 PRINT
1530 PRINT "IF YOU NEED A DESCRIPTION OF PROGRAM, LIST LINES 1000-1360"
1540 PRINT "ELSE HIT <ENTER> TO CONTINUE";
1550 INPUT I%
1560 CLS
1570 REM BEGIN INPUT DATA SEQUENCE
1580 PRINT"WHAT ARE THE STATION CALL LETTERS";
1590 INPUT W$
1600 INPUT"WHAT IS YOUR LOCAL TIME (EST, EDT, PST, ETC.)";TL$
1610 PRINT"HOW MANY HOURS/MINUTES DIFFERENCE FROM GMT ?"
1620 PRINT" USE + IF EARLIER, - IF LATER"
1630 INPUT" (EG., EST WOULD BE -0500)";TD
1640 IF TD<-1200 OR TD > 1200 THEN 1610
1650 PRINT "WHAT IS YOUR LATITUDE (DEGREES,MINUTES)"
1660 PRINT"+NORTH / -SOUTH ";
1670 INPUT L5, U5
1680 IF L5>90 OR L5<-90 OR U5>60 THEN 1650
1690 PRINT "WHAT IS YOUR LONGITUDE (DEGREES,MINUTES)"
1700 PRINT "+WEST / -EAST ";
1710 INPUT L6,U6
1720 IF L6>180 OR L6<-180 OR U6>60 THEN 1690
1730 L5=39:U5=58:L6=105:U6=.08:TL$="MST": TD=-600
1740 L5=(L5+U5/60)*R5
1750 L6=(L6+U6/60)*R5
1760 INPUT "WHAT IS THE DESIRED PRINTING INCREMENT IN MINUTES (1-60)";I
1770 IF I <=0 OR I>60 THEN 1760
1780 B$=" "
1790 INPUT"DO YOU ONLY WANT PRINTOUT WHEN THE MOON IS NEAR THE HORIZON(YES/NO)";B$
1800 IF LEFT$(B$,1)="Y" THEN 1830
1810 I6=100
1820 GOTO 2030
1830 INPUT"BELOW WHAT ELEVATION IN DEGREES DO YOU WANT PRINTOUT";I6
1840 WW$=" "
1850 INPUT"DO YOU WANT HARDCOPY PRINTOUT (YES/NO)";WW$
1860 IF LEFT$(WW$,1)="Y" THEN WW$="YES"
1870 PRINT
1880 PRINT
1890 PRINT"WHAT ARE THE GMT MONTH, DAY, YEAR DESIRED ?"
1900 PRINT"*** NOTE - USE 4-DIGITS FOR YEAR (EG.,1983) ***"
1910 PRINT"ENTER DATA FOR UP TO 31 DAYS"
1920 PRINT"HIT <ENTER> AFTER LAST ENTRY"
1930 PRINT
1940 N=0
1950 FOR N=1 TO 31
1960 PRINT"DAY ";N;" (MM,DD,YYYY)";
1970 INPUT F(N), V(N), Y(N)
1980 IF F(N)=0 THEN 2220
1990 IF F(N)<1 OR F(N)>12 OR V(N)<1 OR V(N)>31 OR Y(N)<1900 OR Y(N)>2000 THEN 1960
2000 IF N=31 THEN 2220
2010 NEXT N
2020 GOTO 1950
2030 WW$=" "
2040 INPUT"DO YOU WANT HARDCOPY (YES/NO)";WW$
2050 IF LEFT$(WW$,1)="Y" THEN WW$="YES"
2060 REM
2070 PRINT
2080 PRINT"INPUT - GMT MONTH, DAY, YEAR, TIME BEGINNING, TIME ENDING"
2090 PRINT"USE 4-DIGITS FOR YEAR AND 24-HOUR CLOCK"
2100 PRINT"ENTER DATA FOR UP TO 31 DAYS"
2110 PRINT"HIT <ENTER> AFTER LAST ENTRY"
2120 PRINT
2130 N=0
2140 FOR N=1 TO 31
2150 PRINT"DATE";N;" (MM,DD,YYYY,TTTT,TTTT)";
2160 INPUT F(N), V(N), Y(N), Q(N), S(N)
2170 IF F(N)=0 THEN 2220
2180 IF F(N)<1 OR F(N)>12 OR V(N)<1 OR V(N)>31 OR Y(N)<1900 OR Y(N)>2000 OR Q(N)<0 OR Q(N)>2359 OR S(N)<.0001 OR S(N)>2400 THEN 2150
2190 IF N=31 THEN 2220
2200 NEXT N
2210 GOTO 2140
2220 IF N=31 THEN N5=N ELSE N5=N-1
2230 FOR N=1 TO N5
2240 IF LEFT$(B$, 1)="Y" THEN 2260
2250 GOTO 2290
2260 E1=2400
2270 B=0
2280 GOTO 2310
2290 E1=S(N)
2300 B=Q(N)
2310 M=F(N)
2320 D=V(N)
2330 Y=Y(N)
2340 Y1=Y-(INT(Y/100)*100)
2350 REM SETUP OUTPUT FORMAT
2360 PRINT
2370 IF WW$="YES" THEN LPRINT" "
2380 PRINT
2390 IF N=1 THEN CLS
2400 IF WW$="YES" THEN LPRINT " "
2410 PRINT"POSITION OF THE MOON ON ";M;"/";D;"/";Y;" GMT FROM" " "W$
2420 IF WW$="YES" THEN LPRINT"POSITION OF THE MOON ON ";M;"/";D;"/";Y;" GMT FROM " " "W$
2430 PRINT
2440 IF WW$="YES" THEN LPRINT" "
2450 PRINT"GMT" TAB(8)"GHA" TAB(17)"DEC" TAB(27)"LST" TAB(37)TL$ TAB(47)"AZ" TAB(56)"EL"
2460 IF WW$="YES" THEN LPRINT"GMT" TAB(8)"GHA" TAB(17)"DEC" TAB(27)"LST" TAB(37)TL$ TAB(47)"AZ" TAB(56)"EL"
2470 I1=2
2480 REM CALCULATION OF JULIAN DATE
2490 IF M>=3 THEN 2570
2500 IF INT((Y-1853)/4)<11 THEN 2530
2510 C1=-1
2520 GOTO 2540
2530 C1=0
2540 J1=365*(Y-1853)+D+30*(M+9)+INT((M+10)/2)
2550 J2=INT((Y-1853)/4)+1+C1
2560 GOTO 2680
2570 IF INT((Y-1852)/4)<11 THEN 2600
2580 C1=-1
2590 GOTO 2610
2600 C1=0
2610 IF M=9 THEN 2650
2620 IF M=11 THEN 2650
2630 C2=0
2640 GOTO 2660
2650 C2=1
2660 J1=365*(Y-1852)+D+30*(M-3)+INT((M-2)/2)
2670 J2=INT((Y-1852)/4)+C1+C2
2680 J=J1+J2
2690 JD#=J+2397547.5#
2700 GOSUB 4450:REM FOR MOON DISTANCE CALCULATIONS
2710 T1=J-17472.5
2720 REM MAIN CALCULATIONS BEGIN
2730 D9=(B-INT(B/100)*100)+INT(B/100)*60
2740 D6=(E1-INT(E1/100)*100)+INT(E1/100)*60
2750 D7=D9-D6
2760 D8=D7-I
2770 IF D7>0 THEN 2790
2780 GOTO 2820
2790 IF D8>=0 THEN 4250
2800 B=E1
2810 REM CALCULATION OF LATITUDE AND LONGITUDE OF MOON
2820 T=(B-INT(B/100)*100)/1440+INT(B/100)/24
2830 T5=T1+T
2840 K1=((.751213+.036601102#*T5)-INT(.751213+.036601102#*T5))*P5
2850 K2=((.822513+.0362916457#*T5)-INT(.822513+.0362916457#*T5))*P5
2860 K3=((.995766+.00273777852#*T5)-INT(.995766+.00273777852#*T5))*P5
2870 K4=((.974271+.0338631922#*T5)-INT(.974271+.0338631922#*T5))*P5
2880 K5=((.0312525+.0367481957#*T5)-INT(.0312525+.0367481957#*T5))*P5
2890 L8=K1+.658*R5*SIN(2*K4)+6.289*R5*SIN(K2)
2900 L8=L8-1.274*R5*SIN(K2-2*K4)-.186*R5*SIN(K3)
2910 L8=L8+.214*R5*SIN(2*K2)-.114*R5*SIN(2*K5)
2920 L8=L8-.059*R5*SIN(2*K2-2*K4)-.057*R5*SIN(K2+K3-2*K4)
2930 K6=K5+.6593*R5*SIN(2*K4)+6.2303*R5*SIN(K2)-1.272*R5*SIN(D2-2*K4)
2940 L7=5.144*R5*SIN(K6)-.146*R5*SIN(K5-2*K4)
2950 REM CALCULATION OF RIGHT ASCENSION (R1) AND DECLINATION (D1)
2960 D1=COS(L7)*SIN(L8)*.397821+SIN(L7)*.917463
2970 D1=ATN(D1/(SQR(1-D1^2)))
2980 G1=50+.5+((D1)/(.792))*D5
2990 G2=80+((D1)/(.808))*D5
3000 G3=141.5-((D1)*(.738)*D5)
3010 G4=170.5-((D1)*(.587)*D5)
3020 A2=COS(L7)*COS(L8)/COS(D1)
3030 A1=(COS(L7)*SIN(L8)*.917463-SIN(L7)*.397821)/COS(D1)
3040 A=ATN(A1/A2)
3050 GOSUB 3390
3060 R1=A
3070 R2=R1*57.295779#*24/360
3080 L1=.065709822#*T1
3090 L=T*24*1.002738+6.646055+(L1-INT(L1/24)*24)
3100 LA=L-(L6*24*57.295779#/360)*1.002738
3110 L=(L-INT(L/24)*24)
3120 REM CALCULATION OF GREENWICH HOUR ANGLE (G) FROM LOCAL SIDEREAL TIME
3130 G=(L/24)*P5-R1
3140 IF G<P5 THEN 3170
3150 G=G-P5
3160 GOTO 3210
3170 IF G<0 THEN 3190
3180 GOTO 3210
3190 G=G+P5
3200 REM CALCULATION OF LOCAL HOUR ANGLE (H) FROM GHA (G)
3210 H=L6-G
3220 GOSUB 4740:REM FOR PARALLAX CORRECTIONS
3230 REM CALCULATION OF ELEVATION (E) OF OBJECT
3240 E3=COS(L5)*COS(H)*COS(D1)+SIN(D1)*SIN(L5)
3250 E2=SQR(1-(E3*E3))
3260 E=ATN(E3/E2)
3270 F=E
3280 IF E<0 THEN 4200
3290 IF E>I6*R5 THEN 4200
3300 REM CALCULATION OF AZIMUTH (A) OF OBJECT
3310 A2=SIN(D1)/(COS(L5)*COS(F))
3320 A2=A2-(SIN(L5)/COS(L5))*(SIN(F)/COS(F))
3330 A1=SIN(L5)*SIN(D1)+COS(L5)*COS(D1)*COS(H)
3340 A1=(SIN(H)*COS(D1))/SQR(1-A1^2)
3350 A=ATN(A1/A2)
3360 GOSUB 3390
3370 GOTO 3540
3380 REM REMOVAL OF AMBIGUITIES INCURRED WITH ATN FUNCTION
3390 IF A=0 THEN 3410
3400 GOTO 3450
3410 IF A2<0 THEN 3430
3420 GOTO 3530
3430 A=P5/2
3440 GOTO 3530
3450 IF A>0 THEN 3510
3460 IF A2<0 THEN 3490
3470 A=P5+A
3480 GOTO 3530
3490 A=P5+(A-P5/2)
3500 GOTO 3530
3510 IF A2=>0 THEN 3530
3520 A=A+P5/2
3530 RETURN
3540 IF (T-I1)> (2*I)/1440 THEN 3560
3550 GOTO 3580
3560 PRINT
3570 IF WW$="YES" THEN LPRINT " "
3580 Z1=INT(A*D5*10+.5)/10
3590 Z2=INT(E*D5*10+.5)/10
3600 Z3=INT(G*D5*10+.5)/10
3610 Z4=INT(D1*D5*10+.5)/10
3620 IF Z4<0 THEN 3750
3630 IF Z3<G1 THEN 3750
3640 IF Z3>G2 THEN 3660
3650 GOTO 3690
3660 IF Z3<G3 THEN 3710
3670 IF Z3>G4 THEN 3750
3680 GOTO 3730
3690 Y$="U"
3700 GOTO 3760
3710 Y$="W"
3720 GOTO 3760
3730 Y$="J"
3740 GOTO 3760
3750 Y$=" "
3760 AT$="000"
3770 BT$="00"
3780 CT$="0"
3790 BS=INT(B+.5)
3800 IF BS<10 THEN BS$=AT$+RIGHT$(STR$(BS), 1):GOTO 3840
3810 IF BS<100 THEN BS$=BT$+RIGHT$(STR$(BS), 2):GOTO 3840
3820 IF BS<1000 THEN BS$=CT$+RIGHT$(STR$(BS), 3):GOTO 3840
3830 BS$=RIGHT$(STR$(BS), 4)
3840 IF TD>0 OR TD/100=INT(TD/100)THEN TC=TD: GOTO 3860
3850 TC=TD+2360
3860 ES=BS+TC
3870 IF ES>2400 THEN ES=ES-2400
3880 IF ES<=0 THEN ES=ES+2400
3890 IF ES<10 THEN ES$=AT$+RIGHT$(STR$(ES), 1):GOTO 3930
3900 IF ES<100 THEN ES$=BT$+RIGHT$(STR$(ES), 2):GOTO 3930
3910 IF ES<1000 THEN ES$=CT$+RIGHT$(STR$(ES), 3):GOTO 3930
3920 ES$=RIGHT$(STR$(ES), 4)
3930 IF LA<0 THEN LA=LA+24
3940 IF LA>24 THEN LA=LA-24
3950 LB=100*INT(LA)
3960 LC=60*(LA-INT(LA))
3970 IF LC-INT(LC)=>.5 THEN LC=INT(LC)+1 ELSE LC=INT(LC)
3980 IF LC=>60 THEN LC=0:LB=LB+100
3990 LD=LB+LC
4000 IF LD>2400 THEN LD=LD-2400
4010 LB$=STR$(LD)
4020 IF LD<10 THEN LB$=AT$+RIGHT$(LB$, 1):GOTO 4060
4030 IF LD<100 THEN LB$=BT$+RIGHT$(LB$, 2):GOTO 4060
4040 IF LD<1000 THEN LB$=CT$+RIGHT$(LB$, 3):GOTO 4060
4050 LB$=RIGHT$(LB$, 4)
4060 Z1$="###.#"
4070 Z2$="##.#"
4080 Z3$="###.#"
4090 Z4$="+##.#"
4100 PRINT TAB(1)"";BS$;
4110 PRINT TAB(7) Z3;
4120 PRINT TAB(16)Z4;
4130 PRINT Y$;
4140 PRINT TAB(27)LB$;
4150 PRINT TAB(37)"";ES$;
4160 PRINT TAB(45)Z1;
4170 PRINT TAB(55)Z2;
4180 IF WW$="YES" THEN LPRINT TAB(1)"";BS$;:LPRINT TAB(7)Z3;:LPRINT TAB(16)Z4;:LPRINT Y$;:LPRINT TAB(27)LB$;:LPRINT TAB(37)ES$;:LPRINT TAB(45)Z1;:LPRINT TAB(55)Z2;
4190 I1=T
4200 B=B+I
4210 Z=(B-INT(B/100)*100)-60
4220 IF Z<0 THEN 2730
4230 B=INT(B/100)*100+100+Z
4240 GOTO 2730
4250 RX=R2
4260 IF RX<0 THEN RX=RX+24
4270 IF RX>24 THEN RX=RX-24
4280 RA=100*INT(RX)
4290 RB=60*(RX-INT(RX))
4300 IF RB-INT(RB)=>.5 THEN RB=INT(RB)+1 ELSE RB=INT(RB)
4310 IF RB=60 THEN RB=0:RA=RA+100
4320 RC=RA+RB
4330 RY$=STR$(RC)
4340 IF RC<10 THEN RY$=AT$+RIGHT$(RY$, 1)
4350 IF RC<100 THEN RY$=BT$+RIGHT$(RY$, 2)
4360 IF RC<1000 THEN RY$=CT$+RIGHT$(RY$, 3)
4370 RY$=RIGHT$(RY$, 4)
4380 PRINT
4390 IF WW$="YES" THEN LPRINT" "
4400 PRINT"R.A. OF MOON = ";RY$; " PATH-LOSS INCREASE +";DB"DB"
4410 IF WW$="YES" THEN LPRINT "R.A. OF MOON =";RY$;" PATH-LOSS INCREASE +";DB;" DB"
4420 PRINT
4430 NEXT N
4440 END
4450 REM CALCULATE DISTANCE TO THE MOON
4460 DD#=JD#-2444238.5#
4470 AA=.98564733#
4480 ED=-3.76286
4490 MS=(AA*DD#)+ED
4500 IF MS<0 THEN MS=MS+360: GOTO 4500
4510 IF MS>360 THEN MS=MS-360:GOTO 4510
4520 AE=.1858*SIN(MS*.0174533)
4530 AF=.37*SIN(MS*.0174533)
4540 LS=(AA*DD#)+(1.9157417#*SIN(.0174533*((AA*DD#)+(-3.76286))))+278.83354#
4550 IF LS<0 THEN LS=LS+360:GOTO 4550
4560 IF LS>360 THEN LS=LS-360:GOTO 4560
4570 LL=(13.1763966#*DD#)+64.975464#
4580 IF LL <0 THEN LL=LL+360:GOTO 4580
4590 IF LL >360 THEN LL=LL-360: GOTO 4590
4600 CC=LL-LS
4610 MM=LL-(.1114041*DD#)-349.383063#
4620 IF MM<0 THEN MM=MM+360:GOTO 4620
4630 IF MM >360 THEN MM=MM-360:GOTO 4630
4640 EV=1.2739*SIN(((2*CC)-(MM))*.0174533)
4650 MN=MM+EV-AE-AF
4660 EC=6.2886*SIN(MN*.0174533)
4670 MD=383242.41#/(1+.0549*COS((MN+EC)*.017453292#))
4680 REM CONVERT DISTANCE VARIATION TO PATH-LOSS CHANGE (DB)
4690 DB=MD/356334!
4700 DB=40*LOG(DB)/LOG(10)
4710 DB=INT(DB*10+.5)/10
4720 RETURN
4730 END
4740 REM CORRECTIONS FOR PARALLAX
4750 H1=H
4760 R#=MD/6378.16
4770 U=ATN(.996647*TAN(L5))
4780 P1=.996647*SIN(U)
4790 P2=COS(U)
4800 HC=ATN((P2*SIN(H))/(R#*COS(D1)-P2*COS(H)))
4810 H=H+HC
4820 G=L6-H
4830 D1=ATN((COS(H))*((R#*SIN(D1))-P1)/((R#*COS(D1)*COS(H1))-P2))
4840 RETURN