Search in sources :

Example 11 with AbsoluteDate

use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testWithPropagator.

/**
 * Check integration error is small when integrating the same equations over the same
 * interval.
 *
 * @throws OrekitException on error.
 */
@Test
public void testWithPropagator() throws OrekitException {
    CelestialBody sun = CelestialBodyFactory.getSun();
    final Frame eci = FramesFactory.getGCRF();
    final Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    AbsoluteDate date = new AbsoluteDate(2004, 1, 1, utc);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
    Orbit orbit = new KeplerianOrbit(6378137 + 400e3, 1e-3, FastMath.toRadians(50), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU);
    final SpacecraftState ic = new SpacecraftState(orbit);
    final AbsoluteDate end = date.shiftedBy(5 * Constants.JULIAN_DAY);
    final AbsoluteDate resetDate = date.shiftedBy(0.8 * Constants.JULIAN_DAY + 0.1);
    final SpacecraftState[] lastState = new SpacecraftState[1];
    final OrekitStepHandler stepSaver = (interpolator, isLast) -> {
        final AbsoluteDate start = interpolator.getPreviousState().getDate();
        if (start.compareTo(resetDate) < 0) {
            lastState[0] = interpolator.getPreviousState();
        }
    };
    // propagate with state rest to take slightly different path
    NumericalPropagator propagator = getNumericalPropagator(sun, earth, ic);
    propagator.setMasterMode(stepSaver);
    propagator.propagate(resetDate);
    propagator.resetInitialState(lastState[0]);
    propagator.setSlaveMode();
    final SpacecraftState actual = propagator.propagate(end);
    // propagate straight through
    propagator = getNumericalPropagator(sun, earth, ic);
    propagator.resetInitialState(ic);
    propagator.setSlaveMode();
    final SpacecraftState expected = propagator.propagate(end);
    assertThat(actual.getPVCoordinates(), pvCloseTo(expected.getPVCoordinates(), 1.0));
}
Also used : OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) DTM2000InputParameters(org.orekit.forces.drag.atmosphere.DTM2000InputParameters) Frame(org.orekit.frames.Frame) TimeScale(org.orekit.time.TimeScale) DragForce(org.orekit.forces.drag.DragForce) IERSConventions(org.orekit.utils.IERSConventions) Orbit(org.orekit.orbits.Orbit) StrengthLevel(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation.StrengthLevel) CelestialBody(org.orekit.bodies.CelestialBody) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) SpacecraftState(org.orekit.propagation.SpacecraftState) After(org.junit.After) OrbitType(org.orekit.orbits.OrbitType) PositionAngle(org.orekit.orbits.PositionAngle) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) FastMath(org.hipparchus.util.FastMath) Utils(org.orekit.Utils) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) DateComponents(org.orekit.time.DateComponents) FramesFactory(org.orekit.frames.FramesFactory) Atmosphere(org.orekit.forces.drag.atmosphere.Atmosphere) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitMatchers(org.orekit.OrekitMatchers) Test(org.junit.Test) MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) DataProvidersManager(org.orekit.data.DataProvidersManager) Month(org.orekit.time.Month) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) TimeScalesFactory(org.orekit.time.TimeScalesFactory) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) Assert(org.junit.Assert) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) CelestialBody(org.orekit.bodies.CelestialBody) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) Test(org.junit.Test)

Example 12 with AbsoluteDate

use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testMinDate.

@Test
public void testMinDate() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel.WEAK);
    Assert.assertEquals(new AbsoluteDate("2010-05-01", utc), msafe.getMinDate());
    Assert.assertEquals(78.1, msafe.getMeanFlux(msafe.getMinDate()), 1.0e-14);
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 13 with AbsoluteDate

use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testFluxStrong.

@Test
public void testFluxStrong() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel.STRONG);
    Assert.assertEquals(94.2, msafe.getMeanFlux(new AbsoluteDate("2010-10-01", utc)), 1.0e-10);
    Assert.assertEquals(96.6, msafe.getMeanFlux(new AbsoluteDate("2010-10-16T12:00:00", utc)), 1.0e-10);
    Assert.assertEquals(99.0, msafe.getMeanFlux(new AbsoluteDate("2010-11-01", utc)), 1.0e-10);
    Assert.assertEquals(msafe.getInstantFlux(new AbsoluteDate("2010-11-01", utc)), msafe.getMeanFlux(new AbsoluteDate("2010-11-01", utc)), 1.0e-10);
    Assert.assertEquals(MarshallSolarActivityFutureEstimation.StrengthLevel.STRONG, msafe.getStrengthLevel());
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 14 with AbsoluteDate

use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testKpStrong.

@Test
public void testKpStrong() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel.STRONG);
    Assert.assertEquals(2 + 1.0 / 3.0, msafe.get24HoursKp(new AbsoluteDate("2010-10-01", utc)), 0.2);
    Assert.assertEquals(3.0, msafe.get24HoursKp(new AbsoluteDate("2011-05-01", utc)), 0.1);
    // this one should get exactly to an element of the AP_ARRAY: ap = 7.0
    Assert.assertEquals(2.0, msafe.get24HoursKp(new AbsoluteDate("2010-08-01", utc)), 0.3);
    Assert.assertEquals(msafe.getThreeHourlyKP(new AbsoluteDate("2010-08-01", utc)), msafe.get24HoursKp(new AbsoluteDate("2010-08-01", utc)), 1.0e-14);
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 15 with AbsoluteDate

use of org.orekit.time.AbsoluteDate in project Orekit by CS-SI.

the class MarshallSolarActivityFutureEstimationTest method testFutureOutOfRange.

@Test(expected = OrekitException.class)
public void testFutureOutOfRange() throws OrekitException {
    MarshallSolarActivityFutureEstimation msafe = loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel.WEAK);
    msafe.get24HoursKp(new AbsoluteDate("2060-10-01", utc));
}
Also used : MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

AbsoluteDate (org.orekit.time.AbsoluteDate)840 Test (org.junit.Test)632 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)321 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)283 SpacecraftState (org.orekit.propagation.SpacecraftState)279 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)204 PVCoordinates (org.orekit.utils.PVCoordinates)193 Orbit (org.orekit.orbits.Orbit)157 Frame (org.orekit.frames.Frame)152 OrekitException (org.orekit.errors.OrekitException)141 DateComponents (org.orekit.time.DateComponents)134 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)106 CartesianOrbit (org.orekit.orbits.CartesianOrbit)104 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)97 ArrayList (java.util.ArrayList)96 Propagator (org.orekit.propagation.Propagator)90 TimeScale (org.orekit.time.TimeScale)90 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)88 TimeComponents (org.orekit.time.TimeComponents)88 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)87