Search in sources :

Example 16 with BoundedPropagator

use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.

the class SmallManeuverAnalyticalModelTest method testLowEarthOrbit1.

@Test
public void testLowEarthOrbit1() throws OrekitException {
    Orbit leo = new CircularOrbit(7200000.0, -1.0e-5, 2.0e-4, FastMath.toRadians(98.0), FastMath.toRadians(123.456), 0.0, PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
    double mass = 5600.0;
    AbsoluteDate t0 = leo.getDate().shiftedBy(1000.0);
    Vector3D dV = new Vector3D(-0.01, 0.02, 0.03);
    double f = 20.0;
    double isp = 315.0;
    BoundedPropagator withoutManeuver = getEphemeris(leo, mass, t0, Vector3D.ZERO, f, isp);
    BoundedPropagator withManeuver = getEphemeris(leo, mass, t0, dV, f, isp);
    SmallManeuverAnalyticalModel model = new SmallManeuverAnalyticalModel(withoutManeuver.propagate(t0), dV, isp);
    Assert.assertEquals(t0, model.getDate());
    for (AbsoluteDate t = withoutManeuver.getMinDate(); t.compareTo(withoutManeuver.getMaxDate()) < 0; t = t.shiftedBy(60.0)) {
        PVCoordinates pvWithout = withoutManeuver.getPVCoordinates(t, leo.getFrame());
        PVCoordinates pvWith = withManeuver.getPVCoordinates(t, leo.getFrame());
        PVCoordinates pvModel = model.apply(withoutManeuver.propagate(t)).getPVCoordinates(leo.getFrame());
        double nominalDeltaP = new PVCoordinates(pvWith, pvWithout).getPosition().getNorm();
        double modelError = new PVCoordinates(pvWith, pvModel).getPosition().getNorm();
        if (t.compareTo(t0) < 0) {
            // before maneuver, all positions should be equal
            Assert.assertEquals(0, nominalDeltaP, 1.0e-10);
            Assert.assertEquals(0, modelError, 1.0e-10);
        } else {
            // despite nominal deltaP exceeds 1 kilometer after less than 3 orbits
            if (t.durationFrom(t0) > 0.1 * leo.getKeplerianPeriod()) {
                Assert.assertTrue(modelError < 0.009 * nominalDeltaP);
            }
            Assert.assertTrue(modelError < 0.8);
        }
    }
}
Also used : Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 17 with BoundedPropagator

use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.

the class SmallManeuverAnalyticalModelTest method testEccentricOrbit.

@Test
public void testEccentricOrbit() throws OrekitException {
    Orbit heo = new KeplerianOrbit(90000000.0, 0.92, FastMath.toRadians(98.0), FastMath.toRadians(12.3456), FastMath.toRadians(123.456), FastMath.toRadians(1.23456), PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
    double mass = 5600.0;
    AbsoluteDate t0 = heo.getDate().shiftedBy(1000.0);
    Vector3D dV = new Vector3D(-0.01, 0.02, 0.03);
    double f = 20.0;
    double isp = 315.0;
    BoundedPropagator withoutManeuver = getEphemeris(heo, mass, t0, Vector3D.ZERO, f, isp);
    BoundedPropagator withManeuver = getEphemeris(heo, mass, t0, dV, f, isp);
    SmallManeuverAnalyticalModel model = new SmallManeuverAnalyticalModel(withoutManeuver.propagate(t0), dV, isp);
    Assert.assertEquals(t0, model.getDate());
    for (AbsoluteDate t = withoutManeuver.getMinDate(); t.compareTo(withoutManeuver.getMaxDate()) < 0; t = t.shiftedBy(600.0)) {
        PVCoordinates pvWithout = withoutManeuver.getPVCoordinates(t, heo.getFrame());
        PVCoordinates pvWith = withManeuver.getPVCoordinates(t, heo.getFrame());
        PVCoordinates pvModel = model.apply(withoutManeuver.propagate(t)).getPVCoordinates(heo.getFrame());
        double nominalDeltaP = new PVCoordinates(pvWith, pvWithout).getPosition().getNorm();
        double modelError = new PVCoordinates(pvWith, pvModel).getPosition().getNorm();
        if (t.compareTo(t0) < 0) {
            // before maneuver, all positions should be equal
            Assert.assertEquals(0, nominalDeltaP, 1.0e-10);
            Assert.assertEquals(0, modelError, 1.0e-10);
        } else {
            // despite nominal deltaP exceeds 300 kilometers at perigee, after 3 orbits
            if (t.durationFrom(t0) > 0.01 * heo.getKeplerianPeriod()) {
                Assert.assertTrue(modelError < 0.005 * nominalDeltaP);
            }
            Assert.assertTrue(modelError < 1700);
        }
    }
}
Also used : Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 18 with BoundedPropagator

use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.

the class AggregateBoundedPropagatorTest method testOutsideBounds.

@Test
public void testOutsideBounds() throws Exception {
    // setup
    AbsoluteDate date = AbsoluteDate.CCSDS_EPOCH;
    BoundedPropagator p1 = createPropagator(date, date.shiftedBy(10), 0);
    BoundedPropagator p2 = createPropagator(date.shiftedBy(10), date.shiftedBy(20), 1);
    // action
    BoundedPropagator actual = new AggregateBoundedPropagator(Arrays.asList(p1, p2));
    // verify
    int ulps = 0;
    // before bound of first propagator
    try {
        // may or may not throw an exception depending on the type of propagator.
        Assert.assertThat(actual.propagate(date.shiftedBy(-60)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p1.propagate(date.shiftedBy(-60)).getPVCoordinates(), ulps));
    } catch (OrekitException e) {
    // expected
    }
    try {
        // may or may not throw an exception depending on the type of propagator.
        Assert.assertThat(actual.getPVCoordinates(date.shiftedBy(-60), frame), OrekitMatchers.pvCloseTo(p1.propagate(date.shiftedBy(-60)).getPVCoordinates(), ulps));
    } catch (OrekitException e) {
    // expected
    }
    // after bound of last propagator
    try {
        // may or may not throw an exception depending on the type of propagator.
        Assert.assertThat(actual.propagate(date.shiftedBy(60)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(60)).getPVCoordinates(), ulps));
    } catch (OrekitException e) {
    // expected
    }
    try {
        // may or may not throw an exception depending on the type of propagator.
        Assert.assertThat(actual.getPVCoordinates(date.shiftedBy(60), frame), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(60)).getPVCoordinates(), ulps));
    } catch (OrekitException e) {
    // expected
    }
}
Also used : OrekitException(org.orekit.errors.OrekitException) BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 19 with BoundedPropagator

