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.utils;
18
19 import java.util.List;
20 import java.util.Map;
21
22 import org.orekit.propagation.SpacecraftState;
23 import org.orekit.propagation.integration.AdditionalEquations;
24 import org.orekit.propagation.numerical.EpochDerivativesEquations;
25 import org.orekit.propagation.numerical.NumericalPropagator;
26
27 /**
28 * Multiple shooting method applicable for trajectories, in an ephemeris model.
29 * Not suited for closed orbits.
30 * @see "TRAJECTORY DESIGN AND ORBIT MAINTENANCE STRATEGIES IN MULTI-BODY DYNAMICAL REGIMES by Thomas A. Pavlak, Purdue University"
31 * @author William Desprats
32 * @since 10.2
33 */
34 public class MultipleShooter extends AbstractMultipleShooting {
35
36 /** Simple Constructor.
37 * <p> Standard constructor for multiple shooting which can be used with the CR3BP model.</p>
38 * @param initialGuessList initial patch points to be corrected.
39 * @param propagatorList list of propagators associated to each patch point.
40 * @param additionalEquations list of additional equations linked to propagatorList.
41 * @param arcDuration initial guess of the duration of each arc.
42 * @param tolerance convergence tolerance on the constraint vector
43 */
44 public MultipleShooter(final List<SpacecraftState> initialGuessList, final List<NumericalPropagator> propagatorList,
45 final List<AdditionalEquations> additionalEquations, final double arcDuration, final double tolerance) {
46 super(initialGuessList, propagatorList, additionalEquations, arcDuration, tolerance, "derivatives");
47 }
48
49 /** {@inheritDoc} */
50 protected SpacecraftState getAugmentedInitialState(final SpacecraftState initialState,
51 final AdditionalEquations additionalEquation) {
52 return ((EpochDerivativesEquations) additionalEquation).setInitialJacobians(initialState);
53 }
54
55 /** {@inheritDoc} */
56 protected double[][] computeAdditionalJacobianMatrix(final List<SpacecraftState> propagatedSP) {
57 final Map<Integer, Double> mapConstraints = getConstraintsMap();
58
59 final int n = mapConstraints.size();
60 final int ncolumns = getNumberOfFreeVariables() - 1;
61
62 final double[][] M = new double[n][ncolumns];
63
64 int k = 0;
65 for (int index : mapConstraints.keySet()) {
66 M[k][index] = 1;
67 k++;
68 }
69 return M;
70 }
71
72 /** {@inheritDoc} */
73 protected double[] computeAdditionalConstraints(final List<SpacecraftState> propagatedSP) {
74 // The additional constraint vector has the following form :
75
76 // [ y1i - y1d ]---- other constraints (component of
77 // Fadd(X) = [ ... ] | a patch point eaquals to a
78 // [vz2i - vz2d]---- desired value)
79
80 // Number of additional constraints
81 final int n = getConstraintsMap().size();
82 final double[] fxAdditionnal = new double[n];
83
84 // Update additional constraints
85 updateAdditionalConstraints(0, fxAdditionnal);
86 return fxAdditionnal;
87 }
88
89 }