Search in sources :

Example 21 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class BatchLSEstimatorTest method testMultiSatWithParameters.

/**
 * A modified version of the previous test with a selection of propagation drivers to estimate
 *  One common (ยต)
 *  Some specifics for each satellite (Cr and Ca)
 *
 * @throws OrekitException
 */
@Test
public void testMultiSatWithParameters() throws OrekitException {
    // Test: Set the propagator drivers to estimate for each satellite
    final boolean muEstimated = true;
    final boolean crEstimated1 = true;
    final boolean caEstimated1 = true;
    final boolean crEstimated2 = true;
    final boolean caEstimated2 = false;
    // Builder sat 1
    final Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder1 = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0, Force.POTENTIAL, Force.SOLAR_RADIATION_PRESSURE);
    // Adding selection of parameters
    String satName = "sat 1";
    for (DelegatingDriver driver : propagatorBuilder1.getPropagationParametersDrivers().getDrivers()) {
        if (driver.getName().equals("central attraction coefficient")) {
            driver.setSelected(muEstimated);
        }
        if (driver.getName().equals(RadiationSensitive.REFLECTION_COEFFICIENT)) {
            driver.setName(driver.getName() + " " + satName);
            driver.setSelected(crEstimated1);
        }
        if (driver.getName().equals(RadiationSensitive.ABSORPTION_COEFFICIENT)) {
            driver.setName(driver.getName() + " " + satName);
            driver.setSelected(caEstimated1);
        }
    }
    // Builder for sat 2
    final Context context2 = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder2 = context2.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0, Force.POTENTIAL, Force.SOLAR_RADIATION_PRESSURE);
    // Adding selection of parameters
    satName = "sat 2";
    for (ParameterDriver driver : propagatorBuilder2.getPropagationParametersDrivers().getDrivers()) {
        if (driver.getName().equals("central attraction coefficient")) {
            driver.setSelected(muEstimated);
        }
        if (driver.getName().equals(RadiationSensitive.REFLECTION_COEFFICIENT)) {
            driver.setName(driver.getName() + " " + satName);
            driver.setSelected(crEstimated2);
        }
        if (driver.getName().equals(RadiationSensitive.ABSORPTION_COEFFICIENT)) {
            driver.setName(driver.getName() + " " + satName);
            driver.setSelected(caEstimated2);
        }
    }
    // Create perfect inter-satellites range measurements
    final TimeStampedPVCoordinates original = context.initialOrbit.getPVCoordinates();
    final Orbit closeOrbit = new CartesianOrbit(new TimeStampedPVCoordinates(context.initialOrbit.getDate(), original.getPosition().add(new Vector3D(1000, 2000, 3000)), original.getVelocity().add(new Vector3D(-0.03, 0.01, 0.02))), context.initialOrbit.getFrame(), context.initialOrbit.getMu());
    final Propagator closePropagator = EstimationTestUtils.createPropagator(closeOrbit, propagatorBuilder2);
    closePropagator.setEphemerisMode();
    closePropagator.propagate(context.initialOrbit.getDate().shiftedBy(3.5 * closeOrbit.getKeplerianPeriod()));
    final BoundedPropagator ephemeris = closePropagator.getGeneratedEphemeris();
    Propagator propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
    final List<ObservedMeasurement<?>> r12 = EstimationTestUtils.createMeasurements(propagator1, new InterSatellitesRangeMeasurementCreator(ephemeris), 1.0, 3.0, 300.0);
    // create perfect range measurements for first satellite
    propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
    final List<ObservedMeasurement<?>> r1 = EstimationTestUtils.createMeasurements(propagator1, new RangeMeasurementCreator(context), 1.0, 3.0, 300.0);
    // create orbit estimator
    final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder1, propagatorBuilder2);
    for (final ObservedMeasurement<?> interSat : r12) {
        estimator.addMeasurement(interSat);
    }
    for (final ObservedMeasurement<?> range : r1) {
        estimator.addMeasurement(range);
    }
    estimator.setParametersConvergenceThreshold(1.0e-2);
    estimator.setMaxIterations(10);
    estimator.setMaxEvaluations(20);
    estimator.setObserver(new BatchLSObserver() {

        int lastIter = 0;

        int lastEval = 0;

        /**
         * {@inheritDoc}
         */
        @Override
        public void evaluationPerformed(int iterationsCount, int evaluationscount, Orbit[] orbits, ParameterDriversList estimatedOrbitalParameters, ParameterDriversList estimatedPropagatorParameters, ParameterDriversList estimatedMeasurementsParameters, EstimationsProvider evaluationsProvider, Evaluation lspEvaluation) throws OrekitException {
            if (iterationsCount == lastIter) {
                Assert.assertEquals(lastEval + 1, evaluationscount);
            } else {
                Assert.assertEquals(lastIter + 1, iterationsCount);
            }
            lastIter = iterationsCount;
            lastEval = evaluationscount;
            AbsoluteDate previous = AbsoluteDate.PAST_INFINITY;
            for (int i = 0; i < evaluationsProvider.getNumber(); ++i) {
                AbsoluteDate current = evaluationsProvider.getEstimatedMeasurement(i).getDate();
                Assert.assertTrue(current.compareTo(previous) >= 0);
                previous = current;
            }
        }
    });
    List<DelegatingDriver> parameters = estimator.getOrbitalParametersDrivers(true).getDrivers();
    ParameterDriver a0Driver = parameters.get(0);
    Assert.assertEquals("a[0]", a0Driver.getName());
    a0Driver.setValue(a0Driver.getValue() + 1.2);
    a0Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    ParameterDriver a1Driver = parameters.get(6);
    Assert.assertEquals("a[1]", a1Driver.getName());
    a1Driver.setValue(a1Driver.getValue() - 5.4);
    a1Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    final Orbit before = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
    Assert.assertEquals(4.7246, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), before.getPVCoordinates().getPosition()), 1.0e-3);
    Assert.assertEquals(0.0010514, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), before.getPVCoordinates().getVelocity()), 1.0e-6);
    EstimationTestUtils.checkFit(context, estimator, 4, 5, 0.0, 6.0e-06, 0.0, 1.7e-05, 0.0, 4.4e-07, 0.0, 1.7e-10);
    final Orbit determined = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
    Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), determined.getPVCoordinates().getPosition()), 5.8e-6);
    Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), determined.getPVCoordinates().getVelocity()), 3.5e-9);
    // got a default one
    for (final ParameterDriver driver : estimator.getOrbitalParametersDrivers(true).getDrivers()) {
        if (driver.getName().startsWith("a[")) {
            // user-specified reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(AbsoluteDate.GALILEO_EPOCH), 1.0e-15);
        } else {
            // default reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(propagatorBuilder1.getInitialOrbitDate()), 1.0e-15);
        }
    }
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ParameterDriversList(org.orekit.utils.ParameterDriversList) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) OrekitException(org.orekit.errors.OrekitException) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DelegatingDriver(org.orekit.utils.ParameterDriversList.DelegatingDriver) BoundedPropagator(org.orekit.propagation.BoundedPropagator) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) EstimationsProvider(org.orekit.estimation.measurements.EstimationsProvider) Context(org.orekit.estimation.Context) Evaluation(org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem.Evaluation) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) ParameterDriver(org.orekit.utils.ParameterDriver) LevenbergMarquardtOptimizer(org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) Test(org.junit.Test)

