Search in sources :

Example 6 with DragForce

use of org.orekit.forces.drag.DragForce 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;
}
Also used : IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) Atmosphere(org.orekit.forces.drag.atmosphere.Atmosphere) DragForce(org.orekit.forces.drag.DragForce) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) ClassicalRungeKuttaIntegrator(org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator) DTM2000InputParameters(org.orekit.forces.drag.atmosphere.DTM2000InputParameters)

Example 7 with DragForce

use of org.orekit.forces.drag.DragForce in project Orekit by CS-SI.

the class NumericalPropagatorTest method createPropagator.

private static synchronized NumericalPropagator createPropagator(SpacecraftState spacecraftState, OrbitType orbitType, PositionAngle angleType) throws OrekitException {
    final double minStep = 0.001;
    final double maxStep = 120.0;
    final double positionTolerance = 0.1;
    final int degree = 20;
    final int order = 20;
    final double spacecraftArea = 1.0;
    final double spacecraftDragCoefficient = 2.0;
    final double spacecraftReflectionCoefficient = 2.0;
    // propagator main configuration
    final double[][] tol = NumericalPropagator.tolerances(positionTolerance, spacecraftState.getOrbit(), orbitType);
    final ODEIntegrator integrator = new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]);
    final NumericalPropagator np = new NumericalPropagator(integrator);
    np.setOrbitType(orbitType);
    np.setPositionAngleType(angleType);
    np.setInitialState(spacecraftState);
    // Earth gravity field
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final NormalizedSphericalHarmonicsProvider harmonicsGravityProvider = GravityFieldFactory.getNormalizedProvider(degree, order);
    np.addForceModel(new HolmesFeatherstoneAttractionModel(earth.getBodyFrame(), harmonicsGravityProvider));
    // Sun and Moon attraction
    np.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getSun()));
    np.addForceModel(new ThirdBodyAttraction(CelestialBodyFactory.getMoon()));
    // atmospheric drag
    MarshallSolarActivityFutureEstimation msafe = new MarshallSolarActivityFutureEstimation("Jan2000F10-edited-data\\.txt", MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE);
    DataProvidersManager.getInstance().feed(msafe.getSupportedNames(), msafe);
    DTM2000 atmosphere = new DTM2000(msafe, CelestialBodyFactory.getSun(), earth);
    np.addForceModel(new DragForce(atmosphere, new IsotropicDrag(spacecraftArea, spacecraftDragCoefficient)));
    // solar radiation pressure
    np.addForceModel(new SolarRadiationPressure(CelestialBodyFactory.getSun(), earth.getEquatorialRadius(), new IsotropicRadiationSingleCoefficient(spacecraftArea, spacecraftReflectionCoefficient)));
    return np;
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) DTM2000(org.orekit.forces.drag.atmosphere.DTM2000) SolarRadiationPressure(org.orekit.forces.radiation.SolarRadiationPressure) MarshallSolarActivityFutureEstimation(org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation) ThirdBodyAttraction(org.orekit.forces.gravity.ThirdBodyAttraction) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) DragForce(org.orekit.forces.drag.DragForce) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) IsotropicRadiationSingleCoefficient(org.orekit.forces.radiation.IsotropicRadiationSingleCoefficient)

Example 8 with DragForce

use of org.orekit.forces.drag.DragForce in project Orekit by CS-SI.

the class PartialDerivativesTest method doTestParametersDerivatives.

