Search in sources :

Example 46 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class CloseEventsNumericalAMTest method getPropagator.

/**
 * Create a propagator using the {@link #initialOrbit}.
 *
 * @param stepSize   of integrator.
 * @return a usable propagator.
 * @throws OrekitException
 */
public Propagator getPropagator(double stepSize) throws OrekitException {
    double[][] tol = NumericalPropagator.tolerances(1, initialOrbit, OrbitType.CARTESIAN);
    final AdamsMoultonIntegrator integrator = new AdamsMoultonIntegrator(4, stepSize, stepSize, tol[0], tol[1]);
    final DormandPrince853Integrator starter = new DormandPrince853Integrator(stepSize / 100, stepSize / 10, tol[0], tol[1]);
    starter.setInitialStepSize(stepSize / 20);
    integrator.setStarterIntegrator(starter);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setInitialState(new SpacecraftState(initialOrbit));
    propagator.setOrbitType(OrbitType.CARTESIAN);
    return propagator;
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AdamsMoultonIntegrator(org.hipparchus.ode.nonstiff.AdamsMoultonIntegrator)

Example 47 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class EclipseDetectorTest method setUp.

@Before
public void setUp() {
    try {
        Utils.setDataRoot("regular-data");
        mu = 3.9860047e14;
        final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
        final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
        iniDate = new AbsoluteDate(1969, 7, 28, 4, 0, 0.0, TimeScalesFactory.getTT());
        final Orbit orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getGCRF(), iniDate, mu);
        initialState = new SpacecraftState(orbit);
        double[] absTolerance = { 0.001, 1.0e-9, 1.0e-9, 1.0e-6, 1.0e-6, 1.0e-6, 0.001 };
        double[] relTolerance = { 1.0e-7, 1.0e-4, 1.0e-4, 1.0e-7, 1.0e-7, 1.0e-7, 1.0e-7 };
        AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, absTolerance, relTolerance);
        integrator.setInitialStepSize(60);
        propagator = new NumericalPropagator(integrator);
        propagator.setInitialState(initialState);
        sun = CelestialBodyFactory.getSun();
        earth = CelestialBodyFactory.getEarth();
        sunRadius = 696000000.;
        earthRadius = 6400000.;
    } catch (OrekitException oe) {
        Assert.fail(oe.getLocalizedMessage());
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) CartesianOrbit(org.orekit.orbits.CartesianOrbit) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) OrekitException(org.orekit.errors.OrekitException) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 48 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class NodeDetectorTest method testIssue138.

@Test
public void testIssue138() throws OrekitException {
    double a = 800000 + Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
    double e = 0.0001;
    double i = FastMath.toRadians(98);
    double w = -90;
    double raan = 0;
    double v = 0;
    Frame inertialFrame = FramesFactory.getEME2000();
    AbsoluteDate initialDate = new AbsoluteDate(2014, 01, 01, 0, 0, 0, TimeScalesFactory.getUTC());
    AbsoluteDate finalDate = initialDate.shiftedBy(5000);
    KeplerianOrbit initialOrbit = new KeplerianOrbit(a, e, i, w, raan, v, PositionAngle.TRUE, inertialFrame, initialDate, Constants.WGS84_EARTH_MU);
    SpacecraftState initialState = new SpacecraftState(initialOrbit, 1000);
    double[][] tol = NumericalPropagator.tolerances(10, initialOrbit, initialOrbit.getType());
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 1000, tol[0], tol[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setInitialState(initialState);
    // Define 2 instances of NodeDetector:
    EventDetector rawDetector = new NodeDetector(1e-6, initialState.getOrbit(), initialState.getFrame()).withHandler(new ContinueOnEvent<NodeDetector>());
    EventsLogger logger1 = new EventsLogger();
    EventDetector node1 = logger1.monitorDetector(rawDetector);
    EventsLogger logger2 = new EventsLogger();
    EventDetector node2 = logger2.monitorDetector(rawDetector);
    propagator.addEventDetector(node1);
    propagator.addEventDetector(node2);
    // First propagation
    propagator.setEphemerisMode();
    propagator.propagate(finalDate);
    Assert.assertEquals(2, logger1.getLoggedEvents().size());
    Assert.assertEquals(2, logger2.getLoggedEvents().size());
    logger1.clearLoggedEvents();
    logger2.clearLoggedEvents();
    BoundedPropagator postpro = propagator.getGeneratedEphemeris();
    // Post-processing
    postpro.addEventDetector(node1);
    postpro.addEventDetector(node2);
    postpro.propagate(finalDate);
    Assert.assertEquals(2, logger1.getLoggedEvents().size());
    Assert.assertEquals(2, logger2.getLoggedEvents().size());
}
Also used : Frame(org.orekit.frames.Frame) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) BoundedPropagator(org.orekit.propagation.BoundedPropagator) Test(org.junit.Test)

Example 49 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class IntegratedEphemerisTest method setUp.

