AttitudeDeterminationSensor.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.orekit.errors.OrekitException;
  19. import org.orekit.errors.OrekitMessages;
  20. import org.orekit.files.ccsds.section.CommentsContainer;

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

  40.     /** Sensor number. */
  41.     private int sensorNumber;

  42.     /** Sensor used. */
  43.     private String sensorUsed;

  44.     /** Number of noise elements for sensor. */
  45.     private int nbSensorNoiseCovariance;

  46.     /** Standard deviation of sensor noises for sensor. */
  47.     private double[] sensorNoiseCovariance;

  48.     /** Frequency of sensor data. */
  49.     private double sensorFrequency;

  50.     /** Simple constructor.
  51.      */
  52.     public AttitudeDeterminationSensor() {
  53.         nbSensorNoiseCovariance = -1;
  54.         sensorFrequency         = Double.NaN;
  55.     }

  56.     /** {@inheritDoc} */
  57.     @Override
  58.     public void validate(final double version) {
  59.         super.validate(version);
  60.         checkNotNegative(sensorNumber, AttitudeDeterminationSensorKey.SENSOR_NUMBER.name());
  61.         checkNotNull(sensorUsed, AttitudeDeterminationSensorKey.SENSOR_USED.name());
  62.         if (nbSensorNoiseCovariance >= 0) {
  63.             final int n = sensorNoiseCovariance == null ? 0 : sensorNoiseCovariance.length;
  64.             if (nbSensorNoiseCovariance != n) {
  65.                 throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS,
  66.                                           nbSensorNoiseCovariance, n);
  67.             }
  68.         }
  69.     }

  70.     /** Get number of the sensor.
  71.      * @return number of the sensor
  72.      */
  73.     public int getSensorNumber() {
  74.         return sensorNumber;
  75.     }

  76.     /** Set number of the sensor.
  77.      * @param sensorNumber number of the sensor
  78.      */
  79.     public void setSensorNumber(final int sensorNumber) {
  80.         this.sensorNumber = sensorNumber;
  81.     }

  82.     /** Get sensor used.
  83.      * @return sensor used
  84.      */
  85.     public String getSensorUsed() {
  86.         return sensorUsed;
  87.     }

  88.     /** Set sensor used.
  89.      * @param sensorUsed sensor used
  90.      */
  91.     public void setSensorUsed(final String sensorUsed) {
  92.         this.sensorUsed = sensorUsed;
  93.     }

  94.     /** Get number of noise elements for sensor.
  95.      * @return number of noise elements for sensor
  96.      */
  97.     public int getNbSensorNoiseCovariance() {
  98.         return nbSensorNoiseCovariance;
  99.     }

  100.     /** Set number of noise elements for sensor.
  101.      * @param n number of noise elements for sensor
  102.      */
  103.     public void setNbSensorNoiseCovariance(final int n) {
  104.         nbSensorNoiseCovariance = n;
  105.     }

  106.     /** Get standard deviation of sensor noise for sensor.
  107.      * @return standard deviation of sensor noise for sensor
  108.      */
  109.     public double[] getSensorNoiseCovariance() {
  110.         return sensorNoiseCovariance == null ? null : sensorNoiseCovariance.clone();
  111.     }

  112.     /** Set standard deviation of sensor noise for sensor.
  113.      * @param stddev standard deviation of sensor noise
  114.      */
  115.     public void setSensorNoiseCovariance(final double[] stddev) {
  116.         if (stddev.length != nbSensorNoiseCovariance) {
  117.             throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS,
  118.                                       nbSensorNoiseCovariance, stddev.length);
  119.         }
  120.         sensorNoiseCovariance = stddev.clone();
  121.     }

  122.     /** Get frequency of sensor data for sensor.
  123.      * @return frequency of sensor data for sensor
  124.      */
  125.     public double getSensorFrequency() {
  126.         return sensorFrequency;
  127.     }

  128.     /** Set frequency of sensor data for sensor.
  129.      * @param frequency frequency of sensor data for sensor
  130.      */
  131.     public void setSensorFrequency(final double frequency) {
  132.         sensorFrequency = frequency;
  133.     }

  134. }