Commit 10988521 authored by Pascal Parraud's avatar Pascal Parraud
Browse files

Fixed sign issue in the TDOA measurement

parent 0671cfc0
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.2" date="TBD" description="TBD">
<action dev="pascal" type="add" issue="911">
Added TDOA and bistatic range rate measurements.
</action>
<action dev="bryan" type="fix" issue="910">
Fixed eD and eY equation in ECOM2 model.
</action>
......
......@@ -38,14 +38,16 @@ import org.orekit.utils.TimeStampedPVCoordinates;
* and two ground stations as receivers.
* <p>
* TDOA measures the difference in signal arrival time between the emitter and receivers,
* corresponding to a difference in ranges from the two receivers to the emitter.<br/>
* The motion of the stations and the satellite during the signal flight time are taken into account.
* corresponding to a difference in ranges from the two receivers to the emitter.
* </p>
* <p>
* The date of the measurement corresponds to the reception of the signal by the prime station.<br/>
* The measurement corresponds to the date of the measurement minus
* the date of reception of the signal by the second station:
* <code>tdoa = tr<sub>1</sub> - tr<sub>2</sub></code>
* </p>
* <p>
* The date of the measurement corresponds to the reception of the signal by the prime ground station.<br/>
* The measurement corresponds to the date of reception of the signal by the second station minus
* the date of the measurement.<br/>
* <code>tdoa = tr<sub>2</sub> - tr<sub>1</sub></code>
* The motion of the stations and the satellite during the signal flight time are taken into account.
* </p>
* @author Pascal Parraud
* @since 11.2
......@@ -189,10 +191,10 @@ public class TDOA extends AbstractMeasurement<TDOA> {
delta = FastMath.abs(tau2.getValue() - previous);
} while (count++ < 10 && delta >= 2 * FastMath.ulp(tau2.getValue()));
// The measured TDOA is (tau2 + clockOffset2) - (tau1 + clockOffset1)
// The measured TDOA is (tau1 + clockOffset1) - (tau2 + clockOffset2)
final Gradient offset1 = primeStation.getClockOffsetDriver().getValue(nbParams, indices);
final Gradient offset2 = secondStation.getClockOffsetDriver().getValue(nbParams, indices);
final Gradient tdoaG = tau2.add(offset2).subtract(tau1.add(offset1));
final Gradient tdoaG = tau1.add(offset1).subtract(tau2.add(offset2));
final double tdoa = tdoaG.getValue();
// Evaluate the TDOA value and derivatives
......@@ -206,8 +208,8 @@ public class TDOA extends AbstractMeasurement<TDOA> {
},
new TimeStampedPVCoordinates[] {
emitterPV.toTimeStampedPVCoordinates(),
tdoa > 0 ? pv1 : pv2,
tdoa > 0 ? pv2 : pv1
tdoa > 0 ? pv2 : pv1,
tdoa > 0 ? pv1 : pv2
});
// set TDOA value
......
......@@ -47,10 +47,10 @@ public class TDOABuilder extends AbstractMeasurementBuilder<TDOA> {
* @param satellite satellite related to this builder
*/
public TDOABuilder(final CorrelatedRandomVectorGenerator noiseSource,
final GroundStation primeStation,
final GroundStation secondStation,
final double sigma, final double baseWeight,
final ObservableSatellite satellite) {
final GroundStation primeStation,
final GroundStation secondStation,
final double sigma, final double baseWeight,
final ObservableSatellite satellite) {
super(noiseSource, sigma, baseWeight, satellite);
this.primeStation = primeStation;
this.secondStation = secondStation;
......
......@@ -187,8 +187,8 @@ public class TDOAIonosphericDelayModifier implements EstimationModifier<TDOA> {
final double[][] stateDerivatives = estimated.getStateDerivatives(0);
for (int irow = 0; irow < stateDerivatives.length; ++irow) {
for (int jcol = 0; jcol < stateDerivatives[0].length; ++jcol) {
stateDerivatives[irow][jcol] -= primeDjac[irow][jcol];
stateDerivatives[irow][jcol] += secondDjac[irow][jcol];
stateDerivatives[irow][jcol] += primeDjac[irow][jcol];
stateDerivatives[irow][jcol] -= secondDjac[irow][jcol];
}
}
estimated.setStateDerivatives(0, stateDerivatives);
......@@ -200,10 +200,10 @@ public class TDOAIonosphericDelayModifier implements EstimationModifier<TDOA> {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
final double[] dDelayPrime = timeErrorParameterDerivative(primeDerivatives,
converter.getFreeStateParameters());
parameterDerivative -= dDelayPrime[index];
parameterDerivative += dDelayPrime[index];
final double[] dDelaySecond = timeErrorParameterDerivative(secondDerivatives,
converter.getFreeStateParameters());
parameterDerivative += dDelaySecond[index];
parameterDerivative -= dDelaySecond[index];
estimated.setParameterDerivatives(driver, parameterDerivative);
index += 1;
}
......@@ -217,7 +217,7 @@ public class TDOAIonosphericDelayModifier implements EstimationModifier<TDOA> {
primeStation.getZenithOffsetDriver())) {
if (driver.isSelected()) {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
parameterDerivative -= timeErrorParameterDerivative(primeStation, driver, state);
parameterDerivative += timeErrorParameterDerivative(primeStation, driver, state);
estimated.setParameterDerivatives(driver, parameterDerivative);
}
}
......@@ -229,7 +229,7 @@ public class TDOAIonosphericDelayModifier implements EstimationModifier<TDOA> {
secondStation.getZenithOffsetDriver())) {
if (driver.isSelected()) {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
parameterDerivative += timeErrorParameterDerivative(secondStation, driver, state);
parameterDerivative -= timeErrorParameterDerivative(secondStation, driver, state);
estimated.setParameterDerivatives(driver, parameterDerivative);
}
}
......@@ -237,8 +237,8 @@ public class TDOAIonosphericDelayModifier implements EstimationModifier<TDOA> {
// Update estimated value taking into account the ionospheric delay for each downlink.
// The ionospheric time delay is directly applied to the TDOA.
final double[] newValue = oldValue.clone();
newValue[0] -= primeGDelay.getReal();
newValue[0] += secondGDelay.getReal();
newValue[0] += primeGDelay.getReal();
newValue[0] -= secondGDelay.getReal();
estimated.setEstimatedValue(newValue);
}
......
......@@ -208,8 +208,8 @@ public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {
final double[][] stateDerivatives = estimated.getStateDerivatives(0);
for (int irow = 0; irow < stateDerivatives.length; ++irow) {
for (int jcol = 0; jcol < stateDerivatives[0].length; ++jcol) {
stateDerivatives[irow][jcol] -= primeDjac[irow][jcol];
stateDerivatives[irow][jcol] += secondDjac[irow][jcol];
stateDerivatives[irow][jcol] += primeDjac[irow][jcol];
stateDerivatives[irow][jcol] -= secondDjac[irow][jcol];
}
}
estimated.setStateDerivatives(0, stateDerivatives);
......@@ -221,10 +221,10 @@ public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
final double[] dDelayPrime = timeErrorParameterDerivative(primeDerivatives,
converter.getFreeStateParameters());
parameterDerivative -= dDelayPrime[index];
parameterDerivative += dDelayPrime[index];
final double[] dDelaySecond = timeErrorParameterDerivative(secondDerivatives,
converter.getFreeStateParameters());
parameterDerivative += dDelaySecond[index];
parameterDerivative -= dDelaySecond[index];
estimated.setParameterDerivatives(driver, parameterDerivative);
index += 1;
}
......@@ -237,7 +237,7 @@ public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {
primeStation.getZenithOffsetDriver())) {
if (driver.isSelected()) {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
parameterDerivative -= timeErrorParameterDerivative(primeStation, driver, state);
parameterDerivative += timeErrorParameterDerivative(primeStation, driver, state);
estimated.setParameterDerivatives(driver, parameterDerivative);
}
}
......@@ -249,7 +249,7 @@ public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {
secondStation.getZenithOffsetDriver())) {
if (driver.isSelected()) {
double parameterDerivative = estimated.getParameterDerivatives(driver)[0];
parameterDerivative += timeErrorParameterDerivative(secondStation, driver, state);
parameterDerivative -= timeErrorParameterDerivative(secondStation, driver, state);
estimated.setParameterDerivatives(driver, parameterDerivative);
}
}
......@@ -257,8 +257,8 @@ public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {
// Update estimated value taking into account the tropospheric delay for each downlink.
// The tropospheric time delay is directly applied to the TDOA.
final double[] newValue = oldValue.clone();
newValue[0] -= primeGDelay.getReal();
newValue[0] += secondGDelay.getReal();
newValue[0] += primeGDelay.getReal();
newValue[0] -= secondGDelay.getReal();
estimated.setEstimatedValue(newValue);
}
......
......@@ -106,7 +106,7 @@ public class TDOAMeasurementCreator extends MeasurementCreator {
}, -1.0, 1.0);
// time difference on arrival
final double tdoa = relativeDelay - referenceDelay;
final double tdoa = referenceDelay - relativeDelay;
addMeasurement(new TDOA(primary, secondary, receptionDate, tdoa, 1.0, 10, satellite));
......
......@@ -506,8 +506,8 @@ public class IonoModifierTest {
// TODO: check threshold
final double epsilon = 1.e-11;
Assert.assertTrue(Precision.compareTo(diffSec, -8.6e-10, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, -2.90e-9, epsilon) > 0);
Assert.assertTrue(Precision.compareTo(diffSec, 2.90e-9, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, 0.85e-9, epsilon) > 0);
}
}
......
......@@ -478,9 +478,9 @@ public class TropoModifierTest {
final double diffSec = eval.getEstimatedValue()[0] - evalNoMod.getEstimatedValue()[0];
final double epsilon = 5.e-11;
Assert.assertTrue(Precision.compareTo(diffSec, 1.1e-9, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, -2.4e-9, epsilon) > 0);
final double epsilon = 1.e-11;
Assert.assertTrue(Precision.compareTo(diffSec, 2.35e-9, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, -1.05e-9, epsilon) > 0);
}
}
......@@ -536,8 +536,8 @@ public class TropoModifierTest {
final double diffSec = eval.getEstimatedValue()[0] - evalNoMod.getEstimatedValue()[0];
final double epsilon = 5.e-11;
Assert.assertTrue(Precision.compareTo(diffSec, 2.2e-9, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, -4.9e-9, epsilon) > 0);
Assert.assertTrue(Precision.compareTo(diffSec, 4.90e-9, epsilon) < 0);
Assert.assertTrue(Precision.compareTo(diffSec, -2.20e-9, epsilon) > 0);
}
}
......
......@@ -17,7 +17,6 @@
package org.orekit.frames;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
......
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