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());
}
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);
}
}
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);
}
}
}
}
}
}
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);
}
}
}
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);
}
Aggregations