Commit de540de7 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Brouwer-Lyddane model uses keplerian parameter rates during propagation.

parent 448bd1d0
......@@ -550,21 +550,21 @@ public class BrouwerLyddanePropagator extends AbstractAnalyticalPropagator {
while (i++ < 200) {
// recompute the osculating parameters from the current mean parameters
final UnivariateDerivative2[] parameters = current.propagateParameters(current.mean.getDate());
final KeplerianOrbit parameters = current.propagateParameters(current.mean.getDate());
// adapted parameters residuals
final double deltaA = osculating.getA() - parameters[0].getValue();
final double deltaE = osculating.getE() - parameters[1].getValue();
final double deltaI = osculating.getI() - parameters[2].getValue();
final double deltaA = osculating.getA() - parameters.getA();
final double deltaE = osculating.getE() - parameters.getE();
final double deltaI = osculating.getI() - parameters.getI();
final double deltaOmega = MathUtils.normalizeAngle(osculating.getPerigeeArgument() -
parameters[3].getValue(),
0.0);
parameters.getPerigeeArgument(),
0.0);
final double deltaRAAN = MathUtils.normalizeAngle(osculating.getRightAscensionOfAscendingNode() -
parameters[4].getValue(),
0.0);
parameters.getRightAscensionOfAscendingNode(),
0.0);
final double deltaAnom = MathUtils.normalizeAngle(osculating.getMeanAnomaly() -
parameters[5].getValue(),
0.0);
parameters.getMeanAnomaly(),
0.0);
// update mean parameters
......@@ -594,14 +594,9 @@ public class BrouwerLyddanePropagator extends AbstractAnalyticalPropagator {
/** {@inheritDoc} */
public KeplerianOrbit propagateOrbit(final AbsoluteDate date) {
// compute Cartesian parameters, taking derivatives into account
// to make sure velocity and acceleration are consistent
// compute keplerian parameters, taking derivatives into account
final BLModel current = models.get(date);
final UnivariateDerivative2[] propOrb_parameters = current.propagateParameters(date);
return new KeplerianOrbit(propOrb_parameters[0].getValue(), propOrb_parameters[1].getValue(),
propOrb_parameters[2].getValue(), propOrb_parameters[3].getValue(),
propOrb_parameters[4].getValue(), propOrb_parameters[5].getValue(),
PositionAngle.MEAN, current.mean.getFrame(), date, mu);
return current.propagateParameters(date);
}
/**
......@@ -1082,7 +1077,7 @@ public class BrouwerLyddanePropagator extends AbstractAnalyticalPropagator {
* @param date target date for the orbit
* @return propagated parameters
*/
public UnivariateDerivative2[] propagateParameters(final AbsoluteDate date) {
public KeplerianOrbit propagateParameters(final AbsoluteDate date) {
// Empirical drag coefficient M2
final double m2 = M2Driver.getValue();
......@@ -1240,7 +1235,12 @@ public class BrouwerLyddanePropagator extends AbstractAnalyticalPropagator {
// Argument of perigee
final UnivariateDerivative2 g = g_p_l.subtract(l);
return new UnivariateDerivative2[] { a, e, i, g, h, l };
// Return a Keplerian orbit
return new KeplerianOrbit(a.getValue(), e.getValue(), i.getValue(),
g.getValue(), h.getValue(), l.getValue(),
a.getFirstDerivative(), e.getFirstDerivative(), i.getFirstDerivative(),
g.getFirstDerivative(), h.getFirstDerivative(), l.getFirstDerivative(),
PositionAngle.MEAN, mean.getFrame(), date, mu);
}
......
......@@ -25,7 +25,6 @@ import org.hipparchus.analysis.differentiation.FieldUnivariateDerivative2;
import org.hipparchus.util.CombinatoricsUtils;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.FieldSinCos;
import org.hipparchus.util.MathArrays;
import org.hipparchus.util.MathUtils;
import org.hipparchus.util.Precision;
import org.orekit.attitudes.AttitudeProvider;
......@@ -549,15 +548,15 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
while (i++ < 200) {
// recompute the osculating parameters from the current mean parameters
final FieldUnivariateDerivative2<T>[] parameters = current.propagateParameters(current.mean.getDate(), getParameters(mass.getField()));
final FieldKeplerianOrbit<T> parameters = current.propagateParameters(current.mean.getDate(), getParameters(mass.getField()));
// adapted parameters residuals
final T deltaA = osculating.getA() .subtract(parameters[0].getValue());
final T deltaE = osculating.getE() .subtract(parameters[1].getValue());
final T deltaI = osculating.getI() .subtract(parameters[2].getValue());
final T deltaOmega = MathUtils.normalizeAngle(osculating.getPerigeeArgument().subtract(parameters[3].getValue()), zero);
final T deltaRAAN = MathUtils.normalizeAngle(osculating.getRightAscensionOfAscendingNode().subtract(parameters[4].getValue()), zero);
final T deltaAnom = MathUtils.normalizeAngle(osculating.getMeanAnomaly().subtract(parameters[5].getValue()), zero);
final T deltaA = osculating.getA() .subtract(parameters.getA());
final T deltaE = osculating.getE() .subtract(parameters.getE());
final T deltaI = osculating.getI() .subtract(parameters.getI());
final T deltaOmega = MathUtils.normalizeAngle(osculating.getPerigeeArgument().subtract(parameters.getPerigeeArgument()), zero);
final T deltaRAAN = MathUtils.normalizeAngle(osculating.getRightAscensionOfAscendingNode().subtract(parameters.getRightAscensionOfAscendingNode()), zero);
final T deltaAnom = MathUtils.normalizeAngle(osculating.getMeanAnomaly().subtract(parameters.getMeanAnomaly()), zero);
// update mean parameters
......@@ -588,13 +587,8 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
/** {@inheritDoc} */
public FieldKeplerianOrbit<T> propagateOrbit(final FieldAbsoluteDate<T> date, final T[] parameters) {
// compute Cartesian parameters, taking derivatives into account
// to make sure velocity and acceleration are consistent
final FieldBLModel<T> current = models.get(date);
final FieldUnivariateDerivative2<T>[] propOrb_parameters = current.propagateParameters(date, parameters);
return new FieldKeplerianOrbit<T>(propOrb_parameters[0].getValue(), propOrb_parameters[1].getValue(),
propOrb_parameters[2].getValue(), propOrb_parameters[3].getValue(),
propOrb_parameters[4].getValue(), propOrb_parameters[5].getValue(),
PositionAngle.MEAN, current.mean.getFrame(), date, mu);
return current.propagateParameters(date, parameters);
}
/**
......@@ -614,6 +608,9 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
/** Constant mass. */
private final T mass;
/** Central attraction coefficient. */
private final T mu;
// CHECKSTYLE: stop JavadocVariable check
// preprocessed values
......@@ -712,6 +709,7 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
this.mean = mean;
this.mass = mass;
this.mu = mu;
final T one = mass.getField().getOne();
final T app = mean.getA();
......@@ -1036,7 +1034,7 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
* @param parameters model parameters
* @return propagated parameters
*/
public FieldUnivariateDerivative2<T>[] propagateParameters(final FieldAbsoluteDate<T> date, final T[] parameters) {
public FieldKeplerianOrbit<T> propagateParameters(final FieldAbsoluteDate<T> date, final T[] parameters) {
// Field
final Field<T> field = date.getField();
......@@ -1199,14 +1197,13 @@ public class FieldBrouwerLyddanePropagator<T extends CalculusFieldElement<T>> ex
// Argument of perigee
final FieldUnivariateDerivative2<T> g = g_p_l.subtract(l);
final FieldUnivariateDerivative2<T>[] FTD = MathArrays.buildArray(g.getField(), 6);
FTD[0] = a;
FTD[1] = e;
FTD[2] = i;
FTD[3] = g;
FTD[4] = h;
FTD[5] = l;
return FTD;
// Return a keplerian orbit
return new FieldKeplerianOrbit<>(a.getValue(), e.getValue(), i.getValue(),
g.getValue(), h.getValue(), l.getValue(),
a.getFirstDerivative(), e.getFirstDerivative(), i.getFirstDerivative(),
g.getFirstDerivative(), h.getFirstDerivative(), l.getFirstDerivative(),
PositionAngle.MEAN, mean.getFrame(), date, this.mu);
}
}
......
......@@ -252,7 +252,7 @@ public class BrouwerLyddaneBatchLSEstimatorTest {
BrouwerLyddaneEstimationTestUtils.checkFit(context, estimator, 1, 2,
0.0, 7.9e-8,
0.0, 1.1e-7,
0.0, 1.4e-5,
0.0, 1.5e-5,
0.0, 1.4e-8);
}
......
......@@ -120,7 +120,7 @@ public class BrouwerLyddaneParametersDerivativesTest {
sM4h, sM3h, sM2h, sM1h, sP1h, sP2h, sP3h, sP4h);
for (int i = 0; i < 6; ++i) {
Assert.assertEquals(0.0, (dYdPRef[i][0] - dYdP.getEntry(i, 0)) / dYdPRef[i][0], 8.49e-13);
Assert.assertEquals(0.0, (dYdPRef[i][0] - dYdP.getEntry(i, 0)) / dYdPRef[i][0], 8.78e-13);
}
}
......
......@@ -73,12 +73,12 @@ public class BrouwerLyddanePropagatorTest {
Assert.assertEquals(0.0,
Vector3D.distance(initialOrbit.getPVCoordinates().getPosition(),
finalOrbit.getPVCoordinates().getPosition()),
1.0e-8);
3.6e-9);
Assert.assertEquals(0.0,
Vector3D.distance(initialOrbit.getPVCoordinates().getVelocity(),
finalOrbit.getPVCoordinates().getVelocity()),
1.0e-11);
3.8e-12);
Assert.assertEquals(0.0, finalOrbit.getA() - initialOrbit.getA(), 0.0);
}
......@@ -102,12 +102,12 @@ public class BrouwerLyddanePropagatorTest {
Assert.assertEquals(0.0,
Vector3D.distance(initialOrbit.getPVCoordinates().getPosition(),
finalOrbit.getPVCoordinates().getPosition()),
1.0e-8);
7.0e-9);
Assert.assertEquals(0.0,
Vector3D.distance(initialOrbit.getPVCoordinates().getVelocity(),
finalOrbit.getPVCoordinates().getVelocity()),
1.0e-11);
7.0e-12);
Assert.assertEquals(0.0, finalOrbit.getA() - initialOrbit.getA(), 0.0);
}
......@@ -242,15 +242,15 @@ public class BrouwerLyddanePropagatorTest {
SpacecraftState BLFinalState = BLextrapolator.propagate(initDate.shiftedBy(timeshift));
final KeplerianOrbit BLOrbit = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(BLFinalState.getOrbit());
Assert.assertEquals(NumOrbit.getA(), BLOrbit.getA(), 0.072);
Assert.assertEquals(NumOrbit.getA(), BLOrbit.getA(), 0.070);
Assert.assertEquals(NumOrbit.getE(), BLOrbit.getE(), 0.00000028);
Assert.assertEquals(NumOrbit.getI(), BLOrbit.getI(), 0.000004);
Assert.assertEquals(NumOrbit.getI(), BLOrbit.getI(), 0.000000053);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getPerigeeArgument(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getPerigeeArgument(), FastMath.PI), 0.119);
MathUtils.normalizeAngle(BLOrbit.getPerigeeArgument(), FastMath.PI), 0.0021);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getRightAscensionOfAscendingNode(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getRightAscensionOfAscendingNode(), FastMath.PI), 0.000072);
MathUtils.normalizeAngle(BLOrbit.getRightAscensionOfAscendingNode(), FastMath.PI), 0.0000013);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getTrueAnomaly(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getTrueAnomaly(), FastMath.PI), 0.12);
MathUtils.normalizeAngle(BLOrbit.getTrueAnomaly(), FastMath.PI), 0.0021);
}
@Test
......
......@@ -109,7 +109,7 @@ public class BrouwerLyddaneStateTransitionMatrixTest {
for (int j = 0; j < 6; ++j) {
if (stateVector[i] != 0) {
double error = FastMath.abs((dYdY0.getEntry(i, j) - dYdY0Ref[i][j]) / stateVector[i]) * steps[j];
Assert.assertEquals(0, error, 5.15e-14);
Assert.assertEquals(0, error, 1.42e-13);
}
}
}
......
......@@ -82,12 +82,12 @@ public class FieldBrouwerLyddanePropagatorTest {
Assert.assertEquals(0.0,
FieldVector3D.distance(initialOrbit.getPVCoordinates().getPosition(),
finalOrbit.getPVCoordinates().getPosition()).getReal(),
1.0e-8);
5.3e-9);
Assert.assertEquals(0.0,
FieldVector3D.distance(initialOrbit.getPVCoordinates().getVelocity(),
finalOrbit.getPVCoordinates().getVelocity()).getReal(),
1.0e-11);
4.6e-12);
Assert.assertEquals(0.0, finalOrbit.getA().getReal() - initialOrbit.getA().getReal(), 0.0);
}
......@@ -117,12 +117,12 @@ public class FieldBrouwerLyddanePropagatorTest {
Assert.assertEquals(0.0,
FieldVector3D.distance(initialOrbit.getPVCoordinates().getPosition(),
finalOrbit.getPVCoordinates().getPosition()).getReal(),
1.1e-8);
3.5e-9);
Assert.assertEquals(0.0,
FieldVector3D.distance(initialOrbit.getPVCoordinates().getVelocity(),
finalOrbit.getPVCoordinates().getVelocity()).getReal(),
1.4e-11);
5.1e-12);
Assert.assertEquals(0.0, finalOrbit.getA().getReal() - initialOrbit.getA().getReal(), 0.0);
}
......@@ -270,15 +270,15 @@ public class FieldBrouwerLyddanePropagatorTest {
final KeplerianOrbit BLOrbit = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(BLFinalState.getOrbit().toOrbit());
Assert.assertEquals(NumOrbit.getA(), BLOrbit.getA(), 0.072);
Assert.assertEquals(NumOrbit.getA(), BLOrbit.getA(), 0.070);
Assert.assertEquals(NumOrbit.getE(), BLOrbit.getE(), 0.00000028);
Assert.assertEquals(NumOrbit.getI(), BLOrbit.getI(), 0.000004);
Assert.assertEquals(NumOrbit.getI(), BLOrbit.getI(), 0.000000053);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getPerigeeArgument(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getPerigeeArgument(), FastMath.PI), 0.119);
MathUtils.normalizeAngle(BLOrbit.getPerigeeArgument(), FastMath.PI), 0.0021);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getRightAscensionOfAscendingNode(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getRightAscensionOfAscendingNode(), FastMath.PI), 0.000072);
MathUtils.normalizeAngle(BLOrbit.getRightAscensionOfAscendingNode(), FastMath.PI), 0.0000013);
Assert.assertEquals(MathUtils.normalizeAngle(NumOrbit.getTrueAnomaly(), FastMath.PI),
MathUtils.normalizeAngle(BLOrbit.getTrueAnomaly(), FastMath.PI), 0.12);
MathUtils.normalizeAngle(BLOrbit.getTrueAnomaly(), FastMath.PI), 0.0021);
}
@Test
......
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