use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class NumericalPropagatorTest method createHyperbolicOrbit.
private CartesianOrbit createHyperbolicOrbit() throws OrekitException {
final AbsoluteDate date = new AbsoluteDate("2003-05-01T00:00:20.000", TimeScalesFactory.getUTC());
final Vector3D position = new Vector3D(224267911.905821, 290251613.109399, 45534292.777492);
final Vector3D velocity = new Vector3D(-1494.068165293, 1124.771027677, 526.915286134);
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.orbits.CartesianOrbit in project Orekit by CS-SI.
the class NumericalPropagatorTest method testEphemerisDatesBackward.
@Test
public void testEphemerisDatesBackward() throws OrekitException {
// setup
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-05", 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(endDate, startDate);
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.orbits.CartesianOrbit in project Orekit by CS-SI.
the class PartialDerivativesEquationsTest method setUp.
/**
* set up {@link #pde} and dependencies.
*
* @throws OrekitException on error
*/
@Before
public void setUp() throws OrekitException {
propagator = new NumericalPropagator(new DormandPrince54Integrator(1, 500, 0.001, 0.001));
forceModel = new MockForceModel();
propagator.addForceModel(forceModel);
pde = new PartialDerivativesEquations("pde", propagator);
Vector3D p = new Vector3D(7378137, 0, 0);
Vector3D v = new Vector3D(0, 7500, 0);
pv = new PVCoordinates(p, v);
state = new SpacecraftState(new CartesianOrbit(pv, eci, date, gm)).addAdditionalState("pde", new double[2 * 3 * 6]);
pde.setInitialJacobians(state);
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class DSSTPropagatorTest method getLEOStatePropagatedBy30Minutes.
private SpacecraftState getLEOStatePropagatedBy30Minutes() throws IllegalArgumentException, OrekitException {
final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
// Spring equinoxe 21st mars 2003 1h00m
final AbsoluteDate initialDate = new AbsoluteDate(new DateComponents(2003, 03, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
final CartesianOrbit osculatingOrbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getTOD(IERSConventions.IERS_1996, false), initialDate, Constants.WGS84_EARTH_MU);
// Adaptive step integrator
// with a minimum step of 0.001 and a maximum step of 1000
double minStep = 0.001;
double maxstep = 1000.0;
double positionTolerance = 10.0;
OrbitType propagationType = OrbitType.EQUINOCTIAL;
double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, osculatingOrbit, propagationType);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]);
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(propagationType);
NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
propagator.addForceModel(holmesFeatherstone);
propagator.setInitialState(new SpacecraftState(osculatingOrbit));
return propagator.propagate(new AbsoluteDate(initialDate, 1800.));
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testNoDerivatives.
@Test
public void testNoDerivatives() throws OrekitException {
for (OrbitType type : OrbitType.values()) {
// create an initial orbit with non-Keplerian acceleration
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, TimeScalesFactory.getUTC());
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final Vector3D keplerAcceleration = new Vector3D(-mu / position.getNormSq(), position.normalize());
final Vector3D nonKeplerAcceleration = new Vector3D(0.001, 0.002, 0.003);
final Vector3D acceleration = keplerAcceleration.add(nonKeplerAcceleration);
final TimeStampedPVCoordinates pva = new TimeStampedPVCoordinates(date, position, velocity, acceleration);
final Orbit initial = type.convertType(new CartesianOrbit(pva, FramesFactory.getEME2000(), mu));
Assert.assertEquals(type, initial.getType());
// the derivatives are available at this stage
checkDerivatives(initial, true);
KeplerianPropagator propagator = new KeplerianPropagator(initial);
Assert.assertEquals(type, propagator.getInitialState().getOrbit().getType());
// non-Keplerian derivatives are explicitly removed when building the Keplerian-only propagator
checkDerivatives(propagator.getInitialState().getOrbit(), false);
PVCoordinates initPV = propagator.getInitialState().getOrbit().getPVCoordinates();
Assert.assertEquals(nonKeplerAcceleration.getNorm(), Vector3D.distance(acceleration, initPV.getAcceleration()), 2.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(keplerAcceleration, initPV.getAcceleration()), 4.0e-15);
double dt = 0.2 * initial.getKeplerianPeriod();
Orbit orbit = propagator.propagateOrbit(initial.getDate().shiftedBy(dt));
Assert.assertEquals(type, orbit.getType());
// at the end, we don't have non-Keplerian derivatives
checkDerivatives(orbit, false);
// using shiftedBy on the initial orbit, non-Keplerian derivatives would have been preserved
checkDerivatives(initial.shiftedBy(dt), true);
}
}
Aggregations