private void doTestParametersDerivatives(String parameterName, double tolerance, OrbitType... orbitTypes) throws OrekitException {
    OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    ForceModel drag = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(), earth), new IsotropicDrag(2.5, 1.2));
    NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
    ForceModel gravityField = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
    Orbit baseOrbit = new KeplerianOrbit(7000000.0, 0.01, 0.1, 0.7, 0, 1.2, PositionAngle.TRUE, FramesFactory.getEME2000(), AbsoluteDate.J2000_EPOCH, provider.getMu());
    double dt = 900;
    double dP = 1.0;
    for (OrbitType orbitType : orbitTypes) {
        final Orbit initialOrbit = orbitType.convertType(baseOrbit);
        for (PositionAngle angleType : PositionAngle.values()) {
            NumericalPropagator propagator = setUpPropagator(initialOrbit, dP, orbitType, angleType, drag, gravityField);
            propagator.setMu(provider.getMu());
            for (final ForceModel forceModel : propagator.getAllForceModels()) {
                for (final ParameterDriver driver : forceModel.getParametersDrivers()) {
                    driver.setValue(driver.getReferenceValue());
                    driver.setSelected(driver.getName().equals(parameterName));
                }
            }
            PartialDerivativesEquations partials = new PartialDerivativesEquations("partials", propagator);
            final SpacecraftState initialState = partials.setInitialJacobians(new SpacecraftState(initialOrbit));
            propagator.setInitialState(initialState);
            final JacobiansMapper mapper = partials.getMapper();
            PickUpHandler pickUp = new PickUpHandler(mapper, null);
            propagator.setMasterMode(pickUp);
            propagator.propagate(initialState.getDate().shiftedBy(dt));
            double[][] dYdP = pickUp.getdYdP();
            // compute reference Jacobian using finite differences
            double[][] dYdPRef = new double[6][1];
            NumericalPropagator propagator2 = setUpPropagator(initialOrbit, dP, orbitType, angleType, drag, gravityField);
            propagator2.setMu(provider.getMu());
            ParameterDriversList bound = new ParameterDriversList();
            for (final ForceModel forceModel : propagator2.getAllForceModels()) {
                for (final ParameterDriver driver : forceModel.getParametersDrivers()) {
                    if (driver.getName().equals(parameterName)) {
                        driver.setSelected(true);
                        bound.add(driver);
                    } else {
                        driver.setSelected(false);
                    }
                }
            }
            ParameterDriver selected = bound.getDrivers().get(0);
            double p0 = selected.getReferenceValue();
            double h = selected.getScale();
            selected.setValue(p0 - 4 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sM4h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 - 3 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sM3h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 - 2 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sM2h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 - 1 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sM1h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 + 1 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sP1h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 + 2 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sP2h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 + 3 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sP3h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            selected.setValue(p0 + 4 * h);
            propagator2.resetInitialState(arrayToState(stateToArray(initialState, orbitType, angleType, true), orbitType, angleType, initialState.getFrame(), initialState.getDate(), // the mu may have been reset above
            propagator2.getMu(), initialState.getAttitude()));
            SpacecraftState sP4h = propagator2.propagate(initialOrbit.getDate().shiftedBy(dt));
            fillJacobianColumn(dYdPRef, 0, orbitType, angleType, h, sM4h, sM3h, sM2h, sM1h, sP1h, sP2h, sP3h, sP4h);
            for (int i = 0; i < 6; ++i) {
                Assert.assertEquals(dYdPRef[i][0], dYdP[i][0], FastMath.abs(dYdPRef[i][0] * tolerance));
            }
        }
    }
}
Also used : HarrisPriester(org.orekit.forces.drag.atmosphere.HarrisPriester) OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) ForceModel(org.orekit.forces.ForceModel) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) PositionAngle(org.orekit.orbits.PositionAngle) ParameterDriver(org.orekit.utils.ParameterDriver) SpacecraftState(org.orekit.propagation.SpacecraftState) ParameterDriversList(org.orekit.utils.ParameterDriversList) DragForce(org.orekit.forces.drag.DragForce) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) OrbitType(org.orekit.orbits.OrbitType) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 9 with DragForce

use of org.orekit.forces.drag.DragForce in project Orekit by CS-SI.

the class NumericalConverterTest method checkFit.

protected void checkFit(final Orbit orbit, final double duration, final double stepSize, final double threshold, final double expectedRMS, final String... freeParameters) throws OrekitException, IOException, ParseException {
    NumericalPropagatorBuilder builder = new NumericalPropagatorBuilder(OrbitType.CARTESIAN.convertType(orbit), new DormandPrince853IntegratorBuilder(minStep, maxStep, dP), PositionAngle.TRUE, dP);
    ForceModel guessedDrag = drag;
    ForceModel guessedGravity = gravity;
    for (String param : freeParameters) {
        if (DragSensitive.DRAG_COEFFICIENT.equals(param)) {
            // we want to adjust drag coefficient, we need to start from a wrong value
            ParameterDriver driver = drag.getParameterDriver(param);
            double coeff = driver.getReferenceValue() - driver.getScale();
            guessedDrag = new DragForce(atmosphere, new IsotropicDrag(crossSection, coeff));
        } else if (NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT.equals(param)) {
            // we want to adjust mu, we need to start from  a wrong value
            guessedGravity = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(2, 0));
            ParameterDriver driver = guessedGravity.getParameterDriver(param);
            driver.setValue(driver.getReferenceValue() + driver.getScale());
        }
    }
    builder.addForceModel(guessedDrag);
    builder.addForceModel(guessedGravity);
    JacobianPropagatorConverter fitter = new JacobianPropagatorConverter(builder, threshold, 5000);
    fitter.convert(propagator, duration, 1 + (int) (duration / stepSize), freeParameters);
    NumericalPropagator prop = (NumericalPropagator) fitter.getAdaptedPropagator();
    Orbit fitted = prop.getInitialState().getOrbit();
    for (String param : freeParameters) {
        for (ForceModel force : propagator.getAllForceModels()) {
            if (force.isSupported(param)) {
                for (ForceModel model : prop.getAllForceModels()) {
                    if (model.isSupported(param)) {
                        Assert.assertEquals(force.getParameterDriver(param).getValue(), model.getParameterDriver(param).getValue(), 3.0e-4 * FastMath.abs(force.getParameterDriver(param).getValue()));
                    }
                }
            }
        }
    }
    Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.01 * expectedRMS);
    Assert.assertEquals(orbit.getPVCoordinates().getPosition().getX(), fitted.getPVCoordinates().getPosition().getX(), 1.1);
    Assert.assertEquals(orbit.getPVCoordinates().getPosition().getY(), fitted.getPVCoordinates().getPosition().getY(), 1.1);
    Assert.assertEquals(orbit.getPVCoordinates().getPosition().getZ(), fitted.getPVCoordinates().getPosition().getZ(), 1.1);
    Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getX(), fitted.getPVCoordinates().getVelocity().getX(), 0.0005);
    Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getY(), fitted.getPVCoordinates().getVelocity().getY(), 0.0005);
    Assert.assertEquals(orbit.getPVCoordinates().getVelocity().getZ(), fitted.getPVCoordinates().getVelocity().getZ(), 0.0005);
}
Also used : IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) ForceModel(org.orekit.forces.ForceModel) Orbit(org.orekit.orbits.Orbit) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) DragForce(org.orekit.forces.drag.DragForce) ParameterDriver(org.orekit.utils.ParameterDriver) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 10 with DragForce

