ManeuverTriggers.java

  1. /* Copyright 2002-2025 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.orekit.forces.maneuvers.Maneuver;
  20. import org.orekit.propagation.FieldSpacecraftState;
  21. import org.orekit.propagation.SpacecraftState;
  22. import org.orekit.propagation.events.EventDetectorsProvider;
  23. import org.orekit.time.AbsoluteDate;
  24. import org.orekit.time.FieldAbsoluteDate;
  25. import org.orekit.utils.ParameterDriversProvider;

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

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

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

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

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

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