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.utils.ContextBinding;
20 import org.orekit.files.ccsds.utils.lexical.ParseToken;
21 import org.orekit.files.ccsds.utils.lexical.TokenType;
22 import org.orekit.utils.units.Unit;
23 import org.orekit.files.ccsds.definitions.PocMethodFacade;
24 import org.orekit.files.ccsds.definitions.Units;
25
26 /** Keys for {@link CdmRelativeMetadata CDM container} entries.
27 * @author Melina Vanel
28 * @since 11.2
29 */
30 public enum CdmRelativeMetadataKey {
31
32 /** The Originator’s ID that uniquely identifies the conjunction to which the message refers. */
33 CONJUNCTION_ID((token, context, container) -> token.processAsNormalizedString(container::setConjunctionId)),
34
35 /** Date and time in UTC of the closest approach. */
36 TCA((token, context, container) -> token.processAsDate(container::setTca, context)),
37
38 /** Norm of relative position vector at TCA. */
39 MISS_DISTANCE((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
40 container::setMissDistance)),
41 /** The length of the relative position vector, normalized to one-sigma dispersions of the combined error covariance
42 * in the direction of the relative position vector. */
43 MAHALANOBIS_DISTANCE((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
44 container::setMahalanobisDistance)),
45
46 /** Norm of relative velocity vector at TCA. */
47 RELATIVE_SPEED((token, context, container) -> token.processAsDouble(Units.M_PER_S, context.getParsedUnitsBehavior(),
48 container::setRelativeSpeed)),
49
50 /** The R component of Object2’s position relative to Object1’s position in the Radial/Transverse/Normal coordinate frame. */
51 RELATIVE_POSITION_R((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
52 container::setRelativePositionR)),
53
54 /** The T component of Object2’s position relative to Object1’s position in the Radial/Transverse/Normal coordinate frame. */
55 RELATIVE_POSITION_T((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
56 container::setRelativePositionT)),
57
58 /** The N component of Object2’s position relative to Object1’s position in the Radial/Transverse/Normal coordinate frame. */
59 RELATIVE_POSITION_N((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
60 container::setRelativePositionN)),
61
62 /** The R component of Object2’s velocity relative to Object1’s veloity in the Radial/Transverse/Normal coordinate frame. */
63 RELATIVE_VELOCITY_R((token, context, container) -> token.processAsDouble(Units.M_PER_S, context.getParsedUnitsBehavior(),
64 container::setRelativeVelocityR)),
65
66 /** The T component of Object2’s velocity relative to Object1’s veloity in the Radial/Transverse/Normal coordinate frame. */
67 RELATIVE_VELOCITY_T((token, context, container) -> token.processAsDouble(Units.M_PER_S, context.getParsedUnitsBehavior(),
68 container::setRelativeVelocityT)),
69
70 /** The N component of Object2’s velocity relative to Object1’s veloity in the Radial/Transverse/Normal coordinate frame. */
71 RELATIVE_VELOCITY_N((token, context, container) -> token.processAsDouble(Units.M_PER_S, context.getParsedUnitsBehavior(),
72 container::setRelativeVelocityN)),
73
74 /** The approach angle computed between Objects 1 and 2 in the RTN coordinate frame relative to object 1. */
75 APPROACH_ANGLE((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
76 container::setApproachAngle)),
77
78 /** The start time in UTC of the screening period for the conjunction assessment. */
79 START_SCREEN_PERIOD((token, context, container) -> token.processAsDate(container::setStartScreenPeriod, context)),
80
81 /** The stop time in UTC of the screening period for the conjunction assessment. */
82 STOP_SCREEN_PERIOD((token, context, container) -> token.processAsDate(container::setStopScreenPeriod, context)),
83
84 /** Name of the Object1 centered reference frame in which the screening volume data are given. */
85 SCREEN_VOLUME_FRAME((token, context, container) -> token.processAsEnum(ScreenVolumeFrame.class, container::setScreenVolumeFrame)),
86
87 /** The type of screening to be used. */
88 SCREEN_TYPE((token, context, container) -> token.processAsEnum(ScreenType.class, container::setScreenType)),
89
90 /** Shape of the screening volume. */
91 SCREEN_VOLUME_SHAPE((token, context, container) -> token.processAsEnum(ScreenVolumeShape.class, container::setScreenVolumeShape)),
92
93 /** The radius of the screening volume. */
94 SCREEN_VOLUME_RADIUS((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
95 container::setScreenVolumeRadius)),
96
97 /** The R or T (depending on if RTN or TVN is selected) component size of the screening volume in the SCREEN_VOLUME_FRAME. */
98 SCREEN_VOLUME_X((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
99 container::setScreenVolumeX)),
100
101 /** The T or V (depending on if RTN or TVN is selected) component size of the screening volume in the SCREEN_VOLUME_FRAME. */
102 SCREEN_VOLUME_Y((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
103 container::setScreenVolumeY)),
104
105 /** The N component size of the screening volume in the SCREEN_VOLUME_FRAME. */
106 SCREEN_VOLUME_Z((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
107 container::setScreenVolumeZ)),
108
109 /** The time in UTC when Object2 enters the screening volume. */
110 SCREEN_ENTRY_TIME((token, context, container) -> token.processAsDate(container::setScreenEntryTime, context)),
111
112 /** The time in UTC when Object2 exits the screening volume. */
113 SCREEN_EXIT_TIME((token, context, container) -> token.processAsDate(container::setScreenExitTime, context)),
114
115 /** The collision probability screening threshold used to identify this conjunction. */
116 SCREEN_PC_THRESHOLD((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
117 container::setScreenPcThreshold)),
118
119 /** An array of 1 to n elements indicating the percentile(s) for which estimates of the collision probability are provided in the
120 * COLLISION_PROBABILITY variable. */
121 COLLISION_PERCENTILE((token, context, container) -> token.processAsIntegerArray(container::setCollisionPercentile)),
122
123 /** The probability (between 0.0 and 1.0) that Object1 and Object2 will collide. */
124 COLLISION_PROBABILITY((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
125 container::setCollisionProbability)),
126
127 /** The method that was used to calculate the collision probability. */
128 COLLISION_PROBABILITY_METHOD((token, context, container) -> {
129 if (token.getType() == TokenType.ENTRY) {
130 container.setCollisionProbaMethod(PocMethodFacade.parse(token.getContentAsNormalizedString()));
131 }
132 return true;
133 }),
134
135 /** The maximum collision probability that Object1 and Object2 will collide. */
136 COLLISION_MAX_PROBABILITY((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
137 container::setMaxCollisionProbability)),
138
139 /** The method that was used to calculate the maximum collision probability. */
140 COLLISION_MAX_PC_METHOD((token, context, container) -> {
141 if (token.getType() == TokenType.ENTRY) {
142 container.setMaxCollisionProbabilityMethod(PocMethodFacade.parse(token.getRawContent()));
143 }
144 return true;
145 }),
146
147 /** The space environment fragmentation impact (SEFI) adjusted estimate of collision probability that Object1 and Object2 will collide. */
148 SEFI_COLLISION_PROBABILITY((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
149 container::setSefiCollisionProbability)),
150
151 /** The method that was used to calculate the space environment fragmentation impact collision probability. */
152 SEFI_COLLISION_PROBABILITY_METHOD((token, context, container) -> {
153 if (token.getType() == TokenType.ENTRY) {
154 container.setSefiCollisionProbabilityMethod(PocMethodFacade.parse(token.getRawContent()));
155 }
156 return true;
157 }),
158
159 /** The Space environment fragmentation model used. */
160 SEFI_FRAGMENTATION_MODEL((token, context, container) -> token.processAsNormalizedString(container::setSefiFragmentationModel)),
161
162 /** ID of previous CDM issued for event identified by CONJUNCTION_ID. */
163 PREVIOUS_MESSAGE_ID((token, context, container) -> token.processAsFreeTextString(container::setPreviousMessageId)),
164
165 /** UTC epoch of the previous CDM issued for the event identified by CONJUNCTION_ID. */
166 PREVIOUS_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setPreviousMessageEpoch, context)),
167
168 /** Scheduled UTC epoch of the next CDM associated with the event identified by CONJUNCTION_ID. */
169 NEXT_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setNextMessageEpoch, context));
170
171
172 /** Processing method. */
173 private final transient TokenProcessor processor;
174
175 /** Simple constructor.
176 * @param processor processing method
177 */
178 CdmRelativeMetadataKey(final TokenProcessor processor) {
179 this.processor = processor;
180 }
181
182 /** Process one token.
183 * @param token token to process
184 * @param context context binding
185 * @param container container to fill
186 * @return true of token was accepted
187 */
188 public boolean process(final ParseToken token, final ContextBinding context, final CdmRelativeMetadata container) {
189 return processor.process(token, context, container);
190 }
191
192 /** Interface for processing one token. */
193 interface TokenProcessor {
194 /** Process one token.
195 * @param token token to process
196 * @param context context binding
197 * @param container container to fill
198 * @return true of token was accepted
199 */
200 boolean process(ParseToken token, ContextBinding context, CdmRelativeMetadata container);
201 }
202
203
204 }