CdmMetadata.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 java.util.List;

  19. import org.orekit.bodies.CelestialBodyFactory;
  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;
  22. import org.orekit.files.ccsds.definitions.BodyFacade;
  23. import org.orekit.files.ccsds.definitions.CelestialBodyFrame;
  24. import org.orekit.files.ccsds.definitions.FrameFacade;
  25. import org.orekit.files.ccsds.definitions.ModifiedFrame;
  26. import org.orekit.files.ccsds.definitions.TimeSystem;
  27. import org.orekit.files.ccsds.definitions.YesNoUnknown;
  28. import org.orekit.files.ccsds.ndm.odm.ocm.ObjectType;
  29. import org.orekit.files.ccsds.section.Metadata;
  30. import org.orekit.frames.Frame;

  31. /**
  32.  * This class gathers the meta-data present in the Conjunction Data Message (CDM).
  33.  * @author Melina Vanel
  34.  * @since 11.2
  35.  */
  36. public class CdmMetadata extends Metadata {

  37.     /** CDM relative metadata. */
  38.     private CdmRelativeMetadata relativeMetadata;

  39.     /** Refering to object 1 or 2. */
  40.     private String object;

  41.     /** Unique satellite identification designator for the object. */
  42.     private String objectDesignator;

  43.     /** Specification of satellite catalog source. */
  44.     private String catalogName;

  45.     /** Object name. */
  46.     private String objectName;

  47.     /** International designator for the object as assigned by the UN Committee
  48.      * on Space Research (COSPAR) and the US National Space Science Data Center (NSSDC). */
  49.     private String internationalDesignator;

  50.     /** Type of object. */
  51.     private ObjectType objectType;

  52.     /** Operator contact position for the space object. */
  53.     private String operatorContact;

  54.     /** Operator organization for the space object. */
  55.     private String operatorOrganization;

  56.     /** Operator phone for the space object. */
  57.     private String operatorPhone;

  58.     /** Operator email for the space object. */
  59.     private String operatorEmail;

  60.     /** Unique identifier of Orbit Data Message(s) that are linked (relevant) to this Conjunction Data Message. */
  61.     private String odmMsgLink;

  62.     /** Unique identifier of Attitude Data Message(s) that are linked (relevant) to this Conjunction Data Message. */
  63.     private String admMsgLink;

  64.     /** Unique name of the external ephemeris file used for the object or NONE. */
  65.     private String ephemName;

  66.     /** Flag indicating whether new tracking observations are anticipated prior to the issue of the next CDM associated with the event
  67.      * specified by CONJUNCTION_ID. */
  68.     private YesNoUnknown obsBeforeNextMessage;

  69.     /** Operator email for the space object. */
  70.     private CovarianceMethod covarianceMethod;

  71.     /** Maneuver capacity. */
  72.     private Maneuvrable maneuverable;

  73.     /** Central body around which Object1 and 2 are orbiting. */
  74.     private BodyFacade orbitCenter;

  75.     /** Reference frame in which state vector data are given. */
  76.     private FrameFacade refFrame;

  77.     /** Gravity model name. */
  78.     private String gravityModel;

  79.     /** Degree of the gravity model. */
  80.     private int gravityDegree;

  81.     /** Order of the gravity model. */
  82.     private int gravityOrder;

  83.     /** Name of atmospheric model. */
  84.     private String atmosphericModel;

  85.     /** N-body perturbation bodies. */
  86.     private List<BodyFacade> nBodyPerturbations;

  87.     /** Is solar radiation pressure taken into account or not ? */
  88.     private boolean isSolarRadPressure;

  89.     /** Is solid Earth and ocean tides taken into account or not ? */
  90.     private boolean isEarthTides;

  91.     /** Is in-track thrust modelling used or not ? */
  92.     private boolean isIntrackThrustModeled;

  93.     /** The source from which the covariance data used in the report for both Object 1 and Object 2 originates. */
  94.     private String covarianceSource;

  95.     /** Flag indicating the type of alternate covariance information provided. */
  96.     private AltCovarianceType altCovType;

  97.     /** Reference frame in which the alternate covariance data are given. */
  98.     private FrameFacade altCovRefFrame;

  99.     /** Simple constructor.
  100.      */
  101.     public CdmMetadata() {
  102.         super(null);
  103.     }

  104.     /** {@inheritDoc} */
  105.     @Override
  106.     public void validate(final double version) {
  107.         // We only check values that are mandatory in a cdm file
  108.         checkNotNull(object,                  CdmMetadataKey.OBJECT);
  109.         checkNotNull(objectDesignator,        CdmMetadataKey.OBJECT_DESIGNATOR);
  110.         checkNotNull(catalogName,             CdmMetadataKey.CATALOG_NAME);
  111.         checkNotNull(objectName,              CdmMetadataKey.OBJECT_NAME);
  112.         checkNotNull(internationalDesignator, CdmMetadataKey.INTERNATIONAL_DESIGNATOR);
  113.         checkNotNull(ephemName,               CdmMetadataKey.EPHEMERIS_NAME);
  114.         checkNotNull(covarianceMethod,        CdmMetadataKey.COVARIANCE_METHOD);
  115.         checkNotNull(maneuverable,            CdmMetadataKey.MANEUVERABLE);
  116.         checkNotNull(refFrame,                CdmMetadataKey.REF_FRAME);
  117.     }

  118.     /**
  119.      * Get the relative metadata following header, they are the common metadata for the CDM.
  120.      * @return relativeMetadata relative metadata
  121.      */
  122.     public CdmRelativeMetadata getRelativeMetadata() {
  123.         return relativeMetadata;
  124.     }

  125.     /**
  126.      * Set the relative metadata following header, they are the common metadata for the CDM.
  127.      * @param relativeMetadata relative metadata
  128.      */
  129.     public void setRelativeMetadata(final CdmRelativeMetadata relativeMetadata) {
  130.         this.relativeMetadata = relativeMetadata;
  131.     }

  132.     /**
  133.      * Get the object name for which metadata are given.
  134.      * @return the object name
  135.      */
  136.     public String getObject() {
  137.         return object;
  138.     }

  139.     /**
  140.      * Set the object name for which metadata are given.
  141.      * @param object = object 1 or 2 to be set
  142.      */
  143.     public void setObject(final String object) {
  144.         this.setTimeSystem(TimeSystem.UTC);
  145.         refuseFurtherComments();
  146.         this.object = object;
  147.     }

  148.     /**
  149.      * Get the object satellite catalog designator for which metadata are given.
  150.      * @return the satellite catalog designator for the object
  151.      */
  152.     public String getObjectDesignator() {
  153.         return objectDesignator;
  154.     }

  155.     /**
  156.      * Set the satellite designator for the object for which metadata are given.
  157.      * @param objectDesignator for the spacecraft to be set
  158.      */
  159.     public void setObjectDesignator(final String objectDesignator) {
  160.         refuseFurtherComments();
  161.         this.objectDesignator = objectDesignator;
  162.     }

  163.     /**
  164.      * Get the satellite catalog used for the object.
  165.      * @return the catalog name
  166.      */
  167.     public String getCatalogName() {
  168.         return catalogName;
  169.     }

  170.     /**
  171.      * Set the satellite catalog name used for object.
  172.      * @param catalogName for the spacecraft to be set
  173.      */
  174.     public void setCatalogName(final String catalogName) {
  175.         refuseFurtherComments();
  176.         this.catalogName = catalogName;
  177.     }

  178.     /**
  179.      * Get the spacecraft name for the object.
  180.      * @return the spacecraft name
  181.      */
  182.     public String getObjectName() {
  183.         return objectName;
  184.     }

  185.     /**
  186.      * Set the spacecraft name used for object.
  187.      * @param objectName for the spacecraft to be set
  188.      */
  189.     public void setObjectName(final String objectName) {
  190.         refuseFurtherComments();
  191.         this.objectName = objectName;
  192.     }

  193.     /**
  194.      * Get the international designator for the object.
  195.      * @return the international designator
  196.      */
  197.     public String getInternationalDes() {
  198.         return internationalDesignator;
  199.     }

  200.     /**
  201.      * Set the international designator used for object.
  202.      * @param internationalDes for the object to be set
  203.      */
  204.     public void setInternationalDes(final String internationalDes) {
  205.         refuseFurtherComments();
  206.         this.internationalDesignator = internationalDes;
  207.     }

  208.     /**
  209.      * Get the type of object.
  210.      * @return the object type
  211.      */
  212.     public ObjectType getObjectType() {
  213.         return objectType;
  214.     }

  215.     /**
  216.      * Set the type of object.
  217.      * @param objectType type of object
  218.      */
  219.     public void setObjectType(final ObjectType objectType) {
  220.         refuseFurtherComments();
  221.         this.objectType = objectType;
  222.     }

  223.     /**
  224.      * Get the contact position of the owner / operator of the object.
  225.      * @return the contact position
  226.      */
  227.     public String getOperatorContactPosition() {
  228.         return operatorContact;
  229.     }

  230.     /**
  231.      * Set the contact position for the object owner / operator.
  232.      * @param opContact for the object to be set
  233.      */
  234.     public void setOperatorContactPosition(final String opContact) {
  235.         refuseFurtherComments();
  236.         this.operatorContact = opContact;
  237.     }

  238.     /**
  239.      * Get the contact organisation of the object.
  240.      * @return the contact organisation
  241.      */
  242.     public String getOperatorOrganization() {
  243.         return operatorOrganization;
  244.     }

  245.     /**
  246.      * Set the contact organisation of the object.
  247.      * @param operatorOrganization contact organisation for the object to be set
  248.      */
  249.     public void setOperatorOrganization(final String operatorOrganization) {
  250.         refuseFurtherComments();
  251.         this.operatorOrganization = operatorOrganization;
  252.     }

  253.     /**
  254.      * Get the contact phone of the operator of the object.
  255.      * @return the operator phone
  256.      */
  257.     public String getOperatorPhone() {
  258.         return operatorPhone;
  259.     }

  260.     /**
  261.      * Set the operator phone of the object.
  262.      * @param operatorPhone contact phone for the object to be set
  263.      */
  264.     public void setOperatorPhone(final String operatorPhone) {
  265.         refuseFurtherComments();
  266.         this.operatorPhone = operatorPhone;
  267.     }

  268.     /**
  269.      * Get the email of the operator of the object.
  270.      * @return the operator email
  271.      */
  272.     public String getOperatorEmail() {
  273.         return operatorEmail;
  274.     }

  275.     /**
  276.      * Set the object operator email.
  277.      * @param operatorEmail operator email for the object to be set
  278.      */
  279.     public void setOperatorEmail(final String operatorEmail) {
  280.         refuseFurtherComments();
  281.         this.operatorEmail = operatorEmail;
  282.     }

  283.     /**
  284.      * Get the unique name of the external ephemeris used for OD.
  285.      * @return the name of ephemeris used
  286.      */
  287.     public String getEphemName() {
  288.         return ephemName;
  289.     }

  290.     /**
  291.      * Set the name of external ephemeris used for OD.
  292.      * @param ephemName me of external ephemeris used
  293.      */
  294.     public void setEphemName(final String ephemName) {
  295.         refuseFurtherComments();
  296.         this.ephemName = ephemName;
  297.     }

  298.     /**
  299.      * Get the method name used to calculate covariance during OD.
  300.      * @return the name of covariance calculation method
  301.      */
  302.     public CovarianceMethod getCovarianceMethod() {
  303.         return covarianceMethod;
  304.     }

  305.     /**
  306.      * Set the method name used to calculate covariance during OD.
  307.      * @param covarianceMethod method name for covariance calculation
  308.      */
  309.     public void setCovarianceMethod(final CovarianceMethod covarianceMethod) {
  310.         refuseFurtherComments();
  311.         this.covarianceMethod = covarianceMethod;
  312.     }

  313.     /**
  314.      * Get the ability of object to maneuver or not.
  315.      * @return the ability to maneuver
  316.      */
  317.     public Maneuvrable getManeuverable() {
  318.         return maneuverable;
  319.     }

  320.     /**
  321.      * Set the object maneuver ability.
  322.      * @param maneuverable ability to maneuver
  323.      */
  324.     public void setManeuverable(final Maneuvrable maneuverable) {
  325.         refuseFurtherComments();
  326.         this.maneuverable = maneuverable;
  327.     }

  328.     /**
  329.      * Get the central body for object 1 and 2.
  330.      * @return the name of the central body
  331.      */
  332.     public BodyFacade getOrbitCenter() {
  333.         return orbitCenter;
  334.     }

  335.     /**
  336.      * Set the central body name for object 1 and 2.
  337.      * @param orbitCenter name of the central body
  338.      */
  339.     public void setOrbitCenter(final BodyFacade orbitCenter) {
  340.         refuseFurtherComments();
  341.         this.orbitCenter = orbitCenter;
  342.     }

  343.     /**
  344.      * Get the reference frame in which data are given: used for state vector and
  345.      * Keplerian elements data (and for the covariance reference frame if none is given).
  346.      *
  347.      * @return the reference frame
  348.      */
  349.     public Frame getFrame() {
  350.         if (orbitCenter == null || orbitCenter.getBody() == null) {
  351.             throw new OrekitException(OrekitMessages.NO_DATA_LOADED_FOR_CELESTIAL_BODY, "No Orbit center name");
  352.         }
  353.         if (refFrame.asFrame() == null) {
  354.             throw new OrekitException(OrekitMessages.CCSDS_INVALID_FRAME, refFrame.getName());
  355.         }
  356.         // Just return frame if we don't need to shift the center based on CENTER_NAME
  357.         // MCI and ICRF are the only non-Earth centered frames specified in Annex A.
  358.         final boolean isMci  = refFrame.asCelestialBodyFrame() == CelestialBodyFrame.MCI;
  359.         final boolean isIcrf = refFrame.asCelestialBodyFrame() == CelestialBodyFrame.ICRF;
  360.         final boolean isSolarSystemBarycenter =
  361.                 CelestialBodyFactory.SOLAR_SYSTEM_BARYCENTER.equals(orbitCenter.getBody().getName());
  362.         if (!(isMci || isIcrf) && CelestialBodyFactory.EARTH.equals(orbitCenter.getBody().getName()) ||
  363.             isMci && CelestialBodyFactory.MARS.equals(orbitCenter.getBody().getName()) ||
  364.             isIcrf && isSolarSystemBarycenter) {
  365.             return refFrame.asFrame();
  366.         }
  367.         // else, translate frame to specified center.
  368.         return new ModifiedFrame(refFrame.asFrame(), refFrame.asCelestialBodyFrame(),
  369.                                  orbitCenter.getBody(), orbitCenter.getName());
  370.     }

  371.     /**
  372.      * Get the value of {@code REF_FRAME} as an Orekit {@link Frame}. The {@code
  373.      * ORBIT_CENTER} key word has not been applied yet, so the returned frame may not
  374.      * correspond to the reference frame of the data in the file.
  375.      * @return the reference frame
  376.      */
  377.     public FrameFacade getRefFrame() {
  378.         return refFrame;
  379.     }

  380.     /**
  381.      * Set the name of the reference frame in which the state vector data are given.
  382.      * @param refFrame reference frame
  383.      */
  384.     public void setRefFrame(final FrameFacade refFrame) {
  385.         refuseFurtherComments();
  386.         this.refFrame = refFrame;
  387.     }

  388.     /** Get gravity model name.
  389.      * @return gravity model name
  390.      */
  391.     public String getGravityModel() {
  392.         return gravityModel;
  393.     }

  394.     /** Get degree of the gravity model.
  395.      * @return degree of the gravity model
  396.      */
  397.     public int getGravityDegree() {
  398.         return gravityDegree;
  399.     }

  400.     /** Get order of the gravity model.
  401.      * @return order of the gravity model
  402.      */
  403.     public int getGravityOrder() {
  404.         return gravityOrder;
  405.     }

  406.     /** Set gravity model.
  407.      * @param name name of the model
  408.      * @param degree degree of the model
  409.      * @param order order of the model
  410.      */
  411.     public void setGravityModel(final String name, final int degree, final int order) {
  412.         refuseFurtherComments();
  413.         this.gravityModel  = name;
  414.         this.gravityDegree = degree;
  415.         this.gravityOrder  = order;
  416.     }

  417.     /** Get name of atmospheric model.
  418.      * @return name of atmospheric model
  419.      */
  420.     public String getAtmosphericModel() {
  421.         return atmosphericModel;
  422.     }

  423.     /** Set name of atmospheric model.
  424.      * @param atmosphericModel name of atmospheric model
  425.      */
  426.     public void setAtmosphericModel(final String atmosphericModel) {
  427.         refuseFurtherComments();
  428.         this.atmosphericModel = atmosphericModel;
  429.     }

  430.     /** Get n-body perturbation bodies.
  431.      * @return n-body perturbation bodies
  432.      */
  433.     public List<BodyFacade> getNBodyPerturbations() {
  434.         return nBodyPerturbations;
  435.     }

  436.     /** Set n-body perturbation bodies.
  437.      * @param nBody n-body perturbation bodies
  438.      */
  439.     public void setNBodyPerturbations(final List<BodyFacade> nBody) {
  440.         refuseFurtherComments();
  441.         this.nBodyPerturbations = nBody;
  442.     }

  443.     /**
  444.      * Get boolean that indicates if Solar Radiation Pressure is taken into account or not.
  445.      * @return isSolarRadPressure boolean
  446.      */
  447.     public boolean getSolarRadiationPressure() {
  448.         return isSolarRadPressure;
  449.     }

  450.     /**
  451.      * Set boolean that indicates if Solar Radiation Pressure is taken into account or not.
  452.      * @param isSolRadPressure boolean
  453.      */
  454.     public void setSolarRadiationPressure(final boolean isSolRadPressure) {
  455.         refuseFurtherComments();
  456.         this.isSolarRadPressure = isSolRadPressure;
  457.     }

  458.     /**
  459.      * Get boolean that indicates if Earth and ocean tides are taken into account or not.
  460.      * @return isEarthTides boolean
  461.      */
  462.     public boolean getEarthTides() {
  463.         return isEarthTides;
  464.     }

  465.     /**
  466.      * Set boolean that indicates if Earth and ocean tides are taken into account or not.
  467.      * @param EarthTides boolean
  468.      */
  469.     public void setEarthTides(final boolean EarthTides) {
  470.         refuseFurtherComments();
  471.         this.isEarthTides = EarthTides;
  472.     }

  473.     /**
  474.      * Get boolean that indicates if intrack thrust modeling was into account or not.
  475.      * @return isEarthTides boolean
  476.      */
  477.     public boolean getIntrackThrust() {
  478.         return isIntrackThrustModeled;
  479.     }

  480.     /**
  481.      * Set boolean that indicates if intrack thrust modeling was into account or not.
  482.      * @param IntrackThrustModeled boolean
  483.      */
  484.     public void setIntrackThrust(final boolean IntrackThrustModeled) {
  485.         refuseFurtherComments();
  486.         this.isIntrackThrustModeled = IntrackThrustModeled;
  487.     }

  488.     /** Get the source of the covariance data.
  489.      * @return the covarianceSource
  490.      */
  491.     public String getCovarianceSource() {
  492.         return covarianceSource;
  493.     }

  494.     /** Set the source of the covariance data.
  495.      * @param covarianceSource the covarianceSource to set
  496.      */
  497.     public void setCovarianceSource(final String covarianceSource) {
  498.         refuseFurtherComments();
  499.         this.covarianceSource = covarianceSource;
  500.     }

  501.     /** Get the flag indicating the type of alternate covariance information provided.
  502.      * @return the altCovType
  503.      */
  504.     public AltCovarianceType getAltCovType() {
  505.         return altCovType;
  506.     }

  507.     /** Set the flag indicating the type of alternate covariance information provided.
  508.      * @param altCovType the altCovType to set
  509.      */
  510.     public void setAltCovType(final AltCovarianceType altCovType) {
  511.         refuseFurtherComments();
  512.         this.altCovType = altCovType;
  513.     }

  514.      /**
  515.      * Get the value of {@code ALT_COV_REF_FRAME} as an Orekit {@link Frame}.
  516.      * @return the reference frame
  517.      */
  518.     public FrameFacade getAltCovRefFrame() {
  519.         return altCovRefFrame;
  520.     }

  521.     /**
  522.      * Set the name of the reference frame in which the alternate covariance data are given.
  523.      * @param altCovRefFrame alternate covariance reference frame
  524.      */
  525.     public void setAltCovRefFrame(final FrameFacade altCovRefFrame) {
  526.         refuseFurtherComments();

  527.         if (getAltCovType() == null) {
  528.             throw new OrekitException(OrekitMessages.CCSDS_MISSING_KEYWORD, CdmMetadataKey.ALT_COV_TYPE);
  529.         }

  530.         if (altCovRefFrame.asFrame() == null) {
  531.             throw new OrekitException(OrekitMessages.CCSDS_INVALID_FRAME, altCovRefFrame.getName());
  532.         }

  533.         // Only set the frame if within the allowed options: GCRF, EME2000, ITRF
  534.         if ( altCovRefFrame.asCelestialBodyFrame() == CelestialBodyFrame.GCRF ||
  535.                  altCovRefFrame.asCelestialBodyFrame() == CelestialBodyFrame.EME2000 ||
  536.                      altCovRefFrame.asCelestialBodyFrame().name().contains("ITRF") ) {
  537.             this.altCovRefFrame = altCovRefFrame;
  538.         } else {
  539.             throw new OrekitException(OrekitMessages.CCSDS_INVALID_FRAME, altCovRefFrame.getName());
  540.         }
  541.     }

  542.     /** Get the unique identifier of Orbit Data Message(s) that are linked (relevant) to this Conjunction Data Message.
  543.      * @return the odmMsgLink
  544.      */
  545.     public String getOdmMsgLink() {
  546.         return odmMsgLink;
  547.     }

  548.     /** Set the unique identifier of Orbit Data Message(s) that are linked (relevant) to this Conjunction Data Message.
  549.      * @param odmMsgLink the odmMsgLink to set
  550.      */
  551.     public void setOdmMsgLink(final String odmMsgLink) {
  552.         refuseFurtherComments();
  553.         this.odmMsgLink = odmMsgLink;
  554.     }

  555.     /** Get the unique identifier of Attitude Data Message(s) that are linked (relevant) to this Conjunction Data Message.
  556.      * @return the admMsgLink
  557.      */
  558.     public String getAdmMsgLink() {
  559.         return admMsgLink;
  560.     }

  561.     /** Set the unique identifier of Attitude Data Message(s) that are linked (relevant) to this Conjunction Data Message.
  562.      * @param admMsgLink the admMsgLink to set
  563.      */
  564.     public void setAdmMsgLink(final String admMsgLink) {
  565.         refuseFurtherComments();
  566.         this.admMsgLink = admMsgLink;
  567.     }

  568.     /** Get the flag indicating whether new tracking observations are anticipated prior to the issue of the next CDM associated with the event
  569.      * specified by CONJUNCTION_ID.
  570.      * @return the obsBeforeNextMessage
  571.      */
  572.     public YesNoUnknown getObsBeforeNextMessage() {
  573.         return obsBeforeNextMessage;
  574.     }

  575.     /** Set the flag indicating whether new tracking observations are anticipated prior to the issue of the next CDM associated with the event
  576.      * specified by CONJUNCTION_ID.
  577.      * @param obsBeforeNextMessage the obsBeforeNextMessage to set
  578.      */
  579.     public void setObsBeforeNextMessage(final YesNoUnknown obsBeforeNextMessage) {
  580.         refuseFurtherComments();
  581.         this.obsBeforeNextMessage = obsBeforeNextMessage;
  582.     }
  583. }