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 18 package org.orekit.files.ccsds.ndm.adm.acm; 19 20 import org.orekit.errors.OrekitException; 21 import org.orekit.errors.OrekitMessages; 22 import org.orekit.files.ccsds.section.CommentsContainer; 23 24 /** Attitude determination sensor data. 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 AttitudeDeterminationSensor extends CommentsContainer { 43 44 /** Sensor number. */ 45 private int sensorNumber; 46 47 /** Sensor used. */ 48 private String sensorUsed; 49 50 /** Number of noise elements for sensor. */ 51 private int nbSensorNoiseCovariance; 52 53 /** Standard deviation of sensor noises for sensor. */ 54 private double[] sensorNoiseCovariance; 55 56 /** Frequency of sensor data. */ 57 private double sensorFrequency; 58 59 /** Simple constructor. 60 */ 61 public AttitudeDeterminationSensor() { 62 nbSensorNoiseCovariance = -1; 63 sensorFrequency = Double.NaN; 64 } 65 66 /** {@inheritDoc} */ 67 @Override 68 public void validate(final double version) { 69 super.validate(version); 70 checkNotNegative(sensorNumber, AttitudeDeterminationSensorKey.SENSOR_NUMBER.name()); 71 checkNotNull(sensorUsed, AttitudeDeterminationSensorKey.SENSOR_USED.name()); 72 if (nbSensorNoiseCovariance >= 0) { 73 final int n = sensorNoiseCovariance == null ? 0 : sensorNoiseCovariance.length; 74 if (nbSensorNoiseCovariance != n) { 75 throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS, 76 nbSensorNoiseCovariance, n); 77 } 78 } 79 } 80 81 /** Get number of the sensor. 82 * @return number of the sensor 83 */ 84 public int getSensorNumber() { 85 return sensorNumber; 86 } 87 88 /** Set number of the sensor. 89 * @param sensorNumber number of the sensor 90 */ 91 public void setSensorNumber(final int sensorNumber) { 92 this.sensorNumber = sensorNumber; 93 } 94 95 /** Get sensor used. 96 * @return sensor used 97 */ 98 public String getSensorUsed() { 99 return sensorUsed; 100 } 101 102 /** Set sensor used. 103 * @param sensorUsed sensor used 104 */ 105 public void setSensorUsed(final String sensorUsed) { 106 this.sensorUsed = sensorUsed; 107 } 108 109 /** Get number of noise elements for sensor. 110 * @return number of noise elements for sensor 111 */ 112 public int getNbSensorNoiseCovariance() { 113 return nbSensorNoiseCovariance; 114 } 115 116 /** Set number of noise elements for sensor. 117 * @param n number of noise elements for sensor 118 */ 119 public void setNbSensorNoiseCovariance(final int n) { 120 nbSensorNoiseCovariance = n; 121 } 122 123 /** Get standard deviation of sensor noise for sensor. 124 * @return standard deviation of sensor noise for sensor 125 */ 126 public double[] getSensorNoiseCovariance() { 127 return sensorNoiseCovariance == null ? null : sensorNoiseCovariance.clone(); 128 } 129 130 /** Set standard deviation of sensor noise for sensor. 131 * @param stddev standard deviation of sensor noise 132 */ 133 public void setSensorNoiseCovariance(final double[] stddev) { 134 if (stddev.length != nbSensorNoiseCovariance) { 135 throw new OrekitException(OrekitMessages.INCONSISTENT_NUMBER_OF_ELEMENTS, 136 nbSensorNoiseCovariance, stddev.length); 137 } 138 sensorNoiseCovariance = stddev.clone(); 139 } 140 141 /** Get frequency of sensor data for sensor. 142 * @return frequency of sensor data for sensor 143 */ 144 public double getSensorFrequency() { 145 return sensorFrequency; 146 } 147 148 /** Set frequency of sensor data for sensor. 149 * @param frequency frequency of sensor data for sensor 150 */ 151 public void setSensorFrequency(final double frequency) { 152 sensorFrequency = frequency; 153 } 154 155 }