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.estimation.sequential;
18  
19  import java.util.List;
20  
21  import org.orekit.propagation.MatricesHarvester;
22  import org.orekit.propagation.PropagationType;
23  import org.orekit.propagation.Propagator;
24  import org.orekit.propagation.conversion.OrbitDeterminationPropagatorBuilder;
25  import org.orekit.propagation.numerical.JacobiansMapper;
26  import org.orekit.utils.ParameterDriversList;
27  
28  /** Class defining the process model dynamics to use with a {@link KalmanEstimator}.
29   * @author Romain Gerbaud
30   * @author Maxime Journot
31   * @since 9.2
32   */
33  public class KalmanModel extends AbstractKalmanModel {
34  
35      /** Kalman process model constructor.
36       * @param propagatorBuilders propagators builders used to evaluate the orbits.
37       * @param covarianceMatricesProviders providers for covariance matrices
38       * @param estimatedMeasurementParameters measurement parameters to estimate
39       * @param measurementProcessNoiseMatrix provider for measurement process noise matrix
40       */
41      public KalmanModel(final List<OrbitDeterminationPropagatorBuilder> propagatorBuilders,
42                         final List<CovarianceMatrixProvider> covarianceMatricesProviders,
43                         final ParameterDriversList estimatedMeasurementParameters,
44                         final CovarianceMatrixProvider measurementProcessNoiseMatrix) {
45          // call super constructor
46          super(propagatorBuilders, covarianceMatricesProviders, estimatedMeasurementParameters,
47                measurementProcessNoiseMatrix, new JacobiansMapper[propagatorBuilders.size()]);
48      }
49  
50      /** {@inheritDoc} */
51      @Override
52      protected void updateReferenceTrajectories(final Propagator[] propagators,
53                                                 final PropagationType pType,
54                                                 final PropagationType sType) {
55  
56          // Update the reference trajectory propagator
57          setReferenceTrajectories(propagators);
58  
59          // Jacobian harvesters
60          final MatricesHarvester[] harvesters = new MatricesHarvester[propagators.length];
61  
62          for (int k = 0; k < propagators.length; ++k) {
63              // Link the partial derivatives to this new propagator
64              final String equationName = KalmanEstimator.class.getName() + "-derivatives-" + k;
65              harvesters[k] = getReferenceTrajectories()[k].setupMatricesComputation(equationName, null, null);
66          }
67  
68          // Update Jacobian harvesters
69          setHarvesters(harvesters);
70  
71      }
72  
73  }