Search in sources :

Example 66 with DormandPrince853Integrator

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

the class DSSTPropagatorTest method testShortPeriodCoefficients.

@Test
public void testShortPeriodCoefficients() throws OrekitException {
    Utils.setDataRoot("regular-data:potential/icgem-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("^eigen-6s-truncated$", false));
    UnnormalizedSphericalHarmonicsProvider nshp = GravityFieldFactory.getUnnormalizedProvider(4, 4);
    Orbit orbit = new KeplerianOrbit(13378000, 0.05, 0, 0, FastMath.PI, 0, PositionAngle.MEAN, FramesFactory.getTOD(false), new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()), nshp.getMu());
    double period = orbit.getKeplerianPeriod();
    double[][] tolerance = DSSTPropagator.tolerances(1.0, orbit);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(period / 100, period * 100, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(10 * period);
    DSSTPropagator propagator = new DSSTPropagator(integrator, false);
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getGTOD(false));
    CelestialBody sun = CelestialBodyFactory.getSun();
    CelestialBody moon = CelestialBodyFactory.getMoon();
    propagator.addForceModel(new DSSTZonal(nshp, 4, 3, 9));
    propagator.addForceModel(new DSSTTesseral(earth.getBodyFrame(), Constants.WGS84_EARTH_ANGULAR_VELOCITY, nshp, 4, 4, 4, 8, 4, 4, 2));
    propagator.addForceModel(new DSSTThirdBody(sun));
    propagator.addForceModel(new DSSTThirdBody(moon));
    propagator.addForceModel(new DSSTAtmosphericDrag(new HarrisPriester(sun, earth), 2.1, 180));
    propagator.addForceModel(new DSSTSolarRadiationPressure(1.2, 180, sun, earth.getEquatorialRadius()));
    final AbsoluteDate finalDate = orbit.getDate().shiftedBy(30 * Constants.JULIAN_DAY);
    propagator.resetInitialState(new SpacecraftState(orbit, 45.0));
    final SpacecraftState stateNoConfig = propagator.propagate(finalDate);
    Assert.assertEquals(0, stateNoConfig.getAdditionalStates().size());
    propagator.setSelectedCoefficients(new HashSet<String>());
    propagator.resetInitialState(new SpacecraftState(orbit, 45.0));
    final SpacecraftState stateConfigEmpty = propagator.propagate(finalDate);
    Assert.assertEquals(234, stateConfigEmpty.getAdditionalStates().size());
    final Set<String> selected = new HashSet<String>();
    selected.add("DSST-3rd-body-Moon-s[7]");
    selected.add("DSST-central-body-tesseral-c[-2][3]");
    propagator.setSelectedCoefficients(selected);
    propagator.resetInitialState(new SpacecraftState(orbit, 45.0));
    final SpacecraftState stateConfigeSelected = propagator.propagate(finalDate);
    Assert.assertEquals(selected.size(), stateConfigeSelected.getAdditionalStates().size());
    propagator.setSelectedCoefficients(null);
    propagator.resetInitialState(new SpacecraftState(orbit, 45.0));
    final SpacecraftState stateConfigNull = propagator.propagate(finalDate);
    Assert.assertEquals(0, stateConfigNull.getAdditionalStates().size());
}
Also used : HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DSSTZonal(org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal) DSSTTesseral(org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral) DSSTAtmosphericDrag(org.orekit.propagation.semianalytical.dsst.forces.DSSTAtmosphericDrag) AbsoluteDate(org.orekit.time.AbsoluteDate) DSSTSolarRadiationPressure(org.orekit.propagation.semianalytical.dsst.forces.DSSTSolarRadiationPressure) SpacecraftState(org.orekit.propagation.SpacecraftState) DSSTThirdBody(org.orekit.propagation.semianalytical.dsst.forces.DSSTThirdBody) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) CelestialBody(org.orekit.bodies.CelestialBody) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 67 with DormandPrince853Integrator

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

the class DSSTPropagatorTest method getLEOStatePropagatedBy30Minutes.

