def test_hyperbolic_orbits_1(self): o = Orbit( i = 0.14170287439640022, Ω = 3.978394514307273, ω = 0.22281479333802098, e = 1.077961355413604, a = -8856935.204227254, M0 = -6.003136275330101, t0 = 34056451.522458464, body = CelestialBody( name = 'kerbin', equatorial_radius = 600000.0, gravitational_parameter = 3531600035840.0, rotational_speed = 0.0002908894093707204, ), ) t = o.epoch tpe = o.time_to_periapsis_at_epoch npoints = 10 tmin = t + tpe - 30 tmax = t + tpe + 30 tt = np.linspace(tmin,tmax,npoints) lat = o.latitude_at_time(tt) / deg lon = o.longitude_at_time(tt) / deg r = o.radius_at_time(tt)
def setup_orbit(): b = CelestialBody( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.periapsis = 6600*km o.speed_at_periapsis = 1.2 * b.escape_speed(6600*km) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.eccentricity = 1 o.periapsis = 7000*km return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.position_at_epoch = (-5368*km, -1784*km, 3691*km) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.position_at_epoch = -6045*km, -3490*km, 2500*km o.velocity_at_epoch = -3.457*km, 6.618*km, 2.533*km return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.position_at_epoch = (8182.4*km, -6865.9*km, 0) o.velocity_at_epoch = (0.47572*km, 8.8116*km, 0) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.position_at_epoch = (7000*km, 9000*km, 0) o.velocity_at_epoch = (-5*km, 7*km, 0) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.position_at_epoch = (7000*km,-12124*km,0) o.velocity_at_epoch = (2.6679*km,4.6210*km,0) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.position_at_epoch = (1600*km, 5310*km, 3800*km) o.velocity_at_epoch = (-7.350*km, 0.4600*km, 2.470*km) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.e = 0.3 o.h = 60000*km**2 o.θ0 = 120*deg return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.radius_at_epoch = 14600*km o.speed_at_epoch = 8.6*km o.flight_path_angle_at_epoch = 50*deg return o
def setup_orbit(): b = CelestialBody( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.radius_at_epoch = 7200*km o.radial_speed_at_epoch = 1*km o.semi_major_axis = 10000*km o.i = 0 o.Ω = 0 o.ω = 0 return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b, pe_alt = 500*km, ap_alt = 5000*km) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, rotational_speed = 72.9217e-6, ) o = Orbit(body=b) return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) z1 = 1545*km θ1 = 126*deg z2 = 852*km θ2 = 58*deg return Orbit.from_altitude_at_true_anomaly(z1,θ1,z2,θ2,b)
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) oe = Bunch( body = b, periapsis_altitude = 400*km, apoapsis_altitude = 4000*km, ) return Orbit(**oe)
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) return Orbit(body=b, orbit_type = OrbitType.parabolic, vpe = 10*km, θ0 = 0, t0 = 0, i = 0, Ω = 0, ω = 0)
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) return Orbit(body=b, vpe = 15*km, pe_alt = 300*km, θ0 = 0, t0 = 0, i = 0, Ω = 0, ω = 0)
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b, epoch = 0, h = 80000*km**2, e = 1.4, i = 30*deg, Ω = 40*deg, ω = 60*deg, θ0 = 30*deg) return o
def setup_orbit(): return Orbit( i = 0.14, Ω = 3.9, ω = 0.2, e = 0.1, a = 8850000, M0 = 5, t0 = 34000000, body = CelestialBody( name = 'kerbin', equatorial_radius = 600000.0, gravitational_parameter = 3531600035840.0, rotational_speed = 0.0002908894093707204, ), )
def test_pe_speed(self): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) ee = np.linspace(0,2,50) apo = [] vpe = [] for e in ee: o = Orbit(body=b,pe=7000*km,e=e) apo.append(o.apoapsis_altitude) vpe.append(o.speed_at_periapsis) apo = np.array(apo)/(km*km) vpe = np.array(vpe)/km '''
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3, ) o = Orbit(body=b) o.pe = 9600*km o.ap = 21000*km o.epoch = 0 o.θ0 = 0 return o
def setup_orbit(): b = Bunch( equatorial_radius = 6378*km, gravitational_parameter = 398600*km**3) o = Orbit(body=b) o.epoch = 0 o.true_anomaly_at_epoch = 30*deg o.radius_at_epoch = 10000*km o.speed_at_epoch = 10*km return o
def test_hyperbolic_orbits_2(self): # same orbit pulled from KSP at different times # lots of jitter, so tolerance for radius at time # is quite large (1%) o1 = Orbit( i = 0.14149227768205455, Ω = 3.977254620789031, ω = 0.22395653996553322, e = 1.0779572208620696, a = -8855744.039847286, M0 = -6.0078569863130475, t0 = 34056398.642449796, body = CelestialBody( name = 'Kerbin', equatorial_radius = 600000.0, gravitational_parameter = 3531600035840.0, rotational_speed = 0.0002908894093707204, ), ) o2 = Orbit( i = 0.14311811324451928, Ω = 3.9859850089566558, ω = 0.21660875587091438, e = 1.07736727693924, a = -8880527.593801336, M0 = -0.012499818155590287, t0 = 34140525.998688884, body = CelestialBody( name = 'Kerbin', equatorial_radius = 600000.0, gravitational_parameter = 3531600035840.0, rotational_speed = 0.0002908894093707204, ), ) tpe1 = o1.time_to_periapsis_at_epoch tpe2 = o2.time_to_periapsis_at_epoch self.isclose(o1.epoch+tpe1, o2.epoch+tpe2) χexpect1 = np.sqrt(-o1.a) \ * (o1.eccentric_anomaly_at_time(o1.epoch+tpe1) \ - o1.eccentric_anomaly_at_epoch) χexpect2 = np.sqrt(-o2.a) \ * (o2.eccentric_anomaly_at_time(o2.epoch+tpe2) \ - o2.eccentric_anomaly_at_epoch) tt = np.linspace(o1.epoch,o1.epoch+1*6*60*60,50) χχexpect = np.sqrt(-o1.a) \ * (o1.eccentric_anomaly_at_time(tt) \ - o1.eccentric_anomaly_at_epoch) χχ = o1.universal_anomaly_at_time(tt) t0 = o1.epoch r0 = o1.radius_at_epoch vr0 = o1.radial_speed_at_epoch a = o1.semi_major_axis x0 = o1.position_at_epoch/km v0 = o1.velocity_at_epoch #print('t0',t0) #print('r0',r0) #print('vr0',vr0) #print('a',a) #print('x0',x0) #print('v0',v0) #from matplotlib import pyplot #pyplot.plot(tt,χχexpect, color='blue') #pyplot.plot(tt[[0,-1]],χχexpect[[0,-1]], color='lightblue') #pyplot.plot(tt,χχ, color='red') #pyplot.plot(tt[[0,-1]],χχ[[0,-1]], color='pink') #pyplot.show() #print('θpe1',o1.true_anomaly_at_time(o1.epoch+tpe1)) #print('θpe2',o2.true_anomaly_at_time(o2.epoch+tpe2)) #print('rpeθ1',o1.radius_at_true_anomaly( #o1.true_anomaly_at_time(o1.epoch+tpe1))) #print('rpeθ2',o2.radius_at_true_anomaly( #o2.true_anomaly_at_time(o2.epoch+tpe2))) f1,g1,df1,dg1 = o1.lagrange_coefficients_at_time(o1.epoch+tpe1) f2,g2,df2,dg2 = o2.lagrange_coefficients_at_time(o2.epoch+tpe2) x1 = o1.position_at_lagrange_coefficients(f1,g1) x2 = o2.position_at_lagrange_coefficients(f2,g2) #print('rpe1(χexp)',np.sqrt(sum(x1**2))) #print('rpe2(χexp)',np.sqrt(sum(x2**2))) self.isclose(o2.periapsis, o2.radius_at_time(o2.epoch+tpe2)) self.isclose(o1.periapsis, o1.radius_at_time(o1.epoch+tpe1)) self.isclose(o1.periapsis, o2.periapsis,rtol=1e-2) self.isclose(o1.radius_at_time(o1.epoch+tpe1), o2.radius_at_time(o2.epoch+tpe2), rtol=0.01)