use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class NumericalPropagatorTest method testEphemerisDates.
@Test
public void testEphemerisDates() throws OrekitException {
// setup
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
AbsoluteDate startDate = new AbsoluteDate("2015-07-03", tai).shiftedBy(-0.1);
AbsoluteDate endDate = new AbsoluteDate("2015-07-04", tai);
Frame eci = FramesFactory.getGCRF();
KeplerianOrbit orbit = new KeplerianOrbit(600e3 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, initialDate, mu);
OrbitType type = OrbitType.CARTESIAN;
double[][] tol = NumericalPropagator.tolerances(1e-3, orbit, type);
NumericalPropagator prop = new NumericalPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1]));
prop.setOrbitType(type);
prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit)));
// action
prop.setEphemerisMode();
prop.propagate(startDate, endDate);
BoundedPropagator ephemeris = prop.getGeneratedEphemeris();
// verify
TimeStampedPVCoordinates actualPV = ephemeris.getPVCoordinates(startDate, eci);
TimeStampedPVCoordinates expectedPV = orbit.getPVCoordinates(startDate, eci);
MatcherAssert.assertThat(actualPV.getPosition(), OrekitMatchers.vectorCloseTo(expectedPV.getPosition(), 1.0));
MatcherAssert.assertThat(actualPV.getVelocity(), OrekitMatchers.vectorCloseTo(expectedPV.getVelocity(), 1.0));
MatcherAssert.assertThat(ephemeris.getMinDate().durationFrom(startDate), OrekitMatchers.closeTo(0, 0));
MatcherAssert.assertThat(ephemeris.getMaxDate().durationFrom(endDate), OrekitMatchers.closeTo(0, 0));
// test date
AbsoluteDate date = endDate.shiftedBy(-0.11);
Assert.assertEquals(ephemeris.propagate(date).getDate().durationFrom(date), 0, 0);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class NumericalPropagatorTest method createEllipticOrbit.
private CartesianOrbit createEllipticOrbit() throws OrekitException {
final AbsoluteDate date = new AbsoluteDate("2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final Vector3D position = new Vector3D(6896874.444705, 1956581.072644, -147476.245054);
final Vector3D velocity = new Vector3D(166.816407662, -1106.783301861, -7372.745712770);
final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, position, velocity);
final Frame frame = FramesFactory.getEME2000();
final double mu = Constants.EIGEN5C_EARTH_MU;
return new CartesianOrbit(pv, frame, mu);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class DSSTPropagatorTest method testEphemerisDates.
@Test
public void testEphemerisDates() throws OrekitException {
// setup
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
AbsoluteDate startDate = new AbsoluteDate("2015-07-03", tai).shiftedBy(-0.1);
AbsoluteDate endDate = new AbsoluteDate("2015-07-04", tai);
Frame eci = FramesFactory.getGCRF();
KeplerianOrbit orbit = new KeplerianOrbit(600e3 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS, 0, 0, 0, 0, 0, PositionAngle.TRUE, eci, initialDate, Constants.EIGEN5C_EARTH_MU);
double[][] tol = DSSTPropagator.tolerances(1, orbit);
Propagator prop = new DSSTPropagator(new DormandPrince853Integrator(0.1, 500, tol[0], tol[1]));
prop.resetInitialState(new SpacecraftState(new CartesianOrbit(orbit)));
// action
prop.setEphemerisMode();
prop.propagate(startDate, endDate);
BoundedPropagator ephemeris = prop.getGeneratedEphemeris();
// verify
TimeStampedPVCoordinates actualPV = ephemeris.getPVCoordinates(startDate, eci);
TimeStampedPVCoordinates expectedPV = orbit.getPVCoordinates(startDate, eci);
MatcherAssert.assertThat(actualPV.getPosition(), OrekitMatchers.vectorCloseTo(expectedPV.getPosition(), 1.0));
MatcherAssert.assertThat(actualPV.getVelocity(), OrekitMatchers.vectorCloseTo(expectedPV.getVelocity(), 1.0));
MatcherAssert.assertThat(ephemeris.getMinDate().durationFrom(startDate), OrekitMatchers.closeTo(0, 0));
MatcherAssert.assertThat(ephemeris.getMaxDate().durationFrom(endDate), OrekitMatchers.closeTo(0, 0));
// test date
AbsoluteDate date = endDate.shiftedBy(-0.11);
Assert.assertEquals(ephemeris.propagate(date).getDate().durationFrom(date), 0, 0);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class DSSTPropagatorTest method testIssueMeanInclination.
@Test
public void testIssueMeanInclination() throws OrekitException {
final double earthAe = 6378137.0;
final double earthMu = 3.9860044E14;
final double earthJ2 = 0.0010826;
// Initialize the DSST propagator with only J2 perturbation
Orbit orb = new KeplerianOrbit(new TimeStampedPVCoordinates(new AbsoluteDate("1992-10-08T15:20:38.821", TimeScalesFactory.getUTC()), new Vector3D(5392808.809823, -4187618.3357927715, -44206.638015847195), new Vector3D(2337.4472786270794, 2474.0146611860464, 6778.507766114648)), FramesFactory.getTOD(false), earthMu);
final SpacecraftState ss = new SpacecraftState(orb);
final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(earthAe, earthMu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { -earthJ2 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 } });
final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
DSSTForceModel zonal = new DSSTZonal(provider, 2, 1, 5);
DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 2, 0, 0, 2, 2, 0, 0);
final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
forces.add(zonal);
forces.add(tesseral);
// Computes J2 mean elements using the DSST osculating to mean converter
final Orbit meanOrb = DSSTPropagator.computeMeanState(ss, null, forces).getOrbit();
Assert.assertEquals(0.0164196, FastMath.toDegrees(orb.getI() - meanOrb.getI()), 1.0e-7);
}
use of org.orekit.utils.TimeStampedPVCoordinates in project Orekit by CS-SI.
the class HalfTrackSampler method handleStep.
/**
* {@inheritDoc}
*/
@Override
public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
// find the sliding ground point below spacecraft
final TimeStampedPVCoordinates pv = currentState.getPVCoordinates(ellipsoid.getBodyFrame());
final TimeStampedPVCoordinates groundPV = ellipsoid.projectToGround(pv, ellipsoid.getBodyFrame());
// geodetic coordinates
final GeodeticPoint gp = ellipsoid.transform(groundPV.getPosition(), ellipsoid.getBodyFrame(), currentState.getDate());
halfTrack.add(new Pair<GeodeticPoint, TimeStampedPVCoordinates>(gp, groundPV));
}
Aggregations