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.propagation.analytical.gnss.data;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.orekit.gnss.SatelliteSystem;
21  import org.orekit.time.TimeScales;
22  
23  /**
24   * Container for data contained in a GPS/QZNSS legacy navigation message.
25   * @param <O> type of the orbital elements
26   * @author Bryan Cazabonne
27   * @since 11.0
28   */
29  public abstract class LegacyNavigationMessage<O extends LegacyNavigationMessage<O>>
30      extends AbstractNavigationMessage<O>
31      implements GNSSClockElements {
32  
33      /** Identifier for message type. */
34      public static final String LNAV = "LNAV";
35  
36      /** Issue of Data, Ephemeris. */
37      private int iode;
38  
39      /** Issue of Data, Clock. */
40      private int iodc;
41  
42      /** The user SV accuracy (m). */
43      private double svAccuracy;
44  
45      /** Satellite health status. */
46      private int svHealth;
47  
48      /** Fit interval.
49       * @since 12.0
50       */
51      private int fitInterval;
52  
53      /**
54       * Constructor.
55       * @param mu Earth's universal gravitational parameter
56       * @param angularVelocity mean angular velocity of the Earth for the GNSS model
57       * @param weeksInCycle number of weeks in the GNSS cycle
58       * @param timeScales known time scales
59       * @param system          satellite system to consider for interpreting week number
60       *                        (may be different from real system, for example in Rinex nav, weeks
61       *                        are always according to GPS)
62       */
63      protected LegacyNavigationMessage(final double mu, final double angularVelocity, final int weeksInCycle,
64                                        final TimeScales timeScales, final SatelliteSystem system) {
65          super(mu, angularVelocity, weeksInCycle, timeScales, system);
66      }
67  
68      /** Constructor from field instance.
69       * @param <T> type of the field elements
70       * @param <A> type of the orbital elements (non-field version)
71       * @param original regular field instance
72       */
73      protected <T extends CalculusFieldElement<T>, A extends LegacyNavigationMessage<A>>
74          LegacyNavigationMessage(final FieldLegacyNavigationMessage<T, A> original) {
75          super(original);
76          setIODE(original.getIODE());
77          setIODC(original.getIODC());
78          setSvAccuracy(original.getSvAccuracy().getReal());
79          setSvHealth(original.getSvHealth());
80          setFitInterval(original.getFitInterval());
81      }
82  
83      /**
84       * Getter for the Issue Of Data Ephemeris (IODE).
85       * @return the Issue Of Data Ephemeris (IODE)
86       */
87      public int getIODE() {
88          return iode;
89      }
90  
91      /**
92       * Setter for the Issue of Data Ephemeris.
93       * @param value the IODE to set
94       */
95      public void setIODE(final double value) {
96          // The value is given as a floating number in the navigation message
97          this.iode = (int) value;
98      }
99  
100     /**
101      * Getter for the Issue Of Data Clock (IODC).
102      * @return the Issue Of Data Clock (IODC)
103      */
104     public int getIODC() {
105         return iodc;
106     }
107 
108     /**
109      * Setter for the Issue of Data Clock.
110      * @param value the IODC to set
111      */
112     public void setIODC(final int value) {
113         this.iodc = value;
114     }
115 
116     /**
117      * Getter for the user SV accuray (meters).
118      * @return the user SV accuracy
119      */
120     public double getSvAccuracy() {
121         return svAccuracy;
122     }
123 
124     /**
125      * Setter for the user SV accuracy.
126      * @param svAccuracy the value to set
127      */
128     public void setSvAccuracy(final double svAccuracy) {
129         this.svAccuracy = svAccuracy;
130     }
131 
132     /**
133      * Getter for the satellite health status.
134      * @return the satellite health status
135      */
136     public int getSvHealth() {
137         return svHealth;
138     }
139 
140     /**
141      * Setter for the satellite health status.
142      * @param svHealth the value to set
143      */
144     public void setSvHealth(final int svHealth) {
145         this.svHealth = svHealth;
146     }
147 
148     /**
149      * Getter for the fit interval.
150      * @return the fit interval
151      * @since 12.0
152      */
153     public int getFitInterval() {
154         return fitInterval;
155     }
156 
157     /**
158      * Setter for the fit interval.
159      * @param fitInterval fit interval
160      * @since 12.0
161      */
162     public void setFitInterval(final int fitInterval) {
163         this.fitInterval = fitInterval;
164     }
165 
166 }