Search in sources :

Example 1 with RangeRateTroposphericDelayModifier

use of org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier in project Orekit by CS-SI.

the class TropoModifierTest method testRangeRateTropoModifier.

@Test
public void testRangeRateTropoModifier() throws OrekitException {
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 0.001);
    // create perfect range measurements
    for (final GroundStation station : context.stations) {
        station.getEastOffsetDriver().setSelected(true);
        station.getNorthOffsetDriver().setSelected(true);
        station.getZenithOffsetDriver().setSelected(true);
    }
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeRateMeasurementCreator(context, false), 1.0, 3.0, 300.0);
    propagator.setSlaveMode();
    final RangeRateTroposphericDelayModifier modifier = new RangeRateTroposphericDelayModifier(SaastamoinenModel.getStandardModel(), false);
    for (final ObservedMeasurement<?> measurement : measurements) {
        final AbsoluteDate date = measurement.getDate();
        final SpacecraftState refState = propagator.propagate(date);
        RangeRate rangeRate = (RangeRate) measurement;
        EstimatedMeasurement<RangeRate> evalNoMod = rangeRate.estimate(0, 0, new SpacecraftState[] { refState });
        // add modifier
        rangeRate.addModifier(modifier);
        // 
        EstimatedMeasurement<RangeRate> eval = rangeRate.estimate(0, 0, new SpacecraftState[] { refState });
        final double diffMetersSec = eval.getEstimatedValue()[0] - evalNoMod.getEstimatedValue()[0];
        final double epsilon = 1e-6;
        Assert.assertTrue(Precision.compareTo(diffMetersSec, 0.01, epsilon) < 0);
        Assert.assertTrue(Precision.compareTo(diffMetersSec, -0.01, epsilon) > 0);
    }
}
Also used : Context(org.orekit.estimation.Context) GroundStation(org.orekit.estimation.measurements.GroundStation) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) RangeRateTroposphericDelayModifier(org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) Propagator(org.orekit.propagation.Propagator) RangeRate(org.orekit.estimation.measurements.RangeRate) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) RangeRateMeasurementCreator(org.orekit.estimation.measurements.RangeRateMeasurementCreator) Test(org.junit.Test)

Example 2 with RangeRateTroposphericDelayModifier

use of org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier in project Orekit by CS-SI.

the class RangeRateTest method testStateDerivativesWithModifier.

@Test
public void testStateDerivativesWithModifier() throws OrekitException {
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 0.001);
    // create perfect range rate measurements
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeRateMeasurementCreator(context, false), 1.0, 3.0, 300.0);
    propagator.setSlaveMode();
    double maxRelativeError = 0;
    for (final ObservedMeasurement<?> measurement : measurements) {
        final RangeRateTroposphericDelayModifier modifier = new RangeRateTroposphericDelayModifier(SaastamoinenModel.getStandardModel(), true);
        ((RangeRate) measurement).addModifier(modifier);
        // 
        // final AbsoluteDate date = measurement.getDate();
        // measurement.getObservedValue()[0] / Constants.SPEED_OF_LIGHT;
        final double meanDelay = 1;
        final AbsoluteDate date = measurement.getDate().shiftedBy(-0.75 * meanDelay);
        final SpacecraftState state = propagator.propagate(date);
        final double[][] jacobian = measurement.estimate(0, 0, new SpacecraftState[] { state }).getStateDerivatives(0);
        final double[][] finiteDifferencesJacobian = Differentiation.differentiate(new StateFunction() {

            public double[] value(final SpacecraftState state) throws OrekitException {
                return measurement.estimate(0, 0, new SpacecraftState[] { state }).getEstimatedValue();
            }
        }, 1, propagator.getAttitudeProvider(), OrbitType.CARTESIAN, PositionAngle.TRUE, 15.0, 3).value(state);
        Assert.assertEquals(finiteDifferencesJacobian.length, jacobian.length);
        Assert.assertEquals(finiteDifferencesJacobian[0].length, jacobian[0].length);
        for (int i = 0; i < jacobian.length; ++i) {
            for (int j = 0; j < jacobian[i].length; ++j) {
                // check the values returned by getStateDerivatives() are correct
                maxRelativeError = FastMath.max(maxRelativeError, FastMath.abs((finiteDifferencesJacobian[i][j] - jacobian[i][j]) / finiteDifferencesJacobian[i][j]));
            }
        }
    }
    Assert.assertEquals(0, maxRelativeError, 1.5e-7);
}
Also used : Context(org.orekit.estimation.Context) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) RangeRateTroposphericDelayModifier(org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) Propagator(org.orekit.propagation.Propagator) StateFunction(org.orekit.utils.StateFunction) Test(org.junit.Test)

