Search in sources :

Example 16 with BodyShape

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

the class FieldOfViewDetectorTest method testStopOnExit.

/**
 * check the default behavior to stop propagation on FoV exit.
 */
@Test
public void testStopOnExit() 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);
    AttitudeProvider attitude = new NadirPointing(eci, earth);
    // action
    FieldOfView fov = new FieldOfView(Vector3D.PLUS_K, Vector3D.PLUS_I, pi / 3, 16, 0);
    FieldOfViewDetector fovDetector = new FieldOfViewDetector(topo, fov).withMaxCheck(5.0);
    EventsLogger logger = new EventsLogger();
    Propagator prop = new KeplerianPropagator(orbit, attitude);
    prop.addEventDetector(logger.monitorDetector(fovDetector));
    prop.propagate(endDate);
    List<LoggedEvent> actual = logger.getLoggedEvents();
    // verify
    // check we have an entry and an exit event.
    Assert.assertEquals(2, actual.size());
}
Also used : NadirPointing(org.orekit.attitudes.NadirPointing) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) LoggedEvent(org.orekit.propagation.events.EventsLogger.LoggedEvent) TopocentricFrame(org.orekit.frames.TopocentricFrame) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Example 17 with BodyShape

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

the class GeographicZoneDetectorTest method testFrance.

@Test
public void testFrance() throws OrekitException {
    final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    GeographicZoneDetector d = new GeographicZoneDetector(20.0, 1.e-3, earth, buildFrance(), FastMath.toRadians(0.5)).withHandler(new ContinueOnEvent<GeographicZoneDetector>());
    Assert.assertEquals(20.0, d.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(1.0e-3, d.getThreshold(), 1.0e-15);
    Assert.assertEquals(0.5, FastMath.toDegrees(d.getMargin()), 1.0e-15);
    Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
    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, Constants.EIGEN5C_EARTH_MU);
    Propagator propagator = new EcksteinHechlerPropagator(orbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
    EventsLogger logger = new EventsLogger();
    propagator.addEventDetector(logger.monitorDetector(d));
    propagator.propagate(date.shiftedBy(10 * Constants.JULIAN_DAY));
    Assert.assertEquals(26, logger.getLoggedEvents().size());
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) BodyShape(org.orekit.bodies.BodyShape) TimeScale(org.orekit.time.TimeScale) AbsoluteDate(org.orekit.time.AbsoluteDate) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) Propagator(org.orekit.propagation.Propagator) Test(org.junit.Test)

Example 18 with BodyShape

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

Example 19 with BodyShape

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

the class GroundStation method getOffsetToInertial.

/**
 * Get the transform between offset frame and inertial frame with derivatives.
 * <p>
 * As the East and North vector are not well defined at pole, the derivatives
 * of these two vectors diverge to infinity as we get closer to the pole.
 * So this method should not be used for stations less than 0.0001 degree from
 * either poles.
 * </p>
 * @param inertial inertial frame to transform to
 * @param date date of the transform
 * @param factory factory for the derivatives
 * @param indices indices of the estimated parameters in derivatives computations
 * @return offset frame defining vectors with derivatives
 * @exception OrekitException if some frame transforms cannot be computed
 * @since 9.0
 */
