1   /* Copyright 2022-2025 Luc Maisonobe
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.estimation.measurements.gnss;
18  
19  import org.hipparchus.util.FastMath;
20  import org.orekit.gnss.GnssSignal;
21  import org.orekit.utils.Constants;
22  import org.orekit.utils.ParameterDriver;
23  
24  import java.util.Locale;
25  
26  /** Specialized {@link ParameterDriver} for ambiguity.
27   * @author Luc Maisonobe
28   * @since 12.1
29   */
30  public class AmbiguityDriver extends ParameterDriver {
31  
32      /** Prefix for parameter drivers names. */
33      public static final String PREFIX = "ambiguity";
34  
35      /** Ambiguity scale factor.
36       * <p>
37       * We use a power of 2 to avoid numeric noise introduction
38       * in the multiplications/divisions sequences.
39       * </p>
40       */
41      private static final double AMBIGUITY_SCALE = FastMath.scalb(1.0, 26);
42  
43      /** Emitter id. */
44      private final String emitter;
45  
46      /** Receiver id. */
47      private final String receiver;
48  
49      /** Wavelength. */
50      private final double wavelength;
51  
52      /** Simple constructor.
53       * @param emitter emitter id
54       * @param receiver receiver id
55       * @param wavelength signal wavelength
56       */
57      public AmbiguityDriver(final String emitter, final String receiver, final double wavelength) {
58          // the name is built from emitter, receiver and the multiplier
59          // with respect to common frequency F0 (10.23 MHz)
60          super(String.format(Locale.US, "%s-%s-%s-%.2f",
61                              PREFIX, emitter, receiver,
62                              Constants.SPEED_OF_LIGHT / (wavelength * GnssSignal.F0)),
63                0.0, AMBIGUITY_SCALE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
64          this.emitter    = emitter;
65          this.receiver   = receiver;
66          this.wavelength = wavelength;
67      }
68  
69      /** Get emitter id.
70       * @return emitter id
71       */
72      public String getEmitter() {
73          return emitter;
74      }
75  
76      /** Get receiver id.
77       * @return receiver id
78       */
79      public String getReceiver() {
80          return receiver;
81      }
82  
83      /** Get signal wavelength.
84       * @return signal wavelength
85       */
86      public double getWavelength() {
87          return wavelength;
88      }
89  
90  }