Maneuver.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.files.ccsds.ndm.odm.opm;

  18. import java.util.Arrays;

  19. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  20. import org.orekit.files.ccsds.definitions.FrameFacade;
  21. import org.orekit.files.ccsds.section.CommentsContainer;
  22. import org.orekit.time.AbsoluteDate;

  23. /** Maneuver in an OPM file.
  24.  * <p>
  25.  * Beware that the Orekit getters and setters all rely on SI units. The parsers
  26.  * and writers take care of converting these SI units into CCSDS mandatory units.
  27.  * The {@link org.orekit.utils.units.Unit Unit} class provides useful
  28.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  29.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
  30.  * already use CCSDS units instead of the API SI units. The general-purpose
  31.  * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
  32.  * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
  33.  * (with an 's') also provide some predefined units. These predefined units and the
  34.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  35.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
  36.  * what the parsers and writers use for the conversions.
  37.  * </p>
  38.  * @author sports
  39.  * @since 6.1
  40.  */
  41. public class Maneuver extends CommentsContainer {

  42.     /** Epoch ignition. */
  43.     private AbsoluteDate epochIgnition;

  44.     /** Coordinate system for velocity increment vector, for absolute frames. */
  45.     private FrameFacade referenceFrame;

  46.     /** Duration (value is 0 for impulsive maneuver). */
  47.     private double duration;

  48.     /** Mass change during maneuver (value is < 0). */
  49.     private double deltaMass;

  50.     /** Velocity increment. */
  51.     private final double[] dV;

  52.     /** Simple constructor.
  53.      */
  54.     public Maneuver() {
  55.         duration  = Double.NaN;
  56.         deltaMass = Double.NaN;
  57.         dV        = new double[3];
  58.         Arrays.fill(dV, Double.NaN);
  59.     }

  60.     /** {@inheritDoc} */
  61.     @Override
  62.     public void validate(final double version) {
  63.         super.validate(version);
  64.         checkNotNull(epochIgnition,  ManeuverKey.MAN_EPOCH_IGNITION.name());
  65.         checkNotNull(referenceFrame, ManeuverKey.MAN_REF_FRAME.name());
  66.         checkNotNaN(duration,        ManeuverKey.MAN_DURATION.name());
  67.         checkNotNaN(deltaMass,       ManeuverKey.MAN_DELTA_MASS.name());
  68.         checkNotNaN(dV[0],           ManeuverKey.MAN_DV_1.name());
  69.         checkNotNaN(dV[1],           ManeuverKey.MAN_DV_2.name());
  70.         checkNotNaN(dV[2],           ManeuverKey.MAN_DV_3.name());
  71.     }

  72.     /** Get epoch ignition.
  73.      * @return epoch ignition
  74.      */
  75.     public AbsoluteDate getEpochIgnition() {
  76.         return epochIgnition;
  77.     }

  78.     /** Set epoch ignition.
  79.      * @param epochIgnition epoch ignition
  80.      */
  81.     public void setEpochIgnition(final AbsoluteDate epochIgnition) {
  82.         this.epochIgnition = epochIgnition;
  83.     }

  84.     /** Get Coordinate system for velocity increment vector.
  85.      * @return coordinate system for velocity increment vector
  86.      */
  87.     public FrameFacade getReferenceFrame() {
  88.         return referenceFrame;
  89.     }

  90.     /** Set Coordinate system for velocity increment vector.
  91.      * @param referenceFrame coordinate system for velocity increment vector
  92.      */
  93.     public void setReferenceFrame(final FrameFacade referenceFrame) {
  94.         this.referenceFrame = referenceFrame;
  95.     }

  96.     /** Get duration (value is 0 for impulsive maneuver).
  97.      * @return duration (value is 0 for impulsive maneuver)
  98.      */
  99.     public double getDuration() {
  100.         return duration;
  101.     }

  102.     /** Set duration (value is 0 for impulsive maneuver).
  103.      * @param duration duration (value is 0 for impulsive maneuver)
  104.      */
  105.     public void setDuration(final double duration) {
  106.         this.duration = duration;
  107.     }

  108.     /** Get mass change during maneuver (value is &lt; 0).
  109.      * @return mass change during maneuver (value is &lt; 0)
  110.      */
  111.     public double getDeltaMass() {
  112.         return deltaMass;
  113.     }

  114.     /** Set mass change during maneuver (value is &lt; 0).
  115.      * @param deltaMass mass change during maneuver (value is &lt; 0)
  116.      */
  117.     public void setDeltaMass(final double deltaMass) {
  118.         this.deltaMass = deltaMass;
  119.     }

  120.     /** Get velocity increment.
  121.      * @return velocity increment
  122.      */
  123.     public Vector3D getDV() {
  124.         return new Vector3D(dV);
  125.     }

  126.     /** Set velocity increment component.
  127.      * @param i component index
  128.      * @param dVi velocity increment component
  129.      */
  130.     public void setDV(final int i, final double dVi) {
  131.         dV[i] = dVi;
  132.     }

  133.     /** Check if maneuver has been completed.
  134.      * @return true if maneuver has been completed
  135.      */
  136.     public boolean completed() {
  137.         return !(epochIgnition == null ||
  138.                  referenceFrame == null ||
  139.                  Double.isNaN(duration + deltaMass + dV[0] + dV[1] + dV[2]));
  140.     }

  141. }