Search in sources :

Example 31 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue110.

@Test
public void testIssue110() throws OrekitException {
    // KEPLERIAN PROPAGATOR
    final Frame eme2000Frame = FramesFactory.getEME2000();
    final AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH;
    final double a = 7000000.0;
    final Orbit initialOrbit = new KeplerianOrbit(a, 0.0, FastMath.PI / 2.2, 0.0, FastMath.PI / 2., 0.0, PositionAngle.TRUE, eme2000Frame, initDate, Constants.EGM96_EARTH_MU);
    final KeplerianPropagator kProp = new KeplerianPropagator(initialOrbit);
    // earth shape
    final OneAxisEllipsoid earthShape = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    // Ground station
    final GeodeticPoint stat = new GeodeticPoint(FastMath.toRadians(35.), FastMath.toRadians(149.8), 0.);
    final TopocentricFrame station = new TopocentricFrame(earthShape, stat, "GSTATION");
    // detector creation
    // =================
    final double maxCheck = 600.;
    final double threshold = 1.0e-3;
    final EventDetector rawEvent = new ElevationDetector(maxCheck, threshold, station).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kProp.addEventDetector(logger.monitorDetector(rawEvent));
    // PROPAGATION with DETECTION
    final AbsoluteDate finalDate = initDate.shiftedBy(30 * 60.);
    kProp.propagate(finalDate);
    Assert.assertEquals(2, logger.getLoggedEvents().size());
    Assert.assertTrue(logger.getLoggedEvents().get(0).isIncreasing());
    Assert.assertEquals(478.945, logger.getLoggedEvents().get(0).getState().getDate().durationFrom(initDate), 1.0e-3);
    Assert.assertFalse(logger.getLoggedEvents().get(1).isIncreasing());
    Assert.assertEquals(665.721, logger.getLoggedEvents().get(1).getState().getDate().durationFrom(initDate), 1.0e-3);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TopocentricFrame(org.orekit.frames.TopocentricFrame) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 32 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class ElevationDetectorTest method testIssue136.

@Test
public void testIssue136() throws OrekitException {
    // Initial state definition : date, orbit
    AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    // inertial frame for orbit definition
    Frame inertialFrame = FramesFactory.getEME2000();
    Orbit initialOrbit = new KeplerianOrbit(6828137.005, 7.322641382145889e-10, 1.6967079057368113, 0.0, 1.658054062748353, 0.0001223149429077902, PositionAngle.MEAN, inertialFrame, initialDate, Constants.EIGEN5C_EARTH_MU);
    // Propagator : consider a simple Keplerian motion (could be more elaborate)
    Propagator kepler = new EcksteinHechlerPropagator(initialOrbit, Constants.EGM96_EARTH_EQUATORIAL_RADIUS, Constants.EGM96_EARTH_MU, Constants.EGM96_EARTH_C20, 0.0, 0.0, 0.0, 0.0);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    // Station
    final double longitude = FastMath.toRadians(-147.5);
    final double latitude = FastMath.toRadians(64);
    final double altitude = 160;
    final GeodeticPoint station1 = new GeodeticPoint(latitude, longitude, altitude);
    final TopocentricFrame sta1Frame = new TopocentricFrame(earth, station1, "station1");
    // Event definition
    final double maxcheck = 120.0;
    final double elevation = FastMath.toRadians(5.);
    final double threshold = 10.0;
    final EventDetector rawEvent = new ElevationDetector(maxcheck, threshold, sta1Frame).withConstantElevation(elevation).withHandler(new ContinueOnEvent<ElevationDetector>());
    final EventsLogger logger = new EventsLogger();
    kepler.addEventDetector(logger.monitorDetector(rawEvent));
    // Propagate from the initial date to the first raising or for the fixed duration
    kepler.propagate(initialDate.shiftedBy(60 * 60 * 24.0 * 40));
    int countIncreasing = 0;
    int countDecreasing = 0;
    for (LoggedEvent le : logger.getLoggedEvents()) {
        if (le.isIncreasing()) {
            ++countIncreasing;
        } else {
            ++countDecreasing;
        }
    }
    Assert.assertEquals(314, countIncreasing);
    Assert.assertEquals(314, countDecreasing);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 33 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid in project Orekit by CS-SI.

the class ElevationDetectorTest method testEventForMask.

@Test
public void testEventForMask() 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 EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, ae, mu, c20, c30, c40, c50, c60);
    // Earth and frame
    // equatorial radius in meter
    double ae = 6378137.0;
    // flattening
    double f = 1.0 / 298.257223563;
    // terrestrial frame at an arbitrary date
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(ae, f, itrf);
    GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(48.833), FastMath.toRadians(2.333), 0.0);
    TopocentricFrame topo = new TopocentricFrame(earth, point, "Gstation");
    double[][] maskValues = { { FastMath.toRadians(0), FastMath.toRadians(5) }, { FastMath.toRadians(30), FastMath.toRadians(4) }, { FastMath.toRadians(60), FastMath.toRadians(3) }, { FastMath.toRadians(90), FastMath.toRadians(2) }, { FastMath.toRadians(120), FastMath.toRadians(3) }, { FastMath.toRadians(150), FastMath.toRadians(4) }, { FastMath.toRadians(180), FastMath.toRadians(5) }, { FastMath.toRadians(210), FastMath.toRadians(6) }, { FastMath.toRadians(240), FastMath.toRadians(5) }, { FastMath.toRadians(270), FastMath.toRadians(4) }, { FastMath.toRadians(300), FastMath.toRadians(3) }, { FastMath.toRadians(330), FastMath.toRadians(4) } };
    ElevationMask mask = new ElevationMask(maskValues);
    ElevationDetector detector = new ElevationDetector(topo).withElevationMask(mask).withHandler(new StopOnIncreasing<ElevationDetector>());
    Assert.assertSame(mask, detector.getElevationMask());
    AbsoluteDate startDate = new AbsoluteDate(2003, 9, 15, 20, 0, 0, utc);
    propagator.resetInitialState(propagator.propagate(startDate));
    propagator.addEventDetector(detector);
    final SpacecraftState fs = propagator.propagate(startDate.shiftedBy(Constants.JULIAN_DAY));
    double elevation = topo.getElevation(fs.getPVCoordinates().getPosition(), fs.getFrame(), fs.getDate());
    Assert.assertEquals(0.065, elevation, 2.0e-5);
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) ElevationMask(org.orekit.utils.ElevationMask) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 34 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid 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 35 with OneAxisEllipsoid

use of org.orekit.bodies.OneAxisEllipsoid 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

OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)146 Test (org.junit.Test)89 AbsoluteDate (org.orekit.time.AbsoluteDate)83 GeodeticPoint (org.orekit.bodies.GeodeticPoint)65 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)59 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)57 SpacecraftState (org.orekit.propagation.SpacecraftState)48 Frame (org.orekit.frames.Frame)47 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)45 Orbit (org.orekit.orbits.Orbit)42 PVCoordinates (org.orekit.utils.PVCoordinates)42 TopocentricFrame (org.orekit.frames.TopocentricFrame)34 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)31 OrekitException (org.orekit.errors.OrekitException)29 CircularOrbit (org.orekit.orbits.CircularOrbit)29 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)29 DateComponents (org.orekit.time.DateComponents)29 Propagator (org.orekit.propagation.Propagator)28 Before (org.junit.Before)26 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)23