Search in sources :

Example 36 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.

the class KalmanOrbitDeterminationTest method testLageos2.

@Test
public // Orbit determination for Lageos2 based on SLR (range) measurements
void testLageos2() throws URISyntaxException, IllegalArgumentException, IOException, OrekitException, ParseException {
    // Print results on console
    final boolean print = false;
    // input in tutorial resources directory/output
    final String inputPath = KalmanOrbitDeterminationTest.class.getClassLoader().getResource("orbit-determination/Lageos2/od_test_Lageos2.in").toURI().getPath();
    final File input = new File(inputPath);
    // configure Orekit data acces
    Utils.setDataRoot("orbit-determination/Lageos2:potential/icgem-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("eigen-6s-truncated", true));
    // Choice of an orbit type to use
    // Default for test is Cartesian
    final OrbitType orbitType = OrbitType.CARTESIAN;
    // Initial orbital Cartesian covariance matrix
    // These covariances are derived from the deltas between initial and reference orbits
    // So in a way they are "perfect"...
    // Cartesian covariance matrix initialization
    final RealMatrix cartesianOrbitalP = MatrixUtils.createRealDiagonalMatrix(new double[] { 1e4, 4e3, 1, 5e-3, 6e-5, 1e-4 });
    // Orbital Cartesian process noise matrix (Q)
    final RealMatrix cartesianOrbitalQ = MatrixUtils.createRealDiagonalMatrix(new double[] { 1.e-4, 1.e-4, 1.e-4, 1.e-10, 1.e-10, 1.e-10 });
    // Initial measurement covariance matrix and process noise matrix
    final RealMatrix measurementP = MatrixUtils.createRealDiagonalMatrix(new double[] { 1., 1., 1., 1. });
    final RealMatrix measurementQ = MatrixUtils.createRealDiagonalMatrix(new double[] { 1e-6, 1e-6, 1e-6, 1e-6 });
    // Kalman orbit determination run.
    ResultKalman kalmanLageos2 = run(input, orbitType, print, cartesianOrbitalP, cartesianOrbitalQ, null, null, measurementP, measurementQ);
    // Definition of the accuracy for the test
    final double distanceAccuracy = 0.86;
    final double velocityAccuracy = 4.12e-3;
    // Tests
    // Note: The reference initial orbit is the same as in the batch LS tests
    // -----
    // Number of measurements processed
    final int numberOfMeas = 258;
    Assert.assertEquals(numberOfMeas, kalmanLageos2.getNumberOfMeasurements());
    // Estimated position and velocity
    final Vector3D estimatedPos = kalmanLageos2.getEstimatedPV().getPosition();
    final Vector3D estimatedVel = kalmanLageos2.getEstimatedPV().getVelocity();
    // Reference position and velocity at initial date (same as in batch LS test)
    final Vector3D refPos0 = new Vector3D(-5532131.956902, 10025696.592156, -3578940.040009);
    final Vector3D refVel0 = new Vector3D(-3871.275109, -607.880985, 4280.972530);
    // Run the reference until Kalman last date
    final Orbit refOrbit = runReference(input, orbitType, refPos0, refVel0, null, kalmanLageos2.getEstimatedPV().getDate());
    final Vector3D refPos = refOrbit.getPVCoordinates().getPosition();
    final Vector3D refVel = refOrbit.getPVCoordinates().getVelocity();
    // Check distances
    final double dP = Vector3D.distance(refPos, estimatedPos);
    final double dV = Vector3D.distance(refVel, estimatedVel);
    Assert.assertEquals(0.0, dP, distanceAccuracy);
    Assert.assertEquals(0.0, dV, velocityAccuracy);
    // Print orbit deltas
    if (print) {
        System.out.println("Test performances:");
        System.out.format("\t%-30s\n", "ΔEstimated / Reference");
        System.out.format(Locale.US, "\t%-10s %20.6f\n", "ΔP [m]", dP);
        System.out.format(Locale.US, "\t%-10s %20.6f\n", "ΔV [m/s]", dV);
    }
    // Test on measurements parameters
    final List<DelegatingDriver> list = new ArrayList<DelegatingDriver>();
    list.addAll(kalmanLageos2.measurementsParameters.getDrivers());
    sortParametersChanges(list);
    // Batch LS values
    // final double[] stationOffSet = { 1.659203,  0.861250,  -0.885352 };
    // final double rangeBias = -0.286275;
    final double[] stationOffSet = { 0.298867, -0.137456, 0.013315 };
    final double rangeBias = 0.002390;
    Assert.assertEquals(stationOffSet[0], list.get(0).getValue(), distanceAccuracy);
    Assert.assertEquals(stationOffSet[1], list.get(1).getValue(), distanceAccuracy);
    Assert.assertEquals(stationOffSet[2], list.get(2).getValue(), distanceAccuracy);
    Assert.assertEquals(rangeBias, list.get(3).getValue(), distanceAccuracy);
    // test on statistic for the range residuals
    final long nbRange = 258;
    // Batch LS values
    // final double[] RefStatRange = { -2.431135, 2.218644, 0.038483, 0.982017 };
    final double[] RefStatRange = { -23.561314, 20.436464, 0.964164, 5.687187 };
    Assert.assertEquals(nbRange, kalmanLageos2.getRangeStat().getN());
    Assert.assertEquals(RefStatRange[0], kalmanLageos2.getRangeStat().getMin(), distanceAccuracy);
    Assert.assertEquals(RefStatRange[1], kalmanLageos2.getRangeStat().getMax(), distanceAccuracy);
    Assert.assertEquals(RefStatRange[2], kalmanLageos2.getRangeStat().getMean(), distanceAccuracy);
    Assert.assertEquals(RefStatRange[3], kalmanLageos2.getRangeStat().getStandardDeviation(), distanceAccuracy);
}
Also used : ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) 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) ArrayList(java.util.ArrayList) GeodeticPoint(org.orekit.bodies.GeodeticPoint) RealMatrix(org.hipparchus.linear.RealMatrix) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) OrbitType(org.orekit.orbits.OrbitType) DelegatingDriver(org.orekit.utils.ParameterDriversList.DelegatingDriver) File(java.io.File) Test(org.junit.Test)

