Commit 4541aa61 authored by Louis Aucouturier's avatar Louis Aucouturier
Browse files

Test modification (DSST and improvements):

- Improveon documentation
- Adding DSST for parallel tests
- Code simplification
parent 4d1e8069
......@@ -36,6 +36,7 @@ import org.orekit.errors.OrekitException;
import org.orekit.forces.ForceModel;
import org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.ICGEMFormatReader;
import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider;
import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
import org.orekit.frames.FramesFactory;
......@@ -46,7 +47,9 @@ import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.analytical.EcksteinHechlerPropagator;
import org.orekit.propagation.events.DateDetector;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.DateComponents;
import org.orekit.time.TimeComponents;
......@@ -55,7 +58,55 @@ import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
public class PropagatorsParallelizerSeveralEphemerisTest {
public class PropagatorsParallelizerEphemerisTest {
private double mass;
private Orbit orbit;
private AttitudeProvider attitudeLaw;
private UnnormalizedSphericalHarmonicsProvider unnormalizedGravityField;
private NormalizedSphericalHarmonicsProvider normalizedGravityField;
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data:potential/icgem-format");
unnormalizedGravityField = GravityFieldFactory.getUnnormalizedProvider(6, 0);
normalizedGravityField = GravityFieldFactory.getNormalizedProvider(6, 0);
mass = 2500;
double a = 7187990.1979844316;
double e = 0.5e-4;
double i = 1.7105407051081795;
double omega = 1.9674147913622104;
double OMEGA = FastMath.toRadians(261);
double lv = 0;
AbsoluteDate date = new AbsoluteDate(new DateComponents(2004, 01, 01),
TimeComponents.H00,
TimeScalesFactory.getUTC());
orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE,
FramesFactory.getEME2000(), date, normalizedGravityField.getMu());
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, true));
attitudeLaw = new BodyCenterPointing(orbit.getFrame(), earth);
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
@After
public void tearDown() {
mass = Double.NaN;
orbit = null;
attitudeLaw = null;
unnormalizedGravityField = null;
normalizedGravityField = null;
}
/*
* Test set to check that ephemeris are produced at the end of the propagation parallelizer
......@@ -67,54 +118,44 @@ public class PropagatorsParallelizerSeveralEphemerisTest {
*
* Tests are based on Anne-Laure LUGAN's proposed test, and on PropagatorsParallelizerTest.
*/
@Test
public void testSeveralEphemeris() {
/*
* The closing behaviour is checked by verifying the presence of generated ephemeris as a result of the
* following process, using PropagatorsParallelizer.
*/
final AbsoluteDate startDate = orbit.getDate();
final AbsoluteDate endDate = startDate.shiftedBy(3600.0);
List<Propagator> propagators = Arrays.asList(buildNumerical(), buildNumerical(), buildNumerical());
List<EphemerisGenerator> generators = propagators.stream().map(Propagator::getEphemerisGenerator).collect(Collectors.toList());
PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(propagators, interpolators -> {
// Do nothing
});
parallelizer.propagate(startDate, endDate);
generators.stream().forEach(generator -> Assert.assertNotNull(generator.getGeneratedEphemeris()));
}
final AbsoluteDate endDate = startDate.shiftedBy(3600);
@Test
public void testSeveralEphemeris2() {
final AbsoluteDate startDate = orbit.getDate();
final AbsoluteDate endDate = startDate.shiftedBy(3600.015);
List<Propagator> propagators = Arrays.asList(buildNumerical(1,300), buildNumerical(0.1,300), buildNumerical(0.001,300), buildEcksteinHechler());
List<Propagator> propagators = Arrays.asList(buildNumerical(), buildNumerical(), buildDSST(), buildEcksteinHechler());
List<EphemerisGenerator> generators = propagators.stream().map(Propagator::getEphemerisGenerator).collect(Collectors.toList());
PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(propagators, interpolators -> {
// Do nothing
});
parallelizer.propagate(startDate, endDate);
generators.stream().forEach(generator -> Assert.assertNotNull(generator.getGeneratedEphemeris()));
AbsoluteDate lastDate = generators.get(0).getGeneratedEphemeris().getMaxDate();
AbsoluteDate firstDate = generators.get(0).getGeneratedEphemeris().getMinDate();
for ( EphemerisGenerator generator : generators ) {
Assert.assertEquals(lastDate, generator.getGeneratedEphemeris().getMaxDate());
Assert.assertEquals(firstDate, generator.getGeneratedEphemeris().getMinDate());
Assert.assertNotNull(generator.getGeneratedEphemeris());
Assert.assertEquals(endDate, generator.getGeneratedEphemeris().getMaxDate());
Assert.assertEquals(startDate, generator.getGeneratedEphemeris().getMinDate());
}
}
@Test
public void testSeveralEphemerisDateDetector() {
/*
* On observe un bug pour l'analytical propagator, qui quand il n'est pas en première position
* va provoquer un problème en indiquant comme date de fin, non pas la date de l'évènement
* The closing behaviour is checked for a stop event occuring during the propagation.
* The test isn't applied to analytical propagators as their behaviour differs.
* (Analytical propagator's ephemerides are the analytical propagators.)
*/
final AbsoluteDate startDate = orbit.getDate();
final AbsoluteDate endDate = startDate.shiftedBy(3600);
List<Propagator> propagators = Arrays.asList(buildNumerical(1,300), buildNumerical(0.1,300), buildNumerical(0.001,300));
DateDetector dateDetect = new DateDetector(startDate.shiftedBy(1800));
final AbsoluteDate endDate = startDate.shiftedBy(3600.015);
List<Propagator> propagators = Arrays.asList(buildNumerical(1,300), buildNumerical(0.001,300), buildDSST());
propagators.stream().forEach(propagator -> propagator.addEventDetector(dateDetect));
// Add new instance of event with same date. DateDetector behaviour at event is stop.
AbsoluteDate detectorDate = startDate.shiftedBy(1800);
propagators.stream().forEach(propagator -> propagator.addEventDetector(new DateDetector(detectorDate)));
List<EphemerisGenerator> generators = propagators.stream().map(Propagator::getEphemerisGenerator).collect(Collectors.toList());
PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(propagators, interpolators -> {
......@@ -122,92 +163,69 @@ public class PropagatorsParallelizerSeveralEphemerisTest {
});
parallelizer.propagate(startDate, endDate);
generators.stream().forEach(generator -> Assert.assertNotNull(generator.getGeneratedEphemeris()));
AbsoluteDate firstDate = generators.get(0).getGeneratedEphemeris().getMinDate();
AbsoluteDate lastDate = generators.get(0).getGeneratedEphemeris().getMaxDate();
// Check for all generators
for ( EphemerisGenerator generator : generators ) {
Assert.assertEquals(firstDate, generator.getGeneratedEphemeris().getMinDate());
Assert.assertEquals(lastDate, generator.getGeneratedEphemeris().getMaxDate());
Assert.assertNotNull(generator.getGeneratedEphemeris());
Assert.assertEquals(startDate, generator.getGeneratedEphemeris().getMinDate());
Assert.assertEquals(detectorDate, generator.getGeneratedEphemeris().getMaxDate());
}
}
private EcksteinHechlerPropagator buildEcksteinHechler() {
return new EcksteinHechlerPropagator(orbit, attitudeLaw, mass, unnormalizedGravityField);
}
private DSSTPropagator buildDSST(final double minStep, final double maxStep) {
// Gravity
Utils.setDataRoot("regular-data:potential/icgem-format");
GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("^eigen-6s-truncated$", false));
UnnormalizedSphericalHarmonicsProvider gravity = GravityFieldFactory.getUnnormalizedProvider(8, 8);
// Propagator
final double[][] tol = DSSTPropagator.tolerances(0.01, orbit);
final DSSTPropagator propagator = new DSSTPropagator(new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]), PropagationType.MEAN);
// Force models
final DSSTForceModel zonal = new DSSTZonal(gravity, 4, 3, 9);
propagator.addForceModel(zonal);
propagator.setInitialState(new SpacecraftState(orbit));
return propagator;
}
private DSSTPropagator buildDSST() {
return buildDSST(0.01,300);
}
private NumericalPropagator buildNumerical() {
return buildNumerical(0.001,300);
}
private NumericalPropagator buildNumerical(double minStep, double maxStep) {
NumericalPropagator numericalPropagator = buildNotInitializedNumerical(minStep, maxStep);
numericalPropagator.setInitialState(new SpacecraftState(orbit,
attitudeLaw.getAttitude(orbit,
orbit.getDate(),
orbit.getFrame()),
mass));
attitudeLaw.getAttitude(orbit,
orbit.getDate(),
orbit.getFrame()),
mass));
return numericalPropagator;
}
private NumericalPropagator buildNotInitializedNumerical(double minStep, double maxStep) {
OrbitType type = OrbitType.CARTESIAN;
double[][] tolerances = NumericalPropagator.tolerances(10.0, orbit, type);
ODEIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tolerances[0], tolerances[1]);
NumericalPropagator numericalPropagator = new NumericalPropagator(integrator);
ForceModel gravity = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true),
normalizedGravityField);
normalizedGravityField);
numericalPropagator.addForceModel(gravity);
return numericalPropagator;
}
@Before
public void setUp() {
try {
Utils.setDataRoot("regular-data:potential/icgem-format");
unnormalizedGravityField = GravityFieldFactory.getUnnormalizedProvider(6, 0);
normalizedGravityField = GravityFieldFactory.getNormalizedProvider(6, 0);
mass = 2500;
double a = 7187990.1979844316;
double e = 0.5e-4;
double i = 1.7105407051081795;
double omega = 1.9674147913622104;
double OMEGA = FastMath.toRadians(261);
double lv = 0;
AbsoluteDate date = new AbsoluteDate(new DateComponents(2004, 01, 01),
TimeComponents.H00,
TimeScalesFactory.getUTC());
orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE,
FramesFactory.getEME2000(), date, normalizedGravityField.getMu());
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, true));
attitudeLaw = new BodyCenterPointing(orbit.getFrame(), earth);
} catch (OrekitException oe) {
Assert.fail(oe.getLocalizedMessage());
}
}
@After
public void tearDown() {
mass = Double.NaN;
orbit = null;
attitudeLaw = null;
unnormalizedGravityField = null;
normalizedGravityField = null;
}
private double mass;
private Orbit orbit;
private AttitudeProvider attitudeLaw;
private UnnormalizedSphericalHarmonicsProvider unnormalizedGravityField;
private NormalizedSphericalHarmonicsProvider normalizedGravityField;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment