AttitudeManeuver.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.acm;

  18. import org.hipparchus.geometry.euclidean.threed.Rotation;
  19. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;
  22. import org.orekit.files.ccsds.definitions.FrameFacade;
  23. import org.orekit.files.ccsds.section.CommentsContainer;

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

  43.     /** Maneuver identification number. */
  44.     private String id;

  45.     /** Identification number of previous maneuver. */
  46.     private String prevID;

  47.     /** Purpose of the maneuver. */
  48.     private String manPurpose;

  49.     /** Start time of actual maneuver, relative to t₀. */
  50.     private double beginTime;

  51.     /** End time of actual maneuver, relative to t₀. */
  52.     private double endTime;

  53.     /** Duration. */
  54.     private double duration;

  55.     /** Actuator used. */
  56.     private String actuatorUsed;

  57.     /** Target momentum (if purpose is momentum desaturation). */
  58.     private Vector3D targetMomentum;

  59.     /** Reference frame for {@link #targetMomentum}. */
  60.     private FrameFacade targetMomFrame;

  61.     /** Target attitude (if purpose is attitude adjustment). */
  62.     private Rotation targetAttitude;

  63.     /** Target spin rate (if purpose is spin rate adjustment). */
  64.     private double targetSpinRate;

  65.     /** Build an uninitialized maneuver.
  66.      */
  67.     public AttitudeManeuver() {
  68.         beginTime      = Double.NaN;
  69.         endTime        = Double.NaN;
  70.         duration       = Double.NaN;
  71.         targetSpinRate = Double.NaN;
  72.     }

  73.     /** {@inheritDoc} */
  74.     @Override
  75.     public void validate(final double version) {
  76.         checkNotNull(manPurpose, AttitudeManeuverKey.MAN_PURPOSE.name());
  77.         checkNotNaN(beginTime,   AttitudeManeuverKey.MAN_BEGIN_TIME.name());
  78.         if (!Double.isNaN(endTime + duration)) {
  79.             throw new OrekitException(OrekitMessages.CCSDS_INCOMPATIBLE_KEYS_BOTH_USED,
  80.                                       AttitudeManeuverKey.MAN_END_TIME,
  81.                                       AttitudeManeuverKey.MAN_DURATION);
  82.         }
  83.         if (targetMomFrame != null) {
  84.             checkNotNull(targetMomentum, AttitudeManeuverKey.TARGET_MOMENTUM.name());
  85.         }
  86.     }

  87.     /** Get maneuver identification number.
  88.      * @return maneuver identification number
  89.      */
  90.     public String getID() {
  91.         return id;
  92.     }

  93.     /** Set maneuver identification number.
  94.      * @param manId maneuver identification number
  95.      */
  96.     public void setID(final String manId) {
  97.         refuseFurtherComments();
  98.         this.id = manId;
  99.     }

  100.     /** Get identification number of previous maneuver.
  101.      * @return identification number of previous maneuver
  102.      */
  103.     public String getPrevID() {
  104.         return prevID;
  105.     }

  106.     /** Set identification number of previous maneuver.
  107.      * @param prevID identification number of previous maneuver
  108.      */
  109.     public void setPrevID(final String prevID) {
  110.         refuseFurtherComments();
  111.         this.prevID = prevID;
  112.     }

  113.     /** Get purpose of maneuver.
  114.      * @return purpose of maneuver
  115.      */
  116.     public String getManPurpose() {
  117.         return manPurpose;
  118.     }

  119.     /** Set purpose of maneuver.
  120.      * @param manPurpose purpose of maneuver
  121.      */
  122.     public void setManPurpose(final String manPurpose) {
  123.         refuseFurtherComments();
  124.         this.manPurpose = manPurpose;
  125.     }

  126.     /** Get start time of actual maneuver, relative to t₀.
  127.      * @return start time of actual maneuver, relative to t₀
  128.      */
  129.     public double getBeginTime() {
  130.         return beginTime;
  131.     }

  132.     /** Set start time of actual maneuver, relative to t₀.
  133.      * @param beginTime start time of actual maneuver, relative to t₀
  134.      */
  135.     public void setBeginTime(final double beginTime) {
  136.         this.beginTime = beginTime;
  137.     }

  138.     /** Get end time of actual maneuver, relative to t₀.
  139.      * @return end time of actual maneuver, relative to t₀
  140.      */
  141.     public double getEndTime() {
  142.         return endTime;
  143.     }

  144.     /** Set end time of actual maneuver, relative to t₀.
  145.      * @param endTime end time of actual maneuver, relative to t₀
  146.      */
  147.     public void setEndTime(final double endTime) {
  148.         this.endTime = endTime;
  149.     }

  150.     /** Get duration.
  151.      * @return duration
  152.      */
  153.     public double getDuration() {
  154.         return duration;
  155.     }

  156.     /** Set duration.
  157.      * @param duration duration
  158.      */
  159.     public void setDuration(final double duration) {
  160.         this.duration = duration;
  161.     }

  162.     /** Get the actuator used.
  163.      * @return actuator used
  164.      */
  165.     public String getActuatorUsed() {
  166.         return actuatorUsed;
  167.     }

  168.     /** Set actuator used.
  169.      * @param actuatorUsed actuator used
  170.      */
  171.     public void setActuatorUsed(final String actuatorUsed) {
  172.         this.actuatorUsed = actuatorUsed;
  173.     }

  174.     /** Get target momentum (if purpose is momentum desaturation).
  175.      * @return target momentum
  176.      */
  177.     public Vector3D getTargetMomentum() {
  178.         return targetMomentum;
  179.     }

  180.     /** Set target momentum (if purpose is momentum desaturation).
  181.      * @param targetMomentum target momentum
  182.      */
  183.     public void setTargetMomentum(final Vector3D targetMomentum) {
  184.         this.targetMomentum = targetMomentum;
  185.     }

  186.     /** Get reference frame for {@link #getTargetMomentum()}.
  187.      * @return reference frame for {@link #getTargetMomentum()}
  188.      */
  189.     public FrameFacade getTargetMomFrame() {
  190.         return targetMomFrame;
  191.     }

  192.     /** Set reference frame for {@link #getTargetMomentum()}.
  193.      * @param targetMomFrame reference frame for {@link #getTargetMomentum()}
  194.      */
  195.     public void setTargetMomFrame(final FrameFacade targetMomFrame) {
  196.         this.targetMomFrame = targetMomFrame;
  197.     }

  198.     /** Get target attitude (if purpose is attitude adjustment).
  199.      * @return target attitude
  200.      */
  201.     public Rotation getTargetAttitude() {
  202.         return targetAttitude;
  203.     }

  204.     /** Set target attitude (if purpose is attitude adjustment).
  205.      * @param targetAttitude target attitude
  206.      */
  207.     public void setTargetAttitude(final Rotation targetAttitude) {
  208.         this.targetAttitude = targetAttitude;
  209.     }

  210.     /** Get target spin rate (if purpose is spin rate adjustment).
  211.      * @return target spin rate
  212.      */
  213.     public double getTargetSpinRate() {
  214.         return targetSpinRate;
  215.     }

  216.     /** Set target spin rate (if purpose is spin rate adjustment).
  217.      * @param targetSpinRate target spin rate
  218.      */
  219.     public void setTargetSpinRate(final double targetSpinRate) {
  220.         this.targetSpinRate = targetSpinRate;
  221.     }

  222. }