use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator 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.));
}
use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator 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()));
}
use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator 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());
}
use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator 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());
}
use of org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator in project Orekit by CS-SI.
the class IntegratedEphemerisTest method doTestSerializationDSST.
private void doTestSerializationDSST(boolean meanOnly, int expectedSize) throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate finalDate = initialOrbit.getDate().shiftedBy(Constants.JULIAN_DAY);
final double[][] tol = DSSTPropagator.tolerances(1.0, initialOrbit);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(10, Constants.JULIAN_DAY, tol[0], tol[1]);
DSSTPropagator dsstProp = new DSSTPropagator(integrator, meanOnly);
dsstProp.setInitialState(new SpacecraftState(initialOrbit), false);
dsstProp.setEphemerisMode();
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final UnnormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getUnnormalizedProvider(8, 8);
final CelestialBody sun = CelestialBodyFactory.getSun();
final CelestialBody moon = CelestialBodyFactory.getMoon();
final RadiationSensitive spacecraft = new IsotropicRadiationSingleCoefficient(20.0, 2.0);
dsstProp.addForceModel(new DSSTZonal(gravity, 8, 7, 17));
dsstProp.addForceModel(new DSSTTesseral(itrf, Constants.WGS84_EARTH_ANGULAR_VELOCITY, gravity, 8, 8, 4, 12, 8, 8, 4));
dsstProp.addForceModel(new DSSTThirdBody(sun));
dsstProp.addForceModel(new DSSTThirdBody(moon));
dsstProp.addForceModel(new DSSTSolarRadiationPressure(sun, Constants.WGS84_EARTH_EQUATORIAL_RADIUS, spacecraft));
dsstProp.propagate(finalDate);
IntegratedEphemeris ephemeris = (IntegratedEphemeris) dsstProp.getGeneratedEphemeris();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue("size = " + bos.size(), bos.size() > 9 * expectedSize / 10);
Assert.assertTrue("size = " + bos.size(), bos.size() < 11 * expectedSize / 10);
Assert.assertNotNull(ephemeris.getFrame());
Assert.assertSame(ephemeris.getFrame(), dsstProp.getFrame());
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
IntegratedEphemeris deserialized = (IntegratedEphemeris) ois.readObject();
Assert.assertEquals(deserialized.getMinDate(), deserialized.getMinDate());
Assert.assertEquals(deserialized.getMaxDate(), deserialized.getMaxDate());
}
Aggregations