use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class TabulatedLofOffsetTest method testYawCompensation.
@Test
public void testYawCompensation() throws OrekitException {
// create a sample from Yaw compensation law
final LOFType type = LOFType.VNC;
final List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
final AttitudeProvider yawCompensLaw = new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth));
final Propagator originalPropagator = new KeplerianPropagator(orbit);
originalPropagator.setAttitudeProvider(yawCompensLaw);
originalPropagator.setMasterMode(1.0, new OrekitFixedStepHandler() {
public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
Rotation offsetAtt = currentState.getAttitude().getRotation();
LofOffset aligned = new LofOffset(currentState.getFrame(), type);
Rotation alignedAtt = aligned.getAttitude(currentState.getOrbit(), currentState.getDate(), currentState.getFrame()).getRotation();
Rotation offsetProper = offsetAtt.compose(alignedAtt.revert(), RotationConvention.VECTOR_OPERATOR);
sample.add(new TimeStampedAngularCoordinates(currentState.getDate(), offsetProper, Vector3D.ZERO, Vector3D.ZERO));
}
});
originalPropagator.propagate(orbit.getDate().shiftedBy(2000));
originalPropagator.setSlaveMode();
// use the sample and compare it to original
final AttitudeProvider tabulated = new TabulatedLofOffset(orbit.getFrame(), type, sample, 6, AngularDerivativesFilter.USE_RR);
final Propagator rebuildingPropagator = new KeplerianPropagator(orbit);
rebuildingPropagator.setAttitudeProvider(tabulated);
rebuildingPropagator.setMasterMode(0.3, new OrekitFixedStepHandler() {
public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
final SpacecraftState rebuilt = originalPropagator.propagate(currentState.getDate());
final Rotation r1 = currentState.getAttitude().getRotation();
final Rotation r2 = rebuilt.getAttitude().getRotation();
Assert.assertEquals(0.0, Rotation.distance(r1, r2), 7.0e-6);
checkField(Decimal64Field.getInstance(), tabulated, currentState.getOrbit(), currentState.getDate(), currentState.getFrame());
}
});
rebuildingPropagator.propagate(orbit.getDate().shiftedBy(50), orbit.getDate().shiftedBy(1950));
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class TargetPointingTest method testSpin.
@Test
public void testSpin() throws OrekitException {
Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
// Elliptic earth shape
OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
// Create target pointing attitude provider
GeodeticPoint geoTarget = new GeodeticPoint(FastMath.toRadians(43.36), FastMath.toRadians(1.26), 600.);
AttitudeProvider law = new TargetPointing(FramesFactory.getEME2000(), geoTarget, earthShape);
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 = 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-5 * 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-5 * evolutionAnglePlus);
Vector3D spin0 = s0.getAttitude().getSpin();
Vector3D reference = AngularCoordinates.estimateRate(sMinus.getAttitude().getRotation(), sPlus.getAttitude().getRotation(), 2 * h);
Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 1.1e-10);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class YawSteeringTest method testSpin.
@Test
public void testSpin() throws OrekitException {
NadirPointing nadirLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
// Target pointing attitude provider with yaw compensation
AttitudeProvider law = new YawSteering(circOrbit.getFrame(), nadirLaw, CelestialBodyFactory.getSun(), Vector3D.MINUS_I);
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.shiftedBy(-300.0), 3.986004415e14);
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-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, 1.0e-9 * 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(), 5.0e-13);
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class TabulatedProviderTest method createSample.
private List<TimeStampedAngularCoordinates> createSample(double samplingRate, AttitudeProvider referenceProvider) throws OrekitException {
// reference propagator, using a yaw compensation law
final KeplerianPropagator referencePropagator = new KeplerianPropagator(circOrbit);
referencePropagator.setAttitudeProvider(referenceProvider);
// create sample
final List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
referencePropagator.setMasterMode(samplingRate, new OrekitFixedStepHandler() {
public void handleStep(SpacecraftState currentState, boolean isLast) {
sample.add(currentState.getAttitude().getOrientation());
}
});
referencePropagator.propagate(circOrbit.getDate().shiftedBy(2 * circOrbit.getKeplerianPeriod()));
return sample;
}
use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.
the class YawCompensationTest method testCompensMinMax.
/**
* Test that maximum yaw compensation is at ascending/descending node,
* and minimum yaw compensation is at maximum latitude.
*/
@Test
public void testCompensMinMax() throws OrekitException {
// Attitude laws
// **************
// Target pointing attitude provider over satellite nadir at date, without yaw compensation
NadirPointing nadirLaw = new NadirPointing(circOrbit.getFrame(), earthShape);
// Target pointing attitude provider with yaw compensation
YawCompensation yawCompensLaw = new YawCompensation(circOrbit.getFrame(), nadirLaw);
// Extrapolation over one orbital period (sec)
double duration = circOrbit.getKeplerianPeriod();
KeplerianPropagator extrapolator = new KeplerianPropagator(circOrbit);
// Extrapolation initializations
// extrapolation duration in seconds
double delta_t = 15.0;
// extrapolation start date
AbsoluteDate extrapDate = date;
// Min initialization
double yawMin = 1.e+12;
double latMin = 0.;
while (extrapDate.durationFrom(date) < duration) {
extrapDate = extrapDate.shiftedBy(delta_t);
// Extrapolated orbit state at date
Orbit extrapOrbit = extrapolator.propagate(extrapDate).getOrbit();
PVCoordinates extrapPvSatEME2000 = extrapOrbit.getPVCoordinates();
// Satellite latitude at date
double extrapLat = earthShape.transform(extrapPvSatEME2000.getPosition(), FramesFactory.getEME2000(), extrapDate).getLatitude();
// Compute yaw compensation angle -- rotations composition
double yawAngle = yawCompensLaw.getYawAngle(extrapOrbit, extrapDate, extrapOrbit.getFrame());
// Update minimum yaw compensation angle
if (FastMath.abs(yawAngle) <= yawMin) {
yawMin = FastMath.abs(yawAngle);
latMin = extrapLat;
}
// 1/ Check yaw values around ascending node (max yaw)
if ((FastMath.abs(extrapLat) < FastMath.toRadians(2.)) && (extrapPvSatEME2000.getVelocity().getZ() >= 0.)) {
Assert.assertEquals(-3.206, FastMath.toDegrees(yawAngle), 0.003);
}
// 2/ Check yaw values around maximum positive latitude (min yaw)
if (extrapLat > FastMath.toRadians(50.15)) {
Assert.assertEquals(0, FastMath.toDegrees(yawAngle), 0.15);
}
// 3/ Check yaw values around descending node (max yaw)
if ((FastMath.abs(extrapLat) < FastMath.toRadians(2.)) && (extrapPvSatEME2000.getVelocity().getZ() <= 0.)) {
Assert.assertEquals(3.206, FastMath.toDegrees(yawAngle), 0.003);
}
// 4/ Check yaw values around maximum negative latitude (min yaw)
if (extrapLat < FastMath.toRadians(-50.15)) {
Assert.assertEquals(0, FastMath.toDegrees(yawAngle), 0.15);
}
}
// 5/ Check that minimum yaw compensation value is around maximum latitude
Assert.assertEquals(0.0, FastMath.toDegrees(yawMin), 0.004);
Assert.assertEquals(50.0, FastMath.toDegrees(latMin), 0.22);
}
Aggregations