ODMFile.java

  1. /* Copyright 2002-2020 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;

  18. import org.orekit.errors.OrekitException;
  19. import org.orekit.errors.OrekitMessages;

  20. /**
  21.  * The ODMFile (Orbit Data Message) class represents any of the three orbit messages used by the CCSDS,
  22.  * i.e. the Orbit Parameter Message (OPM), the Mean-Elements Message (OMM) and the Orbit Ephemeris Message (OEM).
  23.  * It contains the information of the message's header and configuration data (set in the parser).
  24.  * @author sports
  25.  * @since 6.1
  26.  */
  27. public abstract class ODMFile extends NDMFile {

  28.     /** Gravitational coefficient set by the user in the parser. */
  29.     private double muSet;

  30.     /** Gravitational coefficient parsed in the ODM File. */
  31.     private double muParsed;

  32.     /** Gravitational coefficient created from the knowledge of the central body. */
  33.     private double muCreated;

  34.     /** Final gravitational coefficient (used for the public methods that need such a parameter, ex: generateCartesianOrbit).
  35.      * In order of decreasing priority, finalMU is equal to: the coefficient parsed in the file, the coefficient set by the
  36.      * user with the parser's method setMu, the coefficient created from the knowledge of the central body.
  37.      */
  38.     private double muUsed;

  39.     /** ODMFile constructor. */
  40.     public ODMFile() {
  41.         muSet     = Double.NaN;
  42.         muParsed  = Double.NaN;
  43.         muCreated = Double.NaN;
  44.         muUsed    = Double.NaN;
  45.     }

  46.     /**
  47.      * Get the gravitational coefficient set by the user.
  48.      * @return the coefficient
  49.      */
  50.     public double getMuSet() {
  51.         return muSet;
  52.     }

  53.     /**
  54.      * Set the gravitational coefficient set by the user.
  55.      * @param muSet the coefficient to be set
  56.      */
  57.     public void setMuSet(final double muSet) {
  58.         this.muSet = muSet;
  59.     }

  60.     /**
  61.      * Get the gravitational coefficient parsed in the ODM File.
  62.      * @return the coefficient
  63.      */
  64.     public double getMuParsed() {
  65.         return muParsed;
  66.     }

  67.     /**
  68.      * Set the gravitational coefficient parsed in the ODM File.
  69.      * @param muParsed the coefficient to be set
  70.      */
  71.     void setMuParsed(final double muParsed) {
  72.         this.muParsed = muParsed;
  73.     }

  74.     /**
  75.      * Get the gravitational coefficient created from the knowledge of the central body.
  76.      * @return the coefficient
  77.      */
  78.     public double getMuCreated() {
  79.         return muCreated;
  80.     }

  81.     /**
  82.      * Set the gravitational coefficient created from the knowledge of the central body.
  83.      * @param muCreated the coefficient to be set
  84.      */
  85.     void setMuCreated(final double muCreated) {
  86.         this.muCreated = muCreated;
  87.     }

  88.     /**
  89.      * Get the used gravitational coefficient.
  90.      * @return the coefficient
  91.      */
  92.     public double getMuUsed() {
  93.         return muUsed;
  94.     }

  95.     /**
  96.      * Set the gravitational coefficient created from the knowledge of the central body.
  97.      * In order of decreasing priority, finalMU is set equal to:
  98.      * <ol>
  99.      *   <li>the coefficient parsed in the file,</li>
  100.      *   <li>the coefficient set by the user with the parser's method setMu,</li>
  101.      *   <li>the coefficient created from the knowledge of the central body.</li>
  102.      * </ol>
  103.      */
  104.     protected void setMuUsed() {
  105.         if (!Double.isNaN(muParsed)) {
  106.             muUsed = muParsed;
  107.         } else if (!Double.isNaN(muSet)) {
  108.             muUsed = muSet;
  109.         } else if (!Double.isNaN(muCreated)) {
  110.             muUsed = muCreated;
  111.         } else {
  112.             throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_GM);
  113.         }
  114.     }

  115. }