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  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.hipparchus.util.MathUtils;
21  
22  /**
23   * Pattern for GNSS antenna model on one frequency.
24   *
25   * @author Luc Maisonobe
26   * @since 9.2
27   * @see <a href="ftp://www.igs.org/pub/station/general/antex14.txt">ANTEX: The Antenna Exchange Format, Version 1.4</a>
28   *
29   */
30  public class FrequencyPattern {
31  
32      /** Pattern with zero correction (i.e. zero eccentricities and no variations).
33       * @since 12.0
34       */
35      public static final FrequencyPattern ZERO_CORRECTION = new FrequencyPattern(Vector3D.ZERO, null);
36  
37      /** Phase center eccentricities (m). */
38      private final Vector3D eccentricities;
39  
40      /** Phase center variation function (may be null if phase center does not depend on signal direction). */
41      private final PhaseCenterVariationFunction phaseCenterVariationFunction;
42  
43      /** Simple constructor.
44       * @param eccentricities phase center eccentricities (m)
45       * @param phaseCenterVariationFunction phase center variation function
46       * (may be null if phase center does not depend on signal direction)
47       */
48      public FrequencyPattern(final Vector3D eccentricities,
49                              final PhaseCenterVariationFunction phaseCenterVariationFunction) {
50          this.eccentricities               = eccentricities;
51          this.phaseCenterVariationFunction = phaseCenterVariationFunction;
52      }
53  
54      /** Get the phase center eccentricities.
55       * @return phase center eccentricities (m)
56       */
57      public Vector3D getEccentricities() {
58          return eccentricities;
59      }
60  
61      /** Get the phase center variation function.
62       * @return phase center variation function (may be null if phase center does not depend on signal direction)
63       * @since 12.0
64       */
65      public PhaseCenterVariationFunction getPhaseCenterVariationFunction() {
66          return phaseCenterVariationFunction;
67      }
68  
69      /** Get the value of the phase center variation in a signal direction.
70       * @param direction signal direction in antenna reference frame
71       * @return value of the phase center variation
72       */
73      public double getPhaseCenterVariation(final Vector3D direction) {
74          if (phaseCenterVariationFunction == null) {
75              return 0.0;
76          } else {
77              return phaseCenterVariationFunction.value(MathUtils.SEMI_PI - direction.getDelta(),
78                                                        direction.getAlpha());
79          }
80      }
81  
82  }