Search in sources :

Example 76 with Vector3D

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

the class DSSTPropagatorTest method testIssueMeanInclination.

@Test
public void testIssueMeanInclination() throws OrekitException {
    final double earthAe = 6378137.0;
    final double earthMu = 3.9860044E14;
    final double earthJ2 = 0.0010826;
    // Initialize the DSST propagator with only J2 perturbation
    Orbit orb = new KeplerianOrbit(new TimeStampedPVCoordinates(new AbsoluteDate("1992-10-08T15:20:38.821", TimeScalesFactory.getUTC()), new Vector3D(5392808.809823, -4187618.3357927715, -44206.638015847195), new Vector3D(2337.4472786270794, 2474.0146611860464, 6778.507766114648)), FramesFactory.getTOD(false), earthMu);
    final SpacecraftState ss = new SpacecraftState(orb);
    final UnnormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getUnnormalizedProvider(earthAe, earthMu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { -earthJ2 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 } });
    final Frame earthFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
    DSSTForceModel zonal = new DSSTZonal(provider, 2, 1, 5);
    DSSTForceModel tesseral = new DSSTTesseral(earthFrame, Constants.WGS84_EARTH_ANGULAR_VELOCITY, provider, 2, 0, 0, 2, 2, 0, 0);
    final Collection<DSSTForceModel> forces = new ArrayList<DSSTForceModel>();
    forces.add(zonal);
    forces.add(tesseral);
    // Computes J2 mean elements using the DSST osculating to mean converter
    final Orbit meanOrb = DSSTPropagator.computeMeanState(ss, null, forces).getOrbit();
    Assert.assertEquals(0.0164196, FastMath.toDegrees(orb.getI() - meanOrb.getI()), 1.0e-7);
}
Also used : Frame(org.orekit.frames.Frame) 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) DSSTZonal(org.orekit.propagation.semianalytical.dsst.forces.DSSTZonal) ArrayList(java.util.ArrayList) DSSTTesseral(org.orekit.propagation.semianalytical.dsst.forces.DSSTTesseral) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) UnnormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 77 with Vector3D

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

the class DSSTPropagatorTest method testNoExtrapolation.

@Test
public void testNoExtrapolation() throws OrekitException {
    SpacecraftState state = getLEOState();
    setDSSTProp(state);
    // Propagation of the initial state at the initial date
    final SpacecraftState finalState = dsstProp.propagate(state.getDate());
    // Initial orbit definition
    final Vector3D initialPosition = state.getPVCoordinates().getPosition();
    final Vector3D initialVelocity = state.getPVCoordinates().getVelocity();
    // Final orbit definition
    final Vector3D finalPosition = finalState.getPVCoordinates().getPosition();
    final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity();
    // Check results
    Assert.assertEquals(initialPosition.getX(), finalPosition.getX(), 0.0);
    Assert.assertEquals(initialPosition.getY(), finalPosition.getY(), 0.0);
    Assert.assertEquals(initialPosition.getZ(), finalPosition.getZ(), 0.0);
    Assert.assertEquals(initialVelocity.getX(), finalVelocity.getX(), 0.0);
    Assert.assertEquals(initialVelocity.getY(), finalVelocity.getY(), 0.0);
    Assert.assertEquals(initialVelocity.getZ(), finalVelocity.getZ(), 0.0);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Test(org.junit.Test)

Example 78 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testSerialization.

@Test
public void testSerialization() throws IOException, ClassNotFoundException {
    TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, new Vector3D(1, 2, 3), new Vector3D(4, 5, 6), new Vector3D(7, 8, 9));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(pv);
    Assert.assertTrue(bos.size() > 180);
    Assert.assertTrue(bos.size() < 190);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    TimeStampedPVCoordinates deserialized = (TimeStampedPVCoordinates) ois.readObject();
    Assert.assertEquals(0.0, deserialized.getDate().durationFrom(pv.getDate()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(deserialized.getPosition(), pv.getPosition()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(deserialized.getVelocity(), pv.getVelocity()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(deserialized.getAcceleration(), pv.getAcceleration()), 1.0e-15);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 79 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testToDerivativeStructureVector2.

@Test
public void testToDerivativeStructureVector2() throws OrekitException {
    FieldVector3D<DerivativeStructure> fv = new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).toDerivativeStructureVector(2);
    Assert.assertEquals(1, fv.getX().getFreeParameters());
    Assert.assertEquals(2, fv.getX().getOrder());
    Assert.assertEquals(1.0, fv.getX().getReal(), 1.0e-10);
    Assert.assertEquals(0.1, fv.getY().getReal(), 1.0e-10);
    Assert.assertEquals(10.0, fv.getZ().getReal(), 1.0e-10);
    Assert.assertEquals(-1.0, fv.getX().getPartialDerivative(1), 1.0e-15);
    Assert.assertEquals(-0.1, fv.getY().getPartialDerivative(1), 1.0e-15);
    Assert.assertEquals(-10.0, fv.getZ().getPartialDerivative(1), 1.0e-15);
    Assert.assertEquals(10.0, fv.getX().getPartialDerivative(2), 1.0e-15);
    Assert.assertEquals(-1.0, fv.getY().getPartialDerivative(2), 1.0e-15);
    Assert.assertEquals(-100.0, fv.getZ().getPartialDerivative(2), 1.0e-15);
    checkPV(new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)), new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, fv), 1.0e-15);
    for (double dt = 0; dt < 10; dt += 0.125) {
        Vector3D p = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).shiftedBy(dt).getPosition();
        Assert.assertEquals(p.getX(), fv.getX().taylor(dt), 1.0e-14);
        Assert.assertEquals(p.getY(), fv.getY().taylor(dt), 1.0e-14);
        Assert.assertEquals(p.getZ(), fv.getZ().taylor(dt), 1.0e-14);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) Test(org.junit.Test)

