NDMFile.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 java.util.ArrayList;
  19. import java.util.List;

  20. import org.orekit.data.DataContext;
  21. import org.orekit.errors.OrekitException;
  22. import org.orekit.errors.OrekitMessages;
  23. import org.orekit.time.AbsoluteDate;
  24. import org.orekit.utils.IERSConventions;

  25. /**
  26.  * The NDMFile (Navigation Data Message) class represents the navigation
  27.  * messages used by the CCSDS format, (i.e. the Attitude Data Message (ADM),
  28.  * the Orbit Data Message (ODM) and the Tracking Data Message (TDM)).
  29.  * It contains the information of the message's header and configuration data
  30.  * (set in the parser).
  31.  * @see ADMFile
  32.  * @see ODMFile
  33.  * @see TDMFile
  34.  * @author Bryan Cazabonne
  35.  * @since 10.2
  36.  */
  37. public abstract class NDMFile {

  38.     /** CCSDS Format version. */
  39.     private double formatVersion;

  40.     /** Header comments. The list contains a string for each line of comment. */
  41.     private List<String> headerComment;

  42.     /** File creation date and time in UTC. */
  43.     private AbsoluteDate creationDate;

  44.     /** Creating agency or operator. */
  45.     private String originator;

  46.     /** Data context. */
  47.     private DataContext dataContext;

  48.     /** IERS conventions used. */
  49.     private IERSConventions conventions;

  50.     /** Gravitational coefficient. */
  51.     private double mu;

  52.     /** Initial Date for MET or MRT time systems. */
  53.     private AbsoluteDate missionReferenceDate;

  54.     /**
  55.      * Constructor.
  56.      */
  57.     public NDMFile() {
  58.         mu = Double.NaN;
  59.         // Initialise an empty comments list
  60.         headerComment = new ArrayList<>();
  61.     }

  62.     /**
  63.      * Get the used gravitational coefficient.
  64.      * @return the coefficient
  65.      */
  66.     public double getMu() {
  67.         return mu;
  68.     }

  69.     /**
  70.      * Set the used gravitational coefficient.
  71.      * @param mu the coefficient to set
  72.      */
  73.     public void setMu(final double mu) {
  74.         this.mu = mu;
  75.     }

  76.     /**
  77.      * Get the CCSDS NDM (ADM or ODM) format version.
  78.      * @return format version
  79.      */
  80.     public double getFormatVersion() {
  81.         return formatVersion;
  82.     }

  83.     /**
  84.      * Set the CCSDS NDM (ADM or ODM) format version.
  85.      * @param formatVersion the format version to be set
  86.      */
  87.     public void setFormatVersion(final double formatVersion) {
  88.         this.formatVersion = formatVersion;
  89.     }

  90.     /**
  91.      * Get the header comment.
  92.      * @return header comment
  93.      */
  94.     public List<String> getHeaderComment() {
  95.         return headerComment;
  96.     }

  97.     /**
  98.      * Set the header comment.
  99.      * @param headerComment header comment
  100.      */
  101.     public void setHeaderComment(final List<String> headerComment) {
  102.         this.headerComment = new ArrayList<String>(headerComment);
  103.     }

  104.     /**
  105.      * Get the file creation date and time in UTC.
  106.      * @return the file creation date and time in UTC.
  107.      */
  108.     public AbsoluteDate getCreationDate() {
  109.         return creationDate;
  110.     }

  111.     /**
  112.      * Set the file creation date and time in UTC.
  113.      * @param creationDate the creation date to be set
  114.      */
  115.     public void setCreationDate(final AbsoluteDate creationDate) {
  116.         this.creationDate = creationDate;
  117.     }

  118.     /**
  119.      * Get the file originator.
  120.      * @return originator the file originator.
  121.      */
  122.     public String getOriginator() {
  123.         return originator;
  124.     }

  125.     /**
  126.      * Set the file originator.
  127.      * @param originator the originator to be set
  128.      */
  129.     public void setOriginator(final String originator) {
  130.         this.originator = originator;
  131.     }

  132.     /**
  133.      * Get IERS conventions.
  134.      * @return conventions IERS conventions
  135.      */
  136.     public IERSConventions getConventions() {
  137.         if (conventions != null) {
  138.             return conventions;
  139.         } else {
  140.             throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  141.         }
  142.     }

  143.     /**
  144.      * Set IERS conventions.
  145.      * @param conventions IERS conventions to be set
  146.      */
  147.     public void setConventions(final IERSConventions conventions) {
  148.         this.conventions = conventions;
  149.     }

  150.     /**
  151.      * Get reference date for Mission Elapsed Time and Mission Relative Time time systems.
  152.      * @return the reference date
  153.      */
  154.     public AbsoluteDate getMissionReferenceDate() {
  155.         return missionReferenceDate;
  156.     }

  157.     /**
  158.      * Set reference date for Mission Elapsed Time and Mission Relative Time time systems.
  159.      * @param missionReferenceDate reference date for Mission Elapsed Time and Mission Relative Time time systems.
  160.      */
  161.     public void setMissionReferenceDate(final AbsoluteDate missionReferenceDate) {
  162.         this.missionReferenceDate = missionReferenceDate;
  163.     }

  164.     /**
  165.      * Get the data context.
  166.      * @return the data context used for creating frames, time scales, etc.
  167.      */
  168.     public DataContext getDataContext() {
  169.         return dataContext;
  170.     }

  171.     /**
  172.      * Set the data context.
  173.      * @param dataContext used for creating frames, time scales, etc.
  174.      */
  175.     public void setDataContext(final DataContext dataContext) {
  176.         this.dataContext = dataContext;
  177.     }

  178. }