ObservableSpecificSignalBias.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.files.sinex;

  18. import org.orekit.gnss.ObservationType;
  19. import org.orekit.time.AbsoluteDate;
  20. import org.orekit.utils.TimeSpanMap;

  21. import java.util.HashMap;
  22. import java.util.HashSet;

  23. /** Container for observation-specific signal bias for a single link endpoint
  24.  * (either emitter or receiver).
  25.  * <p>
  26.  * This class is made to handle both station and satellite OSB data.
  27.  * Bias values are stored in TimeSpanMaps associated with a given
  28.  * observation type. Those TimeSpanMaps are stored in a Map, which
  29.  * associate an observation code to a TimeSpanMap of double values.
  30.  * </p>
  31.  * @author Louis Aucouturier
  32.  * @author Luc Maisonobe
  33.  * @since 13.0
  34.  */
  35. public class ObservableSpecificSignalBias {

  36.     /** Set of observation types available for the satellite. */
  37.     private final HashSet<ObservationType> observationSets;

  38.     /** Set of biases, identifiable by observation types,
  39.      * each containing the corresponding TimeSpanMap of biases.
  40.      */
  41.     private final HashMap<ObservationType, TimeSpanMap<Double>> biases;

  42.     /** Simple constructor.
  43.      */
  44.     public ObservableSpecificSignalBias() {
  45.         this.observationSets = new HashSet<>();
  46.         this.biases          = new HashMap<>();
  47.     }

  48.     /** Add a bias.
  49.      * @param obs observation used for the OSB computation
  50.      * @param spanBegin beginning of the validity span for this bias value
  51.      * @param spanEnd end of the validity span for this bias value
  52.      * @param biasValue Observable-specific Signal Bias value (meters for code and cycle for phase)
  53.      */
  54.     public void addBias(final ObservationType obs,
  55.                         final AbsoluteDate spanBegin, final AbsoluteDate spanEnd,
  56.                         final double biasValue) {

  57.         // If not present add a new bias to the map, identified by the Observation type.
  58.         // Then add the bias value and validity period.
  59.         if (observationSets.add(obs)) {
  60.             biases.put(obs, new TimeSpanMap<>(null));
  61.         }

  62.         biases.get(obs).addValidBetween(biasValue, spanBegin, spanEnd);
  63.     }

  64.     /** Get the value of the Observable-specific Signal Bias for a given observation type at a given date.
  65.      * @param obs observation type
  66.      * @param date date at which to obtain the Observable-specific Signal Bias
  67.      * @return the value of the Observable-specific Signal Bias (meters for code and cycle for phase)
  68.      */
  69.     public double getBias(final ObservationType obs, final AbsoluteDate date) {
  70.         return getTimeSpanMap(obs).get(date);
  71.     }

  72.     /** Get all available observation types for the satellite.
  73.      * @return Observation types obtained.
  74.      */
  75.     public HashSet<ObservationType> getAvailableObservations() {
  76.         return observationSets;
  77.     }

  78.     /** Get the minimum valid date for a given observation type.
  79.      * @param obs observation type
  80.      * @return minimum valid date for the observation pair
  81.      */
  82.     public AbsoluteDate getMinimumValidDateForObservation(final ObservationType obs) {
  83.         return getTimeSpanMap(obs).getFirstTransition().getDate();
  84.     }

  85.     /** Get the maximum valid date for a given observation type.
  86.      * @param obs observation type
  87.      * @return maximum valid date for the observation pair
  88.      */
  89.     public AbsoluteDate getMaximumValidDateForObservation(final ObservationType obs) {
  90.         return getTimeSpanMap(obs).getLastTransition().getDate();
  91.     }

  92.     /** Get the TimeSpanMap object for a given observation type,
  93.      * for further operation on the object directly.
  94.      *
  95.      * @param obs observation type
  96.      * @return the time span map for a given observation code pair
  97.      */
  98.     private TimeSpanMap<Double> getTimeSpanMap(final ObservationType obs) {
  99.         return biases.get(obs);
  100.     }

  101. }