Search in sources :

Example 26 with KeplerianPropagator

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

the class ImpulseManeuverTest method testInclinationManeuver.

@Test
public void testInclinationManeuver() throws OrekitException {
    final Orbit initialOrbit = new KeplerianOrbit(24532000.0, 0.72, 0.3, FastMath.PI, 0.4, 2.0, PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2008, 06, 23), new TimeComponents(14, 18, 37), TimeScalesFactory.getUTC()), 3.986004415e14);
    final double a = initialOrbit.getA();
    final double e = initialOrbit.getE();
    final double i = initialOrbit.getI();
    final double mu = initialOrbit.getMu();
    final double vApo = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
    double dv = 0.99 * FastMath.tan(i) * vApo;
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VVLH));
    propagator.addEventDetector(new ImpulseManeuver<NodeDetector>(new NodeDetector(initialOrbit, FramesFactory.getEME2000()), new Vector3D(dv, Vector3D.PLUS_J), 400.0));
    SpacecraftState propagated = propagator.propagate(initialOrbit.getDate().shiftedBy(8000));
    Assert.assertEquals(0.0028257, propagated.getI(), 1.0e-6);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NodeDetector(org.orekit.propagation.events.NodeDetector) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) LofOffset(org.orekit.attitudes.LofOffset) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 27 with KeplerianPropagator

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

the class ImpulseManeuverTest method testInertialManeuver.

@Test
public void testInertialManeuver() throws OrekitException {
    final double mu = CelestialBodyFactory.getEarth().getGM();
    final double initialX = 7100e3;
    final double initialY = 0.0;
    final double initialZ = 1300e3;
    final double initialVx = 0;
    final double initialVy = 8000;
    final double initialVz = 1000;
    final Vector3D position = new Vector3D(initialX, initialY, initialZ);
    final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz);
    final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC());
    final TimeStampedPVCoordinates state = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);
    final Orbit initialOrbit = new CartesianOrbit(state, FramesFactory.getEME2000(), mu);
    final double totalPropagationTime = 0.00001;
    final double driftTimeInSec = totalPropagationTime / 2.0;
    final double deltaX = 0.01;
    final double deltaY = 0.02;
    final double deltaZ = 0.03;
    final double isp = 300;
    final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ);
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC));
    DateDetector dateDetector = new DateDetector(epoch.shiftedBy(driftTimeInSec));
    InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, RotationConvention.VECTOR_OPERATOR, 0, 0, 0));
    ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(driftTimeInSec / 4);
    propagator.addEventDetector(burnAtEpoch);
    SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime));
    final double finalVxExpected = initialVx + deltaX;
    final double finalVyExpected = initialVy + deltaY;
    final double finalVzExpected = initialVz + deltaZ;
    final double maneuverTolerance = 1e-4;
    final Vector3D finalVelocity = finalState.getPVCoordinates().getVelocity();
    Assert.assertEquals(finalVxExpected, finalVelocity.getX(), maneuverTolerance);
    Assert.assertEquals(finalVyExpected, finalVelocity.getY(), maneuverTolerance);
    Assert.assertEquals(finalVzExpected, finalVelocity.getZ(), maneuverTolerance);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) LofOffset(org.orekit.attitudes.LofOffset) Test(org.junit.Test)

Example 28 with KeplerianPropagator

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

the class ImpulseManeuverTest method testBackAndForth.

