Search in sources :

Example 1 with FieldTimeStamped

use of org.orekit.time.FieldTimeStamped in project Orekit by CS-SI.

the class FieldNumericalPropagatorTest method doTestShift.

private static <T extends RealFieldElement<T>> void doTestShift(final FieldCartesianOrbit<T> orbit, final OrbitType orbitType, final PositionAngle angleType, final boolean withDerivatives, final double error60s, final double error120s, final double error300s, final double error600s, final double error900s) throws OrekitException {
    T zero = orbit.getDate().getField().getZero();
    Utils.setDataRoot("regular-data:atmosphere:potential/grgs-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
    final FieldNumericalPropagator<T> np = createPropagator(new FieldSpacecraftState<>(orbit), orbitType, angleType);
    // the reference date for shifts is set at 60s, so the propagator can provide derivatives if needed
    // (derivatives are not available in the initial orbit)
    final FieldAbsoluteDate<T> reference = orbit.getDate().shiftedBy(60.0);
    final ShiftChecker<T> checker = new ShiftChecker<>(withDerivatives, orbitType, angleType, error60s, error120s, error300s, error600s, error900s);
    @SuppressWarnings("unchecked") FieldTimeStamped<T>[] dates = (FieldTimeStamped<T>[]) Array.newInstance(FieldTimeStamped.class, 6);
    dates[0] = reference;
    dates[1] = reference.shiftedBy(60.0);
    dates[2] = reference.shiftedBy(120.0);
    dates[3] = reference.shiftedBy(300.0);
    dates[4] = reference.shiftedBy(600.0);
    dates[5] = reference.shiftedBy(900.0);
    np.addEventDetector(new FieldDateDetector<T>(zero.add(30.0), zero.add(1.0e-9), (FieldTimeStamped<T>[]) dates).withHandler(checker));
    np.propagate(reference.shiftedBy(1000.0));
}
Also used : FieldDateDetector(org.orekit.propagation.events.FieldDateDetector) FieldTimeStamped(org.orekit.time.FieldTimeStamped) GRGSFormatReader(org.orekit.forces.gravity.potential.GRGSFormatReader)

Aggregations

GRGSFormatReader (org.orekit.forces.gravity.potential.GRGSFormatReader)1 FieldDateDetector (org.orekit.propagation.events.FieldDateDetector)1 FieldTimeStamped (org.orekit.time.FieldTimeStamped)1