use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.

the class AggregateBoundedPropagatorTest method testOverlap.

/**
 * Check {@link AggregateBoundedPropagator#propagateOrbit(AbsoluteDate)} when the
 * constituent propagators overlap.
 *
 * @throws Exception on error.
 */
@Test
public void testOverlap() throws Exception {
    // setup
    AbsoluteDate date = AbsoluteDate.CCSDS_EPOCH;
    BoundedPropagator p1 = createPropagator(date, date.shiftedBy(25), 0);
    BoundedPropagator p2 = createPropagator(date.shiftedBy(10), date.shiftedBy(20), 1);
    // action
    BoundedPropagator actual = new AggregateBoundedPropagator(Arrays.asList(p1, p2));
    // verify
    int ulps = 0;
    Assert.assertThat(actual.getFrame(), CoreMatchers.is(p1.getFrame()));
    Assert.assertThat(actual.getMinDate(), CoreMatchers.is(date));
    Assert.assertThat(actual.getMaxDate(), CoreMatchers.is(date.shiftedBy(20)));
    Assert.assertThat(actual.propagate(date).getPVCoordinates(), OrekitMatchers.pvCloseTo(p1.propagate(date).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(5)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p1.propagate(date.shiftedBy(5)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(10)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(10)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(15)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(15)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(20)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(20)).getPVCoordinates(), ulps));
}
Also used : BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 20 with BoundedPropagator

use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.

the class AggregateBoundedPropagatorTest method testAdjacent.

/**
 * Check {@link AggregateBoundedPropagator#propagateOrbit(AbsoluteDate)} when the
 * constituent propagators are exactly adjacent.
 *
 * @throws Exception on error.
 */
@Test
public void testAdjacent() throws Exception {
    // setup
    AbsoluteDate date = AbsoluteDate.CCSDS_EPOCH;
    BoundedPropagator p1 = createPropagator(date, date.shiftedBy(10), 0);
    BoundedPropagator p2 = createPropagator(date.shiftedBy(10), date.shiftedBy(20), 1);
    // action
    BoundedPropagator actual = new AggregateBoundedPropagator(Arrays.asList(p1, p2));
    // verify
    int ulps = 0;
    Assert.assertThat(actual.getFrame(), CoreMatchers.is(p1.getFrame()));
    Assert.assertThat(actual.getMinDate(), CoreMatchers.is(date));
    Assert.assertThat(actual.getMaxDate(), CoreMatchers.is(date.shiftedBy(20)));
    Assert.assertThat(actual.propagate(date).getPVCoordinates(), OrekitMatchers.pvCloseTo(p1.propagate(date).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(5)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p1.propagate(date.shiftedBy(5)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(10)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(10)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(15)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(15)).getPVCoordinates(), ulps));
    Assert.assertThat(actual.propagate(date.shiftedBy(20)).getPVCoordinates(), OrekitMatchers.pvCloseTo(p2.propagate(date.shiftedBy(20)).getPVCoordinates(), ulps));
}
Also used : BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

BoundedPropagator (org.orekit.propagation.BoundedPropagator)50 Test (org.junit.Test)44 AbsoluteDate (org.orekit.time.AbsoluteDate)41 SpacecraftState (org.orekit.propagation.SpacecraftState)32 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)20 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)20 Orbit (org.orekit.orbits.Orbit)19 Frame (org.orekit.frames.Frame)16 CartesianOrbit (org.orekit.orbits.CartesianOrbit)15 CircularOrbit (org.orekit.orbits.CircularOrbit)15 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)14 OrekitException (org.orekit.errors.OrekitException)12 PVCoordinates (org.orekit.utils.PVCoordinates)10 Propagator (org.orekit.propagation.Propagator)9 TimeScale (org.orekit.time.TimeScale)9 LofOffset (org.orekit.attitudes.LofOffset)8 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)8 ByteArrayInputStream (java.io.ByteArrayInputStream)7 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6