Search in sources :

Example 56 with Orbit

use of org.orekit.orbits.Orbit in project Orekit by CS-SI.

the class ThirdBodyAttractionTest method testSunContrib.

@Test(expected = OrekitException.class)
public void testSunContrib() throws OrekitException {
    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 07, 01), 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);
    double period = 2 * FastMath.PI * orbit.getA() * FastMath.sqrt(orbit.getA() / orbit.getMu());
    // set up propagator
    NumericalPropagator calc = new NumericalPropagator(new GraggBulirschStoerIntegrator(10.0, period, 0, 1.0e-5));
    calc.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun()));
    // set up step handler to perform checks
    calc.setMasterMode(FastMath.floor(period), new ReferenceChecker(date) {

        protected double hXRef(double t) {
            return -1.06757e-3 + 0.221415e-11 * t + 18.9421e-5 * FastMath.cos(3.9820426e-7 * t) - 7.59983e-5 * FastMath.sin(3.9820426e-7 * t);
        }

        protected double hYRef(double t) {
            return 1.43526e-3 + 7.49765e-11 * t + 6.9448e-5 * FastMath.cos(3.9820426e-7 * t) + 17.6083e-5 * FastMath.sin(3.9820426e-7 * t);
        }
    });
    AbsoluteDate finalDate = date.shiftedBy(365 * period);
    calc.setInitialState(new SpacecraftState(orbit));
    calc.propagate(finalDate);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) GraggBulirschStoerIntegrator(org.hipparchus.ode.nonstiff.GraggBulirschStoerIntegrator) 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) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 57 with Orbit

use of org.orekit.orbits.Orbit in project Orekit by CS-SI.

the class ConstantThrustManeuverInitializationTest method setUp.

@Before
public void setUp() throws OrekitException {
    startDate = new AbsoluteDate();
    double a = Constants.EGM96_EARTH_EQUATORIAL_RADIUS + 400e3;
    double e = 0.001;
    double i = (Math.PI / 4);
    double pa = 0.0;
    double raan = 0.0;
    double anomaly = 0.0;
    PositionAngle type = PositionAngle.MEAN;
    Frame frame = FramesFactory.getEME2000();
    double mu = Constants.EGM96_EARTH_MU;
    Orbit orbit = new KeplerianOrbit(a, e, i, pa, raan, anomaly, type, frame, startDate, mu);
    initialState = new SpacecraftState(orbit, mass);
    // Numerical Propagator
    double minStep = 0.001;
    double maxStep = 1000.0;
    double positionTolerance = 10.;
    OrbitType propagationType = OrbitType.KEPLERIAN;
    double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, orbit, propagationType);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tolerances[0], tolerances[1]);
    // Set up propagator
    propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(propagationType);
    // Control deltaVs and mass changes
    double flowRate = -thrust / (Constants.G0_STANDARD_GRAVITY * isp);
    massControlFullForward = mass + (flowRate * duration);
    deltaVControlFullForward = isp * Constants.G0_STANDARD_GRAVITY * FastMath.log(mass / massControlFullForward);
    massControlHalfForward = mass + (flowRate * duration / 2);
    massControlFullReverse = mass - (flowRate * duration);
    deltaVControlFullReverse = isp * Constants.G0_STANDARD_GRAVITY * FastMath.log(massControlFullReverse / mass);
    massControlHalfReverse = mass - (flowRate * duration / 2);
    deltaVControlHalfReverse = isp * Constants.G0_STANDARD_GRAVITY * FastMath.log(massControlHalfReverse / mass);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Frame(org.orekit.frames.Frame) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PositionAngle(org.orekit.orbits.PositionAngle) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 58 with Orbit

use of org.orekit.orbits.Orbit in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method testForwardAndBackward.

@Test
public void testForwardAndBackward() throws OrekitException {
    final double isp = 318;
    final double mass = 2500;
    final double a = 24396159;
    final double e = 0.72831215;
    final double i = FastMath.toRadians(7);
    final double omega = FastMath.toRadians(180);
    final double OMEGA = FastMath.toRadians(261);
    final double lv = 0;
    final double duration = 3653.99;
    final double f = 420;
    final double delta = FastMath.toRadians(-7.4978);
    final double alpha = FastMath.toRadians(351);
    final AttitudeProvider law = new InertialProvider(new Rotation(new Vector3D(alpha, delta), Vector3D.PLUS_I));
    final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
    final Orbit orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
    final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
    final AbsoluteDate fireDate = new AbsoluteDate(new DateComponents(2004, 01, 02), new TimeComponents(04, 15, 34.080), TimeScalesFactory.getUTC());
    final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);
    Assert.assertEquals(f, maneuver.getThrust(), 1.0e-10);
    Assert.assertEquals(isp, maneuver.getISP(), 1.0e-10);
    double[][] tol = NumericalPropagator.tolerances(1.0, orbit, OrbitType.KEPLERIAN);
    AdaptiveStepsizeIntegrator integrator1 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator1.setInitialStepSize(60);
    final NumericalPropagator propagator1 = new NumericalPropagator(integrator1);
    propagator1.setInitialState(initialState);
    propagator1.setAttitudeProvider(law);
    propagator1.addForceModel(maneuver);
    final SpacecraftState finalState = propagator1.propagate(fireDate.shiftedBy(3800));
    AdaptiveStepsizeIntegrator integrator2 = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    integrator2.setInitialStepSize(60);
    final NumericalPropagator propagator2 = new NumericalPropagator(integrator2);
    propagator2.setInitialState(finalState);
    propagator2.setAttitudeProvider(law);
    propagator2.addForceModel(maneuver);
    final SpacecraftState recoveredState = propagator2.propagate(orbit.getDate());
    final Vector3D refPosition = initialState.getPVCoordinates().getPosition();
    final Vector3D recoveredPosition = recoveredState.getPVCoordinates().getPosition();
    Assert.assertEquals(0.0, Vector3D.distance(refPosition, recoveredPosition), 30.0);
    Assert.assertEquals(initialState.getMass(), recoveredState.getMass(), 1.5e-10);
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) InertialProvider(org.orekit.attitudes.InertialProvider) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 59 with Orbit

