Combining detectors (Python wrapped)

Hello, I am new to Orekit. I am working with the python-wrapped version and currently I’m trying to combine detectors in order to find visibility periods from an optical ground station propagating a TLE. I am able to find such periods but I’d like to find also the maximum elevation reached by the satellite. So I want to know if there exists a method to do this automatically, without a second routine, which would be too much expensive since I am propagating for a year since now.

This is my code, thank you:

#Sat above horizon
horizon_limit = 10.0
is_sat_above_horizon = ElevationDetector(station_frame).withConstantElevation(radians(horizon_limit)).withHandler(ContinueOnEvent())
#Observation site at night
duskdawn_elevation = radians(-10.0)
is_ground_at_night = GroundAtNightDetector(station_frame, CelestialBodyFactory.getSun(), duskdawn_elevation, EarthITU453AtmosphereRefraction(duskdawn_elevation)).withHandler(ContinueOnEvent())
#Sat illumination detector
is_sat_illuminated = EclipseDetector(CelestialBodyFactory.getSun(), Constants.SUN_RADIUS, earth).withPenumbra().withHandler(ContinueOnEvent())
#Combine detectors
combined_detector = BooleanDetector.andCombine([is_sat_illuminated, is_ground_at_night, is_sat_above_horizon])
#Detect events
logger = EventsLogger()
logged_detector = logger.monitorDetector(combined_detector)
#Get two line elements
mytle = TLE(tle_line1,tle_line2)
#Select propagator based on TLE
propagator = TLEPropagator.selectExtrapolator(mytle)
#Use the combined detector
propagator.addEventDetector(logged_detector)
state = propagator.propagate(start_date, end_date)

Welcome!

ElevationExtremumDetector does exactly that. From the javadoc:

This detector identifies when a spacecraft reaches its extremum elevation with respect to a ground point.

Thank you for the reply! I looked at ElevationExtremumDetector over the past days. My question is: can I use it togheter with the other detectors simultaneously? In such a way to obtain with the same propagation routine both the visibility period and the maximum reached elevation.

You cannot include it in the BooleanDetector.andCombine because its detection function does not have the semantics of in/out status. You can however call propagator.addEventDetector as often as you want, i.e. once with your already defined combined_detector and another time with the extremum elevation detector (which you can also wrap as a logged event for later post-processing).

You may try to wrap the event within a EventEnablingPredicateFilter that would be activated/deactivated by the other detector, so you will only be notified by events that occur when all observing conditions are met, and the other events (minimum elevation, maximum elevation when ground is at day…) are not computed at all, hence speeding up the propagation. Beware that if you use EventEnablingPredicateFilter, it tinkers with the raw detection g function, so if you also wants to do fancy things like inserting another layer with an EventSlopeFilter for example, this may not work as expected. Anyway, using the predicate filter is probably better in your case than EventSlopeFilter as ensuring the satellite is above horizon already ensures the extremum is a maximum.

Another point I forgot to explain: when you call propagator.addEventDetector several time, you do it to configure the propagator by registering a bunch of detectors, and once configured, you call propagator.propagate only once: it will manage all the registered detectors simultaneously during a single propagation run. You can have tens of even hundreds of detectors registered at the same time. So you could for example still perform one propagation only and manage visibility from several ground stations at once.

Still another point: propagating a TLE over one year is doomed to failure. The TLE model will diverge after just a few days, so predicted events will be wrong.

Thank you so much, really exhaustive. Surely I’m aware of the issues related on the long-term propagation of a TLE, but i need a raw long term prediction for a project.

Thank you, again!

Hi @lor_cim

What do you mean by long term predicition? How many days or months or years?

Maybe in this case using a semi-analytical orbit propagation method could be interesting. It is a trade of between the accuracy of a numerical method and the computation time of an analytical method. A semi-analytical method computes the mean elements (i.e., long term variations) using a numerical method and the short period variations using analytical methods. Because only the mean elements are computed numerically, semi-analytical models can use big intergration steps (e.g., 12 hours or even 24 hours)

In Orekit, the semi analytical propagator is the DSSTPropagator. Its initialization is close to the NumericalPropagator (i.e., numerical integrator and force models initialization). You can find a Java tutorial about DSST just below, but if you have any question don’t hesitate.

Best regards,
Bryan

Also, you can add event detectors to the DSSTPropagator.

If using DSST with events be aware of DSST osculating state passed to EventDetector.g(...) inconsistent with states passed to EventHandler and StepHandler (#834) · Issues · Orekit / Orekit · GitLab