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.files.rinex.navigation.parsers.ephemeris;
18
19 import org.hipparchus.util.FastMath;
20 import org.orekit.files.rinex.navigation.RinexNavigation;
21 import org.orekit.files.rinex.navigation.parsers.ParseInfo;
22 import org.orekit.propagation.analytical.gnss.data.NavICLegacyNavigationMessage;
23 import org.orekit.utils.units.Unit;
24
25 /** Parser for NavIC legacy.
26 * @author Bryan Cazabonne
27 * @author Luc Maisonobe
28 * @since 14.0
29 */
30 public class NavICLnavParser extends LegacyNavigationParser<NavICLegacyNavigationMessage> {
31
32 /** URA index to URA mapping (table 23 of NavIC ICD). */
33 // CHECKSTYLE: stop Indentation check
34 public static final double[] NAVIC_URA = {
35 2.40, 3.40, 4.85, 6.85,
36 9.65, 13.65, 24.00, 48.00,
37 96.00, 192.00, 384.00, 768.00,
38 1536.00, 3072.00, 6144.00, Double.NaN
39 };
40 // CHECKSTYLE: resume Indentation check
41
42 /** Simple constructor.
43 * @param parseInfo container for parsing data
44 * @param message container for navigation message
45 */
46 public NavICLnavParser(final ParseInfo parseInfo, final NavICLegacyNavigationMessage message) {
47 super(parseInfo, message);
48 }
49
50 /** {@inheritDoc} */
51 @Override
52 public void parseLine00() {
53 final ParseInfo parseInfo = getParseInfo();
54 parseSvEpochSvClockLine(parseInfo.getTimeScales().getNavIC(), parseInfo, getMessage());
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 public void parseLine01() {
60 super.parseLine01();
61 // for NavIC legacy, Issue Of Data applies to both clock and ephemeris
62 final NavICLegacyNavigationMessage message = getMessage();
63 message.setIODC(message.getIODE());
64 }
65
66 /** {@inheritDoc} */
67 @Override
68 public void parseLine06() {
69 super.parseLine06();
70
71 // for NavIC legacy, the User Range Accurary is provided as an index in a table
72 // the base class implementation just parsed it as a double, we need to fix it
73 final NavICLegacyNavigationMessage message = getMessage();
74 final int index = (int) FastMath.rint(message.getSvAccuracy());
75 message.setSvAccuracy(NAVIC_URA[FastMath.min(index, NAVIC_URA.length - 1)]);
76
77 }
78
79 /** {@inheritDoc} */
80 @Override
81 public void parseLine07() {
82 final ParseInfo parseInfo = getParseInfo();
83 final NavICLegacyNavigationMessage message = getMessage();
84 message.setTransmissionTime(parseInfo.parseDouble1(Unit.SECOND));
85 // there is no fit interval in NavIC L message
86 parseInfo.closePendingRecord();
87 }
88
89 /** {@inheritDoc} */
90 @Override
91 public void closeRecord(final RinexNavigation file) {
92 file.addNavICLegacyNavigationMessage(getMessage());
93 }
94
95 }