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.propagation.integration; 18 19 import org.orekit.propagation.SpacecraftState; 20 import org.orekit.time.AbsoluteDate; 21 22 /** Provider for additional derivatives. 23 * 24 * <p> 25 * In some cases users may need to integrate some problem-specific equations along with 26 * classical spacecraft equations of motions. One example is optimal control in low 27 * thrust where adjoint parameters linked to the minimized Hamiltonian must be integrated. 28 * Another example is formation flying or rendez-vous which use the Clohessy-Whiltshire 29 * equations for the relative motion. 30 * </p> 31 * <p> 32 * This interface allows users to add such equations to a {@link 33 * org.orekit.propagation.numerical.NumericalPropagator numerical propagator} or a {@link 34 * org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSST propagator}. Users provide the 35 * equations as an implementation of this interface and register it to the propagator thanks to 36 * its {@link AbstractIntegratedPropagator#addAdditionalDerivativesProvider(AdditionalDerivativesProvider)} 37 * method. Several such objects can be registered with each numerical propagator, but it is 38 * recommended to gather in the same object the sets of parameters which equations can interact 39 * on each others states. 40 * </p> 41 * <p> 42 * This interface is the numerical (read not already integrated) counterpart of 43 * the {@link org.orekit.propagation.AdditionalDataProvider} interface. 44 * It allows to append various additional state parameters to any {@link 45 * org.orekit.propagation.numerical.NumericalPropagator numerical propagator} or {@link 46 * org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSST propagator}. 47 * </p> 48 * @see org.orekit.propagation.integration.AbstractIntegratedPropagator 49 * @author Luc Maisonobe 50 * @since 11.1 51 */ 52 public interface AdditionalDerivativesProvider { 53 54 /** Get the name of the additional derivatives (which will become state once integrated). 55 * @return name of the additional state (names containing "orekit" 56 * with any case are reserved for the library internal use) 57 */ 58 String getName(); 59 60 /** Get the dimension of the generated derivative. 61 * @return dimension of the generated 62 */ 63 int getDimension(); 64 65 /** Initialize the generator at the start of propagation. 66 * @param initialState initial state information at the start of propagation 67 * @param target date of propagation 68 */ 69 default void init(final SpacecraftState initialState, final AbsoluteDate target) { 70 // nothing by default 71 } 72 73 /** Check if this provider should yield so another provider has an opportunity to add missing parts. 74 * <p> 75 * Decision to yield is often based on an additional state being {@link SpacecraftState#hasAdditionalData(String) 76 * already available} in the provided {@code state} (but it could theoretically also depend on 77 * an additional state derivative being {@link SpacecraftState#hasAdditionalStateDerivative(String) 78 * already available}, or any other criterion). If for example a provider needs the state transition 79 * matrix, it could implement this method as: 80 * </p> 81 * <pre>{@code 82 * public boolean yields(final SpacecraftState state) { 83 * return !state.getAdditionalStates().containsKey("STM"); 84 * } 85 * }</pre> 86 * <p> 87 * The default implementation returns {@code false}, meaning that derivative data can be 88 * {@link #combinedDerivatives(SpacecraftState) computed} immediately. 89 * </p> 90 * @param state state to handle 91 * @return true if this provider should yield so another provider has an opportunity to add missing parts 92 * as the state is incrementally built up 93 */ 94 default boolean yields(SpacecraftState state) { 95 return false; 96 } 97 98 /** Compute the derivatives related to the additional state (and optionally main state increments). 99 * @param s current state information: date, kinematics, attitude, and 100 * additional states this equations depend on (according to the 101 * {@link #yields(SpacecraftState) yields} method) 102 * @return computed combined derivatives, which may include some incremental 103 * coupling effect to add to main state derivatives 104 * @since 11.2 105 */ 106 CombinedDerivatives combinedDerivatives(SpacecraftState s); 107 108 }