コード例 #1
0
def test_propagate_with_lunar_third_body():
    x = [66666, 0, 0, 0, 2.451, 0]
    dt = 8600
    r = x[0:3] * u.km
    v = x[3:6] * u.km / u.s
    epoch = Time(2454283.0, format="jd", scale="tdb")
    epoch_f = epoch + (dt * u.s)
    prop_params = PropParams(epoch)
    prop_params.add_perturbation(Perturbations.Moon,
                                 build_lunar_third_body(epoch))

    k_moon = Moon.k.to(u.km**3 / u.s**2).value
    body_moon = build_ephem_interpolant(
        Moon,
        lunar_period, (epoch.value * u.day, epoch.value * u.day + 60 * u.day),
        rtol=1e-2)
    sat_i = Orbit.from_vectors(Earth, r, v, epoch=epoch)
    sat_f = sat_i.cov_propagate(dt * u.s,
                                method=cowell,
                                ad=third_body,
                                k_third=k_moon,
                                third_body=body_moon)
    x_poli = np.concatenate([sat_f.r.value, sat_f.v.value])

    x_custom = state_propagate(np.array(x), epoch_f, prop_params)
    assert np.array_equal(x_custom, x_poli)
コード例 #2
0
def test_propagate_with_drag():
    x = [66666, 0, 0, 0, 2.451, 0]
    dt = 100 * u.s
    r = x[0:3] * u.km
    v = x[3:6] * u.km / u.s
    epoch = Time(2454283.0, format="jd", scale="tdb")
    epoch_obs = epoch + dt
    C_D = 1
    A = 10
    m = 1000
    Drag = build_basic_drag(C_D, A, m)
    prop_params = PropParams(epoch)
    prop_params.add_perturbation(Perturbations.Drag, Drag)

    sat_i = Orbit.from_vectors(Earth, r, v, epoch=epoch)
    sat_f = sat_i.cov_propagate(dt,
                                method=cowell,
                                ad=atmospheric_drag,
                                R=R,
                                C_D=C_D,
                                A=A,
                                m=m,
                                H0=H0_earth,
                                rho0=rho0_earth)
    x_poli = np.concatenate([sat_f.r.value, sat_f.v.value])

    x_custom = state_propagate(x, epoch_obs, prop_params)
    assert np.array_equal(x_custom, x_poli)
コード例 #3
0
def test_propagate_with_srp():
    x = [66666, 0, 0, 0, 2.451, 0]
    dt = 1 * u.day
    r = x[0:3] * u.km
    v = x[3:6] * u.km / u.s
    epoch = Time(2454283.0, format="jd", scale="tdb")
    epoch_obs = epoch + dt
    C_R = 1
    A = 10
    m = 1000
    srp = build_srp(C_R, A, m, epoch)
    prop_params = PropParams(epoch)
    prop_params.add_perturbation(Perturbations.SRP, srp)

    body_sun = build_ephem_interpolant(
        Sun,
        solar_period, (epoch.value * u.day, epoch.value * u.day + 60 * u.day),
        rtol=1e-2)

    sat_i = Orbit.from_vectors(Earth, r, v, epoch=epoch)
    sat_f = sat_i.cov_propagate(dt,
                                method=cowell,
                                ad=radiation_pressure,
                                R=R,
                                C_R=C_R,
                                A=A,
                                m=m,
                                Wdivc_s=Wdivc_sun.value,
                                star=body_sun)
    x_poli = np.concatenate([sat_f.r.value, sat_f.v.value])

    x_custom = state_propagate(x, epoch_obs, prop_params)
    assert np.array_equal(x_custom, x_poli)
コード例 #4
0
ファイル: util.py プロジェクト: ausogle/astroThes
def get_satellite_position_over_time(x, epoch, tf, dt) -> np.matrix:
    t = np.arange(0, tf, dt)
    r = np.zeros((len(t), 3))
    prop_params = PropParams(dt, epoch)
    for i in range(0, len(t)):
        r[i] = x[0:3]
        x = state_propagate(x, prop_params)
        prop_params.epoch = prop_params.epoch + prop_params.dt
    return r
コード例 #5
0
def test_propagate_with_j2j3():
    x = [66666, 0, 0, 0, 2.451, 0]
    dt = 100 * u.day
    r = x[0:3] * u.km
    v = x[3:6] * u.km / u.s
    epoch = Time(2454283.0, format="jd", scale="tdb")
    epoch_obs = epoch + dt

    prop_params = PropParams(epoch)
    prop_params.add_perturbation(Perturbations.J2, build_j2())
    prop_params.add_perturbation(Perturbations.J3, build_j3())

    sat_i = Orbit.from_vectors(Earth, r, v, epoch=epoch)
    sat_f = sat_i.cov_propagate(dt,
                                method=cowell,
                                ad=a_d_j2j3,
                                J2=Earth.J2.value,
                                R=R,
                                J3=Earth.J3.value)
    x_poli = np.concatenate([sat_f.r.value, sat_f.v.value])

    x_custom = state_propagate(x, epoch_obs, prop_params)
    assert np.array_equal(x_custom, x_poli)