@Before
public void setUp() {
    Utils.setDataRoot("regular-data:potential/icgem-format");
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("eigen-6s-truncated", true));
    // Definition of initial conditions with position and velocity
    Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6);
    Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
    double mu = 3.9860047e14;
    AbsoluteDate initDate = AbsoluteDate.J2000_EPOCH.shiftedBy(584.);
    initialOrbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    // Numerical propagator definition
    double[] absTolerance = { 0.0001, 1.0e-11, 1.0e-11, 1.0e-8, 1.0e-8, 1.0e-8, 0.001 };
    double[] relTolerance = { 1.0e-8, 1.0e-8, 1.0e-8, 1.0e-9, 1.0e-9, 1.0e-9, 1.0e-7 };
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 500, absTolerance, relTolerance);
    integrator.setInitialStepSize(100);
    numericalPropagator = new NumericalPropagator(integrator);
}
Also used : ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PVCoordinates(org.orekit.utils.PVCoordinates) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) AbsoluteDate(org.orekit.time.AbsoluteDate) Before(org.junit.Before)

Example 50 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class SolarBodyTest method testPropagationVsEphemeris.

@Test
public void testPropagationVsEphemeris() throws OrekitException {
    Utils.setDataRoot("regular-data");
    // Creation of the celestial bodies of the solar system
    final CelestialBody sun = CelestialBodyFactory.getSun();
    final CelestialBody mercury = CelestialBodyFactory.getMercury();
    final CelestialBody venus = CelestialBodyFactory.getVenus();
    final CelestialBody earth = CelestialBodyFactory.getEarth();
    final CelestialBody mars = CelestialBodyFactory.getMars();
    final CelestialBody jupiter = CelestialBodyFactory.getJupiter();
    final CelestialBody saturn = CelestialBodyFactory.getSaturn();
    final CelestialBody uranus = CelestialBodyFactory.getUranus();
    final CelestialBody neptune = CelestialBodyFactory.getNeptune();
    final CelestialBody pluto = CelestialBodyFactory.getPluto();
    // Starting and end dates
    final AbsoluteDate startingDate = new AbsoluteDate(2000, 1, 2, TimeScalesFactory.getUTC());
    AbsoluteDate endDate = startingDate.shiftedBy(30 * Constants.JULIAN_DAY);
    final Frame icrf = FramesFactory.getICRF();
    // fake orbit around negligible point mass at solar system barycenter
    double negligibleMu = 1.0e-3;
    SpacecraftState initialState = new SpacecraftState(new CartesianOrbit(venus.getPVCoordinates(startingDate, icrf), icrf, startingDate, negligibleMu));
    // Creation of the numerical propagator
    final double[][] tol = NumericalPropagator.tolerances(1000, initialState.getOrbit(), OrbitType.CARTESIAN);
    AbstractIntegrator dop1 = new DormandPrince853Integrator(1.0, 1.0e5, tol[0], tol[1]);
    NumericalPropagator propag = new NumericalPropagator(dop1);
    propag.setOrbitType(OrbitType.CARTESIAN);
    propag.setInitialState(initialState);
    propag.setMu(negligibleMu);
    // Creation of the ForceModels
    propag.addForceModel(new BodyAttraction(sun));
    propag.addForceModel(new BodyAttraction(mercury));
    propag.addForceModel(new BodyAttraction(earth));
    propag.addForceModel(new BodyAttraction(mars));
    propag.addForceModel(new BodyAttraction(jupiter));
    propag.addForceModel(new BodyAttraction(saturn));
    propag.addForceModel(new BodyAttraction(uranus));
    propag.addForceModel(new BodyAttraction(neptune));
    propag.addForceModel(new BodyAttraction(pluto));
    // checks are done within the step handler
    propag.setMasterMode(1000.0, new OrekitFixedStepHandler() {

        public void handleStep(SpacecraftState currentState, boolean isLast) throws OrekitException {
            // propagated position should remain within 1400m of ephemeris for one month
            Vector3D propagatedP = currentState.getPVCoordinates(icrf).getPosition();
            Vector3D ephemerisP = venus.getPVCoordinates(currentState.getDate(), icrf).getPosition();
            Assert.assertEquals(0, Vector3D.distance(propagatedP, ephemerisP), 1400.0);
        }
    });
    propag.propagate(startingDate, endDate);
}
Also used : Frame(org.orekit.frames.Frame) CartesianOrbit(org.orekit.orbits.CartesianOrbit) AbsoluteDate(org.orekit.time.AbsoluteDate) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) SpacecraftState(org.orekit.propagation.SpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) AbstractIntegrator(org.hipparchus.ode.AbstractIntegrator) OrekitException(org.orekit.errors.OrekitException) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) OrekitFixedStepHandler(org.orekit.propagation.sampling.OrekitFixedStepHandler) Test(org.junit.Test)

Aggregations

NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)95 SpacecraftState (org.orekit.propagation.SpacecraftState)69 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)62 Test (org.junit.Test)54 Orbit (org.orekit.orbits.Orbit)50 AbsoluteDate (org.orekit.time.AbsoluteDate)46 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)43 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)39 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)38 OrbitType (org.orekit.orbits.OrbitType)38 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)36 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)36 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)34 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)31 PVCoordinates (org.orekit.utils.PVCoordinates)29 CartesianOrbit (org.orekit.orbits.CartesianOrbit)27 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)24 Frame (org.orekit.frames.Frame)24 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)22 DateComponents (org.orekit.time.DateComponents)21