use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class AdapterPropagatorTest method testNonKeplerian.
@Test
public void testNonKeplerian() throws OrekitException, ParseException, IOException {
Orbit leo = new CircularOrbit(7204319.233600575, 4.434564637450575E-4, 0.0011736728299091088, 1.7211611441767323, 5.5552084166959474, 24950.321259193086, PositionAngle.TRUE, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2003, 9, 16), new TimeComponents(23, 11, 20.264), TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
double mass = 4093.0;
AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2003, 9, 16), new TimeComponents(23, 14, 40.264), TimeScalesFactory.getUTC());
Vector3D dV = new Vector3D(0.0, 3.0, 0.0);
double f = 40.0;
double isp = 300.0;
double vExhaust = Constants.G0_STANDARD_GRAVITY * isp;
double dt = -(mass * vExhaust / f) * FastMath.expm1(-dV.getNorm() / vExhaust);
// setup a specific coefficient file for gravity potential as it will also
// try to read a corrupted one otherwise
GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("g007_eigen_05c_coef", false));
NormalizedSphericalHarmonicsProvider gravityField = GravityFieldFactory.getNormalizedProvider(8, 8);
BoundedPropagator withoutManeuver = getEphemeris(leo, mass, 10, new LofOffset(leo.getFrame(), LOFType.VNC), t0, Vector3D.ZERO, f, isp, true, true, gravityField);
BoundedPropagator withManeuver = getEphemeris(leo, mass, 10, new LofOffset(leo.getFrame(), LOFType.VNC), t0, dV, f, isp, true, true, gravityField);
// we set up a model that reverts the maneuvers
AdapterPropagator adapterPropagator = new AdapterPropagator(withManeuver);
SpacecraftState state0 = adapterPropagator.propagate(t0);
AdapterPropagator.DifferentialEffect directEffect = new SmallManeuverAnalyticalModel(state0, dV.negate(), isp);
AdapterPropagator.DifferentialEffect derivedEffect = new J2DifferentialEffect(state0, directEffect, false, GravityFieldFactory.getUnnormalizedProvider(gravityField));
adapterPropagator.addEffect(directEffect);
adapterPropagator.addEffect(derivedEffect);
adapterPropagator.addAdditionalStateProvider(new AdditionalStateProvider() {
public String getName() {
return "dummy 3";
}
public double[] getAdditionalState(SpacecraftState state) {
return new double[3];
}
});
// the adapted propagators do not manage the additional states from the reference,
// they simply forward them
Assert.assertFalse(adapterPropagator.isAdditionalStateManaged("dummy 1"));
Assert.assertFalse(adapterPropagator.isAdditionalStateManaged("dummy 2"));
Assert.assertTrue(adapterPropagator.isAdditionalStateManaged("dummy 3"));
double maxDelta = 0;
double maxNominal = 0;
for (AbsoluteDate t = t0.shiftedBy(0.5 * dt); t.compareTo(withoutManeuver.getMaxDate()) < 0; t = t.shiftedBy(600.0)) {
PVCoordinates pvWithout = withoutManeuver.getPVCoordinates(t, leo.getFrame());
PVCoordinates pvWith = withManeuver.getPVCoordinates(t, leo.getFrame());
PVCoordinates pvReverted = adapterPropagator.getPVCoordinates(t, leo.getFrame());
double nominal = new PVCoordinates(pvWithout, pvWith).getPosition().getNorm();
double revertError = new PVCoordinates(pvWithout, pvReverted).getPosition().getNorm();
maxDelta = FastMath.max(maxDelta, revertError);
maxNominal = FastMath.max(maxNominal, nominal);
Assert.assertEquals(2, adapterPropagator.propagate(t).getAdditionalState("dummy 1").length);
Assert.assertEquals(1, adapterPropagator.propagate(t).getAdditionalState("dummy 2").length);
Assert.assertEquals(3, adapterPropagator.propagate(t).getAdditionalState("dummy 3").length);
}
Assert.assertTrue(maxDelta < 120);
Assert.assertTrue(maxNominal > 2800);
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testNonSerializableStateProvider.
@Test
public void testNonSerializableStateProvider() throws OrekitException, IOException {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, provider);
// this serialization should work
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
propagator.addAdditionalStateProvider(new AdditionalStateProvider() {
public String getName() {
return "not serializable";
}
public double[] getAdditionalState(SpacecraftState state) {
return new double[] { 0 };
}
});
try {
// this serialization should not work
new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(propagator);
Assert.fail("an exception should have been thrown");
} catch (NotSerializableException nse) {
// expected
}
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue224Backward.
@Test
public void testIssue224Backward() throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
// Impulsive burns
final AbsoluteDate burn1Date = initial.getDate().shiftedBy(-200);
ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn1);
final AbsoluteDate burn2Date = initial.getDate().shiftedBy(-300);
ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn2);
propagator.propagate(initial.getDate().shiftedBy(-400));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(propagator.getGeneratedEphemeris());
Assert.assertTrue(bos.size() > 2950);
Assert.assertTrue(bos.size() < 3050);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {
public void handleStep(SpacecraftState currentState, boolean isLast) {
if (currentState.getDate().durationFrom(burn1Date) > 0.001) {
Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn1Date) < -0.001 && currentState.getDate().durationFrom(burn2Date) > 0.001) {
Assert.assertEquals(98.164, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn2Date) < -0.001) {
Assert.assertEquals(99.273, FastMath.toDegrees(currentState.getI()), 1.0e-3);
}
}
});
ephemeris.propagate(ephemeris.getMinDate());
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue224Forward.
@Test
public void testIssue224Forward() throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
Frame eme2000 = FramesFactory.getEME2000();
Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
// Impulsive burns
final AbsoluteDate burn1Date = initial.getDate().shiftedBy(200);
ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn1);
final AbsoluteDate burn2Date = initial.getDate().shiftedBy(300);
ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
propagator.addEventDetector(impulsiveBurn2);
propagator.propagate(initial.getDate().shiftedBy(400));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(propagator.getGeneratedEphemeris());
Assert.assertTrue(bos.size() > 2950);
Assert.assertTrue(bos.size() < 3050);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {
public void handleStep(SpacecraftState currentState, boolean isLast) {
if (currentState.getDate().durationFrom(burn1Date) < -0.001) {
Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn1Date) > 0.001 && currentState.getDate().durationFrom(burn2Date) < -0.001) {
Assert.assertEquals(98.183, FastMath.toDegrees(currentState.getI()), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn2Date) > 0.001) {
Assert.assertEquals(99.310, FastMath.toDegrees(currentState.getI()), 1.0e-3);
}
}
});
ephemeris.propagate(ephemeris.getMaxDate());
}
use of org.orekit.orbits.CircularOrbit in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method criticalInclination.
@Test(expected = OrekitException.class)
public void criticalInclination() throws OrekitException {
AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH;
Orbit initialOrbit = new CircularOrbit(new PVCoordinates(new Vector3D(-3862363.8474653554, -3521533.9758022362, 4647637.852558916), new Vector3D(65.36170817232278, -6056.563439401233, -4511.1247889782757)), FramesFactory.getEME2000(), initDate, provider.getMu());
// Extrapolator definition
// -----------------------
EcksteinHechlerPropagator extrapolator = new EcksteinHechlerPropagator(initialOrbit, provider);
// Extrapolation at the initial date
// ---------------------------------
double delta_t = 0.0;
AbsoluteDate extrapDate = initDate.shiftedBy(delta_t);
extrapolator.propagate(extrapDate);
}
Aggregations