Obtaining all orbital elements over numerical propagation timespan

Hi all!

This might be a silly question but I was wondering if there was a way to obtain the orbital elements at every timestep of a numerical propagation, since the command propagator.propagate(initialDate,finalDate) only gives the results at the end step.

Thank you!

Hi @wzl10

You must add a FixedStepHandler to your propagator. Something like:

propagator.getMultiplexer().add(fixedStep, new MyStepHandler());

The purpose of the MyStepHandler class could be to save the orbital elements at each fixedStep.
Please note that you have to implement the MyStepHandler class to answer your need.

You can find an example in the following tutorial:

Best regards,
Bryan

Hi @bcazabonne ,

I was wondering, is it possible to access the integration steps instead? Imagine I have a very eccentric orbit (e > 0.9) and a long propagation time: to have a good representation of the trajectory and not too many data points, I would need a much smaller step near the perigee than the apogee. I think directly getting the integration steps would be ideal in this case. Is there any way of doing that?

Best regards,
Emiliano

Yes you can do that. Instead of implementing the OrekitFixedStepHandler interface and pass it as the second argument to the multiplexer add method alongside a fixed step, you have to implement the OrekitStepHandler interface and pass it as the single argument to another similar add method.

The handleStep method in OrekitStepHandler is called once for each integration steps and given a full interpolator valid throughout the step.

1 Like

I see, perfect, thank you!

Just for my understanding: I presume the handleStep method is only called once the correct step size is computed, correct? And I imagine this is also the case when EventDetectors are added to the propagator. I assume the EventDetector is first used to determine when the step should end, and only then the handleStep is called, right?

Yes, the step is truncated when an event handler is triggered.