1   /* Copyright 2002-2020 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  
18  package org.orekit.estimation.common;
19  
20  import java.util.Map;
21  
22  import org.orekit.estimation.measurements.ObservableSatellite;
23  import org.orekit.estimation.measurements.Range;
24  import org.orekit.estimation.measurements.RangeRate;
25  import org.orekit.estimation.measurements.modifiers.Bias;
26  
27  /** Parser for range rate measurements.
28   * @author Luc Maisonobe
29   */
30  class RangeRateParser extends MeasurementsParser<RangeRate> {
31      /** {@inheritDoc} */
32      @Override
33      public RangeRate parseFields(final String[] fields,
34                                   final Map<String, StationData> stations,
35                                   final PVData pvData,
36                                   final ObservableSatellite satellite,
37                                   final Bias<Range> satRangeBias,
38                                   final Weights weights,
39                                   final String line,
40                                   final int lineNumber,
41                                   final String fileName) {
42          checkFields(4, fields, line, lineNumber, fileName);
43          final StationData stationData = getStationData(fields[2], stations, line, lineNumber, fileName);
44          final RangeRate rangeRate = new RangeRate(stationData.getStation(),
45                                                    getDate(fields[0], line, lineNumber, fileName),
46                                                    Double.parseDouble(fields[3]) * 1000.0,
47                                                    stationData.getRangeRateSigma(),
48                                                    weights.getRangeRateBaseWeight(),
49                                                    true, satellite);
50          if (stationData.getRangeRateBias() != null) {
51              rangeRate.addModifier(stationData.getRangeRateBias());
52          }
53          return rangeRate;
54      }
55  }