SignalInSpaceAccuracy.java

  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. /** Signal-In-Space Accuracy (SISA).
  19.  * @see "Galileo OS Signal-In-Space Interface Control Document, Issue 1.3, December 2016, Table 76"
  20.  * @author Bryan Cazabonne
  21.  * @since 11.0
  22.  */
  23. public class SignalInSpaceAccuracy implements AccuracyProvider {

  24.     /** Signal In Space Accuracy indicator. */
  25.     private final int sisaIndex;

  26.     /**
  27.      * Simple constructor.
  28.      * @param index integer value of the signal in space accuracy
  29.      */
  30.     public SignalInSpaceAccuracy(final int index) {
  31.         this.sisaIndex = index;
  32.     }

  33.     /** {@inheritDoc} */
  34.     @Override
  35.     public double getAccuracy() {
  36.         // Cast index to a double value
  37.         final double id = (double) sisaIndex;
  38.         // Compute accuracy
  39.         if (sisaIndex < 50) {
  40.             // Accuracy is between 0 cm and 49 cm with 1 cm resolution
  41.             return 0.01 * id;
  42.         } else if (sisaIndex < 75) {
  43.             // Accuracy is between 50 cm and 98 cm with 2 cm resolution
  44.             return 0.01 * (50.0 + 2.0 * (id - 50.0));
  45.         } else if (sisaIndex < 100) {
  46.             // Accuracy is between 1 m and 2 m with 4 cm resolution
  47.             return 1.0 + 0.04 * (id - 75.0);
  48.         } else if (sisaIndex < 126) {
  49.             // Accuracy is between 2 m and 6 m with 16 cm resolution
  50.             return 2.0 + 0.16 * (id - 100.0);
  51.         } else {
  52.             // Spare or No Accuracy Predicition Available (NAPA)
  53.             return -1.0;
  54.         }
  55.     }

  56. }