def test_gravity_loss(self): # check against ... LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 maneuver = Maneuver() maneuver.orbit = LEO maneuver.C3 = -1.671 templ = 'Gravity Loss from %3dk LEO with C3 of %5.3f and T/W of %5.3f = %5.3f' TW = 0.11 print templ % (maneuver.orbit.apoapsis, maneuver.C3, TW, maneuver.gravity_loss(TW, burns=2)) TW = 0.103 print templ % (maneuver.orbit.apoapsis, maneuver.C3, TW, maneuver.gravity_loss(TW, burns=2)) TW = 0.165 print templ % (maneuver.orbit.apoapsis, maneuver.C3, TW, maneuver.gravity_loss(TW, burns=2)) TW = 0.139 print templ % (maneuver.orbit.apoapsis, maneuver.C3, TW, maneuver.gravity_loss(TW, burns=2))
def test_SKB91(self): # (check against Borowski hand calcs dated 5/24/91) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/24/91 Ex #1, TLI from 407km circular orbit with C3 = -1 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = -1 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.128, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/24/91 Ex #2, TLI from 481.5km circular orbit with C3 = 1.912 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 481.5 LEO.periapsis = 481.5 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 1.912 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.247, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/24/91 Ex #2, TLI from 485km circular orbit with C3 = 1.912 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 485 LEO.periapsis = 485 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 1.912 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.246, 0.005) # # McDDAC Lunar Shuttle Mission, "8-Burn Profile" # (check against Borowski hand calcs dated 5/27/91) # self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (1), LOI into 24hr lunar orbit') self.logger.info(' with apolune = 15.853 km, perilune = 111.12 km and C3 of 0.808 km2/s2') self.logger.info('--------------------------------------------------------------------------------') ELO = Orbit() ELO.body = 'Moon' ELO.apoapsis = 15853.12 ELO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = ELO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.808 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.2815, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (1a), 30 deg plane change from 24hr lunar orbit') self.logger.info(' with apolune = 15.853 km, perilune = 111.12 km') self.logger.info('--------------------------------------------------------------------------------') ELO = Orbit() ELO.body = 'Moon' ELO.apoapsis = 15853.12 ELO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = ELO maneuver.orbit.inclination = 30 # FIXME: quick&dirty hack, this is the maneuver not the orbit maneuver.maneuver_type = 'Plane Change' dV = maneuver.calculate_dV() assert_rel_error(self, dV, 0.119, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (2), circularize lunar orbit at periapsis starting at orbit') self.logger.info(' with apolune = 15.853 km, perilune = 111.12 km') self.logger.info('--------------------------------------------------------------------------------') ELO = Orbit() ELO.body = 'Moon' ELO.apoapsis = 15853.12 ELO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = ELO maneuver.maneuver_type = 'Circularize at Periapsis' dV = maneuver.calculate_dV() assert_rel_error(self, dV, .562, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (2), Trans Earth Injection with C3 of 1.486 km2/s2 from') self.logger.info(' 24 hr lunar orbit with apolune = 15.853 km, perilune = 111.12 km ') self.logger.info('--------------------------------------------------------------------------------') LLO = Orbit() LLO.body = 'Moon' LLO.apoapsis = 15853.12 LLO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = LLO maneuver.maneuver_type = 'Departure from Periapsis' maneuver.C3 = 1.486 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 0.415, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (3), EOC into 481.5 km circular Earth orbit with C3 of 1.378 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 481.5 LEO.periapsis = 481.5 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 1.378 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -3.221, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (4), TLI from 481.5 km circular orbit with C3 = 1.912 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 481.5 LEO.periapsis = 481.5 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 1.912 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.246, 0.005) # # "4-Burn" Lunar Shuttle Mission # (check against Borowski hand calcs dated 5/27/91) # self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (5), LOI into 111.12 km circular orbit with C3 = 0.808 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LLO = Orbit() LLO.body = 'Moon' LLO.apoapsis = 111.12 LLO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = LLO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.808 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.844, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 5/27/91 (5), Trans Earth Injection with C3 of 1.486 km2/s2 from') self.logger.info(' 24 hr lunar orbit with apolune = 15.853 km, perilune = 111.12 km ') self.logger.info('--------------------------------------------------------------------------------') LLO = Orbit() LLO.body = 'Moon' LLO.apoapsis = 111.12 LLO.periapsis = 111.12 maneuver = Maneuver() maneuver.orbit = LLO maneuver.maneuver_type = 'Departure from Periapsis' maneuver.C3 = 1.486 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 0.977, 0.005)
def test_SKB92(self): # (check against Borowski hand calcs dated 10/9/92) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2007 Cargo (1), TMI from 407km circular orbit with C3 = 13.41 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 13.41 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.776, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2007 Cargo (2), MOC into 250km x 33840km orbit with C3 = 6.35 km2/s2') self.logger.info('--------------------------------------------------------------------------------') MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Capture at Apoapsis' maneuver.C3 = 6.35 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.837, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2009 Tanker (1) TMI from 407km circular orbit with C3 = 10.30 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 10.30 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 3.640, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2009 Tanker (2) MOC into 250km x 33840km orbit with C3 = 6.10 km2/s2') self.logger.info('--------------------------------------------------------------------------------') MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Capture at Apoapsis' maneuver.C3 = 6.10 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.814, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2009 Crew (1) TMI from 407km circular orbit with C3 = 30.65 km2/s2') self.logger.info('--------------------------------------------------------------------------------') LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 30.65 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 4.506, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2009 Crew (2) MOC into 250km x 33840km orbit with C3 = 6.10 km2/s2') self.logger.info('--------------------------------------------------------------------------------') MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Capture at Apoapsis' maneuver.C3 = 27.40 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -2.508, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 10/9/92 2009 Crew (3) TEI from 250km x 33840km orbit with C3 = 17.31 km2/s2') self.logger.info('--------------------------------------------------------------------------------') MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 17.31 dV = maneuver.calculate_dV() assert_rel_error(self, dV, 1.762, 0.005)
def test_SKB00(self): # "90 Day" Study LeRC Data *All Propulsive Optimized Trajectory # 2016 Opposition Mars Mission # (check against Borowski hand calcs dated 6/30/00) # define Orbits LEO = Orbit() LEO.body = 'Earth' LEO.apoapsis = 407 LEO.periapsis = 407 MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 HEEO = Orbit() HEEO.body = 'Earth' HEEO.apoapsis = 71136 HEEO.periapsis = 500 self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 6/30/00 2016 Opposition (1), TMI from LEO with C3 = 14.06 km2/s2') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 14.06 dV_TMI = maneuver.calculate_dV() assert_rel_error(self, dV_TMI, 3.805, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 6/30/00 2016 Opposition (2), MOC into MEO with Vinf = 5.31 km/s') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Capture at Apoapsis' maneuver.C3 = 5.31**2 dV_MOC = maneuver.calculate_dV() assert_rel_error(self, dV_MOC, -2.563, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 6/30/00 2016 Opposition (3) TEI from MEO with C3 = 50.552 km2/s2') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = MEO maneuver.maneuver_type = 'Departure from Apoapsis' maneuver.C3 = 50.552 dV_TEI = maneuver.calculate_dV() assert_rel_error(self, dV_TEI, 3.978, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 6/30/00 2016 Opposition (4), EOC into HEEO with Vinf = 5.56 km/s') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = HEEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 5.56**2 dV_EOC = maneuver.calculate_dV() assert_rel_error(self, dV_EOC, -1.799, 0.005) total_dV = abs(dV_TMI) + abs(dV_MOC) + abs(dV_TEI) + abs(dV_EOC) self.logger.info('Total Ideal Delta V = '+str(total_dV)) assert_rel_error(self, total_dV, 12.145, 0.005)
def test_SKB13(self): # Borowski notes dated 3/17/13 # check against Laura Burke results in e-mail dated 9/20/12 LEO = Orbit() LEO.body = 'Earth' LEO.periapsis = 407 LEO.apoapsis = 407 LEO.inclination = 28.5 HEEO_24hr = Orbit() HEEO_24hr.body = 'Earth' HEEO_24hr.periapsis = 500 HEEO_24hr.apoapsis = 71136 HEEO_48hr = Orbit() HEEO_48hr.body = 'Earth' HEEO_48hr.periapsis = 500 HEEO_48hr.apoapsis = 120702 LLO_110 = Orbit() LLO_110.body = 'Moon' LLO_110.periapsis = 110 LLO_110.apoapsis = 110 LLO_300 = Orbit() LLO_300.body = 'Moon' LLO_300.periapsis = 300 LLO_300.apoapsis = 300
def test_SKB12(self): # check against Borowski hand calcs dated 9/17/12 # define Orbits LEO_407 = Orbit() LEO_407.body = 'Earth' LEO_407.apoapsis = 407 LEO_407.periapsis = 407 LEO_500 = Orbit() LEO_500.body = 'Earth' LEO_500.apoapsis = 500 LEO_500.periapsis = 500 LEO_700 = Orbit() LEO_700.body = 'Earth' LEO_700.apoapsis = 700 LEO_700.periapsis = 700 MEO = Orbit() MEO.body = 'Mars' MEO.apoapsis = 250 MEO.periapsis = 33840 HEEO = Orbit() HEEO.body = 'Earth' HEEO.apoapsis = 71136 HEEO.periapsis = 500 self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (1), EOC into HEEO with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = HEEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.482, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (1), EOC into HEEO with Vinf = 5.882 km/s (from Apophis)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = HEEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 5.882**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -1.950, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (2), EOC into LEO_500 with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO_500 maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -3.187, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (2), EOC into LEO_407 with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO_407 maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -3.208, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (3), EOC into LEO_500 with Vinf = 5.882 km/s (from Apophis)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO_500 maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 5.882**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -4.655, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (3), EOC into LEO_407 with Vinf = 5.882 km/s (from Apophis)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO_407 maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 5.882**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -4.668, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12 (4), EOC into LEO_700 with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') maneuver = Maneuver() maneuver.orbit = LEO_700 maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -3.143, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12, EOC into 6 hour EEO with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') EEO = Orbit() EEO.body = 'Earth' EEO.apoapsis = 20238 EEO.periapsis = 500 # check the derivation of the 6hr orbit self.logger.info(EEO.orbit_from_period(6*3600, 500)) maneuver = Maneuver() maneuver.orbit = EEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -1.203, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12, EOC into 9 hour EEO with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') EEO = Orbit() EEO.body = 'Earth' EEO.apoapsis = 30633 EEO.periapsis = 500 # check the derivation of the 9hr orbit self.logger.info('(calculated periapsis=%1.1f, apoapsis=%1.1f)' % EEO.orbit_from_period(9*3600, 500)) maneuver = Maneuver() maneuver.orbit = EEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.914, 0.005) self.logger.info('--------------------------------------------------------------------------------') self.logger.info('SKB 9/17/12, EOC into 12 hour EEO with Vinf = 0.855 km/s (from 2000SG344)') self.logger.info('--------------------------------------------------------------------------------') EEO = Orbit() EEO.body = 'Earth' EEO.apoapsis = 39910 EEO.periapsis = 500 # check the derivation of the 9hr orbit self.logger.info('(calculated periapsis=%1.1f, apoapsis=%1.1f)' % EEO.orbit_from_period(12*3600, 500)) maneuver = Maneuver() maneuver.orbit = EEO maneuver.maneuver_type = 'Capture at Periapsis' maneuver.C3 = 0.855**2 dV = maneuver.calculate_dV() assert_rel_error(self, dV, -0.755, 0.005)