use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.
the class DSSTPropagation method createNumProp.
/**
* Create the numerical propagator
*
* @param orbit initial orbit
* @param mass S/C mass (kg)
* @throws OrekitException
*/
private NumericalPropagator createNumProp(final Orbit orbit, final double mass) throws OrekitException {
final double[][] tol = NumericalPropagator.tolerances(1.0, orbit, orbit.getType());
final double minStep = 1.e-3;
final double maxStep = 1.e+3;
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
integrator.setInitialStepSize(100.);
NumericalPropagator numProp = new NumericalPropagator(integrator);
numProp.setInitialState(new SpacecraftState(orbit, mass));
return numProp;
}
use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.
the class SecularAndHarmonicTest method fitGMST.
private double[] fitGMST(CircularOrbit orbit, int nbOrbits, double mst) throws OrekitException {
double period = orbit.getKeplerianPeriod();
double duration = nbOrbits * period;
NumericalPropagator propagator = createPropagator(orbit);
SecularAndHarmonic mstModel = new SecularAndHarmonic(2, 2.0 * FastMath.PI / Constants.JULIAN_YEAR, 4.0 * FastMath.PI / Constants.JULIAN_YEAR, 2.0 * FastMath.PI / Constants.JULIAN_DAY, 4.0 * FastMath.PI / Constants.JULIAN_DAY);
mstModel.resetFitting(orbit.getDate(), new double[] { mst, -1.0e-10, -1.0e-17, 1.0e-3, 1.0e-3, 1.0e-5, 1.0e-5, 1.0e-5, 1.0e-5, 1.0e-5, 1.0e-5 });
// first descending node
SpacecraftState crossing = findFirstCrossing(0.0, false, orbit.getDate(), orbit.getDate().shiftedBy(2 * period), 0.01 * period, propagator);
while (crossing != null && crossing.getDate().durationFrom(orbit.getDate()) < (nbOrbits * period)) {
final AbsoluteDate previousDate = crossing.getDate();
crossing = findLatitudeCrossing(0.0, previousDate.shiftedBy(period), previousDate.shiftedBy(2 * period), 0.01 * period, period / 8, propagator);
if (crossing != null) {
// store current point
mstModel.addPoint(crossing.getDate(), meanSolarTime(crossing.getOrbit()));
// use the same time separation to pinpoint next crossing
period = crossing.getDate().durationFrom(previousDate);
}
}
// fit the mean solar time to a parabolic model, taking care the main
// periods are properly removed
mstModel.fit();
return mstModel.approximateAsPolynomialOnly(1, orbit.getDate(), 2, 2, orbit.getDate(), orbit.getDate().shiftedBy(duration), 0.01 * period);
}
use of org.orekit.propagation.numerical.NumericalPropagator 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());
}
}
use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.
the class MasterMode 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));
// gravitation coefficient
double mu = 3.986004415e+14;
// inertial frame
Frame inertialFrame = FramesFactory.getEME2000();
// Initial date
AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
// Initial orbit
// 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 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);
// Adaptive step integrator with a minimum step of 0.001 and a maximum step of 1000
final double minStep = 0.001;
final double maxstep = 1000.0;
final double positionTolerance = 10.0;
final OrbitType propagationType = OrbitType.KEPLERIAN;
final double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, initialOrbit, propagationType);
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]);
// Propagator
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(propagationType);
// Force Model (reduced to perturbing gravity field)
final NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(10, 10);
ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
// Add force model to the propagator
propagator.addForceModel(holmesFeatherstone);
// Set up initial state in the propagator
propagator.setInitialState(initialState);
// Set up operating mode for the propagator as master mode
// with fixed step and specialized step handler
propagator.setMasterMode(60., new TutorialStepHandler());
// Extrapolate from the initial to the final date
SpacecraftState finalState = propagator.propagate(initialDate.shiftedBy(630.));
KeplerianOrbit o = (KeplerianOrbit) OrbitType.KEPLERIAN.convertType(finalState.getOrbit());
System.out.format(Locale.US, "Final state:%n%s %12.3f %10.8f %10.6f %10.6f %10.6f %10.6f%n", finalState.getDate(), o.getA(), o.getE(), FastMath.toDegrees(o.getI()), FastMath.toDegrees(o.getPerigeeArgument()), FastMath.toDegrees(o.getRightAscensionOfAscendingNode()), FastMath.toDegrees(o.getTrueAnomaly()));
} catch (OrekitException oe) {
System.err.println(oe.getMessage());
}
}
use of org.orekit.propagation.numerical.NumericalPropagator in project SpriteOrbits by ProjectPersephone.
the class SpritePropOrig method createPropagator.
/**
* Create a numerical propagator for a state.
* @param state state to propagate
* @param attitudeProvider provider for the attitude
* @param crossSection cross section of the object
* @param dragCoeff drag coefficient
*/
private Propagator createPropagator(final SpacecraftState state, final AttitudeProvider attitudeProvider, final double crossSection, final double dragCoeff) throws OrekitException {
// see https://www.orekit.org/static/architecture/propagation.html
// steps limits
final double minStep = 0.001;
final double maxStep = 1000;
final double initStep = 60;
// error control parameters (absolute and relative)
final double positionError = 10.0;
// we will propagate in Cartesian coordinates
final OrbitType orbitType = OrbitType.CARTESIAN;
final double[][] tolerances = NumericalPropagator.tolerances(positionError, state.getOrbit(), orbitType);
// set up mathematical integrator
AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tolerances[0], tolerances[1]);
integrator.setInitialStepSize(initStep);
// set up space dynamics propagator
NumericalPropagator propagator = new NumericalPropagator(integrator);
propagator.setOrbitType(orbitType);
// add gravity field force model
final NormalizedSphericalHarmonicsProvider gravityProvider = GravityFieldFactory.getNormalizedProvider(8, 8);
propagator.addForceModel(new HolmesFeatherstoneAttractionModel(earth.getBodyFrame(), gravityProvider));
// add atmospheric drag force model
propagator.addForceModel(new DragForce(new HarrisPriester(sun, earth), new SphericalSpacecraft(crossSection, dragCoeff, 0.0, 0.0)));
// set attitude mode
propagator.setAttitudeProvider(attitudeProvider);
propagator.setInitialState(state);
return propagator;
}
Aggregations