use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class GeographicZoneDetectorTest method testFrance.
@Test
public void testFrance() throws OrekitException {
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
GeographicZoneDetector d = new GeographicZoneDetector(20.0, 1.e-3, earth, buildFrance(), FastMath.toRadians(0.5)).withHandler(new ContinueOnEvent<GeographicZoneDetector>());
Assert.assertEquals(20.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-3, d.getThreshold(), 1.0e-15);
Assert.assertEquals(0.5, FastMath.toDegrees(d.getMargin()), 1.0e-15);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(10 * Constants.JULIAN_DAY));
Assert.assertEquals(26, logger.getLoggedEvents().size());
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class LatitudeCrossingDetectorTest method testNoCrossing.
@Test
public void testNoCrossing() throws OrekitException {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
LatitudeCrossingDetector d = new LatitudeCrossingDetector(10.0, 1.e-6, earth, FastMath.toRadians(82.0)).withHandler(new ContinueOnEvent<LatitudeCrossingDetector>());
Assert.assertEquals(10.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
Assert.assertEquals(82.0, FastMath.toDegrees(d.getLatitude()), 1.0e-14);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
Assert.assertEquals(0, logger.getLoggedEvents().size());
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class LatitudeCrossingDetectorTest method testRegularCrossing.
@Test
public void testRegularCrossing() throws OrekitException {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
LatitudeCrossingDetector d = new LatitudeCrossingDetector(60.0, 1.e-6, earth, FastMath.toRadians(60.0)).withHandler(new ContinueOnEvent<LatitudeCrossingDetector>());
Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
Assert.assertEquals(60.0, FastMath.toDegrees(d.getLatitude()), 1.0e-14);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
AbsoluteDate previous = null;
for (LoggedEvent e : logger.getLoggedEvents()) {
SpacecraftState state = e.getState();
double latitude = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null).getLatitude();
Assert.assertEquals(60.0, FastMath.toDegrees(latitude), 3.0e-10);
if (previous != null) {
if (e.isIncreasing()) {
// crossing northward
Assert.assertTrue(state.getPVCoordinates().getVelocity().getZ() > 3611.0);
Assert.assertEquals(4954.70, state.getDate().durationFrom(previous), 0.01);
} else {
// crossing southward
Assert.assertTrue(state.getPVCoordinates().getVelocity().getZ() < -3615.0);
Assert.assertEquals(956.17, state.getDate().durationFrom(previous), 0.01);
}
}
previous = state.getDate();
}
Assert.assertEquals(30, logger.getLoggedEvents().size());
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class ElevationExtremumDetectorTest method testLEO.
@Test
public void testLEO() throws OrekitException {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
final ElevationExtremumDetector raw = new ElevationExtremumDetector(new TopocentricFrame(earth, gp, "test")).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<ElevationExtremumDetector>());
final EventSlopeFilter<ElevationExtremumDetector> maxElevationDetector = new EventSlopeFilter<ElevationExtremumDetector>(raw, FilterType.TRIGGER_ONLY_DECREASING_EVENTS);
Assert.assertEquals(60.0, raw.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, raw.getThreshold(), 1.0e-15);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, raw.getMaxIterationCount());
Assert.assertEquals("test", raw.getTopocentricFrame().getName());
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(maxElevationDetector));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
int visibleEvents = 0;
for (LoggedEvent e : logger.getLoggedEvents()) {
final double eMinus = raw.getElevation(e.getState().shiftedBy(-10.0));
final double e0 = raw.getElevation(e.getState());
final double ePlus = raw.getElevation(e.getState().shiftedBy(+10.0));
if (e0 > FastMath.toRadians(5.0)) {
++visibleEvents;
}
Assert.assertTrue(e0 > eMinus);
Assert.assertTrue(e0 > ePlus);
}
Assert.assertEquals(15, logger.getLoggedEvents().size());
Assert.assertEquals(6, visibleEvents);
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class EventEnablingPredicateFilterTest method setUp.
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
}
Aggregations