Search in sources :

Example 6 with NumericalPropagatorBuilder

use of org.orekit.propagation.conversion.NumericalPropagatorBuilder in project Orekit by CS-SI.

the class IonoModifierTest method testRangeRateIonoModifier.

@Test
public void testRangeRateIonoModifier() 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 RangeRateIonosphericDelayModifier modifier = new RangeRateIonosphericDelayModifier(model, true);
    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];
        // TODO: check threshold
        Assert.assertEquals(0.0, diffMetersSec, 0.016);
    }
}
Also used : Context(org.orekit.estimation.Context) GroundStation(org.orekit.estimation.measurements.GroundStation) RangeRateIonosphericDelayModifier(org.orekit.estimation.measurements.modifiers.RangeRateIonosphericDelayModifier) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) 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 7 with NumericalPropagatorBuilder

use of org.orekit.propagation.conversion.NumericalPropagatorBuilder 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)

Example 8 with NumericalPropagatorBuilder

use of org.orekit.propagation.conversion.NumericalPropagatorBuilder in project Orekit by CS-SI.

the class IonoModifierTest method testAngularIonoModifier.

@Test
public void testAngularIonoModifier() 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 AngularAzElMeasurementCreator(context), 1.0, 3.0, 300.0);
    propagator.setSlaveMode();
    final AngularIonosphericDelayModifier modifier = new AngularIonosphericDelayModifier(model);
    for (final ObservedMeasurement<?> measurement : measurements) {
        final AbsoluteDate date = measurement.getDate();
        final SpacecraftState refstate = propagator.propagate(date);
        AngularAzEl angular = (AngularAzEl) measurement;
        EstimatedMeasurement<AngularAzEl> evalNoMod = angular.estimate(0, 0, new SpacecraftState[] { refstate });
        // add modifier
        angular.addModifier(modifier);
        // 
        EstimatedMeasurement<AngularAzEl> eval = angular.estimate(0, 0, new SpacecraftState[] { refstate });
        final double diffAz = MathUtils.normalizeAngle(eval.getEstimatedValue()[0], evalNoMod.getEstimatedValue()[0]) - evalNoMod.getEstimatedValue()[0];
        final double diffEl = MathUtils.normalizeAngle(eval.getEstimatedValue()[1], evalNoMod.getEstimatedValue()[1]) - evalNoMod.getEstimatedValue()[1];
        // TODO: check threshold
        Assert.assertEquals(0.0, diffAz, 5.0e-5);
        Assert.assertEquals(0.0, diffEl, 5.0e-6);
    }
}
Also used : Context(org.orekit.estimation.Context) GroundStation(org.orekit.estimation.measurements.GroundStation) AngularIonosphericDelayModifier(org.orekit.estimation.measurements.modifiers.AngularIonosphericDelayModifier) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) Propagator(org.orekit.propagation.Propagator) AngularAzElMeasurementCreator(org.orekit.estimation.measurements.AngularAzElMeasurementCreator) AngularAzEl(org.orekit.estimation.measurements.AngularAzEl) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) Test(org.junit.Test)

Example 9 with NumericalPropagatorBuilder

use of org.orekit.propagation.conversion.NumericalPropagatorBuilder in project Orekit by CS-SI.

the class OnBoardAntennaInterSatellitesRangeModifierTest method testPreliminary.

