TIP: Click on subject to list as thread! ANSI
echo: science
to: All
from: David Williams
date: 2006-12-18 21:37:00
subject: Satellite calculator

TID: PX/Win v3.0pr5 PX98-1028M6
 MSGID: 1:250/514 fa198954
 TZUTC: -0600
If any of you old-timers is interested... I've been playing with a 
little computer program I wrote long ago - most of it back in 1982. It 
does some calculations concerning geostationary satellites, such as the 
ones that are used for TV broadcasting. It calculates the compass 
bearing (magnetic or true) of the satellite, and its altitude (or angle 
of elevation), given the observer's latitude and longitude on the 
earth, and the longitude of the satellite on the geostationary orbit. 
So it tells you which way to point a dish to aim at the satellite. It 
also calculates the dates and times of "solar outages", which occur 
when the satellite passes in front of, or very close to, the sun in the 
sky. When this happens, radio waves from the sun get received by the 
dish, and interfere with signals from the satellite. 
  
I have recently "downgraded" the program to try to make it compatible 
with many different dialects of BASIC. I have a much nicer version 
which runs under QBasic, but that won't work in most other dialects. 
The following version *should* work under many versions of the 
language. 
  
Let me know if you find it interesting... 
  
                           dow 
  
-------------------------------------------------------- 
  
100 REM ' Satellite information calculator 
110 REM ' Calculates position in sky (compass bearing (magnetic/true) 
120 REM ' and altitude (or angle of elevation)) of any geostationary 
130 REM ' satellite, as seen from anywhere on earth. Also calculates 
140 REM ' dates and times of 'solar outages', when satellite is very 
150 REM ' close to the sun in the sky, so the sun's radio emissions 
160 REM ' can interfere with communications. 
170 PI = 4 * ATN(1): CF2 = PI / 182.5: CF = PI / 180 
180 W1 = 12 * CF2: R = 6.615: CLS 
190 PRINT "Use negative numbers for opposite directions." 
200 INPUT "Observer's Latitude (deg. N)"; LA 
210 INPUT "Observer's Longitude (deg. W)"; LG 
220 INPUT "Satellite's Longitude (deg. W)"; LS 
230 INPUT "Time Zone (+/- hours from GMT)"; TZ 
240 INPUT "Magnetic variation (deg. W) (0 for true bearing)"; MV 
250 PRINT : LD = (LG - LS) * CF: LR = CF * LA: LT = LR + PI / 2 
260 X = R * SIN(LD): Z = R * COS(LD): D = ABS(Z) 
270 AN = SGN(Z) * PI / 2 + LT: Y = D * COS(AN): Z = D * SIN(AN) 
280 IF Y > -1 THEN PRINT "Satellite is below horizon.": END 
290 AY = -1 - Y: AX = SQR(X * X + Z * Z): GOSUB 570: AL = AA / CF 
300 AY = X: AX = Z: GOSUB 570: BE = AA / CF + MV 
310 BE = INT(10 * BE + .5) / 10: AL = INT(10 * AL + .5) / 10 
320 BE = BE - 360 * INT(BE / 360) 
330 PRINT "Satellite's position:": PRINT "Bearing is";
BE; "degrees." 
340 PRINT "Altitude is"; AL; "degrees.": PRINT 
350 X1 = -R * SIN(LD): Y1 = -SIN(LR): Z1 = R * COS(LD) - COS(LR) 
360 C = Y1 / (.3979 * SQR(X1 * X1 + Y1 * Y1 + Z1 * Z1)) 
370 AY = C: AX = SQR(1 - C * C): GOSUB 570: AD = PI / 2 - AA 
380 AY = X1: AX = Z1: GOSUB 570: AG = AA 
390 V = 4 * (AG / CF + LG) + 60 * TZ + 720.5 
400 PRINT "Nominal solar outage dates and times:": FOR J = 0 TO 1 
410 U = 182: L = 364 * J: FOR K = 1 TO 20: D = (U + L) / 2 
420 G = CF2 * D: A = G + .0334 * SIN(G - W1) 
430 IF ABS(U - L) < .1 THEN K = 20: GOTO 450 
440 IF ABS(A - PI) < AD THEN U = D ELSE L = D 
450 NEXT: B = (ATN(TAN(A) / .9174) - G) / PI: E = B - INT(B + .5) 
460 T = INT(V + E * 720): T = T - 1440 * INT(T / 1440) 
470 HI = INT(T / 60): MI = T - 60 * HI: D = D - 40 + TZ / 24 
480 DI = INT(D): Q = D - DI - T / 1440: P = 1 
490 IF ABS(Q) > .5 THEN DI = DI + SGN(Q) 
500 L = VAL(MID$(" 28 31122 31 30999", P, 3)) 
510 IF DI <= L THEN GOTO 530 
520 DI = DI - L: P = P + 3: GOTO 500 
530 MN$ = MID$("FebMarAprAugSepOct", P, 3) + " " 
540 PRINT MN$; DI; TAB(20); HI; "h. "; MI; "m.": NEXT: PRINT 
550 PRINT "Outages occur a few days before and after nominal dates," 
560 PRINT "and for a few minutes before and after nominal times.": END 
570 IF AX = 0 THEN AA = SGN(AY) * PI / 2: RETURN 
580 AA = ATN(AY / AX): IF AX < 0 THEN AA = AA + PI 
590 RETURN 
  
---------------------------------------------------------- 
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)
SEEN-BY: 633/267 270
@PATH: 261/1 38 123/500 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.