use of org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator in project Orekit by CS-SI.
the class EventDetectorTest method testIssue108Numerical.
@Test
public void testIssue108Numerical() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final Vector3D position = new Vector3D(-6142438.668, 3492467.56, -25767.257);
final Vector3D velocity = new Vector3D(505.848, 942.781, 7435.922);
final AbsoluteDate date = new AbsoluteDate(2003, 9, 16, utc);
final Orbit orbit = new CircularOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), date, mu);
final double step = 60.0;
final int n = 100;
NumericalPropagator propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(step));
propagator.resetInitialState(new SpacecraftState(orbit));
GCallsCounter counter = new GCallsCounter(100000.0, 1.0e-6, 20, new StopOnEvent<GCallsCounter>());
propagator.addEventDetector(counter);
propagator.propagate(date.shiftedBy(n * step));
Assert.assertEquals(n + 1, counter.getCount());
}
use of org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator in project Orekit by CS-SI.
the class MarshallSolarActivityFutureEstimationTest method getNumericalPropagator.
/**
* Configure a numerical propagator.
*
* @param sun Sun.
* @param earth Earth.
* @param ic initial condition.
* @return a propagator.
* @throws OrekitException on error.
*/
private NumericalPropagator getNumericalPropagator(CelestialBody sun, OneAxisEllipsoid earth, SpacecraftState ic) throws OrekitException {
// some non-integer step size to induce truncation error in flux interpolation
final ODEIntegrator integrator = new ClassicalRungeKuttaIntegrator(120 + 0.1);
NumericalPropagator propagator = new NumericalPropagator(integrator);
DTM2000InputParameters flux = getFlux();
final Atmosphere atmosphere = new DTM2000(flux, sun, earth);
final IsotropicDrag satellite = new IsotropicDrag(1, 3.2);
propagator.addForceModel(new DragForce(atmosphere, satellite));
propagator.setInitialState(ic);
propagator.setOrbitType(OrbitType.CARTESIAN);
return propagator;
}
use of org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator in project Orekit by CS-SI.
the class HolmesFeatherstoneAttractionModelTest method testZonalWithCunninghamReference.
// test the difference with the Cunningham model
@Test
@Deprecated
public void testZonalWithCunninghamReference() throws OrekitException {
// initialization
AbsoluteDate date = new AbsoluteDate(new DateComponents(2000, 07, 01), new TimeComponents(13, 59, 27.816), TimeScalesFactory.getUTC());
double i = FastMath.toRadians(98.7);
double omega = FastMath.toRadians(93.0);
double OMEGA = FastMath.toRadians(15.0 * 22.5);
Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN, FramesFactory.getEME2000(), date, mu);
propagator = new NumericalPropagator(new ClassicalRungeKuttaIntegrator(1000));
propagator.addForceModel(new HolmesFeatherstoneAttractionModel(itrf, GravityFieldFactory.getNormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { normalizedC20 }, { normalizedC30 }, { normalizedC40 }, { normalizedC50 }, { normalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
propagator.setInitialState(new SpacecraftState(orbit));
SpacecraftState hfOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
propagator.removeForceModels();
propagator.addForceModel(new CunninghamAttractionModel(itrf, GravityFieldFactory.getUnnormalizedProvider(ae, mu, TideSystem.UNKNOWN, new double[][] { { 0.0 }, { 0.0 }, { unnormalizedC20 }, { unnormalizedC30 }, { unnormalizedC40 }, { unnormalizedC50 }, { unnormalizedC60 } }, new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 }, { 0.0 } })));
propagator.setInitialState(new SpacecraftState(orbit));
SpacecraftState cOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
Vector3D dif = hfOrb.getPVCoordinates().getPosition().subtract(cOrb.getPVCoordinates().getPosition());
Assert.assertEquals(0, dif.getNorm(), 2e-9);
Assert.assertTrue(propagator.getCalls() < 400);
}
use of org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator in project Orekit by CS-SI.
the class DSSTPropagation method createDSSTProp.
/**
* Set up the DSST Propagator
*
* @param orbit initial orbit
* @param mass S/C mass (kg)
* @param initialIsOsculating if initial orbital elements are osculating
* @param outputIsOsculating if we want to output osculating parameters
* @param fixedStepSize step size for fixed step integrator (s)
* @param minStep minimum step size, if step is not fixed (s)
* @param maxStep maximum step size, if step is not fixed (s)
* @param dP position tolerance for step size control, if step is not fixed (m)
* @param shortPeriodCoefficients list of short periodic coefficients
* to output (null means no coefficients at all, empty list means all
* possible coefficients)
* @throws OrekitException
*/
private DSSTPropagator createDSSTProp(final Orbit orbit, final double mass, final boolean initialIsOsculating, final boolean outputIsOsculating, final double fixedStepSize, final double minStep, final double maxStep, final double dP, final List<String> shortPeriodCoefficients) throws OrekitException {
AbstractIntegrator integrator;
if (fixedStepSize > 0.) {
integrator = new ClassicalRungeKuttaIntegrator(fixedStepSize);
} else {
final double[][] tol = DSSTPropagator.tolerances(dP, orbit);
integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
((AdaptiveStepsizeIntegrator) integrator).setInitialStepSize(10. * minStep);
}
DSSTPropagator dsstProp = new DSSTPropagator(integrator, !outputIsOsculating);
dsstProp.setInitialState(new SpacecraftState(orbit, mass), initialIsOsculating);
dsstProp.setSelectedCoefficients(shortPeriodCoefficients == null ? null : new HashSet<String>(shortPeriodCoefficients));
return dsstProp;
}
use of org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator in project Orekit by CS-SI.
the class EphemerisMode method main.
/**
* Program entry point.
* @param args program arguments (unused here)
*/
public static void main(String[] args) {
try {
// configure Orekit
File home = new File(System.getProperty("user.home"));
File orekitData = new File(home, "orekit-data");
if (!orekitData.exists()) {
System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
System.exit(1);
}
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData));
// Initial orbit parameters
// semi major axis in meters
double a = 24396159;
// eccentricity
double e = 0.72831215;
// inclination
double i = FastMath.toRadians(7);
// perigee argument
double omega = FastMath.toRadians(180);
// right ascension of ascending node
double raan = FastMath.toRadians(261);
// mean anomaly
double lM = 0;
// Inertial frame
Frame inertialFrame = FramesFactory.getEME2000();
// Initial date in UTC time scale
TimeScale utc = TimeScalesFactory.getUTC();
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, utc);
// gravitation coefficient
double mu = 3.986004415e+14;
// Orbit construction as Keplerian
Orbit initialOrbit = new KeplerianOrbit(a, e, i, omega, raan, lM, PositionAngle.MEAN, inertialFrame, initialDate, mu);
// Initialize state
SpacecraftState initialState = new SpacecraftState(initialOrbit);
// Numerical propagation with no perturbation (only Keplerian movement)
// Using a very simple integrator with a fixed step: classical Runge-Kutta
// the step is ten seconds
double stepSize = 10;
AbstractIntegrator integrator = new ClassicalRungeKuttaIntegrator(stepSize);
NumericalPropagator propagator = new NumericalPropagator(integrator);
// Set the propagator to ephemeris mode
propagator.setEphemerisMode();
// Initialize propagation
propagator.setInitialState(initialState);
// Propagation with storage of the results in an integrated ephemeris
SpacecraftState finalState = propagator.propagate(initialDate.shiftedBy(6000));
System.out.println(" Numerical propagation :");
System.out.println(" Final date : " + finalState.getDate());
System.out.println(" " + finalState.getOrbit());
// Getting the integrated ephemeris
BoundedPropagator ephemeris = propagator.getGeneratedEphemeris();
System.out.println(" Ephemeris defined from " + ephemeris.getMinDate() + " to " + ephemeris.getMaxDate());
System.out.println(" Ephemeris propagation :");
AbsoluteDate intermediateDate = initialDate.shiftedBy(3000);
SpacecraftState intermediateState = ephemeris.propagate(intermediateDate);
System.out.println(" date : " + intermediateState.getDate());
System.out.println(" " + intermediateState.getOrbit());
intermediateDate = finalState.getDate();
intermediateState = ephemeris.propagate(intermediateDate);
System.out.println(" date : " + intermediateState.getDate());
System.out.println(" " + intermediateState.getOrbit());
intermediateDate = initialDate.shiftedBy(-1000);
System.out.println();
System.out.println("Attempting to propagate to date " + intermediateDate + " which is OUT OF RANGE");
System.out.println("This propagation attempt should fail, " + "so an error message shoud appear below, " + "this is expected and shows that errors are handled correctly");
intermediateState = ephemeris.propagate(intermediateDate);
// these two print should never happen as en exception should have been triggered
System.out.println(" date : " + intermediateState.getDate());
System.out.println(" " + intermediateState.getOrbit());
} catch (OrekitException oe) {
System.out.println(oe.getMessage());
}
}
Aggregations