`resetInitialState` of Ephemeris, IntegratedEphemeris is not allowed

Hi Forum,

I am trying to analyze multiple scenarios with a different initial value of an additional state (say initial battery/charge available). But the orbital values don’t change across multiple scenarios (Position, velocity, etc). So what I tried to do was to create an IntegratedEphemeris at the end of the numerical propagation once. IntegratedEphemeris still contains all the event detectors, attitude providers, etc.

So I wanted to change the initial value of one of the additional states and propagate again (and I thought this time it would not propagate the orbit) and would only recompute the new additional state using the providers. So I tried to reset the initial state of the IntegratedEphemeris using resetInitialState method, but I ended up with an OrekitException saying reset state not allowed. I understand this was done to make sure the ephemeris is served as a (read-only) copy.

But how do I achieve this kind of reset so that I don’t end up doing orbital propagation every time and only recompute additional states with new initial values??

Thanks in advance!

Hi @gowtham

I understand your problem and unfortunately, I don’t see any easy solution. As you mentioned, an ephemeris propagator cannot be reset (i.e., its states and additional ones). This applies for both IntegratedEphemeris and Ephemeris interpolators. An interesting solution to try could be to access the list of SpacecraftStates of the interpolator and update manually the additional states. But there is no getter method to access the internal states of the interpolator.

I don’t know if a solution like that is possible (based on Java reference to objects)

List<SpacecraftStates> myInputStates = ... // Your initial list of spacecraft states based on a propagation
int interpolationDegree = 2;
Ephemeris interpolator = new Ephemeris(myInputStates, interpolationDegree)
myInputStates = ... // Update the initial list of input states with additional states
interpolator.propagate(interpolationEpoch); // Interpolate again

I think there is 0.001% of change that this thing work.

If it doesn’t work. I’m sorry but I think you have to create one instance of Ephemeris interpolator per scenario…

I never tried it, but maybe you could try to put all the Ephemeris interpolators inside a PropagatorsParallelizer in order to have only one call to the propagate(...) method.

List<Propagator> propagators = new ArrayList<>();
List<SpacecraftStates> myInputStates = ... // Your initial list of spacecraft states based on a propagation
int interpolationDegree = 2;
// First scenario
List<SpacecraftState> firstScenarioStates = ... // Same as myInputStates but with first scenario conditions
Ephemeris firstScenarioInterpolator = new Ephemeris(firstScenarioStates, interpolationDegree)
// Second scenario
List<SpacecraftState> secondScenarioStates = ...  // Same as myInputStates but with second scenario conditions
Ephemeris secondScenarioInterpolator = new Ephemeris(secondScenarioStates, interpolationDegree)
// Third scenario
// Create the PropagatorsParallelizer
final PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(propagators, interpolators -> {});

Maybe this could be an interesting workaround to try. I hope this will help you.

Best regards,