Search in sources :

Example 11 with ParameterFunction

use of org.orekit.utils.ParameterFunction 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)

Example 12 with ParameterFunction

use of org.orekit.utils.ParameterFunction in project Orekit by CS-SI.

the class TurnAroundRangeIonosphericDelayModifier method rangeErrorParameterDerivative.

/**
 * Compute the derivative of the delay term wrt parameters.
 *
 * @param station ground station
 * @param driver driver for the station offset parameter
 * @param state spacecraft state
 * @return derivative of the delay wrt station offset parameter
 * @throws OrekitException  if frames transformations cannot be computed
 */
private double rangeErrorParameterDerivative(final GroundStation station, final ParameterDriver driver, final SpacecraftState state) throws OrekitException {
    final ParameterFunction rangeError = new ParameterFunction() {

        /**
         * {@inheritDoc}
         */
        @Override
        public double value(final ParameterDriver parameterDriver) throws OrekitException {
            return rangeErrorIonosphericModel(station, state);
        }
    };
    final ParameterFunction rangeErrorDerivative = Differentiation.differentiate(rangeError, driver, 3, 10.0);
    return rangeErrorDerivative.value(driver);
}
Also used : ParameterFunction(org.orekit.utils.ParameterFunction) ParameterDriver(org.orekit.utils.ParameterDriver)

Example 13 with ParameterFunction

use of org.orekit.utils.ParameterFunction in project Orekit by CS-SI.

the class RangeRateIonosphericDelayModifier method rangeRateErrorParameterDerivative.

/**
 * Compute the derivative of the delay term wrt parameters.
 *
 * @param station ground station
 * @param driver driver for the station offset parameter
 * @param state spacecraft state
 * @param delay current ionospheric delay
 * @return derivative of the delay wrt station offset parameter
 * @throws OrekitException  if frames transformations cannot be computed
 */
private double rangeRateErrorParameterDerivative(final GroundStation station, final ParameterDriver driver, final SpacecraftState state, final double delay) throws OrekitException {
    final ParameterFunction rangeError = new ParameterFunction() {

        /**
         * {@inheritDoc}
         */
        @Override
        public double value(final ParameterDriver parameterDriver) throws OrekitException {
            return rangeRateErrorIonosphericModel(station, state);
        }
    };
    final ParameterFunction rangeErrorDerivative = Differentiation.differentiate(rangeError, driver, 3, 10.0);
    return rangeErrorDerivative.value(driver);
}
Also used : ParameterFunction(org.orekit.utils.ParameterFunction) ParameterDriver(org.orekit.utils.ParameterDriver)

Example 14 with ParameterFunction

use of org.orekit.utils.ParameterFunction in project Orekit by CS-SI.

the class RangeTroposphericDelayModifier method rangeErrorParameterDerivative.

/**
 * Compute the derivative of the delay term wrt parameters.
 *
 * @param station ground station
 * @param driver driver for the station offset parameter
 * @param state spacecraft state
 * @param delay current ionospheric delay
 * @return derivative of the delay wrt station offset parameter
 * @throws OrekitException  if frames transformations cannot be computed
 */
private double rangeErrorParameterDerivative(final GroundStation station, final ParameterDriver driver, final SpacecraftState state, final double delay) throws OrekitException {
    final ParameterFunction rangeError = new ParameterFunction() {

        /**
         * {@inheritDoc}
         */
        @Override
        public double value(final ParameterDriver parameterDriver) throws OrekitException {
            return rangeErrorTroposphericModel(station, state);
        }
    };
    final ParameterFunction rangeErrorDerivative = Differentiation.differentiate(rangeError, driver, 3, 10.0);
    return rangeErrorDerivative.value(driver);
}
Also used : ParameterFunction(org.orekit.utils.ParameterFunction) ParameterDriver(org.orekit.utils.ParameterDriver)

Aggregations

ParameterDriver (org.orekit.utils.ParameterDriver)14 ParameterFunction (org.orekit.utils.ParameterFunction)14 OrekitException (org.orekit.errors.OrekitException)8 Context (org.orekit.estimation.Context)8 Propagator (org.orekit.propagation.Propagator)8 SpacecraftState (org.orekit.propagation.SpacecraftState)8 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)8 AbsoluteDate (org.orekit.time.AbsoluteDate)8 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 Mean (org.hipparchus.stat.descriptive.moment.Mean)3 Max (org.hipparchus.stat.descriptive.rank.Max)3 Median (org.hipparchus.stat.descriptive.rank.Median)3 Map (java.util.Map)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 TurnAroundRangeTroposphericDelayModifier (org.orekit.estimation.measurements.modifiers.TurnAroundRangeTroposphericDelayModifier)2 RangeRateTroposphericDelayModifier (org.orekit.estimation.measurements.modifiers.RangeRateTroposphericDelayModifier)1 RangeTroposphericDelayModifier (org.orekit.estimation.measurements.modifiers.RangeTroposphericDelayModifier)1 OrekitStepInterpolator (org.orekit.propagation.sampling.OrekitStepInterpolator)1 ChronologicalComparator (org.orekit.time.ChronologicalComparator)1