List of usage examples for org.apache.commons.math3.ode.nonstiff DormandPrince853Integrator DormandPrince853Integrator
public DormandPrince853Integrator(final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance)
From source file:org.orekit.propagation.events.AlignmentDetectorTest.java
@Before public void setUp() { try {//from www. j a v a2 s . c o m 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()); } }
From source file:org.orekit.propagation.events.EclipseDetectorTest.java
@Before public void setUp() { try {/*from w w w . j a v a 2s. co m*/ Utils.setDataRoot("regular-data"); 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.getGCRF(), 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()); } }
From source file:org.orekit.propagation.events.EventsLoggerTest.java
@Before public void setUp() { try {//from w w w .j a v a2s . com Utils.setDataRoot("regular-data"); 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); count = 0; umbraDetector = buildDetector(true); penumbraDetector = buildDetector(false); } catch (OrekitException oe) { Assert.fail(oe.getLocalizedMessage()); } }
From source file:org.orekit.propagation.events.NodeDetectorTest.java
@Test public void testIssue138() throws OrekitException { double a = 800000 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS; double e = 0.0001; double i = FastMath.toRadians(98); double w = -90; double raan = 0; double v = 0; Frame inertialFrame = FramesFactory.getEME2000(); AbsoluteDate initialDate = new AbsoluteDate(2014, 01, 01, 0, 0, 0, TimeScalesFactory.getUTC()); AbsoluteDate finalDate = initialDate.shiftedBy(5000); KeplerianOrbit initialOrbit = new KeplerianOrbit(a, e, i, w, raan, v, PositionAngle.TRUE, inertialFrame, initialDate, Constants.WGS84_EARTH_MU); SpacecraftState initialState = new SpacecraftState(initialOrbit, 1000); double[][] tol = NumericalPropagator.tolerances(10, initialOrbit, initialOrbit.getType()); AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]); NumericalPropagator propagator = new NumericalPropagator(integrator); propagator.setInitialState(initialState); // Define 2 instances of NodeDetector: EventDetector rawDetector = new NodeDetector(1e-6, initialState.getOrbit(), initialState.getFrame()) .withHandler(new ContinueOnEvent<NodeDetector>()); EventsLogger logger1 = new EventsLogger(); EventDetector node1 = logger1.monitorDetector(rawDetector); EventsLogger logger2 = new EventsLogger(); EventDetector node2 = logger2.monitorDetector(rawDetector); propagator.addEventDetector(node1);/*from w w w . j ava2 s . co m*/ propagator.addEventDetector(node2); // First propagation propagator.setEphemerisMode(); propagator.propagate(finalDate); Assert.assertEquals(2, logger1.getLoggedEvents().size()); Assert.assertEquals(2, logger2.getLoggedEvents().size()); logger1.clearLoggedEvents(); logger2.clearLoggedEvents(); BoundedPropagator postpro = propagator.getGeneratedEphemeris(); // Post-processing postpro.addEventDetector(node1); postpro.addEventDetector(node2); postpro.propagate(finalDate); Assert.assertEquals(2, logger1.getLoggedEvents().size()); Assert.assertEquals(2, logger2.getLoggedEvents().size()); }
From source file:org.orekit.propagation.integration.IntegratedEphemerisTest.java
@Test public void testSerializationDSST() throws PropagationException, 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]);//from ww w .j a va 2 s . co m DSSTPropagator dsstProp = new DSSTPropagator(integrator); dsstProp.setInitialState(new SpacecraftState(initialOrbit), false); dsstProp.setEphemerisMode(); dsstProp.propagate(finalDate); IntegratedEphemeris ephemeris = (IntegratedEphemeris) dsstProp.getGeneratedEphemeris(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(ephemeris); Assert.assertTrue(bos.size() > 8000); Assert.assertTrue(bos.size() < 9000); 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()); }
From source file:org.orekit.propagation.integration.IntegratedEphemerisTest.java
@Test(expected = NotSerializableException.class) public void testSerializationDSSTNotSerializableForceModel() throws PropagationException, 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]);// w w w . j a va 2 s. co m DSSTPropagator dsstProp = new DSSTPropagator(integrator); dsstProp.setInitialState(new SpacecraftState(initialOrbit), false); // set up a dummy not serializable force model dsstProp.addForceModel(new DSSTForceModel() { public void initializeStep(AuxiliaryElements aux) { } public void initialize(AuxiliaryElements aux, boolean meanOnly) { } public double[] getShortPeriodicVariations(AbsoluteDate date, double[] meanElements) { return new double[6]; } public double[] getMeanElementRate(SpacecraftState state) { return new double[6]; } public EventDetector[] getEventsDetectors() { return null; } @Override public void registerAttitudeProvider(AttitudeProvider provider) { } public void computeShortPeriodicsCoefficients(SpacecraftState state) { } @Override public void resetShortPeriodicsCoefficients() { } }); dsstProp.setEphemerisMode(); dsstProp.propagate(finalDate); IntegratedEphemeris ephemeris = (IntegratedEphemeris) dsstProp.getGeneratedEphemeris(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(ephemeris); }
From source file:org.orekit.propagation.integration.IntegratedEphemerisTest.java
@Before public void setUp() { // Definition of initial conditions with position and velocity Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6); Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0); double mu = 3.9860047e14; AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.); initialOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);/* ww w . j av a 2s . c o m*/ // Numerical propagator definition double[] absTolerance = { 0.0001, 1.0e-11, 1.0e-11, 1.0e-8, 1.0e-8, 1.0e-8, 0.001 }; double[] relTolerance = { 1.0e-8, 1.0e-8, 1.0e-8, 1.0e-9, 1.0e-9, 1.0e-9, 1.0e-7 }; AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 500, absTolerance, relTolerance); integrator.setInitialStepSize(100); numericalPropagator = new NumericalPropagator(integrator); }
From source file:org.orekit.propagation.numerical.NumericalPropagatorTest.java
@Test public void testEphemerisDates() throws OrekitException { //setup// w ww . j a v a 2 s . co m 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); double[][] tol = NumericalPropagator.tolerances(1, orbit, OrbitType.CARTESIAN); Propagator prop = new NumericalPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1])); 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); }
From source file:org.orekit.propagation.numerical.NumericalPropagatorTest.java
@Test public void testEphemerisDatesBackward() throws OrekitException { //setup/* w w w. j a v a 2 s .c o m*/ TimeScale tai = TimeScalesFactory.getTAI(); AbsoluteDate initialDate = new AbsoluteDate("2015-07-05", 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); double[][] tol = NumericalPropagator.tolerances(1, orbit, OrbitType.CARTESIAN); Propagator prop = new NumericalPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1])); prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit))); //action prop.setEphemerisMode(); prop.propagate(endDate, startDate); 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); }
From source file:org.orekit.propagation.numerical.NumericalPropagatorTest.java
private PVCoordinates propagateInType(SpacecraftState state, double dP, OrbitType type, PositionAngle angle) throws PropagationException { final double dt = 3200; final double minStep = 0.001; final double maxStep = 1000; double[][] tol = NumericalPropagator.tolerances(dP, state.getOrbit(), type); AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]); NumericalPropagator newPropagator = new NumericalPropagator(integrator); newPropagator.setOrbitType(type);//from www . jav a2 s . c o m newPropagator.setPositionAngleType(angle); newPropagator.setInitialState(state); for (ForceModel force : propagator.getForceModels()) { newPropagator.addForceModel(force); } return newPropagator.propagate(state.getDate().shiftedBy(dt)).getPVCoordinates(); }