OrbitManeuverHistoryMetadataKey.java

  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.odm.ocm;

  18. import org.orekit.files.ccsds.definitions.DutyCycleType;
  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 OrbitManeuverHistoryMetadata maneuver history container} entries.
  24.  * @author Luc Maisonobe
  25.  * @since 11.0
  26.  */
  27. public enum OrbitManeuverHistoryMetadataKey {

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

  31.     /** Maneuver identification number. */
  32.     MAN_ID((token, context, container) -> token.processAsFreeTextString(container::setManID)),

  33.     /** Identification number of previous maneuver. */
  34.     MAN_PREV_ID((token, context, container) -> token.processAsFreeTextString(container::setManPrevID)),

  35.     /** Identification number of next maneuver. */
  36.     MAN_NEXT_ID((token, context, container) -> token.processAsFreeTextString(container::setManNextID)),

  37.     /** Basis of this maneuver history data. */
  38.     MAN_BASIS((token, context, container) -> token.processAsEnum(ManBasis.class, container::setManBasis)),

  39.     /** Identification number of the orbit determination or simulation upon which this maneuver is based.*/
  40.     MAN_BASIS_ID((token, context, container) -> token.processAsFreeTextString(container::setManBasisID)),

  41.     /** Identifier of the device used for this maneuver.*/
  42.     MAN_DEVICE_ID((token, context, container) -> token.processAsFreeTextString(container::setManDeviceID)),

  43.     /** Completion time of previous maneuver. */
  44.     MAN_PREV_EPOCH((token, context, container) -> token.processAsDate(container::setManPrevEpoch, context)),

  45.     /** Start time of next maneuver. */
  46.     MAN_NEXT_EPOCH((token, context, container) -> token.processAsDate(container::setManNextEpoch, context)),

  47.     /** Purposes of the maneuver. */
  48.     MAN_PURPOSE((token, context, container) -> token.processAsFreeTextList(container::setManPurpose)),

  49.     /** Prediction source on which this maneuver is based. */
  50.     MAN_PRED_SOURCE((token, context, container) -> token.processAsFreeTextString(container::setManPredSource)),

  51.     /** Reference frame of the maneuver. */
  52.     MAN_REF_FRAME((token, context, container) -> token.processAsFrame(container::setManReferenceFrame, context, true, true, false)),

  53.     /** Epoch of the {@link #MAN_REF_FRAME maneuver reference frame}. */
  54.     MAN_FRAME_EPOCH((token, context, container) -> token.processAsDate(container::setManFrameEpoch, context)),

  55.     /** Origin of maneuver gravitational assist body. */
  56.     GRAV_ASSIST_NAME((token, context, container) -> token.processAsCenter(container::setGravitationalAssist,
  57.                                                                           context.getDataContext().getCelestialBodies())),

  58.     /** Type of duty cycle. */
  59.     DC_TYPE((token, context, container) -> token.processAsEnum(DutyCycleType.class, container::setDcType)),

  60.     /** Start time of duty cycle-based maneuver window. */
  61.     DC_WIN_OPEN((token, context, container) -> token.processAsDate(container::setDcWindowOpen, context)),

  62.     /** Start time of duty cycle-based maneuver window. */
  63.     DC_WIN_CLOSE((token, context, container) -> token.processAsDate(container::setDcWindowClose, context)),

  64.     /** Minimum number of "ON" duty cycles. */
  65.     DC_MIN_CYCLES((token, context, container) -> token.processAsInteger(container::setDcMinCycles)),

  66.     /** Maximum number of "ON" duty cycles. */
  67.     DC_MAX_CYCLES((token, context, container) -> token.processAsInteger(container::setDcMaxCycles)),

  68.     /** Start time of initial duty cycle-based maneuver execution. */
  69.     DC_EXEC_START((token, context, container) -> token.processAsDate(container::setDcExecStart, context)),

  70.     /** End time of final duty cycle-based maneuver execution. */
  71.     DC_EXEC_STOP((token, context, container) -> token.processAsDate(container::setDcExecStop, context)),

  72.     /** Duty cycle thrust reference time. */
  73.     DC_REF_TIME((token, context, container) -> token.processAsDate(container::setDcRefTime, context)),

  74.     /** Duty cycle pulse "ON" duration. */
  75.     DC_TIME_PULSE_DURATION((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  76.                                                                                 container::setDcTimePulseDuration)),

  77.     /** Duty cycle elapsed time between start of a pulse and start of next pulse. */
  78.     DC_TIME_PULSE_PERIOD((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  79.                                                                               container::setDcTimePulsePeriod)),

  80.     /** Reference direction for triggering duty cycle. */
  81.     DC_REF_DIR((token, context, container) -> token.processAsVector(Unit.NONE, context.getParsedUnitsBehavior(),
  82.                                                                     container::setDcRefDir)),

  83.     /** Spacecraft body frame in which {@link #DC_BODY_TRIGGER} is specified. */
  84.     DC_BODY_FRAME((token, context, container) -> token.processAsFrame(f -> container.setDcBodyFrame(f.asSpacecraftBodyFrame()),
  85.                                                                       context, false, false, true)),

  86.     /** Direction in {@link #DC_BODY_FRAME body frame} for triggering duty cycle. */
  87.     DC_BODY_TRIGGER((token, context, container) -> token.processAsVector(Unit.NONE, context.getParsedUnitsBehavior(),
  88.                                                                          container::setDcBodyTrigger)),

  89.     /** Phase angle of pulse start. */
  90.     DC_PA_START_ANGLE((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  91.                                                                            container::setDcPhaseStartAngle)),

  92.     /** Phase angle of pulse stop. */
  93.     DC_PA_STOP_ANGLE((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  94.                                                                           container::setDcPhaseStopAngle)),

  95.     /** Maneuver elements of information. */
  96.     MAN_COMPOSITION((token, context, container) -> token.processAsEnumsList(ManeuverFieldType.class, container::setManComposition)),

  97.     /** SI units for each elements of the maneuver. */
  98.     MAN_UNITS((token, context, container) -> token.processAsUnitList(container::setManUnits));

  99.     /** Processing method. */
  100.     private final transient TokenProcessor processor;

  101.     /** Simple constructor.
  102.      * @param processor processing method
  103.      */
  104.     OrbitManeuverHistoryMetadataKey(final TokenProcessor processor) {
  105.         this.processor = processor;
  106.     }

  107.     /** Process an token.
  108.      * @param token token to process
  109.      * @param context context binding
  110.      * @param container container to fill
  111.      * @return true of token was accepted
  112.      */
  113.     public boolean process(final ParseToken token, final ContextBinding context, final OrbitManeuverHistoryMetadata container) {
  114.         return processor.process(token, context, container);
  115.     }

  116.     /** Interface for processing one token. */
  117.     interface TokenProcessor {
  118.         /** Process one token.
  119.          * @param token token to process
  120.          * @param context context binding
  121.          * @param container container to fill
  122.          * @return true of token was accepted
  123.          */
  124.         boolean process(ParseToken token, ContextBinding context, OrbitManeuverHistoryMetadata container);
  125.     }

  126. }