Search in sources :

Example 51 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class BatchLSEstimatorTest method testMultiSat.

@Test
public void testMultiSat() throws OrekitException {
    Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");
    final NumericalPropagatorBuilder propagatorBuilder1 = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0);
    final NumericalPropagatorBuilder propagatorBuilder2 = context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true, 1.0e-6, 60.0, 1.0);
    // Create perfect inter-satellites range measurements
    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, propagatorBuilder2);
    closePropagator.setEphemerisMode();
    closePropagator.propagate(context.initialOrbit.getDate().shiftedBy(3.5 * closeOrbit.getKeplerianPeriod()));
    final BoundedPropagator ephemeris = closePropagator.getGeneratedEphemeris();
    Propagator propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
    final List<ObservedMeasurement<?>> r12 = EstimationTestUtils.createMeasurements(propagator1, new InterSatellitesRangeMeasurementCreator(ephemeris), 1.0, 3.0, 300.0);
    // create perfect range measurements for first satellite
    propagator1 = EstimationTestUtils.createPropagator(context.initialOrbit, propagatorBuilder1);
    final List<ObservedMeasurement<?>> r1 = EstimationTestUtils.createMeasurements(propagator1, new RangeMeasurementCreator(context), 1.0, 3.0, 300.0);
    // create orbit estimator
    final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(), propagatorBuilder1, propagatorBuilder2);
    for (final ObservedMeasurement<?> interSat : r12) {
        estimator.addMeasurement(interSat);
    }
    for (final ObservedMeasurement<?> range : r1) {
        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(r12.size() + r1.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(r12.size() + r1.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;
            }
        }
    });
    List<DelegatingDriver> parameters = estimator.getOrbitalParametersDrivers(true).getDrivers();
    ParameterDriver a0Driver = parameters.get(0);
    Assert.assertEquals("a[0]", a0Driver.getName());
    a0Driver.setValue(a0Driver.getValue() + 1.2);
    a0Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    ParameterDriver a1Driver = parameters.get(6);
    Assert.assertEquals("a[1]", a1Driver.getName());
    a1Driver.setValue(a1Driver.getValue() - 5.4);
    a1Driver.setReferenceDate(AbsoluteDate.GALILEO_EPOCH);
    final Orbit before = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
    Assert.assertEquals(4.7246, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), before.getPVCoordinates().getPosition()), 1.0e-3);
    Assert.assertEquals(0.0010514, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), before.getPVCoordinates().getVelocity()), 1.0e-6);
    EstimationTestUtils.checkFit(context, estimator, 2, 3, 0.0, 2.3e-06, 0.0, 6.6e-06, 0.0, 6.2e-07, 0.0, 2.8e-10);
    final Orbit determined = new KeplerianOrbit(parameters.get(6).getValue(), parameters.get(7).getValue(), parameters.get(8).getValue(), parameters.get(9).getValue(), parameters.get(10).getValue(), parameters.get(11).getValue(), PositionAngle.TRUE, closeOrbit.getFrame(), closeOrbit.getDate(), closeOrbit.getMu());
    Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getPosition(), determined.getPVCoordinates().getPosition()), 1.6e-6);
    Assert.assertEquals(0.0, Vector3D.distance(closeOrbit.getPVCoordinates().getVelocity(), determined.getPVCoordinates().getVelocity()), 1.6e-9);
    // got a default one
    for (final ParameterDriver driver : estimator.getOrbitalParametersDrivers(true).getDrivers()) {
        if (driver.getName().startsWith("a[")) {
            // 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(propagatorBuilder1.getInitialOrbitDate()), 1.0e-15);
        }
    }
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ParameterDriversList(org.orekit.utils.ParameterDriversList) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Propagator(org.orekit.propagation.Propagator) OrekitException(org.orekit.errors.OrekitException) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DelegatingDriver(org.orekit.utils.ParameterDriversList.DelegatingDriver) BoundedPropagator(org.orekit.propagation.BoundedPropagator) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) EstimationsProvider(org.orekit.estimation.measurements.EstimationsProvider) 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) ParameterDriver(org.orekit.utils.ParameterDriver) LevenbergMarquardtOptimizer(org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOptimizer) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) RangeMeasurementCreator(org.orekit.estimation.measurements.RangeMeasurementCreator) InterSatellitesRangeMeasurementCreator(org.orekit.estimation.measurements.InterSatellitesRangeMeasurementCreator) Test(org.junit.Test)

