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.frames.Frame;
21 import org.orekit.orbits.FieldKeplerianOrbit;
22 import org.orekit.orbits.KeplerianOrbit;
23 import org.orekit.time.FieldGNSSDate;
24 import org.orekit.time.GNSSDate;
25 import org.orekit.time.TimeScales;
26
27 import java.util.function.DoubleFunction;
28
29 /**
30 * Container for data contained in a NavIC navigation message.
31 * @author Luc Maisonobe
32 * @since 13.0
33 */
34 public class NavICL1NvNavigationMessage extends AbstractNavigationMessage<NavICL1NvNavigationMessage> {
35
36 /** Message type.
37 * @since 14.0
38 */
39 public static final String L1NV = "L1NV";
40
41 /** Reference signal flag. */
42 private final int referenceSignalFlag;
43
44 /** User Range Accuracy Index.
45 * @since 14.0
46 */
47 private final int urai;
48
49 /** L1 SPS health.
50 * @since 14.0
51 */
52 private final int l1SpsHealth;
53
54 /** Estimated group delay differential TGD for S-L5 correction. */
55 private final double tgdSL5;
56
57 /** Inter Signal Delay for S L1P. */
58 private final double iscSL1P;
59
60 /** Inter Signal Delay for L1D L1P. */
61 private final double iscL1DL1P;
62
63 /** Inter Signal Delay for L1P S. */
64 private final double iscL1PS;
65
66 /** Inter Signal Delay for L1D S. */
67 private final double iscL1DS;
68
69 /** Constructor.
70 * @param timeScales known time scales
71 * @param type message type
72 * @param prn PRN number of the satellite
73 * @param toe time of ephemeris (<em>must</em> be consistent with {@code orbit})
74 * @param orbit Keplerian orbit in Earth-frozen frame
75 * @param aDot change rate in semi-major axis (m/s)
76 * @param deltaN0 delta of satellite mean motion
77 * @param deltaN0Dot change rate in Δn₀
78 * @param iDot inclination rate (rad/s)
79 * @param omegaDot rate of right ascension (rad/s)
80 * @param cuc amplitude of the cosine harmonic correction term to the argument of latitude
81 * @param cus amplitude of the sine harmonic correction term to the argument of latitude
82 * @param crc amplitude of the cosine harmonic correction term to the orbit radius
83 * @param crs amplitude of the sine harmonic correction term to the orbit radius
84 * @param cic amplitude of the cosine harmonic correction term to the inclination
85 * @param cis amplitude of the sine harmonic correction term to the inclination
86 * @param af0 zero-th order clock correction (s)
87 * @param af1 first order clock correction (s/s)
88 * @param af2 second order clock correction (s/s²)
89 * @param tgd group delay differential TGD for L1-L2 correction
90 * @param toc time of clock
91 * @param transmissionTime transmission time
92 * @param referenceSignalFlag reference signal flag
93 * @param urai User Range Accuracy Index
94 * @param l1SpsHealth L1 SPS health
95 * @param tgdSL5 estimated group delay differential TGD for S-L5 correction
96 * @param iscSL1P inter signal delay for S L1P
97 * @param iscL1DL1P inter signal delay for L1D L1P
98 * @param iscL1PS inter signal delay for L1P S
99 * @param iscL1DS inter signal delay for L1D S
100 */
101 public NavICL1NvNavigationMessage(final TimeScales timeScales, final String type,
102 final int prn, final GNSSDate toe, final KeplerianOrbit orbit,
103 final double aDot, final double deltaN0, final double deltaN0Dot,
104 final double iDot, final double omegaDot,
105 final double cuc, final double cus,
106 final double crc, final double crs,
107 final double cic, final double cis,
108 final double af0, final double af1, final double af2,
109 final double tgd, final GNSSDate toc, final GNSSDate transmissionTime,
110 final int referenceSignalFlag,
111 final int urai, final int l1SpsHealth,
112 final double tgdSL5,
113 final double iscSL1P, final double iscL1DL1P,
114 final double iscL1PS, final double iscL1DS) {
115 super(GNSSConstants.NAVIC_AV, GNSSConstants.NAVIC_WEEK_NB,
116 timeScales, type, prn, toe, orbit,
117 aDot, deltaN0, deltaN0Dot, iDot, omegaDot, cuc, cus, crc, crs, cic, cis,
118 af0, af1, af2, tgd, toc, transmissionTime);
119 this.referenceSignalFlag = referenceSignalFlag;
120 this.urai = urai;
121 this.l1SpsHealth = l1SpsHealth;
122 this.tgdSL5 = tgdSL5;
123 this.iscSL1P = iscSL1P;
124 this.iscL1DL1P = iscL1DL1P;
125 this.iscL1PS = iscL1PS;
126 this.iscL1DS = iscL1DS;
127 }
128
129 /** Constructor from field instance.
130 * @param <T> type of the field elements
131 * @param original regular field instance
132 */
133 public <T extends CalculusFieldElement<T>> NavICL1NvNavigationMessage(final FieldNavicL1NvNavigationMessage<T> original) {
134 super(original);
135 referenceSignalFlag = original.getReferenceSignalFlag();
136 urai = original.getUrai();
137 l1SpsHealth = original.getL1SpsHealth();
138 tgdSL5 = original.getTGDSL5().getReal();
139 iscSL1P = original.getIscSL1P().getReal();
140 iscL1DL1P = original.getIscL1DL1P().getReal();
141 iscL1PS = original.getIscL1PS().getReal();
142 iscL1DS = original.getIscL1DS().getReal();
143 }
144
145 /** {@inheritDoc} */
146 @Override
147 public <T extends CalculusFieldElement<T>>
148 FieldNavicL1NvNavigationMessage<T> toField(final FieldKeplerianOrbit<T> orbit,
149 final T[] nonKeplerian,
150 final DoubleFunction<T> converter) {
151 return new FieldNavicL1NvNavigationMessage<>(getAngularVelocity(), getWeeksInCycle(), getTimeScales(),
152 getType(), getPrn(),
153 new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfEphemeris()),
154 orbit, nonKeplerian,
155 converter.apply(getTgd()),
156 new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfClock()),
157 new FieldGNSSDate<>(orbit.getDate().getField(), getTransmissionTime()),
158 getReferenceSignalFlag(),
159 getUrai(), getL1SpsHealth(),
160 converter.apply(getTGDSL5()),
161 converter.apply(getIscSL1P()),
162 converter.apply(getIscL1DL1P()),
163 converter.apply(getIscL1PS()),
164 converter.apply(getIscL1DS()));
165 }
166
167 /** Get the reference signal flag.
168 * @return reference signal flag
169 */
170 public int getReferenceSignalFlag() {
171 return referenceSignalFlag;
172 }
173
174 /** Get User Range Accuracy Index.
175 * @return User Range Accuracy Index
176 * @since 14.0
177 */
178 public int getUrai() {
179 return urai;
180 }
181
182 /** Get L1 SPS health.
183 * @return L1 SPS health
184 * @since 14.0
185 */
186 public int getL1SpsHealth() {
187 return l1SpsHealth;
188 }
189
190 /** Get the estimated group delay differential TGD for S-L5 correction.
191 * @return estimated group delay differential TGD for S-L3 correction (s)
192 */
193 public double getTGDSL5() {
194 return tgdSL5;
195 }
196
197 /** Get the inter Signal Delay for S L1P.
198 * @return inter signal delay
199 */
200 public double getIscSL1P() {
201 return iscSL1P;
202 }
203
204 /** Get the inter Signal Delay for L1D L1P.
205 * @return inter signal delay
206 */
207 public double getIscL1DL1P() {
208 return iscL1DL1P;
209 }
210
211 /** Get the inter Signal Delay for L1P S.
212 * @return inter signal delay
213 */
214 public double getIscL1PS() {
215 return iscL1PS;
216 }
217
218 /** Get the inter Signal Delay for L1D S.
219 * @return inter signal delay
220 */
221 public double getIscL1DS() {
222 return iscL1DS;
223 }
224
225 /** {@inheritDoc} */
226 @Override
227 public NavICL1NvNavigationMessageFactory baseFactory(final Frame inertial, final Frame bodyFixed) {
228 return new NavICL1NvNavigationMessageFactory(getTimeScales(), getTimeOfEphemeris().getSystem(), getType(),
229 inertial, bodyFixed);
230 }
231
232 }