FieldCivilianNavigationMessage.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.propagation.analytical.gnss.data;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;

  20. import java.util.function.Function;

  21. /**
  22.  * Container for data contained in a GPS/QZNSS civilian navigation message.
  23.  * @param <T> type of the field elements
  24.  * @param <O> type of the orbital elements (non-field version)
  25.  * @author Luc Maisonobe
  26.  * @since 13.0
  27.  */
  28. public abstract class FieldCivilianNavigationMessage<T extends CalculusFieldElement<T>,
  29.                                                      O extends CivilianNavigationMessage<O>>
  30.     extends FieldAbstractNavigationMessage<T, O>
  31.     implements FieldGNSSClockElements<T> {

  32.     /** Indicator for CNV 2 messages. */
  33.     private final boolean cnv2;

  34.     /** Change rate in semi-major axis (m/s). */
  35.     private T aDot;

  36.     /** Change rate in Δn₀. */
  37.     private T deltaN0Dot;

  38.     /** The user SV accuracy (m). */
  39.     private T svAccuracy;

  40.     /** Satellite health status. */
  41.     private int svHealth;

  42.     /** Inter Signal Delay for L1 C/A. */
  43.     private T iscL1CA;

  44.     /** Inter Signal Delay for L1 CD. */
  45.     private T iscL1CD;

  46.     /** Inter Signal Delay for L1 CP. */
  47.     private T iscL1CP;

  48.     /** Inter Signal Delay for L2 C. */
  49.     private T iscL2C;

  50.     /** Inter Signal Delay for L5I. */
  51.     private T iscL5I5;

  52.     /** Inter Signal Delay for L5Q. */
  53.     private T iscL5Q5;

  54.     /** Elevation-Dependent User Range Accuracy. */
  55.     private int uraiEd;

  56.     /** Term 0 of Non-Elevation-Dependent User Range Accuracy. */
  57.     private int uraiNed0;

  58.     /** Term 1 of Non-Elevation-Dependent User Range Accuracy. */
  59.     private int uraiNed1;

  60.     /** Term 2 of Non-Elevation-Dependent User Range Accuracy. */
  61.     private int uraiNed2;

  62.     /** Constructor from non-field instance.
  63.      * @param field    field to which elements belong
  64.      * @param original regular non-field instance
  65.      */
  66.     protected FieldCivilianNavigationMessage(final Field<T> field, final O original) {
  67.         super(field, original);
  68.         this.cnv2 = original.isCnv2();
  69.         setADot(field.getZero().newInstance(original.getADot()));
  70.         setDeltaN0Dot(field.getZero().newInstance(original.getDeltaN0Dot()));
  71.         setSvAccuracy(field.getZero().newInstance(original.getSvAccuracy()));
  72.         setSvHealth(original.getSvHealth());
  73.         setIscL1CA(field.getZero().newInstance(original.getIscL1CA()));
  74.         setIscL1CD(field.getZero().newInstance(original.getIscL1CD()));
  75.         setIscL1CP(field.getZero().newInstance(original.getIscL1CP()));
  76.         setIscL2C(field.getZero().newInstance(original.getIscL2C()));
  77.         setIscL5I5(field.getZero().newInstance(original.getIscL5I5()));
  78.         setIscL5Q5(field.getZero().newInstance(original.getIscL5Q5()));
  79.         setUraiEd(original.getUraiEd());
  80.         setUraiNed0(original.getUraiNed0());
  81.         setUraiNed1(original.getUraiNed1());
  82.         setUraiNed2(original.getUraiNed2());
  83.     }

  84.     /** Constructor from different field instance.
  85.      * @param <V> type of the old field elements
  86.      * @param original regular non-field instance
  87.      * @param converter for field elements
  88.      */
  89.     protected <V extends CalculusFieldElement<V>> FieldCivilianNavigationMessage(final Function<V, T> converter,
  90.                                                                                  final FieldCivilianNavigationMessage<V, O> original) {
  91.         super(converter, original);
  92.         this.cnv2 = original.isCnv2();
  93.         setADot(converter.apply(original.getADot()));
  94.         setDeltaN0Dot(converter.apply(original.getDeltaN0Dot()));
  95.         setSvAccuracy(converter.apply(original.getSvAccuracy()));
  96.         setSvHealth(original.getSvHealth());
  97.         setIscL1CA(converter.apply(original.getIscL1CA()));
  98.         setIscL1CD(converter.apply(original.getIscL1CD()));
  99.         setIscL1CP(converter.apply(original.getIscL1CP()));
  100.         setIscL2C(converter.apply(original.getIscL2C()));
  101.         setIscL5I5(converter.apply(original.getIscL5I5()));
  102.         setIscL5Q5(converter.apply(original.getIscL5Q5()));
  103.         setUraiEd(original.getUraiEd());
  104.         setUraiNed0(original.getUraiNed0());
  105.         setUraiNed1(original.getUraiNed1());
  106.         setUraiNed2(original.getUraiNed2());
  107.     }

  108.     /** Check it message is a CNV2 message.
  109.      * @return true if message is a CNV2 message
  110.      */
  111.     public boolean isCnv2() {
  112.         return cnv2;
  113.     }

  114.     /** {@inheritDoc} */
  115.     @Override
  116.     public T getADot() {
  117.         return aDot;
  118.     }

  119.     /**
  120.      * Setter for the change rate in semi-major axis.
  121.      * @param value the change rate in semi-major axis
  122.      */
  123.     public void setADot(final T value) {
  124.         this.aDot = value;
  125.     }

  126.     /** {@inheritDoc} */
  127.     @Override
  128.     public T getDeltaN0Dot() {
  129.         return deltaN0Dot;
  130.     }

  131.     /**
  132.      * Setter for change rate in Δn₀.
  133.      * @param deltaN0Dot change rate in Δn₀
  134.      */
  135.     public void setDeltaN0Dot(final T deltaN0Dot) {
  136.         this.deltaN0Dot = deltaN0Dot;
  137.     }

  138.     /**
  139.      * Getter for the user SV accuray (meters).
  140.      * @return the user SV accuracy
  141.      */
  142.     public T getSvAccuracy() {
  143.         return svAccuracy;
  144.     }

  145.     /**
  146.      * Setter for the user SV accuracy.
  147.      * @param svAccuracy the value to set
  148.      */
  149.     public void setSvAccuracy(final T svAccuracy) {
  150.         this.svAccuracy = svAccuracy;
  151.     }

  152.     /**
  153.      * Getter for the satellite health status.
  154.      * @return the satellite health status
  155.      */
  156.     public int getSvHealth() {
  157.         return svHealth;
  158.     }

  159.     /**
  160.      * Setter for the satellite health status.
  161.      * @param svHealth the value to set
  162.      */
  163.     public void setSvHealth(final int svHealth) {
  164.         this.svHealth = svHealth;
  165.     }

  166.     /**
  167.      * Getter for inter Signal Delay for L1 C/A.
  168.      * @return inter signal delay
  169.      */
  170.     public T getIscL1CA() {
  171.         return iscL1CA;
  172.     }

  173.     /**
  174.      * Setter for inter Signal Delay for L1 C/A.
  175.      * @param delay delay to set
  176.      */
  177.     public void setIscL1CA(final T delay) {
  178.         this.iscL1CA = delay;
  179.     }

  180.     /**
  181.      * Getter for inter Signal Delay for L1 CD.
  182.      * @return inter signal delay
  183.      */
  184.     public T getIscL1CD() {
  185.         return iscL1CD;
  186.     }

  187.     /**
  188.      * Setter for inter Signal Delay for L1 CD.
  189.      * @param delay delay to set
  190.      */
  191.     public void setIscL1CD(final T delay) {
  192.         this.iscL1CD = delay;
  193.     }

  194.     /**
  195.      * Getter for inter Signal Delay for L1 CP.
  196.      * @return inter signal delay
  197.      */
  198.     public T getIscL1CP() {
  199.         return iscL1CP;
  200.     }

  201.     /**
  202.      * Setter for inter Signal Delay for L1 CP.
  203.      * @param delay delay to set
  204.      */
  205.     public void setIscL1CP(final T delay) {
  206.         this.iscL1CP = delay;
  207.     }

  208.     /**
  209.      * Getter for inter Signal Delay for L2 C.
  210.      * @return inter signal delay
  211.      */
  212.     public T getIscL2C() {
  213.         return iscL2C;
  214.     }

  215.     /**
  216.      * Setter for inter Signal Delay for L2 C.
  217.      * @param delay delay to set
  218.      */
  219.     public void setIscL2C(final T delay) {
  220.         this.iscL2C = delay;
  221.     }

  222.     /**
  223.      * Getter for inter Signal Delay for L5I.
  224.      * @return inter signal delay
  225.      */
  226.     public T getIscL5I5() {
  227.         return iscL5I5;
  228.     }

  229.     /**
  230.      * Setter for inter Signal Delay for L5I.
  231.      * @param delay delay to set
  232.      */
  233.     public void setIscL5I5(final T delay) {
  234.         this.iscL5I5 = delay;
  235.     }

  236.     /**
  237.      * Getter for inter Signal Delay for L5Q.
  238.      * @return inter signal delay
  239.      */
  240.     public T getIscL5Q5() {
  241.         return iscL5Q5;
  242.     }

  243.     /**
  244.      * Setter for inter Signal Delay for L5Q.
  245.      * @param delay delay to set
  246.      */
  247.     public void setIscL5Q5(final T delay) {
  248.         this.iscL5Q5 = delay;
  249.     }

  250.     /**
  251.      * Getter for Elevation-Dependent User Range Accuracy.
  252.      * @return Elevation-Dependent User Range Accuracy
  253.      */
  254.     public int getUraiEd() {
  255.         return uraiEd;
  256.     }

  257.     /**
  258.      * Setter for Elevation-Dependent User Range Accuracy.
  259.      * @param uraiEd Elevation-Dependent User Range Accuracy
  260.      */
  261.     public void setUraiEd(final int uraiEd) {
  262.         this.uraiEd = uraiEd;
  263.     }

  264.     /**
  265.      * Getter for term 0 of Non-Elevation-Dependent User Range Accuracy.
  266.      * @return term 0 of Non-Elevation-Dependent User Range Accuracy
  267.      */
  268.     public int getUraiNed0() {
  269.         return uraiNed0;
  270.     }

  271.     /**
  272.      * Setter for term 0 of Non-Elevation-Dependent User Range Accuracy.
  273.      * @param uraiNed0 term 0 of Non-Elevation-Dependent User Range Accuracy
  274.      */
  275.     public void setUraiNed0(final int uraiNed0) {
  276.         this.uraiNed0 = uraiNed0;
  277.     }

  278.     /**
  279.      * Getter for term 1 of Non-Elevation-Dependent User Range Accuracy.
  280.      * @return term 1 of Non-Elevation-Dependent User Range Accuracy
  281.      */
  282.     public int getUraiNed1() {
  283.         return uraiNed1;
  284.     }

  285.     /**
  286.      * Setter for term 1 of Non-Elevation-Dependent User Range Accuracy.
  287.      * @param uraiNed1 term 1 of Non-Elevation-Dependent User Range Accuracy
  288.      */
  289.     public void setUraiNed1(final int uraiNed1) {
  290.         this.uraiNed1 = uraiNed1;
  291.     }

  292.     /**
  293.      * Getter for term 2 of Non-Elevation-Dependent User Range Accuracy.
  294.      * @return term 2 of Non-Elevation-Dependent User Range Accuracy
  295.      */
  296.     public int getUraiNed2() {
  297.         return uraiNed2;
  298.     }

  299.     /**
  300.      * Setter for term 2 of Non-Elevation-Dependent User Range Accuracy.
  301.      * @param uraiNed2 term 2 of Non-Elevation-Dependent User Range Accuracy
  302.      */
  303.     public void setUraiNed2(final int uraiNed2) {
  304.         this.uraiNed2 = uraiNed2;
  305.     }

  306. }