EclipseDetector Missing event

I am using an EclipseDetector with an EphemerisSegmentPropagator and am noticing that if the EclipseDetector is given an initial state that is within eclipse, then it will not detect the initial exit from eclipse. Below is the snippet of code performing the computation.

// Parse ephemeris string and create interpolating propagator
                final double mu = Constants.EIGEN5C_EARTH_MU;
                final boolean simpleEop = true;
                final IERSConventions conventions = IERSConventions.IERS_2010;
                final OemParser parser = new ParserBuilder(dataContext)
                        .withMu(mu)
                        .withConventions(conventions)
                        .withSimpleEOP(simpleEop)
                        .buildOemParser();
                final Oem oemFile = parser.parse(new DataSource(satelliteId, () -> new StringReader(propagatedEphemerisData)));
                final OemSegment ephemerisSegment = oemFile.getSegments().getFirst();
                final Frame ephemerisFrame = ephemerisSegment.getFrame();
                EphemerisSegmentPropagator propagator = new EphemerisSegmentPropagator(ephemerisSegment, new LofOffset(ephemerisFrame, LOFType.VVLH));

                // Construct eclipse detector
                OneAxisEllipsoid occultingEarth = ReferenceEllipsoid.getWgs84(dataContext.getFrames().getITRF(conventions, true));
                final AbsoluteDate[] eclipseStartTime = {propagateStart};
                final AbsoluteDate[] eclipseStopTime = {propagateStart};
                final AbsoluteDate[] eclipseManeuverTime = {tca};
                EclipseDetector eclipseDetector = new EclipseDetector(dataContext.getCelestialBodies().getSun(), Constants.SUN_RADIUS, occultingEarth)
                        .withPenumbra()
                        .withHandler((s, detector, increasing) -> {
                            // If exiting eclipse update stop time to new eclipse stop time
                            if (increasing) {
                                eclipseStopTime[0] = s.getDate();
                            // If entering eclipse update start time to new eclipse start time
                            } else {
                                eclipseStartTime[0] = s.getDate();
                                return Action.STOP;
                                }
                            }
                            return Action.CONTINUE;
                        });
                propagator.addEventDetector(eclipseDetector);
                propagator.propagate(propagateStart, propagateEnd);

The initial state of the propagator is set to be within eclipse so I would expect that increasing would be true at the first triggering of the event handler and it would update the eclipse stop time. Instead the detector is only triggered after the satellite exits eclipse then reenters again. Any ideas why that would be occuring?

Thanks,
Scott

Hi,

Have you tried changing the “max check”?
Try adding withMaxCheck(10) or any number smaller than the time to eclipse exit.

Cheers,
Romain.

I realized that the issue was with a change in the propagationStart time that occurs earlier in my code. I was actually beginning the propagation after the satellite exists the first eclipse. :man_facepalming:

1 Like