DSSTBatchLSModel.java

  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.estimation.leastsquares;

  18. import java.util.List;

  19. import org.orekit.estimation.measurements.ObservedMeasurement;
  20. import org.orekit.orbits.Orbit;
  21. import org.orekit.propagation.MatricesHarvester;
  22. import org.orekit.propagation.PropagationType;
  23. import org.orekit.propagation.Propagator;
  24. import org.orekit.propagation.SpacecraftState;
  25. import org.orekit.propagation.conversion.PropagatorBuilder;
  26. import org.orekit.propagation.semianalytical.dsst.DSSTHarvester;
  27. import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
  28. import org.orekit.utils.ParameterDriversList;

  29. /** Bridge between {@link ObservedMeasurement measurements} and {@link
  30.  * org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem
  31.  * least squares problems}.
  32.  * <p>
  33.  * This class is an adaption of the {@link BatchLSModel} class
  34.  * for the {@link DSSTPropagator DSST propagator}.
  35.  * </p>
  36.  * @author Luc Maisonobe
  37.  * @author Bryan Cazabonne
  38.  * @since 10.0
  39.  *
  40.  */
  41. public class DSSTBatchLSModel extends AbstractBatchLSModel {

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

  44.     /** Type of the orbit used for the propagation.*/
  45.     private PropagationType propagationType;

  46.     /** Simple constructor.
  47.      * @param propagatorBuilders builders to use for propagation
  48.      * @param measurements measurements
  49.      * @param estimatedMeasurementsParameters estimated measurements parameters
  50.      * @param observer observer to be notified at model calls
  51.      * @param propagationType type of the orbit used for the propagation (mean or osculating)
  52.      */
  53.     public DSSTBatchLSModel(final PropagatorBuilder[] propagatorBuilders,
  54.                             final List<ObservedMeasurement<?>> measurements,
  55.                             final ParameterDriversList estimatedMeasurementsParameters,
  56.                             final ModelObserver observer,
  57.                             final PropagationType propagationType) {
  58.         // call super constructor
  59.         super(propagatorBuilders, measurements, estimatedMeasurementsParameters, observer);
  60.         this.propagationType = propagationType;
  61.     }

  62.     /** {@inheritDoc} */
  63.     @Override
  64.     protected MatricesHarvester configureHarvester(final Propagator propagator) {
  65.         return propagator.setupMatricesComputation(STM_NAME, null, null);
  66.     }

  67.     /** {@inheritDoc} */
  68.     @Override
  69.     protected Orbit configureOrbits(final MatricesHarvester harvester, final Propagator propagator) {
  70.         // Cast
  71.         final DSSTPropagator dsstPropagator = (DSSTPropagator) propagator;
  72.         final DSSTHarvester  dsstHarvester  = (DSSTHarvester) harvester;
  73.         // Mean orbit
  74.         final SpacecraftState initial = dsstPropagator.initialIsOsculating() ?
  75.                        DSSTPropagator.computeMeanState(dsstPropagator.getInitialState(), dsstPropagator.getAttitudeProvider(), dsstPropagator.getAllForceModels()) :
  76.                        dsstPropagator.getInitialState();
  77.         dsstHarvester.initializeFieldShortPeriodTerms(initial);
  78.         // Compute short period derivatives at the beginning of the iteration
  79.         if (propagationType == PropagationType.OSCULATING) {
  80.             dsstHarvester.updateFieldShortPeriodTerms(initial);
  81.             dsstHarvester.setReferenceState(initial);
  82.         }
  83.         // Compute short period derivatives at the beginning of the iteration
  84.         harvester.setReferenceState(initial);
  85.         return initial.getOrbit();
  86.     }

  87. }