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.hipparchus.CalculusFieldElement;
20  import org.hipparchus.Field;
21  import org.hipparchus.util.FastMath;
22  import org.orekit.gnss.SatelliteSystem;
23  import org.orekit.time.TimeScales;
24  
25  /**
26   * Class for Galileo almanac.
27   *
28   * @see "European GNSS (Galileo) Open Service, Signal In Space,
29   *      Interface Control Document, Table 75"
30   *
31   * @author Bryan Cazabonne
32   * @since 10.0
33   *
34   */
35  public class GalileoAlmanac extends AbstractAlmanac<GalileoAlmanac> {
36  
37      /** Nominal inclination (Ref: Galileo ICD - Table 75). */
38      private static final double I0 = FastMath.toRadians(56.0);
39  
40      /** Nominal semi-major axis in meters (Ref: Galileo ICD - Table 75). */
41      private static final double A0 = 29600000;
42  
43      /** Satellite E5a signal health status. */
44      private int healthE5a;
45  
46      /** Satellite E5b signal health status. */
47      private int healthE5b;
48  
49      /** Satellite E1-B/C signal health status. */
50      private int healthE1;
51  
52      /** Almanac Issue Of Data. */
53      private int iod;
54  
55      /**
56       * Build a new almanac.
57       * @param timeScales known time scales
58       * @param system     satellite system to consider for interpreting week number
59       *                   (may be different from real system, for example in Rinex nav, weeks
60       *                   are always according to GPS)
61       */
62      public GalileoAlmanac(final TimeScales timeScales, final SatelliteSystem system) {
63          super(GNSSConstants.GALILEO_MU, GNSSConstants.GALILEO_AV, GNSSConstants.GALILEO_WEEK_NB, timeScales, system);
64      }
65  
66      /** Constructor from field instance.
67       * @param <T> type of the field elements
68       * @param original regular field instance
69       */
70      public <T extends CalculusFieldElement<T>> GalileoAlmanac(final FieldGalileoAlmanac<T> original) {
71          super(original);
72          setHealthE5a(original.getHealthE5a());
73          setHealthE5b(original.getHealthE5b());
74          setHealthE1(original.getHealthE1());
75          setIOD(original.getIOD());
76      }
77  
78      /** {@inheritDoc} */
79      @SuppressWarnings("unchecked")
80      @Override
81      public <T extends CalculusFieldElement<T>, F extends FieldGnssOrbitalElements<T, GalileoAlmanac>>
82          F toField(final Field<T> field) {
83          return (F) new FieldGalileoAlmanac<>(field, this);
84      }
85  
86      /**
87       * Sets the difference between the square root of the semi-major axis
88       * and the square root of the nominal semi-major axis.
89       * <p>
90       * In addition, this method set the value of the Semi-Major Axis.
91       * </p>
92       * @param dsqa the value to set
93       */
94      public void setDeltaSqrtA(final double dsqa) {
95          final double sqrtA = dsqa + FastMath.sqrt(A0);
96          setSma(sqrtA * sqrtA);
97      }
98  
99      /**
100      * Sets the the correction of orbit reference inclination at reference time.
101      * <p>
102      * In addition, this method set the value of the reference inclination.
103      * </p>
104      * @param dinc correction of orbit reference inclination at reference time in radians
105      */
106     public void setDeltaInc(final double dinc) {
107         setI0(I0 + dinc);
108     }
109 
110     /**
111      * Gets the Issue of Data (IOD).
112      *
113      * @return the Issue Of Data
114      */
115     public int getIOD() {
116         return iod;
117     }
118 
119     /**
120      * Sets the Issue of Data (IOD).
121      *
122      * @param iodValue the value to set
123      */
124     public void setIOD(final int iodValue) {
125         this.iod = iodValue;
126     }
127 
128     /**
129      * Gets the E1-B/C signal health status.
130      *
131      * @return the E1-B/C signal health status
132      */
133     public int getHealthE1() {
134         return healthE1;
135     }
136 
137     /**
138      * Sets the E1-B/C signal health status.
139      *
140      * @param healthE1 health status to set
141      */
142     public void setHealthE1(final int healthE1) {
143         this.healthE1 = healthE1;
144     }
145 
146     /**
147      * Gets the E5a signal health status.
148      *
149      * @return the E5a signal health status
150      */
151     public int getHealthE5a() {
152         return healthE5a;
153     }
154 
155     /**
156      * Sets the E5a signal health status.
157      *
158      * @param healthE5a health status to set
159      */
160     public void setHealthE5a(final int healthE5a) {
161         this.healthE5a = healthE5a;
162     }
163 
164     /**
165      * Gets the E5b signal health status.
166      *
167      * @return the E5b signal health status
168      */
169     public int getHealthE5b() {
170         return healthE5b;
171     }
172 
173     /**
174      * Sets the E5b signal health status.
175      *
176      * @param healthE5b health status to set
177      */
178     public void setHealthE5b(final int healthE5b) {
179         this.healthE5b = healthE5b;
180     }
181 
182 }