use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method testGroundProjectionPosition.
@Test
public void testGroundProjectionPosition() throws OrekitException {
OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.), new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
Frame eme2000 = FramesFactory.getEME2000();
Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);
for (double dt = 0; dt < 3600.0; dt += 60.0) {
TimeStampedPVCoordinates pv = orbit.getPVCoordinates(orbit.getDate().shiftedBy(dt), eme2000);
TimeStampedPVCoordinates groundPV = model.projectToGround(pv, eme2000);
Vector3D groundP = model.projectToGround(pv.getPosition(), pv.getDate(), eme2000);
// check methods projectToGround and transform are consistent with each other
Assert.assertEquals(model.transform(pv.getPosition(), eme2000, pv.getDate()).getLatitude(), model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLatitude(), 1.0e-10);
Assert.assertEquals(model.transform(pv.getPosition(), eme2000, pv.getDate()).getLongitude(), model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLongitude(), 1.0e-10);
Assert.assertEquals(0.0, Vector3D.distance(groundP, groundPV.getPosition()), 1.0e-15 * groundP.getNorm());
}
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class OneAxisEllipsoidTest method testGroundToGroundIssue181.
@Test
public void testGroundToGroundIssue181() throws OrekitException {
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.), new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
TimeStampedPVCoordinates body = itrf.getTransformTo(eme2000, initPV.getDate()).transformPVCoordinates(initPV);
TimeStampedPVCoordinates ground1 = model.projectToGround(body, itrf);
TimeStampedPVCoordinates ground2 = model.projectToGround(ground1, itrf);
Assert.assertEquals(0.0, Vector3D.distance(ground1.getPosition(), ground2.getPosition()), 1.0e-12);
Assert.assertEquals(0.0, Vector3D.distance(ground1.getVelocity(), ground2.getVelocity()), 2.0e-12);
Assert.assertEquals(0.0, Vector3D.distance(ground1.getAcceleration(), ground2.getAcceleration()), 1.0e-12);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class YawCompensationTest method checkField.
private <T extends RealFieldElement<T>> void checkField(final Field<T> field, final GroundPointing provider, final Orbit orbit, final AbsoluteDate date, final Frame frame) throws OrekitException {
final Attitude attitudeD = provider.getAttitude(orbit, date, frame);
final FieldOrbit<T> orbitF = new FieldSpacecraftState<>(field, new SpacecraftState(orbit)).getOrbit();
final FieldAbsoluteDate<T> dateF = new FieldAbsoluteDate<>(field, date);
final FieldAttitude<T> attitudeF = provider.getAttitude(orbitF, dateF, frame);
Assert.assertEquals(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), 2.0e-13);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), 2.0e-11);
Assert.assertEquals(0.0, Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), 2.0e-13);
final TimeStampedPVCoordinates pvD = provider.getTargetPV(orbit, date, frame);
final TimeStampedFieldPVCoordinates<T> pvF = provider.getTargetPV(orbitF, dateF, frame);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getPosition(), pvF.getPosition().toVector3D()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getVelocity(), pvF.getVelocity().toVector3D()), 9.0e-9);
Assert.assertEquals(0.0, Vector3D.distance(pvD.getAcceleration(), pvF.getAcceleration().toVector3D()), 8.0e-7);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class CelestialBodyFactoryTest method testHorizon.
@Test
public void testHorizon() throws OrekitException {
// The following data are an excerpt from a telnet session with JPL Horizon system
// note that in Horizon we selected Jupiter barycenter rather than Jupiter body center
// this seems to match better the content of the DE-431 ephemeris
// *******************************************************************************
// Ephemeris / PORT_LOGIN Mon Oct 26 04:53:43 2015 Pasadena, USA / Horizons
// *******************************************************************************
// Target body name: Jupiter Barycenter (5) {source: DE-0431LE-0431}
// Center body name: Solar System Barycenter (0) {source: DE-0431LE-0431}
// Center-site name: BODY CENTER
// *******************************************************************************
// Start time : A.D. 2000-Jan-01 00:00:00.0000 CT
// Stop time : A.D. 2003-Dec-31 23:59:00.0000 CT
// Step-size : 1440 minutes
// *******************************************************************************
// Center geodetic : 0.00000000,0.00000000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)}
// Center cylindric: 0.00000000,0.00000000,0.0000000 {E-lon(deg),Dxy(km),Dz(km)}
// Center radii : (undefined)
// Output units : KM-S
// Output format : 02
// Reference frame : ICRF/J2000.0
// Output type : GEOMETRIC cartesian states
// Coordinate systm: Earth Mean Equator and Equinox of Reference Epoch
// *******************************************************************************
// JDCT
// X Y Z
// VX VY VZ
// *******************************************************************************
// $$SOE
// 2451544.500000000 = A.D. 2000-Jan-01 00:00:00.0000 (TDB)
// X = 5.978411018921824E+08 Y = 4.085508359611598E+08 Z = 1.605595308103096E+08
// VX=-7.892151874487445E+00 VY= 1.017751699703826E+01 VZ= 4.554715748011852E+00
// 2451545.500000000 = A.D. 2000-Jan-02 00:00:00.0000 (TDB)
// X = 5.971584965869523E+08 Y = 4.094296790808872E+08 Z = 1.609528639632485E+08
// VX=-7.908893450088906E+00 VY= 1.016606978596496E+01 VZ= 4.550216570971850E+00
// 2451546.500000000 = A.D. 2000-Jan-03 00:00:00.0000 (TDB)
// X = 5.964744456934582E+08 Y = 4.103075321378759E+08 Z = 1.613458079269412E+08
// VX=-7.925614558638352E+00 VY= 1.015459888397081E+01 VZ= 4.545706740033853E+00
// 2451547.500000000 = A.D. 2000-Jan-04 00:00:00.0000 (TDB)
// X = 5.957889509819047E+08 Y = 4.111843930867567E+08 Z = 1.617383617815004E+08
// VX=-7.942315157290042E+00 VY= 1.014310432640078E+01 VZ= 4.541186269306714E+00
// 2451548.500000000 = A.D. 2000-Jan-05 00:00:00.0000 (TDB)
// X = 5.951020142261952E+08 Y = 4.120602598852173E+08 Z = 1.621305246082588E+08
// VX=-7.958995203281466E+00 VY= 1.013158614867071E+01 VZ= 4.536655172931710E+00
// 2451549.500000000 = A.D. 2000-Jan-06 00:00:00.0000 (TDB)
// X = 5.944136372039236E+08 Y = 4.129351304940084E+08 Z = 1.625222954897725E+08
// VX=-7.975654653933506E+00 VY= 1.012004438626713E+01 VZ= 4.532113465082445E+00
final TimeStampedPVCoordinates[] refPV = new TimeStampedPVCoordinates[] { createPV(2000, 1, 1, 5.978411018921824E+08, 4.085508359611598E+08, 1.605595308103096E+08, -7.892151874487445E+00, 1.017751699703826E+01, 4.554715748011852E+00), createPV(2000, 1, 2, 5.971584965869523E+08, 4.094296790808872E+08, 1.609528639632485E+08, -7.908893450088906E+00, 1.016606978596496E+01, 4.550216570971850E+00), createPV(2000, 1, 3, 5.964744456934582E+08, 4.103075321378759E+08, 1.613458079269412E+08, -7.925614558638352E+00, 1.015459888397081E+01, 4.545706740033853E+00), createPV(2000, 1, 4, 5.957889509819047E+08, 4.111843930867567E+08, 1.617383617815004E+08, -7.942315157290042E+00, 1.014310432640078E+01, 4.541186269306714E+00), createPV(2000, 1, 5, 5.951020142261952E+08, 4.120602598852173E+08, 1.621305246082588E+08, -7.958995203281466E+00, 1.013158614867071E+01, 4.536655172931710E+00), createPV(2000, 1, 6, 5.944136372039236E+08, 4.129351304940084E+08, 1.625222954897725E+08, -7.975654653933506E+00, 1.012004438626713E+01, 4.532113465082445E+00) };
Utils.setDataRoot("regular-data");
final CelestialBody jupiter = CelestialBodyFactory.getJupiter();
for (final TimeStampedPVCoordinates ref : refPV) {
TimeStampedPVCoordinates testPV = jupiter.getPVCoordinates(ref.getDate(), FramesFactory.getICRF());
Assert.assertEquals(0.0, Vector3D.distance(ref.getPosition(), testPV.getPosition()), 4.0e-4);
Assert.assertEquals(0.0, Vector3D.distance(ref.getVelocity(), testPV.getVelocity()), 1.0e-11);
}
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class BatchLSEstimatorTest method testMultiSat.
@Test
public void testMultiSat() throws OrekitException {
Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
final NumericalPropagatorBuilder propagatorBuilder1 = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0);
final NumericalPropagatorBuilder propagatorBuilder2 = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0);
// Create perfect inter-satellites range measurements
final TimeStampedPVCoordinates original = context.initialOrbit.getPVCoordinates();
final Orbit closeOrbit = new CartesianOrbit(new TimeStampedPVCoordinates(context.initialOrbit.getDate(), original.getPosition().add(new Vector3D(1000, 2000, 3000)), original.getVelocity().add(new Vector3D(-0.03, 0.01, 0.02))), context.initialOrbit.getFrame(), context.initialOrbit.getMu());
final Propagator closePropagator = EstimationTestUtils.createPropagator(closeOrbit, propagatorBuilder2);
closePropagator.setEphemerisMode();
closePropagator.propagate(context.initialOrbit.getDate().shiftedBy(3.5 * closeOrbit.getKeplerianPeriod()));
final BoundedPropagator ephemeris = closePropagator.getGeneratedEphemeris();
Propagator propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
final List<ObservedMeasurement<?>> r12 = EstimationTestUtils.createMeasurements(propagator1, new InterSatellitesRangeMeasurementCreator(ephemeris), 1.0, 3.0, 300.0);
// create perfect range measurements for first satellite
propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
final List<ObservedMeasurement<?>> r1 = EstimationTestUtils.createMeasurements(propagator1, new RangeMeasurementCreator(context), 1.0, 3.0, 300.0);
// create orbit estimator
final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder1, propagatorBuilder2);
for (final ObservedMeasurement<?> interSat : r12) {
estimator.addMeasurement(interSat);
}
for (final ObservedMeasurement<?> range : r1) {
estimator.addMeasurement(range);
}
estimator.setParametersConvergenceThreshold(1.0e-2);
estimator.setMaxIterations(10);
estimator.setMaxEvaluations(20);
estimator.setObserver(new BatchLSObserver() {
int lastIter = 0;
int lastEval = 0;
/**
* {@inheritDoc}
*/
@Override
public void evaluationPerformed(int iterationsCount, int evaluationscount, Orbit[] orbits, ParameterDriversList estimatedOrbitalParameters, ParameterDriversList estimatedPropagatorParameters, ParameterDriversList estimatedMeasurementsParameters, EstimationsProvider evaluationsProvider, Evaluation lspEvaluation) throws OrekitException {
if (iterationsCount == lastIter) {
Assert.assertEquals(lastEval + 1, evaluationscount);
} else {
Assert.assertEquals(lastIter + 1, iterationsCount);
}
lastIter = iterationsCount;
lastEval = evaluationscount;
Assert.assertEquals(r12.size() + r1.size(), evaluationsProvider.getNumber());
try {
evaluationsProvider.getEstimatedMeasurement(-1);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
}
try {
evaluationsProvider.getEstimatedMeasurement(r12.size() + r1.size());
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
}
AbsoluteDate previous = AbsoluteDate.PAST_INFINITY;
for (int i = 0; i < evaluationsProvider.getNumber(); ++i) {
AbsoluteDate current = evaluationsProvider.getEstimatedMeasurement(i).getDate();
Assert.assertTrue(current.compareTo(previous) >= 0);
previous = current;
}
}
});
List<DelegatingDriver> parameters = estimator.getOrbitalParametersDrivers(true).getDrivers();
ParameterDriver a0Driver = parameters.get(0);
Assert.assertEquals("a[0]", a0Driver.getName());
a0Driver.setValue(a0Driver.getValue() + 1.2);
a0Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
ParameterDriver a1Driver = parameters.get(6);
Assert.assertEquals("a[1]", a1Driver.getName());
a1Driver.setValue(a1Driver.getValue() - 5.4);
a1Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
final Orbit before = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
Assert.assertEquals(4.7246, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), before.getPVCoordinates().getPosition()), 1.0e-3);
Assert.assertEquals(0.0010514, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), before.getPVCoordinates().getVelocity()), 1.0e-6);
EstimationTestUtils.checkFit(context, estimator, 2, 3, 0.0, 2.3e-06, 0.0, 6.6e-06, 0.0, 6.2e-07, 0.0, 2.8e-10);
final Orbit determined = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), determined.getPVCoordinates().getPosition()), 1.6e-6);
Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), determined.getPVCoordinates().getVelocity()), 1.6e-9);
// got a default one
for (final ParameterDriver driver : estimator.getOrbitalParametersDrivers(true).getDrivers()) {
if (driver.getName().startsWith("a[")) {
// user-specified reference date
Assert.assertEquals(0, driver.getReferenceDate().durationFrom(AbsoluteDate.GALILEO_EPOCH), 1.0e-15);
} else {
// default reference date
Assert.assertEquals(0, driver.getReferenceDate().durationFrom(propagatorBuilder1.getInitialOrbitDate()), 1.0e-15);
}
}
}
Aggregations