@Test
  public void testEphemerisGenerationIssue14() throws OrekitException, IOException {

    // Propagation of the initial at t + dt
    final double dt = 3200;
    propagator.getInitialState();

    propagator.setOrbitType(OrbitType.CARTESIAN);
    propagator.setEphemerisMode();
    propagator.propagate(initDate.shiftedBy(dt));
    final BoundedPropagator ephemeris1 = propagator.getGeneratedEphemeris();
    Assert.assertEquals(initDate, ephemeris1.getMinDate());
    Assert.assertEquals(initDate.shiftedBy(dt), ephemeris1.getMaxDate());

    propagator.getPVCoordinates(initDate.shiftedBy(2 * dt), FramesFactory.getEME2000());
    propagator.getPVCoordinates(initDate.shiftedBy(-2 * dt), FramesFactory.getEME2000());

    // the new propagations should not have changed ephemeris1
    Assert.assertEquals(initDate, ephemeris1.getMinDate());
    Assert.assertEquals(initDate.shiftedBy(dt), ephemeris1.getMaxDate());

    final BoundedPropagator ephemeris2 = propagator.getGeneratedEphemeris();
    Assert.assertEquals(initDate.shiftedBy(-2 * dt), ephemeris2.getMinDate());
    Assert.assertEquals(initDate.shiftedBy(2 * dt), ephemeris2.getMaxDate());

    // generating ephemeris2 should not have changed ephemeris1
    Assert.assertEquals(initDate, ephemeris1.getMinDate());
    Assert.assertEquals(initDate.shiftedBy(dt), ephemeris1.getMaxDate());
  }
  @Test
  public void testGroundToGroundIssue181() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    TimeStampedPVCoordinates body =
        itrf.getTransformTo(eme2000, initPV.getDate()).transformPVCoordinates(initPV);
    TimeStampedPVCoordinates ground1 = model.projectToGround(body, itrf);
    TimeStampedPVCoordinates ground2 = model.projectToGround(ground1, itrf);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getPosition(), ground2.getPosition()), 1.0e-12);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getVelocity(), ground2.getVelocity()), 1.0e-12);
    Assert.assertEquals(
        0.0, Vector3D.distance(ground1.getAcceleration(), ground2.getAcceleration()), 1.0e-12);
  }
  @Test
  public void testPropagationTypesHyperbolic() throws OrekitException, ParseException, IOException {

    SpacecraftState state =
        new SpacecraftState(
            new KeplerianOrbit(
                -10000000.0,
                2.5,
                0.3,
                0,
                0,
                0.0,
                PositionAngle.TRUE,
                FramesFactory.getEME2000(),
                initDate,
                mu));

    ForceModel gravityField =
        new HolmesFeatherstoneAttractionModel(
            FramesFactory.getITRF(IERSConventions.IERS_2010, true),
            GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);

    // Propagation of the initial at t + dt
    final PVCoordinates pv = state.getPVCoordinates();
    final double dP = 0.001;
    final double dV =
        state.getMu() * dP / (pv.getPosition().getNormSq() * pv.getVelocity().getNorm());

    final PVCoordinates pvcM = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.MEAN);
    final PVCoordinates pvkM = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN);

    final PVCoordinates pvcE =
        propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC);
    final PVCoordinates pvkE =
        propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC);

    final PVCoordinates pvcT = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.TRUE);
    final PVCoordinates pvkT = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE);

    Assert.assertEquals(0, pvcM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.2);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.3);

    Assert.assertEquals(0, pvcE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.009);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.006);

    Assert.assertEquals(0, pvcT.getPosition().subtract(pvkT.getPosition()).getNorm() / dP, 0.3);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pvkT.getVelocity()).getNorm() / dV, 0.4);
  }
  @Test
  public void testUnsupportedParameter() throws OrekitException {
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            Constants.EIGEN5C_EARTH_MU);

    double dP = 0.001;
    NumericalPropagator propagator =
        setUpPropagator(
            initialOrbit,
            dP,
            OrbitType.EQUINOCTIAL,
            PositionAngle.TRUE,
            new ThirdBodyAttraction(CelestialBodyFactory.getSun()),
            new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
    PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
    partials.selectParamAndStep("non-existent", 1.0);
    try {
      partials.computeDerivatives(new SpacecraftState(initialOrbit), new double[6]);
      Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
      Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
    }
  }
 @Test
 public void testMiss() throws OrekitException {
   final CircularOrbit circ =
       new CircularOrbit(
           7178000.0,
           0.5e-4,
           -0.5e-4,
           FastMath.toRadians(0.),
           FastMath.toRadians(270.),
           FastMath.toRadians(5.300),
           PositionAngle.MEAN,
           FramesFactory.getEME2000(),
           date,
           mu);
   final LofOffset upsideDown =
       new LofOffset(circ.getFrame(), LOFType.VVLH, RotationOrder.XYX, FastMath.PI, 0, 0);
   final LofOffsetPointing pointing =
       new LofOffsetPointing(earthSpheric, upsideDown, Vector3D.PLUS_K);
   try {
     pointing.getTargetPV(circ, date, circ.getFrame());
     Assert.fail("an exception should have been thrown");
   } catch (OrekitException oe) {
     Assert.assertEquals(
         OrekitMessages.ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND, oe.getSpecifier());
   }
 }
