1   /* Copyright 2022-2026 Luc Maisonobe
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.hipparchus.Field;
21  
22  import java.util.function.Function;
23  
24  /**
25   * Container for data contained in a NavIC navigation message.
26   * @param <T> type of the field elements
27   * @author Luc Maisonobe
28   * @since 13.0
29   */
30  public class FieldNavicL1NvNavigationMessage<T extends CalculusFieldElement<T>>
31      extends FieldCivilianNavigationMessage<T, NavICL1NvNavigationMessage> {
32  
33      /** Reference signal flag. */
34      private int referenceSignalFlag;
35  
36      /** User Range Accuracy Index.
37       * @since 14.0
38       */
39      private int urai;
40  
41      /** L1 SPS health.
42       * @since 14.0
43       */
44      private int l1SpsHealth;
45  
46      /** Estimated group delay differential TGD for S-L5 correction. */
47      private T tgdSL5;
48  
49      /** Inter Signal Delay for S L1P. */
50      private T iscSL1P;
51  
52      /** Inter Signal Delay for L1D L1P. */
53      private T iscL1DL1P;
54  
55      /** Inter Signal Delay for L1P S. */
56      private T iscL1PS;
57  
58      /** Inter Signal Delay for L1DS. */
59      private T iscL1DS;
60  
61      /** Constructor from non-field instance.
62       * @param field    field to which elements belong
63       * @param original regular non-field instance
64       */
65      public FieldNavicL1NvNavigationMessage(final Field<T> field, final NavICL1NvNavigationMessage original) {
66          super(field, original);
67          setReferenceSignalFlag(original.getReferenceSignalFlag());
68          setUrai(original.getUrai());
69          setL1SpsHealth(original.getL1SpsHealth());
70          setTGDSL5(field.getZero().newInstance(original.getTGDSL5()));
71          setIscSL1P(field.getZero().newInstance(original.getIscSL1P()));
72          setIscL1DL1P(field.getZero().newInstance(original.getIscL1DL1P()));
73          setIscL1PS(field.getZero().newInstance(original.getIscL1PS()));
74          setIscL1DS(field.getZero().newInstance(original.getIscL1DS()));
75      }
76  
77      /** Constructor from different field instance.
78       * @param <V> type of the old field elements
79       * @param original regular non-field instance
80       * @param converter for field elements
81       */
82      public <V extends CalculusFieldElement<V>> FieldNavicL1NvNavigationMessage(final Function<V, T> converter,
83                                                                                 final FieldNavicL1NvNavigationMessage<V> original) {
84          super(converter, original);
85          setReferenceSignalFlag(original.getReferenceSignalFlag());
86          setUrai(original.getUrai());
87          setL1SpsHealth(original.getL1SpsHealth());
88          setTGDSL5(converter.apply(original.getTGDSL5()));
89          setIscSL1P(converter.apply(original.getIscSL1P()));
90          setIscL1DL1P(converter.apply(original.getIscL1DL1P()));
91          setIscL1PS(converter.apply(original.getIscL1PS()));
92          setIscL1DS(converter.apply(original.getIscL1DS()));
93      }
94  
95      /** {@inheritDoc} */
96      @Override
97      public NavICL1NvNavigationMessage toNonField() {
98          return new NavICL1NvNavigationMessage(this);
99      }
100 
101     /** {@inheritDoc} */
102     @SuppressWarnings("unchecked")
103     @Override
104     public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, NavICL1NvNavigationMessage>>
105         G changeField(final Function<T, U> converter) {
106         return (G) new FieldNavicL1NvNavigationMessage<>(converter, this);
107     }
108 
109     /** Set reference signal flag.
110      * @param referenceSignalFlag reference signal flag
111      */
112     public void setReferenceSignalFlag(final int referenceSignalFlag) {
113         this.referenceSignalFlag = referenceSignalFlag;
114     }
115 
116     /** Get reference signal flag.
117      * @return reference signal flag
118      */
119     public int getReferenceSignalFlag() {
120         return referenceSignalFlag;
121     }
122 
123     /** Set User Range Accuracy Index.
124      * @param urai User Range Accuracy Index
125      * @since 14.0
126      */
127     public void setUrai(final int urai) {
128         this.urai = urai;
129     }
130 
131     /** Get User Range Accuracy Index.
132      * @return User Range Accuracy Index
133      * @since 14.0
134      */
135     public int getUrai() {
136         return urai;
137     }
138 
139     /** Set L1 SPS health.
140      * @param l1SpsHealth L1 SPS health
141      * @since 14.0
142      */
143     public void setL1SpsHealth(final int l1SpsHealth) {
144         this.l1SpsHealth = l1SpsHealth;
145     }
146 
147     /** Get L1 SPS health.
148      * @return L1 SPS health
149      * @since 14.0
150      */
151     public int getL1SpsHealth() {
152         return l1SpsHealth;
153     }
154 
155     /**
156      * Set the estimated group delay differential TGD for S-L5 correction.
157      * @param groupDelayDifferential the estimated group delay differential TGD for S-L3 correction (s)
158      */
159     public void setTGDSL5(final T groupDelayDifferential) {
160         this.tgdSL5 = groupDelayDifferential;
161     }
162 
163     /**
164      * Set the estimated group delay differential TGD for S-L5 correction.
165      * @return estimated group delay differential TGD for S-L3 correction (s)
166      */
167     public T getTGDSL5() {
168         return tgdSL5;
169     }
170 
171     /**
172      * Getter for inter Signal Delay for S L1P.
173      * @return inter signal delay
174      */
175     public T getIscSL1P() {
176         return iscSL1P;
177     }
178 
179     /**
180      * Setter for inter Signal Delay for S L1P.
181      * @param delay delay to set
182      */
183     public void setIscSL1P(final T delay) {
184         this.iscSL1P = delay;
185     }
186 
187     /**
188      * Getter for inter Signal Delay for L1D L1P.
189      * @return inter signal delay
190      */
191     public T getIscL1DL1P() {
192         return iscL1DL1P;
193     }
194 
195     /**
196      * Setter for inter Signal Delay for L1D L1P.
197      * @param delay delay to set
198      */
199     public void setIscL1DL1P(final T delay) {
200         this.iscL1DL1P = delay;
201     }
202 
203     /**
204      * Getter for inter Signal Delay for L1P S.
205      * @return inter signal delay
206      */
207     public T getIscL1PS() {
208         return iscL1PS;
209     }
210 
211     /**
212      * Setter for inter Signal Delay for L1P S.
213      * @param delay delay to set
214      */
215     public void setIscL1PS(final T delay) {
216         this.iscL1PS = delay;
217     }
218 
219     /**
220      * Getter for inter Signal Delay for L1D S.
221      * @return inter signal delay
222      */
223     public T getIscL1DS() {
224         return iscL1DS;
225     }
226 
227     /**
228      * Setter for inter Signal Delay for L1D S.
229      * @param delay delay to set
230      */
231     public void setIscL1DS(final T delay) {
232         this.iscL1DS = delay;
233     }
234 
235 }