1   /* Copyright 2002-2021 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      /** QZSS L1 (1575.42 MHz). */
91      J01(SatelliteSystem.QZSS,    "L1", 154),
92  
93      /** QZSS L2 (1227.6 MHz). */
94      J02(SatelliteSystem.QZSS,    "L2", 120),
95  
96      /** QZSS L5 (1176.45 MHz). */
97      J05(SatelliteSystem.QZSS,    "L5", 115),
98  
99      /** QZSS LEX (1278.75 MHz). */
100     J06(SatelliteSystem.QZSS,    "LEX", 125),
101 
102     /** IRNSS L5. (1176.45 MHz) */
103     I05(SatelliteSystem.IRNSS,   "L5", 115),
104 
105     /** IRNSS S (2492.028 MHz). */
106     I09(SatelliteSystem.IRNSS,   "S", 243.6),
107 
108     /** SBAS L1 (1575.42 MHz). */
109     S01(SatelliteSystem.SBAS,    "L1", 154),
110 
111     /** SBAS L5 (1176.45 MHz). */
112     S05(SatelliteSystem.SBAS,    "L5", 115);
113     // CHECKSTYLE: resume MultipleStringLiterals check
114 
115     /** Common frequency F0 in MHz (10.23 MHz). */
116     public static final double F0 = 10.23;
117 
118     /** Satellite system. */
119     private final SatelliteSystem satelliteSystem;
120 
121     /** RINEX name for the frequency. */
122     private final String name;
123 
124     /** Ratio f/f0, where {@link #F0 f0} is the common frequency. */
125     private final double ratio;
126 
127     /** Simple constructor.
128      * @param name for the frequency
129      * @param satelliteSystem satellite system for which this frequency is defined
130      * @param ratio ratio f/f0, where {@link #F0 f0} is the common frequency
131      */
132     Frequency(final SatelliteSystem satelliteSystem, final String name, final double ratio) {
133         this.satelliteSystem = satelliteSystem;
134         this.name            = name;
135         this.ratio           = ratio;
136     }
137 
138     /** Get the RINEX name for the frequency.
139      * @return RINEX name for the frequency
140      */
141     public String getName() {
142         return name;
143     }
144 
145     /** Get the satellite system for which this frequency is defined.
146      * @return satellite system for which this frequency is defined
147      */
148     public SatelliteSystem getSatelliteSystem() {
149         return satelliteSystem;
150     }
151 
152     /** Get the ratio f/f0, where {@link #F0 f0} is the common frequency.
153      * @return ratio f/f0, where {@link #F0 f0} is the common frequency
154      * @see #F0
155      * @see #getMHzFrequency()
156      */
157     public double getRatio() {
158         return ratio;
159     }
160 
161     /** Get the value of the frequency in MHz.
162      * @return value of the frequency in MHz
163      * @see #F0
164      * @see #getRatio()
165      * @see #getWavelength()
166      */
167     public double getMHzFrequency() {
168         return ratio * F0;
169     }
170 
171     /** Get the wavelength in meters.
172      * @return wavelength in meters
173      * @see #getMHzFrequency()
174      * @since 10.1
175      */
176     public double getWavelength() {
177         return Constants.SPEED_OF_LIGHT / (1.0e6 * getMHzFrequency());
178     }
179 
180 }