1   /* Copyright 2002-2022 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.gnss;
18  
19  import org.orekit.utils.Constants;
20  
21  /**
22   * Enumerate for GNSS frequencies.
23   *
24   * @author Luc Maisonobe
25   * @since 9.2
26   */
27  public enum Frequency {
28  
29      // CHECKSTYLE: stop MultipleStringLiterals check
30      /** GPS L1 (1575.42 MHz). */
31      G01(SatelliteSystem.GPS,     "L1", 154),
32  
33      /** GPS L2 (1227.6 MHz). */
34      G02(SatelliteSystem.GPS,     "L2", 120),
35  
36      /** GPS L5 (1176.45 MHz). */
37      G05(SatelliteSystem.GPS,     "L5", 115),
38  
39      /** GLONASS, "G1" (1602 MHZ). */
40      R01(SatelliteSystem.GLONASS, "G1", 1602.0 / 10.23),
41  
42      /** GLONASS, "G2" (1246 MHz). */
43      R02(SatelliteSystem.GLONASS, "G2", 1246.0 / 10.23),
44  
45      /** GLONASS, "G3" (1202.025 MHz). */
46      R03(SatelliteSystem.GLONASS, "G3", 117.5),
47  
48      /** GLONASS, "G1a" (1600.995 MHZ). */
49      R04(SatelliteSystem.GLONASS, "G1a", 156.5),
50  
51      /** GLONASS, "G2a" (1248.06 MHz). */
52      R06(SatelliteSystem.GLONASS, "G2a", 122),
53  
54      /** Galileo, "E1" (1575.42 MHz). */
55      E01(SatelliteSystem.GALILEO, "E1", 154),
56  
57      /** Galileo E5a (1176.45 MHz). */
58      E05(SatelliteSystem.GALILEO, "E5a", 115),
59  
60      /** Galileo E5b (1207.14 MHz). */
61      E07(SatelliteSystem.GALILEO, "E5b", 118),
62  
63      /** Galileo E5 (E5a + E5b) (1191.795MHz). */
64      E08(SatelliteSystem.GALILEO, "E5 (E5a+E5b)", 116.5),
65  
66      /** Galileo E6 (1278.75 MHz). */
67      E06(SatelliteSystem.GALILEO, "E6", 125),
68  
69      /** In the ANTEX files, both C01 and C02 refer to Beidou B1 signal (1561.098 MHz). */
70      C01(SatelliteSystem.BEIDOU, "B1", 152.6),
71  
72      /** In the ANTEX files, both C01 and C02 refer to Beidou B1 signal (1561.098 MHz). */
73      C02(SatelliteSystem.BEIDOU, "B1", 152.6),
74  
75      /** In the ANTEX files, C06 appears without much reference, we assume it is B2 (1207.14 MHz). */
76      C06(SatelliteSystem.BEIDOU, "B2", 118),
77  
78      /** In the ANTEX files, C07 seems to refer to a signal close to E06, probably B3... (1268.52 MHz). */
79      C07(SatelliteSystem.BEIDOU, "B3", 124),
80  
81      /** Beidou B1 (1561.098 MHz). */
82      B01(SatelliteSystem.BEIDOU,  "B1", 152.6),
83  
84      /** Beidou B2 (1207.14 MHz). */
85      B02(SatelliteSystem.BEIDOU,  "B2", 118),
86  
87      /** Beidou B3 (1268.52 MHz). */
88      B03(SatelliteSystem.BEIDOU,  "B3", 124),
89  
90      /** Beidou B1 (1575.42 MHz).
91       * FIXME the name must be updated in 12.0.
92       * It has been set to B04 as a workaround to handle the incompatibility between Rinex 3.02 and Rinex 3.04 for C2X
93       * In 3.02 the frequency of C2X is equal to 1561.098 MHz whereas in 3.04 it is equal to 1575.42 MHz
94       */
95      B04(SatelliteSystem.BEIDOU,  "B1", 154),
96  
97      /** Beidou B2a (1176.45 MHz). */
98      B05(SatelliteSystem.BEIDOU, "B2a", 115),
99  
100     /** Beidou B2 (B2a + B2b) (1191.795MHz). */
101     B08(SatelliteSystem.BEIDOU, "B2 (B2a+B2b)", 116.5),
102 
103     /** QZSS L1 (1575.42 MHz). */
104     J01(SatelliteSystem.QZSS,    "L1", 154),
105 
106     /** QZSS L2 (1227.6 MHz). */
107     J02(SatelliteSystem.QZSS,    "L2", 120),
108 
109     /** QZSS L5 (1176.45 MHz). */
110     J05(SatelliteSystem.QZSS,    "L5", 115),
111 
112     /** QZSS LEX (1278.75 MHz). */
113     J06(SatelliteSystem.QZSS,    "LEX", 125),
114 
115     /** IRNSS L5. (1176.45 MHz) */
116     I05(SatelliteSystem.IRNSS,   "L5", 115),
117 
118     /** IRNSS S (2492.028 MHz). */
119     I09(SatelliteSystem.IRNSS,   "S", 243.6),
120 
121     /** SBAS L1 (1575.42 MHz). */
122     S01(SatelliteSystem.SBAS,    "L1", 154),
123 
124     /** SBAS L5 (1176.45 MHz). */
125     S05(SatelliteSystem.SBAS,    "L5", 115);
126     // CHECKSTYLE: resume MultipleStringLiterals check
127 
128     /** Common frequency F0 in MHz (10.23 MHz). */
129     public static final double F0 = 10.23;
130 
131     /** Satellite system. */
132     private final SatelliteSystem satelliteSystem;
133 
134     /** RINEX name for the frequency. */
135     private final String name;
136 
137     /** Ratio f/f0, where {@link #F0 f0} is the common frequency. */
138     private final double ratio;
139 
140     /** Simple constructor.
141      * @param name for the frequency
142      * @param satelliteSystem satellite system for which this frequency is defined
143      * @param ratio ratio f/f0, where {@link #F0 f0} is the common frequency
144      */
145     Frequency(final SatelliteSystem satelliteSystem, final String name, final double ratio) {
146         this.satelliteSystem = satelliteSystem;
147         this.name            = name;
148         this.ratio           = ratio;
149     }
150 
151     /** Get the RINEX name for the frequency.
152      * @return RINEX name for the frequency
153      */
154     public String getName() {
155         return name;
156     }
157 
158     /** Get the satellite system for which this frequency is defined.
159      * @return satellite system for which this frequency is defined
160      */
161     public SatelliteSystem getSatelliteSystem() {
162         return satelliteSystem;
163     }
164 
165     /** Get the ratio f/f0, where {@link #F0 f0} is the common frequency.
166      * @return ratio f/f0, where {@link #F0 f0} is the common frequency
167      * @see #F0
168      * @see #getMHzFrequency()
169      */
170     public double getRatio() {
171         return ratio;
172     }
173 
174     /** Get the value of the frequency in MHz.
175      * @return value of the frequency in MHz
176      * @see #F0
177      * @see #getRatio()
178      * @see #getWavelength()
179      */
180     public double getMHzFrequency() {
181         return ratio * F0;
182     }
183 
184     /** Get the wavelength in meters.
185      * @return wavelength in meters
186      * @see #getMHzFrequency()
187      * @since 10.1
188      */
189     public double getWavelength() {
190         return Constants.SPEED_OF_LIGHT / (1.0e6 * getMHzFrequency());
191     }
192 
193 }