Antenna.java

  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.gnss.antenna;

  18. import java.util.List;
  19. import java.util.Map;
  20. import java.util.stream.Collectors;

  21. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  22. import org.orekit.errors.OrekitException;
  23. import org.orekit.errors.OrekitMessages;
  24. import org.orekit.gnss.RadioWave;

  25. /**
  26.  * GNSS antenna model.
  27.  *
  28.  * @author Luc Maisonobe
  29.  * @since 9.2
  30.  * @see <a href="ftp://www.igs.org/pub/station/general/antex14.txt">ANTEX: The Antenna Exchange Format, Version 1.4</a>
  31.  *
  32.  */
  33. public class Antenna {

  34.     /** Type of the antenna. */
  35.     private final String type;

  36.     /** Sinex code. */
  37.     private final String sinexCode;

  38.     /** Radio waves patterns. */
  39.     private final Map<RadioWave, FrequencyPattern> patterns;

  40.     /** Simple constructor.
  41.      * @param type antenna type
  42.      * @param sinexCode sinex code
  43.      * @param patterns frequencies patterns
  44.      */
  45.     protected Antenna(final String type, final String sinexCode,
  46.                       final Map<RadioWave, FrequencyPattern> patterns) {
  47.         this.type      = type;
  48.         this.sinexCode = sinexCode;
  49.         this.patterns  = patterns;
  50.     }

  51.     /** Get the type of the antenna.
  52.      * @return type of the antenna
  53.      */
  54.     public String getType() {
  55.         return type;
  56.     }

  57.     /** Get the sinex code of the antenna.
  58.      * @return sinex code of the antenna
  59.      */
  60.     public String getSinexCode() {
  61.         return sinexCode;
  62.     }

  63.     /** Get supported radio waves.
  64.      * @return supported radio waves
  65.      * @since 13.0
  66.      */
  67.     public List<RadioWave> getRadioWaves() {
  68.         return patterns.
  69.                entrySet().
  70.                stream().
  71.                map(Map.Entry::getKey).
  72.                collect(Collectors.toList());
  73.     }

  74.     /**
  75.      * Get the phase center eccentricities.
  76.      *
  77.      * @param radioWave radio wave of the signal to consider
  78.      * @return phase center eccentricities (m)
  79.      */
  80.     public Vector3D getEccentricities(final RadioWave radioWave) {
  81.         return getPattern(radioWave).getEccentricities();
  82.     }

  83.     /**
  84.      * Get the value of the phase center variation in a signal direction.
  85.      *
  86.      * @param radioWave radio wave of the signal to consider
  87.      * @param direction signal direction in antenna reference frame
  88.      * @return value of the phase center variation (m)
  89.      */
  90.     public double getPhaseCenterVariation(final RadioWave radioWave, final Vector3D direction) {
  91.         return getPattern(radioWave).getPhaseCenterVariation(direction);
  92.     }

  93.     /**
  94.      * Get a frequency pattern.
  95.      *
  96.      * @param radioWave radio wave of the signal to consider
  97.      * @return pattern for this frequency
  98.      */
  99.     public FrequencyPattern getPattern(final RadioWave radioWave) {
  100.         final FrequencyPattern pattern = patterns.get(radioWave);
  101.         if (pattern == null) {
  102.             throw new OrekitException(OrekitMessages.UNSUPPORTED_FREQUENCY_FOR_ANTENNA, radioWave, type);
  103.         }
  104.         return pattern;
  105.     }

  106. }