Search in sources :

Example 16 with AdaptiveStepsizeIntegrator

use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator 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)

Example 17 with AdaptiveStepsizeIntegrator

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

the class EcksteinHechlerPropagatorTest method testInitializationCorrectness.

@Test
public void testInitializationCorrectness() throws OrekitException, IOException {
    // Definition of initial conditions
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    // find the default Eckstein-Hechler propagator initialized from the initial orbit
    EcksteinHechlerPropagator defaultEH = new EcksteinHechlerPropagator(initial, provider);
    // the osculating parameters recomputed by the default Eckstein-Hechler propagator are quite different
    // from initial orbit
    CircularOrbit defaultOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(defaultEH.propagateOrbit(initial.getDate()));
    Assert.assertEquals(267.4, defaultOrbit.getA() - initial.getA(), 0.1);
    // the position on the other hand match perfectly
    Assert.assertEquals(0.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), initial.getPVCoordinates().getPosition()), 1.0e-8);
    // set up a reference numerical propagator starting for the specified start orbit
    // using the same force models (i.e. the first few zonal terms)
    double[][] tol = NumericalPropagator.tolerances(0.1, initial, OrbitType.CIRCULAR);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator.setInitialStepSize(60);
    NumericalPropagator num = new NumericalPropagator(integrator);
    num.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(provider)));
    num.setInitialState(new SpacecraftState(initial));
    num.setOrbitType(OrbitType.CIRCULAR);
    // find the best Eckstein-Hechler propagator that match the orbit evolution
    PropagatorConverter converter = new FiniteDifferencePropagatorConverter(new EcksteinHechlerPropagatorBuilder(initial, provider, PositionAngle.TRUE, 1.0), 1.0e-6, 100);
    EcksteinHechlerPropagator fittedEH = (EcksteinHechlerPropagator) converter.convert(num, 3 * initial.getKeplerianPeriod(), 300);
    // the default Eckstein-Hechler propagator did however quite a good job, as it found
    // an orbit close to the best fitting
    CircularOrbit fittedOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(fittedEH.propagateOrbit(initial.getDate()));
    Assert.assertEquals(0.623, defaultOrbit.getA() - fittedOrbit.getA(), 0.1);
    // the position on the other hand are slightly different
    // because the fitted orbit minimizes the residuals over a complete time span,
    // not on a single point
    Assert.assertEquals(58.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), fittedOrbit.getPVCoordinates().getPosition()), 0.1);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) FiniteDifferencePropagatorConverter(org.orekit.propagation.conversion.FiniteDifferencePropagatorConverter) PropagatorConverter(org.orekit.propagation.conversion.PropagatorConverter) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagatorBuilder(org.orekit.propagation.conversion.EcksteinHechlerPropagatorBuilder) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FiniteDifferencePropagatorConverter(org.orekit.propagation.conversion.FiniteDifferencePropagatorConverter) Transform(org.orekit.frames.Transform) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) Test(org.junit.Test)

Example 18 with AdaptiveStepsizeIntegrator

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

the class OsculatingToMeanElementsConverterTest method testTrivial.

@Test
public void testTrivial() throws Exception {
    final AbsoluteDate date = new AbsoluteDate("2011-12-12T11:57:20.000", TimeScalesFactory.getUTC());
    final Orbit orbit1 = new CircularOrbit(7204535.848109436, -4.484755873986251E-4, 0.0011562979012178316, FastMath.toRadians(98.74341600466741), FastMath.toRadians(43.32990110790338), FastMath.toRadians(180.0), PositionAngle.MEAN, FramesFactory.getGCRF(), date, Constants.WGS84_EARTH_MU);
    final SpacecraftState initialState = new SpacecraftState(orbit1);
    // Set up the numerical propagator
    final double[][] tol = NumericalPropagator.tolerances(1.0, initialState.getOrbit(), initialState.getOrbit().getType());
    final double minStep = 1.;
    final double maxStep = 200.;
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
    integrator.setInitialStepSize(100.);
    final NumericalPropagator prop = new NumericalPropagator(integrator);
    prop.setInitialState(initialState);
    final OsculatingToMeanElementsConverter converter = new OsculatingToMeanElementsConverter(initialState, 2, prop, 1.0);
    final SpacecraftState meanOrbit = converter.convert();
    final double eps = 1.e-15;
    Assert.assertEquals(orbit1.getA(), meanOrbit.getA(), eps * orbit1.getA());
    Assert.assertEquals(orbit1.getEquinoctialEx(), meanOrbit.getEquinoctialEx(), eps);
    Assert.assertEquals(orbit1.getEquinoctialEy(), meanOrbit.getEquinoctialEy(), eps);
    Assert.assertEquals(orbit1.getHx(), meanOrbit.getHx(), eps);
    Assert.assertEquals(orbit1.getHy(), meanOrbit.getHy(), eps);
    Assert.assertEquals(MathUtils.normalizeAngle(orbit1.getLM(), FastMath.PI), MathUtils.normalizeAngle(meanOrbit.getLM(), FastMath.PI), eps);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 19 with AdaptiveStepsizeIntegrator

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

the class DateDetectorTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        final double mu = 3.9860047e14;
        final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
        iniOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), iniDate, mu);
        SpacecraftState initialState = new SpacecraftState(iniOrbit);
        double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
        double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
        AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
        integrator.setInitialStepSize(60);
        propagator = new NumericalPropagator(integrator);
        propagator.setInitialState(initialState);
        dt = 60.;
        maxCheck = 10.;
        threshold = 10.e-10;
        evtno = 0;
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 20 with AdaptiveStepsizeIntegrator

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

the class AlignmentDetectorTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        double mu = 3.9860047e14;
        final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
        final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), iniDate, mu);
        initialState = new SpacecraftState(orbit);
        double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
        double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
        AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
        integrator.setInitialStepSize(60);
        propagator = new NumericalPropagator(integrator);
        propagator.setInitialState(initialState);
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Aggregations

AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)51 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)51 SpacecraftState (org.orekit.propagation.SpacecraftState)45 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)38 Test (org.junit.Test)34 AbsoluteDate (org.orekit.time.AbsoluteDate)28 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)26 PVCoordinates (org.orekit.utils.PVCoordinates)26 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)25 Orbit (org.orekit.orbits.Orbit)23 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)21 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)20 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)19 Frame (org.orekit.frames.Frame)19 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)19 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)16 OrbitType (org.orekit.orbits.OrbitType)16 CartesianOrbit (org.orekit.orbits.CartesianOrbit)15 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)15 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)14