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.     }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  176. }