Infinite loop combining `LongitudeCrossingDetector` and another `EventDetector`
Hi Orekit
I found this infinite loop adding another event detector when already a LongitudeCrossingDetector
is defined.
Here the discussion on the forum: https://forum.orekit.org/t/not-converging-propagation-combining-eclipsedetector-and-longitudecrossingdetector/2886/3
Here my tests:
- LongitudeCros- singDetector → works
- LatitudeCrossingDetector → works
- LongitudeCrossingDetector + EclipseDetector → no converges
- LatitudeCrossingDetector + EclipseDetector → works
- LongitudeCrossingDetector + LatitudeCrossingDetector → no converges
Here the JUnit Test
long endTimestamp = 1366547952523L;
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, false);
final OneAxisEllipsoid earthShapeIERS = new OneAxisEllipsoid(
org.orekit.utils.Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
org.orekit.utils.Constants.WGS84_EARTH_FLATTENING,
itrf);
//Add logger and events
EventsLogger logger = new EventsLogger();
EventDetector longDetector = new LongitudeCrossingDetector(earthShapeIERS, FastMath.toRadians(-83.4))
.withHandler(new ContinueOnEvent<>());
final EclipseDetector sunEclipseDetector = new EclipseDetector(
CelestialBodyFactory.getSun(), org.orekit.utils.Constants.SUN_RADIUS,
earthShapeIERS)
.withHandler(new ContinueOnEvent<>());
//TLE propagator from ISS 2013 orbit
TLE tle = new TLE("1 25544U 98067A 13110.27262069 .00008419 00000-0 14271-3 0 6447",
"2 25544 51.6474 35.7007 0010356 160.4171 304.1803 15.52381363825715");
TLEPropagator propagator = TLEPropagator.selectExtrapolator(tle);
//Add event detectors and propagate
propagator.addEventDetector(logger.monitorDetector(longDetector));
propagator.addEventDetector(logger.monitorDetector(sunEclipseDetector));
propagator.propagate(Time.getAbsoluteDateFromEpochMilli(endTimestamp));
//Get logged events
assertFalse(logger.getLoggedEvents().stream()
.filter(e -> e.getEventDetector() instanceof LongitudeCrossingDetector)
.toList()
.isEmpty());
where:
public static AbsoluteDate getAbsoluteDateFromTimestamp(long timestamp) {
LocalDateTime utcDate = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), UTC_ZONE_ID);
val year = utcDate.getYear();
val month = utcDate.getMonthValue();
val day = utcDate.getDayOfMonth();
val hour = utcDate.getHour();
val minute = utcDate.getMinute();
val second = utcDate.getSecond();
val millis = utcDate.getNano() / 1e9;
return new AbsoluteDate(year, month, day, hour, minute, second, TimeScalesFactory.getUTC()).shiftedBy(millis);
}
Thanks! Alberto
Edited by Alberto Ferrero