Search in sources :

Example 11 with PVCoordinates

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

the class OrbitDeterminationTest method run.

private ResultOD run(final File input, final boolean print) throws IOException, IllegalArgumentException, OrekitException, ParseException {
    // read input parameters
    KeyValueFileParser<ParameterKey> parser = new KeyValueFileParser<ParameterKey>(ParameterKey.class);
    parser.parseInput(input.getAbsolutePath(), new FileInputStream(input));
    // log file
    final RangeLog rangeLog = new RangeLog();
    final RangeRateLog rangeRateLog = new RangeRateLog();
    final AzimuthLog azimuthLog = new AzimuthLog();
    final ElevationLog elevationLog = new ElevationLog();
    final PositionLog positionLog = new PositionLog();
    final VelocityLog velocityLog = new VelocityLog();
    // gravity field
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("eigen-5c.gfc", true));
    final NormalizedSphericalHarmonicsProvider gravityField = createGravityField(parser);
    // Orbit initial guess
    final Orbit initialGuess = createOrbit(parser, gravityField.getMu());
    // IERS conventions
    final IERSConventions conventions;
    if (!parser.containsKey(ParameterKey.IERS_CONVENTIONS)) {
        conventions = IERSConventions.IERS_2010;
    } else {
        conventions = IERSConventions.valueOf("IERS_" + parser.getInt(ParameterKey.IERS_CONVENTIONS));
    }
    // central body
    final OneAxisEllipsoid body = createBody(parser);
    // propagator builder
    final NumericalPropagatorBuilder propagatorBuilder = createPropagatorBuilder(parser, conventions, gravityField, body, initialGuess);
    // estimator
    final BatchLSEstimator estimator = createEstimator(parser, propagatorBuilder);
    // measurements
    final List<ObservedMeasurement<?>> measurements = new ArrayList<ObservedMeasurement<?>>();
    for (final String fileName : parser.getStringsList(ParameterKey.MEASUREMENTS_FILES, ',')) {
        measurements.addAll(readMeasurements(new File(input.getParentFile(), fileName), createStationsData(parser, body), createPVData(parser), createSatRangeBias(parser), createWeights(parser), createRangeOutliersManager(parser), createRangeRateOutliersManager(parser), createAzElOutliersManager(parser), createPVOutliersManager(parser)));
    }
    for (ObservedMeasurement<?> measurement : measurements) {
        estimator.addMeasurement(measurement);
    }
    if (print) {
        estimator.setObserver(new BatchLSObserver() {

            private PVCoordinates previousPV;

            {
                previousPV = initialGuess.getPVCoordinates();
                final String header = "iteration evaluations      ΔP(m)        ΔV(m/s)           RMS          nb Range    nb Range-rate  nb Angular     nb PV%n";
                System.out.format(Locale.US, header);
            }

            /**
             * {@inheritDoc}
             */
            @Override
            public void evaluationPerformed(final int iterationsCount, final int evaluationsCount, final Orbit[] orbits, final ParameterDriversList estimatedOrbitalParameters, final ParameterDriversList estimatedPropagatorParameters, final ParameterDriversList estimatedMeasurementsParameters, final EstimationsProvider evaluationsProvider, final LeastSquaresProblem.Evaluation lspEvaluation) {
                PVCoordinates currentPV = orbits[0].getPVCoordinates();
                final String format0 = "    %2d         %2d                                 %16.12f     %s       %s     %s     %s%n";
                final String format = "    %2d         %2d      %13.6f %12.9f %16.12f     %s       %s     %s     %s%n";
                final EvaluationCounter<Range> rangeCounter = new EvaluationCounter<Range>();
                final EvaluationCounter<RangeRate> rangeRateCounter = new EvaluationCounter<RangeRate>();
                final EvaluationCounter<AngularAzEl> angularCounter = new EvaluationCounter<AngularAzEl>();
                final EvaluationCounter<PV> pvCounter = new EvaluationCounter<PV>();
                for (final Map.Entry<ObservedMeasurement<?>, EstimatedMeasurement<?>> entry : estimator.getLastEstimations().entrySet()) {
                    if (entry.getKey() instanceof Range) {
                        @SuppressWarnings("unchecked") EstimatedMeasurement<Range> evaluation = (EstimatedMeasurement<Range>) entry.getValue();
                        rangeCounter.add(evaluation);
                    } else if (entry.getKey() instanceof RangeRate) {
                        @SuppressWarnings("unchecked") EstimatedMeasurement<RangeRate> evaluation = (EstimatedMeasurement<RangeRate>) entry.getValue();
                        rangeRateCounter.add(evaluation);
                    } else if (entry.getKey() instanceof AngularAzEl) {
                        @SuppressWarnings("unchecked") EstimatedMeasurement<AngularAzEl> evaluation = (EstimatedMeasurement<AngularAzEl>) entry.getValue();
                        angularCounter.add(evaluation);
                    } else if (entry.getKey() instanceof PV) {
                        @SuppressWarnings("unchecked") EstimatedMeasurement<PV> evaluation = (EstimatedMeasurement<PV>) entry.getValue();
                        pvCounter.add(evaluation);
                    }
                }
                if (evaluationsCount == 1) {
                    System.out.format(Locale.US, format0, iterationsCount, evaluationsCount, lspEvaluation.getRMS(), rangeCounter.format(8), rangeRateCounter.format(8), angularCounter.format(8), pvCounter.format(8));
                } else {
                    System.out.format(Locale.US, format, iterationsCount, evaluationsCount, Vector3D.distance(previousPV.getPosition(), currentPV.getPosition()), Vector3D.distance(previousPV.getVelocity(), currentPV.getVelocity()), lspEvaluation.getRMS(), rangeCounter.format(8), rangeRateCounter.format(8), angularCounter.format(8), pvCounter.format(8));
                }
                previousPV = currentPV;
            }
        });
    }
    Orbit estimated = estimator.estimate()[0].getInitialState().getOrbit();
    // compute some statistics
    for (final Map.Entry<ObservedMeasurement<?>, EstimatedMeasurement<?>> entry : estimator.getLastEstimations().entrySet()) {
        if (entry.getKey() instanceof Range) {
            @SuppressWarnings("unchecked") EstimatedMeasurement<Range> evaluation = (EstimatedMeasurement<Range>) entry.getValue();
            rangeLog.add(evaluation);
        } else if (entry.getKey() instanceof RangeRate) {
            @SuppressWarnings("unchecked") EstimatedMeasurement<RangeRate> evaluation = (EstimatedMeasurement<RangeRate>) entry.getValue();
            rangeRateLog.add(evaluation);
        } else if (entry.getKey() instanceof AngularAzEl) {
            @SuppressWarnings("unchecked") EstimatedMeasurement<AngularAzEl> evaluation = (EstimatedMeasurement<AngularAzEl>) entry.getValue();
            azimuthLog.add(evaluation);
            elevationLog.add(evaluation);
        } else if (entry.getKey() instanceof PV) {
            @SuppressWarnings("unchecked") EstimatedMeasurement<PV> evaluation = (EstimatedMeasurement<PV>) entry.getValue();
            positionLog.add(evaluation);
            velocityLog.add(evaluation);
        }
    }
    // parmaters and measurements.
    final ParameterDriversList propagatorParameters = estimator.getPropagatorParametersDrivers(true);
    final ParameterDriversList measurementsParameters = estimator.getMeasurementsParametersDrivers(true);
    // instation of results
    return new ResultOD(propagatorParameters, measurementsParameters, estimator.getIterationsCount(), estimator.getEvaluationsCount(), estimated.getPVCoordinates(), rangeLog.createStatisticsSummary(), rangeRateLog.createStatisticsSummary(), azimuthLog.createStatisticsSummary(), elevationLog.createStatisticsSummary(), positionLog.createStatisticsSummary(), velocityLog.createStatisticsSummary(), estimator.getPhysicalCovariances(1.0e-10));
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) PV(org.orekit.estimation.measurements.PV) ArrayList(java.util.ArrayList) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) ObservedMeasurement(org.orekit.estimation.measurements.ObservedMeasurement) EstimatedMeasurement(org.orekit.estimation.measurements.EstimatedMeasurement) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Range(org.orekit.estimation.measurements.Range) FileInputStream(java.io.FileInputStream) NumericalPropagatorBuilder(org.orekit.propagation.conversion.NumericalPropagatorBuilder) RangeRate(org.orekit.estimation.measurements.RangeRate) File(java.io.File) AngularAzEl(org.orekit.estimation.measurements.AngularAzEl) Map(java.util.Map) HashMap(java.util.HashMap) ParameterDriversList(org.orekit.utils.ParameterDriversList) LeastSquaresProblem(org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) EstimationsProvider(org.orekit.estimation.measurements.EstimationsProvider) KeyValueFileParser(org.orekit.KeyValueFileParser) IERSConventions(org.orekit.utils.IERSConventions) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Example 12 with PVCoordinates

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

