use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.
the class ImpulseManeuverTest method testBackward.
@Test
public void testBackward() throws OrekitException {
final AbsoluteDate iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
final Orbit initialOrbit = new KeplerianOrbit(7e6, 1.0e-4, FastMath.toRadians(98.5), FastMath.toRadians(87.0), FastMath.toRadians(216.1807), FastMath.toRadians(319.779), PositionAngle.MEAN, FramesFactory.getEME2000(), iniDate, Constants.EIGEN5C_EARTH_MU);
KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC));
DateDetector dateDetector = new DateDetector(iniDate.shiftedBy(-300));
Vector3D deltaV = new Vector3D(12.0, 1.0, -4.0);
final double isp = 300;
ImpulseManeuver<DateDetector> maneuver = new ImpulseManeuver<DateDetector>(dateDetector, deltaV, isp).withMaxCheck(3600.0).withThreshold(1.0e-6);
propagator.addEventDetector(maneuver);
SpacecraftState finalState = propagator.propagate(initialOrbit.getDate().shiftedBy(-900));
Assert.assertTrue(finalState.getMass() > propagator.getInitialState().getMass());
Assert.assertTrue(finalState.getDate().compareTo(propagator.getInitialState().getDate()) < 0);
}
use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.
the class SmallManeuverAnalyticalModelTest method getEphemeris.
private BoundedPropagator getEphemeris(final Orbit orbit, final double mass, final AbsoluteDate t0, final Vector3D dV, final double f, final double isp) throws OrekitException {
AttitudeProvider law = new LofOffset(orbit.getFrame(), LOFType.LVLH);
final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
// set up numerical propagator
final double dP = 1.0;
double[][] tolerances = NumericalPropagator.tolerances(dP, orbit, orbit.getType());
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tolerances[0], tolerances[1]);
integrator.setInitialStepSize(orbit.getKeplerianPeriod() / 100.0);
final NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(orbit.getType());
propagator.setInitialState(initialState);
propagator.setAttitudeProvider(law);
if (dV.getNorm() > 1.0e-6) {
// set up maneuver
final double vExhaust = Constants.G0_STANDARD_GRAVITY * isp;
final double dt = -(mass * vExhaust / f) * FastMath.expm1(-dV.getNorm() / vExhaust);
final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(t0, dt, f, isp, dV.normalize());
propagator.addForceModel(maneuver);
}
propagator.setEphemerisMode();
propagator.propagate(t0.shiftedBy(5 * orbit.getKeplerianPeriod()));
return propagator.getGeneratedEphemeris();
}
use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.
the class SolarRadiationPressureTest method testLocalJacobianIsotropicClassicalVs80Implementation.
@Test
public void testLocalJacobianIsotropicClassicalVs80Implementation() throws OrekitException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
double i = FastMath.toRadians(98.7);
double omega = FastMath.toRadians(93.0);
double OMEGA = FastMath.toRadians(15.0 * 22.5);
Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
final SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(), Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new IsotropicRadiationClassicalConvention(2.5, 0.7, 0.2));
checkStateJacobianVs80Implementation(new SpacecraftState(orbit), forceModel, new LofOffset(orbit.getFrame(), LOFType.VVLH), 1.0e-15, false);
}
use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.
the class EcksteinHechlerPropagatorTest method propagatedKeplerian.
@Test
public void propagatedKeplerian() throws OrekitException {
// Definition of initial conditions with Keplerian parameters
// -----------------------------------------------------------
AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
Orbit initialOrbit = new KeplerianOrbit(7209668.0, 0.5e-4, 1.7, 2.1, 2.9, 6.2, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, provider.getMu());
// Extrapolator definition
// -----------------------
EcksteinHechlerPropagator extrapolator = new EcksteinHechlerPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC, RotationOrder.XYZ, 0, 0, 0), 2000.0, provider);
// Extrapolation at a final date different from initial date
// ---------------------------------------------------------
// extrapolation duration in seconds
double delta_t = 100000.0;
AbsoluteDate extrapDate = initDate.shiftedBy(delta_t);
SpacecraftState finalOrbit = extrapolator.propagate(extrapDate);
Assert.assertEquals(0.0, finalOrbit.getDate().durationFrom(extrapDate), 1.0e-9);
// computation of M final orbit
double LM = finalOrbit.getLE() - finalOrbit.getEquinoctialEx() * FastMath.sin(finalOrbit.getLE()) + finalOrbit.getEquinoctialEy() * FastMath.cos(finalOrbit.getLE());
Assert.assertEquals(LM, finalOrbit.getLM(), Utils.epsilonAngle);
// test of tan((LE - Lv)/2) :
Assert.assertEquals(FastMath.tan((finalOrbit.getLE() - finalOrbit.getLv()) / 2.), tangLEmLv(finalOrbit.getLv(), finalOrbit.getEquinoctialEx(), finalOrbit.getEquinoctialEy()), Utils.epsilonAngle);
// test of evolution of M vs E: LM = LE - ex*sin(LE) + ey*cos(LE)
// with ex and ey the same for initial and final orbit
double deltaM = finalOrbit.getLM() - initialOrbit.getLM();
double deltaE = finalOrbit.getLE() - initialOrbit.getLE();
double delta = finalOrbit.getEquinoctialEx() * FastMath.sin(finalOrbit.getLE()) - initialOrbit.getEquinoctialEx() * FastMath.sin(initialOrbit.getLE()) - finalOrbit.getEquinoctialEy() * FastMath.cos(finalOrbit.getLE()) + initialOrbit.getEquinoctialEy() * FastMath.cos(initialOrbit.getLE());
Assert.assertEquals(deltaM, deltaE - delta, Utils.epsilonAngle * FastMath.abs(deltaE - delta));
// for final orbit
double ex = finalOrbit.getEquinoctialEx();
double ey = finalOrbit.getEquinoctialEy();
double hx = finalOrbit.getHx();
double hy = finalOrbit.getHy();
double LE = finalOrbit.getLE();
double ex2 = ex * ex;
double ey2 = ey * ey;
double hx2 = hx * hx;
double hy2 = hy * hy;
double h2p1 = 1. + hx2 + hy2;
double beta = 1. / (1. + FastMath.sqrt(1. - ex2 - ey2));
double x3 = -ex + (1. - beta * ey2) * FastMath.cos(LE) + beta * ex * ey * FastMath.sin(LE);
double y3 = -ey + (1. - beta * ex2) * FastMath.sin(LE) + beta * ex * ey * FastMath.cos(LE);
Vector3D U = new Vector3D((1. + hx2 - hy2) / h2p1, (2. * hx * hy) / h2p1, (-2. * hy) / h2p1);
Vector3D V = new Vector3D((2. * hx * hy) / h2p1, (1. - hx2 + hy2) / h2p1, (2. * hx) / h2p1);
Vector3D r = new Vector3D(finalOrbit.getA(), (new Vector3D(x3, U, y3, V)));
Assert.assertEquals(finalOrbit.getPVCoordinates().getPosition().getNorm(), r.getNorm(), Utils.epsilonTest * r.getNorm());
}
use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.
the class EphemerisTest method testSerialization.
@Test
public void testSerialization() throws OrekitException, IOException, ClassNotFoundException {
propagator.setAttitudeProvider(new LofOffset(inertialFrame, LOFType.VVLH));
int numberOfIntervals = 150;
double deltaT = finalDate.durationFrom(initDate) / numberOfIntervals;
List<SpacecraftState> states = new ArrayList<SpacecraftState>(numberOfIntervals + 1);
for (int j = 0; j <= numberOfIntervals; j++) {
states.add(propagator.propagate(initDate.shiftedBy((j * deltaT))));
}
int numInterpolationPoints = 2;
Ephemeris ephemPropagator = new Ephemeris(states, numInterpolationPoints, 1.25);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemPropagator);
Assert.assertTrue(bos.size() > 30000);
Assert.assertTrue(bos.size() < 31000);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
Ephemeris deserialized = (Ephemeris) ois.readObject();
Assert.assertEquals(deserialized.getMinDate(), ephemPropagator.getMinDate());
Assert.assertEquals(deserialized.getMaxDate(), ephemPropagator.getMaxDate());
Assert.assertEquals(deserialized.getExtrapolationThreshold(), ephemPropagator.getExtrapolationThreshold(), 1.0e-15);
for (double dt = 0; dt < finalDate.durationFrom(initDate); dt += 10.0) {
AbsoluteDate date = initDate.shiftedBy(dt);
TimeStampedPVCoordinates pvRef = ephemPropagator.getPVCoordinates(date, inertialFrame);
TimeStampedPVCoordinates pv = deserialized.getPVCoordinates(date, inertialFrame);
Assert.assertEquals(0.0, Vector3D.distance(pvRef.getPosition(), pv.getPosition()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvRef.getVelocity(), pv.getVelocity()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(pvRef.getAcceleration(), pv.getAcceleration()), 1.0e-15);
}
}
Aggregations