OrbitDeterminationKey.java

  1. /* Copyright 2002-2022 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. import org.orekit.files.ccsds.definitions.OdMethodFacade;
  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. /** Keys for {@link OrbitDetermination orbit determination data} entries.
  24.  * @author Luc Maisonobe
  25.  * @since 11.0
  26.  */
  27. public enum OrbitDeterminationKey {

  28.     /** Comment entry. */
  29.     COMMENT((token, context, container) ->
  30.             token.getType() == TokenType.ENTRY ? container.addComment(token.getContentAsNormalizedString()) : true),

  31.     /** Identification number. */
  32.     OD_ID((token, context, container) -> token.processAsNormalizedString(container::setId)),

  33.     /** Identification of previous orbit determination. */
  34.     OD_PREV_ID((token, context, container) -> token.processAsNormalizedString(container::setPrevId)),

  35.     /** Orbit determination method. */
  36.     OD_METHOD((token, context, container) -> {
  37.         if (token.getType() == TokenType.ENTRY) {
  38.             container.setMethod(OdMethodFacade.parse(token.getContentAsNormalizedString()));
  39.         }
  40.         return true;
  41.     }),

  42.     /** Time tag for orbit determination solved-for state. */
  43.     OD_EPOCH((token, context, container) -> token.processAsDate(container::setEpoch, context)),

  44.     /** Time elapsed between first accepted observation on epoch. */
  45.     DAYS_SINCE_FIRST_OBS((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  46.                                                                               container::setTimeSinceFirstObservation)),

  47.     /** Time elapsed between last accepted observation on epoch. */
  48.     DAYS_SINCE_LAST_OBS((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  49.                                                                              container::setTimeSinceLastObservation)),

  50.     /** Sime span of observation recommended for the OD of the object. */
  51.     RECOMMENDED_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  52.                                                                              container::setRecommendedOdSpan)),

  53.     /** Actual time span used for the OD of the object. */
  54.     ACTUAL_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  55.                                                                         container::setActualOdSpan)),

  56.     /** Number of observations available within the actual OD span. */
  57.     OBS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setObsAvailable)),

  58.     /** Number of observations accepted within the actual OD span. */
  59.     OBS_USED((token, context, container) -> token.processAsInteger(container::setObsUsed)),

  60.     /** Number of sensors tracks available for the OD within the actual OD span. */
  61.     TRACKS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setTracksAvailable)),

  62.     /** Number of sensors tracks accepted for the OD within the actual OD span. */
  63.     TRACKS_USED((token, context, container) -> token.processAsInteger(container::setTracksUsed)),

  64.     /** Maximum time between observations in the OD of the object. */
  65.     MAXIMUM_OBS_GAP((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  66.                                                                          container::setMaximumObsGap)),

  67.     /** Positional error ellipsoid 1σ major eigenvalue at the epoch of OD. */
  68.     OD_EPOCH_EIGMAJ((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  69.                                                                          container::setEpochEigenMaj)),

  70.     /** Positional error ellipsoid 1σ intermediate eigenvalue at the epoch of OD. */
  71.     OD_EPOCH_EIGINT((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  72.                                                                          container::setEpochEigenInt)),

  73.     /** Positional error ellipsoid 1σ minor eigenvalue at the epoch of OD. */
  74.     OD_EPOCH_EIGMIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  75.                                                                          container::setEpochEigenMin)),

  76.     /** Maximum predicted major eigenvalue of 1σ positional error ellipsoid over entire time span of the OCM. */
  77.     OD_MAX_PRED_EIGMAJ((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  78.                                                                             container::setMaxPredictedEigenMaj)),

  79.     /** Minimum predicted minor eigenvalue of 1σ positional error ellipsoid over entire time span of the OCM. */
  80.     OD_MIN_PRED_EIGMIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  81.                                                                             container::setMinPredictedEigenMin)),

  82.     /** Confidence metric. */
  83.     OD_CONFIDENCE((token, context, container) -> token.processAsDouble(Unit.PERCENT, context.getParsedUnitsBehavior(),
  84.                                                                        container::setConfidence)),

  85.     /** Generalize Dilution Of Precision. */
  86.     GDOP((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(), container::setGdop)),

  87.     /** Number of solved-for states. */
  88.     SOLVE_N((token, context, container) -> token.processAsInteger(container::setSolveN)),

  89.     /** Description of state elements solved-for. */
  90.     SOLVE_STATES((token, context, container) -> token.processAsNormalizedList(container::setSolveStates)),

  91.     /** Number of consider parameters. */
  92.     CONSIDER_N((token, context, container) -> token.processAsInteger(container::setConsiderN)),

  93.     /** Description of consider parameters. */
  94.     CONSIDER_PARAMS((token, context, container) -> token.processAsNormalizedList(container::setConsiderParameters)),

  95.     /** Number of sensors used. */
  96.     SENSORS_N((token, context, container) -> token.processAsInteger(container::setSensorsN)),

  97.     /** Description of sensors used. */
  98.     SENSORS((token, context, container) -> token.processAsNormalizedList(container::setSensors)),

  99.     /** Weighted RMS residual ratio. */
  100.     WEIGHTED_RMS((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  101.                                                                       container::setWeightedRms)),

  102.     /** Observation data types used. */
  103.     DATA_TYPES((token, context, container) -> token.processAsNormalizedList(container::setDataTypes));

  104.     /** Processing method. */
  105.     private final TokenProcessor processor;

  106.     /** Simple constructor.
  107.      * @param processor processing method
  108.      */
  109.     OrbitDeterminationKey(final TokenProcessor processor) {
  110.         this.processor = processor;
  111.     }

  112.     /** Process an token.
  113.      * @param token token to process
  114.      * @param context context binding
  115.      * @param container container to fill
  116.      * @return true of token was accepted
  117.      */
  118.     public boolean process(final ParseToken token, final ContextBinding context, final OrbitDetermination container) {
  119.         return processor.process(token, context, container);
  120.     }

  121.     /** Interface for processing one token. */
  122.     interface TokenProcessor {
  123.         /** Process one token.
  124.          * @param token token to process
  125.          * @param context context binding
  126.          * @param container container to fill
  127.          * @return true of token was accepted
  128.          */
  129.         boolean process(ParseToken token, ContextBinding context, OrbitDetermination container);
  130.     }

  131. }