@Test public void testIssue157() throws OrekitException { try { Orbit orbit = new KeplerianOrbit( 13378000, 0.05, 0, 0, FastMath.PI, 0, PositionAngle.MEAN, FramesFactory.getTOD(false), new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU); NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN); Assert.fail("an exception should have been thrown"); } catch (PropagationException pe) { Assert.assertEquals(OrekitMessages.SINGULAR_JACOBIAN_FOR_ORBIT_TYPE, pe.getSpecifier()); } }
@Test public void testEphemerisAdditionalState() throws OrekitException, IOException { // Propagation of the initial at t + dt final double dt = -3200; final double rate = 2.0; propagator.addAdditionalStateProvider( new AdditionalStateProvider() { public String getName() { return "squaredA"; } public double[] getAdditionalState(SpacecraftState state) { return new double[] {state.getA() * state.getA()}; } }); propagator.addAdditionalEquations( new AdditionalEquations() { public String getName() { return "extra"; } public double[] computeDerivatives(SpacecraftState s, double[] pDot) { pDot[0] = rate; return null; } }); propagator.setInitialState(propagator.getInitialState().addAdditionalState("extra", 1.5)); propagator.setOrbitType(OrbitType.CARTESIAN); propagator.setEphemerisMode(); propagator.propagate(initDate.shiftedBy(dt)); final BoundedPropagator ephemeris1 = propagator.getGeneratedEphemeris(); Assert.assertEquals(initDate.shiftedBy(dt), ephemeris1.getMinDate()); Assert.assertEquals(initDate, ephemeris1.getMaxDate()); try { ephemeris1.propagate(ephemeris1.getMinDate().shiftedBy(-10.0)); Assert.fail("an exception should have been thrown"); } catch (PropagationException pe) { Assert.assertEquals(OrekitMessages.OUT_OF_RANGE_EPHEMERIDES_DATE, pe.getSpecifier()); } try { ephemeris1.propagate(ephemeris1.getMaxDate().shiftedBy(+10.0)); Assert.fail("an exception should have been thrown"); } catch (PropagationException pe) { Assert.assertEquals(OrekitMessages.OUT_OF_RANGE_EPHEMERIDES_DATE, pe.getSpecifier()); } double shift = -60; SpacecraftState s = ephemeris1.propagate(initDate.shiftedBy(shift)); Assert.assertEquals(2, s.getAdditionalStates().size()); Assert.assertTrue(s.hasAdditionalState("squaredA")); Assert.assertTrue(s.hasAdditionalState("extra")); Assert.assertEquals(s.getA() * s.getA(), s.getAdditionalState("squaredA")[0], 1.0e-10); Assert.assertEquals(1.5 + shift * rate, s.getAdditionalState("extra")[0], 1.0e-10); try { ephemeris1.resetInitialState(s); Assert.fail("an exception should have been thrown"); } catch (OrekitException oe) { Assert.assertEquals(OrekitMessages.NON_RESETABLE_STATE, oe.getSpecifier()); } }