Example 22 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class NumericalPropagatorTest method testEphemerisDates.

@Test
public void testEphemerisDates() throws OrekitException {
    // setup
    TimeScale tai = TimeScalesFactory.getTAI();
    AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
    AbsoluteDate startDate = new AbsoluteDate("2015-07-03", tai).shiftedBy(-0.1);
    AbsoluteDate endDate = new AbsoluteDate("2015-07-04", tai);
    Frame eci = FramesFactory.getGCRF();
    KeplerianOrbit orbit = new KeplerianOrbit(600e3 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, initialDate, mu);
    OrbitType type = OrbitType.CARTESIAN;
    double[][] tol = NumericalPropagator.tolerances(1e-3, orbit, type);
    NumericalPropagator prop = new NumericalPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1]));
    prop.setOrbitType(type);
    prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit)));
    // action
    prop.setEphemerisMode();
    prop.propagate(startDate, endDate);
    BoundedPropagator ephemeris = prop.getGeneratedEphemeris();
    // verify
    TimeStampedPVCoordinates actualPV = ephemeris.getPVCoordinates(startDate, eci);
    TimeStampedPVCoordinates expectedPV = orbit.getPVCoordinates(startDate, eci);
    MatcherAssert.assertThat(actualPV.getPosition(), OrekitMatchers.vectorCloseTo(expectedPV.getPosition(), 1.0));
    MatcherAssert.assertThat(actualPV.getVelocity(), OrekitMatchers.vectorCloseTo(expectedPV.getVelocity(), 1.0));
    MatcherAssert.assertThat(ephemeris.getMinDate().durationFrom(startDate), OrekitMatchers.closeTo(0, 0));
    MatcherAssert.assertThat(ephemeris.getMaxDate().durationFrom(endDate), OrekitMatchers.closeTo(0, 0));
    // test date
    AbsoluteDate date = endDate.shiftedBy(-0.11);
    Assert.assertEquals(ephemeris.propagate(date).getDate().durationFrom(date), 0, 0);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) TimeScale(org.orekit.time.TimeScale) BoundedPropagator(org.orekit.propagation.BoundedPropagator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 23 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class NumericalPropagatorTest method testParallelismIssue258.

@Test
public void testParallelismIssue258() throws OrekitException, InterruptedException, ExecutionException, FileNotFoundException {
    Utils.setDataRoot("regular-data:atmosphere:potential/grgs-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
    final double mu = GravityFieldFactory.getNormalizedProvider(2, 2).getMu();
    // Geostationary transfer orbit
    // semi major axis in meters
    final double a = 24396159;
    // eccentricity
    final double e = 0.72831215;
    // inclination
    final double i = FastMath.toRadians(7);
    // perigee argument
    final double omega = FastMath.toRadians(180);
    // right ascension of ascending node
    final double raan = FastMath.toRadians(261);
    // mean anomaly
    final double lM = 0;
    final Frame inertialFrame = FramesFactory.getEME2000();
    final TimeScale utc = TimeScalesFactory.getUTC();
    final AbsoluteDate initialDate = new AbsoluteDate(2003, 1, 1, 00, 00, 00.000, utc);
    final Orbit initialOrbit = new CartesianOrbit(new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu));
    final SpacecraftState initialState = new SpacecraftState(initialOrbit, 1000);
    // initialize the testing points
    final List<SpacecraftState> states = new ArrayList<SpacecraftState>();
    final NumericalPropagator propagator = createPropagator(initialState, OrbitType.CARTESIAN, PositionAngle.TRUE);
    final double samplingStep = 10000.0;
    propagator.setMasterMode(samplingStep, (state, isLast) -> states.add(state));
    propagator.propagate(initialDate.shiftedBy(5 * samplingStep));
    // compute reference errors, using serial computation in a for loop
    final double[][] referenceErrors = new double[states.size() - 1][];
    for (int startIndex = 0; startIndex < states.size() - 1; ++startIndex) {
        referenceErrors[startIndex] = recomputeFollowing(startIndex, states);
    }
    final Consumer<SpacecraftState> checker = point -> {
        try {
            final int startIndex = states.indexOf(point);
            double[] errors = recomputeFollowing(startIndex, states);
            for (int k = 0; k < errors.length; ++k) {
                Assert.assertEquals(startIndex + " to " + (startIndex + k + 1), referenceErrors[startIndex][k], errors[k], 1.0e-9);
            }
        } catch (OrekitException oe) {
            Assert.fail(oe.getLocalizedMessage());
        }
    };
    // serial propagation using Stream
    states.stream().forEach(checker);
    // parallel propagation using parallelStream
    states.parallelStream().forEach(checker);
}
Also used : ParameterDriver(org.orekit.utils.ParameterDriver) CoreMatchers(org.hamcrest.CoreMatchers) ApsideDetector(org.orekit.propagation.events.ApsideDetector) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) ForceModel(org.orekit.forces.ForceModel) Frame(org.orekit.frames.Frame) DragForce(org.orekit.forces.drag.DragForce) IERSConventions(org.orekit.utils.IERSConventions) PVCoordinates(org.orekit.utils.PVCoordinates) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) GRGSFormatReader(org.orekit.forces.gravity.potential.GRGSFormatReader) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldEventDetector(org.orekit.propagation.events.FieldEventDetector) After(org.junit.After) StopOnEvent(org.orekit.propagation.events.handlers.StopOnEvent) ThirdBodyAttraction(org.orekit.forces.gravity.ThirdBodyAttraction) PositionAngle(org.orekit.orbits.PositionAngle) DateDetector(org.orekit.propagation.events.DateDetector) ParseException(java.text.ParseException) Utils(org.orekit.Utils) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FramesFactory(org.orekit.frames.FramesFactory) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) FileNotFoundException(java.io.FileNotFoundException) SHMFormatReader(org.orekit.forces.gravity.potential.SHMFormatReader) List(java.util.List) Stream(java.util.stream.Stream) MatcherAssert(org.hamcrest.MatcherAssert) DataProvidersManager(org.orekit.data.DataProvidersManager) RealFieldElement(org.hipparchus.RealFieldElement) EventDetector(org.orekit.propagation.events.EventDetector) Action(org.orekit.propagation.events.handlers.EventHandler.Action) SolarRadiationPressure(org.orekit.forces.radiation.SolarRadiationPressure) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) ContinueOnEvent(org.orekit.propagation.events.handlers.ContinueOnEvent) OrekitStepHandler(org.orekit.propagation.sampling.OrekitStepHandler) AdditionalStateProvider(org.orekit.propagation.AdditionalStateProvider) AbstractIntegratedPropagator(org.orekit.propagation.integration.AbstractIntegratedPropagator) TimeScale(org.orekit.time.TimeScale) Orbit(org.orekit.orbits.Orbit) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) ArrayList(java.util.ArrayList) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) IsotropicRadiationSingleCoefficient(org.orekit.forces.radiation.IsotropicRadiationSingleCoefficient) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) OrbitType(org.orekit.orbits.OrbitType) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) OrekitStepInterpolator(org.orekit.propagation.sampling.OrekitStepInterpolator) FastMath(org.hipparchus.util.FastMath) AdditionalEquations(org.orekit.propagation.integration.AdditionalEquations) Before(org.junit.Before) Constants(org.orekit.utils.Constants) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) OrekitMatchers(org.orekit.OrekitMatchers) IOException(java.io.IOException) Test(org.junit.Test) GravityFieldFactory(org.orekit.forces.gravity.potential.GravityFieldFactory) MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) ExecutionException(java.util.concurrent.ExecutionException) Consumer(java.util.function.Consumer) Field(org.hipparchus.Field) OrekitMessages(org.orekit.errors.OrekitMessages) EventHandler(org.orekit.propagation.events.handlers.EventHandler) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) OrekitException(org.orekit.errors.OrekitException) CelestialBodyFactory(org.orekit.bodies.CelestialBodyFactory) TimeScalesFactory(org.orekit.time.TimeScalesFactory) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) LocalizedCoreFormats(org.hipparchus.exception.LocalizedCoreFormats) Assert(org.junit.Assert) AbstractDetector(org.orekit.propagation.events.AbstractDetector) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) AbsoluteDate(org.orekit.time.AbsoluteDate) Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) ArrayList(java.util.ArrayList) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) GRGSFormatReader(org.orekit.forces.gravity.potential.GRGSFormatReader) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 24 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class NumericalPropagatorTest method testIssue157.

