use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class DragForceTest method testJacobianBoxVs80Implementation.
@Test
public void testJacobianBoxVs80Implementation() 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 DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true))), new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
SpacecraftState state = new SpacecraftState(orbit, Propagator.DEFAULT_LAW.getAttitude(orbit, orbit.getDate(), orbit.getFrame()));
checkStateJacobianVs80Implementation(state, forceModel, new LofOffset(state.getFrame(), LOFType.VVLH), 5e-6, false);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class MarshallSolarActivityFutureEstimationTest method testFileDate.
@Test
public void testFileDate() throws OrekitException {
MarshallSolarActivityFutureEstimation msafe = loadMsafe(MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE);
Assert.assertEquals(new DateComponents(2010, Month.NOVEMBER, 1), msafe.getFileDate(new AbsoluteDate("2010-05-01", utc)));
Assert.assertEquals(new DateComponents(2010, Month.DECEMBER, 1), msafe.getFileDate(new AbsoluteDate("2010-06-01", utc)));
Assert.assertEquals(new DateComponents(2011, Month.JANUARY, 1), msafe.getFileDate(new AbsoluteDate("2010-07-01", utc)));
Assert.assertEquals(new DateComponents(2011, Month.JANUARY, 1), msafe.getFileDate(new AbsoluteDate("2030-01-01", utc)));
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class HarrisPriesterTest method setUp.
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
sun = CelestialBodyFactory.getSun();
earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
earth = new OneAxisEllipsoid(6378136.460, 1.0 / 298.257222101, earthFrame);
// Equinoxe 21 mars 2003 à 1h00m
utc = TimeScalesFactory.getUTC();
date = new AbsoluteDate(new DateComponents(2003, 03, 21), new TimeComponents(1, 0, 0.), utc);
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class NRLMSISE00Test method testDensityGradient.
@Test
public void testDensityGradient() throws OrekitException {
// Build the input params provider
final InputParams ip = new InputParams();
// Get Sun
final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
// Get Earth body shape
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
// Build the model
final NRLMSISE00 atm = new NRLMSISE00(ip, sun, earth);
// Build the date
final AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 172), new TimeComponents(29000.), TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true));
// Build the position
final double alt = 400.;
final double lat = 60.;
final double lon = -70.;
final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(lat), FastMath.toRadians(lon), alt * 1000.);
final Vector3D pos = earth.transform(point);
// Run
DerivativeStructure zero = new DSFactory(1, 1).variable(0, 0.0);
FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(5, 10.0);
DerivativeStructure rhoX = differentiator.differentiate((double x) -> {
try {
return atm.getDensity(date, new Vector3D(1, pos, x, Vector3D.PLUS_I), itrf);
} catch (OrekitException oe) {
return Double.NaN;
}
}).value(zero);
DerivativeStructure rhoY = differentiator.differentiate((double y) -> {
try {
return atm.getDensity(date, new Vector3D(1, pos, y, Vector3D.PLUS_J), itrf);
} catch (OrekitException oe) {
return Double.NaN;
}
}).value(zero);
DerivativeStructure rhoZ = differentiator.differentiate((double z) -> {
try {
return atm.getDensity(date, new Vector3D(1, pos, z, Vector3D.PLUS_K), itrf);
} catch (OrekitException oe) {
return Double.NaN;
}
}).value(zero);
DSFactory factory3 = new DSFactory(3, 1);
Field<DerivativeStructure> field = factory3.getDerivativeField();
final DerivativeStructure rhoDS = atm.getDensity(new FieldAbsoluteDate<>(field, date), new FieldVector3D<>(factory3.variable(0, pos.getX()), factory3.variable(1, pos.getY()), factory3.variable(2, pos.getZ())), itrf);
Assert.assertEquals(rhoX.getValue(), rhoDS.getReal(), rhoX.getValue() * 2.0e-13);
Assert.assertEquals(rhoY.getValue(), rhoDS.getReal(), rhoY.getValue() * 2.0e-13);
Assert.assertEquals(rhoZ.getValue(), rhoDS.getReal(), rhoZ.getValue() * 2.0e-13);
Assert.assertEquals(rhoX.getPartialDerivative(1), rhoDS.getPartialDerivative(1, 0, 0), FastMath.abs(2.0e-10 * rhoX.getPartialDerivative(1)));
Assert.assertEquals(rhoY.getPartialDerivative(1), rhoDS.getPartialDerivative(0, 1, 0), FastMath.abs(2.0e-10 * rhoY.getPartialDerivative(1)));
Assert.assertEquals(rhoZ.getPartialDerivative(1), rhoDS.getPartialDerivative(0, 0, 1), FastMath.abs(2.0e-10 * rhoY.getPartialDerivative(1)));
}
use of org.orekit.time.DateComponents in project Orekit by CS-SI.
the class NRLMSISE00Test method testDensityField.
@Test
public void testDensityField() throws OrekitException {
// Build the input params provider
final InputParams ip = new InputParams();
// Get Sun
final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
// Get Earth body shape
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, itrf);
// Build the model
final NRLMSISE00 atm = new NRLMSISE00(ip, sun, earth);
// Build the date
final AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 172), new TimeComponents(29000.), TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true));
// Build the position
final double alt = 400.;
final double lat = 60.;
final double lon = -70.;
final GeodeticPoint point = new GeodeticPoint(FastMath.toRadians(lat), FastMath.toRadians(lon), alt * 1000.);
final Vector3D pos = earth.transform(point);
Field<Decimal64> field = Decimal64Field.getInstance();
// Run
final double rho = atm.getDensity(date, pos, itrf);
final Decimal64 rho64 = atm.getDensity(new FieldAbsoluteDate<>(field, date), new FieldVector3D<>(field.getOne(), pos), itrf);
Assert.assertEquals(rho, rho64.getReal(), rho * 2.0e-13);
}
Aggregations