AdditionalParametersKey.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.cdm;

  18. import org.orekit.files.ccsds.definitions.Units;
  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 AdditionalParameters CDM additional parameters} entries.
  24.  * @author Melina Vanel
  25.  * @since 11.2
  26.  */
  27. public enum AdditionalParametersKey {

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

  31.     /** The actual area of the object. */
  32.     AREA_PC((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  33.                                                                  container::setAreaPC)),

  34.     /** Minimum area (or cross-section) of the object to be used in the calculation of the probability of collision. */
  35.     AREA_PC_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  36.                                                                  container::setAreaPCMin)),

  37.     /** Maximum area (or cross-section) of the object to be used in the calculation of the probability of collision. */
  38.     AREA_PC_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  39.                                                                  container::setAreaPCMax)),

  40.     /** The effective area of the object exposed to atmospheric drag. */
  41.     AREA_DRG((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  42.                                                                  container::setAreaDRG)),

  43.     /** The effective area of the object exposed to solar radiation pressure. */
  44.     AREA_SRP((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  45.                                                                  container::setAreaSRP)),

  46.     /** Optimally Enclosing Box parent reference frame. */
  47.     OEB_PARENT_FRAME((token, context, container) -> token.processAsFrame(container::setOebParentFrame, context, true, true, false)),

  48.     /** Optimally Enclosing Box parent reference frame epoch. */
  49.     OEB_PARENT_FRAME_EPOCH((token, context, container) -> token.processAsDate(container::setOebParentFrameEpoch, context)),

  50.     /** Quaternion defining Optimally Enclosing Box (first vectorial component). */
  51.     OEB_Q1((token, context, container) -> token.processAsIndexedDouble(1, Unit.ONE, context.getParsedUnitsBehavior(),
  52.                                                                        container::setOebQ)),

  53.     /** Quaternion defining Optimally Enclosing Box (second vectorial component). */
  54.     OEB_Q2((token, context, container) -> token.processAsIndexedDouble(2, Unit.ONE, context.getParsedUnitsBehavior(),
  55.                                                                        container::setOebQ)),

  56.     /** Quaternion defining Optimally Enclosing Box (third vectorial component). */
  57.     OEB_Q3((token, context, container) -> token.processAsIndexedDouble(3, Unit.ONE, context.getParsedUnitsBehavior(),
  58.                                                                        container::setOebQ)),

  59.     /** Quaternion defining Optimally Enclosing Box (scalar component). */
  60.     OEB_QC((token, context, container) -> token.processAsIndexedDouble(0, Unit.ONE, context.getParsedUnitsBehavior(),
  61.                                                                        container::setOebQ)),

  62.     /**  Maximum physical dimension of Optimally Enclosing Box. */
  63.     OEB_MAX((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  64.                                                                  container::setOebMax)),

  65.     /**  Intermediate physical dimension of Optimally Enclosing Box. */
  66.     OEB_INT((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  67.                                                                  container::setOebIntermediate)),

  68.     /**  Minium physical dimension of Optimally Enclosing Box. */
  69.     OEB_MIN((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  70.                                                                  container::setOebMin)),

  71.     /** Cross-sectional area of Optimally Enclosing Box when viewed along the maximum OEB direction. */
  72.     AREA_ALONG_OEB_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  73.                                                                             container::setOebAreaAlongMax)),

  74.     /** Cross-sectional area of Optimally Enclosing Box when viewed along the intermediate OEB direction. */
  75.     AREA_ALONG_OEB_INT((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  76.                                                                             container::setOebAreaAlongIntermediate)),

  77.     /** Cross-sectional area of Optimally Enclosing Box when viewed along the minimum OEB direction. */
  78.     AREA_ALONG_OEB_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  79.                                                                             container::setOebAreaAlongMin)),
  80.     /** Typical (50th percentile) radar cross-section. */
  81.     RCS((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  82.                                                              container::setRcs)),

  83.     /** Minimum radar cross-section. */
  84.     RCS_MIN((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  85.                                                                  container::setMinRcs)),

  86.     /** Maximum radar cross-section. */
  87.     RCS_MAX((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  88.                                                                  container::setMaxRcs)),

  89.     /** Typical (50th percentile) absolute visual magnitude. */
  90.     VM_ABSOLUTE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  91.                                                                      container::setVmAbsolute)),

  92.     /** Minimum apparent visual magnitude. */
  93.     VM_APPARENT_MIN((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  94.                                                                          container::setVmApparentMin)),

  95.     /** Typical (50th percentile) apparent visual magnitude. */
  96.     VM_APPARENT((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  97.                                                                      container::setVmApparent)),

  98.     /** Maximum apparent visual magnitude. */
  99.     VM_APPARENT_MAX((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  100.                                                                          container::setVmApparentMax)),

  101.     /** Typical (50th percentile) coefficient of reflectance. */
  102.     REFLECTANCE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  103.                                                                      container::setReflectance)),

  104.     /** The mass of the object. */
  105.     MASS((token, context, container) -> token.processAsDouble(Unit.KILOGRAM, context.getParsedUnitsBehavior(),
  106.                                                                  container::setMass)),

  107.     /** Object hard body radius. */
  108.     HBR((token, context, container) -> token.processAsDouble(Unit.METRE, context.getParsedUnitsBehavior(),
  109.                                                                      container::setHbr)),

  110.     /** The object’s Cd x A/m used to propagate the state vector and covariance to TCA. */
  111.     CD_AREA_OVER_MASS((token, context, container) -> token.processAsDouble(Units.M2_PER_KG, context.getParsedUnitsBehavior(),
  112.                                                                  container::setCDAreaOverMass)),

  113.     /** The object’s Cr x A/m used to propagate the state vector and covariance to TCA. */
  114.     CR_AREA_OVER_MASS((token, context, container) -> token.processAsDouble(Units.M2_PER_KG, context.getParsedUnitsBehavior(),
  115.                                                                  container::setCRAreaOverMass)),

  116.     /** The object’s acceleration due to in-track thrust used to propagate the state vector and covariance to TCA. */
  117.     THRUST_ACCELERATION((token, context, container) -> token.processAsDouble(Units.M_PER_S2, context.getParsedUnitsBehavior(),
  118.                                                                  container::setThrustAcceleration)),

  119.     /** The amount of energy being removed from the object’s orbit by atmospheric drag. This value is an average calculated during the OD. */
  120.     SEDR((token, context, container) -> token.processAsDouble(Units.W_PER_KG, context.getParsedUnitsBehavior(),
  121.                                                                  container::setSedr)),

  122.     /** The distance of the furthest point in the objects orbit above the equatorial radius of the central body. */
  123.     APOAPSIS_ALTITUDE((token, context, container) -> token.processAsDouble(Unit.KILOMETRE, context.getParsedUnitsBehavior(),
  124.                                                                      container::setApoapsisAltitude)),

  125.     /** The distance of the closest point in the objects orbit above the equatorial radius of the central body. */
  126.     PERIAPSIS_ALTITUDE((token, context, container) -> token.processAsDouble(Unit.KILOMETRE, context.getParsedUnitsBehavior(),
  127.                                                                      container::setPeriapsissAltitude)),

  128.     /** The angle between the objects orbit plane and the orbit centers equatorial plane. */
  129.     INCLINATION((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  130.                                                                      container::setInclination)),

  131.     /** A measure of the confidence in the covariance errors matching reality. */
  132.     COV_CONFIDENCE((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
  133.                                                                      container::setCovConfidence)),

  134.     /** The method used for the calculation of COV_CONFIDENCE. */
  135.     COV_CONFIDENCE_METHOD((token, context, container) -> token.processAsFreeTextString(container::setCovConfidenceMethod));

  136.     /** Processing method. */
  137.     private final TokenProcessor processor;

  138.     /** Simple constructor.
  139.      * @param processor processing method
  140.      */
  141.     AdditionalParametersKey(final TokenProcessor processor) {
  142.         this.processor = processor;
  143.     }

  144.     /** Process one token.
  145.      * @param token token to process
  146.      * @param context context binding
  147.      * @param container container to fill
  148.      * @return true of token was accepted
  149.      */
  150.     public boolean process(final ParseToken token, final ContextBinding context, final AdditionalParameters container) {
  151.         return processor.process(token, context, container);
  152.     }

  153.     /** Interface for processing one token. */
  154.     interface TokenProcessor {
  155.         /** Process one token.
  156.          * @param token token to process
  157.          * @param context context binding
  158.          * @param container container to fill
  159.          * @return true of token was accepted
  160.          */
  161.         boolean process(ParseToken token, ContextBinding context, AdditionalParameters container);
  162.     }

  163. }