Example 52 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class OrbitDetermination method createOrbit.

/**
 * Create an orbit from input parameters
 * @param parser input file parser
 * @param mu     central attraction coefficient
 * @throws NoSuchElementException if input parameters are missing
 * @throws OrekitException if inertial frame cannot be created
 */
private Orbit createOrbit(final KeyValueFileParser<ParameterKey> parser, final double mu) throws NoSuchElementException, OrekitException {
    final Frame frame;
    if (!parser.containsKey(ParameterKey.INERTIAL_FRAME)) {
        frame = FramesFactory.getEME2000();
    } else {
        frame = parser.getInertialFrame(ParameterKey.INERTIAL_FRAME);
    }
    // Orbit definition
    PositionAngle angleType = PositionAngle.MEAN;
    if (parser.containsKey(ParameterKey.ORBIT_ANGLE_TYPE)) {
        angleType = PositionAngle.valueOf(parser.getString(ParameterKey.ORBIT_ANGLE_TYPE).toUpperCase());
    }
    if (parser.containsKey(ParameterKey.ORBIT_KEPLERIAN_A)) {
        return new KeplerianOrbit(parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_A), parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_E), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_I), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_PA), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_RAAN), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_ANOMALY), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_EQUINOCTIAL_A)) {
        return new EquinoctialOrbit(parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_A), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EY), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HY), parser.getAngle(ParameterKey.ORBIT_EQUINOCTIAL_LAMBDA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_CIRCULAR_A)) {
        return new CircularOrbit(parser.getDouble(ParameterKey.ORBIT_CIRCULAR_A), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EX), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EY), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_I), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_RAAN), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_ALPHA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_TLE_LINE_1)) {
        final String line1 = parser.getString(ParameterKey.ORBIT_TLE_LINE_1);
        final String line2 = parser.getString(ParameterKey.ORBIT_TLE_LINE_2);
        final TLE tle = new TLE(line1, line2);
        TLEPropagator propagator = TLEPropagator.selectExtrapolator(tle);
        // propagator.setEphemerisMode();
        AbsoluteDate initDate = tle.getDate();
        SpacecraftState initialState = propagator.getInitialState();
        // Transformation from TEME to frame.
        return new CartesianOrbit(initialState.getPVCoordinates(FramesFactory.getEME2000()), frame, initDate, mu);
    } else {
        final double[] pos = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PX), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PY), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PZ) };
        final double[] vel = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VX), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VY), parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VZ) };
        return new CartesianOrbit(new PVCoordinates(new Vector3D(pos), new Vector3D(vel)), frame, parser.getDate(ParameterKey.ORBIT_DATE, TimeScalesFactory.getUTC()), mu);
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) PositionAngle(org.orekit.orbits.PositionAngle) PVCoordinates(org.orekit.utils.PVCoordinates) TLEPropagator(org.orekit.propagation.analytical.tle.TLEPropagator) TLE(org.orekit.propagation.analytical.tle.TLE) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit)

Example 53 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class Frames1 method main.

