Commit da389790 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Improved test coverage.

parent 4875c3cc
......@@ -299,6 +299,13 @@ public class DSSTStateTransitionMatrixGeneratorTest {
propagatorMEAN.setMu(provider.getMu());
SpacecraftState initialStateMEAN = propagatorMEAN.getInitialState();
DSSTHarvester harvesterMEAN = (DSSTHarvester) propagatorMEAN.setupMatricesComputation("stm", null, null);
propagatorMEAN.
getAllForceModels().
forEach(fm -> fm.
getParametersDrivers().
stream().
filter(d -> d.getName().equals(RadiationSensitive.REFLECTION_COEFFICIENT)).
forEach(d -> d.setSelected(true)));
harvesterMEAN.setReferenceState(initialStateMEAN);
SpacecraftState finalMEAN = propagatorMEAN.propagate(initialStateMEAN.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0MEAN = harvesterMEAN.getStateTransitionMatrix(finalMEAN);
......@@ -307,21 +314,41 @@ public class DSSTStateTransitionMatrixGeneratorTest {
Assert.assertEquals(i == j ? 1.0 : 0.0, dYdY0MEAN.getEntry(i, j), 1e-9);
}
}
RealMatrix dYdPMEAN = harvesterMEAN.getParametersJacobian(finalMEAN);
Assert.assertEquals(6, dYdPMEAN.getRowDimension());
Assert.assertEquals(1, dYdPMEAN.getColumnDimension());
for (int i = 0; i < 6; ++i) {
Assert.assertEquals(0.0, dYdPMEAN.getEntry(i, 0), 1e-9);
}
// Test OSCULATING case
DSSTPropagator propagatorOSC = setUpPropagator(PropagationType.OSCULATING, dP, provider);
propagatorOSC.setMu(provider.getMu());
final SpacecraftState initialStateOSC = propagatorOSC.getInitialState();
DSSTHarvester harvesterOCS = (DSSTHarvester) propagatorOSC.setupMatricesComputation("stm", null, null);
harvesterOCS.setReferenceState(initialStateOSC);
DSSTHarvester harvesterOSC = (DSSTHarvester) propagatorOSC.setupMatricesComputation("stm", null, null);
propagatorOSC.
getAllForceModels().
forEach(fm -> fm.
getParametersDrivers().
stream().
filter(d -> d.getName().equals(RadiationSensitive.REFLECTION_COEFFICIENT)).
forEach(d -> d.setSelected(true)));
harvesterOSC.setReferenceState(initialStateOSC);
SpacecraftState finalOSC = propagatorOSC.propagate(initialStateOSC.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0OSC = harvesterOCS.getStateTransitionMatrix(finalOSC);
RealMatrix dYdY0OSC = harvesterOSC.getStateTransitionMatrix(finalOSC);
final double[] refLine1 = new double[] {1.0000, -5750.3478, 15270.6488, -2707.1208, -2165.0148, -178.3653};
final double[] refLine6 = new double[] {0.0000, 0.0035, 0.0013, -0.0005, 0.0005, 1.0000};
for (int i = 0; i < 6; ++i) {
Assert.assertEquals(refLine1[i], dYdY0OSC.getEntry(0, i), 1e-4);
Assert.assertEquals(refLine6[i], dYdY0OSC.getEntry(5, i), 1e-4);
}
RealMatrix dYdPOSC = harvesterOSC.getParametersJacobian(finalOSC);
final double[] refCol = new double[] { 0.813996593833, -16.479e-9, -2.901e-9, 7.801e-9, 1.901e-9, -26.769e-9};
Assert.assertEquals(6, dYdPOSC.getRowDimension());
Assert.assertEquals(1, dYdPOSC.getColumnDimension());
for (int i = 0; i < 6; ++i) {
Assert.assertEquals(refCol[i], dYdPOSC.getEntry(i, 0), 1e-12);
}
}
......
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