AbstractAnalyticalPropagatorBuilder.java

  1. /* Copyright 2022-2024 Romain Serra
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.propagation.conversion;


  18. import org.orekit.attitudes.AttitudeProvider;
  19. import org.orekit.estimation.leastsquares.AbstractBatchLSModel;
  20. import org.orekit.estimation.leastsquares.BatchLSModel;
  21. import org.orekit.estimation.leastsquares.ModelObserver;
  22. import org.orekit.estimation.measurements.ObservedMeasurement;
  23. import org.orekit.forces.maneuvers.ImpulseManeuver;
  24. import org.orekit.orbits.Orbit;
  25. import org.orekit.orbits.PositionAngleType;
  26. import org.orekit.utils.ParameterDriversList;

  27. import java.util.ArrayList;
  28. import java.util.List;

  29. /**
  30.  * Abstract class for propagator builders of analytical models (except for ephemeris i.e. interpolated ones).
  31.  *
  32.  * @author Romain Serra
  33.  * @since 12.2
  34.  */
  35. public abstract class AbstractAnalyticalPropagatorBuilder extends AbstractPropagatorBuilder {

  36.     /** Impulse maneuvers. */
  37.     private final List<ImpulseManeuver> impulseManeuvers;

  38.     /** Build a new instance.
  39.      * <p>
  40.      * The template orbit is used as a model to {@link
  41.      * #createInitialOrbit() create initial orbit}. It defines the
  42.      * inertial frame, the central attraction coefficient, the orbit type, and is also
  43.      * used together with the {@code positionScale} to convert from the {@link
  44.      * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
  45.      * callers of this builder to the real orbital parameters. The default attitude
  46.      * provider is aligned with the orbit's inertial frame.
  47.      * </p>
  48.      * <p>
  49.      * By default, all the {@link #getOrbitalParametersDrivers() orbital parameters drivers}
  50.      * are selected, which means that if the builder is used for orbit determination or
  51.      * propagator conversion, all orbital parameters will be estimated. If only a subset
  52.      * of the orbital parameters must be estimated, caller must retrieve the orbital
  53.      * parameters by calling {@link #getOrbitalParametersDrivers()} and then call
  54.      * {@link org.orekit.utils.ParameterDriver#setSelected(boolean) setSelected(false)}.
  55.      * </p>
  56.      * @param templateOrbit reference orbit from which real orbits will be built
  57.      * @param positionAngleType position angle type to use
  58.      * @param positionScale scaling factor used for orbital parameters normalization
  59.      * (typically set to the expected standard deviation of the position)
  60.      * @param addDriverForCentralAttraction if true, a {@link org.orekit.utils.ParameterDriver} should
  61.      * be set up for central attraction coefficient
  62.      * @param attitudeProvider for the propagator
  63.      * @param initialMass mass
  64.      */
  65.     protected AbstractAnalyticalPropagatorBuilder(final Orbit templateOrbit, final PositionAngleType positionAngleType,
  66.                                                   final double positionScale, final boolean addDriverForCentralAttraction,
  67.                                                   final AttitudeProvider attitudeProvider, final double initialMass) {
  68.         super(templateOrbit, positionAngleType, positionScale, addDriverForCentralAttraction, attitudeProvider, initialMass);
  69.         this.impulseManeuvers = new ArrayList<>();
  70.     }

  71.     /**
  72.      * Protected getter for the impulse maneuvers.
  73.      * @return impulse maneuvers
  74.      */
  75.     protected List<ImpulseManeuver> getImpulseManeuvers() {
  76.         return new ArrayList<>(impulseManeuvers);
  77.     }

  78.     /**
  79.      * Add impulse maneuver.
  80.      * @param impulseManeuver impulse maneuver
  81.      */
  82.     public void addImpulseManeuver(final ImpulseManeuver impulseManeuver) {
  83.         impulseManeuvers.add(impulseManeuver);
  84.     }

  85.     /**
  86.      * Remove all impulse maneuvers.
  87.      */
  88.     public void clearImpulseManeuvers() {
  89.         impulseManeuvers.clear();
  90.     }

  91.     /** {@inheritDoc} */
  92.     @Override
  93.     public AbstractBatchLSModel buildLeastSquaresModel(final PropagatorBuilder[] builders,
  94.                                                        final List<ObservedMeasurement<?>> measurements,
  95.                                                        final ParameterDriversList estimatedMeasurementsParameters,
  96.                                                        final ModelObserver observer) {
  97.         return new BatchLSModel(builders, measurements, estimatedMeasurementsParameters, observer);
  98.     }
  99. }