public static void main(String[] args) {
    try {
        // configure Orekit
        File home = new File(System.getProperty("user.home"));
        File orekitData = new File(home, "orekit-data");
        if (!orekitData.exists()) {
            System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
            System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
            System.exit(1);
        }
        DataProvidersManager manager = DataProvidersManager.getInstance();
        manager.addProvider(new DirectoryCrawler(orekitData));
        // Initial state definition : date, orbit
        TimeScale utc = TimeScalesFactory.getUTC();
        AbsoluteDate initialDate = new AbsoluteDate(2008, 10, 01, 0, 0, 00.000, utc);
        // gravitation coefficient
        double mu = 3.986004415e+14;
        // inertial frame for orbit definition
        Frame inertialFrame = FramesFactory.getEME2000();
        Vector3D posisat = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        Vector3D velosat = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        PVCoordinates pvsat = new PVCoordinates(posisat, velosat);
        Orbit initialOrbit = new CartesianOrbit(pvsat, inertialFrame, initialDate, mu);
        // Propagator : consider a simple Keplerian motion
        Propagator kepler = new KeplerianPropagator(initialOrbit);
        // Earth and frame
        Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame);
        // Station
        final double longitude = FastMath.toRadians(45.);
        final double latitude = FastMath.toRadians(25.);
        final double altitude = 0.;
        final GeodeticPoint station = new GeodeticPoint(latitude, longitude, altitude);
        final TopocentricFrame staF = new TopocentricFrame(earth, station, "station");
        System.out.println("          time           doppler (m/s)");
        // Stop date
        final AbsoluteDate finalDate = new AbsoluteDate(initialDate, 6000, utc);
        // Loop
        AbsoluteDate extrapDate = initialDate;
        while (extrapDate.compareTo(finalDate) <= 0) {
            // We can simply get the position and velocity of spacecraft in station frame at any time
            PVCoordinates pvInert = kepler.propagate(extrapDate).getPVCoordinates();
            PVCoordinates pvStation = inertialFrame.getTransformTo(staF, extrapDate).transformPVCoordinates(pvInert);
            // And then calculate the doppler signal
            double doppler = Vector3D.dotProduct(pvStation.getPosition(), pvStation.getVelocity()) / pvStation.getPosition().getNorm();
            System.out.format(Locale.US, "%s   %9.3f%n", extrapDate, doppler);
            extrapDate = extrapDate.shiftedBy(600);
        }
    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}
Also used : Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) PVCoordinates(org.orekit.utils.PVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) TimeScale(org.orekit.time.TimeScale) BodyShape(org.orekit.bodies.BodyShape) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) DirectoryCrawler(org.orekit.data.DirectoryCrawler) DataProvidersManager(org.orekit.data.DataProvidersManager) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) File(java.io.File)

Example 54 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class DSSTPropagation method createOrbit.

/**
 * Create an orbit from input parameters
 * @param parser input file parser
 * @param scale  time scale
 * @param mu     central attraction coefficient
 * @throws OrekitException if inertial frame cannot be retrieved
 * @throws NoSuchElementException if input parameters are missing
 * @throws IOException if input parameters are invalid
 */
private Orbit createOrbit(final KeyValueFileParser<ParameterKey> parser, final TimeScale scale, final double mu) throws OrekitException, NoSuchElementException, IOException {
    final Frame frame;
    if (!parser.containsKey(ParameterKey.INERTIAL_FRAME)) {
        frame = FramesFactory.getEME2000();
    } else {
        frame = parser.getInertialFrame(ParameterKey.INERTIAL_FRAME);
    }
    // Orbit definition
    Orbit orbit;
    PositionAngle angleType = PositionAngle.MEAN;
    if (parser.containsKey(ParameterKey.ORBIT_ANGLE_TYPE)) {
        angleType = PositionAngle.valueOf(parser.getString(ParameterKey.ORBIT_ANGLE_TYPE).toUpperCase());
    }
    if (parser.containsKey(ParameterKey.ORBIT_KEPLERIAN_A)) {
        orbit = new KeplerianOrbit(parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_A) * 1000., parser.getDouble(ParameterKey.ORBIT_KEPLERIAN_E), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_I), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_PA), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_RAAN), parser.getAngle(ParameterKey.ORBIT_KEPLERIAN_ANOMALY), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, scale), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_EQUINOCTIAL_A)) {
        orbit = new EquinoctialOrbit(parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_A) * 1000., parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_EY), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HX), parser.getDouble(ParameterKey.ORBIT_EQUINOCTIAL_HY), parser.getAngle(ParameterKey.ORBIT_EQUINOCTIAL_LAMBDA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, scale), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_CIRCULAR_A)) {
        orbit = new CircularOrbit(parser.getDouble(ParameterKey.ORBIT_CIRCULAR_A) * 1000., parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EX), parser.getDouble(ParameterKey.ORBIT_CIRCULAR_EY), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_I), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_RAAN), parser.getAngle(ParameterKey.ORBIT_CIRCULAR_ALPHA), angleType, frame, parser.getDate(ParameterKey.ORBIT_DATE, scale), mu);
    } else if (parser.containsKey(ParameterKey.ORBIT_CARTESIAN_PX)) {
        final double[] pos = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PX) * 1000., parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PY) * 1000., parser.getDouble(ParameterKey.ORBIT_CARTESIAN_PZ) * 1000. };
        final double[] vel = { parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VX) * 1000., parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VY) * 1000., parser.getDouble(ParameterKey.ORBIT_CARTESIAN_VZ) * 1000. };
        orbit = new CartesianOrbit(new PVCoordinates(new Vector3D(pos), new Vector3D(vel)), frame, parser.getDate(ParameterKey.ORBIT_DATE, scale), mu);
    } else {
        throw new IOException("Orbit definition is incomplete.");
    }
    return orbit;
}
Also used : Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) 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) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PositionAngle(org.orekit.orbits.PositionAngle) PVCoordinates(org.orekit.utils.PVCoordinates) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) IOException(java.io.IOException)

