use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method stopAtTargetDate.
@Test
public void stopAtTargetDate() throws OrekitException {
final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
propagator.addEventDetector(new NodeDetector(orbit, itrf).withHandler(new ContinueOnEvent<NodeDetector>()));
AbsoluteDate farTarget = orbit.getDate().shiftedBy(10000.0);
SpacecraftState propagated = propagator.propagate(farTarget);
Assert.assertEquals(0.0, FastMath.abs(farTarget.durationFrom(propagated.getDate())), 1.0e-3);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method wrongAttitude.
@Test(expected = OrekitException.class)
public void wrongAttitude() throws OrekitException {
KeplerianOrbit orbit = new KeplerianOrbit(1.0e10, 1.0e-4, 1.0e-2, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
AttitudeProvider wrongLaw = new AttitudeProvider() {
private static final long serialVersionUID = 5918362126173997016L;
public Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame) throws OrekitException {
throw new OrekitException(new DummyLocalizable("gasp"), new RuntimeException());
}
public <T extends RealFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame) throws OrekitException {
throw new OrekitException(new DummyLocalizable("gasp"), new RuntimeException());
}
};
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, wrongLaw, provider);
propagator.propagate(AbsoluteDate.J2000_EPOCH.shiftedBy(10.0));
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method hyperbolic.
@Test(expected = OrekitException.class)
public void hyperbolic() throws OrekitException {
KeplerianOrbit hyperbolic = new KeplerianOrbit(-1.0e10, 2, 0, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, 3.986004415e14);
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(hyperbolic, provider);
propagator.propagate(AbsoluteDate.J2000_EPOCH.shiftedBy(10.0));
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testAcceleration.
@Test
public void testAcceleration() throws OrekitException {
final KeplerianOrbit orbit = new KeplerianOrbit(7.8e6, 0.032, 0.4, 0.1, 0.2, 0.3, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(orbit, provider);
AbsoluteDate target = AbsoluteDate.J2000_EPOCH.shiftedBy(10000.0);
List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
for (double dt : Arrays.asList(-0.5, 0.0, 0.5)) {
sample.add(propagator.propagate(target.shiftedBy(dt)).getPVCoordinates());
}
TimeStampedPVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(target, CartesianDerivativesFilter.USE_P, sample);
Vector3D computedP = sample.get(1).getPosition();
Vector3D computedV = sample.get(1).getVelocity();
Vector3D referenceP = interpolated.getPosition();
Vector3D referenceV = interpolated.getVelocity();
Vector3D computedA = sample.get(1).getAcceleration();
Vector3D referenceA = interpolated.getAcceleration();
final CircularOrbit propagated = (CircularOrbit) OrbitType.CIRCULAR.convertType(propagator.propagateOrbit(target));
final CircularOrbit keplerian = new CircularOrbit(propagated.getA(), propagated.getCircularEx(), propagated.getCircularEy(), propagated.getI(), propagated.getRightAscensionOfAscendingNode(), propagated.getAlphaM(), PositionAngle.MEAN, propagated.getFrame(), propagated.getDate(), propagated.getMu());
Vector3D keplerianP = keplerian.getPVCoordinates().getPosition();
Vector3D keplerianV = keplerian.getPVCoordinates().getVelocity();
Vector3D keplerianA = keplerian.getPVCoordinates().getAcceleration();
// perturbed orbit position should be similar to Keplerian orbit position
Assert.assertEquals(0.0, Vector3D.distance(referenceP, computedP), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(referenceP, keplerianP), 4.0e-9);
// perturbed orbit velocity should be equal to Keplerian orbit because
// it was in fact reconstructed from Cartesian coordinates
double computationErrorV = Vector3D.distance(referenceV, computedV);
double nonKeplerianEffectV = Vector3D.distance(referenceV, keplerianV);
Assert.assertEquals(nonKeplerianEffectV, computationErrorV, 9.0e-13);
Assert.assertEquals(2.2e-4, computationErrorV, 3.0e-6);
// perturbed orbit acceleration should be different from Keplerian orbit because
// Keplerian orbit doesn't take orbit shape changes into account
// perturbed orbit acceleration should be consistent with position evolution
double computationErrorA = Vector3D.distance(referenceA, computedA);
double nonKeplerianEffectA = Vector3D.distance(referenceA, keplerianA);
Assert.assertEquals(1.0e-7, computationErrorA, 6.0e-9);
Assert.assertEquals(6.37e-3, nonKeplerianEffectA, 7.0e-6);
Assert.assertTrue(computationErrorA < nonKeplerianEffectA / 60000);
}
use of org.orekit.orbits.KeplerianOrbit in project Orekit by CS-SI.
the class EphemerisTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, OrekitException {
Utils.setDataRoot("regular-data");
initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), TimeComponents.H00, TimeScalesFactory.getUTC());
finalDate = new AbsoluteDate(new DateComponents(2004, 01, 02), TimeComponents.H00, TimeScalesFactory.getUTC());
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;
double mu = 3.9860047e14;
inertialFrame = FramesFactory.getEME2000();
Orbit initialState = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, inertialFrame, initDate, mu);
propagator = new KeplerianPropagator(initialState);
}
Aggregations