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
19
20 import org.orekit.attitudes.AttitudeProvider;
21 import org.orekit.estimation.leastsquares.AbstractBatchLSModel;
22 import org.orekit.estimation.leastsquares.BatchLSModel;
23 import org.orekit.estimation.leastsquares.ModelObserver;
24 import org.orekit.estimation.measurements.ObservedMeasurement;
25 import org.orekit.forces.maneuvers.ImpulseManeuver;
26 import org.orekit.orbits.Orbit;
27 import org.orekit.orbits.PositionAngleType;
28 import org.orekit.propagation.analytical.AbstractAnalyticalPropagator;
29 import org.orekit.utils.ParameterDriversList;
30
31 import java.util.ArrayList;
32 import java.util.List;
33
34 /**
35 * Abstract class for propagator builders of analytical models (except for ephemeris i.e. interpolated ones).
36 *
37 * @author Romain Serra
38 * @since 12.2
39 */
40 public abstract class AbstractAnalyticalPropagatorBuilder<T extends AbstractAnalyticalPropagator>
41 extends AbstractPropagatorBuilder<T> {
42
43 /** Impulse maneuvers. */
44 private final List<ImpulseManeuver> impulseManeuvers;
45
46 /** Build a new instance.
47 * <p>
48 * The template orbit is used as a model to {@link
49 * #createInitialOrbit() create initial orbit}. It defines the
50 * inertial frame, the central attraction coefficient, the orbit type, and is also
51 * used together with the {@code positionScale} to convert from the {@link
52 * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
53 * callers of this builder to the real orbital parameters. The default attitude
54 * provider is aligned with the orbit's inertial frame.
55 * </p>
56 * <p>
57 * By default, all the {@link #getOrbitalParametersDrivers() orbital parameters drivers}
58 * are selected, which means that if the builder is used for orbit determination or
59 * propagator conversion, all orbital parameters will be estimated. If only a subset
60 * of the orbital parameters must be estimated, caller must retrieve the orbital
61 * parameters by calling {@link #getOrbitalParametersDrivers()} and then call
62 * {@link org.orekit.utils.ParameterDriver#setSelected(boolean) setSelected(false)}.
63 * </p>
64 * @param templateOrbit reference orbit from which real orbits will be built
65 * @param positionAngleType position angle type to use
66 * @param positionScale scaling factor used for orbital parameters normalization
67 * (typically set to the expected standard deviation of the position)
68 * @param addDriverForCentralAttraction if true, a {@link org.orekit.utils.ParameterDriver} should
69 * be set up for central attraction coefficient
70 * @param attitudeProvider for the propagator
71 * @param initialMass mass
72 */
73 protected AbstractAnalyticalPropagatorBuilder(final Orbit templateOrbit, final PositionAngleType positionAngleType,
74 final double positionScale, final boolean addDriverForCentralAttraction,
75 final AttitudeProvider attitudeProvider, final double initialMass) {
76 super(templateOrbit, positionAngleType, positionScale, addDriverForCentralAttraction, attitudeProvider, initialMass);
77 this.impulseManeuvers = new ArrayList<>();
78 }
79
80 /**
81 * Protected getter for the impulse maneuvers.
82 * @return impulse maneuvers
83 */
84 protected List<ImpulseManeuver> getImpulseManeuvers() {
85 return new ArrayList<>(impulseManeuvers);
86 }
87
88 /**
89 * Add impulse maneuver.
90 * @param impulseManeuver impulse maneuver
91 */
92 public void addImpulseManeuver(final ImpulseManeuver impulseManeuver) {
93 impulseManeuvers.add(impulseManeuver);
94 }
95
96 /**
97 * Remove all impulse maneuvers.
98 */
99 public void clearImpulseManeuvers() {
100 impulseManeuvers.clear();
101 }
102
103 /** {@inheritDoc} */
104 @Override
105 public AbstractBatchLSModel buildLeastSquaresModel(final PropagatorBuilder[] builders,
106 final List<ObservedMeasurement<?>> measurements,
107 final ParameterDriversList estimatedMeasurementsParameters,
108 final ModelObserver observer) {
109 return new BatchLSModel(builders, measurements, estimatedMeasurementsParameters, observer);
110 }
111
112 }