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.orekit.orbits.FieldKeplerianOrbit;
21  import org.orekit.time.FieldGNSSDate;
22  import org.orekit.time.TimeScales;
23  
24  import java.util.function.Function;
25  
26  /**
27   * Container for data contained in a NavIC navigation message.
28   * @param <T> type of the field elements
29   * @author Luc Maisonobe
30   * @since 13.0
31   */
32  public class FieldNavicL1NvNavigationMessage<T extends CalculusFieldElement<T>>
33      extends FieldAbstractNavigationMessage<T, NavICL1NvNavigationMessage> {
34  
35      /** Reference signal flag. */
36      private final int referenceSignalFlag;
37  
38      /** User Range Accuracy Index.
39       * @since 14.0
40       */
41      private final int urai;
42  
43      /** L1 SPS health.
44       * @since 14.0
45       */
46      private final int l1SpsHealth;
47  
48      /** Estimated group delay differential TGD for S-L5 correction. */
49      private final T tgdSL5;
50  
51      /** Inter Signal Delay for S L1P. */
52      private final T iscSL1P;
53  
54      /** Inter Signal Delay for L1D L1P. */
55      private final T iscL1DL1P;
56  
57      /** Inter Signal Delay for L1P S. */
58      private final T iscL1PS;
59  
60      /** Inter Signal Delay for L1DS. */
61      private final T iscL1DS;
62  
63      /** Creates a new instance.
64       * @param angularVelocity     mean angular velocity of the Earth for the GNSS model
65       * @param weeksInCycle        number of weeks in the GNSS cycle
66       * @param timeScales          known time scales
67       * @param type                type (null if not a navigation message)
68       * @param prn                 PRN number of the satellite
69       * @param toe                 time of ephemeris (<em>must</em> be consistent with {@code orbit})
70       * @param orbit               Keplerian orbit in Earth-frozen frame
71       * @param nonKeplerian        15 non-Keplerian parameters (in the order given by {@link NonKeplerianDriversFactory}
72       * @param tgd                 group delay differential TGD for L1-L2 correction
73       * @param toc                 time of clock
74       * @param transmissionTime    transmission time
75       * @param referenceSignalFlag reference signal flag
76       * @param urai                User Range Accuracy Index
77       * @param l1SpsHealth         L1 SPS health
78       * @param tgdSL5              estimated group delay differential TGD for S-L5 correction
79       * @param iscSL1P             inter signal delay for S L1P
80       * @param iscL1DL1P           inter signal delay for L1D L1P
81       * @param iscL1PS             inter signal delay for L1P S
82       * @param iscL1DS             inter signal delay for L1D S
83       * @since 14.0
84       */
85      public FieldNavicL1NvNavigationMessage(final double angularVelocity, final int weeksInCycle,
86                                             final TimeScales timeScales, final String type, final int prn,
87                                             final FieldGNSSDate<T> toe, final FieldKeplerianOrbit<T> orbit,
88                                             final T[] nonKeplerian, final T tgd,
89                                             final FieldGNSSDate<T> toc, final FieldGNSSDate<T>  transmissionTime,
90                                             final int referenceSignalFlag,
91                                             final int urai, final int l1SpsHealth,
92                                             final T tgdSL5,
93                                             final T iscSL1P, final T iscL1DL1P,
94                                             final T iscL1PS, final T iscL1DS) {
95          super(angularVelocity, weeksInCycle, timeScales, type, prn, toe, orbit, nonKeplerian,
96                tgd, toc, transmissionTime);
97          this.referenceSignalFlag = referenceSignalFlag;
98          this.urai                = urai;
99          this.l1SpsHealth         = l1SpsHealth;
100         this.tgdSL5              = tgdSL5;
101         this.iscSL1P             = iscSL1P;
102         this.iscL1DL1P           = iscL1DL1P;
103         this.iscL1PS             = iscL1PS;
104         this.iscL1DS             = iscL1DS;
105     }
106 
107     /** {@inheritDoc} */
108     @Override
109     public NavICL1NvNavigationMessage toNonField() {
110         return new NavICL1NvNavigationMessage(this);
111     }
112 
113     /** {@inheritDoc} */
114     @Override
115     public <U extends CalculusFieldElement<U>>
116         FieldNavicL1NvNavigationMessage<U> toField(final FieldKeplerianOrbit<U> orbit, final U[] nonKeplerian, final Function<T, U> converter) {
117         return new FieldNavicL1NvNavigationMessage<>(getAngularVelocity(), getWeeksInCycle(), getTimeScales(),
118                                                      getType(), getPrn(),
119                                                      new FieldGNSSDate<>(orbit.getDate().getField(),
120                                                                          getTimeOfEphemeris().getGnssDate()),
121                                                      orbit, nonKeplerian,
122                                                      converter.apply(getTgd()),
123                                                      new FieldGNSSDate<>(orbit.getDate().getField(),
124                                                                          getTimeOfClock().getGnssDate()),
125                                                      new FieldGNSSDate<>(orbit.getDate().getField(),
126                                                                            getTransmissionTime().getGnssDate()),
127                                                      getReferenceSignalFlag(),
128                                                      getUrai(), getL1SpsHealth(),
129                                                      converter.apply(getTGDSL5()),
130                                                      converter.apply(getIscSL1P()),
131                                                      converter.apply(getIscL1DL1P()),
132                                                      converter.apply(getIscL1PS()),
133                                                      converter.apply(getIscL1DS()));
134     }
135 
136     /** Get reference signal flag.
137      * @return reference signal flag
138      */
139     public int getReferenceSignalFlag() {
140         return referenceSignalFlag;
141     }
142 
143     /** Get User Range Accuracy Index.
144      * @return User Range Accuracy Index
145      * @since 14.0
146      */
147     public int getUrai() {
148         return urai;
149     }
150 
151     /** Get L1 SPS health.
152      * @return L1 SPS health
153      * @since 14.0
154      */
155     public int getL1SpsHealth() {
156         return l1SpsHealth;
157     }
158 
159     /**
160      * Set the estimated group delay differential TGD for S-L5 correction.
161      * @return estimated group delay differential TGD for S-L3 correction (s)
162      */
163     public T getTGDSL5() {
164         return tgdSL5;
165     }
166 
167     /**
168      * Getter for inter Signal Delay for S L1P.
169      * @return inter signal delay
170      */
171     public T getIscSL1P() {
172         return iscSL1P;
173     }
174 
175     /**
176      * Getter for inter Signal Delay for L1D L1P.
177      * @return inter signal delay
178      */
179     public T getIscL1DL1P() {
180         return iscL1DL1P;
181     }
182 
183     /**
184      * Getter for inter Signal Delay for L1P S.
185      * @return inter signal delay
186      */
187     public T getIscL1PS() {
188         return iscL1PS;
189     }
190 
191     /**
192      * Getter for inter Signal Delay for L1D S.
193      * @return inter signal delay
194      */
195     public T getIscL1DS() {
196         return iscL1DS;
197     }
198 
199 }