1   /* Copyright 2025-2026 Hawkeye 360 (HE360)
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  
18  package org.orekit.estimation.measurements;
19  
20  import java.util.Map;
21  
22  import org.hipparchus.analysis.differentiation.Gradient;
23  import org.hipparchus.analysis.differentiation.GradientField;
24  import org.orekit.time.AbsoluteDate;
25  import org.orekit.time.FieldAbsoluteDate;
26  import org.orekit.time.clocks.ClockModel;
27  import org.orekit.time.clocks.FieldClockModel;
28  import org.orekit.utils.ParameterDriversProvider;
29  
30  /** Interface underlying both observed and observing measurement objects. Contains the clock model.
31   *
32   * @author Brianna Aubin
33   * @since 14.0
34   */
35  public interface MeasurementParticipant extends ParameterDriversProvider {
36  
37      /** Suffix for ground station position parameters names. */
38      String OFFSET_SUFFIX = "-offset";
39  
40      /** Suffix for clock bias (a.k.a. systematic offset) parameters name. */
41      String BIAS_SUFFIX = "-bias";
42  
43      /** Suffix for ground clock drift parameters name. */
44      String DRIFT_SUFFIX = "-drift";
45  
46      /** Suffix for ground clock drift parameters name. */
47      String ACCELERATION_SUFFIX = "-acceleration";
48  
49      /** Get the MeasurementObject name.
50       * @return name for the object
51       */
52      String getName();
53  
54      /** Get a clock model valid at some date.
55       * @return clock model
56       */
57      ClockModel getClockModel();
58  
59      /** Get the current clock offset as a function of time.
60       * @param date time of computations
61       * @return current clock offset value
62       */
63      default double getOffsetValue(final AbsoluteDate date) {
64          return getClockModel().getOffset(date).getBias();
65      }
66  
67      /** Get the current clock drift as a function of time.
68       * @param date time of computations
69       * @return current clock drift value
70       */
71      default double getOffsetRate(final AbsoluteDate date) {
72          return getClockModel().getOffset(date).getRate();
73      }
74  
75      /** Get the current gradient clock offset as a function of time.
76       * @param freeParameters total number of free parameters in the gradient
77       * @param indices indices of the differentiation parameters in derivatives computations
78       * @param date time of computations
79       * @return current gradient clock offset value
80       */
81      default Gradient getFieldOffsetValue(final int freeParameters, final Map<String, Integer> indices,
82                                          final AbsoluteDate date) {
83          final FieldAbsoluteDate<Gradient> fieldDate = new FieldAbsoluteDate<>(GradientField.getField(freeParameters), date);
84          return getFieldClockModel(freeParameters, indices, date).getOffset(fieldDate).getBias();
85      }
86  
87      /** Get the current gradient clock drift as a function of time.
88       * @param freeParameters total number of free parameters in the gradient
89       * @param indices indices of the differentiation parameters in derivatives computations
90       * @param date time of computations
91       * @return current gradient clock drift value
92       */
93      default Gradient getFieldOffsetRate(final int freeParameters,
94                                          final Map<String, Integer> indices,
95                                          final AbsoluteDate date) {
96          final FieldAbsoluteDate<Gradient> fieldDate = new FieldAbsoluteDate<>(GradientField.getField(freeParameters), date);
97          return getFieldClockModel(freeParameters, indices, date).getOffset(fieldDate).getRate();
98      }
99  
100     /** Get Gradient clock model.
101      * @param freeParameters total number of free parameters in the gradient
102      * @param indices indices of the differentiation parameters in derivatives computations,
103      * must be span name and not driver name
104      * @param date time of computations
105      * @return clock gradient
106      */
107     default FieldClockModel<Gradient> getFieldClockModel(final int freeParameters, final Map<String, Integer> indices,
108                                                          final AbsoluteDate date) {
109         return getClockModel().getFieldModel(freeParameters, indices, date);
110     }
111 
112 }