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  
18  package org.orekit.files.ccsds.ndm.odm;
19  
20  import java.util.Optional;
21  
22  import org.orekit.annotation.Nullable;
23  import org.orekit.files.ccsds.section.CommentsContainer;
24  import org.orekit.files.ccsds.section.Data;
25  
26  /** Container for spacecraft parameters.
27   * <p>
28   * Beware that the Orekit getters and setters all rely on SI units. The parsers
29   * and writers take care of converting these SI units into CCSDS mandatory units.
30   * The {@link org.orekit.utils.units.Unit Unit} class provides useful
31   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
32   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
33   * already use CCSDS units instead of the API SI units. The general-purpose
34   * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
35   * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
36   * (with an 's') also provide some predefined units. These predefined units and the
37   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
38   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
39   * what the parsers and writers use for the conversions.
40   * </p>
41   * @author sports
42   * @since 6.1
43   */
44  public class SpacecraftParameters extends CommentsContainer implements Data {
45  
46      /** Spacecraft mass. */
47      private double mass;
48  
49      /** Solar radiation pressure area (m^2). */
50      @Nullable
51      private Double solarRadArea;
52  
53      /** Solar radiation pressure coefficient. */
54      @Nullable
55      private Double solarRadCoeff;
56  
57      /** Drag area (m^2). */
58      @Nullable
59      private Double dragArea;
60  
61      /** Drag coefficient. */
62      @Nullable
63      private Double dragCoeff;
64  
65      /** Create an empty state data set.
66       */
67      public SpacecraftParameters() {
68          mass = Double.NaN;
69      }
70  
71      /** {@inheritDoc} */
72      @Override
73      public void validate(final double version) {
74          checkNotNaN(mass, SpacecraftParametersKey.MASS.name());
75      }
76  
77      /** Get the spacecraft mass.
78       * @return the spacecraft mass
79       */
80      public double getMass() {
81          return mass;
82      }
83  
84      /** Set the spacecraft mass.
85       * @param mass the spacecraft mass to be set
86       */
87      public void setMass(final double mass) {
88          refuseFurtherComments();
89          this.mass = mass;
90      }
91  
92      /** Get the solar radiation pressure area.
93       * @return the solar radiation pressure area
94       */
95      public Optional<Double> getSolarRadArea() {
96          return Optional.ofNullable(solarRadArea);
97      }
98  
99      /** Set the solar radiation pressure area.
100      * @param solarRadArea the area to be set
101      */
102     public void setSolarRadArea(final double solarRadArea) {
103         refuseFurtherComments();
104         this.solarRadArea = solarRadArea;
105     }
106 
107     /** Get the solar radiation pressure coefficient.
108      * @return the solar radiation pressure coefficient
109      */
110     public Optional<Double> getSolarRadCoeff() {
111         return Optional.ofNullable(solarRadCoeff);
112     }
113 
114     /** Set the solar radiation pressure coefficient.
115      * @param solarRadCoeff the coefficient to be set
116      */
117     public void setSolarRadCoeff(final double solarRadCoeff) {
118         refuseFurtherComments();
119         this.solarRadCoeff = solarRadCoeff;
120     }
121 
122     /** Get the drag area.
123      * @return the drag area
124      */
125     public Optional<Double> getDragArea() {
126         return Optional.ofNullable(dragArea);
127     }
128 
129     /** Set the drag area.
130      * @param dragArea the area to be set
131      */
132     public void setDragArea(final double dragArea) {
133         refuseFurtherComments();
134         this.dragArea = dragArea;
135     }
136 
137     /** Get the drag coefficient.
138      * @return the drag coefficient
139      */
140     public Optional<Double> getDragCoeff() {
141         return Optional.ofNullable(dragCoeff);
142     }
143 
144     /** Set the drag coefficient.
145      * @param dragCoeff the coefficient to be set
146      */
147     public void setDragCoeff(final double dragCoeff) {
148         refuseFurtherComments();
149         this.dragCoeff = dragCoeff;
150     }
151 
152 }