1   /* Copyright 2002-2026 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.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 an NavIC navigation message.
31   * @author Bryan Cazabonne
32   * @since 11.0
33   */
34  public class NavICLegacyNavigationMessage
35      extends LegacyNavigationMessage<NavICLegacyNavigationMessage>  {
36  
37      /** Message type.
38       * @since 14.0
39       */
40      public static final String LNAV = "LNAV";
41  
42          /** Constructor.
43       * @param timeScales       known time scales
44       * @param type             message type
45       * @param prn              PRN number of the satellite
46       * @param toe              time of ephemeris(<em>must</em> be consistent with {@code orbit})
47       * @param orbit            Keplerian orbit in Earth-frozen frame
48       * @param aDot             change rate in semi-major axis (m/s)
49       * @param deltaN0          delta of satellite mean motion
50       * @param deltaN0Dot       change rate in Δn₀
51       * @param iDot             inclination rate (rad/s)
52       * @param omegaDot         rate of right ascension (rad/s)
53       * @param cuc              amplitude of the cosine harmonic correction term to the argument of latitude
54       * @param cus              amplitude of the sine harmonic correction term to the argument of latitude
55       * @param crc              amplitude of the cosine harmonic correction term to the orbit radius
56       * @param crs              amplitude of the sine harmonic correction term to the orbit radius
57       * @param cic              amplitude of the cosine harmonic correction term to the inclination
58       * @param cis              amplitude of the sine harmonic correction term to the inclination
59       * @param af0              zero-th order clock correction (s)
60       * @param af1              first order clock correction (s/s)
61       * @param af2              second order clock correction (s/s²)
62       * @param tgd              group delay differential TGD for L1-L2 correctio
63       * @param toc              time of clock
64       * @param transmissionTime transmission time
65       * @param iode             issue of data, ephemeris
66       * @param iodc             issue of data, clock
67       * @param svAccuracy       user SV accuracy (m)
68       * @param svHealth         satellite health status
69       * @param fitInterval      fit interval
70       * @param l2Codes          codes on L2 channel
71       * @param l2PFlags         L2 P data flags.
72       */
73      public NavICLegacyNavigationMessage(final TimeScales timeScales, final String type,
74                                          final int prn, final GNSSDate toe, final KeplerianOrbit orbit,
75                                          final double aDot, final double deltaN0, final double deltaN0Dot,
76                                          final double iDot, final double omegaDot,
77                                          final double cuc, final double cus,
78                                          final double crc, final double crs,
79                                          final double cic, final double cis,
80                                          final double af0, final double af1, final double af2,
81                                          final double tgd, final GNSSDate toc, final GNSSDate  transmissionTime,
82                                          final int iode, final int iodc, final double svAccuracy,
83                                          final int svHealth, final int fitInterval,
84                                          final int l2Codes, final int l2PFlags) {
85          super(GNSSConstants.NAVIC_AV, GNSSConstants.NAVIC_WEEK_NB,
86                timeScales, type, prn, toe, orbit,
87                aDot, deltaN0, deltaN0Dot, iDot, omegaDot, cuc, cus, crc, crs, cic, cis,
88                af0, af1, af2, tgd, toc, transmissionTime,
89                iode, iodc, svAccuracy, svHealth, fitInterval, l2Codes, l2PFlags);
90      }
91  
92      /** Constructor from field instance.
93       * @param <T> type of the field elements
94       * @param original regular field instance
95       */
96      public <T extends CalculusFieldElement<T>> NavICLegacyNavigationMessage(final FieldNavicLegacyNavigationMessage<T> original) {
97          super(original);
98      }
99  
100     /** {@inheritDoc} */
101     @Override
102     public <T extends CalculusFieldElement<T>>
103         FieldNavicLegacyNavigationMessage<T> toField(final FieldKeplerianOrbit<T> orbit,
104                                                      final T[] nonKeplerian,
105                                                      final DoubleFunction<T> converter) {
106         return new FieldNavicLegacyNavigationMessage<>(getAngularVelocity(), getWeeksInCycle(), getTimeScales(),
107                                                        getType(), getPrn(),
108                                                        new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfEphemeris()),
109                                                        orbit, nonKeplerian,
110                                                        converter.apply(getTgd()),
111                                                        new FieldGNSSDate<>(orbit.getDate().getField(), getTimeOfClock()),
112                                                        new FieldGNSSDate<>(orbit.getDate().getField(), getTransmissionTime()),
113                                                        getIODE(), getIODC(),
114                                                        converter.apply(getSvAccuracy()),
115                                                        getSvHealth(), getFitInterval(),
116                                                        getL2Codes(), getL2PFlags());
117     }
118 
119     /** {@inheritDoc} */
120     @Override
121     public NavICLegacyNavigationMessageFactory baseFactory(final Frame inertial, final Frame bodyFixed) {
122         return new NavICLegacyNavigationMessageFactory(getTimeScales(), getTimeOfEphemeris().getSystem(), getType(),
123                                                        inertial, bodyFixed);
124     }
125 
126 }