use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.
the class FieldCircularOrbitTest method doTestNonInertialFrame.
private <T extends RealFieldElement<T>> void doTestNonInertialFrame(Field<T> field) throws IllegalArgumentException {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
FieldVector3D<T> position = new FieldVector3D<>(zero.add(33051.2), zero.add(26184.9), zero.add(-1.3E-5));
FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-60376.2), zero.add(76208.), zero.add(2.7E-4));
FieldPVCoordinates<T> pvCoordinates = new FieldPVCoordinates<>(position, velocity);
new FieldCircularOrbit<>(pvCoordinates, new Frame(FramesFactory.getEME2000(), Transform.IDENTITY, "non-inertial", false), date, mu);
}
use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.
the class TransformTest method testTransPV.
@Test
public void testTransPV() {
RandomGenerator rnd = new Well19937a(0x73d5554d99427af0l);
for (int i = 0; i < 10; ++i) {
// random position, velocity and acceleration
Vector3D pos = randomVector(1.0e3, rnd);
Vector3D vel = randomVector(1.0, rnd);
Vector3D acc = randomVector(1.0e-3, rnd);
PVCoordinates pvOne = new PVCoordinates(pos, vel, acc);
// random transform
Vector3D transPos = randomVector(1.0e3, rnd);
Vector3D transVel = randomVector(1.0, rnd);
Vector3D transAcc = randomVector(1.0e-3, rnd);
Transform tr = new Transform(AbsoluteDate.J2000_EPOCH, transPos, transVel, transAcc);
double dt = 1;
// we should obtain
Vector3D good = tr.transformPosition(pos.add(new Vector3D(dt, vel))).add(new Vector3D(dt, transVel));
// we have
PVCoordinates pvTwo = tr.transformPVCoordinates(pvOne);
Vector3D result = pvTwo.getPosition().add(new Vector3D(dt, pvTwo.getVelocity()));
checkVector(good, result, 1.0e-15);
FieldPVCoordinates<Decimal64> fieldPVOne = new FieldPVCoordinates<Decimal64>(new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getPosition()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getVelocity()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getAcceleration()));
FieldPVCoordinates<Decimal64> fieldPVTwo = tr.transformPVCoordinates(fieldPVOne);
FieldVector3D<Decimal64> fieldResult = fieldPVTwo.getPosition().add(new FieldVector3D<Decimal64>(dt, fieldPVTwo.getVelocity()));
checkVector(good, fieldResult.toVector3D(), 1.0e-15);
TimeStampedFieldPVCoordinates<Decimal64> fieldTPVOne = new TimeStampedFieldPVCoordinates<Decimal64>(tr.getDate(), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getPosition()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getVelocity()), new FieldVector3D<Decimal64>(Decimal64Field.getInstance(), pvOne.getAcceleration()));
TimeStampedFieldPVCoordinates<Decimal64> fieldTPVTwo = tr.transformPVCoordinates(fieldTPVOne);
FieldVector3D<Decimal64> fieldTResult = fieldTPVTwo.getPosition().add(new FieldVector3D<Decimal64>(dt, fieldTPVTwo.getVelocity()));
checkVector(good, fieldTResult.toVector3D(), 1.0e-15);
// test inverse
Vector3D resultvel = tr.getInverse().transformPVCoordinates(pvTwo).getVelocity();
checkVector(resultvel, vel, 1.0e-15);
}
}
use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.
the class AbstractMeasurement method getCoordinates.
/**
* Get Cartesian coordinates as derivatives.
* <p>
* The position will correspond to variables {@code firstDerivative},
* {@code firstDerivative + 1} and {@code firstDerivative + 2}.
* The velocity will correspond to variables {@code firstDerivative + 3},
* {@code firstDerivative + 4} and {@code firstDerivative + 5}.
* The acceleration will correspond to constants.
* </p>
* @param state state of the satellite considered
* @param firstDerivative index of the first derivative
* @param factory factory for building the derivatives
* @return Cartesian coordinates as derivatives
*/
public static TimeStampedFieldPVCoordinates<DerivativeStructure> getCoordinates(final SpacecraftState state, final int firstDerivative, final DSFactory factory) {
// Position of the satellite expressed as a derivative structure
// The components of the position are the 3 first derivative parameters
final Vector3D p = state.getPVCoordinates().getPosition();
final FieldVector3D<DerivativeStructure> pDS = new FieldVector3D<>(factory.variable(firstDerivative + 0, p.getX()), factory.variable(firstDerivative + 1, p.getY()), factory.variable(firstDerivative + 2, p.getZ()));
// Velocity of the satellite expressed as a derivative structure
// The components of the velocity are the 3 second derivative parameters
final Vector3D v = state.getPVCoordinates().getVelocity();
final FieldVector3D<DerivativeStructure> vDS = new FieldVector3D<>(factory.variable(firstDerivative + 3, v.getX()), factory.variable(firstDerivative + 4, v.getY()), factory.variable(firstDerivative + 5, v.getZ()));
// Acceleration of the satellite
// The components of the acceleration are not derivative parameters
final Vector3D a = state.getPVCoordinates().getAcceleration();
final FieldVector3D<DerivativeStructure> aDS = new FieldVector3D<>(factory.constant(a.getX()), factory.constant(a.getY()), factory.constant(a.getZ()));
return new TimeStampedFieldPVCoordinates<>(state.getDate(), pDS, vDS, aDS);
}
use of org.hipparchus.geometry.euclidean.threed.FieldVector3D in project Orekit by CS-SI.
the class FieldEquinoctialOrbitTest method doTestNonInertialFrame.
private <T extends RealFieldElement<T>> void doTestNonInertialFrame(Field<T> field) throws IllegalArgumentException {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
FieldVector3D<T> position = new FieldVector3D<>(zero.add(4512.9), zero.add(18260.), zero.add(-5127.));
FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(134664.6), zero.add(90066.8), zero.add(72047.6));
FieldPVCoordinates<T> FieldPVCoordinates = new FieldPVCoordinates<>(position, velocity);
new FieldEquinoctialOrbit<>(FieldPVCoordinates, new Frame(FramesFactory.getEME2000(), Transform.IDENTITY, "non-inertial", false), date, mu);
}
use of org.hipparchus.geometry.euclidean.threed.FieldVector3D 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);
}
Aggregations