ManeuverTriggers.java

  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. package org.orekit.forces.maneuvers.trigger;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;
  20. import org.orekit.forces.maneuvers.Maneuver;
  21. import org.orekit.propagation.FieldSpacecraftState;
  22. import org.orekit.propagation.SpacecraftState;
  23. import org.orekit.propagation.events.EventDetectorsProvider;
  24. import org.orekit.time.AbsoluteDate;
  25. import org.orekit.time.FieldAbsoluteDate;
  26. import org.orekit.utils.ParameterDriversProvider;

  27. /** Generic interface for the maneuver triggers used in a {@link Maneuver}.
  28.  * @author Maxime Journot
  29.  * @since 10.2
  30.  */
  31. public interface ManeuverTriggers extends ParameterDriversProvider, EventDetectorsProvider {

  32.     /** Initialization method called at propagation start.
  33.      * <p>
  34.      * The default implementation does nothing.
  35.      * </p>
  36.      * @param initialState initial spacecraft state (at the start of propagation).
  37.      * @param target date of propagation. Not equal to {@code initialState.getDate()}.
  38.      */
  39.     default void init(SpacecraftState initialState, AbsoluteDate target) {
  40.         // nothing by default
  41.     }

  42.     /** Initialization method called at propagation start.
  43.      * <p>
  44.      * The default implementation does nothing.
  45.      * </p>
  46.      * @param initialState initial spacecraft state (at the start of propagation).
  47.      * @param target date of propagation. Not equal to {@code initialState.getDate()}.
  48.      * @param <T> type of the elements
  49.      * @since 11.1
  50.      */
  51.     default <T extends CalculusFieldElement<T>> void init(FieldSpacecraftState<T> initialState, FieldAbsoluteDate<T> target) {
  52.         init(initialState.toSpacecraftState(), target.toAbsoluteDate());
  53.     }

  54.     /** Find out if the maneuver is firing or not.
  55.      * @param date current date
  56.      * @param parameters maneuver triggers parameters
  57.      * @return true if the maneuver is firing, false otherwise
  58.      */
  59.     boolean isFiring(AbsoluteDate date, double[] parameters);

  60.     /** Find out if the maneuver is firing or not.
  61.      * @param date current date
  62.      * @param parameters maneuver triggers parameters
  63.      * @param <T> type of the field elements
  64.      * @return true if the maneuver is firing, false otherwise
  65.      */
  66.     <T extends CalculusFieldElement<T>> boolean isFiring(FieldAbsoluteDate<T> date, T[] parameters);

  67.     /** Get the maneuver name.
  68.      * @return the maneuver name
  69.      */
  70.     default String getName() {
  71.         return "";
  72.     }

  73.     /** Add a resetter.
  74.      * @param resetter resetter to add
  75.      */
  76.     void addResetter(ManeuverTriggersResetter resetter);

  77.     /** Add a resetter.
  78.      * @param field field to which the state belongs
  79.      * @param resetter resetter to add
  80.      * @param <T> type of the field elements
  81.      */
  82.     <T extends CalculusFieldElement<T>> void addResetter(Field<T> field, FieldManeuverTriggersResetter<T> resetter);
  83. }