1   /* Copyright 2002-2021 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.odm.ocm;
18  
19  import org.orekit.files.ccsds.definitions.OdMethodFacade;
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  
26  /** Keys for {@link OrbitDetermination orbit determination data} entries.
27   * @author Luc Maisonobe
28   * @since 11.0
29   */
30  public enum OrbitDeterminationKey {
31  
32      /** Comment entry. */
33      COMMENT((token, context, container) ->
34              token.getType() == TokenType.ENTRY ? container.addComment(token.getContentAsNormalizedString()) : true),
35  
36      /** Identification number. */
37      OD_ID((token, context, container) -> token.processAsNormalizedString(container::setId)),
38  
39      /** Identification of previous orbit determination. */
40      OD_PREV_ID((token, context, container) -> token.processAsNormalizedString(container::setPrevId)),
41  
42      /** Orbit determination method. */
43      OD_METHOD((token, context, container) -> {
44          if (token.getType() == TokenType.ENTRY) {
45              container.setMethod(OdMethodFacade.parse(token.getContentAsNormalizedString()));
46          }
47          return true;
48      }),
49  
50      /** Time tag for orbit determination solved-for state. */
51      OD_EPOCH((token, context, container) -> token.processAsDate(container::setEpoch, context)),
52  
53      /** Time elapsed between first accepted observation on epoch. */
54      DAYS_SINCE_FIRST_OBS((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
55                                                                                container::setTimeSinceFirstObservation)),
56  
57      /** Time elapsed between last accepted observation on epoch. */
58      DAYS_SINCE_LAST_OBS((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
59                                                                               container::setTimeSinceLastObservation)),
60  
61      /** Sime span of observation recommended for the OD of the object. */
62      RECOMMENDED_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
63                                                                               container::setRecommendedOdSpan)),
64  
65      /** Actual time span used for the OD of the object. */
66      ACTUAL_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
67                                                                          container::setActualOdSpan)),
68  
69      /** Number of observations available within the actual OD span. */
70      OBS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setObsAvailable)),
71  
72      /** Number of observations accepted within the actual OD span. */
73      OBS_USED((token, context, container) -> token.processAsInteger(container::setObsUsed)),
74  
75      /** Number of sensors tracks available for the OD within the actual OD span. */
76      TRACKS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setTracksAvailable)),
77  
78      /** Number of sensors tracks accepted for the OD within the actual OD span. */
79      TRACKS_USED((token, context, container) -> token.processAsInteger(container::setTracksUsed)),
80  
81      /** Maximum time between observations in the OD of the object. */
82      MAXIMUM_OBS_GAP((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
83                                                                           container::setMaximumObsGap)),
84  
85      /** Positional error ellipsoid 1σ major eigenvalue at the epoch of OD. */
86      OD_EPOCH_EIGMAJ((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
87                                                                           container::setEpochEigenMaj)),
88  
89      /** Positional error ellipsoid 1σ intermediate eigenvalue at the epoch of OD. */
90      OD_EPOCH_EIGMED((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
91                                                                           container::setEpochEigenMed)),
92  
93      /** Positional error ellipsoid 1σ minor eigenvalue at the epoch of OD. */
94      OD_EPOCH_EIGMIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
95                                                                           container::setEpochEigenMin)),
96  
97      /** Maximum predicted major eigenvalue of 1σ positional error ellipsoid over entire time span of the OCM. */
98      OD_MAX_PRED_EIGMAJ((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
99                                                                              container::setMaxPredictedEigenMaj)),
100 
101     /** Minimum predicted minor eigenvalue of 1σ positional error ellipsoid over entire time span of the OCM. */
102     OD_MIN_PRED_EIGMIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
103                                                                             container::setMinPredictedEigenMin)),
104 
105     /** Confidence metric. */
106     OD_CONFIDENCE((token, context, container) -> token.processAsDouble(Unit.PERCENT, context.getParsedUnitsBehavior(),
107                                                                        container::setConfidence)),
108 
109     /** Generalize Dilution Of Precision. */
110     GDOP((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(), container::setGdop)),
111 
112     /** Number of solved-for states. */
113     SOLVE_N((token, context, container) -> token.processAsInteger(container::setSolveN)),
114 
115     /** Description of state elements solved-for. */
116     SOLVE_STATES((token, context, container) -> token.processAsNormalizedList(container::setSolveStates)),
117 
118     /** Number of consider parameters. */
119     CONSIDER_N((token, context, container) -> token.processAsInteger(container::setConsiderN)),
120 
121     /** Description of consider parameters. */
122     CONSIDER_PARAMS((token, context, container) -> token.processAsNormalizedList(container::setConsiderParameters)),
123 
124     /** Number of sensors used. */
125     SENSORS_N((token, context, container) -> token.processAsInteger(container::setSensorsN)),
126 
127     /** Description of sensors used. */
128     SENSORS((token, context, container) -> token.processAsNormalizedList(container::setSensors)),
129 
130     /** Weighted RMS residual ratio. */
131     WEIGHTED_RMS((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
132                                                                       container::setWeightedRms)),
133 
134     /** Observation data types used. */
135     DATA_TYPES((token, context, container) -> token.processAsNormalizedList(container::setDataTypes));
136 
137     /** Processing method. */
138     private final TokenProcessor processor;
139 
140     /** Simple constructor.
141      * @param processor processing method
142      */
143     OrbitDeterminationKey(final TokenProcessor processor) {
144         this.processor = processor;
145     }
146 
147     /** Process an token.
148      * @param token token to process
149      * @param context context binding
150      * @param container container to fill
151      * @return true of token was accepted
152      */
153     public boolean process(final ParseToken token, final ContextBinding context, final OrbitDetermination container) {
154         return processor.process(token, context, container);
155     }
156 
157     /** Interface for processing one token. */
158     interface TokenProcessor {
159         /** Process one token.
160          * @param token token to process
161          * @param context context binding
162          * @param container container to fill
163          * @return true of token was accepted
164          */
165         boolean process(ParseToken token, ContextBinding context, OrbitDetermination container);
166     }
167 
168 }