Search in sources :

Example 61 with TimeScale

use of org.orekit.time.TimeScale 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 62 with TimeScale

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

the class FundamentalNutationArgumentsTest method testDotField.

@Test
public void testDotField() throws OrekitException {
    final IERSConventions conventions = IERSConventions.IERS_2010;
    final TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    final FundamentalNutationArguments fna = conventions.getNutationArguments(ut1);
    final FieldAbsoluteDate<Decimal64> t0 = new FieldAbsoluteDate<>(Decimal64Field.getInstance(), 2002, 4, 7, 12, 34, 22.5, TimeScalesFactory.getUTC());
    final UnivariateDifferentiableFunction gamma = differentiate(fna, t0, b -> b.getGamma());
    final UnivariateDifferentiableFunction l = differentiate(fna, t0, b -> b.getL());
    final UnivariateDifferentiableFunction lPrime = differentiate(fna, t0, b -> b.getLPrime());
    final UnivariateDifferentiableFunction f = differentiate(fna, t0, b -> b.getF());
    final UnivariateDifferentiableFunction d = differentiate(fna, t0, b -> b.getD());
    final UnivariateDifferentiableFunction lMe = differentiate(fna, t0, b -> b.getLMe());
    final UnivariateDifferentiableFunction lVe = differentiate(fna, t0, b -> b.getLVe());
    final UnivariateDifferentiableFunction lE = differentiate(fna, t0, b -> b.getLE());
    final UnivariateDifferentiableFunction lMa = differentiate(fna, t0, b -> b.getLMa());
    final UnivariateDifferentiableFunction lJu = differentiate(fna, t0, b -> b.getLJu());
    final UnivariateDifferentiableFunction lSa = differentiate(fna, t0, b -> b.getLSa());
    final UnivariateDifferentiableFunction lUr = differentiate(fna, t0, b -> b.getLUr());
    final UnivariateDifferentiableFunction lNe = differentiate(fna, t0, b -> b.getLNe());
    final UnivariateDifferentiableFunction pa = differentiate(fna, t0, b -> b.getPa());
    final DSFactory factory = new DSFactory(1, 1);
    double maxErrorGamma = 0;
    double maxErrorL = 0;
    double maxErrorLPrime = 0;
    double maxErrorF = 0;
    double maxErrorD = 0;
    double maxErrorLMe = 0;
    double maxErrorLVe = 0;
    double maxErrorLE = 0;
    double maxErrorLMa = 0;
    double maxErrorLJu = 0;
    double maxErrorLSa = 0;
    double maxErrorLUr = 0;
    double maxErrorLNe = 0;
    double maxErrorPa = 0;
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 60.0) {
        FieldBodiesElements<Decimal64> be = fna.evaluateAll(t0.shiftedBy(dt));
        DerivativeStructure dtDS = factory.variable(0, dt);
        maxErrorGamma = FastMath.max(maxErrorGamma, FastMath.abs(gamma.value(dtDS).getPartialDerivative(1) - be.getGammaDot().getReal()));
        maxErrorL = FastMath.max(maxErrorL, FastMath.abs(l.value(dtDS).getPartialDerivative(1) - be.getLDot().getReal()));
        maxErrorLPrime = FastMath.max(maxErrorLPrime, FastMath.abs(lPrime.value(dtDS).getPartialDerivative(1) - be.getLPrimeDot().getReal()));
        maxErrorF = FastMath.max(maxErrorF, FastMath.abs(f.value(dtDS).getPartialDerivative(1) - be.getFDot().getReal()));
        maxErrorD = FastMath.max(maxErrorD, FastMath.abs(d.value(dtDS).getPartialDerivative(1) - be.getDDot().getReal()));
        maxErrorLMe = FastMath.max(maxErrorLMe, FastMath.abs(lMe.value(dtDS).getPartialDerivative(1) - be.getLMeDot().getReal()));
        maxErrorLVe = FastMath.max(maxErrorLVe, FastMath.abs(lVe.value(dtDS).getPartialDerivative(1) - be.getLVeDot().getReal()));
        maxErrorLE = FastMath.max(maxErrorLE, FastMath.abs(lE.value(dtDS).getPartialDerivative(1) - be.getLEDot().getReal()));
        maxErrorLMa = FastMath.max(maxErrorLMa, FastMath.abs(lMa.value(dtDS).getPartialDerivative(1) - be.getLMaDot().getReal()));
        maxErrorLJu = FastMath.max(maxErrorLJu, FastMath.abs(lJu.value(dtDS).getPartialDerivative(1) - be.getLJuDot().getReal()));
        maxErrorLSa = FastMath.max(maxErrorLSa, FastMath.abs(lSa.value(dtDS).getPartialDerivative(1) - be.getLSaDot().getReal()));
        maxErrorLUr = FastMath.max(maxErrorLUr, FastMath.abs(lUr.value(dtDS).getPartialDerivative(1) - be.getLUrDot().getReal()));
        maxErrorLNe = FastMath.max(maxErrorLNe, FastMath.abs(lNe.value(dtDS).getPartialDerivative(1) - be.getLNeDot().getReal()));
        maxErrorPa = FastMath.max(maxErrorPa, FastMath.abs(pa.value(dtDS).getPartialDerivative(1) - be.getPaDot().getReal()));
    }
    Assert.assertEquals(0, maxErrorGamma, 8.0e-13);
    Assert.assertEquals(0, maxErrorL, 1.0e-14);
    Assert.assertEquals(0, maxErrorLPrime, 6.0e-16);
    Assert.assertEquals(0, maxErrorF, 6.0e-15);
    Assert.assertEquals(0, maxErrorD, 6.0e-15);
    Assert.assertEquals(0, maxErrorLMe, 2.0e-15);
    Assert.assertEquals(0, maxErrorLVe, 5.0e-16);
    Assert.assertEquals(0, maxErrorLE, 3.0e-16);
    Assert.assertEquals(0, maxErrorLMa, 4.0e-16);
    Assert.assertEquals(0, maxErrorLJu, 3.0e-17);
    Assert.assertEquals(0, maxErrorLSa, 4.0e-17);
    Assert.assertEquals(0, maxErrorLUr, 1.0e-16);
    Assert.assertEquals(0, maxErrorLNe, 8.0e-17);
    Assert.assertEquals(0, maxErrorPa, 3.0e-20);
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) Decimal64(org.hipparchus.util.Decimal64) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) Test(org.junit.Test)

