Hi everyone,
I think there is a bug with additional states in the AbstractAnalyticalPropagator.BoundedPropagatorView.
I want to use the KeplerianPropagator with a SpacecraftState containing an additional state.
The propagation has no problem, and the final state contains the additional state. However, the generated ephemeris created by the KeplerianPropagator has a strange behaviour.
By calling the method getInitialState on the generated BoundedPropagator, we obtain the same as the initial state of the KeplerianPropagator, but the final state, after propagation, loses its additional state.
By using debug on the BoundedPropagatorView, we can find that the initialState is null, but this$0.initialState is the correct initial state. The second one is called by the getInitialState or the resetInitialState methods, but the first one is used in AbstractPropagator.initializePropagation, a method that looks for additional states. Thus, AbstractPropagator is looking at the wrong (and null) additional state.
Here is a test to reproduce this case:
@Test
public void testEphemerisModeWithHandler() {
double mu = 3.9860047e14;
AbsoluteDate initDate = AbsoluteDate.GPS_EPOCH;
Orbit ic = new KeplerianOrbit(6378137 + 500e3, 1e-3, 0, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getGCRF(), initDate, mu);
Propagator propagator = new KeplerianPropagator(ic);
SpacecraftState initialState = propagator.getInitialState().addAdditionalState("myState", 4.2);
propagator.resetInitialState(initialState);
AbsoluteDate end = initDate.shiftedBy(90 * 60);
propagator.setEphemerisMode();
SpacecraftState finalStateKeplerianPropagator = propagator.propagate(end);
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
SpacecraftState ephemerisInitialState = ephemeris.getInitialState();
SpacecraftState finalStateBoundedPropagator = ephemeris.propagate(end);
finalStateKeplerianPropagator.getAdditionalState("myState");
ephemerisInitialState.getAdditionalState("myState");
finalStateBoundedPropagator.getAdditionalState("myState");
}
Do you think it is an issue, or am I using the propagator wrong ?
Regards,
Valérian