/** * Replace the deserialized data transfer object with a {@link MeanPlusShortPeriodicMapper}. * * @return replacement {@link MeanPlusShortPeriodicMapper} */ private Object readResolve() { final MeanPlusShortPeriodicMapper mapper = new MeanPlusShortPeriodicMapper(referenceDate, mu, attitudeProvider, frame); for (final DSSTForceModel forceModel : forceModels) { mapper.addForceModel(forceModel); } mapper.setSatelliteRevolution(satelliteRevolution); mapper.setInitialIsOsculating(initialIsOsculating); return mapper; }
/** * Method called just before integration. * * <p>The default implementation does nothing, it may be specialized in subclasses. * * @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 for (final DSSTForceModel force : mapper.getForceModels()) { force.initialize(aux, meanOnly); } // if required, insert the special short periodics step handler if (!meanOnly) { final InterpolationGrid grid = new VariableStepInterpolationGrid(INTERPOLATION_POINTS_PER_STEP); final ShortPeriodicsHandler spHandler = new ShortPeriodicsHandler(grid); final Collection<StepHandler> stepHandlers = new ArrayList<StepHandler>(); stepHandlers.add(spHandler); final AbstractIntegrator integrator = getIntegrator(); final Collection<StepHandler> existing = integrator.getStepHandlers(); stepHandlers.addAll(existing); integrator.clearStepHandlers(); // add back the existing handlers after the short periodics one for (final StepHandler sp : stepHandlers) { integrator.addStepHandler(sp); } } }
/** {@inheritDoc} */ @Override protected StateMapper createMapper( final AbsoluteDate referenceDate, final double mu, final OrbitType orbitType, final PositionAngle positionAngleType, final AttitudeProvider attitudeProvider, final Frame frame) { // create a mapper with the common settings provided as arguments final MeanPlusShortPeriodicMapper newMapper = new MeanPlusShortPeriodicMapper(referenceDate, mu, attitudeProvider, frame); // copy the specific settings from the existing mapper if (mapper != null) { for (final DSSTForceModel forceModel : mapper.getForceModels()) { newMapper.addForceModel(forceModel); } newMapper.setSatelliteRevolution(mapper.getSatelliteRevolution()); newMapper.setInitialIsOsculating(mapper.initialIsOsculating()); } mapper = newMapper; return mapper; }
/** {@inheritDoc} */ @Override public void setAttitudeProvider(final AttitudeProvider attitudeProvider) { super.setAttitudeProvider(attitudeProvider); // Register the attitude provider for each force model for (final DSSTForceModel force : mapper.getForceModels()) { force.registerAttitudeProvider(attitudeProvider); } }
/** * Get the number of satellite revolutions to use for converting osculating to mean elements. * * @return number of satellite revolutions to use for converting osculating to mean elements */ public int getSatelliteRevolution() { return mapper.getSatelliteRevolution(); }
/** * Override the default value of the parameter. * * <p>By default, if the initial orbit is defined as osculating, it will be averaged over 2 * satellite revolutions. This can be changed by using this method. * * @param satelliteRevolution number of satellite revolutions to use for converting osculating to * mean elements */ public void setSatelliteRevolution(final int satelliteRevolution) { mapper.setSatelliteRevolution(satelliteRevolution); }
/** * Remove all perturbing force models from the global perturbation model. * * <p>Once all perturbing forces have been removed (and as long as no new force model is added), * the integrated orbit will follow a keplerian evolution only. * * @see #addForceModel(DSSTForceModel) */ public void removeForceModels() { mapper.removeForceModels(); }
/** * Add a force model to the global perturbation model. * * <p>If this method is not called at all, the integrated orbit will follow a keplerian evolution * only. * * @param force perturbing {@link DSSTForceModel force} to add * @see #removeForceModels() */ public void addForceModel(final DSSTForceModel force) { mapper.addForceModel(force); force.registerAttitudeProvider(getAttitudeProvider()); }
/** * Check if the initial state is provided in osculating elements. * * @return true if initial state is provided in osculating elements */ public boolean initialIsOsculating() { return mapper.initialIsOsculating(); }
/** * Set the initial state. * * @param initialState initial state * @param isOsculating true if the orbital state is defined with osculating elements * @throws PropagationException if the initial state cannot be set */ public void setInitialState(final SpacecraftState initialState, final boolean isOsculating) throws PropagationException { mapper.setInitialIsOsculating(isOsculating); resetInitialState(initialState); }