C$Procedure Firstguess C subroutine firstguess ( STRAT, ORBIT, DATE, TIMTGT, & BOUNDS, JEARTH, LTOP, LSFLAG, n_ref_orbits, & equator_xings, DELTAV ) C C C******************************************************************************* C C Copyright (C) 1993, California Institute of Technology. U.S. C Government Sponsorhip under NASA Contract NAS7-918 is C acknowledged. C C******************************************************************************* C C$ Log C C Date Name Description C ----------------------------------------------------------------------------- C 13 Aug 1991 Bruce Shapiro create firstguess C C$ Purpose C C Determines a first guess at the delta v required based upon a constant C density approximation and a given targeting method. C C$ Input_Arguments C C Name Type Dim Units Description C ----------------------------------------------------------------------------- C STRAT C*6 1 - see GTARG C ORBIT DP 6 km,deg input orbit of (a,e,i,LAN,w,M) C DATE C*25 1 --> input epoch of ORBIT in TIMETRANS format C 'dd-mmm-yyyy hh:mm:ss.fff C BOUNDS DP 2 km boundary of the valid ground track band C as measured C from the reference ground track. Usually, C BOUNDS will be something like -/+ 1 km. C But, BOUNDS could be (.5,1.5), i.e., fully C right of the reference ground track. C TIMTGT DP 1 days if STRAT='EAST' or STRAT='WEST', then C TIMTGT is the desired target time to the C east or west boundary. C JEARTH DP (2:29) Earth gravity coefficients C LTOP I 1 size of gravity field (up to 17) C LSFLAG L 1 True/false use lunar/solar perturbations C n_ref_orbits i 1 Number of crossings in equator_xings C equator_xings DP n_ref_orbist reference equator crossings in deg C C$ Output_Arguments C C Name Type Dim Units Description C ----------------------------------------------------------------------------- C DELTAV DP 1 mm/sec guess at deltav C C$ Namelist_Output C C none C C$ Library_Links C C Entry Point Name Location C ----------------------------------------------------------------------------- C sidang TPXORB C MNODES gtarg C RNG360 C ORBBP TPXORB C SUNORB TPXORB C B2DRAG TPXLIB C CRMGET GTARG C dclose TPXUTIL C C common area C double precision earth_rad ! in kilomters double precision earth_freq ! radians / second double precision earth_rate ! meters / day double precision mu_earth ! km**3/sec double precision mu_moon ! km**3/sec double precision mu_sun ! km**3/sec double precision sid_day ! seconds double precision deg2km ! kilometers/deg common / physical_constants / & earth_rad, earth_freq, earth_rate, mu_earth, & mu_moon, mu_sun, sid_day, deg2km C$ Parameters C C MU = GM_EARTH in KM**3/SEC**2 C C DOUBLE PRECISION MU C PARAMETER ( MU = 398600.44807345 ) C C DOUBLE PRECISION EARTH_RADIUS C PARAMETER ( EARTH_RADIUS = 6378.140 ) C DOUBLE PRECISION PI C PARAMETER ( PI = 3.14159265358979323846 ) C DOUBLE PRECISION SIDEREAL_DAY C PARAMETER ( SIDEREAL_DAY = 86164.09055 ) DOUBLE PRECISION OMEGA_EARTH C parameter ( OMEGA_EARTH = 2.0 * PI * EARTH_RADIUS * C & 86400.0/ SIDEREAL_DAY ) C DOUBLE PRECISION deg2km C parameter ( deg2km = PI * EARTH_RADIUS / 180.0 ) C C$ Declarations_of_Input_and_Output_Arguments C DOUBLE PRECISION ORBIT ( 6 ) DOUBLE PRECISION BOUNDS ( 2 ) double precision jearth ( 2:29 ) CHARACTER*25 DATE CHARACTER*6 STRAT DOUBLE PRECISION TIMTGT DOUBLE PRECISION DELTAV logical LSFLAG integer LTOP integer n_ref_orbits double precision equator_xings ( n_ref_orbits ) C C$ Declarations_of_Local_Variables C C Name Type Dim Units Description C ----------------------------------------------------------------------------- C CRM DP 1 1/km**3 rho*C_D/M C AREA DP 1 KM**2 area of drag C v DP 1 km/sec spacecraft velocity C sunstt DP 1 Sun vector C betaprime DP 1 beta abgke C alpha, beta DP 1 coefficients of g.t. equation C dl = dl + alpha * t + beta * t ** 2 double precision CRM, crmhi, crmlo double precision area double precision v double precision orbwrk ( 6 ) double precision sunstt ( 6 ) double precision betaprime, betap double precision orbnode ( 6) character * 25 timenode double precision ecl double precision delta_lambda double precision alpha, beta double precision west_bound, east_bound character * 4 hilo C C$ External_Statements C double precision sidang external sidang double precision rng360 external rng360 double precision VMAREA external VMAREA double precision ORBBP external ORBBP integer dclose external dclose C C$ Method C-& C convert from meters/day to kilomters/day C omega_earth = earth_rate/1000.0 write (8, 1000) 1000 format (/, & ' ',25x,'Targeting First Guess Report',/, & ' ',25x,'----------------------------' & ) C write (6, *) '========== First Guess Calculation ==========' C write (6, *) 'Method: ', STRAT C write (6, *) 'Semi-major axis: ', ORBIT(1) C write (6, *) 'Date: ', DATE C write (6, *) 'Time target: ', TIMTGT C write (6, *) LSFLAG C write (6, *) n_ref_orbits, ' ', equator_xings(1) call dvmove ( 6, orbit, orbwrk ) west_bound = bounds ( 1 ) east_bound = bounds ( 2 ) C C circular velocity approximation v = sqrt ( mu_earth / orbwrk (1) ) C write (6, *) 'Spacecraft vel: ', v C C get drag parameters C call SUNORB ( DATE, SUNSTT ) betaprime = orbbp ( ORBWRK, SUNSTT ) area = VMAREA ( betaprime, 'DRAG' ) / (1000.0 ** 2) call crmget ( date, CRM, crmhi, crmlo ) C write (6,*) 'SUN:', sunstt C write (6,*) 'Beta prime: ', betaprime C write (6,*) 'Area: ', area C write (6,*) 'rho * CD / M: ', CRM C C calculate current ground track position: propagate to nearest C ascending node with drag turned on C hilo = 'TRUE' call MNODES ( orbwrk, date, 1, jearth, ltop, lsflag, .true., & 0.0d0, 0.0d0, 0.0d0, & 'TRUE', orbnode, timenode, betap ) C C equator crossing longitude C ecl = rng360 ( orbnode ( 4 ) - sidang ( timenode, 0d0 ) ) ref_index = DCLOSE ( ecl, n_ref_orbits, equator_xings ) delta_lambda = ecl - equator_xings ( ref_index ) C write (6,*) 'ecl:', ecl C write (6,*) 'delta lambda:', delta_lambda if ( delta_lambda .gt. 180d0 ) then delta_lambda = delta_lambda - 360d0 else if ( delta_lambda .lt. -180d0 ) then delta_lambda = delta_lambda + 360.0d0 end if delta_lambda = delta_lambda * DEG2KM write (8, 1050) delta_lambda, betaprime, CRM 1050 format (' ',T15,' Initial Ground Track:', & T42,F10.5,' kilometers.',/, & ' ',T15, ' Constant beta prime:',T42, F10.5, & ' degrees.',/, & ' ',T15, 'Constant rho * CD / M:',T42, E14.9, & ' km**-3') beta = 0.75d0 * omega_earth * crm * area * v * 86400.0d0 if ( strat .eq. 'LONG' ) then alpha = -2.0 * sqrt ( beta * & ( delta_lambda - west_bound ) ) else if ( strat .eq. 'EAST' ) then alpha = ( delta_lambda - east_bound ) / timtgt - & beta * timtgt else if ( strat .eq. 'WEST' ) then alpha = - 2.0 * beta * timtgt end if C write (6,*) 'beta = ', beta C write (6,*) 'alpha = ', alpha deltav = ( -alpha * v / (3 * omega_earth ) ) * 1d6 write (8,1090) deltav 1090 format(' ',T15, ' First guess delta v:',T42,F10.3, & ' mm/sec.') RETURN END