示例#6
0
  private static List<GeodeticPoint> computeCircle(
      double latitude,
      double longitude,
      double altitude,
      String name,
      double minElevation,
      double radius,
      int points)
      throws OrekitException {

    // define Earth shape, using WGS84 model
    BodyShape earth =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, false));

    // define an array of ground stations
    TopocentricFrame station =
        new TopocentricFrame(earth, new GeodeticPoint(latitude, longitude, altitude), name);

    // compute the visibility circle
    List<GeodeticPoint> circle = new ArrayList<GeodeticPoint>();
    for (int i = 0; i < points; ++i) {
      double azimuth = i * (2.0 * FastMath.PI / points);
      circle.add(station.computeLimitVisibilityPoint(radius, azimuth, minElevation));
    }

    // return the computed points
    return circle;
  }
  @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());
  }
  @Test
  public void testEventDetectionBug() throws OrekitException, IOException, ParseException {

    TimeScale utc = TimeScalesFactory.getUTC();
    AbsoluteDate initialDate = new AbsoluteDate(2005, 1, 1, 0, 0, 0.0, utc);
    double duration = 100000.;
    AbsoluteDate endDate = new AbsoluteDate(initialDate, duration);

    // Initialization of the frame EME2000
    Frame EME2000 = FramesFactory.getEME2000();

    // Initial orbit
    double a = 35786000. + 6378137.0;
    double e = 0.70;
    double rApogee = a * (1 + e);
    double vApogee = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
    Orbit geo =
        new CartesianOrbit(
            new PVCoordinates(new Vector3D(rApogee, 0., 0.), new Vector3D(0., vApogee, 0.)),
            EME2000,
            initialDate,
            mu);

    duration = geo.getKeplerianPeriod();
    endDate = new AbsoluteDate(initialDate, duration);

    // Numerical Integration
    final double minStep = 0.001;
    final double maxStep = 1000;
    final double initStep = 60;
    final double[] absTolerance = {0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001};
    final double[] relTolerance = {1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7};

    AdaptiveStepsizeIntegrator integrator =
        new DormandPrince853Integrator(minStep, maxStep, absTolerance, relTolerance);
    integrator.setInitialStepSize(initStep);

    // Numerical propagator based on the integrator
    propagator = new NumericalPropagator(integrator);
    double mass = 1000.;
    SpacecraftState initialState = new SpacecraftState(geo, mass);
    propagator.setInitialState(initialState);
    propagator.setOrbitType(OrbitType.CARTESIAN);

    // Set the events Detectors
    ApsideDetector event1 = new ApsideDetector(geo);
    propagator.addEventDetector(event1);

    // Set the propagation mode
    propagator.setSlaveMode();

    // Propagate
    SpacecraftState finalState = propagator.propagate(endDate);

    // we should stop long before endDate
    Assert.assertTrue(endDate.durationFrom(finalState.getDate()) > 40000.0);
  }
 @Test
 public void testFarPoint() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame);
   Vector3D point = new Vector3D(1.0e15, 2.0e15, -1.0e12);
   GeodeticPoint gp = model.transform(point, frame, date);
   Vector3D rebuilt = model.transform(gp);
   Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm());
 }
