示例#1
0
def test_man_tangetial_linear(tangential):

    orb = tangential

    forward = 60

    dv = 0.1
    duration = timedelta(seconds=abs(forward / dv))
    dv1 = orb.propagator._mat3 @ [0, dv, 0]
    accel = (orb.propagator._mat3 @ [-1, 0, 0]) * 2 * orb.propagator.n * dv

    man_start = orb.date + timedelta(seconds=10)
    duration = timedelta(seconds=forward / dv)
    man_stop = man_start + duration

    orb.maneuvers = [
        ImpulsiveMan(man_start, dv1),
        ContinuousMan(man_start, duration, accel=accel),
        ImpulsiveMan(man_stop, -dv1),
    ]

    # ephem = orb.ephem(stop=man_stop + timedelta(hours=1), step=timedelta(seconds=60))
    # plot_ephem(ephem)

    orb2 = orb.propagate(man_stop + timedelta(seconds=120))

    radial = 0 if orb.propagator.frame.orientation == "QSW" else 1
    tan = 1 if orb.propagator.frame.orientation == "QSW" else 0

    assert duration.total_seconds() == 600
    assert np.isclose(orb2[radial], 0)
    assert np.isclose(orb2[tan] - orb[tan], forward)
    assert orb2[2] == orb[2]
示例#2
0
def test_man_tangential_boost(tangential):

    orb = tangential

    man_start = orb.date + timedelta(seconds=60)
    man_stop = man_start + timedelta(seconds=2 * np.pi / orb.propagator.n)

    forward = 70  # Advance 70 m closer to the target
    dv = forward * orb.propagator.n / (6 * np.pi)

    orb.maneuvers = [
        ImpulsiveMan(man_start, orb.propagator._mat3 @ [0, -dv, 0]),
        ImpulsiveMan(man_stop, orb.propagator._mat3 @ [0, dv, 0]),
    ]

    # ephem = orb.ephem(stop=man_stop + timedelta(hours=1), step=timedelta(seconds=60))
    # plot_ephem(ephem)

    orb2 = orb.propagate(man_stop + timedelta(seconds=120))

    radial = 0 if orb.propagator.frame.orientation == "QSW" else 1
    tan = 1 if orb.propagator.frame.orientation == "QSW" else 0

    assert np.isclose(orb[radial], orb2[radial])
    assert np.isclose(orb2[tan] - orb[tan], forward)
    assert np.isclose(orb2[tan], -30)
    assert orb[2] == orb2[2]
示例#3
0
def test_man_impulsive(molniya_kepler):

    # Test of a circularisation of a molniya orbit
    # At apogee, this is roughly 1400 m/s

    with raises(ValueError):
        ImpulsiveMan(Date(2018, 9, 20, 13, 48, 21, 763091), (28, 0, 0, 0))

    apo = find_event(molniya_kepler.iter(stop=timedelta(hours=26),
                                         listeners=ApsideListener()),
                     'Apoapsis',
                     offset=1)
    man = ImpulsiveMan(apo.date, (1427., 0, 0), frame="TNW")

    # Check on the sensitivity of the find_event function
    apo2 = find_event(molniya_kepler.iter(start=molniya_kepler.date +
                                          timedelta(seconds=243, minutes=5),
                                          stop=timedelta(hours=26),
                                          listeners=ApsideListener()),
                      'Apoapsis',
                      offset=1)
    assert abs(apo.date - apo2.date) < timedelta(seconds=1)

    molniya_kepler.maneuvers = man

    altitude = []
    eccentricity = []
    dates = []
    for p in molniya_kepler.iter(stop=timedelta(hours=36)):
        altitude.append(p.copy(form='spherical').r - p.frame.center.body.r)
        eccentricity.append(p.copy(form="keplerian").e)
        dates.append(p.date.datetime)

    # plot_delta_a(dates, altitude, eccentricity)

    # retrieve the index of the first point after the maneuver
    man_idx = (np.array(dates) > man.date.datetime).argmax()

    alt_before = np.mean(altitude[:man_idx])
    alt_after = np.mean(altitude[man_idx:])

    ecc_before = np.mean(eccentricity[:man_idx])
    ecc_after = np.mean(eccentricity[man_idx:])

    assert abs(ecc_before - 6.47e-1) < 2e-4
    assert abs(ecc_after - 3e-3) < 2e-4
    # assert abs(ecc_after - 6.57e-4) < 1e-6

    assert str(man.date) == "2018-05-03T16:29:23.246451 UTC"

    # 8'000 km increment in altitude
    assert 8000000 < alt_after - alt_before < 8200000