the class KalmanOrbitDeterminationTest 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.
        Transform t = FramesFactory.getTEME().getTransformTo(FramesFactory.getEME2000(), initDate.getDate());
        return new CartesianOrbit(t.transformPVCoordinates(initialState.getPVCoordinates()), 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) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) 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) Transform(org.orekit.frames.Transform)

Example 13 with PVCoordinates

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

the class OPMParserTest method testParseOPM1.

@Test
public void testParseOPM1() throws OrekitException {
    // simple test for OPM file, contains p/v entries and other mandatory
    // data.
    final String ex = "/ccsds/OPMExample.txt";
    final OPMParser parser = new OPMParser().withMu(398600e9).withConventions(IERSConventions.IERS_2010).withSimpleEOP(true);
    final InputStream inEntry = getClass().getResourceAsStream(ex);
    final OPMFile file = parser.parse(inEntry, "OPMExample.txt");
    Assert.assertEquals(IERSConventions.IERS_2010, file.getConventions());
    // Check Header Block;
    Assert.assertEquals(2.0, file.getFormatVersion(), 1.0e-10);
    Assert.assertEquals(new AbsoluteDate(1998, 11, 06, 9, 23, 57, TimeScalesFactory.getUTC()), file.getCreationDate());
    Assert.assertEquals("JAXA", file.getOriginator());
    // Check Metadata Block;
    Assert.assertEquals("GODZILLA 5", file.getMetaData().getObjectName());
    Assert.assertEquals("1998-057A", file.getMetaData().getObjectID());
    Assert.assertEquals(1998, file.getMetaData().getLaunchYear());
    Assert.assertEquals(57, file.getMetaData().getLaunchNumber());
    Assert.assertEquals("A", file.getMetaData().getLaunchPiece());
    Assert.assertEquals("EARTH", file.getMetaData().getCenterName());
    Assert.assertTrue(file.getMetaData().getHasCreatableBody());
    Assert.assertEquals(CelestialBodyFactory.getEarth(), file.getMetaData().getCenterBody());
    Assert.assertEquals(CCSDSFrame.ITRF97.toString(), file.getMetaData().getFrame().getName());
    Assert.assertEquals(CcsdsTimeScale.TAI, file.getMetaData().getTimeSystem());
    Assert.assertFalse(file.hasCovarianceMatrix());
    // Check State Vector data Block;
    Assert.assertEquals(new AbsoluteDate(1998, 12, 18, 14, 28, 15.1172, TimeScalesFactory.getTAI()), file.getEpoch());
    checkPVEntry(new PVCoordinates(new Vector3D(6503514.000, 1239647.000, -717490.000), new Vector3D(-873.160, 8740.420, -4191.076)), file.getPVCoordinates());
    try {
        file.generateCartesianOrbit();
        Assert.fail("an exception should have been thrown");
    } catch (OrekitIllegalArgumentException oiae) {
        Assert.assertEquals(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME, oiae.getSpecifier());
        Assert.assertEquals("ITRF97", oiae.getParts()[0]);
    }
    try {
        file.generateKeplerianOrbit();
        Assert.fail("an exception should have been thrown");
    } catch (OrekitIllegalArgumentException oiae) {
        Assert.assertEquals(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME, oiae.getSpecifier());
        Assert.assertEquals("ITRF97", oiae.getParts()[0]);
    }
    try {
        file.generateSpacecraftState();
        Assert.fail("an exception should have been thrown");
    } catch (OrekitIllegalArgumentException oiae) {
        Assert.assertEquals(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME, oiae.getSpecifier());
        Assert.assertEquals("ITRF97", oiae.getParts()[0]);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InputStream(java.io.InputStream) PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) OrekitIllegalArgumentException(org.orekit.errors.OrekitIllegalArgumentException) Test(org.junit.Test)

Example 14 with PVCoordinates

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

the class OPMParserTest method testParseOPM2.

@Test
public void testParseOPM2() throws OrekitException {
    // simple test for OPM file, contains all mandatory information plus
    // Keplerian elements, Spacecraft parameters and 2 maneuvers.
    final String ex = "/ccsds/OPMExample2.txt";
    final OPMParser parser = new OPMParser();
    final InputStream inEntry = getClass().getResourceAsStream(ex);
    final OPMFile file = parser.parse(inEntry, "OPMExample2.txt");
    try {
        file.getConventions();
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS, oe.getSpecifier());
    }
    // Check Header Block;
    Assert.assertEquals(2.0, file.getFormatVersion(), 1.0e-10);
    ArrayList<String> headerComment = new ArrayList<String>();
    headerComment.add("Generated by GSOC, R. Kiehling");
    headerComment.add("Current intermediate orbit IO2 and maneuver planning data");
    Assert.assertEquals(headerComment, file.getHeaderComment());
    Assert.assertEquals(new AbsoluteDate(2000, 06, 03, 05, 33, 00, TimeScalesFactory.getUTC()), file.getCreationDate());
    Assert.assertEquals(file.getOriginator(), "GSOC");
    // Check Metadata Block;
    Assert.assertEquals("EUTELSAT W4", file.getMetaData().getObjectName());
    Assert.assertEquals("2000-028A", file.getMetaData().getObjectID());
    Assert.assertEquals("EARTH", file.getMetaData().getCenterName());
    Assert.assertTrue(file.getMetaData().getHasCreatableBody());
    Assert.assertEquals(CelestialBodyFactory.getEarth(), file.getMetaData().getCenterBody());
    Assert.assertEquals(FramesFactory.getGCRF(), file.getMetaData().getFrame());
    Assert.assertEquals(CcsdsTimeScale.GPS, file.getMetaData().getTimeSystem());
    Assert.assertEquals(0, file.getMetaDataComment().size());
    // Check Data State Vector block
    ArrayList<String> epochComment = new ArrayList<String>();
    epochComment.add("State Vector");
    Assert.assertEquals(epochComment, file.getEpochComment());
    Assert.assertEquals(new AbsoluteDate(2006, 06, 03, 00, 00, 00, TimeScalesFactory.getGPS()), file.getEpoch());
    checkPVEntry(new PVCoordinates(new Vector3D(6655994.2, -40218575.1, -82917.7), new Vector3D(3115.48208, 470.42605, -1.01495)), file.getPVCoordinates());
    // Check Data Keplerian Elements block
    Assert.assertTrue(file.hasKeplerianElements());
    ArrayList<String> keplerianElementsComment = new ArrayList<String>();
    keplerianElementsComment.add("Keplerian elements");
    Assert.assertEquals(keplerianElementsComment, file.getKeplerianElementsComment());
    Assert.assertEquals(41399512.3, file.getA(), 1e-6);
    Assert.assertEquals(0.020842611, file.getE(), 1e-10);
    Assert.assertEquals(FastMath.toRadians(0.117746), file.getI(), 1e-10);
    Assert.assertEquals(FastMath.toRadians(17.604721), file.getRaan(), 1e-10);
    Assert.assertEquals(FastMath.toRadians(218.242943), file.getPa(), 1e-10);
    Assert.assertEquals(PositionAngle.TRUE, file.getAnomalyType());
    Assert.assertEquals(FastMath.toRadians(41.922339), file.getAnomaly(), 1e-10);
    Assert.assertEquals(398600.4415 * 1e9, file.getMuParsed(), 1e-10);
    // Check Data Spacecraft block
    ArrayList<String> spacecraftComment = new ArrayList<String>();
    spacecraftComment.add("Spacecraft parameters");
    Assert.assertEquals(spacecraftComment, file.getSpacecraftComment());
    Assert.assertEquals(1913.000, file.getMass(), 1e-10);
    Assert.assertEquals(10.000, file.getSolarRadArea(), 1e-10);
    Assert.assertEquals(1.300, file.getSolarRadCoeff(), 1e-10);
    Assert.assertEquals(10.000, file.getDragArea(), 1e-10);
    Assert.assertEquals(2.300, file.getDragCoeff(), 1e-10);
    // Check Data Maneuvers block
    Assert.assertTrue(file.getHasManeuver());
    Assert.assertEquals(3, file.getNbManeuvers());
    ArrayList<String> stateManeuverComment0 = new ArrayList<String>();
    stateManeuverComment0.add("2 planned maneuvers");
    stateManeuverComment0.add("First maneuver: AMF-3");
    stateManeuverComment0.add("Non-impulsive, thrust direction fixed in inertial frame");
    Assert.assertEquals(stateManeuverComment0, file.getManeuver(0).getComment());
    Assert.assertEquals(new AbsoluteDate(2000, 06, 03, 9, 00, 34.1, TimeScalesFactory.getGPS()), file.getManeuvers().get(0).getEpochIgnition());
    Assert.assertEquals(132.6, file.getManeuver(0).getDuration(), 1e-10);
    Assert.assertEquals(-18.418, file.getManeuver(0).getDeltaMass(), 1e-10);
    Assert.assertNull(file.getManeuver(0).getRefLofType());
    Assert.assertEquals(FramesFactory.getEME2000(), file.getManeuver(0).getRefFrame());
    Assert.assertEquals(0.0, new Vector3D(-23.25700, 16.83160, -8.93444).distance(file.getManeuver(0).getDV()), 1.0e-10);
    ArrayList<String> stateManeuverComment1 = new ArrayList<String>();
    stateManeuverComment1.add("Second maneuver: first station acquisition maneuver");
    stateManeuverComment1.add("impulsive, thrust direction fixed in RTN frame");
    Assert.assertEquals(stateManeuverComment1, file.getManeuver(1).getComment());
    Assert.assertEquals(new AbsoluteDate(2000, 06, 05, 18, 59, 21, TimeScalesFactory.getGPS()), file.getManeuvers().get(1).getEpochIgnition());
    Assert.assertEquals(0.0, file.getManeuver(1).getDuration(), 1e-10);
    Assert.assertEquals(-1.469, file.getManeuver(1).getDeltaMass(), 1e-10);
    Assert.assertEquals(LOFType.QSW, file.getManeuver(1).getRefLofType());
    Assert.assertNull(file.getManeuver(1).getRefFrame());
    Assert.assertEquals(0.0, new Vector3D(1.015, -1.873, 0.0).distance(file.getManeuver(1).getDV()), 1.0e-10);
    Assert.assertTrue(file.getManeuver(2).getComment().isEmpty());
    Assert.assertEquals(new AbsoluteDate(2000, 06, 05, 18, 59, 51, TimeScalesFactory.getGPS()), file.getManeuvers().get(2).getEpochIgnition());
    Assert.assertEquals(0.0, file.getManeuver(2).getDuration(), 1e-10);
    Assert.assertEquals(-1.469, file.getManeuver(2).getDeltaMass(), 1e-10);
    Assert.assertEquals(LOFType.QSW, file.getManeuver(2).getRefLofType());
    Assert.assertNull(file.getManeuver(2).getRefFrame());
    Assert.assertEquals(0.0, new Vector3D(1.015, -1.873, 0.0).distance(file.getManeuver(2).getDV()), 1.0e-10);
    file.generateCartesianOrbit();
    file.generateKeplerianOrbit();
    file.generateSpacecraftState();
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 15 with PVCoordinates

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

the class SP3ParserTest method testParseSP3c2.

@Test
public void testParseSP3c2() throws OrekitException, IOException {
    // simple test for version sp3-c, contains p/v entries and correlations
    final String ex = "/sp3/example-c-2.sp3";
    final SP3Parser parser = new SP3Parser();
    final InputStream inEntry = getClass().getResourceAsStream(ex);
    final SP3File file = parser.parse(inEntry);
    Assert.assertEquals(SP3OrbitType.HLM, file.getOrbitType());
    Assert.assertEquals(TimeSystem.GPS, file.getTimeSystem());
    Assert.assertEquals(26, file.getSatelliteCount());
    final List<SP3Coordinate> coords = file.getSatellites().get("G01").getCoordinates();
    Assert.assertEquals(2, coords.size());
    final SP3Coordinate coord = coords.get(0);
    // 2001  8  8  0  0  0.00000000
    Assert.assertEquals(new AbsoluteDate(2001, 8, 8, 0, 0, 0, TimeScalesFactory.getGPS()), coord.getDate());
    // PG01 -11044.805800 -10475.672350  21929.418200    189.163300 18 18 18 219
    // VG01  20298.880364 -18462.044804   1381.387685     -4.534317 14 14 14 191
    checkPVEntry(new PVCoordinates(new Vector3D(-11044805.8, -10475672.35, 21929418.2), new Vector3D(2029.8880364, -1846.2044804, 138.1387685)), coord);
}
Also used : SP3Coordinate(org.orekit.files.sp3.SP3File.SP3Coordinate) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InputStream(java.io.InputStream) PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

PVCoordinates (org.orekit.utils.PVCoordinates)341 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)271 Test (org.junit.Test)242 AbsoluteDate (org.orekit.time.AbsoluteDate)189 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)159 SpacecraftState (org.orekit.propagation.SpacecraftState)95 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)76 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)73 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)71 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)67 Orbit (org.orekit.orbits.Orbit)65 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)57 Frame (org.orekit.frames.Frame)53 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)44 CartesianOrbit (org.orekit.orbits.CartesianOrbit)43 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)42 DateComponents (org.orekit.time.DateComponents)40 CircularOrbit (org.orekit.orbits.CircularOrbit)37 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)30 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)30