MultipleShooter.java

  1. /* Copyright 2002-2020 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.utils;

  18. import java.util.List;
  19. import java.util.Map;

  20. import org.orekit.propagation.SpacecraftState;
  21. import org.orekit.propagation.integration.AdditionalEquations;
  22. import org.orekit.propagation.numerical.EpochDerivativesEquations;
  23. import org.orekit.propagation.numerical.NumericalPropagator;

  24. /**
  25.  * Multiple shooting method applicable for trajectories, in an ephemeris model.
  26.  * Not suited for closed orbits.
  27.  * @see "TRAJECTORY DESIGN AND ORBIT MAINTENANCE STRATEGIES IN MULTI-BODY DYNAMICAL REGIMES by Thomas A. Pavlak, Purdue University"
  28.  * @author William Desprats
  29.  * @since 10.2
  30.  */
  31. public class MultipleShooter extends AbstractMultipleShooting {

  32.     /** Simple Constructor.
  33.      * <p> Standard constructor for multiple shooting which can be used with the CR3BP model.</p>
  34.      * @param initialGuessList initial patch points to be corrected.
  35.      * @param propagatorList list of propagators associated to each patch point.
  36.      * @param additionalEquations list of additional equations linked to propagatorList.
  37.      * @param arcDuration initial guess of the duration of each arc.
  38.      * @param tolerance convergence tolerance on the constraint vector
  39.      */
  40.     public MultipleShooter(final List<SpacecraftState> initialGuessList, final List<NumericalPropagator> propagatorList,
  41.                            final List<AdditionalEquations> additionalEquations, final double arcDuration, final double tolerance) {
  42.         super(initialGuessList, propagatorList, additionalEquations, arcDuration, tolerance, "derivatives");
  43.     }

  44.     /** {@inheritDoc} */
  45.     protected SpacecraftState getAugmentedInitialState(final SpacecraftState initialState,
  46.                                                        final AdditionalEquations additionalEquation) {
  47.         return ((EpochDerivativesEquations) additionalEquation).setInitialJacobians(initialState);
  48.     }

  49.     /** {@inheritDoc} */
  50.     protected double[][] computeAdditionalJacobianMatrix(final List<SpacecraftState> propagatedSP) {
  51.         final Map<Integer, Double> mapConstraints = getConstraintsMap();

  52.         final int n = mapConstraints.size();
  53.         final int ncolumns = getNumberOfFreeVariables() - 1;

  54.         final double[][] M = new double[n][ncolumns];

  55.         int k = 0;
  56.         for (int index : mapConstraints.keySet()) {
  57.             M[k][index] = 1;
  58.             k++;
  59.         }
  60.         return M;
  61.     }

  62.     /** {@inheritDoc} */
  63.     protected double[] computeAdditionalConstraints(final List<SpacecraftState> propagatedSP) {
  64.         // The additional constraint vector has the following form :

  65.         //           [ y1i - y1d ]---- other constraints (component of
  66.         // Fadd(X) = [    ...    ]    | a patch point eaquals to a
  67.         //           [vz2i - vz2d]----  desired value)

  68.         // Number of additional constraints
  69.         final int      n             = getConstraintsMap().size();
  70.         final double[] fxAdditionnal = new double[n];

  71.         // Update additional constraints
  72.         updateAdditionalConstraints(0, fxAdditionnal);
  73.         return fxAdditionnal;
  74.     }

  75. }