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 QZSS navigation message.
31 * @author Luc Maisonobe
32 * @since 12.0
33 */
34 public class QZSSCivilianNavigationMessage extends CivilianNavigationMessage<QZSSCivilianNavigationMessage> {
35
36 /** Message type.
37 * @since 14.0
38 */
39 public static final String CNAV = "CNAV";
40
41 /** Message type.
42 * @since 14.0
43 */
44 public static final String CNV2 = "CNV2";
45
46 /** Constructor.
47 * @param cnv2 indicator for CNV2 messages
48 * @param timeScales known time scales
49 * @param type message type
50 * @param prn PRN number of the satellite
51 * @param toe time of ephemeris (<em>must</em> be consistent with {@code orbit})
52 * @param orbit Keplerian orbit in Earth-frozen frame
53 * @param aDot change rate in semi-major axis (m/s)
54 * @param deltaN0 delta of satellite mean motion
55 * @param deltaN0Dot change rate in Δn₀
56 * @param iDot inclination rate (rad/s)
57 * @param omegaDot rate of right ascension (rad/s)
58 * @param cuc amplitude of the cosine harmonic correction term to the argument of latitude
59 * @param cus amplitude of the sine harmonic correction term to the argument of latitude
60 * @param crc amplitude of the cosine harmonic correction term to the orbit radius
61 * @param crs amplitude of the sine harmonic correction term to the orbit radius
62 * @param cic amplitude of the cosine harmonic correction term to the inclination
63 * @param cis amplitude of the sine harmonic correction term to the inclination
64 * @param af0 zero-th order clock correction (s)
65 * @param af1 first order clock correction (s/s)
66 * @param af2 second order clock correction (s/s²)
67 * @param tgd group delay differential TGD for L1-L2 correction
68 * @param toc time of clock
69 * @param transmissionTime transmission time
70 * @param svAccuracy user SV accuracy (m)
71 * @param svHealth satellite health status
72 * @param iscL1CA inter signal delay for L1 C/A
73 * @param iscL1CD inter signal delay for L1 CD
74 * @param iscL1CP inter signal delay for L1 CP
75 * @param iscL2C inter signal delay for L2 C
76 * @param iscL5I5 inter signal delay for L5I
77 * @param iscL5Q5 inter signal delay for L5Q
78 * @param uraiEd elevation-dependent user range accuracy
79 * @param uraiNed0 term 0 of non-elevation-dependent user range accuracy
80 * @param uraiNed1 term 1 of non-elevation-dependent user range accuracy
81 * @param uraiNed2 term 2 of non-elevation-dependent user range accuracy
82 * @param flags flags
83 */
84 public QZSSCivilianNavigationMessage(final boolean cnv2,
85 final TimeScales timeScales, final String type,
86 final int prn, final GNSSDate toe, final KeplerianOrbit orbit,
87 final double aDot,
88 final double deltaN0, final double deltaN0Dot,
89 final double iDot, final double omegaDot,
90 final double cuc, final double cus,
91 final double crc, final double crs,
92 final double cic, final double cis,
93 final double af0, final double af1, final double af2,
94 final double tgd, final GNSSDate toc, final GNSSDate transmissionTime,
95 final double svAccuracy, final int svHealth,
96 final double iscL1CA, final double iscL1CD, final double iscL1CP,
97 final double iscL2C, final double iscL5I5, final double iscL5Q5,
98 final int uraiEd, final int uraiNed0, final int uraiNed1, final int uraiNed2,
99 final int flags) {
100 super(cnv2, GNSSConstants.QZSS_AV, GNSSConstants.QZSS_WEEK_NB,
101 timeScales, type, prn, toe, orbit,
102 aDot, deltaN0, deltaN0Dot, iDot, omegaDot, cuc, cus, crc, crs, cic, cis,
103 af0, af1, af2, tgd, toc, transmissionTime,
104 svAccuracy, svHealth, iscL1CA, iscL1CD, iscL1CP, iscL2C, iscL5I5, iscL5Q5,
105 uraiEd, uraiNed0, uraiNed1, uraiNed2, flags);
106 }
107
108 /** Constructor from field instance.
109 * @param <T> type of the field elements
110 * @param original regular field instance
111 */
112 public <T extends CalculusFieldElement<T>> QZSSCivilianNavigationMessage(final FieldQZSSCivilianNavigationMessage<T> original) {
113 super(original);
114 }
115
116 /** {@inheritDoc} */
117 @Override
118 public <T extends CalculusFieldElement<T>>
119 FieldQZSSCivilianNavigationMessage<T> toField(final FieldKeplerianOrbit<T> orbit,
120 final T[] nonKeplerian,
121 final DoubleFunction<T> converter) {
122 return new FieldQZSSCivilianNavigationMessage<>(isCnv2(),
123 getAngularVelocity(), getWeeksInCycle(), getTimeScales(),
124 getType(), getPrn(),
125 new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfEphemeris()),
126 orbit, nonKeplerian,
127 converter.apply(getTgd()),
128 new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfClock()),
129 new FieldGNSSDate<>(orbit.getDate().getField(), getTransmissionTime()),
130 converter.apply(getSvAccuracy()),
131 getSvHealth(),
132 converter.apply(getIscL1CA()),
133 converter.apply(getIscL1CD()),
134 converter.apply(getIscL1CP()),
135 converter.apply(getIscL2C()),
136 converter.apply(getIscL5I5()),
137 converter.apply(getIscL5Q5()),
138 getUraiEd(), getUraiNed0(), getUraiNed1(), getUraiNed2(),
139 getFlags());
140 }
141
142 /** {@inheritDoc} */
143 @Override
144 public QZSSCivilianNavigationMessageFactory baseFactory(final Frame inertial, final Frame bodyFixed) {
145 return new QZSSCivilianNavigationMessageFactory(getTimeScales(), getTimeOfEphemeris().getSystem(), getType(),
146 inertial, bodyFixed, isCnv2());
147 }
148
149 }