use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class EventDetectorTest method testNoisyGFunction.
@Test
public void testNoisyGFunction() throws OrekitException {
// initial conditions
Frame eme2000 = FramesFactory.getEME2000();
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2011, 5, 11, utc);
AbsoluteDate startDate = new AbsoluteDate(2032, 10, 17, utc);
AbsoluteDate interruptDate = new AbsoluteDate(2032, 10, 18, utc);
AbsoluteDate targetDate = new AbsoluteDate(2211, 5, 11, utc);
KeplerianPropagator k1 = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008462.4706055815, -3155502.5373837613, -5044275.9880020910), new Vector3D(-5012.9298276860990, 1920.3567095973078, -5172.7403501801580)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
KeplerianPropagator k2 = new KeplerianPropagator(new EquinoctialOrbit(new PVCoordinates(new Vector3D(4008912.4039522274, -3155453.3125615157, -5044297.6484738905), new Vector3D(-5012.5883854112530, 1920.6332221785074, -5172.2177085540500)), eme2000, initialDate, Constants.WGS84_EARTH_MU));
k2.addEventDetector(new CloseApproachDetector(2015.243454166727, 0.0001, 100, new ContinueOnEvent<CloseApproachDetector>(), k1));
k2.addEventDetector(new DateDetector(Constants.JULIAN_DAY, 1.0e-6, interruptDate));
SpacecraftState s = k2.propagate(startDate, targetDate);
Assert.assertEquals(0.0, interruptDate.durationFrom(s.getDate()), 1.1e-6);
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class FieldEventDetectorTest method doTestWrappedException.
private <T extends RealFieldElement<T>> void doTestWrappedException(Field<T> field) throws OrekitException {
final T zero = field.getZero();
final Throwable dummyCause = new RuntimeException();
try {
// initial conditions
Frame eme2000 = FramesFactory.getEME2000();
TimeScale utc = TimeScalesFactory.getUTC();
final FieldAbsoluteDate<T> initialDate = new FieldAbsoluteDate<>(field, 2011, 5, 11, utc);
final FieldAbsoluteDate<T> exceptionDate = initialDate.shiftedBy(3600.0);
FieldKeplerianPropagator<T> k = new FieldKeplerianPropagator<>(new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(new FieldVector3D<>(zero.add(4008462.4706055815), zero.add(-3155502.5373837613), zero.add(-5044275.9880020910)), new FieldVector3D<>(zero.add(-5012.9298276860990), zero.add(1920.3567095973078), zero.add(-5172.7403501801580))), eme2000, initialDate, Constants.WGS84_EARTH_MU));
k.addEventDetector(new FieldDateDetector<T>(initialDate.shiftedBy(Constants.JULIAN_DAY)) {
@Override
public T g(final FieldSpacecraftState<T> s) throws OrekitException {
final T dt = s.getDate().durationFrom(exceptionDate);
if (dt.abs().getReal() < 1.0) {
throw new OrekitException(dummyCause, LocalizedCoreFormats.SIMPLE_MESSAGE, "dummy");
}
return dt;
}
});
k.propagate(initialDate.shiftedBy(Constants.JULIAN_YEAR));
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertSame(dummyCause, oe.getCause());
}
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class FieldEventDetectorTest method doTestIssue108Analytical.
private <T extends RealFieldElement<T>> void doTestIssue108Analytical(Field<T> field) throws OrekitException {
final T zero = field.getZero();
final TimeScale utc = TimeScalesFactory.getUTC();
final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, utc);
final FieldOrbit<T> orbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, mu);
final T step = zero.add(60.0);
final int n = 100;
FieldKeplerianPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
GCallsCounter<T> counter = new GCallsCounter<>(zero.add(100000.0), zero.add(1.0e-6), 20, new FieldStopOnEvent<GCallsCounter<T>, T>());
propagator.addEventDetector(counter);
propagator.setMasterMode(step, new FieldOrekitFixedStepHandler<T>() {
public void handleStep(FieldSpacecraftState<T> currentState, boolean isLast) {
}
});
propagator.propagate(date.shiftedBy(step.multiply(n)));
Assert.assertEquals(n + 1, counter.getCount());
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class FieldEventDetectorTest method doTestBasicScheduling.
private <T extends RealFieldElement<T>> void doTestBasicScheduling(Field<T> field) throws OrekitException {
final T zero = field.getZero();
final TimeScale utc = TimeScalesFactory.getUTC();
final FieldVector3D<T> position = new FieldVector3D<>(zero.add(-6142438.668), zero.add(3492467.56), zero.add(-25767.257));
final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(505.848), zero.add(942.781), zero.add(7435.922));
final FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field, 2003, 9, 16, utc);
final FieldOrbit<T> orbit = new FieldCircularOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), date, mu);
FieldPropagator<T> propagator = new FieldKeplerianPropagator<>(orbit);
T stepSize = zero.add(60.0);
OutOfOrderChecker<T> checker = new OutOfOrderChecker<>(stepSize);
propagator.addEventDetector(new FieldDateDetector<>(date.shiftedBy(stepSize.multiply(5.25))).withHandler(checker));
propagator.setMasterMode(stepSize, checker);
propagator.propagate(date.shiftedBy(stepSize.multiply(10)));
Assert.assertTrue(checker.outOfOrderCallDetected());
}
use of org.orekit.time.TimeScale in project Orekit by CS-SI.
the class FootprintOverlapDetectorTest method setUp.
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data");
final TimeScale utc = 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 AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
initialOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
propagator = new EcksteinHechlerPropagator(initialOrbit, Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU, Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40, Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
} catch (OrekitException oe) {
Assert.fail(oe.getMessage());
}
}
Aggregations