private SpacecraftState getLEOStatePropagatedBy30Minutes() throws IllegalArgumentException, OrekitException {
    final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
    final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
    // Spring equinoxe 21st mars 2003 1h00m
    final AbsoluteDate initialDate = new AbsoluteDate(new DateComponents(2003, 03, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
    final CartesianOrbit osculatingOrbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getTOD(IERSConventions.IERS_1996, false), initialDate, Constants.WGS84_EARTH_MU);
    // Adaptive step integrator
    // with a minimum step of 0.001 and a maximum step of 1000
    double minStep = 0.001;
    double maxstep = 1000.0;
    double positionTolerance = 10.0;
    OrbitType propagationType = OrbitType.EQUINOCTIAL;
    double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, osculatingOrbit, propagationType);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(propagationType);
    NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
    ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
    propagator.addForceModel(holmesFeatherstone);
    propagator.setInitialState(new SpacecraftState(osculatingOrbit));
    return propagator.propagate(new AbsoluteDate(initialDate, 1800.));
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) ForceModel(org.orekit.forces.ForceModel) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 68 with DormandPrince853Integrator

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

the class DSSTPropagatorTest method testGetInitialOsculatingState.

@Test
public void testGetInitialOsculatingState() throws IllegalArgumentException, OrekitException {
    final SpacecraftState initialState = getGEOState();
    // build integrator
    final double minStep = initialState.getKeplerianPeriod() * 0.1;
    final double maxStep = initialState.getKeplerianPeriod() * 10.0;
    final double[][] tol = DSSTPropagator.tolerances(0.1, initialState.getOrbit());
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
    // build the propagator for the propagation of the mean elements
    DSSTPropagator prop = new DSSTPropagator(integrator, true);
    final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(4, 0);
    final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
    DSSTForceModel zonal = new DSSTZonal(provider, 4, 3, 9);
    DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 4, 0, 4, 8, 4, 0, 2);
    prop.addForceModel(zonal);
    prop.addForceModel(tesseral);
    // Set the initial state as osculating
    prop.setInitialState(initialState, false);
    // Check the stored initial state is the osculating one
    Assert.assertEquals(initialState, prop.getInitialState());
    // Check that no propagation, i.e. propagation to the initial date, provides the initial
    // osculating state although the propagator is configured to propagate mean elements !!!
    Assert.assertEquals(initialState, prop.propagate(initialState.getDate()));
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DSSTZonal(org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal) DSSTTesseral(org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) Test(org.junit.Test)

Example 69 with DormandPrince853Integrator

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

the class AdditionalEquationsTest method testInitNumerical.

/**
 * Test for issue #401
 *  with a numerical propagator
 */
@Test
public void testInitNumerical() throws OrekitException {
    // setup
    final double reference = 1.25;
    InitCheckerEquations checker = new InitCheckerEquations(reference);
    Assert.assertFalse(checker.wasCalled());
    // action
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(60);
    NumericalPropagator propagatorNumerical = new NumericalPropagator(integrator);
    propagatorNumerical.setInitialState(initialState.addAdditionalState(checker.getName(), reference));
    propagatorNumerical.addAdditionalEquations(checker);
    propagatorNumerical.propagate(initDate.shiftedBy(600));
    // verify
    Assert.assertTrue(checker.wasCalled());
}
Also used : NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) Test(org.junit.Test)

Example 70 with DormandPrince853Integrator

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

the class AdditionalEquationsTest method testInitDSST.

/**
 * Test for issue #401
 *  with a DSST propagator
 */
@Test
public void testInitDSST() throws OrekitException {
    // setup
    final double reference = 3.5;
    InitCheckerEquations checker = new InitCheckerEquations(reference);
    Assert.assertFalse(checker.wasCalled());
    // action
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(60);
    DSSTPropagator propagatorDSST = new DSSTPropagator(integrator);
    propagatorDSST.setInitialState(initialState.addAdditionalState(checker.getName(), reference));
    propagatorDSST.addAdditionalEquations(checker);
    propagatorDSST.propagate(initDate.shiftedBy(600));
    // verify
    Assert.assertTrue(checker.wasCalled());
}
Also used : AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) DSSTPropagator(org.orekit.propagation.semianalytical.dsst.DSSTPropagator) 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