Example 63 with TimeScale

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

the class FundamentalNutationArgumentsTest method testSerializationTidalCorrection.

@Test
public void testSerializationTidalCorrection() throws OrekitException, IOException, ClassNotFoundException {
    IERSConventions conventions = IERSConventions.IERS_2010;
    TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    checkSerialization(295000, 300000, conventions.getNutationArguments(ut1));
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Example 64 with TimeScale

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

the class FundamentalNutationArgumentsTest method testDotDouble.

@Test
public void testDotDouble() throws OrekitException {
    final IERSConventions conventions = IERSConventions.IERS_2010;
    final TimeScale ut1 = TimeScalesFactory.getUT1(conventions, false);
    final FundamentalNutationArguments fna = conventions.getNutationArguments(ut1);
    final AbsoluteDate t0 = new AbsoluteDate(2002, 4, 7, 12, 34, 22.5, TimeScalesFactory.getUTC());
    final UnivariateDifferentiableFunction gamma = differentiate(fna, t0, b -> b.getGamma());
    final UnivariateDifferentiableFunction l = differentiate(fna, t0, b -> b.getL());
    final UnivariateDifferentiableFunction lPrime = differentiate(fna, t0, b -> b.getLPrime());
    final UnivariateDifferentiableFunction f = differentiate(fna, t0, b -> b.getF());
    final UnivariateDifferentiableFunction d = differentiate(fna, t0, b -> b.getD());
    final UnivariateDifferentiableFunction lMe = differentiate(fna, t0, b -> b.getLMe());
    final UnivariateDifferentiableFunction lVe = differentiate(fna, t0, b -> b.getLVe());
    final UnivariateDifferentiableFunction lE = differentiate(fna, t0, b -> b.getLE());
    final UnivariateDifferentiableFunction lMa = differentiate(fna, t0, b -> b.getLMa());
    final UnivariateDifferentiableFunction lJu = differentiate(fna, t0, b -> b.getLJu());
    final UnivariateDifferentiableFunction lSa = differentiate(fna, t0, b -> b.getLSa());
    final UnivariateDifferentiableFunction lUr = differentiate(fna, t0, b -> b.getLUr());
    final UnivariateDifferentiableFunction lNe = differentiate(fna, t0, b -> b.getLNe());
    final UnivariateDifferentiableFunction pa = differentiate(fna, t0, b -> b.getPa());
    final DSFactory factory = new DSFactory(1, 1);
    double maxErrorGamma = 0;
    double maxErrorL = 0;
    double maxErrorLPrime = 0;
    double maxErrorF = 0;
    double maxErrorD = 0;
    double maxErrorLMe = 0;
    double maxErrorLVe = 0;
    double maxErrorLE = 0;
    double maxErrorLMa = 0;
    double maxErrorLJu = 0;
    double maxErrorLSa = 0;
    double maxErrorLUr = 0;
    double maxErrorLNe = 0;
    double maxErrorPa = 0;
    for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 60.0) {
        BodiesElements be = fna.evaluateAll(t0.shiftedBy(dt));
        DerivativeStructure dtDS = factory.variable(0, dt);
        maxErrorGamma = FastMath.max(maxErrorGamma, FastMath.abs(gamma.value(dtDS).getPartialDerivative(1) - be.getGammaDot()));
        maxErrorL = FastMath.max(maxErrorL, FastMath.abs(l.value(dtDS).getPartialDerivative(1) - be.getLDot()));
        maxErrorLPrime = FastMath.max(maxErrorLPrime, FastMath.abs(lPrime.value(dtDS).getPartialDerivative(1) - be.getLPrimeDot()));
        maxErrorF = FastMath.max(maxErrorF, FastMath.abs(f.value(dtDS).getPartialDerivative(1) - be.getFDot()));
        maxErrorD = FastMath.max(maxErrorD, FastMath.abs(d.value(dtDS).getPartialDerivative(1) - be.getDDot()));
        maxErrorLMe = FastMath.max(maxErrorLMe, FastMath.abs(lMe.value(dtDS).getPartialDerivative(1) - be.getLMeDot()));
        maxErrorLVe = FastMath.max(maxErrorLVe, FastMath.abs(lVe.value(dtDS).getPartialDerivative(1) - be.getLVeDot()));
        maxErrorLE = FastMath.max(maxErrorLE, FastMath.abs(lE.value(dtDS).getPartialDerivative(1) - be.getLEDot()));
        maxErrorLMa = FastMath.max(maxErrorLMa, FastMath.abs(lMa.value(dtDS).getPartialDerivative(1) - be.getLMaDot()));
        maxErrorLJu = FastMath.max(maxErrorLJu, FastMath.abs(lJu.value(dtDS).getPartialDerivative(1) - be.getLJuDot()));
        maxErrorLSa = FastMath.max(maxErrorLSa, FastMath.abs(lSa.value(dtDS).getPartialDerivative(1) - be.getLSaDot()));
        maxErrorLUr = FastMath.max(maxErrorLUr, FastMath.abs(lUr.value(dtDS).getPartialDerivative(1) - be.getLUrDot()));
        maxErrorLNe = FastMath.max(maxErrorLNe, FastMath.abs(lNe.value(dtDS).getPartialDerivative(1) - be.getLNeDot()));
        maxErrorPa = FastMath.max(maxErrorPa, FastMath.abs(pa.value(dtDS).getPartialDerivative(1) - be.getPaDot()));
    }
    Assert.assertEquals(0, maxErrorGamma, 8.0e-13);
    Assert.assertEquals(0, maxErrorL, 1.0e-14);
    Assert.assertEquals(0, maxErrorLPrime, 6.0e-16);
    Assert.assertEquals(0, maxErrorF, 6.0e-15);
    Assert.assertEquals(0, maxErrorD, 6.0e-15);
    Assert.assertEquals(0, maxErrorLMe, 2.0e-15);
    Assert.assertEquals(0, maxErrorLVe, 5.0e-16);
    Assert.assertEquals(0, maxErrorLE, 3.0e-16);
    Assert.assertEquals(0, maxErrorLMa, 4.0e-16);
    Assert.assertEquals(0, maxErrorLJu, 3.0e-17);
    Assert.assertEquals(0, maxErrorLSa, 4.0e-17);
    Assert.assertEquals(0, maxErrorLUr, 1.0e-16);
    Assert.assertEquals(0, maxErrorLNe, 8.0e-17);
    Assert.assertEquals(0, maxErrorPa, 3.0e-20);
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) UnivariateDifferentiableFunction(org.hipparchus.analysis.differentiation.UnivariateDifferentiableFunction) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 65 with TimeScale

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