use of org.orekit.forces.drag.DragForce in project Orekit by CS-SI.

the class NumericalConverterTest method setUp.

@Before
public void setUp() throws OrekitException, IOException, ParseException {
    Utils.setDataRoot("regular-data:potential/shm-format");
    gravity = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(2, 0));
    mu = gravity.getParameterDriver(NewtonianAttraction.CENTRAL_ATTRACTION_COEFFICIENT).getValue();
    minStep = 1.0;
    maxStep = 600.0;
    dP = 10.0;
    // use a orbit that comes close to Earth so the drag coefficient has an effect
    final Vector3D position = new Vector3D(7.0e6, 1.0e6, 4.0e6).normalize().scalarMultiply(Constants.WGS84_EARTH_EQUATORIAL_RADIUS + 300e3);
    final Vector3D velocity = new Vector3D(-500.0, 8000.0, 1000.0);
    final AbsoluteDate initDate = new AbsoluteDate(2010, 10, 10, 10, 10, 10.0, TimeScalesFactory.getUTC());
    orbit = new EquinoctialOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    final double[][] tol = NumericalPropagator.tolerances(dP, orbit, OrbitType.CARTESIAN);
    propagator = new NumericalPropagator(new DormandPrince853Integrator(minStep, maxStep, tol[0], tol[1]));
    propagator.setInitialState(new SpacecraftState(orbit));
    propagator.setOrbitType(OrbitType.CARTESIAN);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    earth.setAngularThreshold(1.e-7);
    atmosphere = new SimpleExponentialAtmosphere(earth, 0.0004, 42000.0, 7500.0);
    final double dragCoef = 2.0;
    crossSection = 10.0;
    drag = new DragForce(atmosphere, new IsotropicDrag(crossSection, dragCoef));
    propagator.addForceModel(gravity);
    propagator.addForceModel(drag);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) IsotropicDrag(org.orekit.forces.drag.IsotropicDrag) PVCoordinates(org.orekit.utils.PVCoordinates) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) DragForce(org.orekit.forces.drag.DragForce) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) SimpleExponentialAtmosphere(org.orekit.forces.drag.atmosphere.SimpleExponentialAtmosphere) Before(org.junit.Before)

Aggregations

DragForce (org.orekit.forces.drag.DragForce)13 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)12 IsotropicDrag (org.orekit.forces.drag.IsotropicDrag)11 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)6 DTM2000 (org.orekit.forces.drag.atmosphere.DTM2000)6 ThirdBodyAttraction (org.orekit.forces.gravity.ThirdBodyAttraction)6 IsotropicRadiationSingleCoefficient (org.orekit.forces.radiation.IsotropicRadiationSingleCoefficient)6 SolarRadiationPressure (org.orekit.forces.radiation.SolarRadiationPressure)6 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)5 Atmosphere (org.orekit.forces.drag.atmosphere.Atmosphere)5 MarshallSolarActivityFutureEstimation (org.orekit.forces.drag.atmosphere.data.MarshallSolarActivityFutureEstimation)5 NormalizedSphericalHarmonicsProvider (org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider)5 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)5 ParameterDriver (org.orekit.utils.ParameterDriver)5 ParameterDriversList (org.orekit.utils.ParameterDriversList)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 CelestialBody (org.orekit.bodies.CelestialBody)3 GeodeticPoint (org.orekit.bodies.GeodeticPoint)3 DataProvidersManager (org.orekit.data.DataProvidersManager)3