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.adm.apm;

  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. /**
  24.  * Maneuver in an APM file.
  25.  * @author Bryan Cazabonne
  26.  * @since 10.2
  27.  */
  28. public class Maneuver extends CommentsContainer {

  29.     /** Epoch of start of maneuver . */
  30.     private AbsoluteDate epochStart;

  31.     /** Coordinate system for the torque vector. */
  32.     private FrameFacade frame;

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

  35.     /** Torque vector (N.m). */
  36.     private double[] torque;

  37.     /** Mass change during maneuver (kg).
  38.      * @since 12.0
  39.      */
  40.     private double deltaMass;

  41.     /**
  42.      * Simple constructor.
  43.      */
  44.     public Maneuver() {
  45.         duration  = Double.NaN;
  46.         torque    = new double[3];
  47.         deltaMass = Double.NaN;
  48.         Arrays.fill(torque, Double.NaN);
  49.     }

  50.     /** {@inheritDoc} */
  51.     @Override
  52.     public void validate(final double version) {
  53.         super.validate(version);
  54.         checkNotNull(epochStart, ManeuverKey.MAN_EPOCH_START.name());
  55.         checkNotNaN(duration,    ManeuverKey.MAN_DURATION.name());
  56.         checkNotNull(frame,      ManeuverKey.MAN_REF_FRAME.name());
  57.         checkNotNaN(torque[0],   ManeuverKey.MAN_TOR_1.name());
  58.         checkNotNaN(torque[1],   ManeuverKey.MAN_TOR_2.name());
  59.         checkNotNaN(torque[2],   ManeuverKey.MAN_TOR_3.name());
  60.     }

  61.     /**
  62.      * Get epoch start.
  63.      * @return epoch start
  64.      */
  65.     public AbsoluteDate getEpochStart() {
  66.         return epochStart;
  67.     }

  68.     /**
  69.      * Set epoch start.
  70.      * @param epochStart epoch start
  71.      */
  72.     public void setEpochStart(final AbsoluteDate epochStart) {
  73.         refuseFurtherComments();
  74.         this.epochStart = epochStart;
  75.     }

  76.     /**
  77.      * Get Coordinate system for the torque vector.
  78.      * @return coordinate system for the torque vector
  79.      */
  80.     public FrameFacade getFrame() {
  81.         return frame;
  82.     }

  83.     /**
  84.      * Set Coordinate system for the torque vector.
  85.      * @param frame coordinate system for the torque vector
  86.      */
  87.     public void setFrame(final FrameFacade frame) {
  88.         refuseFurtherComments();
  89.         this.frame = frame;
  90.     }

  91.     /**
  92.      * Get duration (value is 0 for impulsive maneuver).
  93.      * @return duration (value is 0 for impulsive maneuver)
  94.      */
  95.     public double getDuration() {
  96.         return duration;
  97.     }

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

  106.     /**
  107.      * Get the torque vector (N.m).
  108.      * @return torque vector
  109.      */
  110.     public Vector3D getTorque() {
  111.         return new Vector3D(torque);
  112.     }

  113.     /**
  114.      * Set the torque vector (N.m).
  115.      * @param index vector component index (counting from 0)
  116.      * @param value component value
  117.      */
  118.     public void setTorque(final int index, final double value) {
  119.         refuseFurtherComments();
  120.         this.torque[index] = value;
  121.     }

  122.     /**
  123.      * Get mass change during maneuver.
  124.      * @return mass change during maneuver (kg, negative)
  125.      * @since 12.0
  126.      */
  127.     public double getDeltaMass() {
  128.         return deltaMass;
  129.     }

  130.     /**
  131.      * Set mass change during maneuver.
  132.      * @param deltaMass mass change during maneuver (kg)
  133.      * @since 12.0
  134.      */
  135.     public void setDeltaMass(final double deltaMass) {
  136.         refuseFurtherComments();
  137.         this.deltaMass = deltaMass;
  138.     }

  139. }