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 * This class holds a GPS almanac as read from SEM or YUMA files.
26 *
27 * <p>Depending on the source (SEM or YUMA), some fields may be filled in or not.
28 * An almanac read from a YUMA file doesn't hold SVN number, average URA and satellite
29 * configuration.</p>
30 *
31 * @author Pascal Parraud
32 * @since 8.0
33 *
34 */
35 public class GPSAlmanac extends AbstractAlmanac<GPSAlmanac> {
36
37 /** Source of the almanac. */
38 private String src;
39
40 /** SVN number. */
41 private int svn;
42
43 /** Health status. */
44 private int health;
45
46 /** Average URA. */
47 private int ura;
48
49 /** Satellite configuration. */
50 private int config;
51
52 /**
53 * Constructor.
54 * @param timeScales known time scales
55 * @param system satellite system to consider for interpreting week number
56 * (may be different from real system, for example in Rinex nav, weeks
57 * are always according to GPS)
58 */
59 public GPSAlmanac(final TimeScales timeScales, final SatelliteSystem system) {
60 super(GNSSConstants.GPS_MU, GNSSConstants.GPS_AV, GNSSConstants.GPS_WEEK_NB, timeScales, system);
61 }
62
63 /** Constructor from field instance.
64 * @param <T> type of the field elements
65 * @param original regular field instance
66 */
67 public <T extends CalculusFieldElement<T>> GPSAlmanac(final FieldGPSAlmanac<T> original) {
68 super(original);
69 setSource(original.getSource());
70 setSVN(original.getSVN());
71 setHealth(original.getHealth());
72 setURA(original.getURA());
73 setSatConfiguration(original.getSatConfiguration());
74 }
75
76 /** {@inheritDoc} */
77 @SuppressWarnings("unchecked")
78 @Override
79 public <T extends CalculusFieldElement<T>, F extends FieldGnssOrbitalElements<T, GPSAlmanac>>
80 F toField(final Field<T> field) {
81 return (F) new FieldGPSAlmanac<>(field, this);
82 }
83
84 /**
85 * Setter for the Square Root of Semi-Major Axis (m^1/2).
86 * <p>
87 * In addition, this method set the value of the Semi-Major Axis.
88 * </p>
89 * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
90 */
91 public void setSqrtA(final double sqrtA) {
92 setSma(sqrtA * sqrtA);
93 }
94
95 /**
96 * Gets the source of this GPS almanac.
97 * <p>Sources can be SEM or YUMA, when the almanac is read from a file.</p>
98 *
99 * @return the source of this GPS almanac
100 */
101 public String getSource() {
102 return src;
103 }
104
105 /**
106 * Sets the source of this GPS almanac.
107 *
108 * @param source the source of this GPS almanac
109 */
110 public void setSource(final String source) {
111 this.src = source;
112 }
113
114 /**
115 * Gets the satellite "SVN" reference number.
116 *
117 * @return the satellite "SVN" reference number
118 */
119 public int getSVN() {
120 return svn;
121 }
122
123 /**
124 * Sets the "SVN" reference number.
125 *
126 * @param svnNumber the number to set
127 */
128 public void setSVN(final int svnNumber) {
129 this.svn = svnNumber;
130 }
131
132 /**
133 * Gets the Health status.
134 *
135 * @return the Health status
136 */
137 public int getHealth() {
138 return health;
139 }
140
141 /**
142 * Sets the health status.
143 *
144 * @param health the health status to set
145 */
146 public void setHealth(final int health) {
147 this.health = health;
148 }
149
150 /**
151 * Gets the average URA number.
152 *
153 * @return the average URA number
154 */
155 public int getURA() {
156 return ura;
157 }
158
159 /**
160 * Sets the average URA number.
161 *
162 * @param uraNumber the URA number to set
163 */
164 public void setURA(final int uraNumber) {
165 this.ura = uraNumber;
166 }
167
168 /**
169 * Gets the satellite configuration.
170 *
171 * @return the satellite configuration
172 */
173 public int getSatConfiguration() {
174 return config;
175 }
176
177 /**
178 * Sets the satellite configuration.
179 *
180 * @param satConfiguration the satellite configuration to set
181 */
182 public void setSatConfiguration(final int satConfiguration) {
183 this.config = satConfiguration;
184 }
185
186 }