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 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 #3
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 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());
    }
  }