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

Fixed BStar estimation in TLE-based orbit determination.

Fixed #864
parent 15439c56
Pipeline #1564 passed with stages
in 19 minutes and 56 seconds
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.1" date="TBD" description="TBD">
<action dev="bryan" type="fix" issue="864">
Fixed BStar estimation in TLE-based orbit determination.
</action>
<action dev="mvanel" type="add" issue="653">
Added Brouwer-Lyddane orbit propagator.
</action>
......
......@@ -819,6 +819,15 @@ public class TLE implements TimeStamped, Serializable {
FastMath.abs(deltaHy) < thrH &&
FastMath.abs(deltaLv) < thrV) {
// Verify if parameters are estimated
for (final ParameterDriver templateDrivers : templateTLE.getParametersDrivers()) {
if (templateDrivers.isSelected()) {
// Set to selected for the new TLE
current.getParameterDriver(templateDrivers.getName()).setSelected(true);
}
}
// Return
return current;
}
......@@ -1014,6 +1023,33 @@ public class TLE implements TimeStamped, Serializable {
return Collections.singletonList(bStarParameterDriver);
}
/** Get parameter driver from its name.
* @param name parameter name
* @return parameter driver
* @since 11.1
*/
public ParameterDriver getParameterDriver(final String name) {
// Loop on known drivers
for (final ParameterDriver driver : getParametersDrivers()) {
if (name.equals(driver.getName())) {
// we have found a parameter with that name
return driver;
}
}
// build the list of supported parameters
final StringBuilder sBuilder = new StringBuilder();
for (final ParameterDriver driver : getParametersDrivers()) {
if (sBuilder.length() > 0) {
sBuilder.append(", ");
}
sBuilder.append(driver.getName());
}
throw new OrekitException(OrekitMessages.UNSUPPORTED_PARAMETER_NAME,
name, sBuilder.toString());
}
/** Replace the instance with a data transfer object for serialization.
* @return data transfer object that will be serialized
*/
......
......@@ -687,6 +687,46 @@ public class TLETest {
}
@Test
public void testIssue864() {
// Initialize TLE
final TLE tleISS = new TLE("1 25544U 98067A 21035.14486477 .00001026 00000-0 26816-4 0 9998",
"2 25544 51.6455 280.7636 0002243 335.6496 186.1723 15.48938788267977");
// TLE propagator
final TLEPropagator propagator = TLEPropagator.selectExtrapolator(tleISS);
// State at TLE epoch
final SpacecraftState state = propagator.propagate(tleISS.getDate());
// Set the BStar driver to selected
tleISS.getParametersDrivers().forEach(driver -> driver.setSelected(true));
// Convert to TLE
final TLE rebuilt = TLE.stateToTLE(state, tleISS);
// Verify if driver is still selected
rebuilt.getParametersDrivers().forEach(driver -> Assert.assertTrue(driver.isSelected()));
}
@Test
public void testUnknowParameter() {
// Initialize TLE
final TLE tleISS = new TLE("1 25544U 98067A 21035.14486477 .00001026 00000-0 26816-4 0 9998",
"2 25544 51.6455 280.7636 0002243 335.6496 186.1723 15.48938788267977");
try {
tleISS.getParameterDriver("MyWonderfulDriver");
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oe.getSpecifier());
}
}
@Before
public void setUp() {
Utils.setDataRoot("regular-data");
......
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