@Test
public void testBackAndForth() throws OrekitException {
    final AttitudeProvider lof = new LofOffset(FramesFactory.getEME2000(), LOFType.VNC);
    final double mu = Constants.EIGEN5C_EARTH_MU;
    final AbsoluteDate iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
    final Orbit pastOrbit = new KeplerianOrbit(7e6, 1.0e-4, FastMath.toRadians(98.5), FastMath.toRadians(87.0), FastMath.toRadians(216.1807), FastMath.toRadians(319.779), PositionAngle.MEAN, FramesFactory.getEME2000(), iniDate, mu);
    final double pastMass = 2500.0;
    DateDetector dateDetector = new DateDetector(iniDate.shiftedBy(600));
    Vector3D deltaV = new Vector3D(12.0, 1.0, -4.0);
    final double isp = 300;
    ImpulseManeuver<DateDetector> maneuver = new ImpulseManeuver<DateDetector>(dateDetector, new InertialProvider(Rotation.IDENTITY), deltaV, isp).withMaxCheck(3600.0).withThreshold(1.0e-6);
    double span = 900.0;
    KeplerianPropagator forwardPropagator = new KeplerianPropagator(pastOrbit, lof, mu, pastMass);
    forwardPropagator.addEventDetector(maneuver);
    SpacecraftState futureState = forwardPropagator.propagate(pastOrbit.getDate().shiftedBy(span));
    KeplerianPropagator backwardPropagator = new KeplerianPropagator(futureState.getOrbit(), lof, mu, futureState.getMass());
    backwardPropagator.addEventDetector(maneuver);
    SpacecraftState rebuiltPast = backwardPropagator.propagate(pastOrbit.getDate());
    Assert.assertEquals(0.0, Vector3D.distance(pastOrbit.getPVCoordinates().getPosition(), rebuiltPast.getPVCoordinates().getPosition()), 2.0e-8);
    Assert.assertEquals(0.0, Vector3D.distance(pastOrbit.getPVCoordinates().getVelocity(), rebuiltPast.getPVCoordinates().getVelocity()), 2.0e-11);
    Assert.assertEquals(pastMass, rebuiltPast.getMass(), 5.0e-13);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Example 29 with KeplerianPropagator

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

the class ImpulseManeuverTest method testAdditionalStateKeplerian.

@Test
public void testAdditionalStateKeplerian() throws OrekitException {
    final double mu = CelestialBodyFactory.getEarth().getGM();
    final double initialX = 7100e3;
    final double initialY = 0.0;
    final double initialZ = 1300e3;
    final double initialVx = 0;
    final double initialVy = 8000;
    final double initialVz = 1000;
    final Vector3D position = new Vector3D(initialX, initialY, initialZ);
    final Vector3D velocity = new Vector3D(initialVx, initialVy, initialVz);
    final AbsoluteDate epoch = new AbsoluteDate(2010, 1, 1, 0, 0, 0, TimeScalesFactory.getUTC());
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(epoch, position, velocity, Vector3D.ZERO);
    final Orbit initialOrbit = new CartesianOrbit(pv, FramesFactory.getEME2000(), mu);
    final double totalPropagationTime = 10;
    final double deltaX = 0.01;
    final double deltaY = 0.02;
    final double deltaZ = 0.03;
    final double isp = 300;
    final Vector3D deltaV = new Vector3D(deltaX, deltaY, deltaZ);
    final AttitudeProvider attitudeProvider = new LofOffset(initialOrbit.getFrame(), LOFType.VNC);
    final Attitude initialAttitude = attitudeProvider.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame());
    final SpacecraftState initialState = new SpacecraftState(initialOrbit, initialAttitude);
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit);
    propagator.resetInitialState(initialState.addAdditionalState("testOnly", -1.0));
    DateDetector dateDetector = new DateDetector(epoch.shiftedBy(0.5 * totalPropagationTime));
    InertialProvider attitudeOverride = new InertialProvider(new Rotation(RotationOrder.XYX, RotationConvention.VECTOR_OPERATOR, 0, 0, 0));
    ImpulseManeuver<DateDetector> burnAtEpoch = new ImpulseManeuver<DateDetector>(dateDetector, attitudeOverride, deltaV, isp).withThreshold(1.0e-3);
    propagator.addEventDetector(burnAtEpoch);
    SpacecraftState finalState = propagator.propagate(epoch.shiftedBy(totalPropagationTime));
    Assert.assertEquals(1, finalState.getAdditionalStates().size());
    Assert.assertEquals(-1.0, finalState.getAdditionalState("testOnly")[0], 1.0e-15);
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Attitude(org.orekit.attitudes.Attitude) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) InertialProvider(org.orekit.attitudes.InertialProvider) LofOffset(org.orekit.attitudes.LofOffset) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) Test(org.junit.Test)

Example 30 with KeplerianPropagator

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

the class SolarRadiationPressureTest method testLighting.

@Test
public void testLighting() throws OrekitException, ParseException {
    // Initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 3, 21), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
    Orbit orbit = new EquinoctialOrbit(42164000, 10e-3, 10e-3, FastMath.tan(0.001745329) * FastMath.cos(2 * FastMath.PI / 3), FastMath.tan(0.001745329) * FastMath.sin(2 * FastMath.PI / 3), 0.1, PositionAngle.TRUE, FramesFactory.getEME2000(), date, mu);
    PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
    OneAxisEllipsoid earth = new OneAxisEllipsoid(6378136.46, 1.0 / 298.25765, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    SolarRadiationPressure SRP = new SolarRadiationPressure(sun, earth.getEquatorialRadius(), (RadiationSensitive) new IsotropicRadiationCNES95Convention(50.0, 0.5, 0.5));
    double period = 2 * FastMath.PI * FastMath.sqrt(orbit.getA() * orbit.getA() * orbit.getA() / orbit.getMu());
    Assert.assertEquals(86164, period, 1);
    // creation of the propagator
    KeplerianPropagator k = new KeplerianPropagator(orbit);
    // intermediate variables
    AbsoluteDate currentDate;
    double changed = 1;
    int count = 0;
    for (int t = 1; t < 3 * period; t += 1000) {
        currentDate = date.shiftedBy(t);
        try {
            double ratio = SRP.getLightingRatio(k.propagate(currentDate).getPVCoordinates().getPosition(), FramesFactory.getEME2000(), currentDate);
            if (FastMath.floor(ratio) != changed) {
                changed = FastMath.floor(ratio);
                if (changed == 0) {
                    count++;
                }
            }
        } catch (OrekitException e) {
            e.printStackTrace();
        }
    }
    Assert.assertTrue(3 == count);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) PVCoordinatesProvider(org.orekit.utils.PVCoordinatesProvider) OrekitException(org.orekit.errors.OrekitException) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) 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