Maneuver.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.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.  * @author sports
  25.  * @since 6.1
  26.  */
  27. public class Maneuver extends CommentsContainer {

  28.     /** Epoch ignition. */
  29.     private AbsoluteDate epochIgnition;

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

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

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

  36.     /** Velocity increment. */
  37.     private double[] dV;

  38.     /** Simple constructor.
  39.      */
  40.     public Maneuver() {
  41.         duration  = Double.NaN;
  42.         deltaMass = Double.NaN;
  43.         dV        = new double[3];
  44.         Arrays.fill(dV, Double.NaN);
  45.     }

  46.     /** {@inheritDoc} */
  47.     @Override
  48.     public void validate(final double version) {
  49.         super.validate(version);
  50.         checkNotNull(epochIgnition,  ManeuverKey.MAN_EPOCH_IGNITION.name());
  51.         checkNotNull(referenceFrame, ManeuverKey.MAN_REF_FRAME.name());
  52.         checkNotNaN(duration,        ManeuverKey.MAN_DURATION.name());
  53.         checkNotNaN(deltaMass,       ManeuverKey.MAN_DELTA_MASS.name());
  54.         checkNotNaN(dV[0],           ManeuverKey.MAN_DV_1.name());
  55.         checkNotNaN(dV[1],           ManeuverKey.MAN_DV_2.name());
  56.         checkNotNaN(dV[2],           ManeuverKey.MAN_DV_3.name());
  57.     }

  58.     /** Get epoch ignition.
  59.      * @return epoch ignition
  60.      */
  61.     public AbsoluteDate getEpochIgnition() {
  62.         return epochIgnition;
  63.     }

  64.     /** Set epoch ignition.
  65.      * @param epochIgnition epoch ignition
  66.      */
  67.     public void setEpochIgnition(final AbsoluteDate epochIgnition) {
  68.         this.epochIgnition = epochIgnition;
  69.     }

  70.     /** Get Coordinate system for velocity increment vector.
  71.      * @return coordinate system for velocity increment vector
  72.      */
  73.     public FrameFacade getReferenceFrame() {
  74.         return referenceFrame;
  75.     }

  76.     /** Set Coordinate system for velocity increment vector.
  77.      * @param referenceFrame coordinate system for velocity increment vector
  78.      */
  79.     public void setReferenceFrame(final FrameFacade referenceFrame) {
  80.         this.referenceFrame = referenceFrame;
  81.     }

  82.     /** Get duration (value is 0 for impulsive maneuver).
  83.      * @return duration (value is 0 for impulsive maneuver)
  84.      */
  85.     public double getDuration() {
  86.         return duration;
  87.     }

  88.     /** Set duration (value is 0 for impulsive maneuver).
  89.      * @param duration duration (value is 0 for impulsive maneuver)
  90.      */
  91.     public void setDuration(final double duration) {
  92.         this.duration = duration;
  93.     }

  94.     /** Get mass change during maneuver (value is &lt; 0).
  95.      * @return mass change during maneuver (value is &lt; 0)
  96.      */
  97.     public double getDeltaMass() {
  98.         return deltaMass;
  99.     }

  100.     /** Set mass change during maneuver (value is &lt; 0).
  101.      * @param deltaMass mass change during maneuver (value is &lt; 0)
  102.      */
  103.     public void setDeltaMass(final double deltaMass) {
  104.         this.deltaMass = deltaMass;
  105.     }

  106.     /** Get velocity increment.
  107.      * @return velocity increment
  108.      */
  109.     public Vector3D getDV() {
  110.         return new Vector3D(dV);
  111.     }

  112.     /** Set velocity increment component.
  113.      * @param i component index
  114.      * @param dVi velocity increment component
  115.      */
  116.     public void setDV(final int i, final double dVi) {
  117.         dV[i] = dVi;
  118.     }

  119.     /** Check if maneuver has been completed.
  120.      * @return true if maneuver has been completed
  121.      */
  122.     public boolean completed() {
  123.         return !(epochIgnition == null ||
  124.                  referenceFrame == null ||
  125.                  Double.isNaN(duration + deltaMass + dV[0] + dV[1] + dV[2]));
  126.     }

  127. }