Search in sources :

Example 46 with LofOffset

use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.

the class OnBoardAntennaRangeModifierTest method testPreliminary.

@Test
public void testPreliminary() throws OrekitException {
    // this test does not check OnBoardAntennaRangeModifier at all,
    // it just checks RangeMeasurementCreator 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 range measurements without antenna offset
    final Propagator p1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> spacecraftCenteredMeasurements = EstimationTestUtils.createMeasurements(p1, new RangeMeasurementCreator(context, Vector3D.ZERO), 1.0, 3.0, 300.0);
    // create perfect 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 RangeMeasurementCreator(context, new Vector3D(xOffset, 0, 0)), 1.0, 3.0, 300.0);
    for (int i = 0; i < spacecraftCenteredMeasurements.size(); ++i) {
        Range sr = (Range) spacecraftCenteredMeasurements.get(i);
        Range ar = (Range) antennaCenteredMeasurements.get(i);
        double alphaMax = FastMath.asin(Constants.WGS84_EARTH_EQUATORIAL_RADIUS / sr.getObservedValue()[0]);
        Assert.assertEquals(0.0, sr.getDate().durationFrom(ar.getDate()), 1.0e-8);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] >= xOffset);
        Assert.assertTrue(ar.getObservedValue()[0] - sr.getObservedValue()[0] <= xOffset * FastMath.cos(alphaMax));
    }
}
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) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) Range(org.orekit.estimation.measurements.Range) LofOffset(org.orekit.attitudes.LofOffset) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) Test(org.junit.Test)

Example 47 with LofOffset

use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.

the class OnBoardAntennaTurnAroundRangeModifierTest method testEffect.

@Test
public void testEffect() 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);
    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 Vector3D apc = new Vector3D(-2.5, 0, 0);
    final Propagator p2 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> antennaCenteredMeasurements = EstimationTestUtils.createMeasurements(p2, new TurnAroundRangeMeasurementCreator(context, apc), 1.0, 3.0, 300.0);
    final Propagator p3 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    OnBoardAntennaTurnAroundRangeModifier modifier = new OnBoardAntennaTurnAroundRangeModifier(apc);
    for (int i = 0; i < spacecraftCenteredMeasurements.size(); ++i) {
        TurnAroundRange sr = (TurnAroundRange) spacecraftCenteredMeasurements.get(i);
        sr.addModifier(modifier);
        EstimatedMeasurement<TurnAroundRange> estimated = sr.estimate(0, 0, new SpacecraftState[] { p3.propagate(sr.getDate()) });
        TurnAroundRange ar = (TurnAroundRange) antennaCenteredMeasurements.get(i);
        Assert.assertEquals(0.0, sr.getDate().durationFrom(ar.getDate()), 2.0e-8);
        Assert.assertEquals(ar.getObservedValue()[0], estimated.getEstimatedValue()[0], 5.0e-7);
    }
}
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)

Example 48 with LofOffset

use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.

the class DSSTPropagatorTest method testImpulseManeuver.

@Test
public void testImpulseManeuver() throws OrekitException {
    final Orbit initialOrbit = new KeplerianOrbit(24532000.0, 0.72, 0.3, FastMath.PI, 0.4, 2.0, PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2008, 06, 23), new TimeComponents(14, 18, 37), TimeScalesFactory.getUTC()), 3.986004415e14);
    final double a = initialOrbit.getA();
    final double e = initialOrbit.getE();
    final double i = initialOrbit.getI();
    final double mu = initialOrbit.getMu();
    final double vApo = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
    double dv = 0.99 * FastMath.tan(i) * vApo;
    // Set propagator with state
    setDSSTProp(new SpacecraftState(initialOrbit));
    // Add impulse maneuver
    dsstProp.setAttitudeProvider(new LofOffset(initialOrbit.getFrame(), LOFType.VVLH));
    dsstProp.addEventDetector(new ImpulseManeuver<NodeDetector>(new NodeDetector(initialOrbit, FramesFactory.getEME2000()), new Vector3D(dv, Vector3D.PLUS_J), 400.0));
    SpacecraftState propagated = dsstProp.propagate(initialOrbit.getDate().shiftedBy(8000));
    Assert.assertEquals(0.0028257, propagated.getI(), 1.0e-6);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NodeDetector(org.orekit.propagation.events.NodeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) LofOffset(org.orekit.attitudes.LofOffset) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 49 with LofOffset

use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.

the class BatchLSEstimatorTest method testKeplerRangeWithOnBoardAntennaOffset.

/**
 * Perfect range measurements with a biased start and an on-board antenna range offset
 * @throws OrekitException
 */
