Getting initial and final values when detectors have no events

Hello, I would like to verify that I am thinking correctly about propagators and event detectors. For example I would like a method to return the max elevation over a time period for a large number of geodetic points for a satellite given by a TLE. To accomplish this I use an ElevationExtremumDetector for each point and add it to the TLEPropagator, but in the case where there are no events because there is no sign change of the g function, then I need to get the elevation at the initial and final epochs since one of these must then be the maximum over the interval.

It appears that calling propagator.propagate() already returns the final SpacecraftState, and it also appears that propagators have a getInitialState() method. So since I have the list of Topocentric frames that I am using with the detectors, in the case that there are no events I should be able to grab the initial and final SpacecraftStates and then call for example

SpacecraftState initialSatState = propagator.getInitialState();

double elevationRadInitial = stationFrame.getElevation(initialSatState.getPVCoordinates().getPosition(), initialSatState.getFrame(), initialSatState.getDate())

for each point of interest. From my testing this appears to produce the correct results, but please let me know if this is a correct approach or if there is a better/preferred/approved way to obtain the initial and final states/elevations, such as using a custom handler or derived detector. Thank you.

Your approach is correct. As extremum detectors monitor the derivative of the elevation and not the elevation by itself, you really need to compute the value by other means. Calling stationFrame.getElevation is the more straightforward mean.

1 Like

Awesome, thank you Luc!

Hi there,

Note that you can implement your own EventDetector or EventHandler that would compute these boundary values on the fly, thanks to the init and finish methods.

Cheers,
Romain.

Hi Romain,

Good to know, thank you. I may be misreading the java, but it looks like a handler would have finish called automatically but the ElevationExtremumDetector doesn’t call the init method by itself, so it looks like I would have to implement the detector to use a handler this way; is that correct?

I was looking at my earlier idea to get the final SpacecraftState from the propagator return, but in the case of PropagatorsParallelizer, a list of SpacecraftState is returned. Since this is using multithreading, is it guaranteed that that list will be in the same order as the propagators list given to the parallelizer? I don’t see any name or other obvious property to correlate a SpacecraftState from the list with the propagator that returned it, but I could be mistaken. Thank you.

The init and finish methods are called by the Propagator itself.

1 Like

Yes, it is guaranteed, see MultiSatStepHandler javadoc for the handleStep method

1 Like

Thank you very much, gentlemen. Your work on Orekit and also on the forum is very much appreciated!