1   /* Copyright 2002-2026 CS GROUP
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.cdm;
18  
19  import java.util.Optional;
20  
21  import org.orekit.annotation.Nullable;
22  import org.orekit.files.ccsds.section.CommentsContainer;
23  
24  /**
25   * Container for the additional covariance metadata (optional).
26   * <p>
27   * Beware that the Orekit getters and setters all rely on SI units. The parsers
28   * and writers take care of converting these SI units into CCSDS mandatory units.
29   * The {@link org.orekit.utils.units.Unit Unit} class provides useful
30   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
31   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
32   * already use CCSDS units instead of the API SI units. The general-purpose
33   * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
34   * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
35   * (with an 's') also provide some predefined units. These predefined units and the
36   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
37   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
38   * what the parsers and writers use for the conversions.
39   * </p>
40   */
41  public class AdditionalCovarianceMetadata extends CommentsContainer {
42  
43      /** The atmospheric density forecast error. */
44      @Nullable
45      private Double densityForecastUncertainty;
46  
47      /** The minimum suggested covariance scale factor. */
48      @Nullable
49      private Double cScaleFactorMin;
50  
51      /** The (median) suggested covariance scale factor. */
52      @Nullable
53      private Double cScaleFactor;
54  
55      /** The maximum suggested covariance scale factor. */
56      @Nullable
57      private Double cScaleFactorMax;
58  
59      /** The source (or origin) of the specific orbital data for this object. */
60      @Nullable
61      private String screeningDataSource;
62  
63      /** The drag consider parameter (DCP) sensitivity vectors map forward expected error in the drag acceleration to actual
64       * componentized position errors at TCA. */
65      @Nullable
66      private double[] dcpSensitivityVectorPosition;
67  
68      /** The drag consider parameter (DCP) sensitivity vectors map forward expected error in the drag acceleration to actual
69       * componentized velocity errors at TCA. */
70      @Nullable
71      private double[] dcpSensitivityVectorVelocity;
72  
73  
74      /** Simple constructor. */
75      public AdditionalCovarianceMetadata() {
76      }
77  
78      /** {@inheritDoc} */
79      @Override
80      public void validate(final double version) {
81          super.validate(version);
82      }
83  
84  
85      /**
86       * Get the atmospheric density forecast error.
87       * @return densityForecastUncertainty
88       */
89      public Optional<Double> getDensityForecastUncertainty() {
90          return Optional.ofNullable(densityForecastUncertainty);
91      }
92  
93      /**
94       * Set the atmospheric density forecast error.
95       * @param densityForecastUncertainty the cScaleFactorMax to set
96       */
97      public void setDensityForecastUncertainty(final double densityForecastUncertainty) {
98          refuseFurtherComments();
99          this.densityForecastUncertainty = densityForecastUncertainty;
100     }
101 
102     /** Get the minimum suggested covariance scale factor.
103      * @return the cScaleFactorMin
104      */
105     public Optional<Double> getcScaleFactorMin() {
106         return Optional.ofNullable(cScaleFactorMin);
107     }
108 
109     /** Set the minimum suggested covariance scale factor.
110      * @param cScaleFactorMin the cScaleFactorMin to set
111      */
112     public void setcScaleFactorMin(final double cScaleFactorMin) {
113         this.cScaleFactorMin = cScaleFactorMin;
114     }
115 
116     /** Get the (median) suggested covariance scale factor.
117      * @return the cScaleFactor
118      */
119     public Optional<Double> getcScaleFactor() {
120         return Optional.ofNullable(cScaleFactor);
121     }
122 
123     /** Set the (median) suggested covariance scale factor.
124      * @param cScaleFactor the cScaleFactor to set
125      */
126     public void setcScaleFactor(final double cScaleFactor) {
127         this.cScaleFactor = cScaleFactor;
128     }
129 
130     /** Get the maximum suggested covariance scale factor.
131      * @return the cScaleFactorMax
132      */
133     public Optional<Double> getcScaleFactorMax() {
134         return Optional.ofNullable(cScaleFactorMax);
135     }
136 
137     /** set the maximum suggested covariance scale factor.
138      * @param cScaleFactorMax the cScaleFactorMax to set
139      */
140     public void setcScaleFactorMax(final double cScaleFactorMax) {
141         this.cScaleFactorMax = cScaleFactorMax;
142     }
143 
144     /** Get the source (or origin) of the specific orbital data for this object.
145      * @return the screeningDataSource
146      */
147     public Optional<String> getScreeningDataSource() {
148         return Optional.ofNullable(screeningDataSource);
149     }
150 
151     /** Set the source (or origin) of the specific orbital data for this object.
152      * @param screeningDataSource the screeningDataSource to set
153      */
154     public void setScreeningDataSource(final String screeningDataSource) {
155         this.screeningDataSource = screeningDataSource;
156     }
157 
158     /** Get the DCP sensitivity vector (position errors at TCA).
159      * @return the dcpSensitivityVectorPosition
160      */
161     public Optional<double[]> getDcpSensitivityVectorPosition() {
162         if (dcpSensitivityVectorPosition == null) {
163             return Optional.empty();
164         }
165         return Optional.of(dcpSensitivityVectorPosition.clone());
166     }
167 
168     /** Set the DCP sensitivity vector (position errors at TCA).
169      * @param dcpSensitivityVectorPosition the dcpSensitivityVectorPosition to set
170      */
171     public void setDcpSensitivityVectorPosition(final double[] dcpSensitivityVectorPosition) {
172         this.dcpSensitivityVectorPosition = dcpSensitivityVectorPosition == null ? null : dcpSensitivityVectorPosition.clone();
173     }
174 
175     /** Get the DCP sensitivity vector (velocity errors at TCA).
176      * @return the dcpSensitivityVectorVelocity
177      */
178     public Optional<double[]> getDcpSensitivityVectorVelocity() {
179         if (dcpSensitivityVectorVelocity == null) {
180             return Optional.empty();
181         }
182         return Optional.of(dcpSensitivityVectorVelocity.clone());
183     }
184 
185     /** Set the DCP sensitivity vector (velocity errors at TCA).
186      * @param dcpSensitivityVectorVelocity the dcpSensitivityVectorVelocity to set
187      */
188     public void setDcpSensitivityVectorVelocity(final double[] dcpSensitivityVectorVelocity) {
189         this.dcpSensitivityVectorVelocity = dcpSensitivityVectorVelocity == null ? null : dcpSensitivityVectorVelocity.clone();
190     }
191 
192 }