public FieldTransform<DerivativeStructure> getOffsetToInertial(final Frame inertial, final FieldAbsoluteDate<DerivativeStructure> date, final DSFactory factory, final Map<String, Integer> indices) throws OrekitException {
    final Field<DerivativeStructure> field = date.getField();
    final FieldVector3D<DerivativeStructure> zero = FieldVector3D.getZero(field);
    final FieldVector3D<DerivativeStructure> plusI = FieldVector3D.getPlusI(field);
    final FieldVector3D<DerivativeStructure> plusK = FieldVector3D.getPlusK(field);
    // take Earth offsets into account
    final FieldTransform<DerivativeStructure> intermediateToBody = estimatedEarthFrameProvider.getTransform(date, factory, indices).getInverse();
    // take station offset into account
    final DerivativeStructure x = parametricModel(factory, eastOffsetDriver, indices);
    final DerivativeStructure y = parametricModel(factory, northOffsetDriver, indices);
    final DerivativeStructure z = parametricModel(factory, zenithOffsetDriver, indices);
    final BodyShape baseShape = baseFrame.getParentShape();
    final Transform baseToBody = baseFrame.getTransformTo(baseShape.getBodyFrame(), (AbsoluteDate) null);
    FieldVector3D<DerivativeStructure> origin = baseToBody.transformPosition(new FieldVector3D<>(x, y, z));
    origin = origin.add(computeDisplacement(date.toAbsoluteDate(), origin.toVector3D()));
    final FieldGeodeticPoint<DerivativeStructure> originGP = baseShape.transform(origin, baseShape.getBodyFrame(), date);
    final FieldTransform<DerivativeStructure> offsetToIntermediate = new FieldTransform<>(date, new FieldTransform<>(date, new FieldRotation<>(plusI, plusK, originGP.getEast(), originGP.getZenith()), zero), new FieldTransform<>(date, origin));
    // combine all transforms together
    final FieldTransform<DerivativeStructure> bodyToInert = baseFrame.getParent().getTransformTo(inertial, date);
    return new FieldTransform<>(date, offsetToIntermediate, new FieldTransform<>(date, intermediateToBody, bodyToInert));
}
Also used : FieldTransform(org.orekit.frames.FieldTransform) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform) BodyShape(org.orekit.bodies.BodyShape) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation)

Example 20 with BodyShape

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

the class TopocentricFrameTest method testVisibilityCircle.

@Test
public void testVisibilityCircle() throws OrekitException, IOException {
    // a few random from International Laser Ranging Service
    final BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame[] ilrs = { new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(52.3800), FastMath.toRadians(3.0649), 133.745), "Potsdam"), new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(36.46273), FastMath.toRadians(-6.20619), 64.0), "San Fernando"), new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(35.5331), FastMath.toRadians(24.0705), 157.0), "Chania") };
    PolynomialFunction distanceModel = new PolynomialFunction(new double[] { 7.0892e+05, 3.1913, -8.2181e-07, 1.4033e-13 });
    for (TopocentricFrame station : ilrs) {
        for (double altitude = 500000; altitude < 2000000; altitude += 100000) {
            for (double azimuth = 0; azimuth < 2 * FastMath.PI; azimuth += 0.05) {
                GeodeticPoint p = station.computeLimitVisibilityPoint(Constants.WGS84_EARTH_EQUATORIAL_RADIUS + altitude, azimuth, FastMath.toRadians(5.0));
                double d = station.getRange(earth.transform(p), earth.getBodyFrame(), AbsoluteDate.J2000_EPOCH);
                Assert.assertEquals(distanceModel.value(altitude), d, 40000.0);
            }
        }
    }
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction) GeodeticPoint(org.orekit.bodies.GeodeticPoint) BodyShape(org.orekit.bodies.BodyShape) Test(org.junit.Test)

Aggregations

BodyShape (org.orekit.bodies.BodyShape)24 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)20 GeodeticPoint (org.orekit.bodies.GeodeticPoint)17 Test (org.junit.Test)15 AbsoluteDate (org.orekit.time.AbsoluteDate)15 TopocentricFrame (org.orekit.frames.TopocentricFrame)13 Propagator (org.orekit.propagation.Propagator)13 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)12 Frame (org.orekit.frames.Frame)12 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)12 Orbit (org.orekit.orbits.Orbit)12 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)11 SpacecraftState (org.orekit.propagation.SpacecraftState)8 EcksteinHechlerPropagator (org.orekit.propagation.analytical.EcksteinHechlerPropagator)8 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)7 TimeScale (org.orekit.time.TimeScale)7 PVCoordinates (org.orekit.utils.PVCoordinates)7 Transform (org.orekit.frames.Transform)5 LoggedEvent (org.orekit.propagation.events.EventsLogger.LoggedEvent)4 File (java.io.File)3