use of org.orekit.time.TimeComponents 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.TimeComponents 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.TimeComponents 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);
}
use of org.orekit.time.TimeComponents in project Orekit by CS-SI.
the class HolmesFeatherstoneAttractionModelTest method testZonalWithCunninghamReference.
// test the difference with the Cunningham model
@Test
@Deprecated
public void testZonalWithCunninghamReference() throws OrekitException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(2000, 07, 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, mu);
propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(1000));
propagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { normalizedC20 }, { normalizedC30 }, { normalizedC40 }, { normalizedC50 }, { normalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
propagator.setInitialState(new SpacecraftState(orbit));
SpacecraftState hfOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
propagator.removeForceModels();
propagator.addForceModel(new CunninghamAttractionModel(itrf, GravityFieldFactory.getUnnormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { unnormalizedC20 }, { unnormalizedC30 }, { unnormalizedC40 }, { unnormalizedC50 }, { unnormalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
propagator.setInitialState(new SpacecraftState(orbit));
SpacecraftState cOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
Vector3D dif = hfOrb.getPVCoordinates().getPosition().subtract(cOrb.getPVCoordinates().getPosition());
Assert.assertEquals(0, dif.getNorm(), 2e-9);
Assert.assertTrue(propagator.getCalls() < 400);
}
use of org.orekit.time.TimeComponents in project Orekit by CS-SI.
the class HolmesFeatherstoneAttractionModelTest method testStateJacobianVsFiniteDifferences.
@Test
public void testStateJacobianVsFiniteDifferences() throws OrekitException {
Utils.setDataRoot("regular-data:potential/grgs-format");
GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(2000, 07, 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, mu);
HolmesFeatherstoneAttractionModel hfModel = new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(50, 50));
Assert.assertEquals(TideSystem.UNKNOWN, hfModel.getTideSystem());
SpacecraftState state = new SpacecraftState(orbit);
checkStateJacobianVsFiniteDifferences(state, hfModel, Propagator.DEFAULT_LAW, 10.0, 2.0e-10, false);
}
Aggregations