Search in sources :

Example 1 with AuxiliaryElements

use of org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements in project Orekit by CS-SI.

the class DSSTPropagator method computeOsculatingState.

/**
 * Conversion from mean to osculating orbit.
 * <p>
 * Compute osculating state <b>in a DSST sense</b>, corresponding to the
 * mean SpacecraftState in input, and according to the Force models taken
 * into account.
 * </p><p>
 * Since the osculating state is obtained by adding short-periodic variation
 * of each force model, the resulting output will depend on the
 * force models parameterized in input.
 * </p>
 * @param mean Mean state to convert
 * @param forces Forces to take into account
 * @param attitudeProvider attitude provider (may be null if there are no Gaussian force models
 * like atmospheric drag, radiation pressure or specific user-defined models)
 * @return osculating state in a DSST sense
 * @throws OrekitException if computation of short periodics fails
 */
public static SpacecraftState computeOsculatingState(final SpacecraftState mean, final AttitudeProvider attitudeProvider, final Collection<DSSTForceModel> forces) throws OrekitException {
    // Create the auxiliary object
    final AuxiliaryElements aux = new AuxiliaryElements(mean.getOrbit(), I);
    // Set the force models
    final List<ShortPeriodTerms> shortPeriodTerms = new ArrayList<ShortPeriodTerms>();
    for (final DSSTForceModel force : forces) {
        force.registerAttitudeProvider(attitudeProvider);
        shortPeriodTerms.addAll(force.initialize(aux, false));
        force.updateShortPeriodTerms(mean);
    }
    final EquinoctialOrbit osculatingOrbit = computeOsculatingOrbit(mean, shortPeriodTerms);
    return new SpacecraftState(osculatingOrbit, mean.getAttitude(), mean.getMass(), mean.getAdditionalStates());
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ShortPeriodTerms(org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) ArrayList(java.util.ArrayList) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Example 2 with AuxiliaryElements

use of org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements in project Orekit by CS-SI.

the class AbstractGaussianContribution method updateShortPeriodTerms.

/**
 * {@inheritDoc}
 */
@Override
public void updateShortPeriodTerms(final SpacecraftState... meanStates) throws OrekitException {
    final Slot slot = gaussianSPCoefs.createSlot(meanStates);
    for (final SpacecraftState meanState : meanStates) {
        initializeStep(new AuxiliaryElements(meanState.getOrbit(), I));
        final double[][] currentRhoSigmaj = computeRhoSigmaCoefficients(meanState.getDate());
        final FourierCjSjCoefficients fourierCjSj = new FourierCjSjCoefficients(meanState, JMAX);
        final UijVijCoefficients uijvij = new UijVijCoefficients(currentRhoSigmaj, fourierCjSj, JMAX);
        gaussianSPCoefs.computeCoefficients(meanState, slot, fourierCjSj, uijvij, n, a);
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Example 3 with AuxiliaryElements

use of org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements in project Orekit by CS-SI.

the class DSSTTesseral method updateShortPeriodTerms.

/**
 * {@inheritDoc}
 */
@Override
public void updateShortPeriodTerms(final SpacecraftState... meanStates) throws OrekitException {
    final Slot slot = shortPeriodTerms.createSlot(meanStates);
    for (final SpacecraftState meanState : meanStates) {
        initializeStep(new AuxiliaryElements(meanState.getOrbit(), I));
        // Initialise the Hansen coefficients
        for (int s = -maxDegree; s <= maxDegree; s++) {
            // coefficients with j == 0 are always needed
            this.hansenObjects[s + maxDegree][0].computeInitValues(e2, chi, chi2);
            if (maxDegreeTesseralSP >= 0) {
                // initialize other objects only if required
                for (int j = 1; j <= maxFrequencyShortPeriodics; j++) {
                    this.hansenObjects[s + maxDegree][j].computeInitValues(e2, chi, chi2);
                }
            }
        }
        // Compute only if there is at least one non-resonant tesseral
        if (!nonResOrders.isEmpty() || maxDegreeTesseralSP < 0) {
            // Generate the fourrier coefficients
            cjsjFourier.generateCoefficients(meanState.getDate());
            // the coefficient 3n / 2a
            final double tnota = 1.5 * meanMotion / a;
            // build the mDaily coefficients
            for (int m = 1; m <= maxOrderMdailyTesseralSP; m++) {
                // build the coefficients
                buildCoefficients(meanState.getDate(), slot, m, 0, tnota);
            }
            if (maxDegreeTesseralSP >= 0) {
                // generate the other coefficients, if required
                for (final Map.Entry<Integer, List<Integer>> entry : nonResOrders.entrySet()) {
                    for (int j : entry.getValue()) {
                        // build the coefficients
                        buildCoefficients(meanState.getDate(), slot, entry.getKey(), j, tnota);
                    }
                }
            }
        }
    }
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ArrayList(java.util.ArrayList) List(java.util.List) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements) TimeSpanMap(org.orekit.utils.TimeSpanMap) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap) SortedMap(java.util.SortedMap)

Example 4 with AuxiliaryElements

use of org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements in project Orekit by CS-SI.

the class DSSTPropagator method beforeIntegration.

/**
 * Method called just before integration.
 * <p>
 * The default implementation does nothing, it may be specialized in subclasses.
 * </p>
 * @param initialState initial state
 * @param tEnd target date at which state should be propagated
 * @exception OrekitException if hook cannot be run
 */
@Override
protected void beforeIntegration(final SpacecraftState initialState, final AbsoluteDate tEnd) throws OrekitException {
    // compute common auxiliary elements
    final AuxiliaryElements aux = new AuxiliaryElements(initialState.getOrbit(), I);
    // check if only mean elements must be used
    final boolean meanOnly = isMeanOrbit();
    // initialize all perturbing forces
    final List<ShortPeriodTerms> shortPeriodTerms = new ArrayList<ShortPeriodTerms>();
    for (final DSSTForceModel force : forceModels) {
        shortPeriodTerms.addAll(force.initialize(aux, meanOnly));
    }
    mapper.setShortPeriodTerms(shortPeriodTerms);
    // if required, insert the special short periodics step handler
    if (!meanOnly) {
        final ShortPeriodicsHandler spHandler = new ShortPeriodicsHandler(forceModels);
        final Collection<ODEStepHandler> stepHandlers = new ArrayList<ODEStepHandler>();
        stepHandlers.add(spHandler);
        final ODEIntegrator integrator = getIntegrator();
        final Collection<ODEStepHandler> existing = integrator.getStepHandlers();
        stepHandlers.addAll(existing);
        integrator.clearStepHandlers();
        // add back the existing handlers after the short periodics one
        for (final ODEStepHandler sp : stepHandlers) {
            integrator.addStepHandler(sp);
        }
    }
}
Also used : ShortPeriodTerms(org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) ArrayList(java.util.ArrayList) ODEStepHandler(org.hipparchus.ode.sampling.ODEStepHandler) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Example 5 with AuxiliaryElements

use of org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements in project Orekit by CS-SI.

the class DSSTPropagator method computeMeanOrbit.

/**
 * Compute mean state from osculating state.
 * <p>
 * Compute in a DSST sense the mean state corresponding to the input osculating state.
 * </p><p>
 * The computing is done through a fixed-point iteration process.
 * </p>
 * @param osculating initial osculating state
 * @param attitudeProvider attitude provider (may be null if there are no Gaussian force models
 * like atmospheric drag, radiation pressure or specific user-defined models)
 * @param forceModels force models
 * @return mean state
 * @throws OrekitException if the underlying computation of short periodic variation fails
 */
private static Orbit computeMeanOrbit(final SpacecraftState osculating, final AttitudeProvider attitudeProvider, final Collection<DSSTForceModel> forceModels) throws OrekitException {
    // rough initialization of the mean parameters
    EquinoctialOrbit meanOrbit = (EquinoctialOrbit) OrbitType.EQUINOCTIAL.convertType(osculating.getOrbit());
    // threshold for each parameter
    final double epsilon = 1.0e-13;
    final double thresholdA = epsilon * (1 + FastMath.abs(meanOrbit.getA()));
    final double thresholdE = epsilon * (1 + meanOrbit.getE());
    final double thresholdI = epsilon * (1 + meanOrbit.getI());
    final double thresholdL = epsilon * FastMath.PI;
    // ensure all Gaussian force models can rely on attitude
    for (final DSSTForceModel force : forceModels) {
        force.registerAttitudeProvider(attitudeProvider);
    }
    int i = 0;
    while (i++ < 200) {
        final SpacecraftState meanState = new SpacecraftState(meanOrbit, osculating.getAttitude(), osculating.getMass());
        // Create the auxiliary object
        final AuxiliaryElements aux = new AuxiliaryElements(meanOrbit, I);
        // Set the force models
        final List<ShortPeriodTerms> shortPeriodTerms = new ArrayList<ShortPeriodTerms>();
        for (final DSSTForceModel force : forceModels) {
            shortPeriodTerms.addAll(force.initialize(aux, false));
            force.updateShortPeriodTerms(meanState);
        }
        // recompute the osculating parameters from the current mean parameters
        final EquinoctialOrbit rebuilt = computeOsculatingOrbit(meanState, shortPeriodTerms);
        // adapted parameters residuals
        final double deltaA = osculating.getA() - rebuilt.getA();
        final double deltaEx = osculating.getEquinoctialEx() - rebuilt.getEquinoctialEx();
        final double deltaEy = osculating.getEquinoctialEy() - rebuilt.getEquinoctialEy();
        final double deltaHx = osculating.getHx() - rebuilt.getHx();
        final double deltaHy = osculating.getHy() - rebuilt.getHy();
        final double deltaLv = MathUtils.normalizeAngle(osculating.getLv() - rebuilt.getLv(), 0.0);
        // check convergence
        if (FastMath.abs(deltaA) < thresholdA && FastMath.abs(deltaEx) < thresholdE && FastMath.abs(deltaEy) < thresholdE && FastMath.abs(deltaHx) < thresholdI && FastMath.abs(deltaHy) < thresholdI && FastMath.abs(deltaLv) < thresholdL) {
            return meanOrbit;
        }
        // update mean parameters
        meanOrbit = new EquinoctialOrbit(meanOrbit.getA() + deltaA, meanOrbit.getEquinoctialEx() + deltaEx, meanOrbit.getEquinoctialEy() + deltaEy, meanOrbit.getHx() + deltaHx, meanOrbit.getHy() + deltaHy, meanOrbit.getLv() + deltaLv, PositionAngle.TRUE, meanOrbit.getFrame(), meanOrbit.getDate(), meanOrbit.getMu());
    }
    throw new OrekitException(OrekitMessages.UNABLE_TO_COMPUTE_DSST_MEAN_PARAMETERS, i);
}
Also used : SpacecraftState(org.orekit.propagation.SpacecraftState) ShortPeriodTerms(org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms) EquinoctialOrbit(org.orekit.orbits.EquinoctialOrbit) ArrayList(java.util.ArrayList) OrekitException(org.orekit.errors.OrekitException) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Aggregations

AuxiliaryElements (org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)7 SpacecraftState (org.orekit.propagation.SpacecraftState)6 ArrayList (java.util.ArrayList)4 DSSTForceModel (org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel)3 ShortPeriodTerms (org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms)3 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 ODEIntegrator (org.hipparchus.ode.ODEIntegrator)1 ODEStepHandler (org.hipparchus.ode.sampling.ODEStepHandler)1 OrekitException (org.orekit.errors.OrekitException)1 TimeSpanMap (org.orekit.utils.TimeSpanMap)1