1   /* Copyright 2002-2026 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.antenna;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.hipparchus.geometry.euclidean.threed.Vector3D;
24  import org.orekit.errors.OrekitException;
25  import org.orekit.errors.OrekitMessages;
26  import org.orekit.gnss.RadioWave;
27  
28  /**
29   * GNSS antenna model.
30   *
31   * @author Luc Maisonobe
32   * @since 9.2
33   * @see <a href="ftp://www.igs.org/pub/station/general/antex14.txt">ANTEX: The Antenna Exchange Format, Version 1.4</a>
34   *
35   */
36  public class Antenna {
37  
38      /** Type of the antenna. */
39      private final String type;
40  
41      /** Sinex code. */
42      private final String sinexCode;
43  
44      /** Radio waves patterns. */
45      private final Map<RadioWave, FrequencyPattern> patterns;
46  
47      /** Simple constructor.
48       * @param type antenna type
49       * @param sinexCode sinex code
50       * @param patterns frequencies patterns
51       */
52      protected Antenna(final String type, final String sinexCode,
53                        final Map<RadioWave, FrequencyPattern> patterns) {
54          this.type      = type;
55          this.sinexCode = sinexCode;
56          this.patterns  = patterns;
57      }
58  
59      /** Get the type of the antenna.
60       * @return type of the antenna
61       */
62      public String getType() {
63          return type;
64      }
65  
66      /** Get the sinex code of the antenna.
67       * @return sinex code of the antenna
68       */
69      public String getSinexCode() {
70          return sinexCode;
71      }
72  
73      /** Get supported radio waves.
74       * @return supported radio waves
75       * @since 13.0
76       */
77      public List<RadioWave> getRadioWaves() {
78          return new ArrayList<>(patterns.keySet());
79      }
80  
81      /**
82       * Get the phase center eccentricities.
83       *
84       * @param radioWave radio wave of the signal to consider
85       * @return phase center eccentricities (m)
86       */
87      public Vector3D getEccentricities(final RadioWave radioWave) {
88          return getPattern(radioWave).getEccentricities();
89      }
90  
91      /**
92       * Get the value of the phase center variation in a signal direction.
93       *
94       * @param radioWave radio wave of the signal to consider
95       * @param direction signal direction in antenna reference frame
96       * @return value of the phase center variation (m)
97       */
98      public double getPhaseCenterVariation(final RadioWave radioWave, final Vector3D direction) {
99          return getPattern(radioWave).getPhaseCenterVariation(direction);
100     }
101 
102     /**
103      * Get a frequency pattern.
104      *
105      * @param radioWave radio wave of the signal to consider
106      * @return pattern for this frequency
107      */
108     public FrequencyPattern getPattern(final RadioWave radioWave) {
109         final FrequencyPattern pattern = patterns.get(radioWave);
110         if (pattern == null) {
111             throw new OrekitException(OrekitMessages.UNSUPPORTED_FREQUENCY_FOR_ANTENNA, radioWave, type);
112         }
113         return pattern;
114     }
115 
116 }