Search in sources :

Example 31 with ForceModel

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

the class DSSTPropagatorTest method getLEOStatePropagatedBy30Minutes.

private SpacecraftState getLEOStatePropagatedBy30Minutes() throws IllegalArgumentException, OrekitException {
    final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
    final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
    // Spring equinoxe 21st mars 2003 1h00m
    final AbsoluteDate initialDate = new AbsoluteDate(new DateComponents(2003, 03, 21), new TimeComponents(1, 0, 0.), TimeScalesFactory.getUTC());
    final CartesianOrbit osculatingOrbit = new CartesianOrbit(new PVCoordinates(position, velocity), FramesFactory.getTOD(IERSConventions.IERS_1996, false), initialDate, Constants.WGS84_EARTH_MU);
    // Adaptive step integrator
    // with a minimum step of 0.001 and a maximum step of 1000
    double minStep = 0.001;
    double maxstep = 1000.0;
    double positionTolerance = 10.0;
    OrbitType propagationType = OrbitType.EQUINOCTIAL;
    double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, osculatingOrbit, propagationType);
    AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]);
    NumericalPropagator propagator = new NumericalPropagator(integrator);
    propagator.setOrbitType(propagationType);
    NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(5, 5);
    ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider);
    propagator.addForceModel(holmesFeatherstone);
    propagator.setInitialState(new SpacecraftState(osculatingOrbit));
    return propagator.propagate(new AbsoluteDate(initialDate, 1800.));
}
Also used : CartesianOrbit(org.orekit.orbits.CartesianOrbit) ForceModel(org.orekit.forces.ForceModel) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) TimeStampedPVCoordinates(org.orekit.utils.TimeStampedPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) DateComponents(org.orekit.time.DateComponents) TimeComponents(org.orekit.time.TimeComponents) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) NormalizedSphericalHarmonicsProvider(org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 32 with ForceModel

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

the class FieldNumericalPropagatorTest method doTestPropagationTypesHyperbolic.

private <T extends RealFieldElement<T>> void doTestPropagationTypesHyperbolic(Field<T> field) throws OrekitException {
    T zero = field.getZero();
    // setup
    final FieldAbsoluteDate<T> initDate = FieldAbsoluteDate.getJ2000Epoch(field);
    FieldSpacecraftState<T> initialState;
    FieldNumericalPropagator<T> propagator;
    final FieldVector3D<T> position = new FieldVector3D<>(zero.add(7.0e6), zero.add(1.0e6), zero.add(4.0e6));
    final FieldVector3D<T> velocity = new FieldVector3D<>(zero.add(-500.0), zero.add(8000.0), zero.add(1000.0));
    final FieldOrbit<T> orbit = new FieldEquinoctialOrbit<>(new FieldPVCoordinates<>(position, velocity), FramesFactory.getEME2000(), initDate, mu);
    initialState = new FieldSpacecraftState<>(orbit);
    OrbitType type = OrbitType.EQUINOCTIAL;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, orbit.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<T> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    propagator = new FieldNumericalPropagator<>(field, integrator);
    propagator.setOrbitType(type);
    propagator.setInitialState(initialState);
    FieldSpacecraftState<T> state = new FieldSpacecraftState<>(new FieldKeplerianOrbit<>(zero.add(-10000000.0), zero.add(2.5), zero.add(0.3), zero, zero, zero, PositionAngle.TRUE, FramesFactory.getEME2000(), initDate, mu));
    ForceModel gravityField = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(5, 5));
    propagator.addForceModel(gravityField);
    // Propagation of the initial at t + dt
    final FieldPVCoordinates<T> pv = state.getPVCoordinates();
    final T dP = zero.add(0.001);
    final T dV = dP.multiply(state.getMu()).divide(pv.getPosition().getNormSq().multiply(pv.getVelocity().getNorm()));
    final FieldPVCoordinates<T> pvcM = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pvkM = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.MEAN, propagator);
    final FieldPVCoordinates<T> pvcE = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pvkE = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.ECCENTRIC, propagator);
    final FieldPVCoordinates<T> pvcT = propagateInType(state, dP, OrbitType.CARTESIAN, PositionAngle.TRUE, propagator);
    final FieldPVCoordinates<T> pvkT = propagateInType(state, dP, OrbitType.KEPLERIAN, PositionAngle.TRUE, propagator);
    Assert.assertEquals(0, pvcM.getPosition().subtract(pvkT.getPosition()).getNorm().getReal() / dP.getReal(), 0.3);
    Assert.assertEquals(0, pvcM.getVelocity().subtract(pvkT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.4);
    Assert.assertEquals(0, pvkM.getPosition().subtract(pvkT.getPosition()).getNorm().getReal() / dP.getReal(), 0.2);
    Assert.assertEquals(0, pvkM.getVelocity().subtract(pvkT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.3);
    Assert.assertEquals(0, pvcE.getPosition().subtract(pvkT.getPosition()).getNorm().getReal() / dP.getReal(), 0.3);
    Assert.assertEquals(0, pvcE.getVelocity().subtract(pvkT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.4);
    Assert.assertEquals(0, pvkE.getPosition().subtract(pvkT.getPosition()).getNorm().getReal() / dP.getReal(), 0.009);
    Assert.assertEquals(0, pvkE.getVelocity().subtract(pvkT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.006);
    Assert.assertEquals(0, pvcT.getPosition().subtract(pvkT.getPosition()).getNorm().getReal() / dP.getReal(), 0.3);
    Assert.assertEquals(0, pvcT.getVelocity().subtract(pvkT.getVelocity()).getNorm().getReal() / dV.getReal(), 0.4);
}
Also used : DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) ForceModel(org.orekit.forces.ForceModel) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) FieldEquinoctialOrbit(org.orekit.orbits.FieldEquinoctialOrbit) OrbitType(org.orekit.orbits.OrbitType) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)

