use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class MODProviderTest method testEuler1976.
@Test
public void testEuler1976() throws OrekitException {
TransformProvider eulerBasedProvider = new TransformProvider() {
private static final long serialVersionUID = 1L;
private final PolynomialNutation zetaA = new PolynomialNutation(0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 0.30188 * Constants.ARC_SECONDS_TO_RADIANS, 0.017998 * Constants.ARC_SECONDS_TO_RADIANS);
private final PolynomialNutation thetaA = new PolynomialNutation(0.0, 2004.3109 * Constants.ARC_SECONDS_TO_RADIANS, -0.42665 * Constants.ARC_SECONDS_TO_RADIANS, -0.041833 * Constants.ARC_SECONDS_TO_RADIANS);
private final PolynomialNutation zA = new PolynomialNutation(0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 1.09468 * Constants.ARC_SECONDS_TO_RADIANS, 0.018203 * Constants.ARC_SECONDS_TO_RADIANS);
public Transform getTransform(AbsoluteDate date) {
final double tc = IERSConventions.IERS_1996.evaluateTC(date);
final Rotation r1 = new Rotation(Vector3D.PLUS_K, zA.value(tc), RotationConvention.VECTOR_OPERATOR);
final Rotation r2 = new Rotation(Vector3D.PLUS_J, -thetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
final Rotation r3 = new Rotation(Vector3D.PLUS_K, zetaA.value(tc), RotationConvention.VECTOR_OPERATOR);
return new Transform(date, r1.compose(r2.compose(r3, RotationConvention.VECTOR_OPERATOR), RotationConvention.VECTOR_OPERATOR));
}
public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {
throw new UnsupportedOperationException("never called in this test");
}
};
MODProvider modProvider = new MODProvider(IERSConventions.IERS_1996);
for (double dt = -5 * Constants.JULIAN_YEAR; dt < 5 * Constants.JULIAN_YEAR; dt += 10 * Constants.JULIAN_DAY) {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
Transform t = new Transform(date, modProvider.getTransform(date).getInverse(), eulerBasedProvider.getTransform(date));
Assert.assertEquals(0, t.getRotation().getAngle(), 1.01e-11);
}
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class GTODProviderTest method testAASReferenceLEO.
@Test
public void testAASReferenceLEO() throws OrekitException {
// this reference test has been extracted from the following paper:
// Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
// David A. Vallado, John H. Seago, P. Kenneth Seidelmann
// http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
Utils.setLoaders(IERSConventions.IERS_1996, Utils.buildEOPList(IERSConventions.IERS_1996, ITRFVersion.ITRF_2008, new double[][] { { 53098, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53099, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53100, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53101, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53102, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53103, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53104, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN }, { 53105, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN } }));
AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 04, 06), new TimeComponents(07, 51, 28.386009), TimeScalesFactory.getUTC());
// PEF iau76
PVCoordinates pvPEF = new PVCoordinates(new Vector3D(-1033475.0313, 7901305.5856, 6380344.5328), new Vector3D(-3225.632747, -2872.442511, 5531.931288));
// it seems the induced effect of pole nutation correction δΔψ on the equation of the equinoxes
// was not taken into account in the reference paper, so we fix it here for the test
final double dDeltaPsi = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true).getEquinoxNutationCorrection(t0)[0];
final double epsilonA = IERSConventions.IERS_1996.getMeanObliquityFunction().value(t0);
final Transform fix = new Transform(t0, new Rotation(Vector3D.PLUS_K, dDeltaPsi * FastMath.cos(epsilonA), RotationConvention.FRAME_TRANSFORM));
// TOD iau76
PVCoordinates pvTOD = new PVCoordinates(new Vector3D(5094514.7804, 6127366.4612, 6380344.5328), new Vector3D(-4746.088567, 786.077222, 5531.931288));
Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true).getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.00942, 3.12e-5);
// if we forget to apply nutation corrections, results are much worse, which is expected
t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 257.49, 0.13955);
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class GroundStation method getOffsetToInertial.
/**
* Get the transform between offset frame and inertial frame.
* <p>
* The offset frame takes the <em>current</em> position offset,
* polar motion and the meridian shift into account. The frame
* returned is disconnected from later changes in the parameters.
* When the {@link ParameterDriver parameters} managing these
* offsets are changed, the method must be called again to retrieve
* a new offset frame.
* </p>
* @param inertial inertial frame to transform to
* @param date date of the transform
* @return offset frame defining vectors
* @exception OrekitException if offset frame cannot be computed for current offset values
*/
public Transform getOffsetToInertial(final Frame inertial, final AbsoluteDate date) throws OrekitException {
// take Earth offsets into account
final Transform intermediateToBody = estimatedEarthFrameProvider.getTransform(date).getInverse();
// take station offset into account
final double x = parametricModel(eastOffsetDriver);
final double y = parametricModel(northOffsetDriver);
final double z = parametricModel(zenithOffsetDriver);
final BodyShape baseShape = baseFrame.getParentShape();
final Transform baseToBody = baseFrame.getTransformTo(baseShape.getBodyFrame(), date);
Vector3D origin = baseToBody.transformPosition(new Vector3D(x, y, z));
origin = origin.add(computeDisplacement(date, origin));
final GeodeticPoint originGP = baseShape.transform(origin, baseShape.getBodyFrame(), date);
final Transform offsetToIntermediate = new Transform(date, new Transform(date, new Rotation(Vector3D.PLUS_I, Vector3D.PLUS_K, originGP.getEast(), originGP.getZenith()), Vector3D.ZERO), new Transform(date, origin));
// combine all transforms together
final Transform bodyToInert = baseFrame.getParent().getTransformTo(inertial, date);
return new Transform(date, offsetToIntermediate, new Transform(date, intermediateToBody, bodyToInert));
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testInitializationCorrectness.
@Test
public void testInitializationCorrectness() throws OrekitException, IOException {
// Definition of initial conditions
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
// find the default Eckstein-Hechler propagator initialized from the initial orbit
EcksteinHechlerPropagator defaultEH = new EcksteinHechlerPropagator(initial, provider);
// the osculating parameters recomputed by the default Eckstein-Hechler propagator are quite different
// from initial orbit
CircularOrbit defaultOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(defaultEH.propagateOrbit(initial.getDate()));
Assert.assertEquals(267.4, defaultOrbit.getA() - initial.getA(), 0.1);
// the position on the other hand match perfectly
Assert.assertEquals(0.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), initial.getPVCoordinates().getPosition()), 1.0e-8);
// set up a reference numerical propagator starting for the specified start orbit
// using the same force models (i.e. the first few zonal terms)
double[][] tol = NumericalPropagator.tolerances(0.1, initial, OrbitType.CIRCULAR);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
integrator.setInitialStepSize(60);
NumericalPropagator num = new NumericalPropagator(integrator);
num.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(provider)));
num.setInitialState(new SpacecraftState(initial));
num.setOrbitType(OrbitType.CIRCULAR);
// find the best Eckstein-Hechler propagator that match the orbit evolution
PropagatorConverter converter = new FiniteDifferencePropagatorConverter(new EcksteinHechlerPropagatorBuilder(initial, provider, PositionAngle.TRUE, 1.0), 1.0e-6, 100);
EcksteinHechlerPropagator fittedEH = (EcksteinHechlerPropagator) converter.convert(num, 3 * initial.getKeplerianPeriod(), 300);
// the default Eckstein-Hechler propagator did however quite a good job, as it found
// an orbit close to the best fitting
CircularOrbit fittedOrbit = (CircularOrbit) OrbitType.CIRCULAR.convertType(fittedEH.propagateOrbit(initial.getDate()));
Assert.assertEquals(0.623, defaultOrbit.getA() - fittedOrbit.getA(), 0.1);
// the position on the other hand are slightly different
// because the fitted orbit minimizes the residuals over a complete time span,
// not on a single point
Assert.assertEquals(58.0, Vector3D.distance(defaultOrbit.getPVCoordinates().getPosition(), fittedOrbit.getPVCoordinates().getPosition()), 0.1);
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue223.
@Test
public void testIssue223() throws OrekitException, IOException, ClassNotFoundException {
// Definition of initial conditions
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
propagator.propagate(initial.getDate().shiftedBy(40000));
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
Assert.assertSame(poleAligned, ephemeris.getFrame());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue(bos.size() > 2450);
Assert.assertTrue(bos.size() < 2550);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator deserialized = (BoundedPropagator) ois.readObject();
Assert.assertEquals(initial.getA(), deserialized.getInitialState().getA(), 1.0e-10);
Assert.assertEquals(initial.getEquinoctialEx(), deserialized.getInitialState().getEquinoctialEx(), 1.0e-10);
SpacecraftState s = deserialized.propagate(initial.getDate().shiftedBy(20000));
Map<String, double[]> additional = s.getAdditionalStates();
Assert.assertEquals(1, additional.size());
Assert.assertEquals(1, additional.get("seven").length);
Assert.assertEquals(7, additional.get("seven")[0], 1.0e-15);
}
Aggregations