AbstractAnalyticalPropagatorBuilder.java

  1. /* Copyright 2022-2025 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.propagation.analytical.AbstractAnalyticalPropagator;
  27. import org.orekit.utils.ParameterDriversList;

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

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

  38.     /** Impulse maneuvers. */
  39.     private final List<ImpulseManeuver> impulseManeuvers;

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

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

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

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

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

  101. }