DSSTBatchLSModel.java

  1. /* Copyright 2002-2021 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.PropagationType;
  22. import org.orekit.propagation.Propagator;
  23. import org.orekit.propagation.SpacecraftState;
  24. import org.orekit.propagation.conversion.OrbitDeterminationPropagatorBuilder;
  25. import org.orekit.propagation.integration.AbstractJacobiansMapper;
  26. import org.orekit.propagation.semianalytical.dsst.DSSTJacobiansMapper;
  27. import org.orekit.propagation.semianalytical.dsst.DSSTPartialDerivativesEquations;
  28. import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
  29. import org.orekit.utils.ParameterDriversList;

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

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

  45.     /** Type of the elements used to define the orbital state.*/
  46.     private PropagationType stateType;

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

  67.     /** {@inheritDoc} */
  68.     @Override
  69.     protected DSSTJacobiansMapper configureDerivatives(final Propagator propagator) {

  70.         final String equationName = DSSTBatchLSModel.class.getName() + "-derivatives";

  71.         final DSSTPartialDerivativesEquations partials = new DSSTPartialDerivativesEquations(equationName, (DSSTPropagator) propagator, propagationType);

  72.         // add the derivatives to the initial state
  73.         final SpacecraftState rawState = propagator.getInitialState();
  74.         final SpacecraftState stateWithDerivatives = partials.setInitialJacobians(rawState);
  75.         ((DSSTPropagator) propagator).setInitialState(stateWithDerivatives, stateType);

  76.         return partials.getMapper();

  77.     }

  78.     /** {@inheritDoc} */
  79.     @Override
  80.     protected Orbit configureOrbits(final AbstractJacobiansMapper mapper,
  81.                                     final Propagator propagator) {
  82.         // Cast
  83.         final DSSTPropagator dsstPropagator = (DSSTPropagator) propagator;
  84.         // Mean orbit
  85.         final SpacecraftState initial = dsstPropagator.initialIsOsculating() ?
  86.                        DSSTPropagator.computeMeanState(dsstPropagator.getInitialState(), dsstPropagator.getAttitudeProvider(), dsstPropagator.getAllForceModels()) :
  87.                        dsstPropagator.getInitialState();
  88.         // Compute short period derivatives at the beginning of the iteration
  89.         ((DSSTJacobiansMapper) mapper).setShortPeriodJacobians(initial);
  90.         return initial.getOrbit();
  91.     }

  92. }