示例#10
0
 @Test
 public void testNoLineIntersection() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame);
   Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796);
   Vector3D direction = new Vector3D(0.0, 9.0, -2.0);
   Line line = new Line(point, point.add(direction), 1.0e-10);
   Assert.assertNull(model.getIntersectionPoint(line, point, frame, date));
 }
示例#11
0
  @Test
  public void testSpin() throws OrekitException {

    AbsoluteDate date =
        new AbsoluteDate(
            new DateComponents(1970, 01, 01),
            new TimeComponents(3, 25, 45.6789),
            TimeScalesFactory.getUTC());
    KeplerianOrbit orbit =
        new KeplerianOrbit(
            7178000.0,
            1.e-4,
            FastMath.toRadians(50.),
            FastMath.toRadians(10.),
            FastMath.toRadians(20.),
            FastMath.toRadians(30.),
            PositionAngle.MEAN,
            FramesFactory.getEME2000(),
            date,
            3.986004415e14);

    final AttitudeProvider law =
        new LofOffsetPointing(
            earthSpheric,
            new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYX, 0.1, 0.2, 0.3),
            Vector3D.PLUS_K);

    Propagator propagator = new KeplerianPropagator(orbit, law);

    double h = 0.01;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));

    // check spin is consistent with attitude evolution
    double errorAngleMinus =
        Rotation.distance(
            sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus =
        Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 1.0e-6 * evolutionAngleMinus);
    double errorAnglePlus =
        Rotation.distance(
            s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus =
        Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 1.0e-6 * evolutionAnglePlus);

    Vector3D spin0 = s0.getAttitude().getSpin();
    Vector3D reference =
        AngularCoordinates.estimateRate(
            sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
    Assert.assertTrue(spin0.getNorm() > 1.0e-3);
    Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.0e-10);
  }
示例#12
0
 @Test
 public void testGeoCar() throws OrekitException {
   OneAxisEllipsoid model =
       new OneAxisEllipsoid(
           6378137.0, 1.0 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
   GeodeticPoint nsp = new GeodeticPoint(0.852479154923577, 0.0423149994747243, 111.6);
   Vector3D p = model.transform(nsp);
   Assert.assertEquals(4201866.69291890, p.getX(), 1.0e-6);
   Assert.assertEquals(177908.184625686, p.getY(), 1.0e-6);
   Assert.assertEquals(4779203.64408617, p.getZ(), 1.0e-6);
 }
示例#13
0
 @Test
 public void testOnSurface() throws OrekitException {
   Vector3D surfacePoint =
       new Vector3D(-1092200.775949484, -3944945.7282234835, 4874931.946956173);
   OneAxisEllipsoid earthShape =
       new OneAxisEllipsoid(
           6378136.460, 1 / 298.257222101, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
   GeodeticPoint gp =
       earthShape.transform(surfacePoint, earthShape.getBodyFrame(), AbsoluteDate.J2000_EPOCH);
   Vector3D rebuilt = earthShape.transform(gp);
   Assert.assertEquals(0, rebuilt.distance(surfacePoint), 3.0e-9);
 }
示例#14
0
 @Test
 public void testEquatorialInside() throws OrekitException {
   AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
   Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
   OneAxisEllipsoid model = new OneAxisEllipsoid(90.0, 5.0 / 9.0, frame);
   for (double rho = 0; rho < model.getEquatorialRadius(); rho += 0.01) {
     Vector3D point = new Vector3D(rho, 0.0, 0.0);
     GeodeticPoint gp = model.transform(point, frame, date);
     Vector3D rebuilt = model.transform(gp);
     Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-10);
   }
 }
示例#15
0
  @Test
  public void testGroundProjectionDerivatives() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    double[] errors = derivativesErrors(orbit, orbit.getDate(), eme2000, model);
    Assert.assertEquals(0, errors[0], 1.0e-16);
    Assert.assertEquals(0, errors[1], 1.0e-12);
    Assert.assertEquals(0, errors[2], 2.0e-4);
  }
  @Before
  public void setUp() throws OrekitException {

    Utils.setDataRoot("regular-data");
    earth =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    gp = new GeodeticPoint(FastMath.toRadians(51.0), FastMath.toRadians(66.6), 300.0);
    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);
    orbit =
        new EquinoctialOrbit(
            new PVCoordinates(position, velocity),
            FramesFactory.getEME2000(),
            date,
            Constants.EIGEN5C_EARTH_MU);
  }
