1   /* Copyright 2022-2025 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      /** Estimated group delay differential TGD for S-L5 correction. */
37      private T tgdSL5;
38  
39      /** Inter Signal Delay for S L1P. */
40      private T iscSL1P;
41  
42      /** Inter Signal Delay for L1D L1P. */
43      private T iscL1DL1P;
44  
45      /** Inter Signal Delay for L1P S. */
46      private T iscL1PS;
47  
48      /** Inter Signal Delay for L1DS. */
49      private T iscL1DS;
50  
51      /** Constructor from non-field instance.
52       * @param field    field to which elements belong
53       * @param original regular non-field instance
54       */
55      public FieldNavicL1NVNavigationMessage(final Field<T> field, final NavICL1NVNavigationMessage original) {
56          super(field, original);
57          setReferenceSignalFlag(original.getReferenceSignalFlag());
58          setTGDSL5(field.getZero().newInstance(original.getTGDSL5()));
59          setIscSL1P(field.getZero().newInstance(original.getIscSL1P()));
60          setIscL1DL1P(field.getZero().newInstance(original.getIscL1DL1P()));
61          setIscL1PS(field.getZero().newInstance(original.getIscL1PS()));
62          setIscL1DS(field.getZero().newInstance(original.getIscL1DS()));
63      }
64  
65      /** Constructor from different field instance.
66       * @param <V> type of the old field elements
67       * @param original regular non-field instance
68       * @param converter for field elements
69       */
70      public <V extends CalculusFieldElement<V>> FieldNavicL1NVNavigationMessage(final Function<V, T> converter,
71                                                                                 final FieldNavicL1NVNavigationMessage<V> original) {
72          super(converter, original);
73          setReferenceSignalFlag(original.getReferenceSignalFlag());
74          setTGDSL5(converter.apply(original.getTGDSL5()));
75          setIscSL1P(converter.apply(original.getIscSL1P()));
76          setIscL1DL1P(converter.apply(original.getIscL1DL1P()));
77          setIscL1PS(converter.apply(original.getIscL1PS()));
78          setIscL1DS(converter.apply(original.getIscL1DS()));
79      }
80  
81      /** {@inheritDoc} */
82      @Override
83      public NavICL1NVNavigationMessage toNonField() {
84          return new NavICL1NVNavigationMessage(this);
85      }
86  
87      /** {@inheritDoc} */
88      @SuppressWarnings("unchecked")
89      @Override
90      public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, NavICL1NVNavigationMessage>>
91          G changeField(final Function<T, U> converter) {
92          return (G) new FieldNavicL1NVNavigationMessage<>(converter, this);
93      }
94  
95      /** Set reference signal flag.
96       * @param referenceSignalFlag reference signal flag
97       */
98      public void setReferenceSignalFlag(final int referenceSignalFlag) {
99          this.referenceSignalFlag = referenceSignalFlag;
100     }
101 
102     /** Get reference signal flag.
103      * @return reference signal flag
104      */
105     public int getReferenceSignalFlag() {
106         return referenceSignalFlag;
107     }
108 
109     /**
110      * Set the estimated group delay differential TGD for S-L5 correction.
111      * @param groupDelayDifferential the estimated group delay differential TGD for S-L3 correction (s)
112      */
113     public void setTGDSL5(final T groupDelayDifferential) {
114         this.tgdSL5 = groupDelayDifferential;
115     }
116 
117     /**
118      * Set the estimated group delay differential TGD for S-L5 correction.
119      * @return estimated group delay differential TGD for S-L3 correction (s)
120      */
121     public T getTGDSL5() {
122         return tgdSL5;
123     }
124 
125     /**
126      * Getter for inter Signal Delay for S L1P.
127      * @return inter signal delay
128      */
129     public T getIscSL1P() {
130         return iscSL1P;
131     }
132 
133     /**
134      * Setter for inter Signal Delay for S L1P.
135      * @param delay delay to set
136      */
137     public void setIscSL1P(final T delay) {
138         this.iscSL1P = delay;
139     }
140 
141     /**
142      * Getter for inter Signal Delay for L1D L1P.
143      * @return inter signal delay
144      */
145     public T getIscL1DL1P() {
146         return iscL1DL1P;
147     }
148 
149     /**
150      * Setter for inter Signal Delay for L1D L1P.
151      * @param delay delay to set
152      */
153     public void setIscL1DL1P(final T delay) {
154         this.iscL1DL1P = delay;
155     }
156 
157     /**
158      * Getter for inter Signal Delay for L1P S.
159      * @return inter signal delay
160      */
161     public T getIscL1PS() {
162         return iscL1PS;
163     }
164 
165     /**
166      * Setter for inter Signal Delay for L1P S.
167      * @param delay delay to set
168      */
169     public void setIscL1PS(final T delay) {
170         this.iscL1PS = delay;
171     }
172 
173     /**
174      * Getter for inter Signal Delay for L1D S.
175      * @return inter signal delay
176      */
177     public T getIscL1DS() {
178         return iscL1DS;
179     }
180 
181     /**
182      * Setter for inter Signal Delay for L1D S.
183      * @param delay delay to set
184      */
185     public void setIscL1DS(final T delay) {
186         this.iscL1DS = delay;
187     }
188 
189 }