use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class IERSConventionsTest method testTidalCorrection2010.
@Test
public void testTidalCorrection2010() throws OrekitException {
// the reference value has been computed using the September 2007 version
// of interp.f from ftp://hpiers.obspm.fr/iers/models/ adding input/output
// parameters for LOD (which was already computed in the underlying routines),
// with the following driver program:
//
// PROGRAM OR_TEST
// IMPLICIT NONE
// INTEGER J, N
// PARAMETER (N = 4)
// INTEGER MJD(N)
// DOUBLE PRECISION TTTAI, TAIUTC
// PARAMETER (TAIUTC = 32.000D0)
// PARAMETER (TTTAI = 32.184D0)
// DOUBLE PRECISION RJD(N), UT1(N), LOD(N), X(N), Y(N), H(5)
// DOUBLE PRECISION RJD_INT, UT1_INT, LOD_INT, X_INT, Y_INT
// DATA(MJD(J), UT1(J), LOD(J), X(J), Y(J),
// & J=1,4)/
// & 52653, -0.2979055D0, 0.0005744D0, -0.120344D0, 0.217095D0,
// & 52654, -0.2984238D0, 0.0004224D0, -0.121680D0, 0.219400D0,
// & 52655, -0.2987682D0, 0.0002878D0, -0.122915D0, 0.221760D0,
// & 52656, -0.2989957D0, 0.0001778D0, -0.124248D0, 0.224294D0/
// C
// DATA(H(J),J=1,5)/0.0D0, 3600.0D0, 7200.0D0, 43200.0D0, 86400.0D0/
// C
// DO 10 J = 1, N
// RJD(J) = MJD(J) + (TTTAI + TAIUTC) / 86400.0D0
// 10 CONTINUE
// C
// DO 20 J = 1, 5
// RJD_INT = RJD(2) + H(J) / 86400.0D0
// CALL INTERP(RJD,X,Y,UT1,LOD,N,
// & RJD_INT,X_INT,Y_INT,UT1_INT,LOD_INT)
// WRITE(6, 30) H(J),UT1_INT,LOD_INT,X_INT,Y_INT
// 20 CONTINUE
// 30 FORMAT(F7.1,4(1X, F20.17))
// C
// END PROGRAM
//
// the output of this test reads:
// 0.0 -0.29840026968370659 0.00045312852893139 -0.12196223480123573 0.21922730818562719
// 3600.0 -0.29841834564816189 0.00041710864863793 -0.12213345007640604 0.21927433626001305
// 7200.0 -0.29843503870494986 0.00039207574457087 -0.12222881007999241 0.21932415788122142
// 43200.0 -0.29866930257052676 0.00042895046506082 -0.12247697694276605 0.22105450666130921
// 86400.0 -0.29874235341010519 0.00035460263868306 -0.12312252389660779 0.22161364352515728
Utils.setLoaders(IERSConventions.IERS_2010, Utils.buildEOPList(IERSConventions.IERS_2010, ITRFVersion.ITRF_2008, new double[][] { { 52653, -0.2979055, 0.0005744, -0.120344, 0.217095, 0.0, 0.0, 0.0, 0.0 }, { 52654, -0.2984238, 0.0004224, -0.121680, 0.219400, 0.0, 0.0, 0.0, 0.0 }, { 52655, -0.2987682, 0.0002878, -0.122915, 0.221760, 0.0, 0.0, 0.0, 0.0 }, { 52656, -0.2989957, 0.0001778, -0.124248, 0.224294, 0.0, 0.0, 0.0, 0.0 } }));
EOPHistory eopHistory = FramesFactory.getEOPHistory(IERSConventions.IERS_2010, false);
final AbsoluteDate t0 = new AbsoluteDate(new DateComponents(DateComponents.MODIFIED_JULIAN_EPOCH, 52654), TimeScalesFactory.getUTC());
for (double[] row : new double[][] { { 0.0, -0.29840026968370659, 0.00045312852893139, -0.12196223480123573, 0.21922730818562719 }, { 3600.0, -0.29841834564816189, 0.00041710864863793, -0.12213345007640604, 0.21927433626001305 }, { 7200.0, -0.29843503870494986, 0.00039207574457087, -0.12222881007999241, 0.21932415788122142 }, { 43200.0, -0.29866930257052676, 0.00042895046506082, -0.12247697694276605, 0.22105450666130921 }, { 86400.0, -0.29874235341010519, 0.00035460263868306, -0.12312252389660779, 0.22161364352515728 } }) {
AbsoluteDate date = t0.shiftedBy(row[0]);
Assert.assertEquals(row[1], eopHistory.getUT1MinusUTC(date), 2.5e-12);
Assert.assertEquals(row[2], eopHistory.getLOD(date), 4.3e-11);
Assert.assertEquals(row[3] * Constants.ARC_SECONDS_TO_RADIANS, eopHistory.getPoleCorrection(date).getXp(), 1.6e-10);
Assert.assertEquals(row[4] * Constants.ARC_SECONDS_TO_RADIANS, eopHistory.getPoleCorrection(date).getYp(), 0.7e-10);
}
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class JPLEphemeridesLoader method extractDate.
/**
* Extract a date from a record.
* @param record record to parse
* @param offset offset of the double within the record
* @return extracted date
*/
private AbsoluteDate extractDate(final byte[] record, final int offset) {
final double t = extractDouble(record, offset);
int jDay = (int) FastMath.floor(t);
double seconds = (t + 0.5 - jDay) * Constants.JULIAN_DAY;
if (seconds >= Constants.JULIAN_DAY) {
++jDay;
seconds -= Constants.JULIAN_DAY;
}
return new AbsoluteDate(new DateComponents(DateComponents.JULIAN_EPOCH, jDay), new TimeComponents(seconds), timeScale);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class ThirdBodyAttractionTest method testGlobalStateJacobian.
@Test
public void testGlobalStateJacobian() 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);
OrbitType integrationType = OrbitType.CARTESIAN;
double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, integrationType);
NumericalPropagator propagator = new NumericalPropagator(new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
propagator.setOrbitType(integrationType);
final CelestialBody moon = CelestialBodyFactory.getMoon();
final ThirdBodyAttraction forceModel = new ThirdBodyAttraction(moon);
propagator.addForceModel(forceModel);
SpacecraftState state0 = new SpacecraftState(orbit);
checkStateJacobian(propagator, state0, date.shiftedBy(3.5 * 3600.0), 1e4, tolerances[0], 2.0e-9);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class ThirdBodyAttractionTest method testSunContrib.
@Test(expected = OrekitException.class)
public void testSunContrib() throws OrekitException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 07, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
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(), date, mu);
double period = 2 * FastMath.PI * orbit.getA() * FastMath.sqrt(orbit.getA() / orbit.getMu());
// set up propagator
NumericalPropagator calc = new NumericalPropagator(new GraggBulirschStoerIntegrator(10.0, period, 0, 1.0e-5));
calc.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun()));
// set up step handler to perform checks
calc.setMasterMode(FastMath.floor(period), new ReferenceChecker(date) {
protected double hXRef(double t) {
return -1.06757e-3 + 0.221415e-11 * t + 18.9421e-5 * FastMath.cos(3.9820426e-7 * t) - 7.59983e-5 * FastMath.sin(3.9820426e-7 * t);
}
protected double hYRef(double t) {
return 1.43526e-3 + 7.49765e-11 * t + 6.9448e-5 * FastMath.cos(3.9820426e-7 * t) + 17.6083e-5 * FastMath.sin(3.9820426e-7 * t);
}
});
AbsoluteDate finalDate = date.shiftedBy(365 * period);
calc.setInitialState(new SpacecraftState(orbit));
calc.propagate(finalDate);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class ConstantThrustManeuverTest method testForwardAndBackward.
@Test
public void testForwardAndBackward() throws OrekitException {
final double isp = 318;
final double mass = 2500;
final double a = 24396159;
final double e = 0.72831215;
final double i = FastMath.toRadians(7);
final double omega = FastMath.toRadians(180);
final double OMEGA = FastMath.toRadians(261);
final double lv = 0;
final double duration = 3653.99;
final double f = 420;
final double delta = FastMath.toRadians(-7.4978);
final double alpha = FastMath.toRadians(351);
final AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(alpha, delta), Vector3D.PLUS_I));
final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
final Orbit orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
final AbsoluteDate fireDate = new AbsoluteDate(new DateComponents(2004, 01, 02), new TimeComponents(04, 15, 34.080), TimeScalesFactory.getUTC());
final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);
Assert.assertEquals(f, maneuver.getThrust(), 1.0e-10);
Assert.assertEquals(isp, maneuver.getISP(), 1.0e-10);
double[][] tol = NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
AdaptiveStepsizeIntegrator integrator1 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
integrator1.setInitialStepSize(60);
final NumericalPropagator propagator1 = new NumericalPropagator(integrator1);
propagator1.setInitialState(initialState);
propagator1.setAttitudeProvider(law);
propagator1.addForceModel(maneuver);
final SpacecraftState finalState = propagator1.propagate(fireDate.shiftedBy(3800));
AdaptiveStepsizeIntegrator integrator2 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
integrator2.setInitialStepSize(60);
final NumericalPropagator propagator2 = new NumericalPropagator(integrator2);
propagator2.setInitialState(finalState);
propagator2.setAttitudeProvider(law);
propagator2.addForceModel(maneuver);
final SpacecraftState recoveredState = propagator2.propagate(orbit.getDate());
final Vector3D refPosition = initialState.getPVCoordinates().getPosition();
final Vector3D recoveredPosition = recoveredState.getPVCoordinates().getPosition();
Assert.assertEquals(0.0, Vector3D.distance(refPosition, recoveredPosition), 30.0);
Assert.assertEquals(initialState.getMass(), recoveredState.getMass(), 1.5e-10);
}
Aggregations