ConstantThrustManeuver.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;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  20. import org.orekit.attitudes.AttitudeProvider;
  21. import org.orekit.forces.maneuvers.propulsion.AbstractConstantThrustPropulsionModel;
  22. import org.orekit.forces.maneuvers.propulsion.BasicConstantThrustPropulsionModel;
  23. import org.orekit.forces.maneuvers.trigger.DateBasedManeuverTriggers;
  24. import org.orekit.propagation.FieldSpacecraftState;
  25. import org.orekit.propagation.SpacecraftState;
  26. import org.orekit.time.AbsoluteDate;

  27. /** This class implements a simple maneuver with constant thrust.
  28.  * <p>The maneuver is defined by a direction in satellite frame.
  29.  * The current attitude of the spacecraft, defined by the current
  30.  * spacecraft state, will be used to compute the thrust direction in
  31.  * inertial frame. A typical case for tangential maneuvers is to use a
  32.  * {@link org.orekit.attitudes.LofOffset LOF aligned} attitude provider
  33.  * for state propagation and a velocity increment along the +X satellite axis.</p>
  34.  * @author Fabien Maussion
  35.  * @author V&eacute;ronique Pommier-Maurussane
  36.  * @author Luc Maisonobe
  37.  * @author Maxime Journot
  38.  */
  39. public class ConstantThrustManeuver extends Maneuver {

  40.     /** Simple constructor for a constant direction and constant thrust.
  41.      * <p>
  42.      * It uses the propulsion model {@link BasicConstantThrustPropulsionModel} and
  43.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  44.      * </p><p>
  45.      * Calling this constructor is equivalent to call {@link
  46.      * #ConstantThrustManeuver(AbsoluteDate, double, double, double, Vector3D, String)
  47.      * ConstantThrustManeuver(date, duration, thrust, isp, direction, "")},
  48.      * hence not using any prefix for the parameters drivers names.
  49.      * </p>
  50.      * @param date maneuver date
  51.      * @param duration the duration of the thrust (s) (if negative,
  52.      * the date is considered to be the stop date)
  53.      * @param thrust the thrust force (N)
  54.      * @param isp engine specific impulse (s)
  55.      * @param direction the acceleration direction in satellite frame.
  56.      */
  57.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  58.                                   final double thrust, final double isp,
  59.                                   final Vector3D direction) {
  60.         this(date, duration, thrust, isp, direction, "");
  61.     }

  62.     /** Simple constructor for a constant direction and constant thrust.
  63.      * <p>
  64.      * It uses the propulsion model {@link BasicConstantThrustPropulsionModel} and
  65.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  66.      * </p><p>
  67.      * Calling this constructor is equivalent to call {@link
  68.      * #ConstantThrustManeuver(AbsoluteDate, double, double, double, Vector3D, String)
  69.      * ConstantThrustManeuver(date, duration, thrust, isp, direction, "")},
  70.      * hence not using any prefix for the parameters drivers names.
  71.      * </p>
  72.      * @param date maneuver date
  73.      * @param duration the duration of the thrust (s) (if negative,
  74.      * the date is considered to be the stop date)
  75.      * @param thrust the thrust force (N)
  76.      * @param isp engine specific impulse (s)
  77.      * @param attitudeOverride the attitude provider to use for the maneuver, or
  78.      * null if the attitude from the propagator should be used
  79.      * @param direction the acceleration direction in satellite frame.
  80.      * @param name name of the maneuver, used as a prefix for the {@link #getParametersDrivers() parameters drivers}
  81.      * @since 12.0
  82.      */
  83.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  84.                                   final double thrust, final double isp,
  85.                                   final AttitudeProvider attitudeOverride,
  86.                                   final Vector3D direction,
  87.                                   final String name) {
  88.         this(date, duration, thrust, isp, attitudeOverride, direction, Control3DVectorCostType.TWO_NORM, name);
  89.     }

  90.     /** Simple constructor for a constant direction and constant thrust.
  91.      * <p>
  92.      * It uses the propulsion model {@link BasicConstantThrustPropulsionModel} and
  93.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  94.      * </p><p>
  95.      * Calling this constructor is equivalent to call {@link
  96.      * #ConstantThrustManeuver(AbsoluteDate, double, double, double, Vector3D, String)
  97.      * ConstantThrustManeuver(date, duration, thrust, isp, direction, "")},
  98.      * hence not using any prefix for the parameters drivers names.
  99.      * </p>
  100.      * @param date maneuver date
  101.      * @param duration the duration of the thrust (s) (if negative,
  102.      * the date is considered to be the stop date)
  103.      * @param thrust the thrust force (N)
  104.      * @param isp engine specific impulse (s)
  105.      * @param attitudeOverride the attitude provider to use for the maneuver, or
  106.      * null if the attitude from the propagator should be used
  107.      * @param direction the acceleration direction in satellite frame.
  108.      * @since 9.2
  109.      */
  110.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  111.                                   final double thrust, final double isp,
  112.                                   final AttitudeProvider attitudeOverride, final Vector3D direction) {
  113.         this(date, duration, thrust, isp, attitudeOverride, direction, "");
  114.     }

  115.     /** Simple constructor for a constant direction and constant thrust.
  116.      * <p>
  117.      * It uses the propulsion model {@link BasicConstantThrustPropulsionModel} and
  118.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  119.      * </p><p>
  120.      * The name of the maneuver is used to distinguish the parameter drivers.
  121.      * A typical use case is to use something like "1A-" or "2B-" as a prefix corresponding to the
  122.      * name of the thruster to use, so separate parameters can be adjusted
  123.      * for the different thrusters involved during an orbit determination
  124.      * where maneuvers parameters are estimated.
  125.      * </p>
  126.      * @param date maneuver date
  127.      * @param duration the duration of the thrust (s) (if negative,
  128.      * the date is considered to be the stop date)
  129.      * @param thrust the thrust force (N)
  130.      * @param isp engine specific impulse (s)
  131.      * @param direction the acceleration direction in satellite frame
  132.      * @param name name of the maneuver, used as a prefix for the {@link #getParametersDrivers() parameters drivers}
  133.      * @since 9.0
  134.      */
  135.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  136.                                   final double thrust, final double isp,
  137.                                   final Vector3D direction,
  138.                                   final String name) {
  139.         this(date, duration, thrust, isp, null, direction, name);
  140.     }

  141.     /** Simple constructor for a constant direction and constant thrust.
  142.      * <p>
  143.      * It uses the propulsion model {@link BasicConstantThrustPropulsionModel} and
  144.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  145.      * </p><p>
  146.      * The name of the maneuver is used to distinguish the parameter drivers.
  147.      * A typical use case is to use something like "1A-" or "2B-" as a prefix corresponding to the
  148.      * name of the thruster to use, so separate parameters can be adjusted
  149.      * for the different thrusters involved during an orbit determination
  150.      * where maneuvers parameters are estimated.
  151.      * </p>
  152.      * @param date maneuver date
  153.      * @param duration the duration of the thrust (s) (if negative,
  154.      * the date is considered to be the stop date)
  155.      * @param thrust the thrust force (N)
  156.      * @param isp engine specific impulse (s)
  157.      * @param attitudeOverride the attitude provider to use for the maneuver, or
  158.      * null if the attitude from the propagator should be used
  159.      * @param direction the acceleration direction in satellite frame
  160.      * @param control3DVectorCostType control vector's cost type
  161.      * @param name name of the maneuver, used as a prefix for the {@link #getParametersDrivers() parameters drivers}
  162.      * @since 12.0
  163.      */
  164.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  165.                                   final double thrust, final double isp, final AttitudeProvider attitudeOverride,
  166.                                   final Vector3D direction, final Control3DVectorCostType control3DVectorCostType,
  167.                                   final String name) {
  168.         this(date, duration, attitudeOverride,
  169.                 new BasicConstantThrustPropulsionModel(thrust, isp, direction, control3DVectorCostType, name));
  170.     }

  171.     /** Simple constructor for a constant direction and constant thrust.
  172.      * <p>
  173.      * It uses an {@link AbstractConstantThrustPropulsionModel} and
  174.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  175.      * </p><p>
  176.      * The names of the maneuver (and thus its parameter drivers) are extracted
  177.      * from the propulsion model.
  178.      * </p>
  179.      * @param date maneuver date
  180.      * @param duration the duration of the thrust (s) (if negative,
  181.      * the date is considered to be the stop date)
  182.      * @param attitudeOverride the attitude provider to use for the maneuver, or
  183.      * null if the attitude from the propagator should be used
  184.      * @param constantThrustPropulsionModel user-defined constant thrust propulsion model
  185.      */
  186.     public ConstantThrustManeuver(final AbsoluteDate date, final double duration,
  187.                                   final AttitudeProvider attitudeOverride,
  188.                                   final AbstractConstantThrustPropulsionModel constantThrustPropulsionModel) {
  189.         this(attitudeOverride,
  190.              new DateBasedManeuverTriggers(constantThrustPropulsionModel.getName(), date, duration),
  191.              constantThrustPropulsionModel);
  192.     }

  193.     /** Simple constructor for a constant direction and constant thrust.
  194.      * <p>
  195.      * It uses an {@link AbstractConstantThrustPropulsionModel} and
  196.      * the maneuver triggers {@link DateBasedManeuverTriggers}
  197.      * </p><p>
  198.      * The names of the maneuver (and thus its parameter drivers) are extracted
  199.      * from the propulsion model or the maneuver triggers.
  200.      * Propulsion model name is evaluated first, if it isn't empty, it becomes the name of the maneuver.
  201.      * In that case the name in the maneuver triggers should be the same or empty, otherwise this could be
  202.      * misleading when retrieving estimated parameters by their names.
  203.      * </p>
  204.      * @param attitudeOverride the attitude provider to use for the maneuver, or
  205.      * null if the attitude from the propagator should be used
  206.      * @param dateBasedManeuverTriggers user-defined maneuver triggers object based on a start and end date
  207.      * @param constantThrustPropulsionModel user-defined constant thrust propulsion model
  208.      */
  209.     public ConstantThrustManeuver(final AttitudeProvider attitudeOverride,
  210.                                   final DateBasedManeuverTriggers dateBasedManeuverTriggers,
  211.                                   final AbstractConstantThrustPropulsionModel constantThrustPropulsionModel) {
  212.         super(attitudeOverride, dateBasedManeuverTriggers, constantThrustPropulsionModel);
  213.     }

  214.     /** Get the thrust vector (N) in S/C frame.
  215.      * @param date date at which the thrust vector wants to be known,
  216.      * often the date parameter will not be important and can be whatever
  217.      * if the thrust parameter driver as only value estimated over the all
  218.      * orbit determination interval
  219.      * @return thrust vector (N) in S/C frame.
  220.      */
  221.     public Vector3D getThrustVector(final AbsoluteDate date) {
  222.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getThrustVector(date);
  223.     }

  224.     /** Get the thrust vector (N) in S/C frame.
  225.      * @return thrust vector (N) in S/C frame.
  226.      */
  227.     public Vector3D getThrustVector() {
  228.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getThrustVector();
  229.     }

  230.     /** Get the thrust magnitude.
  231.      * @param date date at which the thrust vector wants to be known,
  232.      * often the date parameter will not be important and can be whatever
  233.      * if the thrust parameter driver as only value estimated over the all
  234.      * orbit determination interval
  235.      * @return thrust force (N).
  236.      */
  237.     public double getThrustMagnitude(final AbsoluteDate date) {
  238.         return getThrustVector(date).getNorm();
  239.     }

  240.     /** Get the thrust magnitude.
  241.      * @return thrust force (N).
  242.      */
  243.     public double getThrustMagnitude() {
  244.         return getThrustVector().getNorm();
  245.     }

  246.     /** Get the specific impulse at given date.
  247.      * @param date date at which the thrust vector wants to be known,
  248.      * often the date parameter will not be important and can be whatever
  249.      * if the thrust parameter driver as only value estimated over the all
  250.      * orbit determination interval
  251.      * @return specific impulse (s).
  252.      */
  253.     public double getIsp(final AbsoluteDate date) {
  254.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getIsp(date);
  255.     }

  256.     /** Get the specific impulse.
  257.      * @return specific impulse (s).
  258.      */
  259.     public double getIsp() {
  260.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getIsp();
  261.     }

  262.     /** Get the flow rate at given date.
  263.      * @param date at which the Thrust wants to be known
  264.      * @return flow rate (negative, kg/s).
  265.      */
  266.     public double getFlowRate(final AbsoluteDate date) {
  267.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getFlowRate(date);
  268.     }

  269.     /** Get the flow rate.
  270.      * @return flow rate (negative, kg/s).
  271.      */
  272.     public double getFlowRate() {
  273.         return ((AbstractConstantThrustPropulsionModel) getPropulsionModel()).getFlowRate();
  274.     }

  275.     /** Get the direction.
  276.      * @param date at which the Thrust wants to be known
  277.      * @return the direction
  278.      * @since 9.2
  279.      */
  280.     public Vector3D getDirection(final AbsoluteDate date) {
  281.         return getThrustVector(date).normalize();
  282.     }

  283.     /** Get the direction.
  284.      * @return the direction
  285.      * @since 9.2
  286.      */
  287.     public Vector3D getDirection() {
  288.         return getThrustVector().normalize();
  289.     }

  290.     /** Get the start date.
  291.      * @return the start date
  292.      * @since 9.2
  293.      */
  294.     public AbsoluteDate getStartDate() {
  295.         return ((DateBasedManeuverTriggers) getManeuverTriggers()).getStartDate();
  296.     }

  297.     /** Get the end date.
  298.      * @return the end date
  299.      * @since 9.2
  300.      */
  301.     public AbsoluteDate getEndDate() {
  302.         return ((DateBasedManeuverTriggers) getManeuverTriggers()).getEndDate();
  303.     }

  304.     /** Get the duration of the maneuver (s).
  305.      * duration = endDate - startDate
  306.      * @return the duration of the maneuver (s)
  307.      * @since 9.2
  308.      */
  309.     public double getDuration() {
  310.         return ((DateBasedManeuverTriggers) getManeuverTriggers()).getDuration();
  311.     }

  312.     /** Check if maneuvering is on.
  313.      * @param s current state
  314.      * @return true if maneuver is on at this state
  315.      * @since 10.1
  316.      */
  317.     public boolean isFiring(final SpacecraftState s) {
  318.         return isFiring(s.getDate());
  319.     }

  320.     /** Check if maneuvering is on.
  321.      * @param s current state
  322.      * @param <T> type of the field elements
  323.      * @return true if maneuver is on at this state
  324.      * @since 10.1
  325.      */
  326.     public <T extends CalculusFieldElement<T>> boolean isFiring(final FieldSpacecraftState<T> s) {
  327.         return isFiring(s.getDate().toAbsoluteDate());
  328.     }

  329.     /** Check if maneuvering is on.
  330.      * @param date current date
  331.      * @return true if maneuver is on at this date
  332.      * @since 10.1
  333.      */
  334.     public boolean isFiring(final AbsoluteDate date) {
  335.         return getManeuverTriggers().isFiring(date, new double[] {});
  336.     }
  337. }