示例#17
0
 @Test
 public void testIssue141() throws OrekitException {
   AbsoluteDate date =
       new AbsoluteDate("2002-03-06T20:50:20.44188731559965033", TimeScalesFactory.getUTC());
   Frame frame = FramesFactory.getGTOD(IERSConventions.IERS_1996, true);
   OneAxisEllipsoid model =
       new OneAxisEllipsoid(
           Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, frame);
   Vector3D point = new Vector3D(-6838696.282102453, -2148321.403361013, -0.011907944179711194);
   GeodeticPoint gp = model.transform(point, frame, date);
   Vector3D rebuilt = model.transform(gp);
   Assert.assertEquals(0.0, rebuilt.distance(point), 1.0e-15 * point.getNorm());
 }
示例#18
0
  @Test
  public void testGroundProjectionTaylor() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    TimeStampedPVCoordinates pv0 = orbit.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    PVCoordinatesProvider groundTaylor =
        model.projectToGround(pv0, model.getBodyFrame()).toTaylorProvider(model.getBodyFrame());

    TimeStampedPVCoordinates g0 =
        groundTaylor.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    Vector3D zenith = pv0.getPosition().subtract(g0.getPosition()).normalize();
    Vector3D acrossTrack = Vector3D.crossProduct(zenith, g0.getVelocity()).normalize();
    Vector3D alongTrack = Vector3D.crossProduct(acrossTrack, zenith).normalize();
    for (double dt = -1; dt < 1; dt += 0.01) {
      AbsoluteDate date = orbit.getDate().shiftedBy(dt);
      Vector3D taylorP = groundTaylor.getPVCoordinates(date, model.getBodyFrame()).getPosition();
      Vector3D refP =
          model.projectToGround(
              orbit.getPVCoordinates(date, model.getBodyFrame()).getPosition(),
              date,
              model.getBodyFrame());
      Vector3D delta = taylorP.subtract(refP);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, alongTrack), 0.0015);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, acrossTrack), 0.0007);
      Assert.assertEquals(0.0, Vector3D.dotProduct(delta, zenith), 0.00002);
    }
  }
示例#19
0
  public static void setLoaders(final IERSConventions conventions, final List<EOPEntry> eop) {

    OrekitUtils.clearFactoryMaps(FramesFactory.class);
    OrekitUtils.clearFactoryMaps(TimeScalesFactory.class);

    FramesFactory.addEOPHistoryLoader(
        conventions,
        new EOPHistoryLoader() {
          public void fillHistory(
              IERSConventions.NutationCorrectionConverter converter, SortedSet<EOPEntry> history) {
            history.addAll(eop);
          }
        });
  }
