1   /* Copyright 2022-2025 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.hipparchus.Field;
21  
22  import java.util.function.Function;
23  
24  /**
25   * Container for data contained in a Galileo navigation message.
26   * @param <T> type of the field elements
27   * @author Luc Maisonobe
28   * @since 13.0
29   */
30  public class FieldGalileoNavigationMessage<T extends CalculusFieldElement<T>>
31      extends FieldAbstractNavigationMessage<T, GalileoNavigationMessage> {
32  
33      /** Issue of Data of the navigation batch. */
34      private int iodNav;
35  
36      /** Data source. */
37      private int dataSource;
38  
39      /** E1/E5a broadcast group delay (s). */
40      private T bgbE1E5a;
41  
42      /** E5b/E1 broadcast group delay (s). */
43      private T bgdE5bE1;
44  
45      /** Signal in space accuracy. */
46      private T sisa;
47  
48      /** Satellite health status. */
49      private T svHealth;
50  
51      /** Constructor from non-field instance.
52       * @param field    field to which elements belong
53       * @param original regular non-field instance
54       */
55      public FieldGalileoNavigationMessage(final Field<T> field, final GalileoNavigationMessage original) {
56          super(field, original);
57          setIODNav(original.getIODNav());
58          setDataSource(original.getDataSource());
59          setBGDE1E5a(field.getZero().newInstance(original.getBGDE1E5a()));
60          setBGDE5bE1(field.getZero().newInstance(original.getBGDE5bE1()));
61          setSisa(field.getZero().newInstance(original.getSisa()));
62          setSvHealth(field.getZero().newInstance(original.getSvHealth()));
63      }
64  
65      /** Constructor from different field instance.
66       * @param <V> type of the old field elements
67       * @param original regular non-field instance
68       * @param converter for field elements
69       */
70      public <V extends CalculusFieldElement<V>> FieldGalileoNavigationMessage(final Function<V, T> converter,
71                                                                               final FieldGalileoNavigationMessage<V> original) {
72          super(converter, original);
73          setIODNav(original.getIODNav());
74          setDataSource(original.getDataSource());
75          setBGDE1E5a(converter.apply(original.getBGDE1E5a()));
76          setBGDE5bE1(converter.apply(original.getBGDE5bE1()));
77          setSisa(converter.apply(original.getSisa()));
78          setSvHealth(converter.apply(original.getSvHealth()));
79      }
80  
81      /** {@inheritDoc} */
82      @Override
83      public GalileoNavigationMessage toNonField() {
84          return new GalileoNavigationMessage(this);
85      }
86  
87      /** {@inheritDoc} */
88      @SuppressWarnings("unchecked")
89      @Override
90      public <U extends CalculusFieldElement<U>, G extends FieldGnssOrbitalElements<U, GalileoNavigationMessage>>
91          G changeField(final Function<T, U> converter) {
92          return (G) new FieldGalileoNavigationMessage<>(converter, this);
93      }
94  
95      /**
96       * Getter for the the Issue Of Data (IOD).
97       * @return the Issue Of Data (IOD)
98       */
99      public int getIODNav() {
100         return iodNav;
101     }
102 
103     /**
104      * Setter for the Issue of Data of the navigation batch.
105      * @param iod the IOD to set
106      */
107     public void setIODNav(final int iod) {
108         this.iodNav = iod;
109     }
110 
111     /**
112      * Getter for the the data source.
113      * @return the data source
114      */
115     public int getDataSource() {
116         return dataSource;
117     }
118 
119     /**
120      * Setter for the data source.
121      * @param dataSource data source
122      */
123     public void setDataSource(final int dataSource) {
124         this.dataSource = dataSource;
125     }
126 
127     /**
128      * Getter for the E1/E5a broadcast group delay.
129      * @return the E1/E5a broadcast group delay (s)
130      */
131     public T getBGDE1E5a() {
132         return bgbE1E5a;
133     }
134 
135     /**
136      * Setter for the E1/E5a broadcast group delay (s).
137      * @param bgd the E1/E5a broadcast group delay to set
138      */
139     public void setBGDE1E5a(final T bgd) {
140         this.bgbE1E5a = bgd;
141     }
142 
143     /**
144      * Setter for the E5b/E1 broadcast group delay (s).
145      * @param bgd the E5b/E1 broadcast group delay to set
146      */
147     public void setBGDE5bE1(final T bgd) {
148         this.bgdE5bE1 = bgd;
149     }
150 
151     /**
152      * Getter for the the Broadcast Group Delay E5b/E1.
153      * @return the Broadcast Group Delay E5b/E1 (s)
154      */
155     public T getBGDE5bE1() {
156         return bgdE5bE1;
157     }
158 
159     /**
160      * Getter for the signal in space accuracy (m).
161      * @return the signal in space accuracy
162      */
163     public T getSisa() {
164         return sisa;
165     }
166 
167     /**
168      * Setter for the signal in space accuracy.
169      * @param sisa the sisa to set
170      */
171     public void setSisa(final T sisa) {
172         this.sisa = sisa;
173     }
174 
175     /**
176      * Getter for the SV health status.
177      * @return the SV health status
178      */
179     public T getSvHealth() {
180         return svHealth;
181     }
182 
183     /**
184      * Setter for the SV health status.
185      * @param svHealth the SV health status to set
186      */
187     public void setSvHealth(final T svHealth) {
188         this.svHealth = svHealth;
189     }
190 
191 }