AttitudeManeuver.java

  1. /* Copyright 2002-2024 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.  * @author Luc Maisonobe
  26.  * @since 12.0
  27.  */
  28. public class AttitudeManeuver extends CommentsContainer {

  29.     /** Maneuver identification number. */
  30.     private String id;

  31.     /** Identification number of previous maneuver. */
  32.     private String prevID;

  33.     /** Purpose of the maneuver. */
  34.     private String manPurpose;

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

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

  39.     /** Duration. */
  40.     private double duration;

  41.     /** Actuator used. */
  42.     private String actuatorUsed;

  43.     /** Target momentum (if purpose is momentum desaturation). */
  44.     private Vector3D targetMomentum;

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

  47.     /** Target attitude (if purpose is attitude adjustment). */
  48.     private Rotation targetAttitude;

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

  51.     /** Build an uninitialized maneuver.
  52.      */
  53.     public AttitudeManeuver() {
  54.         beginTime      = Double.NaN;
  55.         endTime        = Double.NaN;
  56.         duration       = Double.NaN;
  57.         targetSpinRate = Double.NaN;
  58.     }

  59.     /** {@inheritDoc} */
  60.     @Override
  61.     public void validate(final double version) {
  62.         checkNotNull(manPurpose, AttitudeManeuverKey.MAN_PURPOSE.name());
  63.         checkNotNaN(beginTime,   AttitudeManeuverKey.MAN_BEGIN_TIME.name());
  64.         if (!Double.isNaN(endTime + duration)) {
  65.             throw new OrekitException(OrekitMessages.CCSDS_INCOMPATIBLE_KEYS_BOTH_USED,
  66.                                       AttitudeManeuverKey.MAN_END_TIME,
  67.                                       AttitudeManeuverKey.MAN_DURATION);
  68.         }
  69.         if (targetMomFrame != null) {
  70.             checkNotNull(targetMomentum, AttitudeManeuverKey.TARGET_MOMENTUM.name());
  71.         }
  72.     }

  73.     /** Get maneuver identification number.
  74.      * @return maneuver identification number
  75.      */
  76.     public String getID() {
  77.         return id;
  78.     }

  79.     /** Set maneuver identification number.
  80.      * @param manId maneuver identification number
  81.      */
  82.     public void setID(final String manId) {
  83.         refuseFurtherComments();
  84.         this.id = manId;
  85.     }

  86.     /** Get identification number of previous maneuver.
  87.      * @return identification number of previous maneuver
  88.      */
  89.     public String getPrevID() {
  90.         return prevID;
  91.     }

  92.     /** Set identification number of previous maneuver.
  93.      * @param prevID identification number of previous maneuver
  94.      */
  95.     public void setPrevID(final String prevID) {
  96.         refuseFurtherComments();
  97.         this.prevID = prevID;
  98.     }

  99.     /** Get purpose of maneuver.
  100.      * @return purpose of maneuver
  101.      */
  102.     public String getManPurpose() {
  103.         return manPurpose;
  104.     }

  105.     /** Set purpose of maneuver.
  106.      * @param manPurpose purpose of maneuver
  107.      */
  108.     public void setManPurpose(final String manPurpose) {
  109.         refuseFurtherComments();
  110.         this.manPurpose = manPurpose;
  111.     }

  112.     /** Get start time of actual maneuver, relative to t₀.
  113.      * @return start time of actual maneuver, relative to t₀
  114.      */
  115.     public double getBeginTime() {
  116.         return beginTime;
  117.     }

  118.     /** Set start time of actual maneuver, relative to t₀.
  119.      * @param beginTime start time of actual maneuver, relative to t₀
  120.      */
  121.     public void setBeginTime(final double beginTime) {
  122.         this.beginTime = beginTime;
  123.     }

  124.     /** Get end time of actual maneuver, relative to t₀.
  125.      * @return end time of actual maneuver, relative to t₀
  126.      */
  127.     public double getEndTime() {
  128.         return endTime;
  129.     }

  130.     /** Set end time of actual maneuver, relative to t₀.
  131.      * @param endTime end time of actual maneuver, relative to t₀
  132.      */
  133.     public void setEndTime(final double endTime) {
  134.         this.endTime = endTime;
  135.     }

  136.     /** Get duration.
  137.      * @return duration
  138.      */
  139.     public double getDuration() {
  140.         return duration;
  141.     }

  142.     /** Set duration.
  143.      * @param duration duration
  144.      */
  145.     public void setDuration(final double duration) {
  146.         this.duration = duration;
  147.     }

  148.     /** Get the actuator used.
  149.      * @return actuator used
  150.      */
  151.     public String getActuatorUsed() {
  152.         return actuatorUsed;
  153.     }

  154.     /** Set actuator used.
  155.      * @param actuatorUsed actuator used
  156.      */
  157.     public void setActuatorUsed(final String actuatorUsed) {
  158.         this.actuatorUsed = actuatorUsed;
  159.     }

  160.     /** Get target momentum (if purpose is momentum desaturation).
  161.      * @return target momentum
  162.      */
  163.     public Vector3D getTargetMomentum() {
  164.         return targetMomentum;
  165.     }

  166.     /** Set target momentum (if purpose is momentum desaturation).
  167.      * @param targetMomentum target momentum
  168.      */
  169.     public void setTargetMomentum(final Vector3D targetMomentum) {
  170.         this.targetMomentum = targetMomentum;
  171.     }

  172.     /** Get reference frame for {@link #getTargetMomentum()}.
  173.      * @return reference frame for {@link #getTargetMomentum()}
  174.      */
  175.     public FrameFacade getTargetMomFrame() {
  176.         return targetMomFrame;
  177.     }

  178.     /** Set reference frame for {@link #getTargetMomentum()}.
  179.      * @param targetMomFrame reference frame for {@link #getTargetMomentum()}
  180.      */
  181.     public void setTargetMomFrame(final FrameFacade targetMomFrame) {
  182.         this.targetMomFrame = targetMomFrame;
  183.     }

  184.     /** Get target attitude (if purpose is attitude adjustment).
  185.      * @return target attitude
  186.      */
  187.     public Rotation getTargetAttitude() {
  188.         return targetAttitude;
  189.     }

  190.     /** Set target attitude (if purpose is attitude adjustment).
  191.      * @param targetAttitude target attitude
  192.      */
  193.     public void setTargetAttitude(final Rotation targetAttitude) {
  194.         this.targetAttitude = targetAttitude;
  195.     }

  196.     /** Get target spin rate (if purpose is spin rate adjustment).
  197.      * @return target spin rate
  198.      */
  199.     public double getTargetSpinRate() {
  200.         return targetSpinRate;
  201.     }

  202.     /** Set target spin rate (if purpose is spin rate adjustment).
  203.      * @param targetSpinRate target spin rate
  204.      */
  205.     public void setTargetSpinRate(final double targetSpinRate) {
  206.         this.targetSpinRate = targetSpinRate;
  207.     }

  208. }