Hello!!
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
setup_orekit_curdir()
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 org.orekit.propagation.events import EclipseDetector, EventsLogger
from org.orekit.propagation.events.handlers 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,
PositionAngle.TRUE,
inertialFrame, epochDate, Constants.WGS84_EARTH_MU)
minStep = 0.001
maxstep = 10**5.0
initStep = 1000.0
positionTolerance = 1e-5
tolerances = NumericalPropagator.tolerances(positionTolerance,
initialOrbit,
initialOrbit.getType())
integrator = DormandPrince853Integrator(minStep, maxstep,
JArray_double.cast_(tolerances[0]), # Double array of doubles needs to be casted in Python
JArray_double.cast_(tolerances[1]))
integrator.setInitialStepSize(initStep)
integrator=ClassicalRungeKuttaIntegrator(initStep)
satellite_mass = 1.0 # The models need a spacecraft mass, unit kg.
initialState = SpacecraftState(initialOrbit, satellite_mass)
propagator_num = NumericalPropagator(integrator)
propagator_num.setOrbitType(OrbitType.CARTESIAN)
propagator_num.setInitialState(initialState)
ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True)
earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
ITRF)
sun = CelestialBodyFactory.getSun()
sunRadius = 696000000.0
eclipse_detector = EclipseDetector(sun, sunRadius, earth).withUmbra().withHandler(ContinueOnEvent())
logger = EventsLogger()
logged_detector = logger.monitorDetector(eclipse_detector)
propagator_num.addEventDetector(logged_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))