示例#4
0
def test_man_hohmann(kind, lower_circular):
    """Check stability of a Hohmann transfer to nullified radial distance

    i.e. if the tangential distance does not evolve
    """

    orb = lower_circular

    man_start = orb.date + timedelta(seconds=60)
    if kind == "impulive":
        man_stop = man_start + timedelta(seconds=np.pi / orb.propagator.n)
    else:
        man_stop = timedelta(seconds=2 * np.pi / orb.propagator.n)

    delta_a = 600
    dv = 1.5 * orb.propagator.n * delta_a / 6

    if kind == "impulive":
        orb.maneuvers = [
            ImpulsiveMan(man_start, orb.propagator._mat3 @ [0, dv, 0]),
            ImpulsiveMan(man_stop, orb.propagator._mat3 @ [0, dv, 0]),
        ]
    else:
        orb.maneuvers = [
            ContinuousMan(man_start,
                          man_stop,
                          dv=2 * orb.propagator._mat3 @ [0, dv, 0]),
        ]

    # ephem = orb.ephem(stop=man_stop + timedelta(hours=1), step=timedelta(seconds=60))
    # plot_ephem(ephem)

    orb2 = orb.propagate(man_stop + timedelta(seconds=60))
    orb3 = orb.propagate(man_stop + timedelta(seconds=120))

    radial = 0 if orb.propagator.frame.orientation == "QSW" else 1
    tan = 1 if orb.propagator.frame.orientation == "QSW" else 0

    assert np.isclose(orb2[radial], orb3[radial])
    assert np.isclose(orb2[tan], orb3[tan])
    assert orb2[2] == orb3[2]

    # Propagate during the continuous maneuver
    if kind == "continuous":
        orb4 = orb.propagate(man_start + timedelta(minutes=25))
        assert orb.maneuvers[0].check(orb4.date)

        if orb.propagator.frame.orientation == "QSW":
            assert -delta_a < orb4[radial] < 0
        else:
            assert delta_a > orb4[radial] > 0
示例#5
0
def orbit_man(orbit):
    orbit = orbit.copy()
    orbit.propagator = KeplerNum(get_body("Earth"), timedelta(seconds=60))
    orbit.maneuvers = [
        ImpulsiveMan(
            Date(2008, 9, 20, 12, 41, 9, 984493),
            [280, 0, 0],
            frame="TNW",
            comment="Maneuver 1",
        ),
        ImpulsiveMan(Date(2008, 9, 20, 13, 33, 11, 374985), [270, 0, 0],
                     frame="TNW"),
    ]
    return orbit
示例#6
0
def test_man_eccentric_boost(kind, tangential):

    orb = tangential

    man_start = orb.date + timedelta(seconds=60)
    if kind == "impulive":
        man_stop = man_start + timedelta(seconds=np.pi / orb.propagator.n)
    else:
        man_stop = timedelta(seconds=2 * np.pi / orb.propagator.n)

    forward = 70  # Advance 70 m closer to the target
    dv = forward * orb.propagator.n / 4

    if kind == "impulive":
        orb.maneuvers = [
            ImpulsiveMan(man_start, orb.propagator._mat3 @ [-dv, 0, 0]),
            ImpulsiveMan(man_stop, orb.propagator._mat3 @ [-dv, 0, 0]),
        ]
    else:
        orb.maneuvers = ContinuousMan(man_start,
                                      man_stop,
                                      dv=2 *
                                      orb.propagator._mat3 @ [-dv, 0, 0])

    # ephem = orb.ephem(stop=man_stop + timedelta(hours=1), step=timedelta(seconds=60))
    # plot_ephem(ephem)

    orb2 = orb.propagate(man_stop + timedelta(seconds=120))

    radial = 0 if orb.propagator.frame.orientation == "QSW" else 1
    tan = 1 if orb.propagator.frame.orientation == "QSW" else 0

    assert np.isclose(orb[radial], orb2[radial])
    assert np.isclose(orb2[tan] - orb[tan], forward)
    assert np.isclose(orb2[tan], -30)
    assert orb[2] == orb2[2]
示例#7
0
1 25544U 98067A   18124.55610684  .00001524  00000-0  30197-4 0  9997
2 25544  51.6421 236.2139 0003381  47.8509  47.6767 15.54198229111731"""
          ).orbit()

start = orb.date
stop = timedelta(minutes=300)
step = timedelta(seconds=60)

# Changing the propagator to Keplerian, as SGP4 is not able to perform maneuvers
orb.propagator = KeplerNum(step, bodies=get_body("Earth"))

# Research for the next perigee
perigee = find_event(orb.iter(stop=stop, listeners=ApsideListener()),
                     'Periapsis')

man1 = ImpulsiveMan(perigee.date, (280, 0, 0), frame="TNW")
orb.maneuvers = [man1]

dates1, alt1 = [], []

# Research for the next apogee after the first maneuver
apogee = find_event(
    orb.iter(start=perigee.date - step * 10,
             stop=stop,
             listeners=ApsideListener()), 'Apoapsis')
# apogee = find_event(orb.iter(stop=stop, listeners=ApsideListener()), 'Apoapsis', offset=1)

# Adding the second maneuver to the orbit
man2 = ImpulsiveMan(apogee.date, (270, 0, 0), frame="TNW")
orb.maneuvers.append(man2)