SubFrame3.java

  1. /* Copyright 2022-2025 Thales Alenia Space
  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.rflink.gps;

  18. import org.hipparchus.util.FastMath;
  19. import org.orekit.gnss.metric.parser.Units;

  20. /**
  21.  * Container for sub-frames 3.
  22.  * <p>
  23.  * Table 20-1, sheet 3 and table 40-1, sheet 3 in
  24.  * <a href="https://navcen.uscg.gov/sites/default/files/pdf/gps/IS-GPS-200N.pdf">NAVSTAR
  25.  * GPS Space Segment/Navigation User Segment Interface</a>, IS-GPS-200N, 22 Aug 2022
  26.  * </p>
  27.  * @author Luc Maisonobe
  28.  * @since 12.0
  29.  */
  30. public class SubFrame3 extends SubFrame {

  31.     /** Index of Cic field. */
  32.     private static final int CIC = 7;

  33.     /** Index of Ω₀ field. */
  34.     private static final int UPPERCASE_OMEGA_0 = 8;

  35.     /** Index of Cis field. */
  36.     private static final int CIS = 9;

  37.     /** Index of i₀ field. */
  38.     private static final int I0 = 10;

  39.     /** Index of Crc field. */
  40.     private static final int CRC = 11;

  41.     /** Index of ω field. */
  42.     private static final int LOWERCASE_OMEGA = 12;

  43.     /** Index of dot(Ω) field. */
  44.     private static final int OMEGA_DOT = 13;

  45.     /** Index of IODE field. */
  46.     private static final int IODE = 14;

  47.     /** Index of dot(i) field. */
  48.     private static final int I_DOT = 15;

  49.     /** Simple constructor.
  50.      * @param words raw words
  51.      */
  52.     SubFrame3(final int[] words) {

  53.         // create raw container
  54.         super(words, I_DOT + 1);

  55.         // populate container
  56.         setField(CIC,                   3, 14, 16, words);
  57.         setField(UPPERCASE_OMEGA_0,     3,  6,  8, 4,  6, 24, words);
  58.         setField(CIS,                   5, 14, 16, words);
  59.         setField(I0,                    5,  6,  8, 6,  6, 24, words);
  60.         setField(CRC,                   7, 14, 16, words);
  61.         setField(LOWERCASE_OMEGA,       7,  6,  8, 8,  6, 24, words);
  62.         setField(OMEGA_DOT,             9,  6, 24, words);
  63.         setField(IODE,                 10, 22,  8, words);
  64.         setField(I_DOT,                10,  8, 14, words);

  65.     }

  66.     /** Get Cic.
  67.      * @return Cic (rad)
  68.      */
  69.     public double getCic() {
  70.         return FastMath.scalb((double) getField(CIC), -29);
  71.     }

  72.     /** Get Ω₀.
  73.      * @return Ω₀ (rad)
  74.      */
  75.     public double getUppercaseOmega0() {
  76.         return Units.SEMI_CIRCLE.toSI(FastMath.scalb((double) getField(UPPERCASE_OMEGA_0), -31));
  77.     }

  78.     /** Get Cis.
  79.      * @return Cis (rad)
  80.      */
  81.     public double getCis() {
  82.         return FastMath.scalb((double) getField(CIS), -29);
  83.     }

  84.     /** Get i₀.
  85.      * @return i₀ (rad)
  86.      */
  87.     public double getI0() {
  88.         return Units.SEMI_CIRCLE.toSI(FastMath.scalb((double) getField(I0), -31));
  89.     }

  90.     /** Get Crc.
  91.      * @return Crc (rad)
  92.      */
  93.     public double getCrc() {
  94.         return FastMath.scalb((double) getField(CRC), -5);
  95.     }

  96.     /** Get ω.
  97.      * @return ω(rad)
  98.      */
  99.     public double getLowercaseOmega() {
  100.         return Units.SEMI_CIRCLE.toSI(FastMath.scalb((double) getField(LOWERCASE_OMEGA), -31));
  101.     }

  102.     /** Get dot(Ω).
  103.      * @return dot(Ω) (rad/s)
  104.      */
  105.     public double getOmegaDot() {
  106.         return Units.SEMI_CIRCLE.toSI(FastMath.scalb((double) getField(OMEGA_DOT), -43));
  107.     }

  108.     /** Get Issue Of Data (ephemeris).
  109.      * @return Issue Of Data (ephemeris)
  110.      */
  111.     public int getIODE() {
  112.         return getField(IODE);
  113.     }

  114.     /** Get dot(i).
  115.      * @return dot(i) (rad/s)
  116.      */
  117.     public double getIDot() {
  118.         return Units.SEMI_CIRCLE.toSI(FastMath.scalb((double) getField(I_DOT), -43));
  119.     }

  120. }