AttitudeStateHistoryMetadata.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.RotationOrder;
  19. import org.orekit.errors.OrekitException;
  20. import org.orekit.errors.OrekitMessages;
  21. import org.orekit.files.ccsds.ndm.adm.AttitudeEndpoints;
  22. import org.orekit.files.ccsds.section.CommentsContainer;

  23. /** Metadata for attitude state history.
  24.  * @author Luc Maisonobe
  25.  * @since 12.0
  26.  */
  27. public class AttitudeStateHistoryMetadata extends CommentsContainer {

  28.     /** Endpoints (i.e. frames A, B and their relationship). */
  29.     private final AttitudeEndpoints endpoints;

  30.     /** Attitude identification number. */
  31.     private String attID;

  32.     /** Identification number of previous attitude. */
  33.     private String attPrevID;

  34.     /** Basis of this attitude state time history data. */
  35.     private String attBasis;

  36.     /** Identification number of the attitude determination or simulation upon which this attitude is based. */
  37.     private String attBasisID;

  38.     /** Rotation order for Euler angles. */
  39.     private RotationOrder eulerRotSeq;

  40.     /** Number of data states included (attitude components plus rates components). */
  41.     private int nbStates;

  42.     /** Attitude element set type. */
  43.     private AttitudeElementsType attitudeType;

  44.     /** Attitude rate element set type. */
  45.     private RateElementsType rateType;

  46.     /** Simple constructor.
  47.      */
  48.     public AttitudeStateHistoryMetadata() {
  49.         endpoints = new AttitudeEndpoints();
  50.     }

  51.     /** {@inheritDoc} */
  52.     @Override
  53.     public void validate(final double version) {
  54.         super.validate(version);
  55.         endpoints.checkExternalFrame(AttitudeStateHistoryMetadataKey.REF_FRAME_A,
  56.                                      AttitudeStateHistoryMetadataKey.REF_FRAME_B);
  57.         checkNotNull(attitudeType, AttitudeStateHistoryMetadataKey.ATT_TYPE.name());
  58.         final int rateSize = rateType == null ? 0 : rateType.getUnits().size();
  59.         if (nbStates != attitudeType.getUnits().size() + rateSize) {
  60.             throw new OrekitException(OrekitMessages.CCSDS_INCONSISTENT_NUMBER_OF_ATTITUDE_STATES,
  61.                                       attitudeType.toString(), rateType.toString(),
  62.                                       attitudeType.getUnits().size() + rateSize, nbStates);
  63.         }
  64.         if (attitudeType == AttitudeElementsType.EULER_ANGLES) {
  65.             checkNotNull(eulerRotSeq, AttitudeStateHistoryMetadataKey.EULER_ROT_SEQ.name());
  66.         }
  67.     }

  68.     /** Get the endpoints (i.e. frames A, B and their relationship).
  69.      * @return endpoints
  70.      */
  71.     public AttitudeEndpoints getEndpoints() {
  72.         return endpoints;
  73.     }

  74.     /** Get attitude identification number.
  75.      * @return attitude identification number
  76.      */
  77.     public String getAttID() {
  78.         return attID;
  79.     }

  80.     /** Set attitude identification number.
  81.      * @param attID attitude identification number
  82.      */
  83.     public void setAttID(final String attID) {
  84.         refuseFurtherComments();
  85.         this.attID = attID;
  86.     }

  87.     /** Get identification number of previous attitude.
  88.      * @return identification number of previous attitude
  89.      */
  90.     public String getAttPrevID() {
  91.         return attPrevID;
  92.     }

  93.     /** Set identification number of previous attitude.
  94.      * @param attPrevID identification number of previous attitude
  95.      */
  96.     public void setAttPrevID(final String attPrevID) {
  97.         refuseFurtherComments();
  98.         this.attPrevID = attPrevID;
  99.     }

  100.     /** Get basis of this attitude state time history data.
  101.      * @return basis of this attitude state time history data
  102.      */
  103.     public String getAttBasis() {
  104.         return attBasis;
  105.     }

  106.     /** Set basis of this attitude state time history data.
  107.      * @param attBasis basis of this attitude state time history data
  108.      */
  109.     public void setAttBasis(final String attBasis) {
  110.         refuseFurtherComments();
  111.         this.attBasis = attBasis;
  112.     }

  113.     /** Get identification number of the orbit determination or simulation upon which this attitude is based.
  114.      * @return identification number of the orbit determination or simulation upon which this attitude is based
  115.      */
  116.     public String getAttBasisID() {
  117.         return attBasisID;
  118.     }

  119.     /** Set identification number of the orbit determination or simulation upon which this attitude is based.
  120.      * @param attBasisID identification number of the orbit determination or simulation upon which this attitude is based
  121.      */
  122.     public void setAttBasisID(final String attBasisID) {
  123.         refuseFurtherComments();
  124.         this.attBasisID = attBasisID;
  125.     }

  126.     /** Get the rotation order for Euler angles.
  127.      * @return rotation order for Euler angles
  128.      */
  129.     public RotationOrder getEulerRotSeq() {
  130.         return eulerRotSeq;
  131.     }

  132.     /** Set the rotation order for Euler angles.
  133.      * @param eulerRotSeq rotation order for Euler angles
  134.      */
  135.     public void setEulerRotSeq(final RotationOrder eulerRotSeq) {
  136.         this.eulerRotSeq = eulerRotSeq;
  137.     }

  138.     /** Get the number of data states included (attitude components plus rates components).
  139.      * @return number of data states included (attitude components plus rates components)
  140.      */
  141.     public int getNbStates() {
  142.         return nbStates;
  143.     }

  144.     /** Set the number of data states included (attitude components plus rates components).
  145.      * @param nbStates number of data states included (attitude components plus rates components)
  146.      */
  147.     public void setNbStates(final int nbStates) {
  148.         this.nbStates = nbStates;
  149.     }

  150.     /** Get attitude element set type.
  151.      * @return attitude element set type
  152.      */
  153.     public AttitudeElementsType getAttitudeType() {
  154.         return attitudeType;
  155.     }

  156.     /** Set attitude element set type.
  157.      * @param attitudeType attitude element set type
  158.      */
  159.     public void setAttitudeType(final AttitudeElementsType attitudeType) {
  160.         refuseFurtherComments();
  161.         this.attitudeType = attitudeType;
  162.     }

  163.     /** Get attitude rate element set type.
  164.      * @return attitude rate element set type
  165.      */
  166.     public RateElementsType getRateType() {
  167.         return rateType;
  168.     }

  169.     /** Set attitude rate element set type.
  170.      * @param rateType attitude rate element set type
  171.      */
  172.     public void setRateType(final RateElementsType rateType) {
  173.         refuseFurtherComments();
  174.         this.rateType = rateType;
  175.     }

  176. }