Example 37 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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 38 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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 39 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.

the class OPMParserTest method checkPVEntry.

private void checkPVEntry(final PVCoordinates expected, final PVCoordinates actual) {
    final Vector3D expectedPos = expected.getPosition();
    final Vector3D expectedVel = expected.getVelocity();
    final Vector3D actualPos = actual.getPosition();
    final Vector3D actualVel = actual.getVelocity();
    final double eps = 1e-12;
    Assert.assertEquals(expectedPos.getX(), actualPos.getX(), eps);
    Assert.assertEquals(expectedPos.getY(), actualPos.getY(), eps);
    Assert.assertEquals(expectedPos.getZ(), actualPos.getZ(), eps);
    Assert.assertEquals(expectedVel.getX(), actualVel.getX(), eps);
    Assert.assertEquals(expectedVel.getY(), actualVel.getY(), eps);
    Assert.assertEquals(expectedVel.getZ(), actualVel.getZ(), eps);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D)

Example 40 with Vector3D

use of org.hipparchus.geometry.euclidean.threed.Vector3D 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

Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)750 Test (org.junit.Test)466 AbsoluteDate (org.orekit.time.AbsoluteDate)323 PVCoordinates (org.orekit.utils.PVCoordinates)280 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)259 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)187 SpacecraftState (org.orekit.propagation.SpacecraftState)152 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)124 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)119 Frame (org.orekit.frames.Frame)115 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)105 Orbit (org.orekit.orbits.Orbit)100 GeodeticPoint (org.orekit.bodies.GeodeticPoint)84 OrekitException (org.orekit.errors.OrekitException)83 CartesianOrbit (org.orekit.orbits.CartesianOrbit)75 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)68 DateComponents (org.orekit.time.DateComponents)67 Transform (org.orekit.frames.Transform)61 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)59 CircularOrbit (org.orekit.orbits.CircularOrbit)59