ObservableSatellite.java

  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;

  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-";

  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-";

  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-";

  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.     /** Name of the satellite.
  54.      * @since 13.0
  55.      */
  56.     private final String name;

  57.     /** Simple constructor.
  58.      * <p>
  59.      * This constructor builds a default name based on the propagator index.
  60.      * </p>
  61.      * @param propagatorIndex index of the propagator related to this satellite
  62.      */
  63.     public ObservableSatellite(final int propagatorIndex) {
  64.         this(propagatorIndex, null);
  65.     }

  66.     /** Simple constructor.
  67.      * @param propagatorIndex index of the propagator related to this satellite
  68.      * @param name satellite name (if null, a default name built from index will be used)
  69.      * @since 13.0
  70.      */
  71.     public ObservableSatellite(final int propagatorIndex, final String name) {
  72.         this.propagatorIndex   = propagatorIndex;
  73.         this.name              = name == null ? SAT_PREFIX + propagatorIndex : name;
  74.         this.clockOffsetDriver = new ParameterDriver(CLOCK_OFFSET_PREFIX + this.name,
  75.                                                      0.0, CLOCK_OFFSET_SCALE,
  76.                                                      Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  77.         this.clockDriftDriver = new ParameterDriver(CLOCK_DRIFT_PREFIX + this.name,
  78.                                                     0.0, CLOCK_OFFSET_SCALE,
  79.                                                     Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  80.         this.clockAccelerationDriver = new ParameterDriver(CLOCK_ACCELERATION_PREFIX + this.name,
  81.                                                            0.0, CLOCK_OFFSET_SCALE,
  82.                                                            Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
  83.     }

  84.     /** Build a name for the satellite.
  85.      * <p>
  86.      * This is mainly useful to build the arguments for {@link
  87.      * org.orekit.estimation.measurements.gnss.AmbiguityCache#getAmbiguity(String,
  88.      * String, double)}
  89.      * </p>
  90.      * @return name for the satellite
  91.      * @since 12.1
  92.      */
  93.     public String getName() {
  94.         return name;
  95.     }

  96.     /** Get the index of the propagator related to this satellite.
  97.      * @return index of the propagator related to this satellite
  98.      */
  99.     public int getPropagatorIndex() {
  100.         return propagatorIndex;
  101.     }

  102.     /** Get the clock offset parameter driver.
  103.      * <p>
  104.      * The offset value is defined as the value in seconds that must be <em>subtracted</em> from
  105.      * the satellite clock reading of time to compute the real physical date. The offset
  106.      * is therefore negative if the satellite clock is slow and positive if it is fast.
  107.      * </p>
  108.      * @return clock offset parameter driver
  109.      */
  110.     public ParameterDriver getClockOffsetDriver() {
  111.         return clockOffsetDriver;
  112.     }

  113.     /** Get the clock drift parameter driver.
  114.      * <p>
  115.      * The drift is negative if the satellite clock is slowing down and positive if it is speeding up.
  116.      * </p>
  117.      * @return clock drift parameter driver
  118.      * @since 10.3
  119.      */
  120.     public ParameterDriver getClockDriftDriver() {
  121.         return clockDriftDriver;
  122.     }

  123.     /** Get the clock acceleration parameter driver.
  124.      * @return clock acceleration parameter driver
  125.      * @since 12.1
  126.      */
  127.     public ParameterDriver getClockAccelerationDriver() {
  128.         return clockAccelerationDriver;
  129.     }

  130.     /** Get a quadratic clock model valid at some date.
  131.      * @return quadratic clock model
  132.      * @since 12.1
  133.      */
  134.     public QuadraticClockModel getQuadraticClockModel() {
  135.         return new QuadraticClockModel(clockOffsetDriver,
  136.                                        clockDriftDriver,
  137.                                        clockAccelerationDriver);
  138.     }

  139.     /** {@inheritDoc}
  140.      * @since 12.0
  141.      */
  142.     @Override
  143.     public boolean equals(final Object other) {
  144.         if (other instanceof ObservableSatellite) {
  145.             return propagatorIndex == ((ObservableSatellite) other).propagatorIndex;
  146.         } else {
  147.             return false;

  148.         }
  149.     }

  150.     /** {@inheritDoc}
  151.      * @since 12.0
  152.      */
  153.     @Override
  154.     public int hashCode() {
  155.         return propagatorIndex;
  156.     }

  157. }