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

  21. /** Attitude determination sensor data.
  22.  * @author Luc Maisonobe
  23.  * @since 12.0
  24.  */
  25. public class AttitudeDeterminationSensor extends CommentsContainer {

  26.     /** Sensor number. */
  27.     private int sensorNumber;

  28.     /** Sensor used. */
  29.     private String sensorUsed;

  30.     /** Number of noise elements for sensor. */
  31.     private int nbSensorNoiseCovariance;

  32.     /** Standard deviation of sensor noises for sensor. */
  33.     private double[] sensorNoiseCovariance;

  34.     /** Frequency of sensor data. */
  35.     private double sensorFrequency;

  36.     /** Simple constructor.
  37.      */
  38.     public AttitudeDeterminationSensor() {
  39.         nbSensorNoiseCovariance = -1;
  40.         sensorFrequency         = Double.NaN;
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public void validate(final double version) {
  45.         super.validate(version);
  46.         checkNotNegative(sensorNumber, AttitudeDeterminationSensorKey.SENSOR_NUMBER.name());
  47.         checkNotNull(sensorUsed, AttitudeDeterminationSensorKey.SENSOR_USED.name());
  48.         if (nbSensorNoiseCovariance >= 0) {
  49.             final int n = sensorNoiseCovariance == null ? 0 : sensorNoiseCovariance.length;
  50.             if (nbSensorNoiseCovariance != n) {
  51.                 throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS,
  52.                                           nbSensorNoiseCovariance, n);
  53.             }
  54.         }
  55.     }

  56.     /** Get number of the sensor.
  57.      * @return number of the sensor
  58.      */
  59.     public int getSensorNumber() {
  60.         return sensorNumber;
  61.     }

  62.     /** Set number of the sensor.
  63.      * @param sensorNumber number of the sensor
  64.      */
  65.     public void setSensorNumber(final int sensorNumber) {
  66.         this.sensorNumber = sensorNumber;
  67.     }

  68.     /** Get sensor used.
  69.      * @return sensor used
  70.      */
  71.     public String getSensorUsed() {
  72.         return sensorUsed;
  73.     }

  74.     /** Set sensor used.
  75.      * @param sensorUsed sensor used
  76.      */
  77.     public void setSensorUsed(final String sensorUsed) {
  78.         this.sensorUsed = sensorUsed;
  79.     }

  80.     /** Get number of noise elements for sensor.
  81.      * @return number of noise elements for sensor
  82.      */
  83.     public int getNbSensorNoiseCovariance() {
  84.         return nbSensorNoiseCovariance;
  85.     }

  86.     /** Set number of noise elements for sensor.
  87.      * @param n number of noise elements for sensor
  88.      */
  89.     public void setNbSensorNoiseCovariance(final int n) {
  90.         nbSensorNoiseCovariance = n;
  91.     }

  92.     /** Get standard deviation of sensor noise for sensor.
  93.      * @return standard deviation of sensor noise for sensor
  94.      */
  95.     public double[] getSensorNoiseCovariance() {
  96.         return sensorNoiseCovariance == null ? null : sensorNoiseCovariance.clone();
  97.     }

  98.     /** Set standard deviation of sensor noise for sensor.
  99.      * @param stddev standard deviation of sensor noise
  100.      */
  101.     public void setSensorNoiseCovariance(final double[] stddev) {
  102.         if (stddev.length != nbSensorNoiseCovariance) {
  103.             throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS,
  104.                                       nbSensorNoiseCovariance, stddev.length);
  105.         }
  106.         sensorNoiseCovariance = stddev.clone();
  107.     }

  108.     /** Get frequency of sensor data for sensor.
  109.      * @return frequency of sensor data for sensor
  110.      */
  111.     public double getSensorFrequency() {
  112.         return sensorFrequency;
  113.     }

  114.     /** Set frequency of sensor data for sensor.
  115.      * @param frequency frequency of sensor data for sensor
  116.      */
  117.     public void setSensorFrequency(final double frequency) {
  118.         sensorFrequency = frequency;
  119.     }

  120. }