Search in sources :

Example 11 with EcksteinHechlerPropagator

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

the class LongitudeCrossingDetectorTest method testRegularCrossing.

@Test
public void testRegularCrossing() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LongitudeCrossingDetector d = new LongitudeCrossingDetector(earth, FastMath.toRadians(10.0)).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<LongitudeCrossingDetector>());
    Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(10.0, FastMath.toDegrees(d.getLongitude()), 1.0e-14);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    Assert.assertSame(earth, d.getBody());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    AbsoluteDate previous = null;
    for (LoggedEvent e : logger.getLoggedEvents()) {
        SpacecraftState state = e.getState();
        double longitude = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null).getLongitude();
        Assert.assertEquals(10.0, FastMath.toDegrees(longitude), 1.6e-7);
        if (previous != null) {
            // same time interval regardless of increasing/decreasing,
            // as increasing/decreasing flag is irrelevant for this detector
            Assert.assertEquals(4954.70, state.getDate().durationFrom(previous), 1e10);
        }
        previous = state.getDate();
    }
    Assert.assertEquals(16, logger.getLoggedEvents().size());
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Test(org.junit.Test)

Example 12 with EcksteinHechlerPropagator

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

the class LongitudeExtremumDetectorTest method testNoCrossing.

@Test
public void testNoCrossing() throws OrekitException {
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    LongitudeExtremumDetector d = new LongitudeExtremumDetector(earth).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<LongitudeExtremumDetector>());
    Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    Assert.assertSame(earth, d.getBody());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    Assert.assertEquals(0, logger.getLoggedEvents().size());
}
Also used : EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 13 with EcksteinHechlerPropagator

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

the class PositionAngleDetectorTest method doTest.

private void doTest(final OrbitType orbitType, final PositionAngle positionAngle, final double angle, final int expectedCrossings) throws OrekitException {
    PositionAngleDetector d = new PositionAngleDetector(orbitType, positionAngle, angle).withMaxCheck(60).withThreshold(1.e-10).withHandler(new ContinueOnEvent<PositionAngleDetector>());
    Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-10, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(orbitType, d.getOrbitType());
    Assert.assertEquals(positionAngle, d.getPositionAngle());
    Assert.assertEquals(angle, d.getAngle(), 1.0e-14);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(506.0, 943.0, 7450);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
    double[] array = new double[6];
    for (LoggedEvent e : logger.getLoggedEvents()) {
        SpacecraftState state = e.getState();
        orbitType.mapOrbitToArray(state.getOrbit(), positionAngle, array, null);
        Assert.assertEquals(angle, MathUtils.normalizeAngle(array[5], angle), 1.0e-10);
    }
    Assert.assertEquals(15, logger.getLoggedEvents().size());
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator)

Example 14 with EcksteinHechlerPropagator

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

the class AttitudesSequenceTest method testBackwardPropagation.

@Test
public void testBackwardPropagation() throws OrekitException {
    // Initial state definition : date, orbit
    final AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
    final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
    final Orbit initialOrbit = new KeplerianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initialDate, Constants.EIGEN5C_EARTH_MU);
    final AttitudesSequence attitudesSequence = new AttitudesSequence();
    final AttitudeProvider past = new InertialProvider(Rotation.IDENTITY);
    final AttitudeProvider current = new InertialProvider(Rotation.IDENTITY);
    final AttitudeProvider future = new InertialProvider(Rotation.IDENTITY);
    final Handler handler = new Handler(current, past);
    attitudesSequence.addSwitchingCondition(past, current, new DateDetector(initialDate.shiftedBy(-500.0)), true, false, 10.0, AngularDerivativesFilter.USE_R, handler);
    attitudesSequence.addSwitchingCondition(current, future, new DateDetector(initialDate.shiftedBy(+500.0)), true, false, 10.0, AngularDerivativesFilter.USE_R, null);
    attitudesSequence.resetActiveProvider(current);
    SpacecraftState initialState = new SpacecraftState(initialOrbit);
    initialState = initialState.addAdditionalState("fortyTwo", 42.0);
    final Propagator propagator = new EcksteinHechlerPropagator(initialOrbit, attitudesSequence, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    propagator.resetInitialState(initialState);
    Assert.assertEquals(42.0, propagator.getInitialState().getAdditionalState("fortyTwo")[0], 1.0e-10);
    // Register the switching events to the propagator
    attitudesSequence.registerSwitchEvents(propagator);
    SpacecraftState finalState = propagator.propagate(initialDate.shiftedBy(-10000.0));
    Assert.assertEquals(42.0, finalState.getAdditionalState("fortyTwo")[0], 1.0e-10);
    Assert.assertEquals(1, handler.dates.size());
    Assert.assertEquals(-500.0, handler.dates.get(0).durationFrom(initialDate), 1.0e-3);
    Assert.assertEquals(-490.0, finalState.getDate().durationFrom(initialDate), 1.0e-3);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) FieldOrbit(org.orekit.orbits.FieldOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldOrekitFixedStepHandler(org.orekit.propagation.sampling.FieldOrekitFixedStepHandler) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) EventHandler(org.orekit.propagation.events.handlers.EventHandler) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldEcksteinHechlerPropagator(org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldEcksteinHechlerPropagator(org.orekit.propagation.analytical.FieldEcksteinHechlerPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) FieldPropagator(org.orekit.propagation.FieldPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 15 with EcksteinHechlerPropagator

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

the class ElevationDetectorTest method testPresTemp.

public void testPresTemp() throws OrekitException {
    final TimeScale utc = TimeScalesFactory.getUTC();
    final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
    final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
    final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
    final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(48.833), FastMath.toRadians(2.333), 0.0);
    TopocentricFrame topo = new TopocentricFrame(earth, point, "Gstation");
    EarthStandardAtmosphereRefraction refractionModel = new EarthStandardAtmosphereRefraction();
    ElevationDetector detector = new ElevationDetector(topo).withRefraction(refractionModel).withHandler(new StopOnIncreasing<ElevationDetector>());
    refractionModel.setPressure(101325);
    refractionModel.setTemperature(290);
    AbsoluteDate startDate = new AbsoluteDate(2003, 9, 15, 20, 0, 0, utc);
    propagator.resetInitialState(propagator.propagate(startDate));
    propagator.addEventDetector(detector);
    final SpacecraftState fs = propagator.propagate(startDate.shiftedBy(Constants.JULIAN_DAY));
    double elevation = topo.getElevation(fs.getPVCoordinates().getPosition(), fs.getFrame(), fs.getDate());
    Assert.assertEquals(FastMath.toRadians(1.7026104902251749), elevation, 2.0e-5);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EarthStandardAtmosphereRefraction(org.orekit.models.earth.EarthStandardAtmosphereRefraction)

Aggregations

EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)34 AbsoluteDate (org.orekit.time.AbsoluteDate)30 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)27 PVCoordinates (org.orekit.utils.PVCoordinates)25 Orbit (org.orekit.orbits.Orbit)24 Propagator (org.orekit.propagation.Propagator)22 Test (org.junit.Test)17 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)17 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)16 SpacecraftState (org.orekit.propagation.SpacecraftState)16 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)14 TimeScale (org.orekit.time.TimeScale)14 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)9 ArrayList (java.util.ArrayList)8 BodyShape (org.orekit.bodies.BodyShape)8 TopocentricFrame (org.orekit.frames.TopocentricFrame)8 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)8 GeodeticPoint (org.orekit.bodies.GeodeticPoint)7 OrekitException (org.orekit.errors.OrekitException)7 Frame (org.orekit.frames.Frame)7