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  
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.utils.ParameterDriver;
33  
34  /** Generic interface for a propulsion model used in a {@link Maneuver}.
35   * @author Maxime Journot
36   * @since 10.2
37   */
38  public interface PropulsionModel {
39  
40      /** Initialization method.
41       *  Called in when Maneuver.init(...) is called (from ForceModel.init(...))
42       * @param initialState initial spacecraft state (at the start of propagation).
43       * @param target date of propagation. Not equal to {@code initialState.getDate()}.
44       */
45      default void init(SpacecraftState initialState, AbsoluteDate target) {
46      }
47  
48      /** Get the acceleration of the spacecraft during maneuver and in maneuver frame.
49       * @param s current spacecraft state
50       * @param maneuverAttitude current attitude in maneuver
51       * @param parameters propulsion model parameters
52       * @return acceleration
53       */
54      Vector3D getAcceleration(SpacecraftState s, Attitude maneuverAttitude, double[] parameters);
55  
56      /** Get the acceleration of the spacecraft during maneuver and in maneuver frame.
57       * @param s current spacecraft state
58       * @param maneuverAttitude current attitude in maneuver
59       * @param parameters propulsion model parameters
60       * @param <T> extends CalculusFieldElement&lt;T&gt;
61       * @return acceleration
62       */
63      <T extends CalculusFieldElement<T>> FieldVector3D<T> getAcceleration(FieldSpacecraftState<T> s,
64                                                                       FieldAttitude<T> maneuverAttitude,
65                                                                       T[] parameters);
66  
67      /** Get the mass derivative (i.e. flow rate in kg/s) during maneuver.
68       *@param s current spacecraft state
69       * @param parameters propulsion model parameters
70       * @return mass derivative in kg/s
71       */
72      double getMassDerivatives(SpacecraftState s, double[] parameters);
73  
74      /** Get the mass derivative (i.e. flow rate in kg/s) during maneuver.
75       *@param s current spacecraft state
76       * @param parameters propulsion model parameters
77       * @param <T> extends CalculusFieldElement&lt;T&gt;
78       * @return mass derivative in kg/s
79       */
80      <T extends CalculusFieldElement<T>> T getMassDerivatives(FieldSpacecraftState<T> s,
81                                                           T[] parameters);
82  
83      /** Get the propulsion model parameter drivers.
84       * @return propulsion model parameter drivers
85       */
86      default List<ParameterDriver> getParametersDrivers() {
87          return Collections.emptyList();
88      }
89  
90      /** Get the maneuver name.
91       * @return the maneuver name
92       */
93      default String getName() {
94          return "";
95      }
96  
97  }