Example 3 with RangeRateTroposphericDelayModifier

use of org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier in project Orekit by CS-SI.

the class RangeRateTest method testParameterDerivativesWithModifier.

@Test
public void testParameterDerivativesWithModifier() throws OrekitException {
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 0.001);
    // create perfect range rate measurements
    for (final GroundStation station : context.stations) {
        station.getEastOffsetDriver().setSelected(true);
        station.getNorthOffsetDriver().setSelected(true);
        station.getZenithOffsetDriver().setSelected(true);
    }
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeRateMeasurementCreator(context, false), 1.0, 3.0, 300.0);
    propagator.setSlaveMode();
    double maxRelativeError = 0;
    for (final ObservedMeasurement<?> measurement : measurements) {
        final RangeRateTroposphericDelayModifier modifier = new RangeRateTroposphericDelayModifier(SaastamoinenModel.getStandardModel(), true);
        ((RangeRate) measurement).addModifier(modifier);
        // parameter corresponding to station position offset
        final GroundStation stationParameter = ((RangeRate) measurement).getStation();
        // We intentionally propagate to a date which is close to the
        // real spacecraft state but is *not* the accurate date, by
        // compensating only part of the downlink delay. This is done
        // in order to validate the partial derivatives with respect
        // to velocity. If we had chosen the proper state date, the
        // range would have depended only on the current position but
        // not on the current velocity.
        final double meanDelay = measurement.getObservedValue()[0] / Constants.SPEED_OF_LIGHT;
        final AbsoluteDate date = measurement.getDate().shiftedBy(-0.75 * meanDelay);
        final SpacecraftState state = propagator.propagate(date);
        final ParameterDriver[] drivers = new ParameterDriver[] { stationParameter.getEastOffsetDriver(), stationParameter.getNorthOffsetDriver(), stationParameter.getZenithOffsetDriver() };
        for (int i = 0; i < 3; ++i) {
            final double[] gradient = measurement.estimate(0, 0, new SpacecraftState[] { state }).getParameterDerivatives(drivers[i]);
            Assert.assertEquals(1, measurement.getDimension());
            Assert.assertEquals(1, gradient.length);
            final ParameterFunction dMkdP = Differentiation.differentiate(new ParameterFunction() {

                /**
                 * {@inheritDoc}
                 */
                @Override
                public double value(final ParameterDriver parameterDriver) throws OrekitException {
                    return measurement.estimate(0, 0, new SpacecraftState[] { state }).getEstimatedValue()[0];
                }
            }, drivers[i], 3, 20.0);
            final double ref = dMkdP.value(drivers[i]);
            maxRelativeError = FastMath.max(maxRelativeError, FastMath.abs((ref - gradient[0]) / ref));
        }
    }
    Assert.assertEquals(0, maxRelativeError, 1.2e-6);
}
Also used : Context(org.orekit.estimation.Context) ParameterDriver(org.orekit.utils.ParameterDriver) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) RangeRateTroposphericDelayModifier(org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) ParameterFunction(org.orekit.utils.ParameterFunction) Propagator(org.orekit.propagation.Propagator) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Context (org.orekit.estimation.Context)3 RangeRateTroposphericDelayModifier (org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier)3 Propagator (org.orekit.propagation.Propagator)3 SpacecraftState (org.orekit.propagation.SpacecraftState)3 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)3 AbsoluteDate (org.orekit.time.AbsoluteDate)3 OrekitException (org.orekit.errors.OrekitException)1 GroundStation (org.orekit.estimation.measurements.GroundStation)1 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)1 RangeRate (org.orekit.estimation.measurements.RangeRate)1 RangeRateMeasurementCreator (org.orekit.estimation.measurements.RangeRateMeasurementCreator)1 ParameterDriver (org.orekit.utils.ParameterDriver)1 ParameterFunction (org.orekit.utils.ParameterFunction)1 StateFunction (org.orekit.utils.StateFunction)1