@Test
public void testKeplerRangeWithOnBoardAntennaOffset() 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, 1.0);
    propagatorBuilder.setAttitudeProvider(new LofOffset(propagatorBuilder.getFrame(), LOFType.LVLH));
    final Vector3D antennaPhaseCenter = new Vector3D(-1.2, 2.3, -0.7);
    // create perfect range measurements with antenna offset
    final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder);
    final List<ObservedMeasurement<?>> measurements = EstimationTestUtils.createMeasurements(propagator, new RangeMeasurementCreator(context, antennaPhaseCenter), 1.0, 3.0, 300.0);
    // create orbit estimator
    final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder);
    final OnBoardAntennaRangeModifier obaModifier = new OnBoardAntennaRangeModifier(antennaPhaseCenter);
    for (final ObservedMeasurement<?> range : measurements) {
        ((Range) range).addModifier(obaModifier);
        estimator.addMeasurement(range);
    }
    estimator.setParametersConvergenceThreshold(1.0e-2);
    estimator.setMaxIterations(10);
    estimator.setMaxEvaluations(20);
    estimator.setObserver(new BatchLSObserver() {

        int lastIter = 0;

        int lastEval = 0;

        /**
         * {@inheritDoc}
         */
        @Override
        public void evaluationPerformed(int iterationsCount, int evaluationscount, Orbit[] orbits, ParameterDriversList estimatedOrbitalParameters, ParameterDriversList estimatedPropagatorParameters, ParameterDriversList estimatedMeasurementsParameters, EstimationsProvider evaluationsProvider, Evaluation lspEvaluation) throws OrekitException {
            if (iterationsCount == lastIter) {
                Assert.assertEquals(lastEval + 1, evaluationscount);
            } else {
                Assert.assertEquals(lastIter + 1, iterationsCount);
            }
            lastIter = iterationsCount;
            lastEval = evaluationscount;
            Assert.assertEquals(measurements.size(), evaluationsProvider.getNumber());
            try {
                evaluationsProvider.getEstimatedMeasurement(-1);
                Assert.fail("an exception should have been thrown");
            } catch (OrekitException oe) {
                Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
            }
            try {
                evaluationsProvider.getEstimatedMeasurement(measurements.size());
                Assert.fail("an exception should have been thrown");
            } catch (OrekitException oe) {
                Assert.assertEquals(LocalizedCoreFormats.OUT_OF_RANGE_SIMPLE, oe.getSpecifier());
            }
            AbsoluteDate previous = AbsoluteDate.PAST_INFINITY;
            for (int i = 0; i < evaluationsProvider.getNumber(); ++i) {
                AbsoluteDate current = evaluationsProvider.getEstimatedMeasurement(i).getDate();
                Assert.assertTrue(current.compareTo(previous) >= 0);
                previous = current;
            }
        }
    });
    ParameterDriver aDriver = estimator.getOrbitalParametersDrivers(true).getDrivers().get(0);
    Assert.assertEquals("a", aDriver.getName());
    aDriver.setValue(aDriver.getValue() + 1.2);
    aDriver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    EstimationTestUtils.checkFit(context, estimator, 2, 3, 0.0, 2.0e-5, 0.0, 5.2e-5, 0.0, 2.7e-5, 0.0, 1.1e-8);
    // got a default one
    for (final ParameterDriver driver : estimator.getOrbitalParametersDrivers(true).getDrivers()) {
        if ("a".equals(driver.getName())) {
            // user-specified reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(AbsoluteDate.GALILEO_EPOCH), 1.0e-15);
        } else {
            // default reference date
            Assert.assertEquals(0, driver.getReferenceDate().durationFrom(propagatorBuilder.getInitialOrbitDate()), 1.0e-15);
        }
    }
}
Also used : Context(org.orekit.estimation.Context) Evaluation(org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem.Evaluation) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Range(org.orekit.estimation.measurements.Range) ParameterDriver(org.orekit.utils.ParameterDriver) AbsoluteDate(org.orekit.time.AbsoluteDate) LevenbergMarquardtOptimizer(org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer) OnBoardAntennaRangeModifier(org.orekit.estimation.measurements.modifiers.OnBoardAntennaRangeModifier) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ParameterDriversList(org.orekit.utils.ParameterDriversList) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) OrekitException(org.orekit.errors.OrekitException) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) LofOffset(org.orekit.attitudes.LofOffset) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) EstimationsProvider(org.orekit.estimation.measurements.EstimationsProvider) Test(org.junit.Test)

Example 50 with LofOffset