Example 80 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testInterpolatePolynomialPV.

@Test
public void testInterpolatePolynomialPV() {
    Random random = new Random(0xae7771c9933407bdl);
    AbsoluteDate t0 = AbsoluteDate.J2000_EPOCH;
    for (int i = 0; i < 20; ++i) {
        PolynomialFunction px = randomPolynomial(5, random);
        PolynomialFunction py = randomPolynomial(5, random);
        PolynomialFunction pz = randomPolynomial(5, random);
        PolynomialFunction pxDot = px.polynomialDerivative();
        PolynomialFunction pyDot = py.polynomialDerivative();
        PolynomialFunction pzDot = pz.polynomialDerivative();
        PolynomialFunction pxDotDot = pxDot.polynomialDerivative();
        PolynomialFunction pyDotDot = pyDot.polynomialDerivative();
        PolynomialFunction pzDotDot = pzDot.polynomialDerivative();
        List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
        for (double dt : new double[] { 0.0, 0.5, 1.0 }) {
            Vector3D position = new Vector3D(px.value(dt), py.value(dt), pz.value(dt));
            Vector3D velocity = new Vector3D(pxDot.value(dt), pyDot.value(dt), pzDot.value(dt));
            sample.add(new TimeStampedPVCoordinates(t0.shiftedBy(dt), position, velocity, Vector3D.ZERO));
        }
        for (double dt = 0; dt < 1.0; dt += 0.01) {
            TimeStampedPVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_PV, sample);
            Vector3D p = interpolated.getPosition();
            Vector3D v = interpolated.getVelocity();
            Vector3D a = interpolated.getAcceleration();
            Assert.assertEquals(px.value(dt), p.getX(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(py.value(dt), p.getY(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(pz.value(dt), p.getZ(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(pxDot.value(dt), v.getX(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pyDot.value(dt), v.getY(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pzDot.value(dt), v.getZ(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pxDotDot.value(dt), a.getX(), 1.0e-14 * a.getNorm());
            Assert.assertEquals(pyDotDot.value(dt), a.getY(), 1.0e-14 * a.getNorm());
            Assert.assertEquals(pzDotDot.value(dt), a.getZ(), 1.0e-14 * a.getNorm());
        }
    }
}
Also used : Random(java.util.Random) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) ArrayList(java.util.ArrayList) PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction) 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