Search in sources :

Example 1 with TurnAroundRangeIonosphericDelayModifier

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

the class IonoModifierTest method testTurnAroundRangeIonoModifier.

@Test
public void testTurnAroundRangeIonoModifier() 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 turn-around measurements
    for (Map.Entry<GroundStation, GroundStation> entry : context.TARstations.entrySet()) {
        final GroundStation masterStation = entry.getKey();
        final GroundStation slaveStation = entry.getValue();
        masterStation.getEastOffsetDriver().setSelected(true);
        masterStation.getNorthOffsetDriver().setSelected(true);
        masterStation.getZenithOffsetDriver().setSelected(true);
        slaveStation.getEastOffsetDriver().setSelected(true);
        slaveStation.getNorthOffsetDriver().setSelected(true);
        slaveStation.getZenithOffsetDriver().setSelected(true);
    }
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new TurnAroundRangeMeasurementCreator(context), 1.0, 3.0, 300.0);
    propagator.setSlaveMode();
    final TurnAroundRangeIonosphericDelayModifier modifier = new TurnAroundRangeIonosphericDelayModifier(model);
    for (final ObservedMeasurement<?> measurement : measurements) {
        final AbsoluteDate date = measurement.getDate();
        final SpacecraftState refstate = propagator.propagate(date);
        TurnAroundRange turnAroundRange = (TurnAroundRange) measurement;
        EstimatedMeasurement<TurnAroundRange> evalNoMod = turnAroundRange.estimate(12, 17, new SpacecraftState[] { refstate });
        Assert.assertEquals(12, evalNoMod.getIteration());
        Assert.assertEquals(17, evalNoMod.getCount());
        // Add modifier
        turnAroundRange.addModifier(modifier);
        boolean found = false;
        for (final EstimationModifier<TurnAroundRange> existing : turnAroundRange.getModifiers()) {
            found = found || existing == modifier;
        }
        Assert.assertTrue(found);
        // 
        EstimatedMeasurement<TurnAroundRange> eval = turnAroundRange.estimate(12, 17, new SpacecraftState[] { refstate });
        Assert.assertEquals(evalNoMod.getStatus(), eval.getStatus());
        eval.setStatus(EstimatedMeasurement.Status.REJECTED);
        Assert.assertEquals(EstimatedMeasurement.Status.REJECTED, eval.getStatus());
        eval.setStatus(evalNoMod.getStatus());
        try {
            eval.getParameterDerivatives(new ParameterDriver("extra", 0, 1, -1, +1));
            Assert.fail("an exception should have been thrown");
        } catch (OrekitIllegalArgumentException oiae) {
            Assert.assertEquals(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, oiae.getSpecifier());
        }
        final double diffMeters = eval.getEstimatedValue()[0] - evalNoMod.getEstimatedValue()[0];
        // TODO: check threshold
        Assert.assertEquals(0.0, diffMeters, 30.0);
    }
}
Also used : Context(org.orekit.estimation.Context) GroundStation(org.orekit.estimation.measurements.GroundStation) TurnAroundRangeIonosphericDelayModifier(org.orekit.estimation.measurements.modifiers.TurnAroundRangeIonosphericDelayModifier) ParameterDriver(org.orekit.utils.ParameterDriver) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitIllegalArgumentException(org.orekit.errors.OrekitIllegalArgumentException) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) Propagator(org.orekit.propagation.Propagator) TurnAroundRange(org.orekit.estimation.measurements.TurnAroundRange) Map(java.util.Map) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) TurnAroundRangeMeasurementCreator(org.orekit.estimation.measurements.TurnAroundRangeMeasurementCreator) Test(org.junit.Test)

Aggregations

Map (java.util.Map)1 Test (org.junit.Test)1 OrekitIllegalArgumentException (org.orekit.errors.OrekitIllegalArgumentException)1 Context (org.orekit.estimation.Context)1 GroundStation (org.orekit.estimation.measurements.GroundStation)1 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)1 TurnAroundRange (org.orekit.estimation.measurements.TurnAroundRange)1 TurnAroundRangeMeasurementCreator (org.orekit.estimation.measurements.TurnAroundRangeMeasurementCreator)1 TurnAroundRangeIonosphericDelayModifier (org.orekit.estimation.measurements.modifiers.TurnAroundRangeIonosphericDelayModifier)1 Propagator (org.orekit.propagation.Propagator)1 SpacecraftState (org.orekit.propagation.SpacecraftState)1 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)1 AbsoluteDate (org.orekit.time.AbsoluteDate)1 ParameterDriver (org.orekit.utils.ParameterDriver)1