@Test
public void testPreliminary() throws OrekitException {
    // this test does not check OnBoardAntennaInterSatellitesRangeModifier at all,
    // it just checks InterSatellitesRangeMeasurementCreator behaves as necessary for the other test
    // the *real* test is testEffect below
    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);
    propagatorBuilder.setAttitudeProvider(new LofOffset(propagatorBuilder.getFrame(), LOFType.LVLH));
    // create perfect inter-satellites range measurements without antenna offset
    final TimeStampedPVCoordinates original = context.initialOrbit.getPVCoordinates();
    final Orbit closeOrbit = new CartesianOrbit(new TimeStampedPVCoordinates(context.initialOrbit.getDate(), original.getPosition().add(new Vector3D(1000, 2000, 3000)), original.getVelocity().add(new Vector3D(-0.03, 0.01, 0.02))), context.initialOrbit.getFrame(), context.initialOrbit.getMu());
    final Propagator closePropagator = EstimationTestUtils.createPropagator(closeOrbit, propagatorBuilder);
    closePropagator.setEphemerisMode();
    closePropagator.propagate(context.initialOrbit.getDate().shiftedBy(3.5 * closeOrbit.getKeplerianPeriod()));
    final BoundedPropagator ephemeris = closePropagator.getGeneratedEphemeris();
    final Propagator p1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> spacecraftCenteredMeasurements = EstimationTestUtils.createMeasurements(p1, new InterSatellitesRangeMeasurementCreator(ephemeris, Vector3D.ZERO, Vector3D.ZERO), 1.0, 3.0, 300.0);
    // create perfect inter-satellites range measurements with antenna offset
    final double xOffset1 = -2.5;
    final double yOffset2 = 0.8;
    final Propagator p2 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> antennaCenteredMeasurements = EstimationTestUtils.createMeasurements(p2, new InterSatellitesRangeMeasurementCreator(ephemeris, new Vector3D(xOffset1, 0, 0), new Vector3D(0, yOffset2, 0)), 1.0, 3.0, 300.0);
    for (int i = 0; i < spacecraftCenteredMeasurements.size(); ++i) {
        InterSatellitesRange sr = (InterSatellitesRange) spacecraftCenteredMeasurements.get(i);
        InterSatellitesRange ar = (InterSatellitesRange) antennaCenteredMeasurements.get(i);
        Assert.assertEquals(0.0, sr.getDate().durationFrom(ar.getDate()), 2.0e-8);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] >= -1.0);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] <= -0.36);
    }
}
Also used : Context(org.orekit.estimation.Context) CartesianOrbit(org.orekit.orbits.CartesianOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) InterSatellitesRange(org.orekit.estimation.measurements.InterSatellitesRange) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) LofOffset(org.orekit.attitudes.LofOffset) BoundedPropagator(org.orekit.propagation.BoundedPropagator) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) Test(org.junit.Test)

Example 10 with NumericalPropagatorBuilder

use of org.orekit.propagation.conversion.NumericalPropagatorBuilder in project Orekit by CS-SI.

the class OnBoardAntennaTurnAroundRangeModifierTest method testPreliminary.

@Test
public void testPreliminary() throws OrekitException {
    // this test does not check OnBoardAntennaTurnAroundRangeModifier at all,
    // it just checks TurnAroundRangeMeasurementCreator behaves as necessary for the other test
    // the *real* test is testEffect below
    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);
    propagatorBuilder.setAttitudeProvider(new LofOffset(propagatorBuilder.getFrame(), LOFType.LVLH));
    // create perfect turn-around range measurements without antenna offset
    final Propagator p1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> spacecraftCenteredMeasurements = EstimationTestUtils.createMeasurements(p1, new TurnAroundRangeMeasurementCreator(context, Vector3D.ZERO), 1.0, 3.0, 300.0);
    // create perfect turn-around range measurements with antenna offset
    final double xOffset = -2.5;
    final Propagator p2 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> antennaCenteredMeasurements = EstimationTestUtils.createMeasurements(p2, new TurnAroundRangeMeasurementCreator(context, new Vector3D(xOffset, 0, 0)), 1.0, 3.0, 300.0);
    for (int i = 0; i < spacecraftCenteredMeasurements.size(); ++i) {
        TurnAroundRange sr = (TurnAroundRange) spacecraftCenteredMeasurements.get(i);
        TurnAroundRange ar = (TurnAroundRange) antennaCenteredMeasurements.get(i);
        Assert.assertEquals(0.0, sr.getDate().durationFrom(ar.getDate()), 2.0e-8);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] >= 2.0 * xOffset);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] <= 1.8 * xOffset);
    }
}
Also used : Context(org.orekit.estimation.Context) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) Propagator(org.orekit.propagation.Propagator) TurnAroundRange(org.orekit.estimation.measurements.TurnAroundRange) LofOffset(org.orekit.attitudes.LofOffset) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) TurnAroundRangeMeasurementCreator(org.orekit.estimation.measurements.TurnAroundRangeMeasurementCreator) Test(org.junit.Test)

Aggregations

NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)76 Context (org.orekit.estimation.Context)67 Propagator (org.orekit.propagation.Propagator)67 Test (org.junit.Test)54 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)44 AbsoluteDate (org.orekit.time.AbsoluteDate)44 SpacecraftState (org.orekit.propagation.SpacecraftState)36 ParameterDriver (org.orekit.utils.ParameterDriver)27 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)26 Orbit (org.orekit.orbits.Orbit)23 ParameterDriversList (org.orekit.utils.ParameterDriversList)22 ArrayList (java.util.ArrayList)21 OrekitException (org.orekit.errors.OrekitException)18 Median (org.hipparchus.stat.descriptive.rank.Median)17 RangeMeasurementCreator (org.orekit.estimation.measurements.RangeMeasurementCreator)17 CartesianOrbit (org.orekit.orbits.CartesianOrbit)15 Max (org.hipparchus.stat.descriptive.rank.Max)14 RealMatrix (org.hipparchus.linear.RealMatrix)13 LevenbergMarquardtOptimizer (org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer)13 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)13