Search in sources :

Example 1 with AdaptiveStepsizeIntegrator

use of org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator in project SpriteOrbits by ProjectPersephone.

the class SpriteProp 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;
}
Also used : HarrisPriester(org.orekit.forces.drag.HarrisPriester) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) DragForce(org.orekit.forces.drag.DragForce) AdaptiveStepsizeIntegrator(org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator) SphericalSpacecraft(org.orekit.forces.SphericalSpacecraft) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 2 with AdaptiveStepsizeIntegrator

use of org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator 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;
}
Also used : HarrisPriester(org.orekit.forces.drag.HarrisPriester) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) DragForce(org.orekit.forces.drag.DragForce) AdaptiveStepsizeIntegrator(org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator) SphericalSpacecraft(org.orekit.forces.SphericalSpacecraft) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Aggregations

AdaptiveStepsizeIntegrator (org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator)2 DormandPrince853Integrator (org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator)2 SphericalSpacecraft (org.orekit.forces.SphericalSpacecraft)2 DragForce (org.orekit.forces.drag.DragForce)2 HarrisPriester (org.orekit.forces.drag.HarrisPriester)2 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)2 NormalizedSphericalHarmonicsProvider (org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider)2 OrbitType (org.orekit.orbits.OrbitType)2 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)2