1   /* Copyright 2002-2021 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;
18  
19  import org.hipparchus.util.FastMath;
20  import org.orekit.utils.ParameterDriver;
21  
22  /** Class modeling a satellite that can be observed.
23   *
24   * @author Luc Maisonobe
25   * @since 9.3
26   */
27  public class ObservableSatellite {
28  
29      /** Prefix for clock offset parameter driver, the propagator index will be appended to it. */
30      public static final String CLOCK_OFFSET_PREFIX = "clock-offset-satellite-";
31  
32      /** Prefix for clock drift parameter driver, the propagator index will be appended to it. */
33      public static final String CLOCK_DRIFT_PREFIX = "clock-drift-satellite-";
34  
35      /** Clock offset scaling 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 CLOCK_OFFSET_SCALE = FastMath.scalb(1.0, -10);
42  
43      /** Index of the propagator related to this satellite. */
44      private final int propagatorIndex;
45  
46      /** Parameter driver for satellite clock offset. */
47      private final ParameterDriver clockOffsetDriver;
48  
49      /** Parameter driver for satellite clock drift. */
50      private final ParameterDriver clockDriftDriver;
51  
52      /** Simple constructor.
53       * @param propagatorIndex index of the propagator related to this satellite
54       */
55      public ObservableSatellite(final int propagatorIndex) {
56          this.propagatorIndex   = propagatorIndex;
57          this.clockOffsetDriver = new ParameterDriver(CLOCK_OFFSET_PREFIX + propagatorIndex,
58                                                       0.0, CLOCK_OFFSET_SCALE,
59                                                       Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
60          this.clockDriftDriver = new ParameterDriver(CLOCK_DRIFT_PREFIX + propagatorIndex,
61                                                      0.0, CLOCK_OFFSET_SCALE,
62                                                      Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
63      }
64  
65      /** Get the index of the propagator related to this satellite.
66       * @return index of the propagator related to this satellite
67       */
68      public int getPropagatorIndex() {
69          return propagatorIndex;
70      }
71  
72      /** Get the clock offset parameter driver.
73       * <p>
74       * The offset value is defined as the value in seconds that must be <em>subtracted</em> from
75       * the satellite clock reading of time to compute the real physical date. The offset
76       * is therefore negative if the satellite clock is slow and positive if it is fast.
77       * </p>
78       * @return clock offset parameter driver
79       */
80      public ParameterDriver getClockOffsetDriver() {
81          return clockOffsetDriver;
82      }
83  
84      /** Get the clock drift parameter driver.
85       * <p>
86       * The drift is negative if the satellite clock is slowing down and positive if it is speeding up.
87       * </p>
88       * @return clock offset parameter driver
89       * @since 10.3
90       */
91      public ParameterDriver getClockDriftDriver() {
92          return clockDriftDriver;
93      }
94  
95  }