Search in sources :

Example 1 with ImpulseManeuver

use of org.orekit.forces.maneuvers.ImpulseManeuver in project Orekit by CS-SI.

the class KeplerianPropagatorTest method testIssue224.

@Test
public void testIssue224() throws OrekitException, IOException, ClassNotFoundException {
    // Inertial frame
    Frame inertialFrame = FramesFactory.getEME2000();
    // Initial date
    TimeScale utc = TimeScalesFactory.getUTC();
    AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
    // Central attraction coefficient
    double mu = 3.986004415e+14;
    // Initial orbit
    // semi major axis in meters
    double a = 42100;
    // eccentricity
    double e = 0.01;
    // inclination
    double i = FastMath.toRadians(6);
    // perigee argument
    double omega = FastMath.toRadians(180);
    // right ascention of ascending node
    double raan = FastMath.toRadians(261);
    // mean anomaly
    double lM = 0;
    Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu);
    // Initial state definition
    SpacecraftState initialState = new SpacecraftState(initialOrbit);
    // Propagator
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(inertialFrame, LOFType.VVLH));
    propagator.addAdditionalStateProvider(new SevenProvider());
    propagator.setEphemerisMode();
    // Impulsive burn 1
    final AbsoluteDate burn1Date = initialState.getDate().shiftedBy(200);
    ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(1000, 0, 0), 320);
    propagator.addEventDetector(impulsiveBurn1);
    // Impulsive burn 2
    final AbsoluteDate burn2Date = initialState.getDate().shiftedBy(300);
    ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(1000, 0, 0), 320);
    propagator.addEventDetector(impulsiveBurn2);
    propagator.propagate(initialState.getDate().shiftedBy(400));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(propagator.getGeneratedEphemeris());
    Assert.assertTrue(bos.size() > 2400);
    Assert.assertTrue(bos.size() < 2500);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
    ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) {
            if (currentState.getDate().durationFrom(burn1Date) < -0.001) {
                Assert.assertEquals(42100.0, currentState.getA(), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn1Date) > 0.001 && currentState.getDate().durationFrom(burn2Date) < -0.001) {
                Assert.assertEquals(42979.962, currentState.getA(), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn2Date) > 0.001) {
                Assert.assertEquals(43887.339, currentState.getA(), 1.0e-3);
            }
        }
    });
    ephemeris.propagate(ephemeris.getMaxDate());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) ImpulseManeuver(org.orekit.forces.maneuvers.ImpulseManeuver) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) 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) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) TimeScale(org.orekit.time.TimeScale) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LofOffset(org.orekit.attitudes.LofOffset) BoundedPropagator(org.orekit.propagation.BoundedPropagator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 2 with ImpulseManeuver

use of org.orekit.forces.maneuvers.ImpulseManeuver in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testIssue224Backward.

@Test
public void testIssue224Backward() throws OrekitException, IOException, ClassNotFoundException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
    propagator.addAdditionalStateProvider(new SevenProvider());
    propagator.setEphemerisMode();
    // Impulsive burns
    final AbsoluteDate burn1Date = initial.getDate().shiftedBy(-200);
    ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn1);
    final AbsoluteDate burn2Date = initial.getDate().shiftedBy(-300);
    ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn2);
    propagator.propagate(initial.getDate().shiftedBy(-400));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(propagator.getGeneratedEphemeris());
    Assert.assertTrue(bos.size() > 2950);
    Assert.assertTrue(bos.size() < 3050);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
    ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) {
            if (currentState.getDate().durationFrom(burn1Date) > 0.001) {
                Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn1Date) < -0.001 && currentState.getDate().durationFrom(burn2Date) > 0.001) {
                Assert.assertEquals(98.164, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn2Date) < -0.001) {
                Assert.assertEquals(99.273, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            }
        }
    });
    ephemeris.propagate(ephemeris.getMinDate());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) ImpulseManeuver(org.orekit.forces.maneuvers.ImpulseManeuver) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) Transform(org.orekit.frames.Transform) LofOffset(org.orekit.attitudes.LofOffset) BoundedPropagator(org.orekit.propagation.BoundedPropagator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Example 3 with ImpulseManeuver

use of org.orekit.forces.maneuvers.ImpulseManeuver in project Orekit by CS-SI.

the class EcksteinHechlerPropagatorTest method testIssue224Forward.

@Test
public void testIssue224Forward() throws OrekitException, IOException, ClassNotFoundException {
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(154.);
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    Vector3D pole = itrf.getTransformTo(eme2000, date).transformVector(Vector3D.PLUS_K);
    Frame poleAligned = new Frame(FramesFactory.getEME2000(), new Transform(date, new Rotation(pole, Vector3D.PLUS_K)), "pole aligned", true);
    CircularOrbit initial = new CircularOrbit(7208669.8179538045, 1.3740461966386876E-4, -3.2364250248363356E-5, FastMath.toRadians(97.40236024565775), FastMath.toRadians(166.15873160992115), FastMath.toRadians(90.1282370098961), PositionAngle.MEAN, poleAligned, date, provider.getMu());
    EcksteinHechlerPropagator propagator = new EcksteinHechlerPropagator(initial, new LofOffset(poleAligned, LOFType.VVLH), 1000.0, provider);
    propagator.addAdditionalStateProvider(new SevenProvider());
    propagator.setEphemerisMode();
    // Impulsive burns
    final AbsoluteDate burn1Date = initial.getDate().shiftedBy(200);
    ImpulseManeuver<DateDetector> impulsiveBurn1 = new ImpulseManeuver<DateDetector>(new DateDetector(burn1Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn1);
    final AbsoluteDate burn2Date = initial.getDate().shiftedBy(300);
    ImpulseManeuver<DateDetector> impulsiveBurn2 = new ImpulseManeuver<DateDetector>(new DateDetector(burn2Date), new Vector3D(0.0, 500.0, 0.0), 320);
    propagator.addEventDetector(impulsiveBurn2);
    propagator.propagate(initial.getDate().shiftedBy(400));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(propagator.getGeneratedEphemeris());
    Assert.assertTrue(bos.size() > 2950);
    Assert.assertTrue(bos.size() < 3050);
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    BoundedPropagator ephemeris = (BoundedPropagator) ois.readObject();
    ephemeris.setMasterMode(10, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) {
            if (currentState.getDate().durationFrom(burn1Date) < -0.001) {
                Assert.assertEquals(97.402, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn1Date) > 0.001 && currentState.getDate().durationFrom(burn2Date) < -0.001) {
                Assert.assertEquals(98.183, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            } else if (currentState.getDate().durationFrom(burn2Date) > 0.001) {
                Assert.assertEquals(99.310, FastMath.toDegrees(currentState.getI()), 1.0e-3);
            }
        }
    });
    ephemeris.propagate(ephemeris.getMaxDate());
}
Also used : DateDetector(org.orekit.propagation.events.DateDetector) ImpulseManeuver(org.orekit.forces.maneuvers.ImpulseManeuver) Frame(org.orekit.frames.Frame) TopocentricFrame(org.orekit.frames.TopocentricFrame) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) CircularOrbit(org.orekit.orbits.CircularOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ByteArrayInputStream(java.io.ByteArrayInputStream) Transform(org.orekit.frames.Transform) LofOffset(org.orekit.attitudes.LofOffset) BoundedPropagator(org.orekit.propagation.BoundedPropagator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) ObjectInputStream(java.io.ObjectInputStream) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ObjectInputStream (java.io.ObjectInputStream)3 ObjectOutputStream (java.io.ObjectOutputStream)3 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)3 Test (org.junit.Test)3 LofOffset (org.orekit.attitudes.LofOffset)3 ImpulseManeuver (org.orekit.forces.maneuvers.ImpulseManeuver)3 Frame (org.orekit.frames.Frame)3 TopocentricFrame (org.orekit.frames.TopocentricFrame)3 CircularOrbit (org.orekit.orbits.CircularOrbit)3 BoundedPropagator (org.orekit.propagation.BoundedPropagator)3 SpacecraftState (org.orekit.propagation.SpacecraftState)3 DateDetector (org.orekit.propagation.events.DateDetector)3 OrekitFixedStepHandler (org.orekit.propagation.sampling.OrekitFixedStepHandler)3 AbsoluteDate (org.orekit.time.AbsoluteDate)3 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)3 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)2 Transform (org.orekit.frames.Transform)2 CartesianOrbit (org.orekit.orbits.CartesianOrbit)1