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