How to include eclipse detector in propagation

I have a problem with including eclipse detector in orbit propagation right way, i mean to make it work. I don’t know if all the problem is in event handler. I use ContinueOnEvent(), but how does it work? There are no iterations in Master mode for it to work as continue command usually does. We’re including eclipse detector this way: propagator_num.addEventDetector(). But we don’t point out that detector is related to solar pressure. So if i’ll comment propagator_num.addEventDetector() i will get right the same result for end state, as if it would be uncommented. How can I fix it or do I have to write my own handler?

Here is my script:

from math import radians
import orekit
vm = orekit.initVM()
from orekit.pyhelpers import setup_orekit_curdir, absolutedate_to_datetime
from org.orekit.orbits import KeplerianOrbit, PositionAngle, OrbitType
from org.orekit.time import AbsoluteDate, TimeScalesFactory
from org.orekit.utils import Constants, IERSConventions
from org.orekit.frames import FramesFactory
from org.orekit.bodies import CelestialBodyFactory, OneAxisEllipsoid
from org.orekit.propagation.numerical import NumericalPropagator
from org.hipparchus.ode.nonstiff import DormandPrince853Integrator, ClassicalRungeKuttaIntegrator
from org.orekit.propagation import SpacecraftState#, PropagationType
from org.orekit.forces.gravity.potential import GravityFieldFactory
from org.orekit.forces.gravity import HolmesFeatherstoneAttractionModel, ThirdBodyAttraction
from org.orekit.forces.radiation import IsotropicRadiationSingleCoefficient, SolarRadiationPressure#, IsotropicRadiationClassicalConvention
from orekit import JArray_double
#from org.orekit.propagation.semianalytical.dsst import DSSTPropagator
from import EclipseDetector, EventsLogger
from import ContinueOnEvent

utc = TimeScalesFactory.getUTC()
a = 42462955.1679242 # Semimajor Axis (m)
e = 0.0003862 # Eccentricity
i = radians(8.8286) # Inclination (radians)
omega = radians(105.1223) # Perigee argument (radians)
raan = radians(47.643600000000006) # Right ascension of ascending node (radians)
lv = radians(-98.00505062708943) # Anomaly (rad/s)

epochDate = AbsoluteDate(2021, 9, 23, 0, 0, 00.000, utc)
initialDate = epochDate

inertialFrame = FramesFactory.getEME2000()

initialOrbit = KeplerianOrbit(a, e, i, omega, raan, lv,
inertialFrame, epochDate, Constants.WGS84_EARTH_MU)

minStep = 0.001
maxstep = 10**5.0
initStep = 1000.0

positionTolerance = 1e-5
tolerances = NumericalPropagator.tolerances(positionTolerance,

integrator = DormandPrince853Integrator(minStep, maxstep,
JArray_double.cast_(tolerances[0]), # Double array of doubles needs to be casted in Python


satellite_mass = 1.0 # The models need a spacecraft mass, unit kg.
initialState = SpacecraftState(initialOrbit, satellite_mass)

propagator_num = NumericalPropagator(integrator)

ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)

earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
sun = CelestialBodyFactory.getSun()
sunRadius = 696000000.0

eclipse_detector = EclipseDetector(sun, sunRadius, earth).withUmbra().withHandler(ContinueOnEvent())
logger = EventsLogger()
logged_detector = logger.monitorDetector(eclipse_detector)
events = logger.getLoggedEvents()

cr = 2.0 #reflection coefficient (Albedo)
area = 1.0 #crossSection - Surface (m²)
propagator_num.addForceModel(SolarRadiationPressure(sun, earth.getEquatorialRadius(),
IsotropicRadiationSingleCoefficient(area, cr)))

end_state = propagator_num.propagate(initialDate, initialDate.shiftedBy(86400.0 * 365))

Hi there,

I think you need to call the getLoggedEvents after the call to propagate (except if it’s a reference that you’re getting but I don’t think so).
Are you aware that you overwrite your integrator?
For DP, your tolerance at 1e-5 (in meters) is quite low. I would increase it by a few orders of magnitude. You should also decrease the maximum stepsize, 100000 seconds is very high.

Edit: not sure I understand your question about the radiation pressure, but it’s a force in the dynamics that has no direct link to the Earth eclipses.


Hi @daiana,

Welcome to the forum!

Romain already answered your questions but I just wanted to add something related to SRP.

A lighting/eclipse model is already embedded in the SRP perturbation (see the force model SolarRadiationPressure) so you don’t need to take into account.

Thank you, Romain, for noticing a flaw in my code!! I’ve just experimented a little with integrator parameters and forget to change it back to normal ones.