1 /* Copyright 2002-2024 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.trigger;
19
20 import org.hipparchus.CalculusFieldElement;
21 import org.hipparchus.Field;
22 import org.orekit.forces.maneuvers.Maneuver;
23 import org.orekit.propagation.FieldSpacecraftState;
24 import org.orekit.propagation.SpacecraftState;
25 import org.orekit.propagation.events.EventDetectorsProvider;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.time.FieldAbsoluteDate;
28 import org.orekit.utils.ParameterDriversProvider;
29
30 /** Generic interface for the maneuver triggers used in a {@link Maneuver}.
31 * @author Maxime Journot
32 * @since 10.2
33 */
34 public interface ManeuverTriggers extends ParameterDriversProvider, EventDetectorsProvider {
35
36 /** Initialization method called at propagation start.
37 * <p>
38 * The default implementation does nothing.
39 * </p>
40 * @param initialState initial spacecraft state (at the start of propagation).
41 * @param target date of propagation. Not equal to {@code initialState.getDate()}.
42 */
43 default void init(SpacecraftState initialState, AbsoluteDate target) {
44 // nothing by default
45 }
46
47 /** Initialization method called at propagation start.
48 * <p>
49 * The default implementation does nothing.
50 * </p>
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 /** Find out if the maneuver is firing or not.
61 * @param date current date
62 * @param parameters maneuver triggers parameters
63 * @return true if the maneuver is firing, false otherwise
64 */
65 boolean isFiring(AbsoluteDate date, double[] parameters);
66
67 /** Find out if the maneuver is firing or not.
68 * @param date current date
69 * @param parameters maneuver triggers parameters
70 * @param <T> type of the field elements
71 * @return true if the maneuver is firing, false otherwise
72 */
73 <T extends CalculusFieldElement<T>> boolean isFiring(FieldAbsoluteDate<T> date, T[] parameters);
74
75 /** Get the maneuver name.
76 * @return the maneuver name
77 */
78 default String getName() {
79 return "";
80 }
81
82 /** Add a resetter.
83 * @param resetter resetter to add
84 */
85 void addResetter(ManeuverTriggersResetter resetter);
86
87 /** Add a resetter.
88 * @param field field to which the state belongs
89 * @param resetter resetter to add
90 * @param <T> type of the field elements
91 */
92 <T extends CalculusFieldElement<T>> void addResetter(Field<T> field, FieldManeuverTriggersResetter<T> resetter);
93 }