1   /* Copyright 2002-2022 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  
18  package org.orekit.forces.maneuvers.propulsion;
19  
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.hipparchus.CalculusFieldElement;
24  import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
25  import org.hipparchus.geometry.euclidean.threed.Vector3D;
26  import org.orekit.attitudes.Attitude;
27  import org.orekit.attitudes.FieldAttitude;
28  import org.orekit.forces.maneuvers.Maneuver;
29  import org.orekit.propagation.FieldSpacecraftState;
30  import org.orekit.propagation.SpacecraftState;
31  import org.orekit.time.AbsoluteDate;
32  import org.orekit.time.FieldAbsoluteDate;
33  import org.orekit.utils.ParameterDriver;
34  
35  /** Generic interface for a propulsion model used in a {@link Maneuver}.
36   * @author Maxime Journot
37   * @since 10.2
38   */
39  public interface PropulsionModel {
40  
41      /** Initialization method.
42       *  Called in when Maneuver.init(...) is called (from ForceModel.init(...))
43       * @param initialState initial spacecraft state (at the start of propagation).
44       * @param target date of propagation. Not equal to {@code initialState.getDate()}.
45       */
46      default void init(SpacecraftState initialState, AbsoluteDate target) {
47      }
48  
49      /** Initialization method.
50       *  Called in when Maneuver.init(...) is called (from ForceModel.init(...))
51       * @param initialState initial spacecraft state (at the start of propagation).
52       * @param target date of propagation. Not equal to {@code initialState.getDate()}.
53       * @param <T> type of the elements
54       * @since 11.1
55       */
56      default <T extends CalculusFieldElement<T>> void init(FieldSpacecraftState<T> initialState, FieldAbsoluteDate<T> target) {
57          init(initialState.toSpacecraftState(), target.toAbsoluteDate());
58      }
59  
60      /** Get the acceleration of the spacecraft during maneuver and in maneuver frame.
61       * @param s current spacecraft state
62       * @param maneuverAttitude current attitude in maneuver
63       * @param parameters propulsion model parameters
64       * @return acceleration
65       */
66      Vector3D getAcceleration(SpacecraftState s, Attitude maneuverAttitude, double[] parameters);
67  
68      /** Get the acceleration of the spacecraft during maneuver and in maneuver frame.
69       * @param s current spacecraft state
70       * @param maneuverAttitude current attitude in maneuver
71       * @param parameters propulsion model parameters
72       * @param <T> extends CalculusFieldElement&lt;T&gt;
73       * @return acceleration
74       */
75      <T extends CalculusFieldElement<T>> FieldVector3D<T> getAcceleration(FieldSpacecraftState<T> s,
76                                                                       FieldAttitude<T> maneuverAttitude,
77                                                                       T[] parameters);
78  
79      /** Get the mass derivative (i.e. flow rate in kg/s) during maneuver.
80       * @param s current spacecraft state
81       * @param parameters propulsion model parameters
82       * @return mass derivative in kg/s
83       */
84      double getMassDerivatives(SpacecraftState s, double[] parameters);
85  
86      /** Get the mass derivative (i.e. flow rate in kg/s) during maneuver.
87       * @param s current spacecraft state
88       * @param parameters propulsion model parameters
89       * @param <T> extends CalculusFieldElement&lt;T&gt;
90       * @return mass derivative in kg/s
91       */
92      <T extends CalculusFieldElement<T>> T getMassDerivatives(FieldSpacecraftState<T> s,
93                                                           T[] parameters);
94  
95      /** Get the propulsion model parameter drivers.
96       * @return propulsion model parameter drivers
97       */
98      default List<ParameterDriver> getParametersDrivers() {
99          return Collections.emptyList();
100     }
101 
102     /** Get the maneuver name.
103      * @return the maneuver name
104      */
105     default String getName() {
106         return "";
107     }
108 
109 }