1   /* Copyright 2002-2024 CS GROUP
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  import java.util.List;
20  
21  import org.orekit.attitudes.AttitudeProvider;
22  import org.orekit.attitudes.FrameAlignedProvider;
23  import org.orekit.estimation.leastsquares.AbstractBatchLSModel;
24  import org.orekit.estimation.leastsquares.BatchLSModel;
25  import org.orekit.estimation.leastsquares.ModelObserver;
26  import org.orekit.estimation.measurements.ObservedMeasurement;
27  import org.orekit.orbits.Orbit;
28  import org.orekit.orbits.PositionAngleType;
29  import org.orekit.propagation.Propagator;
30  import org.orekit.propagation.analytical.KeplerianPropagator;
31  import org.orekit.utils.ParameterDriversList;
32  
33  /** Builder for Keplerian propagator.
34   * @author Pascal Parraud
35   * @since 6.0
36   */
37  public class KeplerianPropagatorBuilder extends AbstractPropagatorBuilder {
38  
39      /** Build a new instance.
40       * <p>
41       * The template orbit is used as a model to {@link
42       * #createInitialOrbit() create initial orbit}. It defines the
43       * inertial frame, the central attraction coefficient, the orbit type, and is also
44       * used together with the {@code positionScale} to convert from the {@link
45       * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
46       * callers of this builder to the real orbital parameters.
47       * The default attitude provider is aligned with the orbit's inertial frame.
48       * </p>
49       *
50       * @param templateOrbit reference orbit from which real orbits will be built
51       * @param positionAngleType position angle type to use
52       * @param positionScale scaling factor used for orbital parameters normalization
53       * (typically set to the expected standard deviation of the position)
54       * @since 8.0
55       * @see #KeplerianPropagatorBuilder(Orbit, PositionAngleType, double, AttitudeProvider)
56       */
57      public KeplerianPropagatorBuilder(final Orbit templateOrbit, final PositionAngleType positionAngleType,
58                                        final double positionScale) {
59          this(templateOrbit, positionAngleType, positionScale,
60               FrameAlignedProvider.of(templateOrbit.getFrame()));
61      }
62  
63      /** Build a new instance.
64       * <p>
65       * The template orbit is used as a model to {@link
66       * #createInitialOrbit() create initial orbit}. It defines the
67       * inertial frame, the central attraction coefficient, the orbit type, and is also
68       * used together with the {@code positionScale} to convert from the {@link
69       * org.orekit.utils.ParameterDriver#setNormalizedValue(double) normalized} parameters used by the
70       * callers of this builder to the real orbital parameters.
71       * </p>
72       * @param templateOrbit reference orbit from which real orbits will be built
73       * @param positionAngleType position angle type to use
74       * @param positionScale scaling factor used for orbital parameters normalization
75       * (typically set to the expected standard deviation of the position)
76       * @param attitudeProvider attitude law to use.
77       * @since 10.1
78       */
79      public KeplerianPropagatorBuilder(final Orbit templateOrbit,
80                                        final PositionAngleType positionAngleType,
81                                        final double positionScale,
82                                        final AttitudeProvider attitudeProvider) {
83          super(templateOrbit, positionAngleType, positionScale, true, attitudeProvider);
84      }
85  
86      /** {@inheritDoc} */
87      @Override
88      public KeplerianPropagatorBuilder copy() {
89          return new KeplerianPropagatorBuilder(createInitialOrbit(), getPositionAngleType(),
90                                                getPositionScale(), getAttitudeProvider());
91      }
92  
93      /** {@inheritDoc} */
94      public Propagator buildPropagator(final double[] normalizedParameters) {
95          setParameters(normalizedParameters);
96          return new KeplerianPropagator(createInitialOrbit(), getAttitudeProvider());
97      }
98  
99      /** {@inheritDoc} */
100     @Override
101     public AbstractBatchLSModel buildLeastSquaresModel(final PropagatorBuilder[] builders,
102                                                        final List<ObservedMeasurement<?>> measurements,
103                                                        final ParameterDriversList estimatedMeasurementsParameters,
104                                                        final ModelObserver observer) {
105         return new BatchLSModel(builders, measurements, estimatedMeasurementsParameters, observer);
106     }
107 
108 }