Example 33 with ForceModel

use of org.orekit.forces.ForceModel 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 34 with ForceModel

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

the class NumericalPropagatorBuilder method copy.

/**
 * Create a copy of a NumericalPropagatorBuilder object.
 * @return Copied version of the NumericalPropagatorBuilder
 * @throws OrekitException if parameters drivers cannot be scaled
 */
public NumericalPropagatorBuilder copy() throws OrekitException {
    final NumericalPropagatorBuilder copyBuilder = new NumericalPropagatorBuilder(createInitialOrbit(), builder, getPositionAngle(), getPositionScale());
    copyBuilder.setAttitudeProvider(attProvider);
    copyBuilder.setMass(mass);
    for (ForceModel model : forceModels) {
        copyBuilder.addForceModel(model);
    }
    return copyBuilder;
}
Also used : ForceModel(org.orekit.forces.ForceModel)

Example 35 with ForceModel

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

the class NumericalPropagatorBuilder method buildPropagator.

/**
 * {@inheritDoc}
 */
public NumericalPropagator buildPropagator(final double[] normalizedParameters) throws OrekitException {
    setParameters(normalizedParameters);
    final Orbit orbit = createInitialOrbit();
    final Attitude attitude = attProvider.getAttitude(orbit, orbit.getDate(), getFrame());
    final SpacecraftState state = new SpacecraftState(orbit, attitude, mass);
    final NumericalPropagator propagator = new NumericalPropagator(builder.buildIntegrator(orbit, getOrbitType()));
    propagator.setOrbitType(getOrbitType());
    propagator.setPositionAngleType(getPositionAngle());
    propagator.setAttitudeProvider(attProvider);
    for (ForceModel model : forceModels) {
        propagator.addForceModel(model);
    }
    propagator.resetInitialState(state);
    return propagator;
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) Orbit(org.orekit.orbits.Orbit) ForceModel(org.orekit.forces.ForceModel) Attitude(org.orekit.attitudes.Attitude) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator)

Aggregations

ForceModel (org.orekit.forces.ForceModel)37 SpacecraftState (org.orekit.propagation.SpacecraftState)22 Orbit (org.orekit.orbits.Orbit)16 Test (org.junit.Test)15 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)15 NormalizedSphericalHarmonicsProvider (org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider)14 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)14 AbsoluteDate (org.orekit.time.AbsoluteDate)14 HolmesFeatherstoneAttractionModel (org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel)13 Frame (org.orekit.frames.Frame)11 OrbitType (org.orekit.orbits.OrbitType)11 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)9 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)9 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)8 UT1Scale (org.orekit.time.UT1Scale)8 TimeScale (org.orekit.time.TimeScale)7 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)6 OrekitException (org.orekit.errors.OrekitException)5 FieldCartesianOrbit (org.orekit.orbits.FieldCartesianOrbit)5 PVCoordinates (org.orekit.utils.PVCoordinates)5