use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class DSSTPropagatorTest method getGEOState.
private SpacecraftState getGEOState() throws IllegalArgumentException, OrekitException {
// No shadow at this date
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2003, 05, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
final Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, 3.986004415E14);
return new SpacecraftState(orbit);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class DSSTPropagatorTest method testImpulseManeuver.
@Test
public void testImpulseManeuver() throws OrekitException {
final Orbit initialOrbit = new KeplerianOrbit(24532000.0, 0.72, 0.3, FastMath.PI, 0.4, 2.0, PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2008, 06, 23), new TimeComponents(14, 18, 37), TimeScalesFactory.getUTC()), 3.986004415e14);
final double a = initialOrbit.getA();
final double e = initialOrbit.getE();
final double i = initialOrbit.getI();
final double mu = initialOrbit.getMu();
final double vApo = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
double dv = 0.99 * FastMath.tan(i) * vApo;
// Set propagator with state
setDSSTProp(new SpacecraftState(initialOrbit));
// Add impulse maneuver
dsstProp.setAttitudeProvider(new LofOffset(initialOrbit.getFrame(), LOFType.VVLH));
dsstProp.addEventDetector(new ImpulseManeuver<NodeDetector>(new NodeDetector(initialOrbit, FramesFactory.getEME2000()), new Vector3D(dv, Vector3D.PLUS_J), 400.0));
SpacecraftState propagated = dsstProp.propagate(initialOrbit.getDate().shiftedBy(8000));
Assert.assertEquals(0.0028257, propagated.getI(), 1.0e-6);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class DSSTPropagatorTest method getLEOStatePropagatedBy30Minutes.
private SpacecraftState getLEOStatePropagatedBy30Minutes() throws IllegalArgumentException, OrekitException {
final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
// Spring equinoxe 21st mars 2003 1h00m
final AbsoluteDate initialDate = new AbsoluteDate(new DateComponents(2003, 03, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
final CartesianOrbit osculatingOrbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getTOD(IERSConventions.IERS_1996, false), initialDate, Constants.WGS84_EARTH_MU);
// Adaptive step integrator
// with a minimum step of 0.001 and a maximum step of 1000
double minStep = 0.001;
double maxstep = 1000.0;
double positionTolerance = 10.0;
OrbitType propagationType = OrbitType.EQUINOCTIAL;
double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, osculatingOrbit, propagationType);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]);
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(propagationType);
NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
propagator.addForceModel(holmesFeatherstone);
propagator.setInitialState(new SpacecraftState(osculatingOrbit));
return propagator.propagate(new AbsoluteDate(initialDate, 1800.));
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class TabulatedEphemerisTest method checkInterpolation.
private void checkInterpolation(StateFilter f, double expectedDP, double expectedDV) throws OrekitException {
double mass = 2500;
double a = 7187990.1979844316;
double e = 0.5e-4;
double i = 1.7105407051081795;
double omega = 1.9674147913622104;
double OMEGA = FastMath.toRadians(261);
double lv = 0;
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), TimeComponents.H00, TimeScalesFactory.getUTC());
final AbsoluteDate finalDate = new AbsoluteDate(new DateComponents(2004, 01, 02), TimeComponents.H00, TimeScalesFactory.getUTC());
double deltaT = finalDate.durationFrom(initDate);
Orbit transPar = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
int nbIntervals = 720;
EcksteinHechlerPropagator eck = new EcksteinHechlerPropagator(transPar, mass, ae, mu, c20, c30, c40, c50, c60);
AdditionalStateProvider provider = new AdditionalStateProvider() {
public String getName() {
return "dt";
}
public double[] getAdditionalState(SpacecraftState state) {
return new double[] { state.getDate().durationFrom(initDate) };
}
};
eck.addAdditionalStateProvider(provider);
try {
eck.addAdditionalStateProvider(provider);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.ADDITIONAL_STATE_NAME_ALREADY_IN_USE, oe.getSpecifier());
}
List<SpacecraftState> tab = new ArrayList<SpacecraftState>(nbIntervals + 1);
for (int j = 0; j <= nbIntervals; j++) {
AbsoluteDate current = initDate.shiftedBy((j * deltaT) / nbIntervals);
tab.add(f.filter(eck.propagate(current)));
}
try {
new Ephemeris(tab, nbIntervals + 2);
Assert.fail("an exception should have been thrown");
} catch (MathIllegalArgumentException miae) {
// expected
}
Ephemeris te = new Ephemeris(tab, 2);
Assert.assertEquals(0.0, te.getMaxDate().durationFrom(finalDate), 1.0e-9);
Assert.assertEquals(0.0, te.getMinDate().durationFrom(initDate), 1.0e-9);
double maxP = 0;
double maxV = 0;
for (double dt = 0; dt < 3600; dt += 1) {
AbsoluteDate date = initDate.shiftedBy(dt);
CartesianOrbit c1 = (CartesianOrbit) eck.propagate(date).getOrbit();
CartesianOrbit c2 = (CartesianOrbit) te.propagate(date).getOrbit();
maxP = FastMath.max(maxP, Vector3D.distance(c1.getPVCoordinates().getPosition(), c2.getPVCoordinates().getPosition()));
maxV = FastMath.max(maxV, Vector3D.distance(c1.getPVCoordinates().getVelocity(), c2.getPVCoordinates().getVelocity()));
}
Assert.assertEquals(expectedDP, maxP, 0.1 * expectedDP);
Assert.assertEquals(expectedDV, maxV, 0.1 * expectedDV);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class TLETest method testBug77TooLargeSecondDerivative.
@Test
public void testBug77TooLargeSecondDerivative() throws OrekitException {
try {
TLE tle = new TLE(5555, 'U', 1971, 86, "J", 0, 908, new AbsoluteDate(new DateComponents(2012, 26), new TimeComponents(0.96078249 * Constants.JULIAN_DAY), TimeScalesFactory.getUTC()), taylorConvert(12.26882470, 1), taylorConvert(-0.00000004, 2), taylorConvert(0.99999e11, 3), 0.0075476, FastMath.toRadians(74.0161), FastMath.toRadians(328.9888), FastMath.toRadians(228.9750), FastMath.toRadians(30.6709), 80454, 0.01234e-9);
tle.getLine1();
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.TLE_INVALID_PARAMETER, oe.getSpecifier());
Assert.assertEquals(5555, ((Integer) oe.getParts()[0]).intValue());
Assert.assertEquals("meanMotionSecondDerivative", oe.getParts()[1]);
}
}
Aggregations