示例#20
0
  @Test
  public void testGroundProjectionPosition() throws OrekitException {
    OneAxisEllipsoid model =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    TimeStampedPVCoordinates initPV =
        new TimeStampedPVCoordinates(
            AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.),
            new Vector3D(6414.7, -2006., -3180.),
            Vector3D.ZERO);
    Frame eme2000 = FramesFactory.getEME2000();
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    for (double dt = 0; dt < 3600.0; dt += 60.0) {

      TimeStampedPVCoordinates pv = orbit.getPVCoordinates(orbit.getDate().shiftedBy(dt), eme2000);
      TimeStampedPVCoordinates groundPV = model.projectToGround(pv, eme2000);
      Vector3D groundP = model.projectToGround(pv.getPosition(), pv.getDate(), eme2000);

      // check methods projectToGround and transform are consistent with each other
      Assert.assertEquals(
          model.transform(pv.getPosition(), eme2000, pv.getDate()).getLatitude(),
          model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLatitude(),
          1.0e-10);
      Assert.assertEquals(
          model.transform(pv.getPosition(), eme2000, pv.getDate()).getLongitude(),
          model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLongitude(),
          1.0e-10);
      Assert.assertEquals(
          0.0, Vector3D.distance(groundP, groundPV.getPosition()), 1.0e-15 * groundP.getNorm());
    }
  }
示例#21
0
  @Test
  public void testLineIntersection() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);

    OneAxisEllipsoid model = new OneAxisEllipsoid(100.0, 0.9, frame);
    Vector3D point = new Vector3D(0.0, 93.7139699, 3.5930796);
    Vector3D direction = new Vector3D(0.0, 1.0, 1.0);
    Line line = new Line(point, point.add(direction), 1.0e-10);
    GeodeticPoint gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getAltitude(), 0.0, 1.0e-12);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(0.0, -93.7139699, -3.5930796);
    direction = new Vector3D(0.0, -1.0, -1.0);
    line = new Line(point, point.add(direction), 1.0e-10).revert();
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(0.0, -93.7139699, 3.5930796);
    direction = new Vector3D(0.0, -1.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));

    model = new OneAxisEllipsoid(100.0, 0.9, frame);
    point = new Vector3D(-93.7139699, 0.0, 3.5930796);
    direction = new Vector3D(-1.0, 0.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertTrue(line.contains(model.transform(gp)));
    Assert.assertFalse(line.contains(new Vector3D(0, 0, 7000000)));

    point = new Vector3D(0.0, 0.0, 110);
    direction = new Vector3D(0.0, 0.0, 1.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getLatitude(), FastMath.PI / 2, 1.0e-12);

    point = new Vector3D(0.0, 110, 0);
    direction = new Vector3D(0.0, 1.0, 0.0);
    line = new Line(point, point.add(direction), 1.0e-10);
    gp = model.getIntersectionPoint(line, point, frame, date);
    Assert.assertEquals(gp.getLatitude(), 0, 1.0e-12);
  }
