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;
}
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());
}
}
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());
}
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);
}
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);
}
Aggregations