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

Deprecated older State Transition Matrix and Jacobians API.

parent b825598d
......@@ -26,7 +26,6 @@ import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.conversion.OrbitDeterminationPropagatorBuilder;
import org.orekit.propagation.numerical.JacobiansMapper;
import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.propagation.numerical.PartialDerivativesEquations;
import org.orekit.utils.ParameterDriversList;
/** Bridge between {@link ObservedMeasurement measurements} and {@link
......@@ -65,7 +64,8 @@ public class BatchLSModel extends AbstractBatchLSModel {
@Deprecated
protected JacobiansMapper configureDerivatives(final Propagator propagator) {
final PartialDerivativesEquations partials = new PartialDerivativesEquations(STM_NAME, (NumericalPropagator) propagator);
final org.orekit.propagation.numerical.PartialDerivativesEquations partials =
new org.orekit.propagation.numerical.PartialDerivativesEquations(STM_NAME, (NumericalPropagator) propagator);
// add the derivatives to the initial state
final SpacecraftState rawState = propagator.getInitialState();
......
......@@ -26,7 +26,6 @@ import org.orekit.propagation.Propagator;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.conversion.OrbitDeterminationPropagatorBuilder;
import org.orekit.propagation.semianalytical.dsst.DSSTJacobiansMapper;
import org.orekit.propagation.semianalytical.dsst.DSSTPartialDerivativesEquations;
import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
import org.orekit.utils.ParameterDriversList;
......@@ -84,8 +83,8 @@ public class DSSTBatchLSModel extends AbstractBatchLSModel {
@Deprecated
protected DSSTJacobiansMapper configureDerivatives(final Propagator propagator) {
final DSSTPartialDerivativesEquations partials =
new DSSTPartialDerivativesEquations(STM_NAME, (DSSTPropagator) propagator, propagationType);
final org.orekit.propagation.semianalytical.dsst.DSSTPartialDerivativesEquations partials =
new org.orekit.propagation.semianalytical.dsst.DSSTPartialDerivativesEquations(STM_NAME, (DSSTPropagator) propagator, propagationType);
// add the derivatives to the initial state
final SpacecraftState rawState = propagator.getInitialState();
......
......@@ -55,6 +55,7 @@ import org.orekit.utils.ParameterDriver;
* @author Bryan Cazabonne
* @since 10.2
*/
@SuppressWarnings("deprecation")
public class AbsolutePartialDerivativesEquations extends PartialDerivativesEquations {
/** Name. */
......
......@@ -61,8 +61,11 @@ import org.orekit.utils.ParameterDriversList;
* </p>
* @author V&eacute;ronique Pommier-Maurussane
* @author Luc Maisonobe
* @deprecated as of 11.1, replaced by {@link
* org.orekit.propagation.PropagatorPropagator#setupMatricesComputation(String,
* org.hipparchus.linear.RealMatrix, org.orekit.utils.DoubleArrayDictionary)}
*/
@SuppressWarnings("deprecation")
@Deprecated
public class PartialDerivativesEquations
implements AdditionalDerivativesProvider,
org.orekit.propagation.integration.AdditionalEquations {
......
......@@ -51,8 +51,11 @@ import org.orekit.utils.ParameterDriversList;
* </p>
* @author Bryan Cazabonne
* @since 10.0
* @deprecated as of 11.1, replaced by {@link
* org.orekit.propagation.PropagatorPropagator#setupMatricesComputation(String,
* org.hipparchus.linear.RealMatrix, org.orekit.utils.DoubleArrayDictionary)}
*/
@SuppressWarnings("deprecation")
@Deprecated
public class DSSTPartialDerivativesEquations
implements AdditionalDerivativesProvider,
org.orekit.propagation.integration.AdditionalEquations {
......
......@@ -68,6 +68,7 @@ public class AbsolutePartialDerivativesEquationsTest {
/**
* set up {@link #pde} and dependencies.
*/
@SuppressWarnings("deprecation")
@Before
public void setUp() {
propagator = new NumericalPropagator(new DormandPrince54Integrator(1, 500, 0.001, 0.001));
......@@ -86,6 +87,7 @@ public class AbsolutePartialDerivativesEquationsTest {
/**
* check {@link PartialDerivativesEquations#derivatives(SpacecraftState)} correctly sets the satellite velocity.
*/
@SuppressWarnings("deprecation")
@Test
public void testComputeDerivativesStateVelocity() {
//action
......
......@@ -47,6 +47,7 @@ import org.orekit.utils.PVCoordinates;
import org.orekit.utils.ParameterDriver;
/** Unit tests for {@link PartialDerivativesEquations}. */
@Deprecated
public class PartialDerivativesEquationsTest {
/** arbitrary date */
......
......@@ -67,6 +67,7 @@ import org.orekit.utils.PVCoordinates;
import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterDriversList;
@Deprecated
public class PartialDerivativesTest {
@Test
......
......@@ -19,7 +19,6 @@ package org.orekit.propagation.semianalytical.dsst;
import java.io.IOException;
import java.text.ParseException;
import org.hipparchus.linear.RealMatrix;
import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
import org.hipparchus.util.FastMath;
import org.junit.Assert;
......@@ -48,9 +47,7 @@ import org.orekit.propagation.numerical.NumericalPropagator;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTAtmosphericDrag;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTNewtonianAttraction;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTSolarRadiationPressure;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTThirdBody;
import org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.Constants;
......@@ -267,67 +264,4 @@ public class DSSTIntegrableJacobianColumnGeneratorTest {
return propagator;
}
/** Test to ensure correct Jacobian values.
* In MEAN case, Jacobian should be a 6x6 identity matrix.
* In OSCULATING cas, first and last lines are compared to reference values.
*/
@Test
public void testIssue713() {
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
DSSTForceModel tesseral = new DSSTTesseral(earthFrame,
Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider,
4, 4, 4, 8, 4, 4, 2);
DSSTForceModel zonal = new DSSTZonal(provider, 4, 3, 9);
DSSTForceModel srp = new DSSTSolarRadiationPressure(1.2, 100., CelestialBodyFactory.getSun(),
Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
provider.getMu());
DSSTForceModel moon = new DSSTThirdBody(CelestialBodyFactory.getMoon(), provider.getMu());
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
provider.getMu());
final EquinoctialOrbit orbit = (EquinoctialOrbit) OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
final OrbitType orbitType = OrbitType.EQUINOCTIAL;
// Test MEAN case
DSSTPropagator propagatorMEAN = setUpPropagator(PropagationType.MEAN, orbit, dP, orbitType, srp, tesseral, zonal, moon);
propagatorMEAN.setMu(provider.getMu());
SpacecraftState initialStateMEAN = new SpacecraftState(orbit);
propagatorMEAN.setInitialState(initialStateMEAN);
DSSTHarvester harvesterMEAN = (DSSTHarvester) propagatorMEAN.setupMatricesComputation("stm", null, null);
harvesterMEAN.setReferenceState(initialStateMEAN);
SpacecraftState finalMEAN = propagatorMEAN.propagate(initialStateMEAN.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0MEAN = harvesterMEAN.getStateTransitionMatrix(finalMEAN);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j) {
Assert.assertEquals(i == j ? 1.0 : 0.0, dYdY0MEAN.getEntry(i, j), 1e-9);
}
}
// Test OSCULATING case
DSSTPropagator propagatorOSC = setUpPropagator(PropagationType.OSCULATING, orbit, dP, orbitType, srp, tesseral, zonal, moon);
propagatorOSC.setMu(provider.getMu());
final SpacecraftState initialStateOSC = new SpacecraftState(orbit);
propagatorOSC.setInitialState(initialStateOSC);
DSSTHarvester harvesterOCS = (DSSTHarvester) propagatorOSC.setupMatricesComputation("stm", null, null);
harvesterOCS.setReferenceState(initialStateOSC);
SpacecraftState finalOSC = propagatorOSC.propagate(initialStateOSC.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0OSC = harvesterOCS.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);
}
}
}
......@@ -63,6 +63,7 @@ import org.orekit.utils.IERSConventions;
import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterDriversList;
@Deprecated
public class DSSTPartialDerivativesTest {
@Test
......@@ -499,7 +500,6 @@ public class DSSTPartialDerivativesTest {
checkState(finalState);
}
@SuppressWarnings("deprecation")
private void checkState(final SpacecraftState state) {
Assert.assertEquals(1, state.getAdditionalStatesValues().size());
Assert.assertEquals(mapper.getName(), state.getAdditionalStatesValues().getData().get(0).getKey());
......@@ -515,7 +515,6 @@ public class DSSTPartialDerivativesTest {
* In MEAN case, Jacobian should be a 6x6 identity matrix.
* In OSCULATING cas, first and last lines are compared to reference values.
*/
@SuppressWarnings("deprecation")
@Test
public void testIssue713() {
UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(5, 5);
......
......@@ -29,7 +29,6 @@ import org.orekit.Utils;
import org.orekit.attitudes.Attitude;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.forces.gravity.potential.GravityFieldFactory;
import org.orekit.forces.gravity.potential.SHMFormatReader;
import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
......@@ -146,94 +145,6 @@ public class DSSTStateTransitionMatrixGeneratorTest {
}
}
@Test(expected=OrekitException.class)
public void testNotInitialized() {
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
Constants.EIGEN5C_EARTH_MU);
final Orbit orbit = OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
DSSTPropagator propagator =
setUpPropagator(PropagationType.MEAN, orbit, dP, OrbitType.EQUINOCTIAL);
new DSSTPartialDerivativesEquations("partials", propagator, PropagationType.MEAN).getMapper();
}
@Test(expected=OrekitException.class)
public void testTooSmallDimension() {
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
Constants.EIGEN5C_EARTH_MU);
final Orbit orbit = OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
DSSTPropagator propagator =
setUpPropagator(PropagationType.MEAN, orbit, dP, OrbitType.EQUINOCTIAL);
DSSTPartialDerivativesEquations partials = new DSSTPartialDerivativesEquations("partials", propagator, PropagationType.MEAN);
partials.setInitialJacobians(new SpacecraftState(orbit),
new double[5][6], new double[6][2]);
}
@Test(expected=OrekitException.class)
public void testTooLargeDimension() {
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
Constants.EIGEN5C_EARTH_MU);
final Orbit orbit = OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
DSSTPropagator propagator =
setUpPropagator(PropagationType.MEAN, orbit, dP, OrbitType.EQUINOCTIAL);
DSSTPartialDerivativesEquations partials = new DSSTPartialDerivativesEquations("partials", propagator, PropagationType.MEAN);
partials.setInitialJacobians(new SpacecraftState(orbit),
new double[8][6], new double[6][2]);
}
@Test(expected=OrekitException.class)
public void testMismatchedDimensions() {
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
Constants.EIGEN5C_EARTH_MU);
final Orbit orbit = OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
DSSTPropagator propagator =
setUpPropagator(PropagationType.MEAN, orbit, dP, OrbitType.EQUINOCTIAL);
DSSTPartialDerivativesEquations partials = new DSSTPartialDerivativesEquations("partials", propagator, PropagationType.MEAN);
partials.setInitialJacobians(new SpacecraftState(orbit),
new double[6][6], new double[7][2]);
}
@Test
public void testWrongParametersDimension() {
Orbit initialOrbit =
new KeplerianOrbit(8000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.MEAN,
FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH,
Constants.EIGEN5C_EARTH_MU);
final Orbit orbit = OrbitType.EQUINOCTIAL.convertType(initialOrbit);
double dP = 0.001;
DSSTForceModel sunAttraction = new DSSTThirdBody(CelestialBodyFactory.getSun(), Constants.EIGEN5C_EARTH_MU);
DSSTForceModel moonAttraction = new DSSTThirdBody(CelestialBodyFactory.getMoon(), Constants.EIGEN5C_EARTH_MU);
DSSTPropagator propagator =
setUpPropagator(PropagationType.MEAN, orbit, dP, OrbitType.EQUINOCTIAL,
sunAttraction, moonAttraction);
DSSTPartialDerivativesEquations partials = new DSSTPartialDerivativesEquations("partials", propagator, PropagationType.MEAN);
try {
partials.setInitialJacobians(new SpacecraftState(orbit),
new double[6][6], new double[6][3]);
partials.derivatives(new SpacecraftState(orbit));
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.INITIAL_MATRIX_AND_PARAMETERS_NUMBER_MISMATCH,
oe.getSpecifier());
}
}
private void fillJacobianColumn(double[][] jacobian, int column,
OrbitType orbitType, double h,
SpacecraftState sM4h, SpacecraftState sM3h,
......@@ -330,12 +241,12 @@ public class DSSTStateTransitionMatrixGeneratorTest {
// Test MEAN case
DSSTPropagator propagatorMEAN = setUpPropagator(PropagationType.MEAN, orbit, dP, orbitType, srp, tesseral, zonal, moon);
propagatorMEAN.setMu(provider.getMu());
DSSTPartialDerivativesEquations partialsMEAN = new DSSTPartialDerivativesEquations("partials", propagatorMEAN, PropagationType.MEAN);
final SpacecraftState initialStateMEAN =
partialsMEAN.setInitialJacobians(new SpacecraftState(orbit));
final DSSTJacobiansMapper mapperMEAN = partialsMEAN.getMapper();
mapperMEAN.setReferenceState(initialStateMEAN);
RealMatrix dYdY0MEAN = mapperMEAN.getStateTransitionMatrix(initialStateMEAN);
SpacecraftState initialStateMEAN = new SpacecraftState(orbit);
propagatorMEAN.setInitialState(initialStateMEAN);
DSSTHarvester harvesterMEAN = (DSSTHarvester) propagatorMEAN.setupMatricesComputation("stm", null, null);
harvesterMEAN.setReferenceState(initialStateMEAN);
SpacecraftState finalMEAN = propagatorMEAN.propagate(initialStateMEAN.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0MEAN = harvesterMEAN.getStateTransitionMatrix(finalMEAN);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j) {
Assert.assertEquals(i == j ? 1.0 : 0.0, dYdY0MEAN.getEntry(i, j), 1e-9);
......@@ -345,12 +256,12 @@ public class DSSTStateTransitionMatrixGeneratorTest {
// Test OSCULATING case
DSSTPropagator propagatorOSC = setUpPropagator(PropagationType.OSCULATING, orbit, dP, orbitType, srp, tesseral, zonal, moon);
propagatorOSC.setMu(provider.getMu());
DSSTPartialDerivativesEquations partialsOSC = new DSSTPartialDerivativesEquations("partials", propagatorOSC, PropagationType.OSCULATING);
final SpacecraftState initialStateOSC =
partialsOSC.setInitialJacobians(new SpacecraftState(orbit));
final DSSTJacobiansMapper mapperOSC = partialsOSC.getMapper();
mapperOSC.setReferenceState(initialStateOSC);
RealMatrix dYdY0OSC = mapperOSC.getStateTransitionMatrix(initialStateOSC);
final SpacecraftState initialStateOSC = new SpacecraftState(orbit);
propagatorOSC.setInitialState(initialStateOSC);
DSSTHarvester harvesterOCS = (DSSTHarvester) propagatorOSC.setupMatricesComputation("stm", null, null);
harvesterOCS.setReferenceState(initialStateOSC);
SpacecraftState finalOSC = propagatorOSC.propagate(initialStateOSC.getDate()); // dummy zero duration propagation, to ensure haverster initialization
RealMatrix dYdY0OSC = harvesterOCS.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) {
......
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