1   /* Copyright 2022-2026 Luc Maisonobe
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.orbits.FieldKeplerianOrbit;
21  import org.orekit.time.FieldGNSSDate;
22  import org.orekit.time.TimeScales;
23  
24  import java.util.function.Function;
25  
26  /**
27   * Container for data contained in a Galileo navigation message.
28   * @param <T> type of the field elements
29   * @author Luc Maisonobe
30   * @since 13.0
31   */
32  public class FieldGalileoNavigationMessage<T extends CalculusFieldElement<T>>
33      extends FieldAbstractNavigationMessage<T, GalileoNavigationMessage> {
34  
35      /** Issue of Data of the navigation batch. */
36      private final int iodNav;
37  
38      /** Data source. */
39      private final int dataSource;
40  
41      /** E1/E5a broadcast group delay (s). */
42      private final T bgdE1E5a;
43  
44      /** E5b/E1 broadcast group delay (s). */
45      private final T bgdE5bE1;
46  
47      /** Signal in space accuracy. */
48      private final T sisa;
49  
50      /** Satellite health status. */
51      private final T svHealth;
52  
53      /** Creates a new instance.
54       * @param angularVelocity  mean angular velocity of the Earth for the GNSS model
55       * @param weeksInCycle     number of weeks in the GNSS cycle
56       * @param timeScales       known time scales
57       * @param type             type (null if not a navigation message)
58       * @param prn              PRN number of the satellite
59       * @param toe              time of ephemeris (<em>must</em> be consistent with {@code orbit})
60       * @param orbit            Keplerian orbit in Earth-frozen frame
61       * @param nonKeplerian     15 non-Keplerian parameters (in the order given by {@link NonKeplerianDriversFactory}
62       * @param tgd              group delay differential TGD for L1-L2 correction
63       * @param toc              time of clock
64       * @param transmissionTime transmission time
65       * @param iodNav           issue of Data of the navigation batch
66       * @param dataSource       data source
67       * @param bgdE1E5a         E1/E5a broadcast group delay (s)
68       * @param bgdE5bE1         E5b/E1 broadcast group delay (s)
69       * @param sisa             signal in space accuracy
70       * @param svHealth         satellite health status
71       * @since 14.0
72       */
73      public FieldGalileoNavigationMessage(final double angularVelocity, final int weeksInCycle,
74                                           final TimeScales timeScales, final String type, final int prn,
75                                           final FieldGNSSDate<T> toe, final FieldKeplerianOrbit<T> orbit,
76                                           final T[] nonKeplerian, final T tgd,
77                                           final FieldGNSSDate<T> toc, final FieldGNSSDate<T>  transmissionTime,
78                                           final int iodNav, final int dataSource,
79                                           final T bgdE1E5a, final T bgdE5bE1,
80                                           final T sisa, final T svHealth) {
81          super(angularVelocity, weeksInCycle, timeScales, type, prn, toe, orbit, nonKeplerian,
82                tgd, toc, transmissionTime);
83          this.iodNav     = iodNav;
84          this.dataSource = dataSource;
85          this.bgdE1E5a   = bgdE1E5a;
86          this.bgdE5bE1   = bgdE5bE1;
87          this.sisa       = sisa;
88          this.svHealth   = svHealth;
89      }
90  
91      /** {@inheritDoc} */
92      @Override
93      public GalileoNavigationMessage toNonField() {
94          return new GalileoNavigationMessage(this);
95      }
96  
97      /** {@inheritDoc} */
98      @Override
99      public <U extends CalculusFieldElement<U>>
100         FieldGalileoNavigationMessage<U> toField(final FieldKeplerianOrbit<U> orbit,
101                                                  final U[] nonKeplerian,
102                                                  final Function<T, U> converter) {
103         return new FieldGalileoNavigationMessage<>(getAngularVelocity(), getWeeksInCycle(), getTimeScales(),
104                                                    getType(), getPrn(),
105                                                    new FieldGNSSDate<>(orbit.getDate().getField(),
106                                                                        getTimeOfEphemeris().getGnssDate()),
107                                                    orbit, nonKeplerian,
108                                                    converter.apply(getTgd()),
109                                                    new FieldGNSSDate<>(orbit.getDate().getField(),
110                                                                        getTimeOfClock().getGnssDate()),
111                                                    new FieldGNSSDate<>(orbit.getDate().getField(),
112                                                                        getTransmissionTime().getGnssDate()),
113                                                    getIODNav(), getDataSource(),
114                                                    converter.apply(getBGDE1E5a()),
115                                                    converter.apply(getBGDE5bE1()),
116                                                    converter.apply(getSisa()),
117                                                    converter.apply(getSvHealth()));
118     }
119 
120     /**
121      * Getter for the the Issue Of Data (IOD).
122      * @return the Issue Of Data (IOD)
123      */
124     public int getIODNav() {
125         return iodNav;
126     }
127 
128     /**
129      * Getter for the the data source.
130      * @return the data source
131      */
132     public int getDataSource() {
133         return dataSource;
134     }
135 
136     /**
137      * Getter for the E1/E5a broadcast group delay.
138      * @return the E1/E5a broadcast group delay (s)
139      */
140     public T getBGDE1E5a() {
141         return bgdE1E5a;
142     }
143 
144     /**
145      * Getter for the the Broadcast Group Delay E5b/E1.
146      * @return the Broadcast Group Delay E5b/E1 (s)
147      */
148     public T getBGDE5bE1() {
149         return bgdE5bE1;
150     }
151 
152     /**
153      * Getter for the signal in space accuracy (m).
154      * @return the signal in space accuracy
155      */
156     public T getSisa() {
157         return sisa;
158     }
159 
160     /**
161      * Getter for the SV health status.
162      * @return the SV health status
163      */
164     public T getSvHealth() {
165         return svHealth;
166     }
167 
168 }