1 /* Copyright 2002-2026 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.semianalytical.dsst.forces;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.Field;
21 import org.orekit.attitudes.AttitudeProvider;
22 import org.orekit.propagation.FieldSpacecraftState;
23 import org.orekit.propagation.PropagationType;
24 import org.orekit.propagation.SpacecraftState;
25 import org.orekit.propagation.events.EventDetector;
26 import org.orekit.propagation.events.EventDetectorsProvider;
27 import org.orekit.propagation.events.FieldEventDetector;
28 import org.orekit.propagation.AbstractGradientConverter;
29 import org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements;
30 import org.orekit.propagation.semianalytical.dsst.utilities.FieldAuxiliaryElements;
31 import org.orekit.time.AbsoluteDate;
32 import org.orekit.time.FieldAbsoluteDate;
33 import org.orekit.utils.drivers.ParameterDriversProvider;
34
35 import java.util.List;
36 import java.util.stream.Stream;
37
38 /** This interface represents a force modifying spacecraft motion for a {@link
39 * org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSSTPropagator}.
40 * <p>
41 * Objects implementing this interface are intended to be added to a {@link
42 * org.orekit.propagation.semianalytical.dsst.DSSTPropagator DSST propagator}
43 * before the propagation is started.
44 * </p>
45 * <p>
46 * The propagator will call at the very beginning of a propagation the {@link
47 * #initializeShortPeriodTerms(AuxiliaryElements, PropagationType, double[])} method allowing
48 * preliminary computation such as truncation if needed.
49 * </p>
50 * <p>
51 * Then the propagator will call at each step:
52 * <ol>
53 * <li>the {@link #getMeanElementRate(SpacecraftState, AuxiliaryElements, double[])} method.
54 * The force model instance will extract all the state data needed to compute
55 * the mean element rates that contribute to the mean state derivative.</li>
56 * <li>the {@link #updateShortPeriodTerms(double[], SpacecraftState...)} method,
57 * if osculating parameters are desired, on a sample of points within the
58 * last step.</li>
59 * </ol>
60 *
61 * @author Romain Di Constanzo
62 * @author Pascal Parraud
63 */
64 public interface DSSTForceModel extends ParameterDriversProvider, EventDetectorsProvider {
65
66 /**
67 * Initialize the force model at the start of propagation.
68 * <p> The default implementation of this method does nothing.</p>
69 *
70 * @param initialState spacecraft state at the start of propagation.
71 * @param target date of propagation. Not equal to {@code initialState.getDate()}.
72 * @since 11.0
73 */
74 default void init(final SpacecraftState initialState, final AbsoluteDate target) {
75 }
76
77 /**
78 * Initialize the force model at the start of propagation.
79 * <p> The default implementation of this method does nothing.</p>
80 *
81 * @param initialState spacecraft state at the start of propagation.
82 * @param target date of propagation. Not equal to {@code initialState.getDate()}.
83 * @param <T> type of the elements
84 * @since 11.1
85 */
86 default <T extends CalculusFieldElement<T>> void init(final FieldSpacecraftState<T> initialState, final FieldAbsoluteDate<T> target) {
87 init(initialState.toSpacecraftState(), target.toAbsoluteDate());
88 }
89
90 /** {@inheritDoc}.*/
91 @Override
92 default Stream<EventDetector> getEventDetectors() {
93 return getEventDetectors(getParametersDrivers());
94 }
95
96 /** {@inheritDoc}.*/
97 @Override
98 default <T extends CalculusFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventDetectors(final Field<T> field) {
99 return getFieldEventDetectors(field, getParametersDrivers());
100 }
101
102 /** Performs initialization prior to propagation for the current force model.
103 * <p>
104 * This method aims at being called at the very beginning of a propagation.
105 * </p>
106 * @param auxiliaryElements auxiliary elements related to the current orbit
107 * @param type type of the elements used during the propagation
108 * @param parameters values of the force model parameters for specific date
109 * (1 value only per parameter driver) obtained for example by calling
110 * {@link #getParameters()} on force model.
111 * @return a list of objects that will hold short period terms (the objects
112 * are also retained by the force model, which will update them during propagation)
113 */
114 List<ShortPeriodTerms> initializeShortPeriodTerms(AuxiliaryElements auxiliaryElements,
115 PropagationType type, double[] parameters);
116
117 /** Performs initialization prior to propagation for the current force model.
118 * <p>
119 * This method aims at being called at the very beginning of a propagation.
120 * </p>
121 * @param <T> type of the elements
122 * @param auxiliaryElements auxiliary elements related to the current orbit
123 * @param type type of the elements used during the propagation
124 * @param parameters values of the force model parameters for specific date
125 * (1 value only per parameter driver) obtained for example by calling
126 * {@link #getParameters()} on force model or
127 * {@link AbstractGradientConverter#getParametersAtStateDate(FieldSpacecraftState, ParameterDriversProvider)}
128 * on gradient converter.
129 * @return a list of objects that will hold short period terms (the objects
130 * are also retained by the force model, which will update them during propagation)
131 */
132 <T extends CalculusFieldElement<T>> List<FieldShortPeriodTerms<T>> initializeShortPeriodTerms(FieldAuxiliaryElements<T> auxiliaryElements,
133 PropagationType type, T[] parameters);
134
135 /** Computes the mean equinoctial elements rates da<sub>i</sub> / dt.
136 *
137 * @param state current state information: date, kinematics, attitude
138 * @param auxiliaryElements auxiliary elements related to the current orbit
139 * @param parameters values of the force model parameters at state date (only 1 span for
140 * each parameter driver) obtained for example by calling {@link #getParameters()}
141 * on force model.
142 * @return the mean element rates dai/dt
143 */
144 double[] getMeanElementRate(SpacecraftState state,
145 AuxiliaryElements auxiliaryElements, double[] parameters);
146
147 /** Computes the mean equinoctial elements rates da<sub>i</sub> / dt.
148 *
149 * @param <T> type of the elements
150 * @param state current state information: date, kinematics, attitude
151 * @param auxiliaryElements auxiliary elements related to the current orbit
152 * @param parameters values of the force model parameters at state date (only 1 span for
153 * each parameter driver) obtained for example by calling {@link #getParameters(Field)}
154 * on force model or
155 * {@link AbstractGradientConverter#getParametersAtStateDate(FieldSpacecraftState, ParameterDriversProvider)}
156 * on gradient converter.
157 * @return the mean element rates dai/dt
158 */
159 <T extends CalculusFieldElement<T>> T[] getMeanElementRate(FieldSpacecraftState<T> state,
160 FieldAuxiliaryElements<T> auxiliaryElements, T[] parameters);
161
162 /** Register an attitude provider.
163 * <p>
164 * Register an attitude provider that can be used by the force model.
165 * </p>
166 * @param provider the {@link AttitudeProvider}
167 */
168 void registerAttitudeProvider(AttitudeProvider provider);
169
170 /** Update the short period terms.
171 * <p>
172 * The {@link ShortPeriodTerms short period terms} that will be updated
173 * are the ones that were returned during the call to {@link
174 * #initializeShortPeriodTerms(AuxiliaryElements, PropagationType, double[])}.
175 * </p>
176 * @param parameters values of the force model parameters (all span values for each parameters)
177 * obtained for example by calling {@link #getParameters()} on force model.
178 * @param meanStates mean states information: date, kinematics, attitude
179 */
180 void updateShortPeriodTerms(double[] parameters, SpacecraftState... meanStates);
181
182 /** Update the short period terms.
183 * <p>
184 * The {@link ShortPeriodTerms short period terms} that will be updated
185 * are the ones that were returned during the call to {@link
186 * #initializeShortPeriodTerms(AuxiliaryElements, PropagationType, double[])}.
187 * </p>
188 * @param <T> type of the elements
189 * @param parameters values of the force model parameters (all span values for each parameters)
190 * obtained for example by calling {@link #getParameters(Field)} on force model or
191 * {@link AbstractGradientConverter#getParameters(FieldSpacecraftState, ParameterDriversProvider)}
192 * on gradient converter.
193 * @param meanStates mean states information: date, kinematics, attitude
194 */
195 @SuppressWarnings("unchecked")
196 <T extends CalculusFieldElement<T>> void updateShortPeriodTerms(T[] parameters, FieldSpacecraftState<T>... meanStates);
197
198 }