home *** CD-ROM | disk | FTP | other *** search
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- ' ORBP.BAS
- ' Compile as .TBC file
- '
- ' O R B P
- ' ORBITAL PREDICTION PROGRAM WITH TIME WINDOWS
- ' for the IBM PC & Turbo BASIC
- ' 11/1/1987
- '871116-1
- 'Derived from an original publication in AMSAT and ORBIT magazine
- ' by Dr. Thomas A. Clark (W3IWI). See ORBIT magazine issue #6, 4/81.
- '
- 'Converted the program to Turbo BASIC. Elements are read in from the
- ' file KEPLER.ORB, which is generated directly from AMSAT's Orbital
- ' Element Bulletin contained in a file named ELEMENTS (as read from
- ' a BBS). The routine which converts ELEMENTS to KEPLER.ORB is
- ' ORBUPDAT.EXE.
- '
- 'Station data is now contained in a file named ORBS.CFG. GMST is
- ' now calculated. Sidereal time tables no longer needed.
- ' W0PN, 8/14/87
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- '
- 'Customization of Station data is accomplished by modifying the
- ' file named ORBS.CFG...
- ' Station DATA items are: <call letters>, <Lat>, <W. Lon (in degrees)>,
- ' <Height (meters)>, <min elevation to print in degrees>, <CR/LF>.
-
- ' Satellite records in KEPLER.ORB contain: <Satellite name>, <Catalog #>,
- ' <epoch [year + Julian day # + decimal portion of day]>,
- ' <Element set number (NASA)>,
- ' <epoch [inclination], [Right Ascension of Ascending Node (RAAN)]>,
- ' <epoch [eccentricity], [Argument of Perigee],>
- ' <epoch [Mean Anomaly], [Mean Motion], [Decay Rate]>,
- ' <epoch [Orbit number]>
- ' <F1 Beacon freq in MHz>(optional),
- ' <F2 Beacon freq in MHz>(optional), <CR/LF>.
- '
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
- DEFDBL A-Z
- DIM T$(20), S$(40), I$(40), C(3,2)
-
- CLS
- P% = 1 'Page counter zeroed
- LN0% = 60 'LNO% = Lines printed per page, =24 for terminal
- ln% = 0 'ln% = number of lines printed this page
- dimflag = 0 'Set to 0 to force initialization of DOWTBL
-
- DEF FNT$(D)=chr$(48+fix(D/10))+chr$(48+D-10*fix(D/10)) '2 char string
- DEF FNI(D)=D
-
- PRINT
- color 0,7
- PRINT"= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- PRINT"= =
- PRINT"= O R B S =
- PRINT"= =
- PRINT"= ORBITAL PREDICTION PROGRAM WITH TIME WINDOWS =
- PRINT"= 11/1/1987 =
- PRINT"= Ron Dunbar W0PN =
- PRINT"= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- color 7,0
- PRINT
- PRINT
- PRINT " This program prints tracking data for earth-orbiting satellites"
- PRINT
- PRINT
- PRINT tab(23);
- color 0,7
- print "SATELLITE SELECTION MENU"
- color 7,0
- PRINT
- I%=0
-
- '- - - - - Select parameters for satellite of interest - - - - -
-
- open "KEPLER.ORB" for INPUT as #1 'read Keplerians from disk
- WHILE not eof(1)
- input# 1, S$,ident,d3#,S0,D,D,D,D,D,D,D,D,D,D 'Ds are dummies
- I$ = str$(ident) 'convert for compatibility
- julian# = fix(d3#)
- gosub julian 'convert the date
- I%=I%+1
- print tab(10);STR$(I%)+".";tab(16);S$;tab(34);"ID ="I$;_
- " Set";S0;tab(58);dt$ 'display satellite selections
- WEND
- close #1
-
- '- - - now choose specific satellite - - -
-
- selsat:
- SP$="SELECT SATELLITE"
- PRINT
- PRINT tab(35-(LEN(SP$)/2));
- color 0,7
- print SP$;
- INPUT; J%
- color 7,0
- print
- PRINT
- IF J%<1 OR J%>I% THEN selsat 'Hiccup if out of bounds
-
- OPEN "KEPLER.ORB" for INPUT as #1
- FOR I%=1 TO J%
- input# 1,S$,ident,d3#,S0,incl,raan#,E0,argp,M0,mmot,drag#,K0,F1,F2
- I$ = str$(ident) 'convert for compatibility
- NEXT I%
-
- S$ = ucase$(S$) 'make sat name upper case
- CLOSE #1
-
- 'Convert d3# to Y3,d3#
- y3 = fix(d3#/1000)
- d3# = d3# - (y3*1000)
- julian# = fix(d3#)
- gosub julian 'convert the date
-
- cls
- locate 5,1
- print tab(35 - (len(S$) / 2));
- color 0,7
- print " " ; S$ ; " ";
- color 7,0
- print
- print
- print " Beacon frequencies (MHz) are [F1]";
- color 0,7
- print using "####.###";F1;
- color 7,0
- print " and [F2]";
- color 0,7
- print using "####.###";F2;
- color 7,0
- print
- print
- print "(Respond to this query with <ENTER> if F2 is NOT to be changed..)"
- INPUT "Change beacon frequency F2 to ";D9
- IF D9 > 0 THEN F2 = D9
- color 7,0
- print
-
- 'Set starting date/time, duration, stepsize and initialize
-
- INPUT "Start: year = ";yr
- yr=yr/100
- yr=fix(100*(yr-fix(yr))+.1) 'allows either YYYY or YY input
- IF yr/4=fix(yr/4) THEN F9%=1 ELSE F9%=0 'LEAP-YEAR FLAG
- IF (yr+1900)/400 = fix((yr+1900)/400) then f9% = 0 'Every 400th NOT leap!
-
- INPUT "Month(1-12) = ";M
- INPUT " Day = ";D
-
- mon = m
- day = d
- year = yr
- gosub datecalc 'get all the dates you will ever need!
-
- daynr = doy
- K79 = daynr 'k79= old day#
- D8 = doy 'Day Of Year
- DW$ = dow$
-
- PRINT "Julian date";julian#
-
- color 0,7
- IF Y3 = yr THEN getcfg ELSE PRINT "ELEMENTS NOT FROM CURRENT YEAR"
- print " Cannot continue."
- color 7,0
- STOP
-
- getcfg:
- color 7,0
- open "ORBS.CFG" for input as #1
- input# 1,C$,L9,wlong,obsrvralt,minelev,sflag 'Read station data
- close #1
-
- print
- 2280 INPUT" Start: UTC Hours= ";H
- IF H >= 24 THEN 2280
-
- INPUT" Minutes = ";M
- Stime# = D8 + H / 24 + M / 1440 'Stime# = Start Epoch
- T$ = T$ + FNT$(H) + FNT$(M) + ":00" 'For printing
-
- INPUT" Duration: Hours = ";H1
- INPUT" Minutes= ";M1
- Etime# = Stime# + H1/24 + M1/1440 'Etime# = End Epoch
-
- INPUT"Time step: Minutes= ";M2
- stepamt# = M2/1440 'stepamt# = Time step, minutes
- PRINT
-
- 2450 INPUT "Print only specific time window (y/N)";N$
- n$ = ucase$(n$) 'convert to uppercase
- IF N$ <> "Y" THEN rdphys 'not specific window
-
- 2460 INPUT "Start of window: Hours = ";SWH
- IF SWH >= 24 THEN 2460
-
- 2470 INPUT" Minutes= ";SWM
- if swm > 59 then 2470 'Do it right!
- sw# = SWH/24 + SWM/1440
- SW$ = FNT$(SWH) + FNT$(SWM) + ":00" 'start window for printing
-
- 2520 INPUT" End of window: Hours = ";EWH
- IF EWH >= 24 THEN 2520
-
- 2540 INPUT" Minutes= ";EWM
- if ewm > 59 then 2540 'Do it right!
- ew# = EWH/24 + EWM/1440
- EW$ = FNT$(EWH) + FNT$(EWM) + ":00" 'end window for printing
- PRINT
- if ew# < sw# then ew# = ew# + 1.0 'stop time is in next day
- swd# = sw# + fix(Stime#) 'set 1st start window time
- ewd# = ew# + fix(Stime#) 'set 1st window stop time
-
- rdphys:
- RESTORE 6460
-
- READ P1,C,R0,F,G0,G1 'Get physical constants
- P2 = 2 * P1
- P0 = P1/180
- F = 1/F
- g2 = gmst# 'got gmst from datesubs
-
- GOSUB initobsv 'Init Observer's vector
-
- orbs$ = "*** O R B S ***"
- lprint tab(40-(LEN(orbs$)/2));orbs$ 'center the print line
- lprint
- ln% = ln% + 2
-
- GOSUB inithdr 'Print initial header line
-
- T0# = d3# 'Epoch start
-
- SET$ = "Element set" + STR$(S0)
- lprint tab(31-(LEN(SET$)/2));SET$;" is";
- lprint using "###.#";(Stime#-T0#);
- lprint " days old"
-
- PRINT "Listing covers the period ";
- PRINT using "###.####";Stime#;
- PRINT " to ";
- PRINT using "###.####";Etime#;
- PRINT " or";
- PRINT using "####.##";(Etime# - Stime#) * 24;
- PRINT " hrs."
- locate 1,1
- print " ";
- print " "
- locate 1,49
- print "Julian search time:"
-
- lprint tab(15) "Listing covers the period ";
- lprint using "###.####";Stime#;
- lprint " to ";
- lprint using "###.####";Etime#;
- lprint " or";
- lprint using "####.##";(Etime# - Stime#) * 24;
- lprint " hrs."
- lprint tab(15) "This listing run at ";TIME$;" on ";DATE$+"."
- lprint
-
- lprint
- lprint tab(15) "PARAMETER";tab(35);"REFERENCE";tab(55);"STARTING"
- lprint tab(15) "---------";tab(35);"---------";tab(55);"--------"
- I = I + 1
-
- time# = Stime#
- GOSUB ncsub 'Update elements to current epoch
- GOSUB nmsub 'Evaluate Mean Anomaly, calc orbit number
-
- lprint tab(15) "Catalog number";tab(35);I$
- lprint tab(15) "Epoch ";
- lprint tab(35);using "#####.########";(Y3 * 1000) + T0#;_
- tab(55);(yr * 1000) + Stime#
- lprint tab(15) "Inclination ";
- lprint tab(35);using "###.####";incl ;
- lprint tab(55);" [ No change ]"
- lprint tab(15) "R. A. A. N. ";
- lprint tab(35);using "###.####";raan# ;tab(55);traan#
- lprint tab(15) "Eccentricity ";
- lprint tab(35);using "#.########";E0;
- lprint tab(55);" [ No change ]"
- lprint tab(15) "Arg. Perigee";
- lprint tab(35);using "###.####";argp ;tab(55);targp
- lprint tab(15) "Mean Anomaly ";
- lprint tab(35);using "###.####";M0;tab(55);manom/P0
- lprint tab(15) "Mean Motion ";
- lprint tab(35);using "##.########";mmot ;tab(55);tmmot
- lprint tab(15) "Drag Correction";tab(35);drag#;tab(55);" [ No change ]"
- lprint tab(15) "Orbit number";tab(35);K0;tab(55);orbnr
- lprint tab(15) "S.M.A.,(km)";
- lprint tab(35);using "#####.####";sma;tab(55);tsma
- lprint tab(15) "Perigee Ht, km";
- lprint tab(35);using "#####.####";sma*(1-E0)-R0;tab(55);tsma*(1-E0)-R0
- lprint tab(15) "Apogee Ht, km";
- lprint tab(35);using "#####.####";sma*(1+E0)-R0;tab(55);tsma*(1+E0)-R0
- if f1 > 0 or f2 > 0 then lprint tab(15);"Freq (MHz) ";
- if f1 > 0 then lprint tab(35);f1;" (F1)";
- if f2 > 0 then lprint tab(55);f2;" (F2)";
- lprint
-
- IF N$ <> "Y" THEN skpprt 'not specific window
- lprint tab(13)"*************************************************************"
- lprint tab(15)"Printing only the window between ";SW$;" and ";EW$;" UTC."
- LN% = LN% + 3 'update line count
- lprint tab(13)"*************************************************************"
-
- skpprt:
- K9 = 8.999999E+09
- K8 = 8.999999E+09
- GOSUB utchdr 'print UTC, etc header
- LN% = LN% + 20
- dwc# = fix(Stime#)
-
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- '- - - Here follows the actual computation loop - - -
-
- time# = Stime# 'Can't use FOR/NEXT with double precision variables.
- d0 = 3 'disallow treset on first pass
-
- comploop:
- daynr = fix(time#) 'RRD.. 9/22/87
- IF N$ <> "Y" THEN inwindow 'Not in window mode.. prt all visible
- if time# > ewd# then 'if so, time to update both swd, ewd
- swd# = swd# + 1.0 'bump to next day
- ewd# = ewd# + 1.0 'bump to next day
- end if
-
- IF NOT (time# >= swd# AND time# <= ewd#) THEN stepadj 'not in window..skip
-
- inwindow:
- GOSUB nmsub 'Evaluate Mean Anomaly, calc orbnr
- IF orbnr = k9 THEN sameorb 'orbnr = Orbit number
- GOSUB ncsub 'Update elements to current epoch
- k8 = 8.999999E+09 'set day number to force new day prt
- k9 = 8.999999E+09 'set orb number to force new orb prt
-
- sameorb:
- GOSUB nkmsub 'Solve Kepler's equation given MA
- GOSUB nxtsub 'Calc range, velocity, az, el, SSP
-
- d = satelev - minelev 'check elevation
- if d < 0 then quickstep 'below horizon; accelerate stepping
- if d0 = 0 then treset else d0 = 2 'if quickstepping, reset time
- ' because satellite has risen
- IF k9 = orbnr AND daynr = k8 THEN nochg 'If no chg in orb or day, skip
- IF k9 = orbnr THEN chkpage ELSE k9 = orbnr 'If just new day, print
- GOSUB neworbit 'new orbit heading
- GOTO chkpage 'skip around next two routines
-
- '- - - - - - - - - - - - - - - - - - - - -
- treset: 'This code resets time to be in sync
- time# = time# - dsave
- steps = fix((time# - fix(time#)) / stepamt#)
- time# = fix(time#) + (stepamt# * steps)
- if time# < Stime# then time# = Stime# 'Don't back up too far
- d0 = 1
- locate 1,70
- color 0,7
- print using "####.###";time# 'show julian time upper right screen
- color 7,0
- goto comploop 'recalc & test new step
- '- - - - -
- quickstep: 'This algorithm speeds the stepping
- if d0 = 1 then stepadj else d = range * d^2 * 1e-09
- d0 = 0
- if d > 0.2/mmot then time# = time# + 0.2/mmot else time# = time# + d
- dsave = d 'save quickstep step amount for Treset
- goto stepadj
- 'D0 = 0 :below horizon, in Quickstep mode
- 'D0 = 1 :time has just been re-synced
- 'D0 = 2 :above horizon, time in step
- '- - - - - - - - - - - - - - - - - - - - -
- chkpage:
- IF (LN0% - LN%) < 5 THEN GOSUB newpage ELSE lprint; 'need new page?
- IF LN% < 5 THEN 5740 ELSE lprint;
- IF fix(time#) = dwc# THEN 5120
-
- dwc# = fix(time#)
- julian# = fix((yr * 1000) + dwc#)
-
- gosub julian 'get all the dates again
- daynr = fix(time#) 'daynr = Day number (integer)
-
- 5120 lprint tab(5); "- - - Orbit #";orbnr;"- - - Day #";julian#;_
- "- - - ";dow$;",";dt$;" - - -"
- LN% = LN%+1
-
- nochg:
- K8 = daynr
- T4 = time# - daynr
- S4 = fix(T4 * 86400! + .5)
- H4 = fix(S4/3600 + .000001)
- M4 = fix((S4 - H4 * 3600) / 60 + .000001)
- S4 = S4 - 3600 * H4 - 60 * M4
- T$ = FNT$(H4) + FNT$(M4) + ":" + FNT$(S4) 'Printable time string
- F9 = -F1 * 1000000! * velocity / C '=Doppler F1 * VELOCITY/C
- F10 = -F2 * 1000000! * velocity / C '=Doppler F2 * VELOCITY/C
- IF LN%> = LN0% THEN GOSUB 5740
-
- LN% = LN% + 1
- lprint tab(4)T$; 'print the detail line
- lprint using "#####";FNI(az),
- lprint using "####";FNI(satelev),
- lprint using "+########";FNI(F9),
- lprint using "+########";FNI(F10),
- lprint using "#######";FNI(range),
- lprint using "######";FNI(R-R0),
- lprint using "#####.#";FNI(L5),
- lprint using "####.#";FNI(W5),
- lprint using "#####";M9;
- lprint " ";
- IF F2 = 0 THEN f2skip
-
- FTK = (F2 * velocity / C) + F2 'print tracking freq
- lprint using "####.###";FTK;
-
- f2skip:
- lprint
-
- stepadj:
- time# = time# + stepamt# 'Update time by [stepamt#]
- locate 1,70
- color 0,7
- print using "####.###";time#; 'show julian day/time
- color 7,0
- if satelev < minelev then visible = 0 else visible = 1
- print using "##";visible '=1 if above min elevation
-
- IF time# < Etime# THEN GOTO comploop 'This replaces NEXT
-
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
- PRINT "END OF ";S$
- lprint
- lprint "End of ";S$;" listing."
- lprint chr$(12);
- PRINT chr$(7)
- cls
- locate 12,5
- print "Thanks for using the O R B S tracking program.. Ron, W0PN"
- print
- print
- RUN "orbs.exe" 'EXIT to menu program
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- newpage:
- lprint 'start new page
- LN% = LN% + 1
- IF (LN0% - LN%) <= 0 THEN 5740 ELSE newpage
-
- 5740 LN% = 1
- GOSUB prthdr 'Print header on new page
-
- neworbit:
- IF (LN0% - LN%) <= 0 THEN 5740
- IF (LN0% - LN%) < 8 THEN newpage
- IF LN% > 6 THEN 6160 'RETURN
-
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- utchdr:
- lprint
- lprint tab(4)" U T C AZ EL ";
- lprint using "####.###";F1;
- lprint " ";
- lprint using "####.###";F2;
- lprint " ";
- lprint " RANGE HEIGHT LAT LONG PHASE ";
- IF F2 = 0 THEN 5960
-
- lprint "F2 TRACK";
- 5960 lprint
- LN% = LN% + 2
- lprint tab(4)"hhmm:ss deg deg ";
- lprint "DPLR Hz DPLR Hz";
- lprint " km km deg deg <256> ";
- IF F2=0 THEN 6100 else lprint using "####.###";F2;
- 6100 lprint
- lprint
- LN% = LN% + 2
- 6160 RETURN
-
- '- - - - - Page header subroutine - - - - -
-
- prthdr:
- IF (LN0% - LN%) = LN0% - 1 THEN 6220 ELSE newpage
- 6220 P% = P% + 1
- lprint chr$(12) 'printer TOF (Top Of Forms)
-
- inithdr:
- SHDR$=S$+" Orbital Predictions"
- lprint tab(40-(LEN(SHDR$)/2)); SHDR$; tab(70); "Page #"; P%
- lprint
- lprint tab(22);"for ";C$;" at Lat:";
- lprint using "###.###"; L9;
- lprint " Lon:";
- lprint using "###.###"; wlong
- LN% = LN% + 4
- lprint
- RETURN
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- '- - - Physical and numerical constants - - -
-
- 'Pi, Velocity of Light, Earth Radius, L/Earth flattening coefficient
- 6460 DATA 3.1415926535, 2.997925E5, 6378.160, 298.25
-
- 'GM of Earth in (orbits/day)^2/KM^3 and Siderial/Solar time rate ratio
- DATA 7.5369793d13, 1.0027379093
-
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- '- - - - - Orbit determination routines - - - - -
- 'FNA
- 'Calculates inverse tangent in proper quadrant ala Fortran ATNZ
- 'cases lying in quadrants 2 and 3
-
- nasub:
- IF DX < 0 THEN Q2orQ3
- IF DX > 0 THEN Q1test
-
- 'The two cases for DX = 0
- IF DY >= 0 THEN deg90
- D = 3 * P1/2
- RETURN
-
- 'Cases lying in quadrants 1 and 4
- Q1test:
- IF DY >= 0 then Q1 ELSE Q4
- Q1:
- D = ATN(DY/DX)
- RETURN 'Q1
- Q2orQ3:
- D = P1 + ATN(DY/DX)
- RETURN 'Q2 OR Q3
- deg90:
- D = P1/2
- RETURN '90 DEG
- Q4:
- D = P2 + ATN(DY/DX)
- RETURN 'Q4
-
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 'FNC(T)
- 'Routine to initialize the C(J,K) coordinate rotation matrix
- 'and other parameters associated with the orbital elements.
-
- ncsub:
- IF mmot > .1 THEN sma = ((G0/(mmot^2))^(1/3)) 'Given mmot=Mean Motion
- IF mmot <=.1 THEN mmot = SQR(G0/(sma^3)) 'Given sma=Semi-major axis
- tmmot = mmot + 2 * (time#-T0#) * drag# 'Mean Motion at epoch time#
- tsma = ((G0/(tmmot^2))^(1/3)) 'SMA at epoch time#
- E2 = 1 - E0^2
- E1 = SQR(E2)
- Q0 = M0/360 + K0 'Q0 = initial orbit phase
-
- 'Account for nodal effects due to lumpy gravity field due to
- 'the flattened, oblate spheroid shape of Earth.
-
- K2 = 9.95 * ((R0 / tsma)^3.5) / (E2^2)
-
- 'Update elements to current epoch and evaluate their SIN/COSs
-
- S1 = SIN(incl * P0)
- C1 = COS(incl * P0) 'incl = inclination
- traan# = raan# - (time# - T0#) * K2 * C1
- S0 = SIN(traan# * P0)
- C0 = COS(traan# * P0) 'traan# = R.A.A.N.(deg) at epoch T
- targp = argp + (time# - T0#) * K2 * (2.5 * (C1^2) - 0.5)
- S2 = SIN(targp * P0)
- C2 = COS(targp * P0) 'targp = Arg of Perigee
-
- 'Set up coordinate rotation matrix for the current orbit
-
- C(1,1) = +(C2 * C0) - (S2 * S0 * C1)
- C(1,2) = -(S2 * C0) - (C2 * S0 * C1)
- C(2,1) = +(C2 * S0) + (S2 * C0 * C1)
- C(2,2) = -(S2 * S0) + (C2 * C0 * C1)
- C(3,1) = +(S2 * S1)
- C(3,2) = +(C2 * S1)
- RETURN
-
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 'DEF FNM(T)
- 'Function to evaluate manom = Mean Anomaly in 0-2PI range
- 'Revised to incl drag (drag#)
- nmsub:
- Q = Q0 + mmot * (time# - T0#) + drag# * ((time# - T0#)^2)
- orbnr = fix(Q + .000001)
- M9 = fix((Q - orbnr + .000001) * 256)
- manom = (Q - orbnr) * P2
- RETURN
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- 'DEF FNK(M)
- 'Routine to solve Kepler's equation given manom
-
- 'Returns Satellite's GeoCentric coordinates
-
- nkmsub: 'Initial trial value
- E = manom + E0 * SIN(manom) + 0.5 * (E0^2) * SIN(2 * manom)
-
- nkmsub1: 'Iteration loop solves Kepler's transcendental equation
- S3 = SIN(E)
- C3 = COS(E)
- R3 = 1 - E0 * C3
- M1 = E - E0 * S3
- M5 = M1 - manom
- IF ABS(M5) < 9.999999E-06 THEN nkmsub2 ELSE E = E - M5/R3
- GOTO nkmsub1
-
- nkmsub2:
- X0 = tsma * (C3 - E0)
- Y0 = tsma * E1 * S3
- R = tsma * R3 'In the plane of the orbit
- X1 = X0 * C(1,1) + Y0 * C(1,2)
- Y1 = X0 * C(2,1) + Y0 * C(2,2)
- Z1 = X0 * C(3,1) + Y0 * C(3,2)
-
- 'Rotate through current GHA of Aries, convert to Geocentric coordinates
-
- G7 = time# * G1 + G2
- G7 = (G7 - fix(G7)) * P2
- S7 = -SIN(G7)
- C7 = COS(G7)
- X = +(X1 * C7) - (Y1 * S7)
- Y = +(X1 * S7) + (Y1 * C7)
- Z = Z1
- RETURN
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- 'DEF FNO(D)
- 'Routine to evaluate observer's geocentric coordinates, where
- 'X-Axis=Greenwich, Y-Axis goes thru India, Z-Axis=North Pole
-
- initobsv:
- L8 = L9 * P0 'obsrvralt=Height in meters
- S9 = SIN(L8) 'wlong= West Longitude
- C9 = COS(L8) 'Initial geocentric coordinates
- S8 = SIN(-wlong * P0)
- C8 = COS(wlong * P0)
- R9 = R0 * (1 - (F/2) + (F/2) * COS(2 * L8)) + obsrvralt/1000
-
- 'Now to make L8 the geocentric latitude
-
- L8 = ATN((1 - F)^2 * S9/C9)
- Z9 = R9 * SIN(L8)
- X9 = R9 * COS(L8) * C8
- Y9 = R9 * COS(L8) * S8
- RETURN
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- 'DEF FNX(T)
- 'Routine to extract all the parameters you might never need
-
- 'First get vector from observer to satellite
- nxtsub:
- X5 = (X - X9)
- Y5 = (Y - Y9)
- Z5 = (Z - Z9)
- range = SQR(X5^2 + Y5^2 + Z5^2)
-
- 'Finite difference the range (range) to get the velocity (velocity)
-
- IF oldtime <> time# THEN
- velocity = ((oldrange - range)/(oldtime - time#))/86400!
- ELSE
- velocity = -8.999999E+09
- END IF
-
- oldrange = range 'Save current time and range for next time
- oldtime = time#
-
- 'Now rotate into observer's local coordinates
- 'where X8 = North, Y8 = East, Z8 = Up (Left handed system)
-
- Z8 = +(X5 * C8 * C9) + (Y5 * S8 * C9) + (Z5 * S9)
- X8 = -(X5 * C8 * S9) - (Y5 * S8 * S9) + (Z5 * C9)
- Y8 = +(Y5 * C8) - (X5 * S8)
- S5 = Z8/range
- C5 = SQR(1 - S5 * S5)
- satelev = (ATN(S5/C5))/P0 'satelev=Elevation
- DX = X8
- DY = Y8
- GOSUB nasub
-
- az = D/P0 'FNA resolves quadrant az = Azimuth
- DX = X
- DY = Y
- GOSUB nasub
-
- W5 = 360 - D/P0 'W5=Subsatellite point W.Long
- B5 = Z/R
- L5 = ATN(B5/(SQR(1 - B5^2)))/P0 'L5=SSP LAT
- RETURN '---NOTE R-R0=Sat. altitude above mean spheroid
-
- '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- 'FNT and FNI moved to front of program so they'll be initialized.
-
- '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
- $include "DATESUBS.BAS"
-
-
- '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-
- ' LABEL CROSS REFERENCE
-
- ' OLD NEW OLD NEW
- '-----------------------------------------------------------
- ' A0 tsma O traan
- ' E8 minelev O0 raan
- ' E9 satelev R5 range
- ' K orbnr R6 oldrange
- ' K8 (dayNRsav) R8 velocity
- ' K9 (orbNRsav) T time#
- ' M manom T6 oldtime
- ' N tmmot W targp
- ' N0 mmot W0 argp
- '