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.propagation.analytical.gnss.data;
18  
19  import org.orekit.annotation.DefaultDataContext;
20  import org.orekit.attitudes.AttitudeProvider;
21  import org.orekit.data.DataContext;
22  import org.orekit.frames.Frame;
23  import org.orekit.frames.Frames;
24  import org.orekit.propagation.analytical.gnss.SBASPropagator;
25  import org.orekit.propagation.analytical.gnss.SBASPropagatorBuilder;
26  
27  /**
28   * Container for data contained in a SBAS navigation message.
29   * @author Bryan Cazabonne
30   * @since 11.0
31   */
32  public class SBASNavigationMessage extends AbstractEphemerisMessage implements SBASOrbitalElements {
33  
34      /** Message type.
35       * @since 14.0
36       */
37      public static final String SBAS = "SBAS";
38  
39      /** Transmission time  of  message  (start  of  the message) in GPS seconds of the week. */
40      private double time;
41  
42      /** SV clock bias (s). */
43      private double aGf0;
44  
45      /** SV relative frequency. */
46      private double aGf1;
47  
48      /** User range accuracy (m). */
49      private double ura;
50  
51      /** Issue of data navigation (IODN). */
52      private int iodn;
53  
54      /** Constructor. */
55      public SBASNavigationMessage() {
56          // Nothing to do ...
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      public String getNavigationMessageType() {
62          return SBAS;
63      }
64  
65      /** {@inheritDoc} */
66      @Override
67      public String getNavigationMessageSubType() {
68          return null;
69      }
70  
71      /**
72       * Get the propagator corresponding to the navigation message.
73       <p>The attitude provider is set by default be aligned with the EME2000 frame.<br>
74       * The Earth gravity coefficient is set by default to the
75       *  {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
76       * The mass is set by default to the
77       *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
78       * The ECI frame is set by default to the
79       *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
80       * The ECEF frame is set by default to the
81       *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
82       * </p><p>
83       * This constructor uses the {@link DataContext#getDefault() default data context}
84       * </p>
85       * @return the propagator corresponding to the navigation message
86       * @see #getPropagator(Frames)
87       * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, double, double)
88       * @since 12.0
89       */
90      @DefaultDataContext
91      public SBASPropagator getPropagator() {
92          return new SBASPropagatorBuilder(this).build();
93      }
94  
95      /**
96       * Get the propagator corresponding to the navigation message.
97       * <p>The attitude provider is set by default be aligned with the EME2000 frame.<br>
98       * The Earth gravity coefficient is set by default to the
99       *  {@link org.orekit.propagation.analytical.gnss.data.GNSSConstants#SBAS_MU SBAS_MU}.<br>
100      * The mass is set by default to the
101      *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.<br>
102      * The ECI frame is set by default to the
103      *  {@link org.orekit.frames.Predefined#EME2000 EME2000 frame}.<br>
104      * The ECEF frame is set by default to the
105      *  {@link org.orekit.frames.Predefined#ITRF_CIO_CONV_2010_SIMPLE_EOP CIO/2010-based ITRF simple EOP}.
106      * </p>
107      * @param frames set of frames to use
108      * @return the propagator corresponding to the navigation message
109      * @see #getPropagator()
110      * @see #getPropagator(Frames, AttitudeProvider, Frame, Frame, double, double)
111      * @since 12.0
112      */
113     public SBASPropagator getPropagator(final Frames frames) {
114         return new SBASPropagatorBuilder(this, frames).build();
115     }
116 
117     /**
118      * Get the propagator corresponding to the navigation message.
119      * @param frames set of frames to use
120      * @param provider attitude provider
121      * @param inertial inertial frame, use to provide the propagated orbit
122      * @param bodyFixed body fixed frame, corresponding to the navigation message
123      * @param mass spacecraft mass in kg
124      * @param mu central attraction coefficient
125      * @return the propagator corresponding to the navigation message
126      * @see #getPropagator()
127      * @see #getPropagator(Frames)
128      * @since 12.0
129      */
130     public SBASPropagator getPropagator(final Frames frames, final AttitudeProvider provider,
131                                         final Frame inertial, final Frame bodyFixed,
132                                         final double mass, final double mu) {
133         return new SBASPropagatorBuilder(this, frames).attitudeProvider(provider)
134                                                       .eci(inertial)
135                                                       .ecef(bodyFixed)
136                                                       .mass(mass)
137                                                       .mu(mu)
138                                                       .build();
139     }
140 
141     /** {@inheritDoc} */
142     @Override
143     public int getWeek() {
144         // No provided by the SBAS navigation message
145         return 0;
146     }
147 
148     /** {@inheritDoc} */
149     @Override
150     public double getTime() {
151         return time;
152     }
153 
154     /**
155      * Setter for the reference time of the SBAS orbit in GPS seconds of the week.
156      * @param time the time to set
157      */
158     public void setTime(final double time) {
159         this.time = time;
160     }
161 
162     /** {@inheritDoc} */
163     @Override
164     public int getIODN() {
165         return iodn;
166     }
167 
168     /**
169      * Setter for the issue of data navigation.
170      * @param iod the issue of data to set
171      */
172     public void setIODN(final double iod) {
173         // The value is given as a floating number in the navigation message
174         this.iodn = (int) iod;
175     }
176 
177     /** {@inheritDoc} */
178     @Override
179     public double getAGf0() {
180         return aGf0;
181     }
182 
183     /**
184      * Setter for the SV clock bias.
185      * @param a0 the SV clock bias to set in seconds
186      */
187     public void setAGf0(final double a0) {
188         this.aGf0 = a0;
189     }
190 
191     /** {@inheritDoc} */
192     @Override
193     public double getAGf1() {
194         return aGf1;
195     }
196 
197     /**
198      * Setter for the SV relative frequency.
199      * @param a1 the SV relative frequency to set
200      */
201     public void setAGf1(final double a1) {
202         this.aGf1 = a1;
203     }
204 
205 
206     /**
207      * Getter for the user range accuray (meters).
208      * @return the user range accuracy
209      */
210     public double getURA() {
211         return ura;
212     }
213 
214     /**
215      * Setter for the user range accuracy.
216      * @param accuracy the value to set
217      */
218     public void setURA(final double accuracy) {
219         this.ura = accuracy;
220     }
221 
222 }