use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class FieldOfViewTest method testFOVAwayFromEarth.
@Test
public void testFOVAwayFromEarth() throws OrekitException {
Utils.setDataRoot("regular-data");
FieldOfView fov = new FieldOfView(Vector3D.MINUS_K, Vector3D.PLUS_I, FastMath.toRadians(3.0), 6, 0.0);
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
KeplerianOrbit orbit = new KeplerianOrbit(new PVCoordinates(new Vector3D(7.0e6, 1.0e6, 4.0e6), new Vector3D(-500.0, 8000.0, 1000.0)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new KeplerianPropagator(orbit);
propagator.setAttitudeProvider(new NadirPointing(orbit.getFrame(), earth));
SpacecraftState state = propagator.propagate(orbit.getDate().shiftedBy(1000.0));
Transform inertToBody = state.getFrame().getTransformTo(earth.getBodyFrame(), state.getDate());
Transform fovToBody = new Transform(state.getDate(), state.toTransform().getInverse(), inertToBody);
List<List<GeodeticPoint>> footprint = fov.getFootprint(fovToBody, earth, FastMath.toRadians(1.0));
Assert.assertEquals(0, footprint.size());
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class CircularFieldOfViewDetectorTest method testCircularFielOfView.
@Test
public void testCircularFielOfView() throws OrekitException {
// Definition of initial conditions with position and velocity
// ------------------------------------------------------------
// Extrapolator definition
KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, earthCenterAttitudeLaw);
// Event definition : circular field of view, along X axis, aperture 35°
final double maxCheck = 1.;
final PVCoordinatesProvider sunPV = CelestialBodyFactory.getSun();
final Vector3D center = Vector3D.PLUS_I;
final double aperture = FastMath.toRadians(35);
final CircularFieldOfViewDetector sunVisi = new CircularFieldOfViewDetector(maxCheck, sunPV, center, aperture).withHandler(new CircularSunVisiHandler());
Assert.assertEquals(0, Vector3D.distance(center, sunVisi.getCenter()), 1.0e-15);
Assert.assertEquals(aperture, sunVisi.getHalfAperture(), 1.0e-15);
Assert.assertSame(sunPV, sunVisi.getPVTarget());
// Add event to be detected
propagator.addEventDetector(sunVisi);
// Extrapolate from the initial to the final date
propagator.propagate(initDate.shiftedBy(6000.));
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class BackAndForthDetectorTest method testBackAndForth.
@Test
public void testBackAndForth() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final AbsoluteDate date0 = new AbsoluteDate(2006, 12, 27, 12, 0, 0.0, utc);
final AbsoluteDate date1 = new AbsoluteDate(2006, 12, 27, 22, 50, 0.0, utc);
final AbsoluteDate date2 = new AbsoluteDate(2006, 12, 27, 22, 58, 0.0, utc);
// Orbit
final double a = 7274000.;
final double e = 0.00127;
final double i = FastMath.toRadians(90.);
final double w = FastMath.toRadians(0.);
final double raan = FastMath.toRadians(12.5);
final double lM = FastMath.toRadians(60.);
Orbit iniOrb = new KeplerianOrbit(a, e, i, w, raan, lM, PositionAngle.MEAN, FramesFactory.getEME2000(), date0, Constants.WGS84_EARTH_MU);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(iniOrb);
// Station
final GeodeticPoint stationPosition = new GeodeticPoint(FastMath.toRadians(0.), FastMath.toRadians(100.), 110.);
final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
final TopocentricFrame stationFrame = new TopocentricFrame(earth, stationPosition, "");
// Detector
final Visibility visi = new Visibility();
propagator.addEventDetector(new ElevationDetector(stationFrame).withConstantElevation(FastMath.toRadians(10.)).withHandler(visi));
// Forward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date2);
// Backward propagation (AOS + LOS)
propagator.propagate(date1);
propagator.propagate(date0);
Assert.assertEquals(4, visi.getVisiNb());
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class EventEnablingPredicateFilterTest method testExceedHistoryBackward.
@Test
public void testExceedHistoryBackward() throws OrekitException, IOException {
final double period = 900.0;
// the raw detector should trigger one event at each 900s period
final DateDetector raw = new DateDetector(orbit.getDate().shiftedBy(+0.5 * period)).withMaxCheck(period / 3).withHandler(new ContinueOnEvent<DateDetector>());
for (int i = 0; i < 300; ++i) {
raw.addEventDate(orbit.getDate().shiftedBy(-(i + 0.5) * period));
}
// in fact, we will filter out half of these events, so we get only one event every 2 periods
final EventEnablingPredicateFilter<DateDetector> filtered = new EventEnablingPredicateFilter<DateDetector>(raw, new EnablingPredicate<DateDetector>() {
public boolean eventIsEnabled(SpacecraftState state, DateDetector eventDetector, double g) {
double nbPeriod = orbit.getDate().durationFrom(state.getDate()) / period;
return ((int) FastMath.floor(nbPeriod)) % 2 == 1;
}
});
Propagator propagator = new KeplerianPropagator(orbit);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(filtered));
propagator.propagate(orbit.getDate().shiftedBy(-301 * period));
List<LoggedEvent> events = logger.getLoggedEvents();
// 300 periods, 150 events as half of them are filtered out
Assert.assertEquals(150, events.size());
// as we have encountered a lot of enabling status changes, we exceeded the internal history
// if we try to display again the filtered g function for dates far in the future,
// we will not see the zero crossings anymore, they have been lost
propagator.clearEventsDetectors();
for (double dt = -5000.0; dt > -10000.0; dt -= 3.0) {
double filteredG = filtered.g(propagator.propagate(orbit.getDate().shiftedBy(dt)));
Assert.assertTrue(filteredG < 0.0);
}
// that are still inside the history, we still see the zero crossings
for (double dt = -195400.0; dt > -196200.0; dt -= 3.0) {
double filteredG = filtered.g(propagator.propagate(orbit.getDate().shiftedBy(dt)));
if (dt < -195750) {
Assert.assertTrue(filteredG < 0.0);
} else {
Assert.assertTrue(filteredG > 0.0);
}
}
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class EventSlopeFilterTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
double mu = 3.9860047e14;
final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getGCRF(), iniDate, mu);
propagator = new KeplerianPropagator(orbit, AbstractPropagator.DEFAULT_LAW, mu);
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
Aggregations