use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.
the class FieldNumericalPropagatorTest method createEllipticOrbit.
private static <T extends RealFieldElement<T>> FieldCartesianOrbit<T> createEllipticOrbit(Field<T> field) throws OrekitException {
T zero = field.getZero();
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final FieldVector3D<T> position = new FieldVector3D<>(zero.add(6896874.444705), zero.add(1956581.072644), zero.add(-147476.245054));
final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(166.816407662), zero.add(-1106.783301861), zero.add(-7372.745712770));
final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, FieldVector3D.getZero(field));
final Frame frame = FramesFactory.getEME2000();
final double mu = Constants.EIGEN5C_EARTH_MU;
return new FieldCartesianOrbit<>(pv, frame, mu);
}
use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.
the class FieldKeplerianPropagatorTest method doTestNoDerivatives.
private <T extends RealFieldElement<T>> void doTestNoDerivatives(Field<T> field) throws OrekitException {
T zero = field.getZero();
for (OrbitType type : OrbitType.values()) {
// create an initial orbit with non-Keplerian acceleration
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, TimeScalesFactory.getUTC());
final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
final FieldVector3D<T> keplerAcceleration = new FieldVector3D<>(position.getNormSq().reciprocal().multiply(-mu), position.normalize());
final FieldVector3D<T> nonKeplerAcceleration = new FieldVector3D<>(zero.add(0.001), zero.add(0.002), zero.add(0.003));
final FieldVector3D<T> acceleration = keplerAcceleration.add(nonKeplerAcceleration);
final TimeStampedFieldPVCoordinates<T> pva = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
final FieldOrbit<T> initial = type.convertType(new FieldCartesianOrbit<>(pva, FramesFactory.getEME2000(), mu));
Assert.assertEquals(type, initial.getType());
// the derivatives are available at this stage
checkDerivatives(initial, true);
FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(initial);
Assert.assertEquals(type, propagator.getInitialState().getOrbit().getType());
// non-Keplerian derivatives are explicitly removed when building the Keplerian-only propagator
checkDerivatives(propagator.getInitialState().getOrbit(), false);
FieldPVCoordinates<T> initPV = propagator.getInitialState().getOrbit().getPVCoordinates();
Assert.assertEquals(nonKeplerAcceleration.getNorm().getReal(), FieldVector3D.distance(acceleration, initPV.getAcceleration()).getReal(), 2.0e-15);
Assert.assertEquals(0.0, FieldVector3D.distance(keplerAcceleration, initPV.getAcceleration()).getReal(), 5.0e-15);
T dt = initial.getKeplerianPeriod().multiply(0.2);
FieldOrbit<T> orbit = propagator.propagateOrbit(initial.getDate().shiftedBy(dt));
Assert.assertEquals(type, orbit.getType());
// at the end, we don't have non-Keplerian derivatives
checkDerivatives(orbit, false);
// using shiftedBy on the initial orbit, non-Keplerian derivatives would have been preserved
checkDerivatives(initial.shiftedBy(dt), true);
}
}
use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.
the class FieldCartesianOrbitTest method doTestNonKeplerianDerivatives.
private <T extends RealFieldElement<T>> void doTestNonKeplerianDerivatives(Field<T> field) throws OrekitException {
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
final Frame frame = FramesFactory.getEME2000();
final double mu = Constants.EIGEN5C_EARTH_MU;
final FieldCartesianOrbit<T> orbit = new FieldCartesianOrbit<>(pv, frame, mu);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getA()), orbit.getADot().getReal(), 4.3e-8);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEx()), orbit.getEquinoctialExDot().getReal(), 2.1e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEquinoctialEy()), orbit.getEquinoctialEyDot().getReal(), 5.3e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHx()), orbit.getHxDot().getReal(), 4.4e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot().getReal(), 8.0e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot().getReal(), 1.2e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot().getReal(), 7.8e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot().getReal(), 8.8e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot().getReal(), 7.0e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 5.7e-16);
}
use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.
the class FieldCircularOrbitTest method doTestPositionAngleDerivatives.
private <T extends RealFieldElement<T>> void doTestPositionAngleDerivatives(final Field<T> field) throws OrekitException {
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
final Frame frame = FramesFactory.getEME2000();
final double mu = Constants.EIGEN5C_EARTH_MU;
final FieldCircularOrbit<T> orbit = new FieldCircularOrbit<>(pv, frame, mu);
for (PositionAngle type : PositionAngle.values()) {
final FieldCircularOrbit<T> rebuilt = new FieldCircularOrbit<>(orbit.getA(), orbit.getCircularEx(), orbit.getCircularEy(), orbit.getI(), orbit.getRightAscensionOfAscendingNode(), orbit.getAlpha(type), orbit.getADot(), orbit.getCircularExDot(), orbit.getCircularEyDot(), orbit.getIDot(), orbit.getRightAscensionOfAscendingNodeDot(), orbit.getAlphaDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
Assert.assertThat(rebuilt.getA().getReal(), relativelyCloseTo(orbit.getA().getReal(), 1));
Assert.assertThat(rebuilt.getCircularEx().getReal(), relativelyCloseTo(orbit.getCircularEx().getReal(), 1));
Assert.assertThat(rebuilt.getCircularEy().getReal(), relativelyCloseTo(orbit.getCircularEy().getReal(), 1));
Assert.assertThat(rebuilt.getE().getReal(), relativelyCloseTo(orbit.getE().getReal(), 1));
Assert.assertThat(rebuilt.getI().getReal(), relativelyCloseTo(orbit.getI().getReal(), 1));
Assert.assertThat(rebuilt.getRightAscensionOfAscendingNode().getReal(), relativelyCloseTo(orbit.getRightAscensionOfAscendingNode().getReal(), 1));
Assert.assertThat(rebuilt.getADot().getReal(), relativelyCloseTo(orbit.getADot().getReal(), 1));
Assert.assertThat(rebuilt.getCircularExDot().getReal(), relativelyCloseTo(orbit.getCircularExDot().getReal(), 1));
Assert.assertThat(rebuilt.getCircularEyDot().getReal(), relativelyCloseTo(orbit.getCircularEyDot().getReal(), 1));
Assert.assertThat(rebuilt.getEDot().getReal(), relativelyCloseTo(orbit.getEDot().getReal(), 1));
Assert.assertThat(rebuilt.getIDot().getReal(), relativelyCloseTo(orbit.getIDot().getReal(), 1));
Assert.assertThat(rebuilt.getRightAscensionOfAscendingNodeDot().getReal(), relativelyCloseTo(orbit.getRightAscensionOfAscendingNodeDot().getReal(), 1));
for (PositionAngle type2 : PositionAngle.values()) {
Assert.assertThat(rebuilt.getAlpha(type2).getReal(), relativelyCloseTo(orbit.getAlpha(type2).getReal(), 1));
Assert.assertThat(rebuilt.getAlphaDot(type2).getReal(), relativelyCloseTo(orbit.getAlphaDot(type2).getReal(), 1));
}
}
}
use of org.orekit.utils.TimeStampedFieldPVCoordinates in project Orekit by CS-SI.
the class FieldEquinoctialOrbitTest method doTestPositionAngleDerivatives.
private <T extends RealFieldElement<T>> void doTestPositionAngleDerivatives(final Field<T> field) throws OrekitException {
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, "2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(6896874.444705), field.getZero().add(1956581.072644), field.getZero().add(-147476.245054));
final FieldVector3D<T> velocity = new FieldVector3D<>(field.getZero().add(166.816407662), field.getZero().add(-1106.783301861), field.getZero().add(-7372.745712770));
final FieldVector3D<T> acceleration = new FieldVector3D<>(field.getZero().add(-7.466182457944), field.getZero().add(-2.118153357345), field.getZero().add(0.160004048437));
final TimeStampedFieldPVCoordinates<T> pv = new TimeStampedFieldPVCoordinates<>(date, position, velocity, acceleration);
final Frame frame = FramesFactory.getEME2000();
final double mu = Constants.EIGEN5C_EARTH_MU;
final FieldEquinoctialOrbit<T> orbit = new FieldEquinoctialOrbit<>(pv, frame, mu);
for (PositionAngle type : PositionAngle.values()) {
final FieldEquinoctialOrbit<T> rebuilt = new FieldEquinoctialOrbit<>(orbit.getA(), orbit.getEquinoctialEx(), orbit.getEquinoctialEy(), orbit.getHx(), orbit.getHy(), orbit.getL(type), orbit.getADot(), orbit.getEquinoctialExDot(), orbit.getEquinoctialEyDot(), orbit.getHxDot(), orbit.getHyDot(), orbit.getLDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
Assert.assertThat(rebuilt.getA().getReal(), relativelyCloseTo(orbit.getA().getReal(), 1));
Assert.assertThat(rebuilt.getEquinoctialEx().getReal(), relativelyCloseTo(orbit.getEquinoctialEx().getReal(), 1));
Assert.assertThat(rebuilt.getEquinoctialEy().getReal(), relativelyCloseTo(orbit.getEquinoctialEy().getReal(), 1));
Assert.assertThat(rebuilt.getHx().getReal(), relativelyCloseTo(orbit.getHx().getReal(), 1));
Assert.assertThat(rebuilt.getHy().getReal(), relativelyCloseTo(orbit.getHy().getReal(), 1));
Assert.assertThat(rebuilt.getADot().getReal(), relativelyCloseTo(orbit.getADot().getReal(), 1));
Assert.assertThat(rebuilt.getEquinoctialExDot().getReal(), relativelyCloseTo(orbit.getEquinoctialExDot().getReal(), 1));
Assert.assertThat(rebuilt.getEquinoctialEyDot().getReal(), relativelyCloseTo(orbit.getEquinoctialEyDot().getReal(), 1));
Assert.assertThat(rebuilt.getHxDot().getReal(), relativelyCloseTo(orbit.getHxDot().getReal(), 1));
Assert.assertThat(rebuilt.getHyDot().getReal(), relativelyCloseTo(orbit.getHyDot().getReal(), 1));
for (PositionAngle type2 : PositionAngle.values()) {
Assert.assertThat(rebuilt.getL(type2).getReal(), relativelyCloseTo(orbit.getL(type2).getReal(), 1));
Assert.assertThat(rebuilt.getLDot(type2).getReal(), relativelyCloseTo(orbit.getLDot(type2).getReal(), 1));
}
}
}
Aggregations