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