Search in sources :

Example 81 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator 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 82 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator 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)

Example 83 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class Model method finalizeEstimation.

/**
 * Finalize estimation.
 * @param observedMeasurement measurement that has just been processed
 * @param estimate corrected estimate
 * @exception OrekitException if measurement cannot be re-estimated from corrected state
 */
public void finalizeEstimation(final ObservedMeasurement<?> observedMeasurement, final ProcessEstimate estimate) throws OrekitException {
    // Update the parameters with the estimated state
    // The min/max values of the parameters are handled by the ParameterDriver implementation
    correctedEstimate = estimate;
    updateParameters();
    // Get the estimated propagator (mirroring parameter update in the builder)
    // and the estimated spacecraft state
    final NumericalPropagator estimatedPropagator = getEstimatedPropagator();
    correctedSpacecraftStates[0] = estimatedPropagator.getInitialState();
    // Compute the estimated measurement using estimated spacecraft state
    correctedMeasurement = observedMeasurement.estimate(currentMeasurementNumber, currentMeasurementNumber, correctedSpacecraftStates);
    // Update the trajectory
    // ---------------------
    updateReferenceTrajectory(estimatedPropagator);
}
Also used : NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator)

Example 84 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator 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)

Example 85 with NumericalPropagator

use of org.orekit.propagation.numerical.NumericalPropagator in project Orekit by CS-SI.

the class AttitudesSequenceTest method testResetDuringTransitionBackward.

@Test
public void testResetDuringTransitionBackward() throws OrekitException {
    // Initial state definition : date, orbit
    final AbsoluteDate initialDate = new AbsoluteDate(2004, 01, 01, 23, 30, 00.000, TimeScalesFactory.getUTC());
    final Vector3D position = new Vector3D(-6142438.668, 3492467.560, -25767.25680);
    final Vector3D velocity = new Vector3D(505.8479685, 942.7809215, 7435.922231);
    final Orbit initialOrbit = new KeplerianOrbit(new PVCoordinates(position, velocity), FramesFactory.getEME2000(), initialDate, Constants.EIGEN5C_EARTH_MU);
    final OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
    final TopocentricFrame volgograd = new TopocentricFrame(earth, new GeodeticPoint(FastMath.toRadians(48.7), FastMath.toRadians(44.5), 24.0), "Волгоград");
    final AttitudesSequence attitudesSequence = new AttitudesSequence();
    final double transitionTime = 250.0;
    final AttitudeProvider nadirPointing = new NadirPointing(initialOrbit.getFrame(), earth);
    final AttitudeProvider targetPointing = new TargetPointing(initialOrbit.getFrame(), volgograd.getPoint(), earth);
    final ElevationDetector eventDetector = new ElevationDetector(volgograd).withConstantElevation(FastMath.toRadians(5.0)).withHandler(new ContinueOnEvent<>());
    final List<AbsoluteDate> nadirToTarget = new ArrayList<>();
    attitudesSequence.addSwitchingCondition(nadirPointing, targetPointing, eventDetector, true, false, transitionTime, AngularDerivativesFilter.USE_RR, (previous, next, state) -> nadirToTarget.add(state.getDate()));
    final double[][] tolerance = NumericalPropagator.tolerances(10.0, initialOrbit, initialOrbit.getType());
    final AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(0.001, 300.0, tolerance[0], tolerance[1]);
    final NumericalPropagator propagator = new NumericalPropagator(integrator);
    GravityFieldFactory.addPotentialCoefficientsReader(new ICGEMFormatReader("g007_eigen_05c_coef", false));
    propagator.addForceModel(new HolmesFeatherstoneAttractionModel(earth.getBodyFrame(), GravityFieldFactory.getNormalizedProvider(8, 8)));
    propagator.setInitialState(new SpacecraftState(initialOrbit, nadirPointing.getAttitude(initialOrbit, initialOrbit.getDate(), initialOrbit.getFrame())));
    propagator.setAttitudeProvider(attitudesSequence);
    attitudesSequence.registerSwitchEvents(propagator);
    propagator.propagate(initialDate.shiftedBy(6000));
    // check that if we restart a backward propagation from an intermediate state
    // we properly get an interpolated attitude despite we missed the event trigger
    final AbsoluteDate midTransition = nadirToTarget.get(0).shiftedBy(0.5 * transitionTime);
    SpacecraftState state = propagator.propagate(midTransition.shiftedBy(+60), midTransition);
    Rotation nadirR = nadirPointing.getAttitude(state.getOrbit(), state.getDate(), state.getFrame()).getRotation();
    Rotation targetR = targetPointing.getAttitude(state.getOrbit(), state.getDate(), state.getFrame()).getRotation();
    final double reorientationAngle = Rotation.distance(nadirR, targetR);
    Assert.assertEquals(0.5 * reorientationAngle, Rotation.distance(state.getAttitude().getRotation(), targetR), 0.03 * reorientationAngle);
}
Also used : OneAxisEllipsoid(org.orekit.bodies.OneAxisEllipsoid) ICGEMFormatReader(org.orekit.forces.gravity.potential.ICGEMFormatReader) ElevationDetector(org.orekit.propagation.events.ElevationDetector) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) ArrayList(java.util.ArrayList) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) TopocentricFrame(org.orekit.frames.TopocentricFrame) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) GeodeticPoint(org.orekit.bodies.GeodeticPoint) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) FieldOrbit(org.orekit.orbits.FieldOrbit) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) Orbit(org.orekit.orbits.Orbit) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) Test(org.junit.Test)

Aggregations

NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)95 SpacecraftState (org.orekit.propagation.SpacecraftState)69 DormandPrince853Integrator (org.hipparchus.ode.nonstiff.DormandPrince853Integrator)62 Test (org.junit.Test)54 Orbit (org.orekit.orbits.Orbit)50 AbsoluteDate (org.orekit.time.AbsoluteDate)46 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)43 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)39 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)38 OrbitType (org.orekit.orbits.OrbitType)38 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)36 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)36 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)34 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)31 PVCoordinates (org.orekit.utils.PVCoordinates)29 CartesianOrbit (org.orekit.orbits.CartesianOrbit)27 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)24 Frame (org.orekit.frames.Frame)24 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)22 DateComponents (org.orekit.time.DateComponents)21