use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class FieldEquinoctialOrbitTest 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 FieldEquinoctialOrbit<T> orbit = new FieldEquinoctialOrbit<>(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(), 1.5e-15);
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.7e-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(), 6.9e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 3.5e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.TRUE)), orbit.getLDot(PositionAngle.TRUE).getReal(), 1.2e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.ECCENTRIC)), orbit.getLDot(PositionAngle.ECCENTRIC).getReal(), 7.7e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getL(PositionAngle.MEAN)), orbit.getLDot(PositionAngle.MEAN).getReal(), 8.8e-16);
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class FieldKeplerianOrbitTest method doTestNonKeplerianEllipticDerivatives.
private <T extends RealFieldElement<T>> void doTestNonKeplerianEllipticDerivatives(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 FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(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(), 1.6e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getHy()), orbit.getHyDot().getReal(), 7.3e-17);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLv()), orbit.getLvDot().getReal(), 1.1e-14);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLE()), orbit.getLEDot().getReal(), 7.2e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getLM()), orbit.getLMDot().getReal(), 4.7e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getE()), orbit.getEDot().getReal(), 6.9e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getI()), orbit.getIDot().getReal(), 5.7e-16);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getPerigeeArgument()), orbit.getPerigeeArgumentDot().getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getRightAscensionOfAscendingNode()), orbit.getRightAscensionOfAscendingNodeDot().getReal(), 1.5e-15);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getTrueAnomaly()), orbit.getTrueAnomalyDot().getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getEccentricAnomaly()), orbit.getEccentricAnomalyDot().getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getMeanAnomaly()), orbit.getMeanAnomalyDot().getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.TRUE)), orbit.getAnomalyDot(PositionAngle.TRUE).getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.ECCENTRIC)), orbit.getAnomalyDot(PositionAngle.ECCENTRIC).getReal(), 1.5e-12);
Assert.assertEquals(differentiate(pv, frame, mu, shifted -> shifted.getAnomaly(PositionAngle.MEAN)), orbit.getAnomalyDot(PositionAngle.MEAN).getReal(), 1.5e-12);
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class FieldKeplerianOrbitTest method doTestVeryLargeEccentricity.
private <T extends RealFieldElement<T>> void doTestVeryLargeEccentricity(final Field<T> field) {
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
final Frame eme2000 = FramesFactory.getEME2000();
final double meanAnomaly = 1.;
final FieldKeplerianOrbit<T> orb0 = new FieldKeplerianOrbit<>(field.getZero().add(42600e3), field.getZero().add(0.9), field.getZero().add(0.00001), field.getZero().add(0), field.getZero().add(0), field.getZero().add(FastMath.toRadians(meanAnomaly)), PositionAngle.MEAN, eme2000, date, mu);
// big dV along Y
final FieldVector3D<T> deltaV = new FieldVector3D<>(field.getZero().add(0.0), field.getZero().add(110000.0), field.getZero());
final FieldPVCoordinates<T> pv1 = new FieldPVCoordinates<>(orb0.getPVCoordinates().getPosition(), orb0.getPVCoordinates().getVelocity().add(deltaV));
final FieldKeplerianOrbit<T> orb1 = new FieldKeplerianOrbit<>(pv1, eme2000, date, mu);
// Despite large eccentricity, the conversion of mean anomaly to hyperbolic eccentric anomaly
// converges in less than 50 iterations (issue #114)
final FieldPVCoordinates<T> pvTested = orb1.shiftedBy(field.getZero()).getPVCoordinates();
final FieldVector3D<T> pTested = pvTested.getPosition();
final FieldVector3D<T> vTested = pvTested.getVelocity();
final FieldPVCoordinates<T> pvReference = orb1.getPVCoordinates();
final FieldVector3D<T> pReference = pvReference.getPosition();
final FieldVector3D<T> vReference = pvReference.getVelocity();
final double threshold = 1.e-15;
Assert.assertEquals(0, pTested.subtract(pReference).getNorm().getReal(), pReference.getNorm().multiply(threshold).getReal());
Assert.assertEquals(0, vTested.subtract(vReference).getNorm().getReal(), vReference.getNorm().multiply(threshold).getReal());
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class FieldKeplerianOrbitTest 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 FieldKeplerianOrbit<T> orbit = new FieldKeplerianOrbit<>(pv, frame, mu);
for (PositionAngle type : PositionAngle.values()) {
final FieldKeplerianOrbit<T> rebuilt = new FieldKeplerianOrbit<>(orbit.getA(), orbit.getE(), orbit.getI(), orbit.getPerigeeArgument(), orbit.getRightAscensionOfAscendingNode(), orbit.getAnomaly(type), orbit.getADot(), orbit.getEDot(), orbit.getIDot(), orbit.getPerigeeArgumentDot(), orbit.getRightAscensionOfAscendingNodeDot(), orbit.getAnomalyDot(type), type, orbit.getFrame(), orbit.getDate(), orbit.getMu());
Assert.assertThat(rebuilt.getA().getReal(), relativelyCloseTo(orbit.getA().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.getPerigeeArgument().getReal(), relativelyCloseTo(orbit.getPerigeeArgument().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.getEDot().getReal(), relativelyCloseTo(orbit.getEDot().getReal(), 1));
Assert.assertThat(rebuilt.getIDot().getReal(), relativelyCloseTo(orbit.getIDot().getReal(), 1));
Assert.assertThat(rebuilt.getPerigeeArgumentDot().getReal(), relativelyCloseTo(orbit.getPerigeeArgumentDot().getReal(), 1));
Assert.assertThat(rebuilt.getRightAscensionOfAscendingNodeDot().getReal(), relativelyCloseTo(orbit.getRightAscensionOfAscendingNodeDot().getReal(), 1));
for (PositionAngle type2 : PositionAngle.values()) {
Assert.assertThat(rebuilt.getAnomaly(type2).getReal(), relativelyCloseTo(orbit.getAnomaly(type2).getReal(), 1));
Assert.assertThat(rebuilt.getAnomalyDot(type2).getReal(), relativelyCloseTo(orbit.getAnomalyDot(type2).getReal(), 1));
}
}
}
use of org.orekit.frames.Frame in project Orekit by CS-SI.
the class FieldKeplerianOrbitTest method doTestCopyNonKeplerianAcceleration.
private <T extends RealFieldElement<T>> void doTestCopyNonKeplerianAcceleration(Field<T> field) throws OrekitException {
final Frame eme2000 = FramesFactory.getEME2000();
// Define GEO satellite position
final FieldVector3D<T> position = new FieldVector3D<>(field.getZero().add(42164140), field.getZero(), field.getZero());
// Build PVCoodrinates starting from its position and computing the corresponding circular velocity
final FieldPVCoordinates<T> pv = new FieldPVCoordinates<>(position, new FieldVector3D<>(field.getZero(), position.getNorm().reciprocal().multiply(mu).sqrt(), field.getZero()));
// Build a KeplerianOrbit in eme2000
final FieldOrbit<T> orbit = new FieldKeplerianOrbit<>(pv, eme2000, FieldAbsoluteDate.getJ2000Epoch(field), mu);
// Build another KeplerianOrbit as a copy of the first one
final FieldOrbit<T> orbitCopy = new FieldKeplerianOrbit<>(orbit);
// Shift the orbit of a time-interval
// This works good
final FieldOrbit<T> shiftedOrbit = orbit.shiftedBy(10);
// This does not work
final FieldOrbit<T> shiftedOrbitCopy = orbitCopy.shiftedBy(10);
Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getPosition(), shiftedOrbitCopy.getPVCoordinates().getPosition()).getReal(), 1.0e-10);
Assert.assertEquals(0.0, FieldVector3D.distance(shiftedOrbit.getPVCoordinates().getVelocity(), shiftedOrbitCopy.getPVCoordinates().getVelocity()).getReal(), 1.0e-10);
}
Aggregations