1   /* Copyright 2002-2025 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 org.orekit.files.ccsds.definitions.Units;
20  import org.orekit.files.ccsds.utils.ContextBinding;
21  import org.orekit.files.ccsds.utils.lexical.ParseToken;
22  import org.orekit.files.ccsds.utils.lexical.TokenType;
23  import org.orekit.utils.units.Unit;
24  
25  /** Keys for {@link AdditionalParameters CDM additional parameters} entries.
26   * @author Melina Vanel
27   * @since 11.2
28   */
29  public enum AdditionalParametersKey {
30  
31      /** Comment entry. */
32      COMMENT((token, context, container) ->
33              token.getType() == TokenType.ENTRY ? container.addComment(token.getContentAsNormalizedString()) : true),
34  
35      /** The actual area of the object. */
36      AREA_PC((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
37                                                                   container::setAreaPC)),
38  
39      /** Minimum area (or cross-section) of the object to be used in the calculation of the probability of collision. */
40      AREA_PC_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
41                                                                   container::setAreaPCMin)),
42  
43      /** Maximum area (or cross-section) of the object to be used in the calculation of the probability of collision. */
44      AREA_PC_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
45                                                                   container::setAreaPCMax)),
46  
47      /** The effective area of the object exposed to atmospheric drag. */
48      AREA_DRG((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
49                                                                   container::setAreaDRG)),
50  
51      /** The effective area of the object exposed to solar radiation pressure. */
52      AREA_SRP((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
53                                                                   container::setAreaSRP)),
54  
55      /** Optimally Enclosing Box parent reference frame. */
56      OEB_PARENT_FRAME((token, context, container) -> token.processAsFrame(container::setOebParentFrame, context, true, true, false)),
57  
58      /** Optimally Enclosing Box parent reference frame epoch. */
59      OEB_PARENT_FRAME_EPOCH((token, context, container) -> token.processAsDate(container::setOebParentFrameEpoch, context)),
60  
61      /** Quaternion defining Optimally Enclosing Box (first vectorial component). */
62      OEB_Q1((token, context, container) -> token.processAsIndexedDouble(1, Unit.ONE, context.getParsedUnitsBehavior(),
63                                                                         container::setOebQ)),
64  
65      /** Quaternion defining Optimally Enclosing Box (second vectorial component). */
66      OEB_Q2((token, context, container) -> token.processAsIndexedDouble(2, Unit.ONE, context.getParsedUnitsBehavior(),
67                                                                         container::setOebQ)),
68  
69      /** Quaternion defining Optimally Enclosing Box (third vectorial component). */
70      OEB_Q3((token, context, container) -> token.processAsIndexedDouble(3, Unit.ONE, context.getParsedUnitsBehavior(),
71                                                                         container::setOebQ)),
72  
73      /** Quaternion defining Optimally Enclosing Box (scalar component). */
74      OEB_QC((token, context, container) -> token.processAsIndexedDouble(0, Unit.ONE, context.getParsedUnitsBehavior(),
75                                                                         container::setOebQ)),
76  
77      /**  Maximum physical dimension of Optimally Enclosing Box. */
78      OEB_MAX((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
79                                                                   container::setOebMax)),
80  
81      /**  Intermediate physical dimension of Optimally Enclosing Box. */
82      OEB_INT((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
83                                                                   container::setOebIntermediate)),
84  
85      /**  Minium physical dimension of Optimally Enclosing Box. */
86      OEB_MIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
87                                                                   container::setOebMin)),
88  
89      /** Cross-sectional area of Optimally Enclosing Box when viewed along the maximum OEB direction. */
90      AREA_ALONG_OEB_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
91                                                                              container::setOebAreaAlongMax)),
92  
93      /** Cross-sectional area of Optimally Enclosing Box when viewed along the intermediate OEB direction. */
94      AREA_ALONG_OEB_INT((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
95                                                                              container::setOebAreaAlongIntermediate)),
96  
97      /** Cross-sectional area of Optimally Enclosing Box when viewed along the minimum OEB direction. */
98      AREA_ALONG_OEB_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
99                                                                              container::setOebAreaAlongMin)),
100     /** Typical (50th percentile) radar cross-section. */
101     RCS((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
102                                                              container::setRcs)),
103 
104     /** Minimum radar cross-section. */
105     RCS_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
106                                                                  container::setMinRcs)),
107 
108     /** Maximum radar cross-section. */
109     RCS_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
110                                                                  container::setMaxRcs)),
111 
112     /** Typical (50th percentile) absolute visual magnitude. */
113     VM_ABSOLUTE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
114                                                                      container::setVmAbsolute)),
115 
116     /** Minimum apparent visual magnitude. */
117     VM_APPARENT_MIN((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
118                                                                          container::setVmApparentMin)),
119 
120     /** Typical (50th percentile) apparent visual magnitude. */
121     VM_APPARENT((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
122                                                                      container::setVmApparent)),
123 
124     /** Maximum apparent visual magnitude. */
125     VM_APPARENT_MAX((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
126                                                                          container::setVmApparentMax)),
127 
128     /** Typical (50th percentile) coefficient of reflectance. */
129     REFLECTANCE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
130                                                                      container::setReflectance)),
131 
132     /** The mass of the object. */
133     MASS((token, context, container) -> token.processAsDouble(Unit.KILOGRAM, context.getParsedUnitsBehavior(),
134                                                                  container::setMass)),
135 
136     /** Object hard body radius. */
137     HBR((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
138                                                                      container::setHbr)),
139 
140     /** The object’s Cd x A/m used to propagate the state vector and covariance to TCA. */
141     CD_AREA_OVER_MASS((token, context, container) -> token.processAsDouble(Units.M2_PER_KG, context.getParsedUnitsBehavior(),
142                                                                  container::setCDAreaOverMass)),
143 
144     /** The object’s Cr x A/m used to propagate the state vector and covariance to TCA. */
145     CR_AREA_OVER_MASS((token, context, container) -> token.processAsDouble(Units.M2_PER_KG, context.getParsedUnitsBehavior(),
146                                                                  container::setCRAreaOverMass)),
147 
148     /** The object’s acceleration due to in-track thrust used to propagate the state vector and covariance to TCA. */
149     THRUST_ACCELERATION((token, context, container) -> token.processAsDouble(Units.M_PER_S2, context.getParsedUnitsBehavior(),
150                                                                  container::setThrustAcceleration)),
151 
152     /** The amount of energy being removed from the object’s orbit by atmospheric drag. This value is an average calculated during the OD. */
153     SEDR((token, context, container) -> token.processAsDouble(Units.W_PER_KG, context.getParsedUnitsBehavior(),
154                                                                  container::setSedr)),
155 
156     /** The distance of the furthest point in the objects orbit above the equatorial radius of the central body. */
157     APOAPSIS_ALTITUDE((token, context, container) -> token.processAsDouble(Unit.KILOMETRE, context.getParsedUnitsBehavior(),
158                                                                      container::setApoapsisAltitude)),
159 
160     /** The distance of the closest point in the objects orbit above the equatorial radius of the central body. */
161     PERIAPSIS_ALTITUDE((token, context, container) -> token.processAsDouble(Unit.KILOMETRE, context.getParsedUnitsBehavior(),
162                                                                      container::setPeriapsisAltitude)),
163 
164     /** The angle between the objects orbit plane and the orbit centers equatorial plane. */
165     INCLINATION((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
166                                                                      container::setInclination)),
167 
168     /** A measure of the confidence in the covariance errors matching reality. */
169     COV_CONFIDENCE((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
170                                                                      container::setCovConfidence)),
171 
172     /** The method used for the calculation of COV_CONFIDENCE. */
173     COV_CONFIDENCE_METHOD((token, context, container) -> token.processAsFreeTextString(container::setCovConfidenceMethod));
174 
175     /** Processing method. */
176     private final transient TokenProcessor processor;
177 
178     /** Simple constructor.
179      * @param processor processing method
180      */
181     AdditionalParametersKey(final TokenProcessor processor) {
182         this.processor = processor;
183     }
184 
185     /** Process one token.
186      * @param token token to process
187      * @param context context binding
188      * @param container container to fill
189      * @return true of token was accepted
190      */
191     public boolean process(final ParseToken token, final ContextBinding context, final AdditionalParameters container) {
192         return processor.process(token, context, container);
193     }
194 
195     /** Interface for processing one token. */
196     interface TokenProcessor {
197         /** Process one token.
198          * @param token token to process
199          * @param context context binding
200          * @param container container to fill
201          * @return true of token was accepted
202          */
203         boolean process(ParseToken token, ContextBinding context, AdditionalParameters container);
204     }
205 
206 }