Search in sources :

Example 26 with DormandPrince853Integrator

use of org.hipparchus.ode.nonstiff.DormandPrince853Integrator in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method testForwardAndBackward.

@Test
public void testForwardAndBackward() throws OrekitException {
    final double isp = 318;
    final double mass = 2500;
    final double a = 24396159;
    final double e = 0.72831215;
    final double i = FastMath.toRadians(7);
    final double omega = FastMath.toRadians(180);
    final double OMEGA = FastMath.toRadians(261);
    final double lv = 0;
    final double duration = 3653.99;
    final double f = 420;
    final double delta = FastMath.toRadians(-7.4978);
    final double alpha = FastMath.toRadians(351);
    final AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(alpha, delta), Vector3D.PLUS_I));
    final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
    final Orbit orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
    final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
    final AbsoluteDate fireDate = new AbsoluteDate(new DateComponents(2004, 01, 02), new TimeComponents(04, 15, 34.080), TimeScalesFactory.getUTC());
    final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);
    Assert.assertEquals(f, maneuver.getThrust(), 1.0e-10);
    Assert.assertEquals(isp, maneuver.getISP(), 1.0e-10);
    double[][] tol = NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
    AdaptiveStepsizeIntegrator integrator1 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator1.setInitialStepSize(60);
    final NumericalPropagator propagator1 = new NumericalPropagator(integrator1);
    propagator1.setInitialState(initialState);
    propagator1.setAttitudeProvider(law);
    propagator1.addForceModel(maneuver);
    final SpacecraftState finalState = propagator1.propagate(fireDate.shiftedBy(3800));
    AdaptiveStepsizeIntegrator integrator2 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator2.setInitialStepSize(60);
    final NumericalPropagator propagator2 = new NumericalPropagator(integrator2);
    propagator2.setInitialState(finalState);
    propagator2.setAttitudeProvider(law);
    propagator2.addForceModel(maneuver);
    final SpacecraftState recoveredState = propagator2.propagate(orbit.getDate());
    final Vector3D refPosition = initialState.getPVCoordinates().getPosition();
    final Vector3D recoveredPosition = recoveredState.getPVCoordinates().getPosition();
    Assert.assertEquals(0.0, Vector3D.distance(refPosition, recoveredPosition), 30.0);
    Assert.assertEquals(initialState.getMass(), recoveredState.getMass(), 1.5e-10);
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) InertialProvider(org.orekit.attitudes.InertialProvider) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 27 with DormandPrince853Integrator

use of org.hipparchus.ode.nonstiff.DormandPrince853Integrator in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method RealFieldExpectErrorTest.

/**
 *Same test as the previous one but not adding the ForceModel to the NumericalPropagator
 *    it is a test to validate the previous test.
 *    (to test if the ForceModel it's actually
 *    doing something in the Propagator and the FieldPropagator)
 */
@Test
public void RealFieldExpectErrorTest() throws OrekitException {
    DSFactory factory = new DSFactory(6, 0);
    DerivativeStructure a_0 = factory.variable(0, 7e7);
    DerivativeStructure e_0 = factory.variable(1, 0.4);
    DerivativeStructure i_0 = factory.variable(2, 85 * FastMath.PI / 180);
    DerivativeStructure R_0 = factory.variable(3, 0.7);
    DerivativeStructure O_0 = factory.variable(4, 0.5);
    DerivativeStructure n_0 = factory.variable(5, 0.1);
    Field<DerivativeStructure> field = a_0.getField();
    DerivativeStructure zero = field.getZero();
    FieldAbsoluteDate<DerivativeStructure> J2000 = new FieldAbsoluteDate<>(field);
    Frame EME = FramesFactory.getEME2000();
    FieldKeplerianOrbit<DerivativeStructure> FKO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, R_0, O_0, n_0, PositionAngle.MEAN, EME, J2000, Constants.EIGEN5C_EARTH_MU);
    FieldSpacecraftState<DerivativeStructure> initialState = new FieldSpacecraftState<>(FKO);
    SpacecraftState iSR = initialState.toSpacecraftState();
    final OrbitType type = OrbitType.KEPLERIAN;
    double[][] tolerance = NumericalPropagator.tolerances(10.0, FKO.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<DerivativeStructure> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    AdaptiveStepsizeIntegrator RIntegrator = new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
    RIntegrator.setInitialStepSize(60);
    FieldNumericalPropagator<DerivativeStructure> FNP = new FieldNumericalPropagator<>(field, integrator);
    FNP.setOrbitType(type);
    FNP.setInitialState(initialState);
    NumericalPropagator NP = new NumericalPropagator(RIntegrator);
    NP.setInitialState(iSR);
    final ConstantThrustManeuver forceModel = new ConstantThrustManeuver(J2000.toAbsoluteDate().shiftedBy(100), 100.0, 400.0, 300.0, Vector3D.PLUS_K);
    FNP.addForceModel(forceModel);
    // NOT ADDING THE FORCE MODEL TO THE NUMERICAL PROPAGATOR   NP.addForceModel(forceModel);
    FieldAbsoluteDate<DerivativeStructure> target = J2000.shiftedBy(1000.);
    FieldSpacecraftState<DerivativeStructure> finalState_DS = FNP.propagate(target);
    SpacecraftState finalState_R = NP.propagate(target.toAbsoluteDate());
    FieldPVCoordinates<DerivativeStructure> finPVC_DS = finalState_DS.getPVCoordinates();
    PVCoordinates finPVC_R = finalState_R.getPVCoordinates();
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getX() - finPVC_R.getPosition().getX()) < FastMath.abs(finPVC_R.getPosition().getX()) * 1e-11);
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getY() - finPVC_R.getPosition().getY()) < FastMath.abs(finPVC_R.getPosition().getY()) * 1e-11);
    Assert.assertFalse(FastMath.abs(finPVC_DS.toPVCoordinates().getPosition().getZ() - finPVC_R.getPosition().getZ()) < FastMath.abs(finPVC_R.getPosition().getZ()) * 1e-11);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) Frame(org.orekit.frames.Frame) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 28 with DormandPrince853Integrator

