1 /* Copyright 2002-2025 CS GROUP
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 import org.orekit.gnss.SatelliteSystem;
22 import org.orekit.time.TimeScales;
23
24 /**
25 * Container for data contained in a BeiDou navigation message.
26 * @author Bryan Cazabonne
27 * @since 11.0
28 */
29 public class BeidouLegacyNavigationMessage extends AbstractNavigationMessage<BeidouLegacyNavigationMessage> {
30
31 /** Identifier for message type. */
32 public static final String D1 = "D1";
33
34 /** Identifier for message type. */
35 public static final String D2 = "D2";
36
37 /** Age of Data, Ephemeris. */
38 private int aode;
39
40 /** Age of Data, Clock. */
41 private int aodc;
42
43 /** Health identifier.
44 * @since 14.0
45 */
46 private int satH1;
47
48 /** B1/B3 Group Delay Differential (s). */
49 private double tgd1;
50
51 /** B2/B3 Group Delay Differential (s). */
52 private double tgd2;
53
54 /** The user SV accuracy (m). */
55 private double svAccuracy;
56
57 /** Constructor.
58 * @param timeScales known time scales
59 * @param system satellite system to consider for interpreting week number
60 * (may be different from real system, for example in Rinex nav, weeks
61 * are always according to GPS)
62 * @param type message type
63 */
64 public BeidouLegacyNavigationMessage(final TimeScales timeScales,
65 final SatelliteSystem system,
66 final String type) {
67 super(GNSSConstants.BEIDOU_MU, GNSSConstants.BEIDOU_AV, GNSSConstants.BEIDOU_WEEK_NB,
68 timeScales, system, type);
69 }
70
71 /** Constructor from field instance.
72 * @param <T> type of the field elements
73 * @param original regular field instance
74 */
75 public <T extends CalculusFieldElement<T>> BeidouLegacyNavigationMessage(final FieldBeidouLegacyNavigationMessage<T> original) {
76 super(original);
77 setAODE(original.getAODE());
78 setAODC(original.getAODC());
79 setTGD1(original.getTGD1().getReal());
80 setTGD2(original.getTGD2().getReal());
81 setSvAccuracy(original.getSvAccuracy().getReal());
82 setSatH1(original.getSatH1());
83 }
84
85 /** {@inheritDoc} */
86 @SuppressWarnings("unchecked")
87 @Override
88 public <T extends CalculusFieldElement<T>, F extends FieldGnssOrbitalElements<T, BeidouLegacyNavigationMessage>>
89 F toField(final Field<T> field) {
90 return (F) new FieldBeidouLegacyNavigationMessage<>(field, this);
91 }
92
93 /**
94 * Getter for the Age Of Data Clock (AODC).
95 * @return the Age Of Data Clock (AODC)
96 */
97 public int getAODC() {
98 return aodc;
99 }
100
101 /**
102 * Setter for the age of data clock.
103 * @param aod the age of data to set
104 */
105 public void setAODC(final double aod) {
106 // The value is given as a floating number in the navigation message
107 this.aodc = (int) aod;
108 }
109
110 /**
111 * Getter for the Age Of Data Ephemeris (AODE).
112 * @return the Age Of Data Ephemeris (AODE)
113 */
114 public int getAODE() {
115 return aode;
116 }
117
118 /**
119 * Setter for the age of data ephemeris.
120 * @param aod the age of data to set
121 */
122 public void setAODE(final double aod) {
123 // The value is given as a floating number in the navigation message
124 this.aode = (int) aod;
125 }
126
127 /**
128 * Getter for the estimated group delay differential TGD1 for B1I signal.
129 * @return the estimated group delay differential TGD1 for B1I signal (s)
130 */
131 public double getTGD1() {
132 return tgd1;
133 }
134
135 /**
136 * Setter for the B1/B3 Group Delay Differential (s).
137 * @param tgd the group delay differential to set
138 */
139 public void setTGD1(final double tgd) {
140 this.tgd1 = tgd;
141 }
142
143 /**
144 * Getter for the estimated group delay differential TGD for B2I signal.
145 * @return the estimated group delay differential TGD2 for B2I signal (s)
146 */
147 public double getTGD2() {
148 return tgd2;
149 }
150
151 /**
152 * Setter for the B2/B3 Group Delay Differential (s).
153 * @param tgd the group delay differential to set
154 */
155 public void setTGD2(final double tgd) {
156 this.tgd2 = tgd;
157 }
158
159 /**
160 * Getter for the user SV accuray (meters).
161 * @return the user SV accuracy
162 */
163 public double getSvAccuracy() {
164 return svAccuracy;
165 }
166
167 /**
168 * Setter for the user SV accuracy.
169 * @param svAccuracy the value to set
170 */
171 public void setSvAccuracy(final double svAccuracy) {
172 this.svAccuracy = svAccuracy;
173 }
174
175 /** Get the health identifier.
176 * @return health identifier
177 * @since 14.0
178 */
179 public int getSatH1() {
180 return satH1;
181 }
182
183 /** Set the health identifier.
184 * @param satH1 health identifier
185 * @since 14.0
186 */
187 public void setSatH1(final int satH1) {
188 this.satH1 = satH1;
189 }
190
191 }