Search in sources :

Example 1 with GroundFieldOfViewDetector

use of org.orekit.propagation.events.GroundFieldOfViewDetector in project Orekit by CS-SI.

the class GroundFieldOfViewDetectorTest method testCaseSimilarToElevationDetector.

/**
 * Check FoV detector is similar to {@link ElevationDetector} when using
 * zenith pointing.
 *
 * @throws OrekitException on error.
 */
@Test
public void testCaseSimilarToElevationDetector() throws OrekitException {
    // setup
    double pi = FastMath.PI;
    // arbitrary date
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    AbsoluteDate endDate = date.shiftedBy(Constants.JULIAN_DAY);
    Frame eci = FramesFactory.getGCRF();
    Frame ecef = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ecef);
    GeodeticPoint gp = new GeodeticPoint(FastMath.toRadians(39), FastMath.toRadians(77), 0);
    TopocentricFrame topo = new TopocentricFrame(earth, gp, "topo");
    // iss like orbit
    KeplerianOrbit orbit = new KeplerianOrbit(6378137 + 400e3, 0, FastMath.toRadians(51.65), 0, 0, 0, PositionAngle.TRUE, eci, date, Constants.EGM96_EARTH_MU);
    Propagator prop = new KeplerianPropagator(orbit);
    // compute expected result
    ElevationDetector elevationDetector = new ElevationDetector(topo).withConstantElevation(pi / 6).withMaxCheck(5.0);
    EventsLogger logger = new EventsLogger();
    prop.addEventDetector(logger.monitorDetector(elevationDetector));
    prop.propagate(endDate);
    List<LoggedEvent> expected = logger.getLoggedEvents();
    // action
    // construct similar FoV based detector
    // half width of 60 deg pointed along +Z in antenna frame
    // not a perfect small circle b/c FoV makes a polygon with great circles
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, pi / 3, 16, 0);
    // simple case for fixed pointing to be similar to elevation detector.
    // could define new frame with varying rotation for slewing antenna.
    GroundFieldOfViewDetector fovDetector = new GroundFieldOfViewDetector(topo, fov).withMaxCheck(5.0);
    Assert.assertSame(topo, fovDetector.getFrame());
    Assert.assertSame(fov, fovDetector.getFieldOfView());
    logger = new EventsLogger();
    prop = new KeplerianPropagator(orbit);
    prop.addEventDetector(logger.monitorDetector(fovDetector));
    prop.propagate(endDate);
    List<LoggedEvent> actual = logger.getLoggedEvents();
    // verify
    Assert.assertEquals(2, expected.size());
    Assert.assertEquals(2, actual.size());
    for (int i = 0; i < 2; i++) {
        AbsoluteDate expectedDate = expected.get(i).getState().getDate();
        AbsoluteDate actualDate = actual.get(i).getState().getDate();
        // same event times to within 1s.
        Assert.assertEquals(expectedDate.durationFrom(actualDate), 0.0, 1.0);
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) GroundFieldOfViewDetector(org.orekit.propagation.events.GroundFieldOfViewDetector) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) ElevationDetector(org.orekit.propagation.events.ElevationDetector) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) EventsLogger(org.orekit.propagation.events.EventsLogger) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldOfView(org.orekit.propagation.events.FieldOfView) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BodyShape (org.orekit.bodies.BodyShape)1 GeodeticPoint (org.orekit.bodies.GeodeticPoint)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1 Frame (org.orekit.frames.Frame)1 TopocentricFrame (org.orekit.frames.TopocentricFrame)1 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)1 Propagator (org.orekit.propagation.Propagator)1 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)1 ElevationDetector (org.orekit.propagation.events.ElevationDetector)1 EventsLogger (org.orekit.propagation.events.EventsLogger)1 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)1 FieldOfView (org.orekit.propagation.events.FieldOfView)1 GroundFieldOfViewDetector (org.orekit.propagation.events.GroundFieldOfViewDetector)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1