Skip to content
Snippets Groups Projects
Commit a14c70d2 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Merge branch 'issue-859' into release-11.0

parents fc708dcc 059716a6
No related branches found
No related tags found
No related merge requests found
...@@ -269,6 +269,9 @@ ...@@ -269,6 +269,9 @@
<contributor> <contributor>
<name>Lars N&#230;sbye Christensen</name> <name>Lars N&#230;sbye Christensen</name>
</contributor> </contributor>
<contributor>
<name>Emmanuel Papanagiotou</name>
</contributor>
<contributor> <contributor>
<name>Thomas Paulet</name> <name>Thomas Paulet</name>
</contributor> </contributor>
......
...@@ -46,12 +46,24 @@ import org.orekit.utils.ParameterDriversList; ...@@ -46,12 +46,24 @@ import org.orekit.utils.ParameterDriversList;
*/ */
public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements OrbitDeterminationPropagatorBuilder { public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements OrbitDeterminationPropagatorBuilder {
/** Default value for epsilon. */
private static final double EPSILON_DEFAULT = 1.0e-10;
/** Default value for maxIterations. */
private static final int MAX_ITERATIONS_DEFAULT = 100;
/** Data context used to access frames and time scales. */ /** Data context used to access frames and time scales. */
private final DataContext dataContext; private final DataContext dataContext;
/** Template TLE. */ /** Template TLE. */
private final TLE templateTLE; private final TLE templateTLE;
/** Threshold for convergence used in TLE generation. */
private final double epsilon;
/** Maximum number of iterations for convergence used in TLE generation. */
private final int maxIterations;
/** Build a new instance. This constructor uses the {@link DataContext#getDefault() /** Build a new instance. This constructor uses the {@link DataContext#getDefault()
* default data context}. * default data context}.
* <p> * <p>
...@@ -61,6 +73,9 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O ...@@ -61,6 +73,9 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O
* classification, .... and is also used together with the {@code positionScale} to * classification, .... and is also used together with the {@code positionScale} to
* convert from the {@link ParameterDriver#setNormalizedValue(double) normalized} * convert from the {@link ParameterDriver#setNormalizedValue(double) normalized}
* parameters used by the callers of this builder to the real orbital parameters. * parameters used by the callers of this builder to the real orbital parameters.
* </p><p>
* Using this constructor, {@link #EPSILON_DEFAULT} and {@link #MAX_ITERATIONS_DEFAULT}
* are used for spacecraft's state to TLE transformation
* </p> * </p>
* @param templateTLE reference TLE from which real orbits will be built * @param templateTLE reference TLE from which real orbits will be built
* @param positionAngle position angle type to use * @param positionAngle position angle type to use
...@@ -83,6 +98,9 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O ...@@ -83,6 +98,9 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O
* classification, .... and is also used together with the {@code positionScale} to * classification, .... and is also used together with the {@code positionScale} to
* convert from the {@link ParameterDriver#setNormalizedValue(double) normalized} * convert from the {@link ParameterDriver#setNormalizedValue(double) normalized}
* parameters used by the callers of this builder to the real orbital parameters. * parameters used by the callers of this builder to the real orbital parameters.
* </p><p>
* Using this constructor, {@link #EPSILON_DEFAULT} and {@link #MAX_ITERATIONS_DEFAULT}
* are used for spacecraft's state to TLE transformation
* </p> * </p>
* @param templateTLE reference TLE from which real orbits will be built * @param templateTLE reference TLE from which real orbits will be built
* @param positionAngle position angle type to use * @param positionAngle position angle type to use
...@@ -90,11 +108,65 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O ...@@ -90,11 +108,65 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O
* (typically set to the expected standard deviation of the position) * (typically set to the expected standard deviation of the position)
* @param dataContext used to access frames and time scales. * @param dataContext used to access frames and time scales.
* @since 10.1 * @since 10.1
* @see #TLEPropagatorBuilder(TLE, PositionAngle, double, DataContext, double, int)
*/ */
public TLEPropagatorBuilder(final TLE templateTLE, public TLEPropagatorBuilder(final TLE templateTLE,
final PositionAngle positionAngle, final PositionAngle positionAngle,
final double positionScale, final double positionScale,
final DataContext dataContext) { final DataContext dataContext) {
this(templateTLE, positionAngle, positionScale, dataContext, EPSILON_DEFAULT, MAX_ITERATIONS_DEFAULT);
}
/** Build a new instance. This constructor uses the {@link DataContext#getDefault()
* default data context}.
* <p>
* The template TLE is used as a model to {@link
* #createInitialOrbit() create initial orbit}. It defines the
* inertial frame, the central attraction coefficient, orbit type, satellite number,
* classification, .... and is also used together with the {@code positionScale} to
* convert from the {@link ParameterDriver#setNormalizedValue(double) normalized}
* parameters used by the callers of this builder to the real orbital parameters.
* </p>
* @param templateTLE reference TLE from which real orbits will be built
* @param positionAngle position angle type to use
* @param positionScale scaling factor used for orbital parameters normalization
* (typically set to the expected standard deviation of the position)
* @param epsilon used to compute threshold for convergence check
* @param maxIterations maximum number of iterations for convergence
* @since 11.0.2
* @see #TLEPropagatorBuilder(TLE, PositionAngle, double, DataContext, double, int)
*/
@DefaultDataContext
public TLEPropagatorBuilder(final TLE templateTLE, final PositionAngle positionAngle,
final double positionScale, final double epsilon,
final int maxIterations) {
this(templateTLE, positionAngle, positionScale, DataContext.getDefault(), epsilon, maxIterations);
}
/** Build a new instance.
* <p>
* The template TLE is used as a model to {@link
* #createInitialOrbit() create initial orbit}. It defines the
* inertial frame, the central attraction coefficient, orbit type, satellite number,
* classification, .... and is also used together with the {@code positionScale} to
* convert from the {@link ParameterDriver#setNormalizedValue(double) normalized}
* parameters used by the callers of this builder to the real orbital parameters.
* </p>
* @param templateTLE reference TLE from which real orbits will be built
* @param positionAngle position angle type to use
* @param positionScale scaling factor used for orbital parameters normalization
* (typically set to the expected standard deviation of the position)
* @param dataContext used to access frames and time scales.
* @param epsilon used to compute threshold for convergence check
* @param maxIterations maximum number of iterations for convergence
* @since 11.0.2
*/
public TLEPropagatorBuilder(final TLE templateTLE,
final PositionAngle positionAngle,
final double positionScale,
final DataContext dataContext,
final double epsilon,
final int maxIterations) {
super(TLEPropagator.selectExtrapolator(templateTLE, dataContext.getFrames()) super(TLEPropagator.selectExtrapolator(templateTLE, dataContext.getFrames())
.getInitialState().getOrbit(), .getInitialState().getOrbit(),
positionAngle, positionScale, false, positionAngle, positionScale, false,
...@@ -102,9 +174,10 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O ...@@ -102,9 +174,10 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O
for (final ParameterDriver driver : templateTLE.getParametersDrivers()) { for (final ParameterDriver driver : templateTLE.getParametersDrivers()) {
addSupportedParameter(driver); addSupportedParameter(driver);
} }
this.templateTLE = templateTLE; this.templateTLE = templateTLE;
this.dataContext = dataContext; this.dataContext = dataContext;
this.epsilon = epsilon;
this.maxIterations = maxIterations;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
...@@ -119,7 +192,7 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O ...@@ -119,7 +192,7 @@ public class TLEPropagatorBuilder extends AbstractPropagatorBuilder implements O
final TimeScale utc = dataContext.getTimeScales().getUTC(); final TimeScale utc = dataContext.getTimeScales().getUTC();
// TLE related to the orbit // TLE related to the orbit
final TLE tle = TLE.stateToTLE(state, templateTLE, utc, teme); final TLE tle = TLE.stateToTLE(state, templateTLE, utc, teme, epsilon, maxIterations);
final List<ParameterDriver> drivers = templateTLE.getParametersDrivers(); final List<ParameterDriver> drivers = templateTLE.getParametersDrivers();
for (int index = 0; index < drivers.size(); index++) { for (int index = 0; index < drivers.size(); index++) {
if (drivers.get(index).isSelected()) { if (drivers.get(index).isSelected()) {
......
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
package org.orekit.propagation.conversion; package org.orekit.propagation.conversion;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.orekit.Utils; import org.orekit.Utils;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.orbits.PositionAngle; import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.analytical.tle.TLE; import org.orekit.propagation.analytical.tle.TLE;
import org.orekit.propagation.analytical.tle.TLEPropagator;
import org.orekit.utils.ParameterDriver; import org.orekit.utils.ParameterDriver;
public class TLEConverterTest { public class TLEConverterTest {
...@@ -28,7 +32,6 @@ public class TLEConverterTest { ...@@ -28,7 +32,6 @@ public class TLEConverterTest {
@Test @Test
public void testDeselectOrbitals() { public void testDeselectOrbitals() {
Utils.setDataRoot("regular-data");
final TLE tle = new TLE("1 27508U 02040A 12021.25695307 -.00000113 00000-0 10000-3 0 7326", final TLE tle = new TLE("1 27508U 02040A 12021.25695307 -.00000113 00000-0 10000-3 0 7326",
"2 27508 0.0571 356.7800 0005033 344.4621 218.7816 1.00271798 34501"); "2 27508 0.0571 356.7800 0005033 344.4621 218.7816 1.00271798 34501");
...@@ -41,4 +44,37 @@ public class TLEConverterTest { ...@@ -41,4 +44,37 @@ public class TLEConverterTest {
Assert.assertFalse(driver.isSelected()); Assert.assertFalse(driver.isSelected());
} }
} }
@Test
public void testIssue859() {
// INTELSAT 25 TLE taken from Celestrak the 2021-11-24T07:45:00.000
// Because the satellite eccentricity and inclination are closed to zero, this satellite
// reach convergence issues when converting the spacecraft's state to TLE.
final TLE tle = new TLE("1 33153U 08034A 21327.46310733 -.00000207 00000+0 00000+0 0 9990",
"2 33153 0.0042 20.7353 0003042 213.9370 323.2156 1.00270917 48929");
// Verify convergence issue
final TLEPropagatorBuilder propagatorBuilderError = new TLEPropagatorBuilder(tle, PositionAngle.MEAN, 1.);
try {
propagatorBuilderError.buildPropagator(propagatorBuilderError.getSelectedNormalizedParameters());
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_COMPUTE_TLE, oe.getSpecifier());
}
// Now try using different convergence threshold
final TLEPropagatorBuilder propagatorBuilder = new TLEPropagatorBuilder(tle, PositionAngle.MEAN, 1., 2.0e-4, 10000);
final TLEPropagator propagator = propagatorBuilder.buildPropagator(propagatorBuilderError.getSelectedNormalizedParameters());
final TLE newTLE = propagator.getTLE();
// Verify
Assert.assertEquals(0.0, newTLE.getDate().durationFrom(tle.getDate()), Utils.epsilonTest);
}
@Before
public void setUp() {
Utils.setDataRoot("regular-data");
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment