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.orekit.gnss.SatelliteSystem;
22  import org.orekit.time.TimeScales;
23  
24  /**
25   * Class for BeiDou almanac.
26   *
27   * @see "BeiDou Navigation Satellite System, Signal In Space, Interface Control Document,
28   *      Version 2.1, Table 5-12"
29   *
30   * @author Bryan Cazabonne
31   * @since 10.0
32   *
33   */
34  public class BeidouAlmanac extends AbstractAlmanac<BeidouAlmanac> {
35  
36      /** Health status. */
37      private int health;
38  
39      /**
40       * Build a new almanac.
41       * @param timeScales known time scales
42       * @param system     satellite system to consider for interpreting week number
43       *                   (may be different from real system, for example in Rinex nav, weeks
44       *                   are always according to GPS)
45       */
46      public BeidouAlmanac(final TimeScales timeScales, final SatelliteSystem system) {
47          super(GNSSConstants.BEIDOU_MU, GNSSConstants.BEIDOU_AV, GNSSConstants.BEIDOU_WEEK_NB, timeScales, system);
48      }
49  
50      /** Constructor from field instance.
51       * @param <T> type of the field elements
52       * @param original regular field instance
53       */
54      public <T extends CalculusFieldElement<T>> BeidouAlmanac(final FieldBeidouAlmanac<T> original) {
55          super(original);
56          setHealth(original.getHealth());
57      }
58  
59      /** {@inheritDoc} */
60      @SuppressWarnings("unchecked")
61      @Override
62      public <T extends CalculusFieldElement<T>, F extends FieldGnssOrbitalElements<T, BeidouAlmanac>>
63          F toField(final Field<T> field) {
64          return (F) new FieldBeidouAlmanac<>(field, this);
65      }
66  
67      /**
68       * Sets the Square Root of Semi-Major Axis (√m).
69       * <p>
70       * In addition, this method set the value of the Semi-Major Axis.
71       * </p>
72       * @param sqrtA the Square Root of Semi-Major Axis (√m)
73       */
74      public void setSqrtA(final double sqrtA) {
75          setSma(sqrtA * sqrtA);
76      }
77  
78      /**
79       * Sets the Inclination Angle at Reference Time (rad).
80       *
81       * @param inc the orbit reference inclination
82       * @param dinc the correction of orbit reference inclination at reference time
83       */
84      public void setI0(final double inc, final double dinc) {
85          setI0(inc + dinc);
86      }
87  
88      /**
89       * Gets the Health status.
90       *
91       * @return the Health status
92       */
93      public int getHealth() {
94          return health;
95      }
96  
97      /**
98       * Sets the health status.
99       *
100      * @param health the health status to set
101      */
102     public void setHealth(final int health) {
103         this.health = health;
104     }
105 
106 }