Exception when accessing ephemeris state on start date
In the following test case ephemeris.getPVCoordinates(startDate, eci) will throw an exception. This is a bug because the ephemeris should be valid starting on startDate. The issue seems to be the imprecision in StateMapper.mapDoubleToDate(). This causes the the ephemeris's start date to be slightly different from startDate, sometimes greater and other times less, resulting in unpredictable behaviour.
I'm not sure the best way to fix it. Any ideas?
As a work around I started using a start date 1 second before and an end date 1 second after my actual start and end dates.
~
@Test
public void testEphemerisDates() throws OrekitException {
//setup
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
AbsoluteDate startDate = new AbsoluteDate("2015-07-03",
tai).shiftedBy(-0.11);
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));
}
~
(from redmine: issue id 210, created on 2015-07-01, closed on 2016-02-10)
- Changesets:
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210
- Revision d5089565 by Evan Ward on 2015-08-27T14:32:44Z:
Fix ephemeris start and end dates
Previously a generated ephemeris may not have been available at the start and
stop times used for propagation because of numerical precision issues. Now the
real start and end AbsoluteDates are used if they are equivalent to the double
representation of time. The public interfaces ModeHandler and StateMapper were
changed. Includes test cases for the numerical and DSST propagators.
Fixes #210