Reset state using EventHandler with the step handler not working as expected

Hi forum,

I am currently working with a propagator configured with some detectors (with handlers) and also a fixed step handler (mainly for sampling).

The detector is based on an additional state and when the event occurs, the handler’s eventOccured method returns a RESET_STATE action which in turn resets the additional state which caused the event to occur. For example, I have BatteryMaxCapacityReachedDetector which is dependant on the battery capacity additional state and when it reaches the max capacity, the handler resets the additional state (battery capacity) to the max capacity. This is developed to make sure we detect exactly when it reaches the capacity and does not overshoot.

The handler seems to work perfectly and I can confirm even the resetState is triggered with right values. There is a parallel fixed orekit step handler to sample the additional state values, which when we take a look at is overshooting and it does not seem to capture the event.

An example sampling looks like the following (with battery capacity being 100)

  • AdditionalState at T = 0, 80
  • AdditionalState at T = 10, 90
    EVENT OCCURS AT T=18, additionalState reaches 100 (I know this from resetState trigger)
  • AdditionalState at T = 20, 102 [OVERSHOOT]

The battery capacity evolves using an AdditionalEquations interface which checks for the capacity and computes the derivatives. Is there any configuration that I would be missing because of which an overshoot might be happening?