use of org.orekit.orbits.Orbit in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method testJacobianVs80Implementation.

@Test
public void testJacobianVs80Implementation() throws OrekitException {
    final double isp = 318;
    final double mass = 2500;
    final double a = 24396159;
    final double e = 0.72831215;
    final double i = FastMath.toRadians(7);
    final double omega = FastMath.toRadians(180);
    final double OMEGA = FastMath.toRadians(261);
    final double lv = 0;
    final double duration = 3653.99;
    final double f = 420;
    final AbsoluteDate initDate = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC());
    final Orbit orbit = new KeplerianOrbit(a, e, i, omega, OMEGA, lv, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu);
    final AttitudeProvider law = new LofOffset(orbit.getFrame(), LOFType.VVLH);
    final SpacecraftState initialState = new SpacecraftState(orbit, law.getAttitude(orbit, orbit.getDate(), orbit.getFrame()), mass);
    final AbsoluteDate fireDate = new AbsoluteDate(new DateComponents(2004, 01, 02), new TimeComponents(04, 15, 34.080), TimeScalesFactory.getUTC());
    final ConstantThrustManeuver maneuver = new ConstantThrustManeuver(fireDate, duration, f, isp, Vector3D.PLUS_I);
    // before maneuver (Jacobian wrt. state is zero)
    checkStateJacobianVs80Implementation(initialState, maneuver, law, 1.0e-50, false);
    // in maneuver
    SpacecraftState startState = initialState.shiftedBy(fireDate.durationFrom(initDate));
    maneuver.getEventsDetectors().findFirst().get().eventOccurred(startState, true);
    SpacecraftState midState = startState.shiftedBy(duration / 2.0);
    checkStateJacobianVs80Implementation(midState, maneuver, law, 1.0e-20, false);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) CircularOrbit(org.orekit.orbits.CircularOrbit) DateComponents(org.orekit.time.DateComponents) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) TimeComponents(org.orekit.time.TimeComponents) LofOffset(org.orekit.attitudes.LofOffset) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) AttitudeProvider(org.orekit.attitudes.AttitudeProvider) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 60 with Orbit

use of org.orekit.orbits.Orbit in project Orekit by CS-SI.

the class ImpulseManeuverTest method testBackward.

@Test
public void testBackward() throws OrekitException {
    final AbsoluteDate iniDate = new AbsoluteDate(2003, 5, 1, 17, 30, 0.0, TimeScalesFactory.getUTC());
    final Orbit initialOrbit = 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, Constants.EIGEN5C_EARTH_MU);
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit, new LofOffset(initialOrbit.getFrame(), LOFType.VNC));
    DateDetector dateDetector = new DateDetector(iniDate.shiftedBy(-300));
    Vector3D deltaV = new Vector3D(12.0, 1.0, -4.0);
    final double isp = 300;
    ImpulseManeuver<DateDetector> maneuver = new ImpulseManeuver<DateDetector>(dateDetector, deltaV, isp).withMaxCheck(3600.0).withThreshold(1.0e-6);
    propagator.addEventDetector(maneuver);
    SpacecraftState finalState = propagator.propagate(initialOrbit.getDate().shiftedBy(-900));
    Assert.assertTrue(finalState.getMass() > propagator.getInitialState().getMass());
    Assert.assertTrue(finalState.getDate().compareTo(propagator.getInitialState().getDate()) < 0);
}
Also used : KeplerianPropagator(org.orekit.propagation.analytical.KeplerianPropagator) DateDetector(org.orekit.propagation.events.DateDetector) 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) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) LofOffset(org.orekit.attitudes.LofOffset) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

Orbit (org.orekit.orbits.Orbit)211 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)161 Test (org.junit.Test)153 AbsoluteDate (org.orekit.time.AbsoluteDate)153 SpacecraftState (org.orekit.propagation.SpacecraftState)129 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)99 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)94 CartesianOrbit (org.orekit.orbits.CartesianOrbit)88 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)74 CircularOrbit (org.orekit.orbits.CircularOrbit)68 PVCoordinates (org.orekit.utils.PVCoordinates)66 Frame (org.orekit.frames.Frame)51 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)51 DateComponents (org.orekit.time.DateComponents)48 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)46 Propagator (org.orekit.propagation.Propagator)46 TimeComponents (org.orekit.time.TimeComponents)44 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)43 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)41 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)39