use of org.hipparchus.ode.nonstiff.DormandPrince853Integrator in project Orekit by CS-SI.

the class SmallManeuverAnalyticalModelTest method getEphemeris.

private BoundedPropagator getEphemeris(final Orbit orbit, final double mass, final AbsoluteDate t0, final Vector3D dV, final double f, final double isp) throws OrekitException {
    AttitudeProvider law = new LofOffset(orbit.getFrame(), LOFType.LVLH);
    final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
    // set up numerical propagator
    final double dP = 1.0;
    double[][] tolerances = NumericalPropagator.tolerances(dP, orbit, orbit.getType());
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tolerances[0], tolerances[1]);
    integrator.setInitialStepSize(orbit.getKeplerianPeriod() / 100.0);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(orbit.getType());
    propagator.setInitialState(initialState);
    propagator.setAttitudeProvider(law);
    if (dV.getNorm() > 1.0e-6) {
        // set up maneuver
        final double vExhaust = Constants.G0_STANDARD_GRAVITY * isp;
        final double dt = -(mass * vExhaust / f) * FastMath.expm1(-dV.getNorm() / vExhaust);
        final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(t0, dt, f, isp, dV.normalize());
        propagator.addForceModel(maneuver);
    }
    propagator.setEphemerisMode();
    propagator.propagate(t0.shiftedBy(5 * orbit.getKeplerianPeriod()));
    return propagator.getGeneratedEphemeris();
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider)

Example 29 with DormandPrince853Integrator

use of org.hipparchus.ode.nonstiff.DormandPrince853Integrator in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testGlobalStateJacobianIsotropicClassical.

@Test
public void testGlobalStateJacobianIsotropicClassical() throws OrekitException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    double i = FastMath.toRadians(98.7);
    double omega = FastMath.toRadians(93.0);
    double OMEGA = FastMath.toRadians(15.0 * 22.5);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    OrbitType integrationType = OrbitType.CARTESIAN;
    double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, integrationType);
    NumericalPropagator propagator = new NumericalPropagator(new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
    propagator.setOrbitType(integrationType);
    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new IsotropicRadiationClassicalConvention(2.5, 0.7, 0.2));
    propagator.addForceModel(forceModel);
    SpacecraftState state0 = new SpacecraftState(orbit);
    checkStateJacobian(propagator, state0, date.shiftedBy(3.5 * 3600.0), 1e6, tolerances[0], 2.0e-5);
}
Also used : EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 30 with DormandPrince853Integrator

use of org.hipparchus.ode.nonstiff.DormandPrince853Integrator in project Orekit by CS-SI.

the class SolarRadiationPressureTest method testRoughOrbitalModifs.

@Test
public void testRoughOrbitalModifs() throws ParseException, OrekitException, FileNotFoundException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 7, 1), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    final double period = orbit.getKeplerianPeriod();
    Assert.assertEquals(86164, period, 1);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    // creation of the force model
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.46, 1.0 / 298.25765, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    SolarRadiationPressure SRP = new SolarRadiationPressure(sun, earth.getEquatorialRadius(), new IsotropicRadiationCNES95Convention(500.0, 0.7, 0.7));
    // creation of the propagator
    double[] absTolerance = { 0.1, 1.0e-9, 1.0e-9, 1.0e-5, 1.0e-5, 1.0e-5, 0.001 };
    double[] relTolerance = { 1.0e-4, 1.0e-4, 1.0e-4, 1.0e-6, 1.0e-6, 1.0e-6, 1.0e-7 };
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(900.0, 60000, absTolerance, relTolerance);
    integrator.setInitialStepSize(3600);
    final NumericalPropagator calc = new NumericalPropagator(integrator);
    calc.addForceModel(SRP);
    // Step Handler
    calc.setMasterMode(FastMath.floor(period), new SolarStepHandler());
    AbsoluteDate finalDate = date.shiftedBy(10 * period);
    calc.setInitialState(new SpacecraftState(orbit, 1500.0));
    calc.propagate(finalDate);
    Assert.assertTrue(calc.getCalls() < 7100);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Aggregations

DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)83 SpacecraftState (org.orekit.propagation.SpacecraftState)69 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)63 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)51 Test (org.junit.Test)51 AbsoluteDate (org.orekit.time.AbsoluteDate)47 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)42 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)40 Orbit (org.orekit.orbits.Orbit)36 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)32 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)32 CartesianOrbit (org.orekit.orbits.CartesianOrbit)31 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)30 OrbitType (org.orekit.orbits.OrbitType)29 PVCoordinates (org.orekit.utils.PVCoordinates)29 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)27 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)26 Frame (org.orekit.frames.Frame)25 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)20 DateComponents (org.orekit.time.DateComponents)18