@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);
  }
Beispiel #2
0
  /** {@inheritDoc} */
  protected TimeStampedPVCoordinates getTargetPV(
      final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame)
      throws OrekitException {

    // transform from specified reference frame to spacecraft frame
    final Transform refToSc =
        new Transform(
            date,
            new Transform(date, pvProv.getPVCoordinates(date, frame).negate()),
            new Transform(date, attitudeLaw.getAttitude(pvProv, date, frame).getOrientation()));

    // transform from specified reference frame to body frame
    final Transform refToBody = frame.getTransformTo(shape.getBodyFrame(), date);

    // sample intersection points in current date neighborhood
    final Transform scToBody = new Transform(date, refToSc.getInverse(), refToBody);
    final double h = 0.1;
    final List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
    sample.add(losIntersectionWithBody(scToBody.shiftedBy(-h)));
    sample.add(losIntersectionWithBody(scToBody));
    sample.add(losIntersectionWithBody(scToBody.shiftedBy(+h)));

    // use interpolation to compute properly the time-derivatives
    final TimeStampedPVCoordinates targetBody =
        TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, sample);

    // convert back to caller specified frame
    return refToBody.getInverse().transformPVCoordinates(targetBody);
  }
  @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);
    }
  }
Beispiel #4
0
 /**
  * Set the orbit from Cartesian parameters.
  *
  * <p>The acceleration provided in {@code pvCoordinates} is accessible using {@link
  * #getPVCoordinates()} and {@link #getPVCoordinates(Frame)}. All other methods use {@code mu} and
  * the position to compute the acceleration, including {@link #shiftedBy(double)} and {@link
  * #getPVCoordinates(AbsoluteDate, Frame)}.
  *
  * @param pvCoordinates the position and velocity in the inertial frame
  * @param frame the frame in which the {@link TimeStampedPVCoordinates} are defined (<em>must</em>
  *     be a {@link Frame#isPseudoInertial pseudo-inertial frame})
  * @param mu central attraction coefficient (m^3/s^2)
  * @exception IllegalArgumentException if frame is not a {@link Frame#isPseudoInertial
  *     pseudo-inertial frame}
  */
 protected Orbit(final TimeStampedPVCoordinates pvCoordinates, final Frame frame, final double mu)
     throws IllegalArgumentException {
   ensurePseudoInertialFrame(frame);
   this.date = pvCoordinates.getDate();
   this.mu = mu;
   if (pvCoordinates.getAcceleration().getNormSq() == 0) {
     // the acceleration was not provided,
     // compute it from Newtonian attraction
     final double r2 = pvCoordinates.getPosition().getNormSq();
     final double r3 = r2 * FastMath.sqrt(r2);
     this.pvCoordinates =
         new TimeStampedPVCoordinates(
             pvCoordinates.getDate(),
             pvCoordinates.getPosition(),
             pvCoordinates.getVelocity(),
             new Vector3D(-mu / r3, pvCoordinates.getPosition()));
   } else {
     this.pvCoordinates = pvCoordinates;
   }
   this.frame = frame;
 }
  @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);
  }
  private double[] derivativesErrors(
      PVCoordinatesProvider provider, AbsoluteDate date, Frame frame, OneAxisEllipsoid model)
      throws OrekitException {
    List<TimeStampedPVCoordinates> pvList = new ArrayList<TimeStampedPVCoordinates>();
    List<TimeStampedPVCoordinates> groundPVList = new ArrayList<TimeStampedPVCoordinates>();
    for (double dt = -0.25; dt <= 0.25; dt += 0.125) {
      TimeStampedPVCoordinates shiftedPV = provider.getPVCoordinates(date.shiftedBy(dt), frame);
      Vector3D p = model.projectToGround(shiftedPV.getPosition(), shiftedPV.getDate(), frame);
      pvList.add(shiftedPV);
      groundPVList.add(
          new TimeStampedPVCoordinates(shiftedPV.getDate(), p, Vector3D.ZERO, Vector3D.ZERO));
    }
    TimeStampedPVCoordinates computed =
        model.projectToGround(
            TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, pvList),
            frame);
    TimeStampedPVCoordinates reference =
        TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, groundPVList);

    TimeStampedPVCoordinates pv0 = provider.getPVCoordinates(date, frame);
    Vector3D p0 = pv0.getPosition();
    Vector3D v0 = pv0.getVelocity();
    Vector3D a0 = pv0.getAcceleration();

    return new double[] {
      Vector3D.distance(computed.getPosition(), reference.getPosition()) / p0.getNorm(),
      Vector3D.distance(computed.getVelocity(), reference.getVelocity()) / v0.getNorm(),
      Vector3D.distance(computed.getAcceleration(), reference.getAcceleration()) / a0.getNorm(),
    };
  }
  @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());
    }
  }