EclipseDetect event is not triggered
EclipseDetectorEvent is not triggered when the initial date is entered as any date after “29th of July 2015”. Other events such as EquatorCrossings, Visibility events are working properly.
I’ve used numerical propogator and added the EclipseEvent as follows:
~
NumericalPropagator propagator = null;
EventDetector rawDetector = null;
EventsLogger logger1 = new EventsLogger();
try
{
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initDate = getAbsoluteDate(utc);
// Orbit construction as Keplerian
keplerOrbit = new KeplerianOrbit(keplerianA, keplerianE, FastMath.toRadians(keplerianInclination),
FastMath.toRadians(keplerianOmega), FastMath.toRadians(keplerianRaan), FastMath.toRadians(keplerianAnomaly),
keplerianPositionAngleType,
inertialFrame, initDate, Constants.EGM96_EARTH_MU);
SpacecraftState initialState = new SpacecraftState(keplerOrbit, spacecraftMass);
// Use adaptive Step integrator
if(stepSizeType == ADAPTIVESS)
{
final double[][] tolerances =
NumericalPropagator.tolerances(positionTolerance, keplerOrbit, orbitType);
AdaptiveStepsizeIntegrator integrator =
new DormandPrince853Integrator(stepSizeValue1, stepSizeValue2, tolerances[0], tolerances[1]);
//integrator.setInitialStepSize(100.0);
// Propagator
propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(orbitType);
if(isGravitationalForceUsed)
{
NormalizedSphericalHarmonicsProvider provider =
GravityFieldFactory.getNormalizedProvider(10, 10);
ForceModel holmesFeatherstone =
new
HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010,
true),
provider);
propagator.addForceModel(holmesFeatherstone);
}
OneAxisEllipsoid earth = new
OneAxisEllipsoid(Constants.GRS80_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
inertialFrame);
if(isAtmosphericDragUsed)
{
final org.orekit.forces.drag.Atmosphere atm = new HarrisPriester(CelestialBodyFactory.getSun(), earth, 6);
final SphericalSpacecraft ssc = new SphericalSpacecraft(spacecraftCrossectionArea, spacecraftDragCoefficient, 0., 0.);
propagator.addForceModel(new DragForce(atm, ssc));
}
propagator.setInitialState(initialState);
// add handleStep event handler
propagator.setMasterMode(masterModeStep, new PropogatorFixedStepHandler(masterModeStep, ephemeris, JD_TT0, keplerianPositionAngleType, orbitPath, ephemerisPath));
final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
final PVCoordinatesProvider earthInEclipseEvent = CelestialBodyFactory.getEarth();
final SortedSet output = new TreeSet();
////////////////////////////////////////////////////////////////
// Set event handlers
BufferedWriter buffWriterEvents = new BufferedWriter(new FileWriter(eventFilePath));
if(isEclipseEventSelected)
{
dayNightEvents = new DayNightEventHandler(buffWriterEvents);
// Detector : eclipse entry
final EventDetector dayNightEvent =
new EclipseDetector(sun, Constants.SUN_RADIUS, earthInEclipseEvent, Constants.WGS84_EARTH_EQUATORIAL_RADIUS).
withHandler(dayNightEvents);
propagator.addEventDetector(dayNightEvent);
}
////////////////////////////////////////////////////////////////
// PROPOGATE
SpacecraftState finalState = propagator.propagate(new
AbsoluteDate(initDate, duration));
~
And I define eclipse detector event handler as given below
~
public class DayNightEventHandler implements
EventHandler
{
int[] dayEnd = new int[6];
int[] dayStart = new int[6];
private TimeSeries dayNightCrossingSeries = new TimeSeries("Gündüz Gece Geçişleri");
private List annotationList = new ArrayList();
private Second startSecond;
private Second endSecond;
private BufferedWriter buffWriterEvents;
public DayNightEventHandler(BufferedWriter buffWriterEvents)
{
this.buffWriterEvents = buffWriterEvents;
}
public Action eventOccurred(final SpacecraftState s, final
EclipseDetector detector, final boolean increasing)
{
if(increasing)
{
keepLog(" Olay (UTC 00) : " s.getDate() + " Night to Day pass");
}
else
{
keepLog(" Olay (UTC 00) : " s.getDate() + " Day to night pass");
}
return Action.CONTINUE;
}
private void keepLog(String logText)
{
try
{
buffWriterEvents.write(logText + "\n");
System.out.println(logText);
}
catch (Exception ex)
{
System.out.println("Uydu olay dosyasında güncellenemedi" +
ex.toString());
}
}
public SpacecraftState resetState(EclipseDetector detector,
SpacecraftState oldState)
{
return oldState;
}
public TimeSeries getTimeSeries()
{
// return visibility events which are kept in TimeSeries
return dayNightCrossingSeries;
}
}
~
(from redmine: issue id 212, created on 2015-08-18, closed on 2015-08-20)