use of org.orekit.forces.radiation.RadiationSensitive 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.radiation.RadiationSensitive in project Orekit by CS-SI.
the class IntegratedEphemerisTest method testSerializationNumerical.
@Test
public void testSerializationNumerical() throws OrekitException, IOException, ClassNotFoundException {
AbsoluteDate finalDate = initialOrbit.getDate().shiftedBy(Constants.JULIAN_DAY);
numericalPropagator.setEphemerisMode();
numericalPropagator.setInitialState(new SpacecraftState(initialOrbit));
final Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final NormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getNormalizedProvider(8, 8);
final CelestialBody sun = CelestialBodyFactory.getSun();
final CelestialBody moon = CelestialBodyFactory.getMoon();
final RadiationSensitive spacecraft = new IsotropicRadiationSingleCoefficient(20.0, 2.0);
numericalPropagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, gravity));
numericalPropagator.addForceModel(new ThirdBodyAttraction(sun));
numericalPropagator.addForceModel(new ThirdBodyAttraction(moon));
numericalPropagator.addForceModel(new SolarRadiationPressure(sun, Constants.WGS84_EARTH_EQUATORIAL_RADIUS, spacecraft));
numericalPropagator.propagate(finalDate);
IntegratedEphemeris ephemeris = (IntegratedEphemeris) numericalPropagator.getGeneratedEphemeris();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(ephemeris);
int expectedSize = 258223;
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(), numericalPropagator.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.radiation.RadiationSensitive in project Orekit by CS-SI.
the class DSSTPropagation method setForceModel.
/**
* Set numerical propagator force models
*
* @param parser input file parser
* @param normalized spherical harmonics provider
* @param earthFrame Earth rotating frame
* @param numProp numerical propagator
* @throws IOException
* @throws OrekitException
*/
private void setForceModel(final KeyValueFileParser<ParameterKey> parser, final NormalizedSphericalHarmonicsProvider normalized, final Frame earthFrame, final NumericalPropagator numProp) throws IOException, OrekitException {
final double ae = normalized.getAe();
final int degree = parser.getInt(ParameterKey.CENTRAL_BODY_DEGREE);
final int order = parser.getInt(ParameterKey.CENTRAL_BODY_ORDER);
if (order > degree) {
throw new IOException("Potential order cannot be higher than potential degree");
}
// Central Body (normalized coefficients)
numProp.addForceModel(new HolmesFeatherstoneAttractionModel(earthFrame, normalized));
// 3rd body (SUN)
if (parser.containsKey(ParameterKey.THIRD_BODY_SUN) && parser.getBoolean(ParameterKey.THIRD_BODY_SUN)) {
numProp.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun()));
}
// 3rd body (MOON)
if (parser.containsKey(ParameterKey.THIRD_BODY_MOON) && parser.getBoolean(ParameterKey.THIRD_BODY_MOON)) {
numProp.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
}
// Drag
if (parser.containsKey(ParameterKey.DRAG) && parser.getBoolean(ParameterKey.DRAG)) {
final OneAxisEllipsoid earth = new OneAxisEllipsoid(ae, Constants.WGS84_EARTH_FLATTENING, earthFrame);
final Atmosphere atm = new HarrisPriester(CelestialBodyFactory.getSun(), earth, 6);
final DragSensitive ssc = new IsotropicDrag(parser.getDouble(ParameterKey.DRAG_SF), parser.getDouble(ParameterKey.DRAG_CD));
numProp.addForceModel(new DragForce(atm, ssc));
}
// Solar Radiation Pressure
if (parser.containsKey(ParameterKey.SOLAR_RADIATION_PRESSURE) && parser.getBoolean(ParameterKey.SOLAR_RADIATION_PRESSURE)) {
final double cR = parser.getDouble(ParameterKey.SOLAR_RADIATION_PRESSURE_CR);
final RadiationSensitive ssc = new IsotropicRadiationSingleCoefficient(parser.getDouble(ParameterKey.SOLAR_RADIATION_PRESSURE_SF), cR);
numProp.addForceModel(new SolarRadiationPressure(CelestialBodyFactory.getSun(), ae, ssc));
}
}
Aggregations