use of org.orekit.propagation.Propagator in project Orekit by CS-SI.
the class LongitudeCrossingDetectorTest method testRegularCrossing.
@Test
public void testRegularCrossing() throws OrekitException {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
LongitudeCrossingDetector d = new LongitudeCrossingDetector(earth, FastMath.toRadians(10.0)).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<LongitudeCrossingDetector>());
Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
Assert.assertEquals(10.0, FastMath.toDegrees(d.getLongitude()), 1.0e-14);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
Assert.assertSame(earth, d.getBody());
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);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, 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);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
AbsoluteDate previous = null;
for (LoggedEvent e : logger.getLoggedEvents()) {
SpacecraftState state = e.getState();
double longitude = earth.transform(state.getPVCoordinates(earth.getBodyFrame()).getPosition(), earth.getBodyFrame(), null).getLongitude();
Assert.assertEquals(10.0, FastMath.toDegrees(longitude), 1.6e-7);
if (previous != null) {
// same time interval regardless of increasing/decreasing,
// as increasing/decreasing flag is irrelevant for this detector
Assert.assertEquals(4954.70, state.getDate().durationFrom(previous), 1e10);
}
previous = state.getDate();
}
Assert.assertEquals(16, logger.getLoggedEvents().size());
}
use of org.orekit.propagation.Propagator in project Orekit by CS-SI.
the class LongitudeExtremumDetectorTest method testNoCrossing.
@Test
public void testNoCrossing() throws OrekitException {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
LongitudeExtremumDetector d = new LongitudeExtremumDetector(earth).withMaxCheck(60).withThreshold(1.e-6).withHandler(new ContinueOnEvent<LongitudeExtremumDetector>());
Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-6, d.getThreshold(), 1.0e-15);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
Assert.assertSame(earth, d.getBody());
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);
final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, 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);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
Assert.assertEquals(0, logger.getLoggedEvents().size());
}
use of org.orekit.propagation.Propagator in project Orekit by CS-SI.
the class PositionAngleDetectorTest method doTest.
private void doTest(final OrbitType orbitType, final PositionAngle positionAngle, final double angle, final int expectedCrossings) throws OrekitException {
PositionAngleDetector d = new PositionAngleDetector(orbitType, positionAngle, angle).withMaxCheck(60).withThreshold(1.e-10).withHandler(new ContinueOnEvent<PositionAngleDetector>());
Assert.assertEquals(60.0, d.getMaxCheckInterval(), 1.0e-15);
Assert.assertEquals(1.0e-10, d.getThreshold(), 1.0e-15);
Assert.assertEquals(orbitType, d.getOrbitType());
Assert.assertEquals(positionAngle, d.getPositionAngle());
Assert.assertEquals(angle, d.getAngle(), 1.0e-14);
Assert.assertEquals(AbstractDetector.DEFAULT_MAX_ITER, d.getMaxIterationCount());
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(506.0, 943.0, 7450);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
Propagator propagator = new EcksteinHechlerPropagator(orbit, 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);
EventsLogger logger = new EventsLogger();
propagator.addEventDetector(logger.monitorDetector(d));
propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
double[] array = new double[6];
for (LoggedEvent e : logger.getLoggedEvents()) {
SpacecraftState state = e.getState();
orbitType.mapOrbitToArray(state.getOrbit(), positionAngle, array, null);
Assert.assertEquals(angle, MathUtils.normalizeAngle(array[5], angle), 1.0e-10);
}
Assert.assertEquals(15, logger.getLoggedEvents().size());
}
use of org.orekit.propagation.Propagator in project Orekit by CS-SI.
the class NadirPointingTest method testSpin.
@Test
public void testSpin() throws OrekitException {
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Create earth center pointing attitude provider
NadirPointing law = new NadirPointing(FramesFactory.getEME2000(), earthShape);
// Satellite on any position
KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
Propagator propagator = new KeplerianPropagator(orbit, law, mu, 2500.0);
double h = 0.1;
SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
SpacecraftState s0 = propagator.propagate(date);
SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
// check spin is consistent with attitude evolution
double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAngleMinus, 5.3e-9 * evolutionAngleMinus);
double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAnglePlus, 8.1e-9 * evolutionAnglePlus);
Vector3D spin0 = s0.getAttitude().getSpin();
Rotation rM = sMinus.getAttitude().getRotation();
Rotation rP = sPlus.getAttitude().getRotation();
Vector3D reference = AngularCoordinates.estimateRate(rM, rP, 2 * h);
Assert.assertTrue(Rotation.distance(rM, rP) > 2.0e-4);
Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 2.0e-6);
}
use of org.orekit.propagation.Propagator in project Orekit by CS-SI.
the class InertialAttitudeTest method testSpin.
@Test
public void testSpin() throws OrekitException {
AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2, RotationConvention.VECTOR_OPERATOR));
KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
Propagator propagator = new KeplerianPropagator(orbit, law);
double h = 100.0;
SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
SpacecraftState s0 = propagator.propagate(date);
SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
// check spin is consistent with attitude evolution
double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAngleMinus, 1.0e-6 * evolutionAngleMinus);
double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
Assert.assertEquals(0.0, errorAnglePlus, 1.0e-6 * evolutionAnglePlus);
// compute spin axis using finite differences
Rotation rMinus = sMinus.getAttitude().getRotation();
Rotation rPlus = sPlus.getAttitude().getRotation();
Rotation dr = rPlus.compose(rMinus.revert(), RotationConvention.VECTOR_OPERATOR);
Assert.assertEquals(0, dr.getAngle(), 1.0e-10);
Vector3D spin0 = s0.getAttitude().getSpin();
Assert.assertEquals(0, spin0.getNorm(), 1.0e-10);
}
Aggregations