use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class GPSPropagatorTest method testDerivativesConsistency.
@Test
public void testDerivativesConsistency() throws OrekitException {
final Frame eme2000 = FramesFactory.getEME2000();
double errorP = 0;
double errorV = 0;
double errorA = 0;
for (final GPSAlmanac almanac : almanacs) {
GPSPropagator propagator = new GPSPropagator.Builder(almanac).build();
GPSOrbitalElements elements = propagator.getGPSOrbitalElements();
AbsoluteDate t0 = AbsoluteDate.createGPSDate(elements.getWeek(), 0.001 * elements.getTime());
for (double dt = 0; dt < Constants.JULIAN_DAY; dt += 600) {
final AbsoluteDate central = t0.shiftedBy(dt);
final PVCoordinates pv = propagator.getPVCoordinates(central, eme2000);
final double h = 10.0;
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (int i = -3; i <= 3; ++i) {
sample.add(propagator.getPVCoordinates(central.shiftedBy(i * h), eme2000));
}
final PVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(central, CartesianDerivativesFilter.USE_P, sample);
errorP = FastMath.max(errorP, Vector3D.distance(pv.getPosition(), interpolated.getPosition()));
errorV = FastMath.max(errorV, Vector3D.distance(pv.getVelocity(), interpolated.getVelocity()));
errorA = FastMath.max(errorA, Vector3D.distance(pv.getAcceleration(), interpolated.getAcceleration()));
}
}
Assert.assertEquals(0.0, errorP, 3.8e-9);
Assert.assertEquals(0.0, errorV, 3.5e-8);
Assert.assertEquals(0.0, errorA, 1.1e-8);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class EclipseDetectorTest method testInsideOcculting.
@Test
public void testInsideOcculting() throws OrekitException {
EclipseDetector e = new EclipseDetector(sun, sunRadius, earth, earthRadius);
SpacecraftState s = new SpacecraftState(new CartesianOrbit(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, new Vector3D(1e6, 2e6, 3e6), new Vector3D(1000, 0, 0)), FramesFactory.getGCRF(), mu));
Assert.assertEquals(-FastMath.PI, e.g(s), 1.0e-15);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class EclipseDetectorTest method testInsideOcculted.
@Test
public void testInsideOcculted() throws OrekitException {
EclipseDetector e = new EclipseDetector(sun, sunRadius, earth, earthRadius);
Vector3D p = sun.getPVCoordinates(AbsoluteDate.J2000_EPOCH, FramesFactory.getGCRF()).getPosition();
SpacecraftState s = new SpacecraftState(new CartesianOrbit(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, p.add(Vector3D.PLUS_I), Vector3D.PLUS_K), FramesFactory.getGCRF(), mu));
Assert.assertEquals(FastMath.PI, e.g(s), 1.0e-15);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class EcksteinHechlerConverterTest method checkFit.
protected void checkFit(final Orbit orbit, final double duration, final double stepSize, final double threshold, final boolean positionOnly, final double expectedRMS) throws OrekitException {
// shift position by 3m
CircularOrbit modified = new CircularOrbit(new TimeStampedPVCoordinates(orbit.getDate(), new Vector3D(1, orbit.getPVCoordinates().getPosition(), 3.0, Vector3D.PLUS_J), orbit.getPVCoordinates().getVelocity()), orbit.getFrame(), orbit.getMu());
Propagator p = new EcksteinHechlerPropagator(modified, provider);
List<SpacecraftState> sample = new ArrayList<SpacecraftState>();
for (double dt = 0; dt < duration; dt += stepSize) {
sample.add(p.propagate(modified.getDate().shiftedBy(dt)));
}
UnnormalizedSphericalHarmonics harmonics = provider.onDate(orbit.getDate());
PropagatorBuilder builder = new EcksteinHechlerPropagatorBuilder(orbit, provider.getAe(), provider.getMu(), provider.getTideSystem(), harmonics.getUnnormalizedCnm(2, 0), harmonics.getUnnormalizedCnm(3, 0), harmonics.getUnnormalizedCnm(4, 0), harmonics.getUnnormalizedCnm(5, 0), harmonics.getUnnormalizedCnm(6, 0), OrbitType.CIRCULAR, PositionAngle.TRUE, 1.0);
FiniteDifferencePropagatorConverter fitter = new FiniteDifferencePropagatorConverter(builder, threshold, 1000);
fitter.convert(sample, positionOnly);
Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.01 * expectedRMS);
EcksteinHechlerPropagator prop = (EcksteinHechlerPropagator) fitter.getAdaptedPropagator();
Orbit fitted = prop.getInitialState().getOrbit();
final double eps = 1.0e-12;
Assert.assertEquals(modified.getPVCoordinates().getPosition().getX(), fitted.getPVCoordinates().getPosition().getX(), eps * modified.getPVCoordinates().getPosition().getX());
Assert.assertEquals(modified.getPVCoordinates().getPosition().getY(), fitted.getPVCoordinates().getPosition().getY(), eps * modified.getPVCoordinates().getPosition().getY());
Assert.assertEquals(modified.getPVCoordinates().getPosition().getZ(), fitted.getPVCoordinates().getPosition().getZ(), eps * modified.getPVCoordinates().getPosition().getZ());
Assert.assertEquals(modified.getPVCoordinates().getVelocity().getX(), fitted.getPVCoordinates().getVelocity().getX(), eps * modified.getPVCoordinates().getVelocity().getX());
Assert.assertEquals(modified.getPVCoordinates().getVelocity().getY(), fitted.getPVCoordinates().getVelocity().getY(), -eps * modified.getPVCoordinates().getVelocity().getY());
Assert.assertEquals(modified.getPVCoordinates().getVelocity().getZ(), fitted.getPVCoordinates().getVelocity().getZ(), -eps * modified.getPVCoordinates().getVelocity().getZ());
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class PV method theoreticalEvaluation.
/**
* {@inheritDoc}
*/
@Override
protected EstimatedMeasurement<PV> theoreticalEvaluation(final int iteration, final int evaluation, final SpacecraftState[] states) throws OrekitException {
// PV value
final TimeStampedPVCoordinates pv = states[getPropagatorsIndices().get(0)].getPVCoordinates();
// prepare the evaluation
final EstimatedMeasurement<PV> estimated = new EstimatedMeasurement<>(this, iteration, evaluation, states, new TimeStampedPVCoordinates[] { pv });
estimated.setEstimatedValue(new double[] { pv.getPosition().getX(), pv.getPosition().getY(), pv.getPosition().getZ(), pv.getVelocity().getX(), pv.getVelocity().getY(), pv.getVelocity().getZ() });
// partial derivatives with respect to state
estimated.setStateDerivatives(0, IDENTITY);
return estimated;
}
Aggregations