use of org.orekit.attitudes.LofOffset in project Orekit by CS-SI.

the class AdapterPropagatorTest method testLowEarthOrbit.

@Test
public void testLowEarthOrbit() throws OrekitException, ParseException, IOException {
    Orbit leo = new CircularOrbit(7200000.0, -1.0e-5, 2.0e-4, FastMath.toRadians(98.0), FastMath.toRadians(123.456), 0.0, PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC()), Constants.EIGEN5C_EARTH_MU);
    double mass = 5600.0;
    AbsoluteDate t0 = leo.getDate().shiftedBy(1000.0);
    Vector3D dV = new Vector3D(-0.1, 0.2, 0.3);
    double f = 20.0;
    double isp = 315.0;
    double vExhaust = Constants.G0_STANDARD_GRAVITY * isp;
    double dt = -(mass * vExhaust / f) * FastMath.expm1(-dV.getNorm() / vExhaust);
    BoundedPropagator withoutManeuver = getEphemeris(leo, mass, 5, new LofOffset(leo.getFrame(), LOFType.LVLH), t0, Vector3D.ZERO, f, isp, false, false, null);
    BoundedPropagator withManeuver = getEphemeris(leo, mass, 5, new LofOffset(leo.getFrame(), LOFType.LVLH), t0, dV, f, isp, false, false, null);
    // we set up a model that reverts the maneuvers
    AdapterPropagator adapterPropagator = new AdapterPropagator(withManeuver);
    AdapterPropagator.DifferentialEffect effect = new SmallManeuverAnalyticalModel(adapterPropagator.propagate(t0), dV.negate(), isp);
    adapterPropagator.addEffect(effect);
    adapterPropagator.addAdditionalStateProvider(new AdditionalStateProvider() {

        public String getName() {
            return "dummy 3";
        }

        public double[] getAdditionalState(SpacecraftState state) {
            return new double[3];
        }
    });
    // the adapted propagators do not manage the additional states from the reference,
    // they simply forward them
    Assert.assertFalse(adapterPropagator.isAdditionalStateManaged("dummy 1"));
    Assert.assertFalse(adapterPropagator.isAdditionalStateManaged("dummy 2"));
    Assert.assertTrue(adapterPropagator.isAdditionalStateManaged("dummy 3"));
    for (AbsoluteDate t = t0.shiftedBy(0.5 * dt); t.compareTo(withoutManeuver.getMaxDate()) < 0; t = t.shiftedBy(60.0)) {
        PVCoordinates pvWithout = withoutManeuver.getPVCoordinates(t, leo.getFrame());
        PVCoordinates pvReverted = adapterPropagator.getPVCoordinates(t, leo.getFrame());
        double revertError = new PVCoordinates(pvWithout, pvReverted).getPosition().getNorm();
        Assert.assertEquals(0, revertError, 0.45);
        Assert.assertEquals(2, adapterPropagator.propagate(t).getAdditionalState("dummy 1").length);
        Assert.assertEquals(1, adapterPropagator.propagate(t).getAdditionalState("dummy 2").length);
        Assert.assertEquals(3, adapterPropagator.propagate(t).getAdditionalState("dummy 3").length);
    }
}
Also used : Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) PVCoordinates(org.orekit.utils.PVCoordinates) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) SmallManeuverAnalyticalModel(org.orekit.forces.maneuvers.SmallManeuverAnalyticalModel) CircularOrbit(org.orekit.orbits.CircularOrbit) AdditionalStateProvider(org.orekit.propagation.AdditionalStateProvider) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) BoundedPropagator(org.orekit.propagation.BoundedPropagator) LofOffset(org.orekit.attitudes.LofOffset) Test(org.junit.Test)

Aggregations

LofOffset (org.orekit.attitudes.LofOffset)58 Test (org.junit.Test)52 SpacecraftState (org.orekit.propagation.SpacecraftState)37 Orbit (org.orekit.orbits.Orbit)30 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)29 AbsoluteDate (org.orekit.time.AbsoluteDate)29 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)26 CartesianOrbit (org.orekit.orbits.CartesianOrbit)20 AttitudeProvider (org.orekit.attitudes.AttitudeProvider)18 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)17 CircularOrbit (org.orekit.orbits.CircularOrbit)15 Propagator (org.orekit.propagation.Propagator)13 DateComponents (org.orekit.time.DateComponents)13 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)12 TimeComponents (org.orekit.time.TimeComponents)12 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)11 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)9 BoundedPropagator (org.orekit.propagation.BoundedPropagator)9 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)9 Context (org.orekit.estimation.Context)8