Example 55 with CartesianOrbit

use of org.orekit.orbits.CartesianOrbit in project Orekit by CS-SI.

the class PVCoordinatesTest method testJerkIsAccelerationDerivative.

@Test
public void testJerkIsAccelerationDerivative() throws OrekitException {
    final CartesianOrbit orbit = new CartesianOrbit(new PVCoordinates(new Vector3D(-4947831., -3765382., -3708221.), new Vector3D(-2079., 5291., -7842.)), FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, Constants.EIGEN5C_EARTH_MU);
    FieldPVCoordinates<DerivativeStructure> fv1 = orbit.getPVCoordinates().toDerivativeStructurePV(1);
    Vector3D numericalJerk = differentiate(orbit, o -> o.getPVCoordinates().getAcceleration());
    Assert.assertEquals(numericalJerk.getX(), fv1.getAcceleration().getX().getPartialDerivative(1), 1.0e-13);
    Assert.assertEquals(numericalJerk.getY(), fv1.getAcceleration().getY().getPartialDerivative(1), 1.0e-13);
    Assert.assertEquals(numericalJerk.getZ(), fv1.getAcceleration().getZ().getPartialDerivative(1), 1.0e-13);
    FieldPVCoordinates<DerivativeStructure> fv2 = orbit.getPVCoordinates().toDerivativeStructurePV(2);
    Assert.assertEquals(numericalJerk.getX(), fv2.getAcceleration().getX().getPartialDerivative(1), 1.0e-13);
    Assert.assertEquals(numericalJerk.getY(), fv2.getAcceleration().getY().getPartialDerivative(1), 1.0e-13);
    Assert.assertEquals(numericalJerk.getZ(), fv2.getAcceleration().getZ().getPartialDerivative(1), 1.0e-13);
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) Test(org.junit.Test)

Aggregations

CartesianOrbit (org.orekit.orbits.CartesianOrbit)57 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)48 AbsoluteDate (org.orekit.time.AbsoluteDate)43 SpacecraftState (org.orekit.propagation.SpacecraftState)38 Test (org.junit.Test)37 PVCoordinates (org.orekit.utils.PVCoordinates)32 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)28 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)25 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)22 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)20 Orbit (org.orekit.orbits.Orbit)20 Frame (org.orekit.frames.Frame)17 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)15 OrekitException (org.orekit.errors.OrekitException)14 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)14 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)13 BoundedPropagator (org.orekit.propagation.BoundedPropagator)11 Propagator (org.orekit.propagation.Propagator)10 TimeScale (org.orekit.time.TimeScale)10 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9