コード例 #6
0
def test_propagate_with_no_perturbations():
    x = [66666, 0, 0, 0, 2.451, 0]
    r = x[0:3] * u.km
    v = x[3:6] * u.km / u.s
    dt = 100 * u.day
    epoch = Time(2454283.0, format="jd", scale="tdb")
    epoch_obs = epoch + dt
    prop_params = PropParams(epoch)

    sat_i = Orbit.from_vectors(Earth, r, v, epoch=epoch)
    sat_f = sat_i.cov_propagate(dt, method=cowell)
    x_poli = np.concatenate([sat_f.r.value, sat_f.v.value])

    x_custom = state_propagate(x, epoch_obs, prop_params)
    assert np.array_equal(x_custom, x_poli)
コード例 #7
0
r_lg = np.zeros((len(t), 3))
M = n*t

for i in range(0, len(M)):
    E = M[i]
    for j in range(0, 8):
        E = E + (M[i] - E+e*np.sin(E))/(1-e*np.cos(E))
    F[i] = 1-(a/r0)*(1-np.cos(E))
    G[i] = t[i] + math.sqrt(a*a*a/mu)*(np.sin(E)-E)
    r_lg[i] = F[i]*rr0 + G[i]*vv0


#   Poliastro construction
r_poli = np.zeros((len(t), 3))
epoch = Time(2454283.0, format="jd", scale="tdb")
prop_params = PropParams(dt, epoch)
for i in range(0, len(t)):
    r_poli[i] = x[0:3]
    x = state_propagate(x, prop_params)
    prop_params.epoch = prop_params.epoch + prop_params.dt

#   Difference calculation
r_diff = r_lg - r_poli
diff = np.zeros((len(t), 1))
for i in range(0, len(t)):
    diff[i] = la.norm(r_diff[i])

#   Plots orbits on top of oen another
x, y, z = generate_earth_surface()
fig = plt.figure()
ax = fig.gca(projection='3d')
コード例 #8
0
r = [66666, 0, 0]
v = [0, -2.144, 1]
x = np.array([r[0], r[1], r[2], v[0], v[1], v[2]])
period = get_period(x)
dt = period / 100
tf = period / 2
epoch_obs = Time(2454283.0, format="jd", scale="tdb")
epoch_i = epoch_obs - tf * u.s

x_offset = np.array([100, 50, 10, .01, .01, .03])
obs_pos = [29.2108, 81.0228,
           3.9624]  #Daytona Beach, except 13 feet above sea level
obs_params = Observation(obs_pos, Frames.LLA, epoch_obs)
obs_params = convert_obs_params_from_lla_to_eci(obs_params)
prop_params = PropParams(tf, epoch_i)
yobs = y(state_propagate(x + x_offset, prop_params), obs_params)
x_alg = milani(x, yobs, LsqParams(np.array([1 / 100, 1 / 100])), obs_params,
               prop_params)

r_init = get_satellite_position_over_time(x, epoch_obs, tf, dt)
r_offset = get_satellite_position_over_time(x + x_offset, epoch_obs, tf, dt)
r_alg = get_satellite_position_over_time(x_alg, epoch_obs, tf, dt)

n = r_alg.shape[0] - 1
print(r_offset[n, 0])

fig = plt.figure()
ax = fig.gca(projection='3d')

x, y, z = generate_earth_surface()
コード例 #9
0
ファイル: gui.py プロジェクト: ausogle/astroThes
from astropy import units as u
from src.observation_function import y
from src.state_propagator import state_propagate

x = np.array([66666, 0, 0, 0, -2.6551, 1])
xoffset = np.array([100, 50, 10, .01, .01, .03])

epoch_i = Time("2018-08-17 12:05:50", scale="tdb")
epoch_i.format = "jd"
epoch_f = epoch_i + 112 * u.day
dt = (epoch_f - epoch_i).value
obs_position = [29.2108 * u.deg, 81.0228 * u.deg, 3.9624 * u.m
                ]  #Daytona Beach, except 13 feet above sea level (6378 km)
obs_params = Observation(obs_position, Frames.LLA, epoch_f)
obs_params = verify_locational_units(obs_params)
obs_params = convert_obs_params_from_lla_to_eci(obs_params)

prop_params = PropParams(dt, epoch_f)
prop_params.add_perturbation(Perturbations.J2, build_j2())

xobs = state_propagate(x + xoffset, prop_params)
yobs = y(xobs, obs_params)

xout = milani(x, yobs, LsqParams(), obs_params, prop_params)

print("The outcome of our algorithm is \nposition: ", xout[0:3],
      "\nvelocity: ", xout[3:6])
print("\nCompared to the original \nposition: ", x[0:3], "\nvelocity:", x[3:6])
print("\nDifference in observational values of x and xout")
print(yobs - y(state_propagate(xout, prop_params), obs_params))