the class FundamentalNutationArgumentsTest method testSerializationNoTidalCorrection.

@Test
public void testSerializationNoTidalCorrection() throws OrekitException, IOException, ClassNotFoundException {
    IERSConventions conventions = IERSConventions.IERS_2010;
    TimeScale ut1 = TimeScalesFactory.getUT1(conventions, true);
    checkSerialization(295000, 300000, conventions.getNutationArguments(ut1));
}
Also used : IERSConventions(org.orekit.utils.IERSConventions) TimeScale(org.orekit.time.TimeScale) Test(org.junit.Test)

Aggregations

TimeScale (org.orekit.time.TimeScale)116 AbsoluteDate (org.orekit.time.AbsoluteDate)89 Test (org.junit.Test)75 Frame (org.orekit.frames.Frame)44 Orbit (org.orekit.orbits.Orbit)38 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)38 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)35 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)32 SpacecraftState (org.orekit.propagation.SpacecraftState)30 PVCoordinates (org.orekit.utils.PVCoordinates)28 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)25 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)17 OrekitException (org.orekit.errors.OrekitException)17 Propagator (org.orekit.propagation.Propagator)17 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)15 BodiesElements (org.orekit.data.BodiesElements)14 FundamentalNutationArguments (org.orekit.data.FundamentalNutationArguments)14 CartesianOrbit (org.orekit.orbits.CartesianOrbit)14 FieldCartesianOrbit (org.orekit.orbits.FieldCartesianOrbit)14 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)13