use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class TabulatedEphemerisTest method checkInterpolation.
private void checkInterpolation(StateFilter f, double expectedDP, double expectedDV) throws OrekitException {
double mass = 2500;
double a = 7187990.1979844316;
double e = 0.5e-4;
double i = 1.7105407051081795;
double omega = 1.9674147913622104;
double OMEGA = FastMath.toRadians(261);
double lv = 0;
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), TimeComponents.H00, TimeScalesFactory.getUTC());
final AbsoluteDate finalDate = new AbsoluteDate(new DateComponents(2004, 01, 02), TimeComponents.H00, TimeScalesFactory.getUTC());
double deltaT = finalDate.durationFrom(initDate);
Orbit transPar = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
int nbIntervals = 720;
EcksteinHechlerPropagator eck = new EcksteinHechlerPropagator(transPar, mass, ae, mu, c20, c30, c40, c50, c60);
AdditionalStateProvider provider = new AdditionalStateProvider() {
public String getName() {
return "dt";
}
public double[] getAdditionalState(SpacecraftState state) {
return new double[] { state.getDate().durationFrom(initDate) };
}
};
eck.addAdditionalStateProvider(provider);
try {
eck.addAdditionalStateProvider(provider);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.ADDITIONAL_STATE_NAME_ALREADY_IN_USE, oe.getSpecifier());
}
List<SpacecraftState> tab = new ArrayList<SpacecraftState>(nbIntervals + 1);
for (int j = 0; j <= nbIntervals; j++) {
AbsoluteDate current = initDate.shiftedBy((j * deltaT) / nbIntervals);
tab.add(f.filter(eck.propagate(current)));
}
try {
new Ephemeris(tab, nbIntervals + 2);
Assert.fail("an exception should have been thrown");
} catch (MathIllegalArgumentException miae) {
// expected
}
Ephemeris te = new Ephemeris(tab, 2);
Assert.assertEquals(0.0, te.getMaxDate().durationFrom(finalDate), 1.0e-9);
Assert.assertEquals(0.0, te.getMinDate().durationFrom(initDate), 1.0e-9);
double maxP = 0;
double maxV = 0;
for (double dt = 0; dt < 3600; dt += 1) {
AbsoluteDate date = initDate.shiftedBy(dt);
CartesianOrbit c1 = (CartesianOrbit) eck.propagate(date).getOrbit();
CartesianOrbit c2 = (CartesianOrbit) te.propagate(date).getOrbit();
maxP = FastMath.max(maxP, Vector3D.distance(c1.getPVCoordinates().getPosition(), c2.getPVCoordinates().getPosition()));
maxV = FastMath.max(maxV, Vector3D.distance(c1.getPVCoordinates().getVelocity(), c2.getPVCoordinates().getVelocity()));
}
Assert.assertEquals(expectedDP, maxP, 0.1 * expectedDP);
Assert.assertEquals(expectedDV, maxV, 0.1 * expectedDV);
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class EclipseDetectorTest method testInsideOcculting.
@Test
public void testInsideOcculting() throws OrekitException {
EclipseDetector e = new EclipseDetector(sun, sunRadius, earth, earthRadius);
SpacecraftState s = new SpacecraftState(new CartesianOrbit(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, new Vector3D(1e6, 2e6, 3e6), new Vector3D(1000, 0, 0)), FramesFactory.getGCRF(), mu));
Assert.assertEquals(-FastMath.PI, e.g(s), 1.0e-15);
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class EclipseDetectorTest method testInsideOcculted.
@Test
public void testInsideOcculted() throws OrekitException {
EclipseDetector e = new EclipseDetector(sun, sunRadius, earth, earthRadius);
Vector3D p = sun.getPVCoordinates(AbsoluteDate.J2000_EPOCH, FramesFactory.getGCRF()).getPosition();
SpacecraftState s = new SpacecraftState(new CartesianOrbit(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, p.add(Vector3D.PLUS_I), Vector3D.PLUS_K), FramesFactory.getGCRF(), mu));
Assert.assertEquals(FastMath.PI, e.g(s), 1.0e-15);
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class GPSPropagator method propagateOrbit.
/**
* {@inheritDoc}
*/
protected Orbit propagateOrbit(final AbsoluteDate date) throws OrekitException {
// Gets the PVCoordinates in ECEF frame
final PVCoordinates pvaInECEF = propagateInEcef(date);
// Transforms the PVCoordinates to ECI frame
final PVCoordinates pvaInECI = ecef.getTransformTo(eci, date).transformPVCoordinates(pvaInECEF);
// Returns the Cartesian orbit
return new CartesianOrbit(pvaInECI, eci, date, GPSOrbitalElements.GPS_MU);
}
use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.
the class Context method createBuilder.
public NumericalPropagatorBuilder createBuilder(final OrbitType orbitType, final PositionAngle positionAngle, final boolean perfectStart, final double minStep, final double maxStep, final double dP, final Force... forces) throws OrekitException {
final Orbit startOrbit;
if (perfectStart) {
// orbit estimation will start from a perfect orbit
startOrbit = initialOrbit;
} else {
// orbit estimation will start from a wrong point
final Vector3D initialPosition = initialOrbit.getPVCoordinates().getPosition();
final Vector3D initialVelocity = initialOrbit.getPVCoordinates().getVelocity();
final Vector3D wrongPosition = initialPosition.add(new Vector3D(1000.0, 0, 0));
final Vector3D wrongVelocity = initialVelocity.add(new Vector3D(0, 0, 0.01));
startOrbit = new CartesianOrbit(new PVCoordinates(wrongPosition, wrongVelocity), initialOrbit.getFrame(), initialOrbit.getDate(), initialOrbit.getMu());
}
final NumericalPropagatorBuilder propagatorBuilder = new NumericalPropagatorBuilder(orbitType.convertType(startOrbit), new DormandPrince853IntegratorBuilder(minStep, maxStep, dP), positionAngle, dP);
for (Force force : forces) {
propagatorBuilder.addForceModel(force.getForceModel(this));
}
return propagatorBuilder;
}
Aggregations