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.leastsquares;
18  
19  import org.orekit.estimation.measurements.EstimatedMeasurement;
20  import org.orekit.estimation.measurements.ObservedMeasurement;
21  import org.orekit.time.AbsoluteDate;
22  import org.orekit.time.TimeStamped;
23  
24  /** Class holding compensation of time offset for measurements.
25   * @author Luc Maisonobe
26   * @since 8.1
27   */
28  class PreCompensation implements TimeStamped {
29  
30      /** Underlying measurement. */
31      private final ObservedMeasurement<?> observed;
32  
33      /** State pick-up dates, including pre-compensation. */
34      private final AbsoluteDate precompensated;
35  
36      /** Simple constructor.
37       * @param observed underlying measurement
38       * @param previousEstimation previous estimation of the measurement (may be null)
39       */
40      PreCompensation(final ObservedMeasurement<?> observed,
41                      final EstimatedMeasurement<?> previousEstimation) {
42          this.observed = observed;
43          if (previousEstimation == null) {
44              // no previous estimate of transit time, we will pickup state at observed measurement date
45              precompensated = observed.getDate();
46          } else {
47              // pre-compensate signal transit time
48              precompensated = observed.getDate().shiftedBy(-previousEstimation.getTimeOffset());
49          }
50      }
51  
52      /** Get the observed measurement.
53       * @return observed measurement
54       */
55      public ObservedMeasurement<?> getMeasurement() {
56          return observed;
57      }
58  
59      /** Get the state date, i.e. the measurement date pre-compensated
60       * by time offset.
61       * @return pre-compensated state date
62       */
63      public AbsoluteDate getDate() {
64          return precompensated;
65      }
66  
67  }