PreCompensation.java

  1. /* Copyright 2002-2022 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.leastsquares;

  18. import org.orekit.estimation.measurements.EstimatedMeasurement;
  19. import org.orekit.estimation.measurements.ObservedMeasurement;
  20. import org.orekit.time.AbsoluteDate;
  21. import org.orekit.time.TimeStamped;

  22. /** Class holding compensation of time offset for measurements.
  23.  * @author Luc Maisonobe
  24.  * @since 8.1
  25.  */
  26. class PreCompensation implements TimeStamped {

  27.     /** Underlying measurement. */
  28.     private final ObservedMeasurement<?> observed;

  29.     /** State pick-up dates, including pre-compensation. */
  30.     private final AbsoluteDate precompensated;

  31.     /** Simple constructor.
  32.      * @param observed underlying measurement
  33.      * @param previousEstimation previous estimation of the measurement (may be null)
  34.      */
  35.     PreCompensation(final ObservedMeasurement<?> observed,
  36.                     final EstimatedMeasurement<?> previousEstimation) {
  37.         this.observed = observed;
  38.         if (previousEstimation == null) {
  39.             // no previous estimate of transit time, we will pickup state at observed measurement date
  40.             precompensated = observed.getDate();
  41.         } else {
  42.             // pre-compensate signal transit time
  43.             precompensated = observed.getDate().shiftedBy(-previousEstimation.getTimeOffset());
  44.         }
  45.     }

  46.     /** Get the observed measurement.
  47.      * @return observed measurement
  48.      */
  49.     public ObservedMeasurement<?> getMeasurement() {
  50.         return observed;
  51.     }

  52.     /** Get the state date, i.e. the measurement date pre-compensated
  53.      * by time offset.
  54.      * @return pre-compensated state date
  55.      */
  56.     public AbsoluteDate getDate() {
  57.         return precompensated;
  58.     }

  59. }