示例#22
0
    public Tracker(final BoundedPropagator prop) throws OrekitException {
      this.prop = prop;

      earth =
          new OneAxisEllipsoid(
              Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
              Constants.WGS84_EARTH_FLATTENING,
              FramesFactory.getITRF2005());

      // setup an arbitrary station on the surface of the earth
      double longitude = Math.toRadians(45.);
      double latitude = Math.toRadians(25.);
      double altitude = 0.;
      final GeodeticPoint station = new GeodeticPoint(latitude, longitude, altitude);

      stationFrame = new TopocentricFrame(earth, station, "ground location");
    }
  @Test
  public void testEphemerisDatesBackward() throws OrekitException {
    // setup
    TimeScale tai = TimeScalesFactory.getTAI();
    AbsoluteDate initialDate = new AbsoluteDate("2015-07-05", tai);
    AbsoluteDate startDate = new AbsoluteDate("2015-07-03", tai).shiftedBy(-0.1);
    AbsoluteDate endDate = new AbsoluteDate("2015-07-04", tai);
    Frame eci = FramesFactory.getGCRF();
    KeplerianOrbit orbit =
        new KeplerianOrbit(
            600e3 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            0,
            0,
            0,
            0,
            0,
            PositionAngle.TRUE,
            eci,
            initialDate,
            mu);
    double[][] tol = NumericalPropagator.tolerances(1, orbit, OrbitType.CARTESIAN);
    Propagator prop =
        new NumericalPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1]));
    prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit)));

    // action
    prop.setEphemerisMode();
    prop.propagate(endDate, startDate);
    BoundedPropagator ephemeris = prop.getGeneratedEphemeris();

    // verify
    TimeStampedPVCoordinates actualPV = ephemeris.getPVCoordinates(startDate, eci);
    TimeStampedPVCoordinates expectedPV = orbit.getPVCoordinates(startDate, eci);
    MatcherAssert.assertThat(
        actualPV.getPosition(), OrekitMatchers.vectorCloseTo(expectedPV.getPosition(), 1.0));
    MatcherAssert.assertThat(
        actualPV.getVelocity(), OrekitMatchers.vectorCloseTo(expectedPV.getVelocity(), 1.0));
    MatcherAssert.assertThat(
        ephemeris.getMinDate().durationFrom(startDate), OrekitMatchers.closeTo(0, 0));
    MatcherAssert.assertThat(
        ephemeris.getMaxDate().durationFrom(endDate), OrekitMatchers.closeTo(0, 0));
    // test date
    AbsoluteDate date = endDate.shiftedBy(-0.11);
    Assert.assertEquals(ephemeris.propagate(date).getDate().durationFrom(date), 0, 0);
  }
  @Test
  public void testSerialization()
      throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException,
          OrekitException {

    final double r = Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
    final BodyShape earth =
        new OneAxisEllipsoid(
            r,
            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))
            .withMargin(FastMath.toRadians(0.75))
            .withHandler(new ContinueOnEvent<GeographicZoneDetector>());

    Assert.assertEquals(r, ((OneAxisEllipsoid) d.getBody()).getEquatorialRadius(), 1.0e-12);
    Assert.assertEquals(0.75, FastMath.toDegrees(d.getMargin()), 1.0e-12);
    Assert.assertEquals(5.6807e11, d.getZone().getSize() * r * r, 1.0e9);
    Assert.assertEquals(4.0289e6, d.getZone().getBoundarySize() * r, 1.0e3);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(d);

    Assert.assertTrue(bos.size() > 2100);
    Assert.assertTrue(bos.size() < 2200);

    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    GeographicZoneDetector deserialized = (GeographicZoneDetector) ois.readObject();

    Assert.assertEquals(d.getZone().getSize(), deserialized.getZone().getSize(), 1.0e-3);
    Assert.assertEquals(
        d.getZone().getBoundarySize(), deserialized.getZone().getBoundarySize(), 1.0e-3);
    Assert.assertEquals(d.getZone().getTolerance(), deserialized.getZone().getTolerance(), 1.0e-15);
    Assert.assertEquals(d.getMaxCheckInterval(), deserialized.getMaxCheckInterval(), 1.0e-15);
    Assert.assertEquals(d.getThreshold(), deserialized.getThreshold(), 1.0e-15);
    Assert.assertEquals(d.getMaxIterationCount(), deserialized.getMaxIterationCount());

    Assert.assertTrue(
        new RegionFactory<Sphere2D>().difference(d.getZone(), deserialized.getZone()).isEmpty());
  }
