use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class AlongTrackAiming method findHalfTrack.
/**
* Find the ascending or descending part of an orbit track.
* @param orbit orbit along which tiles should be aligned
* @param ellipsoid ellipsoid over which track is sampled
* @param isAscending indicator for zone tiling with respect to ascending
* or descending orbits
* @return time stamped ground points on the selected half track
* @exception OrekitException if some frame conversion fails
*/
private static List<Pair<GeodeticPoint, TimeStampedPVCoordinates>> findHalfTrack(final Orbit orbit, final OneAxisEllipsoid ellipsoid, final boolean isAscending) throws OrekitException {
// find the span of the next half track
final Propagator propagator = new KeplerianPropagator(orbit);
final HalfTrackSpanHandler handler = new HalfTrackSpanHandler(isAscending);
final LatitudeExtremumDetector detector = new LatitudeExtremumDetector(0.25 * orbit.getKeplerianPeriod(), 1.0e-3, ellipsoid).withHandler(handler).withMaxIter(100);
propagator.addEventDetector(detector);
propagator.propagate(orbit.getDate().shiftedBy(3 * orbit.getKeplerianPeriod()));
// sample the half track
propagator.clearEventsDetectors();
final HalfTrackSampler sampler = new HalfTrackSampler(ellipsoid);
propagator.setMasterMode(handler.getEnd().durationFrom(handler.getStart()) / SAMPLING_STEPS, sampler);
propagator.propagate(handler.getStart(), handler.getEnd());
return sampler.getHalfTrack();
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class TargetPointingTest method testNadirTarget.
/**
* Test with nadir target : Check that when the target is the same as nadir target at date,
* satellite attitude is the same as nadir attitude at the same date, but different at a different date.
*/
@Test
public void testNadirTarget() throws OrekitException {
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Satellite on any position
CircularOrbit circOrbit = new CircularOrbit(7178000.0, 1.e-5, 0., FastMath.toRadians(50.), 0., FastMath.toRadians(90.), PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
// Target attitude provider with target under satellite nadir
// *******************************************************
// Definition of nadir target
// Create nadir pointing attitude provider
NadirPointing nadirAttitudeLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
// Check nadir target
Vector3D pNadirTarget = nadirAttitudeLaw.getTargetPV(circOrbit, date, itrf).getPosition();
GeodeticPoint geoNadirTarget = earthShape.transform(pNadirTarget, itrf, date);
// Create target attitude provider
TargetPointing targetAttitudeLaw = new TargetPointing(circOrbit.getFrame(), geoNadirTarget, earthShape);
// 1/ Test that attitudes are the same at date
// *********************************************
// i.e the composition of inverse earth pointing rotation
// with nadir pointing rotation shall be identity.
// Get satellite rotation from target pointing law at date
Rotation rotTarget = targetAttitudeLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
// Get satellite rotation from nadir pointing law at date
Rotation rotNadir = nadirAttitudeLaw.getAttitude(circOrbit, date, circOrbit.getFrame()).getRotation();
// Compose attitude rotations
Rotation rotCompo = rotTarget.composeInverse(rotNadir, RotationConvention.VECTOR_OPERATOR);
double angle = rotCompo.getAngle();
Assert.assertEquals(angle, 0.0, Utils.epsilonAngle);
// 2/ Test that attitudes are different at a different date
// **********************************************************
// Extrapolation one minute later
KeplerianPropagator extrapolator = new KeplerianPropagator(circOrbit);
// extrapolation duration in seconds
double delta_t = 60.0;
AbsoluteDate extrapDate = date.shiftedBy(delta_t);
Orbit extrapOrbit = extrapolator.propagate(extrapDate).getOrbit();
// Get satellite rotation from target pointing law at date + 1min
Rotation extrapRotTarget = targetAttitudeLaw.getAttitude(extrapOrbit, extrapDate, extrapOrbit.getFrame()).getRotation();
// Get satellite rotation from nadir pointing law at date
Rotation extrapRotNadir = nadirAttitudeLaw.getAttitude(extrapOrbit, extrapDate, extrapOrbit.getFrame()).getRotation();
// Compose attitude rotations
Rotation extrapRotCompo = extrapRotTarget.composeInverse(extrapRotNadir, RotationConvention.VECTOR_OPERATOR);
double extrapAngle = extrapRotCompo.getAngle();
Assert.assertEquals(extrapAngle, FastMath.toRadians(24.684793905118823), Utils.epsilonAngle);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class SolarBodyTest method checkKepler.
private void checkKepler(final PVCoordinatesProvider orbiting, final CelestialBody central, final AbsoluteDate start, final double a, final double epsilon) throws OrekitException {
// set up Keplerian orbit of orbiting body around central body
Orbit orbit = new KeplerianOrbit(orbiting.getPVCoordinates(start, central.getInertiallyOrientedFrame()), central.getInertiallyOrientedFrame(), start, central.getGM());
KeplerianPropagator propagator = new KeplerianPropagator(orbit);
Assert.assertEquals(a, orbit.getA(), 0.02 * a);
double duration = FastMath.min(50 * Constants.JULIAN_DAY, 0.01 * orbit.getKeplerianPeriod());
double max = 0;
for (AbsoluteDate date = start; date.durationFrom(start) < duration; date = date.shiftedBy(duration / 100)) {
PVCoordinates ephemPV = orbiting.getPVCoordinates(date, central.getInertiallyOrientedFrame());
PVCoordinates keplerPV = propagator.propagate(date).getPVCoordinates();
Vector3D error = keplerPV.getPosition().subtract(ephemPV.getPosition());
max = FastMath.max(max, error.getNorm());
}
Assert.assertTrue(max < epsilon * a);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class LofOffsetPointingTest 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());
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);
final AttitudeProvider law = new LofOffsetPointing(orbit.getFrame(), earthSpheric, new LofOffset(orbit.getFrame(), LOFType.VVLH, RotationOrder.XYX, 0.1, 0.2, 0.3), Vector3D.PLUS_K);
Propagator propagator = new KeplerianPropagator(orbit, law);
double h = 0.01;
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);
Vector3D spin0 = s0.getAttitude().getSpin();
Vector3D reference = AngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
Assert.assertTrue(spin0.getNorm() > 1.0e-3);
Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.0e-10);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class InertialAttitudeTest method testIsInertial.
@Test
public void testIsInertial() throws OrekitException {
InertialProvider law = new InertialProvider(new Rotation(new Vector3D(0.6, 0.48, 0.64), 0.9, RotationConvention.VECTOR_OPERATOR));
KeplerianPropagator propagator = new KeplerianPropagator(orbit0, law);
Attitude initial = propagator.propagate(t0).getAttitude();
for (double t = 0; t < 10000.0; t += 100) {
SpacecraftState state = propagator.propagate(t0.shiftedBy(t));
checkField(Decimal64Field.getInstance(), law, state.getOrbit(), state.getDate(), state.getFrame());
Attitude attitude = state.getAttitude();
Rotation evolution = attitude.getRotation().compose(initial.getRotation().revert(), RotationConvention.VECTOR_OPERATOR);
Assert.assertEquals(0, evolution.getAngle(), 1.0e-10);
Assert.assertEquals(FramesFactory.getEME2000(), attitude.getReferenceFrame());
}
}
Aggregations