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); }
/** * 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; }