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