"no cached entries" while trying to calculate eclipse

Hi - first post here (and new to orekit!) and after searching various examples, can’t figure out my error. I’m reading in a set of TLEs and for each TLE, calculating ground station visibilities (using ElevationDetector). This works fine. But when I try to calculate when the given TLE is in eclipse (using EclipseDetector), I get the following stack trace:

Exception in thread "main" org.orekit.errors.OrekitIllegalStateException: no cached entries
	at org.orekit.utils.GenericTimeStampedCache.getLatest(GenericTimeStampedCache.java:253)
	at org.orekit.bodies.JPLEphemeridesLoader$EphemerisRawPVProvider.getRawPV(JPLEphemeridesLoader.java:1055)
	at org.orekit.bodies.JPLCelestialBody.getPVCoordinates(JPLCelestialBody.java:113)
	at org.orekit.propagation.events.EclipseDetector.g(EclipseDetector.java:180)
	at org.orekit.propagation.events.EventsLogger$LoggingWrapper.g(EventsLogger.java:214)
	at org.orekit.propagation.events.EventState.g(EventState.java:153)
	at org.orekit.propagation.events.EventState.reinitializeBegin(EventState.java:165)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.acceptStep(AbstractAnalyticalPropagator.java:208)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:168)
	at wjk.com.sattrack.EclipseTest.main(EclipseTest.java:86)

Stepping through debugger, it looks like I’m correctly reading JPL ephemeris so I’m not sure what the issue is. Here is code:

public static void main(String[] args) {

	// TLE data provider
	log.info("Loading tles ...");
	TLESeries brightestTles = OrekitDataManager.getTleSeries("brightest.tle");
	log.info("Sat nums: " + brightestTles.getAvailableSatelliteNumbers());

	// build sun
	CelestialBody sun = CelestialBodyFactory.getSun();
	double sunRadius = 696000000.;

	// build eclipsing body
	Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
	OneAxisEllipsoid earthEllipse = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
			Constants.WGS84_EARTH_FLATTENING, earthFrame);

	// build station
	final double longitude = FastMath.toRadians(-104.9);
	final double lat = FastMath.toRadians(39.5);
	final double altitude = 6000.0 * 0.3048;
	GroundStation home = new GroundStation(lat, longitude, altitude, "Home");

	// build elevation detector
	final double elevation = FastMath.toRadians(5.0);
	ElevationDetector homeVis = home.makeElevationDetector(elevation)
			.withHandler(new RecordAndContinue<ElevationDetector>());

	// build eclipse detector
	EclipseDetector withFlattening = new EclipseDetector(sun, sunRadius, earthEllipse).withMaxCheck(60.0)
			.withThreshold(1.0e-3).withHandler(new ContinueOnEvent<>()).withUmbra();

	// Not applicable but SGP4 requires it ....
	AttitudeProvider attProv = InertialProvider.EME2000_ALIGNED;

	// get current time as basis for propagation interval
	AbsoluteDate tNow = TimeUtil.getTimeNow();
	AbsoluteDate tStop = tNow.shiftedBy(86400 / 24);

	// fore each named tle in collection, calculate rise/set and tle eclipse times
	for (NamedTLE tle : brightestTles.getTleCollection()) {
		log.info("Generating visibilities for " + tle.getName());

		// build propagator for tle and add detectors
		Propagator prop = new SGP4(tle, attProv, 1000);
		EventsLogger eventsLogger = new EventsLogger();
		prop.addEventDetector(eventsLogger.monitorDetector(homeVis));
		prop.addEventDetector(eventsLogger.monitorDetector(withFlattening));

		SpacecraftState finalState = prop.propagate(tNow, tStop);
		printVisibilities(eventsLogger);
		eventsLogger.clearLoggedEvents();
	}
	log.info("Done");
}

Thanks for any help you can offer!

Hi @wkirsche

Welcome to the Orekit forum!

You have two things to verify:

  1. First, you can verify if you load the orekit-data properly at the beginning of your program. The following code is made to initialize the orekit-data:

         // configure Orekit
         final File home       = new File(System.getProperty("user.home"));
         final File orekitData = new File(home, "orekit-data");
         final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
         manager.addProvider(new DirectoryCrawler(orekitData));
    
  2. Second, you have to verify if, for the epoch of your data, you are reading a JPL ephemeris with the correct time span. Indeed, sometime it is possible to perform computations at a given epoch which is not inside the time span of the JPL ephemeris.

Best regards,
Bryan

Thank you! I figured it was a stupid mistake on my part. I was using some of the sample data that only had a small set of JPL ephemeris.