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.files.rinex.navigation;
18  
19  import org.orekit.gnss.SatelliteSystem;
20  
21  /** Container for data contained in a ionosphere Klobuchar message.
22   * @author Luc Maisonobe
23   * @since 12.0
24   */
25  public class IonosphereKlobucharMessage extends IonosphereBaseMessage {
26  
27      /** α (s/radⁿ). */
28      private final double[] alpha;
29  
30      /** β (s/radⁿ). */
31      private final double[] beta;
32  
33      /** Region code. */
34      private RegionCode regionCode;
35  
36      /** Simple constructor.
37       * @param system satellite system
38       * @param prn satellite number
39       * @param navigationMessageType navigation message type
40       * @param subType message subtype
41       */
42      public IonosphereKlobucharMessage(final SatelliteSystem system, final int prn,
43                                        final String navigationMessageType, final String subType) {
44          super(system, prn, navigationMessageType, subType);
45          alpha = new double[4];
46          beta  = new double[4];
47      }
48  
49      /** Get the α coefficients.
50       * <p>
51       * Beware Orekit uses SI units here.
52       * In order to retrieve the more traditional s/semi-circleⁿ, use
53       * {@code IonosphereKlobucharMessage.S_PER_SC_N[i].fromSI(alpha[i])}
54       * </p>
55       * @return α coefficients (s/radⁿ)
56       */
57      public double[] getAlpha() {
58          return alpha.clone();
59      }
60  
61      /** Set one α coefficient.
62       * <p>
63       * Beware Orekit uses SI units here.
64       * In order to use the more traditional s/semi-circleⁿ, use
65       * {@code setAlphaI(i, IonosphereKlobucharMessage.S_PER_SC_N[i].toSi(alpha[i]))}
66       * </p>
67       * @param i index of the coefficient
68       * @param alphaI α coefficient to set (s/radⁿ)
69       */
70      public void setAlphaI(final int i, final double alphaI) {
71          alpha[i] = alphaI;
72      }
73  
74      /** Get the β coefficients.
75       * <p>
76       * Beware Orekit uses SI units here.
77       * In order to retrieve the more traditional s/semi-circleⁿ, use
78       * {@code IonosphereKlobucharMessage.S_PER_SC_N[i].fromSI(beta[i])}
79       * </p>
80       * @return β coefficients (s/radⁿ)
81       */
82      public double[] getBeta() {
83          return beta.clone();
84      }
85  
86      /** Set one β coefficient.
87       * <p>
88       * Beware Orekit uses SI units here.
89       * In order to use the more traditional s/semi-circleⁿ, use
90       * {@code setBetaI(i, IonosphereKlobucharMessage.S_PER_SC_N[i].toSi(beta[i]))}
91       * </p>
92       * @param i index of the coefficient
93       * @param betaI β coefficient to set (s/radⁿ)
94       */
95      public void setBetaI(final int i, final double betaI) {
96          beta[i] = betaI;
97      }
98  
99      /** Get the region code.
100      * @return region code
101      */
102     public RegionCode getRegionCode() {
103         return regionCode;
104     }
105 
106     /** Set the region code.
107      * @param regionCode region code
108      */
109     public void setRegionCode(final RegionCode regionCode) {
110         this.regionCode = regionCode;
111     }
112 
113 }