use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider in project Orekit by CS-SI.
the class DSSTPropagatorTest method testMeanToOsculatingState.
@Test
public void testMeanToOsculatingState() throws IllegalArgumentException, OrekitException {
final SpacecraftState meanState = getGEOState();
final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(2, 0);
final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
final DSSTForceModel zonal = new DSSTZonal(provider, 2, 1, 5);
final DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 2, 0, 0, 2, 2, 0, 0);
final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
forces.add(zonal);
forces.add(tesseral);
final SpacecraftState osculatingState = DSSTPropagator.computeOsculatingState(meanState, null, forces);
Assert.assertEquals(1559.1, Vector3D.distance(meanState.getPVCoordinates().getPosition(), osculatingState.getPVCoordinates().getPosition()), 1.0);
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider in project Orekit by CS-SI.
the class DSSTPropagatorTest method testHighDegreesSetting.
@Test
public void testHighDegreesSetting() throws OrekitException {
Utils.setDataRoot("regular-data:potential/grgs-format");
GravityFieldFactory.addPotentialCoefficientsReader(new GRGSFormatReader("grim4s4_gr", true));
int earthDegree = 36;
int earthOrder = 36;
int eccPower = 4;
final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(earthDegree, earthOrder);
final org.orekit.frames.Frame earthFrame = // terrestrial frame
FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final DSSTForceModel force = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, earthDegree, earthOrder, eccPower, earthDegree + eccPower, earthDegree, earthOrder, eccPower);
final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
forces.add(force);
TimeScale tai = TimeScalesFactory.getTAI();
AbsoluteDate initialDate = new AbsoluteDate("2015-07-01", tai);
Frame eci = FramesFactory.getGCRF();
KeplerianOrbit orbit = new KeplerianOrbit(7120000.0, 1.0e-3, FastMath.toRadians(60.0), FastMath.toRadians(120.0), FastMath.toRadians(47.0), FastMath.toRadians(12.0), PositionAngle.TRUE, eci, initialDate, Constants.EIGEN5C_EARTH_MU);
SpacecraftState oscuState = DSSTPropagator.computeOsculatingState(new SpacecraftState(orbit), null, forces);
Assert.assertEquals(7119927.097122, oscuState.getA(), 0.001);
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider in project Orekit by CS-SI.
the class DSSTPropagatorTest method testGetInitialOsculatingState.
@Test
public void testGetInitialOsculatingState() throws IllegalArgumentException, OrekitException {
final SpacecraftState initialState = getGEOState();
// build integrator
final double minStep = initialState.getKeplerianPeriod() * 0.1;
final double maxStep = initialState.getKeplerianPeriod() * 10.0;
final double[][] tol = DSSTPropagator.tolerances(0.1, initialState.getOrbit());
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
// build the propagator for the propagation of the mean elements
DSSTPropagator prop = new DSSTPropagator(integrator, true);
final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(4, 0);
final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
DSSTForceModel zonal = new DSSTZonal(provider, 4, 3, 9);
DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 4, 0, 4, 8, 4, 0, 2);
prop.addForceModel(zonal);
prop.addForceModel(tesseral);
// Set the initial state as osculating
prop.setInitialState(initialState, false);
// Check the stored initial state is the osculating one
Assert.assertEquals(initialState, prop.getInitialState());
// Check that no propagation, i.e. propagation to the initial date, provides the initial
// osculating state although the propagator is configured to propagate mean elements !!!
Assert.assertEquals(initialState, prop.propagate(initialState.getDate()));
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider in project Orekit by CS-SI.
the class IntegratedEphemerisTest method doTestSerializationDSST.
private void doTestSerializationDSST(boolean meanOnly, int expectedSize) throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate finalDate = initialOrbit.getDate().shiftedBy(Constants.JULIAN_DAY);
final double[][] tol = DSSTPropagator.tolerances(1.0, initialOrbit);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(10, Constants.JULIAN_DAY, tol[0], tol[1]);
DSSTPropagator dsstProp = new DSSTPropagator(integrator, meanOnly);
dsstProp.setInitialState(new SpacecraftState(initialOrbit), false);
dsstProp.setEphemerisMode();
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final UnnormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getUnnormalizedProvider(8, 8);
final CelestialBody sun = CelestialBodyFactory.getSun();
final CelestialBody moon = CelestialBodyFactory.getMoon();
final RadiationSensitive spacecraft = new IsotropicRadiationSingleCoefficient(20.0, 2.0);
dsstProp.addForceModel(new DSSTZonal(gravity, 8, 7, 17));
dsstProp.addForceModel(new DSSTTesseral(itrf, Constants.WGS84_EARTH_ANGULAR_VELOCITY, gravity, 8, 8, 4, 12, 8, 8, 4));
dsstProp.addForceModel(new DSSTThirdBody(sun));
dsstProp.addForceModel(new DSSTThirdBody(moon));
dsstProp.addForceModel(new DSSTSolarRadiationPressure(sun, Constants.WGS84_EARTH_EQUATORIAL_RADIUS, spacecraft));
dsstProp.propagate(finalDate);
IntegratedEphemeris ephemeris = (IntegratedEphemeris) dsstProp.getGeneratedEphemeris();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
Assert.assertTrue("size = " + bos.size(), bos.size() > 9 * expectedSize / 10);
Assert.assertTrue("size = " + bos.size(), bos.size() < 11 * expectedSize / 10);
Assert.assertNotNull(ephemeris.getFrame());
Assert.assertSame(ephemeris.getFrame(), dsstProp.getFrame());
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
IntegratedEphemeris deserialized = (IntegratedEphemeris) ois.readObject();
Assert.assertEquals(deserialized.getMinDate(), deserialized.getMinDate());
Assert.assertEquals(deserialized.getMaxDate(), deserialized.getMaxDate());
}
use of org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider in project Orekit by CS-SI.
the class FieldEcksteinHechlerPropagatorTest method doAlmostSphericalBody.
private <T extends RealFieldElement<T>> void doAlmostSphericalBody(Field<T> field) throws OrekitException {
T zero = field.getZero();
FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field);
// Definition of initial conditions
// ---------------------------------
// with e around e = 1.4e-4 and i = 1.7 rad
FieldVector3D<T> position = new FieldVector3D<>(zero.add(3220103.), zero.add(69623.), zero.add(6449822.));
FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(6414.7), zero.add(-2006.), zero.add(-3180.));
FieldAbsoluteDate<T> initDate = date.shiftedBy(584.);
FieldOrbit<T> initialOrbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, provider.getMu());
// Initialisation to simulate a Keplerian extrapolation
// To be noticed: in order to simulate a Keplerian extrapolation with the
// analytical
// extrapolator, one should put the zonal coefficients to 0. But due to
// numerical pbs
// one must put a non 0 value.
UnnormalizedSphericalHarmonicsProvider kepProvider = GravityFieldFactory.getUnnormalizedProvider(6.378137e6, 3.9860047e14, TideSystem.UNKNOWN, new double[][] { { 0 }, { 0 }, { 0.1e-10 }, { 0.1e-13 }, { 0.1e-13 }, { 0.1e-14 }, { 0.1e-14 } }, new double[][] { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } });
// Extrapolators definitions
// -------------------------
FieldEcksteinHechlerPropagator<T> extrapolatorAna = new FieldEcksteinHechlerPropagator<>(initialOrbit, kepProvider);
FieldKeplerianPropagator<T> extrapolatorKep = new FieldKeplerianPropagator<>(initialOrbit);
// Extrapolation at a final date different from initial date
// ---------------------------------------------------------
// extrapolation duration in seconds
double delta_t = 100.0;
FieldAbsoluteDate<T> extrapDate = initDate.shiftedBy(delta_t);
FieldSpacecraftState<T> finalOrbitAna = extrapolatorAna.propagate(extrapDate);
FieldSpacecraftState<T> finalOrbitKep = extrapolatorKep.propagate(extrapDate);
Assert.assertEquals(finalOrbitAna.getDate().durationFrom(extrapDate).getReal(), 0.0, Utils.epsilonTest);
// comparison of each orbital parameters
Assert.assertEquals(finalOrbitAna.getA().getReal(), finalOrbitKep.getA().getReal(), 10 * Utils.epsilonTest * finalOrbitKep.getA().getReal());
Assert.assertEquals(finalOrbitAna.getEquinoctialEx().getReal(), finalOrbitKep.getEquinoctialEx().getReal(), Utils.epsilonE * finalOrbitKep.getE().getReal());
Assert.assertEquals(finalOrbitAna.getEquinoctialEy().getReal(), finalOrbitKep.getEquinoctialEy().getReal(), Utils.epsilonE * finalOrbitKep.getE().getReal());
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbitAna.getHx().getReal(), finalOrbitKep.getHx().getReal()), finalOrbitKep.getHx().getReal(), Utils.epsilonAngle * FastMath.abs(finalOrbitKep.getI().getReal()));
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbitAna.getHy().getReal(), finalOrbitKep.getHy().getReal()), finalOrbitKep.getHy().getReal(), Utils.epsilonAngle * FastMath.abs(finalOrbitKep.getI().getReal()));
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbitAna.getLv().getReal(), finalOrbitKep.getLv().getReal()), finalOrbitKep.getLv().getReal(), Utils.epsilonAngle * FastMath.abs(finalOrbitKep.getLv().getReal()));
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbitAna.getLE().getReal(), finalOrbitKep.getLE().getReal()), finalOrbitKep.getLE().getReal(), Utils.epsilonAngle * FastMath.abs(finalOrbitKep.getLE().getReal()));
Assert.assertEquals(MathUtils.normalizeAngle(finalOrbitAna.getLM().getReal(), finalOrbitKep.getLM().getReal()), finalOrbitKep.getLM().getReal(), Utils.epsilonAngle * FastMath.abs(finalOrbitKep.getLM().getReal()));
}
Aggregations