ObservableSatellite.java

  1. /* Copyright 2002-2024 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. import org.hipparchus.util.FastMath;
  19. import org.orekit.utils.ParameterDriver;

  20. /** Class modeling a satellite that can be observed.
  21.  *
  22.  * @author Luc Maisonobe
  23.  * @since 9.3
  24.  */
  25. public class ObservableSatellite {

  26.     /** Prefix for clock offset parameter driver, the propagator index will be appended to it. */
  27.     public static final String CLOCK_OFFSET_PREFIX = "clock-offset-satellite-";

  28.     /** Prefix for clock drift parameter driver, the propagator index will be appended to it. */
  29.     public static final String CLOCK_DRIFT_PREFIX = "clock-drift-satellite-";

  30.     /** Prefix for clock acceleration parameter driver, the propagator index will be appended to it.
  31.      * @since 12.1
  32.      */
  33.     public static final String CLOCK_ACCELERATION_PREFIX = "clock-acceleration-satellite-";

  34.     /** Clock offset scaling factor.
  35.      * <p>
  36.      * We use a power of 2 to avoid numeric noise introduction
  37.      * in the multiplications/divisions sequences.
  38.      * </p>
  39.      */
  40.     private static final double CLOCK_OFFSET_SCALE = FastMath.scalb(1.0, -10);

  41.     /** Prefix for satellite names. */
  42.     private static final String SAT_PREFIX = "sat-";

  43.     /** Index of the propagator related to this satellite. */
  44.     private final int propagatorIndex;

  45.     /** Parameter driver for satellite clock offset. */
  46.     private final ParameterDriver clockOffsetDriver;

  47.     /** Parameter driver for satellite clock drift. */
  48.     private final ParameterDriver clockDriftDriver;

  49.     /** Parameter driver for satellite clock acceleration.
  50.      * @since 12.1
  51.      */
  52.     private final ParameterDriver clockAccelerationDriver;

  53.     /** Simple constructor.
  54.      * @param propagatorIndex index of the propagator related to this satellite
  55.      */
  56.     public ObservableSatellite(final int propagatorIndex) {
  57.         this.propagatorIndex   = propagatorIndex;
  58.         this.clockOffsetDriver = new ParameterDriver(CLOCK_OFFSET_PREFIX + propagatorIndex,
  59.                                                      0.0, CLOCK_OFFSET_SCALE,
  60.                                                      Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  61.         this.clockDriftDriver = new ParameterDriver(CLOCK_DRIFT_PREFIX + propagatorIndex,
  62.                                                     0.0, CLOCK_OFFSET_SCALE,
  63.                                                     Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  64.         this.clockAccelerationDriver = new ParameterDriver(CLOCK_ACCELERATION_PREFIX + propagatorIndex,
  65.                                                            0.0, CLOCK_OFFSET_SCALE,
  66.                                                            Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  67.     }

  68.     /** Build a name for the satellite.
  69.      * <p>
  70.      * This is mainly useful to build the arguments for {@link
  71.      * org.orekit.estimation.measurements.gnss.AmbiguityCache#getAmbiguity(String,
  72.      * String, double)}
  73.      * </p>
  74.      * @return name for the satellite (built from the propagator index)
  75.      * @since 12.1
  76.      */
  77.     public String getName() {
  78.         return SAT_PREFIX + propagatorIndex;
  79.     }

  80.     /** Get the index of the propagator related to this satellite.
  81.      * @return index of the propagator related to this satellite
  82.      */
  83.     public int getPropagatorIndex() {
  84.         return propagatorIndex;
  85.     }

  86.     /** Get the clock offset parameter driver.
  87.      * <p>
  88.      * The offset value is defined as the value in seconds that must be <em>subtracted</em> from
  89.      * the satellite clock reading of time to compute the real physical date. The offset
  90.      * is therefore negative if the satellite clock is slow and positive if it is fast.
  91.      * </p>
  92.      * @return clock offset parameter driver
  93.      */
  94.     public ParameterDriver getClockOffsetDriver() {
  95.         return clockOffsetDriver;
  96.     }

  97.     /** Get the clock drift parameter driver.
  98.      * <p>
  99.      * The drift is negative if the satellite clock is slowing down and positive if it is speeding up.
  100.      * </p>
  101.      * @return clock drift parameter driver
  102.      * @since 10.3
  103.      */
  104.     public ParameterDriver getClockDriftDriver() {
  105.         return clockDriftDriver;
  106.     }

  107.     /** Get the clock acceleration parameter driver.
  108.      * @return clock acceleration parameter driver
  109.      * @since 12.1
  110.      */
  111.     public ParameterDriver getClockAccelerationDriver() {
  112.         return clockAccelerationDriver;
  113.     }

  114.     /** Get a quadratic clock model valid at some date.
  115.      * @return quadratic clock model
  116.      * @since 12.1
  117.      */
  118.     public QuadraticClockModel getQuadraticClockModel() {
  119.         return new QuadraticClockModel(clockOffsetDriver,
  120.                                        clockDriftDriver,
  121.                                        clockAccelerationDriver);
  122.     }

  123.     /** {@inheritDoc}
  124.      * @since 12.0
  125.      */
  126.     @Override
  127.     public boolean equals(final Object other) {
  128.         if (other instanceof ObservableSatellite) {
  129.             return propagatorIndex == ((ObservableSatellite) other).propagatorIndex;
  130.         } else {
  131.             return false;

  132.         }
  133.     }

  134.     /** {@inheritDoc}
  135.      * @since 12.0
  136.      */
  137.     @Override
  138.     public int hashCode() {
  139.         return propagatorIndex;
  140.     }

  141. }