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