Search in sources :

Example 81 with TimeStampedPVCoordinates

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);
}
Also used : Frame(org.orekit.frames.Frame) GPSAlmanac(org.orekit.gnss.GPSAlmanac) ArrayList(java.util.ArrayList) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 82 with TimeStampedPVCoordinates

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Test(org.junit.Test)

Example 83 with TimeStampedPVCoordinates

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);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Test(org.junit.Test)

Example 84 with TimeStampedPVCoordinates

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());
}
Also used : Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CircularOrbit(org.orekit.orbits.CircularOrbit) ArrayList(java.util.ArrayList) UnnormalizedSphericalHarmonics(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider.UnnormalizedSphericalHarmonics) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) EcksteinHechlerPropagator(org.orekit.propagation.analytical.EcksteinHechlerPropagator)

Example 85 with TimeStampedPVCoordinates

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;
}
Also used : TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates)

Aggregations

TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)103 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)64 Test (org.junit.Test)50 AbsoluteDate (org.orekit.time.AbsoluteDate)48 SpacecraftState (org.orekit.propagation.SpacecraftState)36 Frame (org.orekit.frames.Frame)27 ArrayList (java.util.ArrayList)24 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)23 Transform (org.orekit.frames.Transform)22 CartesianOrbit (org.orekit.orbits.CartesianOrbit)20 Orbit (org.orekit.orbits.Orbit)19 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)18 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)17 PVCoordinates (org.orekit.utils.PVCoordinates)17 OrekitException (org.orekit.errors.OrekitException)15 BoundedPropagator (org.orekit.propagation.BoundedPropagator)12 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)11 CircularOrbit (org.orekit.orbits.CircularOrbit)11 Propagator (org.orekit.propagation.Propagator)11 FieldTransform (org.orekit.frames.FieldTransform)10