Search in sources :

Example 6 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class EventDetectorTest method testWrappedException.

@Test
public void testWrappedException() throws OrekitException {
    final Throwable dummyCause = new RuntimeException();
    try {
        // initial conditions
        Frame eme2000 = FramesFactory.getEME2000();
        TimeScale utc = TimeScalesFactory.getUTC();
        final AbsoluteDate initialDate = new AbsoluteDate(2011, 5, 11, utc);
        final AbsoluteDate exceptionDate = initialDate.shiftedBy(3600.0);
        KeplerianPropagator k = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008462.4706055815, -3155502.5373837613, -5044275.9880020910), new Vector3D(-5012.9298276860990, 1920.3567095973078, -5172.7403501801580)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
        k.addEventDetector(new DateDetector(initialDate.shiftedBy(Constants.JULIAN_DAY)) {

            private static final long serialVersionUID = 1L;

            @Override
            public double g(final SpacecraftState s) throws OrekitException {
                final double dt = s.getDate().durationFrom(exceptionDate);
                if (FastMath.abs(dt) < 1.0) {
                    throw new OrekitException(dummyCause, LocalizedCoreFormats.SIMPLE_MESSAGE, "dummy");
                }
                return dt;
            }
        });
        k.propagate(initialDate.shiftedBy(Constants.JULIAN_YEAR));
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertSame(dummyCause, oe.getCause());
    }
}
Also used : Frame(org.orekit.frames.Frame) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 7 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class EventDetectorTest method testBasicScheduling.

@Test
public void testBasicScheduling() throws OrekitException {
    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 CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new KeplerianPropagator(orbit);
    double stepSize = 60.0;
    OutOfOrderChecker checker = new OutOfOrderChecker(stepSize);
    propagator.addEventDetector(new DateDetector(date.shiftedBy(5.25 * stepSize)).withHandler(checker));
    propagator.setMasterMode(stepSize, checker);
    propagator.propagate(date.shiftedBy(10 * stepSize));
    Assert.assertTrue(checker.outOfOrderCallDetected());
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) PVCoordinates(org.orekit.utils.PVCoordinates) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 8 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class FieldOfViewDetectorTest method testDihedralFielOfView.

@Test
public void testDihedralFielOfView() throws OrekitException {
    // Definition of initial conditions with position and velocity
    // ------------------------------------------------------------
    // Extrapolator definition
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, earthCenterAttitudeLaw);
    // Event definition : square field of view, along X axis, aperture 56°
    final double maxCheck = 1.;
    final PVCoordinatesProvider sunPV = CelestialBodyFactory.getSun();
    final Vector3D center = Vector3D.MINUS_J;
    final Vector3D axis1 = Vector3D.PLUS_K;
    final Vector3D axis2 = Vector3D.PLUS_I;
    final double aperture1 = FastMath.toRadians(28);
    final double aperture2 = FastMath.toRadians(28);
    final EventDetector sunVisi = new FieldOfViewDetector(sunPV, new FieldOfView(center, axis1, aperture1, axis2, aperture2, 0.0)).withMaxCheck(maxCheck).withHandler(new DihedralSunVisiHandler());
    Assert.assertSame(sunPV, ((FieldOfViewDetector) sunVisi).getPVTarget());
    Assert.assertEquals(0, ((FieldOfViewDetector) sunVisi).getFieldOfView().getMargin(), 1.0e-15);
    double eta = FastMath.acos(FastMath.sin(aperture1) * FastMath.sin(aperture2));
    double theoreticalArea = MathUtils.TWO_PI - 4 * eta;
    Assert.assertEquals(theoreticalArea, ((FieldOfViewDetector) sunVisi).getFieldOfView().getZone().getSize(), 1.0e-15);
    // 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 9 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class FieldOfViewTest method testRollPitchYawHexagonalFootprint.

@Test
public void testRollPitchYawHexagonalFootprint() throws OrekitException {
    Utils.setDataRoot("regular-data");
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_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 LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYZ, FastMath.toRadians(10), FastMath.toRadians(20), FastMath.toRadians(5)));
    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(0.1));
    Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
    Assert.assertEquals(1, footprint.size());
    List<GeodeticPoint> loop = footprint.get(0);
    Assert.assertEquals(210, loop.size());
    double minEl = Double.POSITIVE_INFINITY;
    double maxEl = 0;
    double minDist = Double.POSITIVE_INFINITY;
    double maxDist = 0;
    for (int i = 0; i < loop.size(); ++i) {
        Assert.assertEquals(0.0, loop.get(i).getAltitude(), 1.0e-15);
        TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
        final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
        minEl = FastMath.min(minEl, elevation);
        maxEl = FastMath.max(maxEl, elevation);
        final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
        minDist = FastMath.min(minDist, dist);
        maxDist = FastMath.max(maxDist, dist);
    }
    Assert.assertEquals(48.0026, FastMath.toDegrees(minEl), 0.001);
    Assert.assertEquals(60.1975, FastMath.toDegrees(maxEl), 0.001);
    Assert.assertEquals(1221543.6, minDist, 1.0);
    Assert.assertEquals(1804921.6, maxDist, 1.0);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) List(java.util.List) Transform(org.orekit.frames.Transform) GeodeticPoint(org.orekit.bodies.GeodeticPoint) LofOffset(org.orekit.attitudes.LofOffset) Test(org.junit.Test)

Example 10 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class FieldOfViewTest method testFOVPartiallyTruncatedAtLimb.

@Test
public void testFOVPartiallyTruncatedAtLimb() throws OrekitException {
    Utils.setDataRoot("regular-data");
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, FastMath.toRadians(40.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));
    Vector3D subSat = earth.projectToGround(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), state.getDate(), earth.getBodyFrame());
    Assert.assertEquals(1, footprint.size());
    List<GeodeticPoint> loop = footprint.get(0);
    Assert.assertEquals(246, loop.size());
    double minEl = Double.POSITIVE_INFINITY;
    double maxEl = 0;
    double minDist = Double.POSITIVE_INFINITY;
    double maxDist = 0;
    for (int i = 0; i < loop.size(); ++i) {
        Assert.assertEquals(0.0, loop.get(i).getAltitude(), 3.0e-7);
        TopocentricFrame topo = new TopocentricFrame(earth, loop.get(i), "atLimb");
        final double elevation = topo.getElevation(state.getPVCoordinates().getPosition(), state.getFrame(), state.getDate());
        minEl = FastMath.min(minEl, elevation);
        maxEl = FastMath.max(maxEl, elevation);
        final double dist = Vector3D.distance(subSat, earth.transform(loop.get(i)));
        minDist = FastMath.min(minDist, dist);
        maxDist = FastMath.max(maxDist, dist);
    }
    Assert.assertEquals(0.0, FastMath.toDegrees(minEl), 2.0e-12);
    Assert.assertEquals(7.8897, FastMath.toDegrees(maxEl), 0.001);
    Assert.assertEquals(4584829.6, minDist, 1.0);
    Assert.assertEquals(5347029.8, maxDist, 1.0);
}
Also used : NadirPointing(org.orekit.attitudes.NadirPointing) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) List(java.util.List) Transform(org.orekit.frames.Transform) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

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