@Test
public void testIssue157() throws OrekitException {
    try {
        Orbit orbit = new KeplerianOrbit(13378000, 0.05, 0, 0, FastMath.PI, 0, PositionAngle.MEAN, FramesFactory.getTOD(false), new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
        NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException pe) {
        Assert.assertEquals(OrekitMessages.SINGULAR_JACOBIAN_FOR_ORBIT_TYPE, pe.getSpecifier());
    }
}
Also used : EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrekitException(org.orekit.errors.OrekitException) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 25 with KeplerianOrbit

use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.

the class NumericalPropagatorTest method testPropagationTypesHyperbolic.

@Test
public void testPropagationTypesHyperbolic() throws OrekitException, ParseException, IOException {
    SpacecraftState state = new SpacecraftState(new KeplerianOrbit(-10000000.0, 2.5, 0.3, 0, 0, 0.0, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu));
    ForceModel gravityField = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);
    // Propagation of the initial at t + dt
    final PVCoordinates pv = state.getPVCoordinates();
    final double dP = 0.001;
    final double dV = state.getMu() * dP / (pv.getPosition().getNormSq() * pv.getVelocity().getNorm());
    final PVCoordinates pvcM = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.MEAN);
    final PVCoordinates pvkM = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN);
    final PVCoordinates pvcE = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC);
    final PVCoordinates pvkE = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC);
    final PVCoordinates pvcT = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.TRUE);
    final PVCoordinates pvkT = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE);
    Assert.assertEquals(0, pvcM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.2);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.3);
    Assert.assertEquals(0, pvcE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.009);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.006);
    Assert.assertEquals(0, pvcT.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) ForceModel(org.orekit.forces.ForceModel) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) Test(org.junit.Test)

Aggregations

KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)211 Test (org.junit.Test)175 AbsoluteDate (org.orekit.time.AbsoluteDate)154 SpacecraftState (org.orekit.propagation.SpacecraftState)146 Orbit (org.orekit.orbits.Orbit)101 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)96 Frame (org.orekit.frames.Frame)71 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)65 CartesianOrbit (org.orekit.orbits.CartesianOrbit)57 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)54 DateComponents (org.orekit.time.DateComponents)50 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)46 PVCoordinates (org.orekit.utils.PVCoordinates)45 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)43 TimeComponents (org.orekit.time.TimeComponents)43 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)42 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)41 Propagator (org.orekit.propagation.Propagator)39 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)36 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)35