示例#25
0
  @Test(expected = OrekitException.class)
  public void testNotInitialized() throws OrekitException {
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            Constants.EIGEN5C_EARTH_MU);

    double dP = 0.001;
    NumericalPropagator propagator =
        setUpPropagator(initialOrbit, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE);
    new PartialDerivativesEquations("partials", propagator).getMapper();
  }
 @Before
 public void setUp() throws OrekitException {
   Utils.setDataRoot("regular-data:potential/shm-format");
   GravityFieldFactory.addPotentialCoefficientsReader(
       new SHMFormatReader("^eigen_cg03c_coef$", false));
   mu = GravityFieldFactory.getUnnormalizedProvider(0, 0).getMu();
   final Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6);
   final Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
   initDate = AbsoluteDate.J2000_EPOCH;
   final Orbit orbit =
       new EquinoctialOrbit(
           new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
   initialState = new SpacecraftState(orbit);
   double[][] tolerance = NumericalPropagator.tolerances(0.001, orbit, OrbitType.EQUINOCTIAL);
   AdaptiveStepsizeIntegrator integrator =
       new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
   integrator.setInitialStepSize(60);
   propagator = new NumericalPropagator(integrator);
   propagator.setInitialState(initialState);
 }
 @Test
 public void testIssue157() throws OrekitException {
   try {
     Orbit orbit =
         new KeplerianOrbit(
             13378000,
             0.05,
             0,
             0,
             FastMath.PI,
             0,
             PositionAngle.MEAN,
             FramesFactory.getTOD(false),
             new AbsoluteDate(2003, 5, 6, TimeScalesFactory.getUTC()),
             Constants.EIGEN5C_EARTH_MU);
     NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
     Assert.fail("an exception should have been thrown");
   } catch (PropagationException pe) {
     Assert.assertEquals(OrekitMessages.SINGULAR_JACOBIAN_FOR_ORBIT_TYPE, pe.getSpecifier());
   }
 }
示例#28
0
  private void checkCartesianToEllipsoidic(
      double ae,
      double f,
      double x,
      double y,
      double z,
      double longitude,
      double latitude,
      double altitude)
      throws OrekitException {

    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    OneAxisEllipsoid model = new OneAxisEllipsoid(ae, f, frame);
    GeodeticPoint gp = model.transform(new Vector3D(x, y, z), frame, date);
    Assert.assertEquals(longitude, MathUtils.normalizeAngle(gp.getLongitude(), longitude), 1.0e-10);
    Assert.assertEquals(latitude, gp.getLatitude(), 1.0e-10);
    Assert.assertEquals(altitude, gp.getAltitude(), 1.0e-10 * FastMath.abs(ae));
    Vector3D rebuiltNadir = Vector3D.crossProduct(gp.getSouth(), gp.getWest());
    Assert.assertEquals(0, rebuiltNadir.subtract(gp.getNadir()).getNorm(), 1.0e-15);
  }
示例#29
0
  @Test
  public void testSerialization() throws OrekitException, IOException, ClassNotFoundException {
    OneAxisEllipsoid original =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRFEquinox(IERSConventions.IERS_1996, true));
    original.setAngularThreshold(1.0e-3);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(original);
    Assert.assertTrue(bos.size() > 250);
    Assert.assertTrue(bos.size() < 350);

    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    OneAxisEllipsoid deserialized = (OneAxisEllipsoid) ois.readObject();
    Assert.assertEquals(
        original.getEquatorialRadius(), deserialized.getEquatorialRadius(), 1.0e-12);
    Assert.assertEquals(original.getFlattening(), deserialized.getFlattening(), 1.0e-12);
  }
示例#30
0
  @Test(expected = OrekitException.class)
  public void testMismatchedDimensions() throws OrekitException {
    Orbit initialOrbit =
        new KeplerianOrbit(
            8000000.0,
            0.01,
            0.1,
            0.7,
            0,
            1.2,
            PositionAngle.TRUE,
            FramesFactory.getEME2000(),
            AbsoluteDate.J2000_EPOCH,
            Constants.EIGEN5C_EARTH_MU);

    double dP = 0.001;
    NumericalPropagator propagator =
        setUpPropagator(initialOrbit, dP, OrbitType.EQUINOCTIAL, PositionAngle.TRUE);
    PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
    partials.setInitialJacobians(
        new SpacecraftState(initialOrbit), new double[6][6], new double[7][2]);
  }