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.estimation.measurements.gnss;
18  
19  import org.hipparchus.util.MathArrays;
20  import org.orekit.gnss.GnssSignal;
21  import org.orekit.gnss.MeasurementType;
22  import org.orekit.gnss.SatelliteSystem;
23  
24  /**
25   * Narrow-Lane combination.
26   * <p>
27   * This combination create signal with a narrow wavelength.
28   * The signal in this combination has a lower noise than each
29   * separated separeted component.
30   * </p>
31   * <pre>
32   *              f1 * m1 + f2 * m2
33   *    mNL =  -----------------------
34   *                   f1 + f2
35   * </pre>
36   * With:
37   * <ul>
38   * <li>mNL : Narrow-laning measurement.</li>
39   * <li>f1  : Frequency of the first measurement.</li>
40   * <li>pr1 : First measurement.</li>
41   * <li>f2  : Frequency of the second measurement.</li>
42   * <li>m1 : Second measurement.</li>
43   * </ul>
44   * <p>
45   * Narrow-Lane combination is a dual frequency combination.
46   * The two measurements shall have different frequencies but they must have the same {@link MeasurementType}.
47   * </p>
48   * @author Bryan Cazabonne
49   * @since 10.1
50   */
51  public class NarrowLaneCombination extends AbstractDualFrequencyCombination {
52  
53      /**
54       * Package private constructor for the factory.
55       * @param system satellite system for which the combination is applied
56       */
57      NarrowLaneCombination(final SatelliteSystem system) {
58          super(CombinationType.NARROW_LANE, system);
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      protected double getCombinedValue(final double obs1, final GnssSignal s1,
64                                        final double obs2, final GnssSignal s2) {
65          // Get the ration f/f0
66          final double ratioF1 = s1.getRatio();
67          final double ratioF2 = s2.getRatio();
68          // Perform combination
69          return MathArrays.linearCombination(ratioF1, obs1, ratioF2, obs2) / (ratioF1 + ratioF2);
70      }
71  
72      /** {@inheritDoc} */
73      @Override
74      protected double getCombinedFrequency(final GnssSignal s1, final GnssSignal s2) {
75          return s1.getFrequency() + s2.getFrequency();
76      }
77  
78  }