use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method testIssue223.
@Test
public void testIssue223() throws OrekitException, IOException, ClassNotFoundException {
// Definition of initial conditions
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);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
propagator.propagate(initial.getDate().shiftedBy(40000));
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
Assert.assertSame(poleAligned, ephemeris.getFrame());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue(bos.size() > 2450);
Assert.assertTrue(bos.size() < 2550);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator deserialized = (BoundedPropagator) ois.readObject();
Assert.assertEquals(initial.getA(), deserialized.getInitialState().getA(), 1.0e-10);
Assert.assertEquals(initial.getEquinoctialEx(), deserialized.getInitialState().getEquinoctialEx(), 1.0e-10);
SpacecraftState s = deserialized.propagate(initial.getDate().shiftedBy(20000));
Map<String, double[]> additional = s.getAdditionalStates();
Assert.assertEquals(1, additional.size());
Assert.assertEquals(1, additional.get("seven").length);
Assert.assertEquals(7, additional.get("seven")[0], 1.0e-15);
}
use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testEphemerisModeWithHandler.
@Test
public void testEphemerisModeWithHandler() throws OrekitException {
// setup
AbsoluteDate initDate = AbsoluteDate.GPS_EPOCH;
Orbit ic = new KeplerianOrbit(6378137 + 500e3, 1e-3, 0, 0, 0, 0, PositionAngle.TRUE, FramesFactory.getGCRF(), initDate, mu);
Propagator propagator = new KeplerianPropagator(ic);
AbsoluteDate end = initDate.shiftedBy(90 * 60);
// action
final List<SpacecraftState> states = new ArrayList<>();
propagator.setEphemerisMode((interpolator, isLast) -> {
states.add(interpolator.getCurrentState());
states.add(interpolator.getPreviousState());
});
propagator.propagate(end);
final BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
// verify
// got some data
Assert.assertTrue(states.size() > 1);
for (SpacecraftState state : states) {
PVCoordinates actual = ephemeris.propagate(state.getDate()).getPVCoordinates();
Assert.assertThat(actual, OrekitMatchers.pvIs(state.getPVCoordinates()));
}
}
use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testIssue224.
@Test
public void testIssue224() throws OrekitException, IOException, ClassNotFoundException {
// Inertial frame
Frame inertialFrame = FramesFactory.getEME2000();
// Initial date
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
// Central attraction coefficient
double mu = 3.986004415e+14;
// Initial orbit
// semi major axis in meters
double a = 42100;
// eccentricity
double e = 0.01;
// inclination
double i = FastMath.toRadians(6);
// perigee argument
double omega = FastMath.toRadians(180);
// right ascention of ascending node
double raan = FastMath.toRadians(261);
// mean anomaly
double lM = 0;
Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu);
// Initial state definition
SpacecraftState initialState = new SpacecraftState(initialOrbit);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(inertialFrame, LOFType.VVLH));
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
// Impulsive burn 1
final AbsoluteDate burn1Date = initialState.getDate().shiftedBy(200);
ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(1000, 0, 0), 320);
propagator.addEventDetector(impulsiveBurn1);
// Impulsive burn 2
final AbsoluteDate burn2Date = initialState.getDate().shiftedBy(300);
ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(1000, 0, 0), 320);
propagator.addEventDetector(impulsiveBurn2);
propagator.propagate(initialState.getDate().shiftedBy(400));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(propagator.getGeneratedEphemeris());
Assert.assertTrue(bos.size() > 2400);
Assert.assertTrue(bos.size() < 2500);
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(42100.0, currentState.getA(), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn1Date) > 0.001 && currentState.getDate().durationFrom(burn2Date) < -0.001) {
Assert.assertEquals(42979.962, currentState.getA(), 1.0e-3);
} else if (currentState.getDate().durationFrom(burn2Date) > 0.001) {
Assert.assertEquals(43887.339, currentState.getA(), 1.0e-3);
}
}
});
ephemeris.propagate(ephemeris.getMaxDate());
}
use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.
the class KeplerianPropagatorTest method testIssue223.
@Test
public void testIssue223() throws OrekitException, IOException, ClassNotFoundException {
// Inertial frame
Frame inertialFrame = FramesFactory.getEME2000();
// Initial date
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
// Central attraction coefficient
double mu = 3.986004415e+14;
// Initial orbit
// semi major axis in meters
double a = 42100;
// eccentricity
double e = 0.01;
// inclination
double i = FastMath.toRadians(6);
// perigee argument
double omega = FastMath.toRadians(180);
// right ascention of ascending node
double raan = FastMath.toRadians(261);
// mean anomaly
double lM = 0;
Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu);
// Initial state definition
SpacecraftState initialState = new SpacecraftState(initialOrbit);
// Propagator
KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit);
propagator.addAdditionalStateProvider(new SevenProvider());
propagator.setEphemerisMode();
propagator.propagate(initialState.getDate().shiftedBy(40000));
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
Assert.assertSame(inertialFrame, ephemeris.getFrame());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue(bos.size() > 2250);
Assert.assertTrue(bos.size() < 2350);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
BoundedPropagator deserialized = (BoundedPropagator) ois.readObject();
Assert.assertEquals(initialOrbit.getA(), deserialized.getInitialState().getA(), 1.0e-10);
Assert.assertEquals(initialOrbit.getEquinoctialEx(), deserialized.getInitialState().getEquinoctialEx(), 1.0e-10);
SpacecraftState s = deserialized.propagate(initialState.getDate().shiftedBy(20000));
Map<String, double[]> additional = s.getAdditionalStates();
Assert.assertEquals(1, additional.size());
Assert.assertEquals(1, additional.get("seven").length);
Assert.assertEquals(7, additional.get("seven")[0], 1.0e-15);
}
use of org.orekit.propagation.BoundedPropagator in project Orekit by CS-SI.
the class TLEPropagatorTest method testEphemerisMode.
@Test
public void testEphemerisMode() throws OrekitException {
TLEPropagator propagator = TLEPropagator.selectExtrapolator(tle);
propagator.setEphemerisMode();
AbsoluteDate initDate = tle.getDate();
SpacecraftState initialState = propagator.getInitialState();
// Simulate a full period of a GPS satellite
// -----------------------------------------
AbsoluteDate endDate = initDate.shiftedBy(period);
propagator.propagate(endDate);
// get the ephemeris
BoundedPropagator boundedProp = propagator.getGeneratedEphemeris();
// get the initial state from the ephemeris and check if it is the same as
// the initial state from the TLE
SpacecraftState boundedState = boundedProp.propagate(initDate);
// Check results
Assert.assertEquals(initialState.getA(), boundedState.getA(), 0.);
Assert.assertEquals(initialState.getEquinoctialEx(), boundedState.getEquinoctialEx(), 0.);
Assert.assertEquals(initialState.getEquinoctialEy(), boundedState.getEquinoctialEy(), 0.);
Assert.assertEquals(initialState.getHx(), boundedState.getHx(), 0.);
Assert.assertEquals(initialState.getHy(), boundedState.getHy(), 0.);
Assert.assertEquals(initialState.getLM(), boundedState.getLM(), 1e-14);
SpacecraftState finalState = boundedProp.propagate(endDate);
// Check results
Assert.assertEquals(initialState.getA(), finalState.getA(), 1e-1);
Assert.assertEquals(initialState.getEquinoctialEx(), finalState.getEquinoctialEx(), 1e-1);
Assert.assertEquals(initialState.getEquinoctialEy(), finalState.getEquinoctialEy(), 1e-1);
Assert.assertEquals(initialState.getHx(), finalState.getHx(), 1e-3);
Assert.assertEquals(initialState.getHy(), finalState.getHy(), 1e-3);
Assert.assertEquals(initialState.getLM(), finalState.getLM(), 1e-3);
}
Aggregations