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.gnss.metric.messages.common;
18
19 /** Signal-In-Space Accuracy (SISA).
20 * @see "Galileo OS Signal-In-Space Interface Control Document, Issue 1.3, December 2016, Table 76"
21 * @author Bryan Cazabonne
22 * @since 11.0
23 */
24 public class SignalInSpaceAccuracy implements AccuracyProvider {
25
26 /** Signal In Space Accuracy indicator. */
27 private final int sisaIndex;
28
29 /**
30 * Simple constructor.
31 * @param index integer value of the signal in space accuracy
32 */
33 public SignalInSpaceAccuracy(final int index) {
34 this.sisaIndex = index;
35 }
36
37 /** {@inheritDoc} */
38 @Override
39 public double getAccuracy() {
40 // Cast index to a double value
41 final double id = (double) sisaIndex;
42 // Compute accuracy
43 if (sisaIndex < 50) {
44 // Accuracy is between 0 cm and 49 cm with 1 cm resolution
45 return 0.01 * id;
46 } else if (sisaIndex < 75) {
47 // Accuracy is between 50 cm and 98 cm with 2 cm resolution
48 return 0.01 * (50.0 + 2.0 * (id - 50.0));
49 } else if (sisaIndex < 100) {
50 // Accuracy is between 1 m and 2 m with 4 cm resolution
51 return 1.0 + 0.04 * (id - 75.0);
52 } else if (sisaIndex < 126) {
53 // Accuracy is between 2 m and 6 m with 16 cm resolution
54 return 2.0 + 0.16 * (id - 100.0);
55 } else {
56 // Spare or No Accuracy Predicition Available (NAPA)
57 return -1.0;
58 }
59 }
60
61 }