Search in sources :

Example 16 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class NadirPointingTest method testSpin.

@Test
public void testSpin() throws OrekitException {
    // Elliptic earth shape
    OneAxisEllipsoid earthShape = new OneAxisEllipsoid(6378136.460, 1 / 298.257222101, itrf);
    // Create earth center pointing attitude provider
    NadirPointing law = new NadirPointing(FramesFactory.getEME2000(), earthShape);
    // Satellite on any position
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
    Propagator propagator = new KeplerianPropagator(orbit, law, mu, 2500.0);
    double h = 0.1;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
    // check spin is consistent with attitude evolution
    double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 5.3e-9 * evolutionAngleMinus);
    double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 8.1e-9 * evolutionAnglePlus);
    Vector3D spin0 = s0.getAttitude().getSpin();
    Rotation rM = sMinus.getAttitude().getRotation();
    Rotation rP = sPlus.getAttitude().getRotation();
    Vector3D reference = AngularCoordinates.estimateRate(rM, rP, 2 * h);
    Assert.assertTrue(Rotation.distance(rM, rP) > 2.0e-4);
    Assert.assertEquals(0.0, spin0.subtract(reference).getNorm(), 2.0e-6);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 17 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class InertialAttitudeTest method testSpin.

@Test
public void testSpin() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2, RotationConvention.VECTOR_OPERATOR));
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    Propagator propagator = new KeplerianPropagator(orbit, law);
    double h = 100.0;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
    // check spin is consistent with attitude evolution
    double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAngleMinus, 1.0e-6 * evolutionAngleMinus);
    double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertEquals(0.0, errorAnglePlus, 1.0e-6 * evolutionAnglePlus);
    // compute spin axis using finite differences
    Rotation rMinus = sMinus.getAttitude().getRotation();
    Rotation rPlus = sPlus.getAttitude().getRotation();
    Rotation dr = rPlus.compose(rMinus.revert(), RotationConvention.VECTOR_OPERATOR);
    Assert.assertEquals(0, dr.getAngle(), 1.0e-10);
    Vector3D spin0 = s0.getAttitude().getSpin();
    Assert.assertEquals(0, spin0.getNorm(), 1.0e-10);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) DateComponents(org.orekit.time.DateComponents) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 18 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class InertialAttitudeTest method testCompensateMomentum.

