Search in sources :

Example 11 with KeplerianPropagator

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());
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) NadirPointing(org.orekit.attitudes.NadirPointing) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) List(java.util.List) Transform(org.orekit.frames.Transform) Test(org.junit.Test)

Example 12 with KeplerianPropagator

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.));
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) Test(org.junit.Test)

Example 13 with KeplerianPropagator

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());
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) TopocentricFrame(org.orekit.frames.TopocentricFrame) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 14 with KeplerianPropagator

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);
        }
    }
}
Also used : LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Test(org.junit.Test)

Example 15 with KeplerianPropagator

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());
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Aggregations

KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)59 Test (org.junit.Test)47 SpacecraftState (org.orekit.propagation.SpacecraftState)41 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)40 AbsoluteDate (org.orekit.time.AbsoluteDate)36 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)34 Propagator (org.orekit.propagation.Propagator)32 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)21 GeodeticPoint (org.orekit.bodies.GeodeticPoint)20 Orbit (org.orekit.orbits.Orbit)20 PVCoordinates (org.orekit.utils.PVCoordinates)15 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)14 OrekitException (org.orekit.errors.OrekitException)13 Frame (org.orekit.frames.Frame)13 TopocentricFrame (org.orekit.frames.TopocentricFrame)12 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)11 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 CartesianOrbit (org.orekit.orbits.CartesianOrbit)8 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)8 DateComponents (org.orekit.time.DateComponents)7