BatchLSModel.java

  1. /* Copyright 2002-2025 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.leastsquares;

  18. import java.util.List;

  19. import org.hipparchus.linear.MatrixUtils;
  20. import org.hipparchus.linear.RealMatrix;
  21. import org.orekit.estimation.measurements.ObservedMeasurement;
  22. import org.orekit.orbits.Orbit;
  23. import org.orekit.propagation.MatricesHarvester;
  24. import org.orekit.propagation.Propagator;
  25. import org.orekit.propagation.conversion.PropagatorBuilder;
  26. import org.orekit.propagation.numerical.NumericalPropagator;
  27. import org.orekit.utils.ParameterDriversList;

  28. /** Bridge between {@link ObservedMeasurement measurements} and {@link
  29.  * org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem
  30.  * least squares problems}.
  31.  * @author Luc Maisonobe
  32.  * @since 8.0
  33.  */
  34. public class BatchLSModel extends AbstractBatchLSModel {

  35.     /** Name of the State Transition Matrix state. */
  36.     private static final String STM_NAME = BatchLSModel.class.getName() + "-derivatives";

  37.     /** Simple constructor.
  38.      * @param propagatorBuilders builders to use for propagation
  39.      * @param measurements measurements
  40.      * @param estimatedMeasurementsParameters estimated measurements parameters
  41.      * @param observer observer to be notified at model calls
  42.      */
  43.     public BatchLSModel(final PropagatorBuilder[] propagatorBuilders,
  44.                         final List<ObservedMeasurement<?>> measurements,
  45.                         final ParameterDriversList estimatedMeasurementsParameters,
  46.                         final ModelObserver observer) {
  47.         // call super constructor
  48.         super(propagatorBuilders, measurements, estimatedMeasurementsParameters, observer);
  49.     }

  50.     /** {@inheritDoc} */
  51.     @Override
  52.     protected MatricesHarvester configureHarvester(final Propagator propagator) {
  53.         final RealMatrix initialStm;
  54.         if (propagator instanceof NumericalPropagator) {
  55.             initialStm = MatrixUtils.createRealIdentityMatrix(7);
  56.         } else {
  57.             initialStm = MatrixUtils.createRealIdentityMatrix(6);
  58.         }
  59.         return propagator.setupMatricesComputation(STM_NAME, initialStm, null);
  60.     }

  61.     /** {@inheritDoc} */
  62.     @Override
  63.     protected Orbit configureOrbits(final MatricesHarvester harvester, final Propagator propagator) {
  64.         // Directly return the propagator's initial state
  65.         return propagator.getInitialState().getOrbit();
  66.     }

  67. }