@Test
public void testCompensateMomentum() throws OrekitException {
    InertialProvider law = new InertialProvider(new Rotation(new Vector3D(-0.64, 0.6, 0.48), 0.2, RotationConvention.VECTOR_OPERATOR));
    KeplerianPropagator propagator = new KeplerianPropagator(orbit0, law);
    Attitude initial = propagator.propagate(t0).getAttitude();
    for (double t = 0; t < 10000.0; t += 100) {
        Attitude attitude = propagator.propagate(t0.shiftedBy(t)).getAttitude();
        Rotation evolution = attitude.getRotation().compose(initial.getRotation().revert(), RotationConvention.VECTOR_OPERATOR);
        Assert.assertEquals(0, evolution.getAngle(), 1.0e-10);
        Assert.assertEquals(FramesFactory.getEME2000(), attitude.getReferenceFrame());
    }
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 19 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class SpinStabilizedTest method testSpin.

@Test
public void testSpin() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789), TimeScalesFactory.getUTC());
    double rate = 2.0 * FastMath.PI / (12 * 60);
    AttitudeProvider law = new SpinStabilized(new InertialProvider(Rotation.IDENTITY), date, Vector3D.PLUS_K, rate);
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN, FramesFactory.getEME2000(), date, 3.986004415e14);
    Propagator propagator = new KeplerianPropagator(orbit, law);
    double h = 10.0;
    SpacecraftState sMinus = propagator.propagate(date.shiftedBy(-h));
    SpacecraftState s0 = propagator.propagate(date);
    SpacecraftState sPlus = propagator.propagate(date.shiftedBy(h));
    Vector3D spin0 = s0.getAttitude().getSpin();
    // check spin is consistent with attitude evolution
    double errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), s0.getAttitude().getRotation());
    double evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), s0.getAttitude().getRotation());
    Assert.assertTrue(errorAngleMinus <= 1.0e-6 * evolutionAngleMinus);
    double errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.shiftedBy(-h).getAttitude().getRotation());
    double evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), sPlus.getAttitude().getRotation());
    Assert.assertTrue(errorAnglePlus <= 1.0e-6 * evolutionAnglePlus);
    // compute spin axis using finite differences
    Rotation rM = sMinus.getAttitude().getRotation();
    Rotation rP = sPlus.getAttitude().getRotation();
    Vector3D reference = AngularCoordinates.estimateRate(rM, rP, 2 * h);
    Assert.assertEquals(2 * FastMath.PI / reference.getNorm(), 2 * FastMath.PI / spin0.getNorm(), 0.05);
    Assert.assertEquals(0.0, FastMath.toDegrees(Vector3D.angle(reference, spin0)), 1.0e-10);
    Assert.assertEquals(0.0, FastMath.toDegrees(Vector3D.angle(Vector3D.PLUS_K, spin0)), 1.0e-10);
}
Also used : DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Propagator(org.orekit.propagation.Propagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Test(org.junit.Test)

Example 20 with KeplerianPropagator

use of org.orekit.propagation.analytical.KeplerianPropagator in project Orekit by CS-SI.

the class TabulatedLofOffsetTest method testSerialization.

@Test
public void testSerialization() throws OrekitException, IOException, ClassNotFoundException {
    // create a sample from Yaw compensation law
    final LOFType type = LOFType.VNC;
    final List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    final AttitudeProvider yawCompensLaw = new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth));
    final Propagator originalPropagator = new KeplerianPropagator(orbit);
    originalPropagator.setAttitudeProvider(yawCompensLaw);
    originalPropagator.setMasterMode(10.0, new OrekitFixedStepHandler() {

        public void handleStep(final SpacecraftState currentState, final boolean isLast) throws OrekitException {
            Rotation offsetAtt = currentState.getAttitude().getRotation();
            LofOffset aligned = new LofOffset(currentState.getFrame(), type);
            Rotation alignedAtt = aligned.getAttitude(currentState.getOrbit(), currentState.getDate(), currentState.getFrame()).getRotation();
            Rotation offsetProper = offsetAtt.compose(alignedAtt.revert(), RotationConvention.VECTOR_OPERATOR);
            sample.add(new TimeStampedAngularCoordinates(currentState.getDate(), offsetProper, Vector3D.ZERO, Vector3D.ZERO));
        }
    });
    originalPropagator.propagate(orbit.getDate().shiftedBy(2000));
    originalPropagator.setSlaveMode();
    // use the sample and generate an ephemeris
    final AttitudeProvider tabulated = new TabulatedLofOffset(orbit.getFrame(), type, sample, 6, AngularDerivativesFilter.USE_RR);
    final Propagator rebuildingPropagator = new KeplerianPropagator(orbit);
    rebuildingPropagator.setAttitudeProvider(tabulated);
    rebuildingPropagator.setEphemerisMode();
    rebuildingPropagator.propagate(orbit.getDate().shiftedBy(5));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(rebuildingPropagator.getGeneratedEphemeris());
    // even despite we propagated only 5 seconds, the attitude sample is huge
    Assert.assertTrue(bos.size() > 17000);
    Assert.assertTrue(bos.size() < 18000);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    TabulatedLofOffset deserialized = (TabulatedLofOffset) ((BoundedPropagator) ois.readObject()).getAttitudeProvider();
    Assert.assertEquals(sample.size(), deserialized.getTable().size());
}
Also used : ArrayList(java.util.ArrayList) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) ByteArrayInputStream(java.io.ByteArrayInputStream) LOFType(org.orekit.frames.LOFType) Propagator(org.orekit.propagation.Propagator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) OrekitException(org.orekit.errors.OrekitException) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) TimeStampedAngularCoordinates(org.orekit.utils.TimeStampedAngularCoordinates) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Aggregations

KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)59 Test (org.junit.Test)47 SpacecraftState (org.orekit.propagation.SpacecraftState)41 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)40 AbsoluteDate (org.orekit.time.AbsoluteDate)36 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)34 Propagator (org.orekit.propagation.Propagator)32 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)21 GeodeticPoint (org.orekit.bodies.GeodeticPoint)20 Orbit (org.orekit.orbits.Orbit)20 PVCoordinates (org.orekit.utils.PVCoordinates)15 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)14 OrekitException (org.orekit.errors.OrekitException)13 Frame (org.orekit.frames.Frame)13 TopocentricFrame (org.orekit.frames.TopocentricFrame)12 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)11 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 CartesianOrbit (org.orekit.orbits.CartesianOrbit)8 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)8 DateComponents (org.orekit.time.DateComponents)7