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.     /** Flags.
  63.      * @since 14.0
  64.      */
  65.     private int flags;

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

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

  114.     /** Check it message is a CNV2 message.
  115.      * @return true if message is a CNV2 message
  116.      */
  117.     public boolean isCnv2() {
  118.         return cnv2;
  119.     }

  120.     /** {@inheritDoc} */
  121.     @Override
  122.     public T getADot() {
  123.         return aDot;
  124.     }

  125.     /**
  126.      * Setter for the change rate in semi-major axis.
  127.      * @param value the change rate in semi-major axis
  128.      */
  129.     public void setADot(final T value) {
  130.         this.aDot = value;
  131.     }

  132.     /** {@inheritDoc} */
  133.     @Override
  134.     public T getDeltaN0Dot() {
  135.         return deltaN0Dot;
  136.     }

  137.     /**
  138.      * Setter for change rate in Δn₀.
  139.      * @param deltaN0Dot change rate in Δn₀
  140.      */
  141.     public void setDeltaN0Dot(final T deltaN0Dot) {
  142.         this.deltaN0Dot = deltaN0Dot;
  143.     }

  144.     /**
  145.      * Getter for the user SV accuray (meters).
  146.      * @return the user SV accuracy
  147.      */
  148.     public T getSvAccuracy() {
  149.         return svAccuracy;
  150.     }

  151.     /**
  152.      * Setter for the user SV accuracy.
  153.      * @param svAccuracy the value to set
  154.      */
  155.     public void setSvAccuracy(final T svAccuracy) {
  156.         this.svAccuracy = svAccuracy;
  157.     }

  158.     /**
  159.      * Getter for the satellite health status.
  160.      * @return the satellite health status
  161.      */
  162.     public int getSvHealth() {
  163.         return svHealth;
  164.     }

  165.     /**
  166.      * Setter for the satellite health status.
  167.      * @param svHealth the value to set
  168.      */
  169.     public void setSvHealth(final int svHealth) {
  170.         this.svHealth = svHealth;
  171.     }

  172.     /**
  173.      * Getter for inter Signal Delay for L1 C/A.
  174.      * @return inter signal delay
  175.      */
  176.     public T getIscL1CA() {
  177.         return iscL1CA;
  178.     }

  179.     /**
  180.      * Setter for inter Signal Delay for L1 C/A.
  181.      * @param delay delay to set
  182.      */
  183.     public void setIscL1CA(final T delay) {
  184.         this.iscL1CA = delay;
  185.     }

  186.     /**
  187.      * Getter for inter Signal Delay for L1 CD.
  188.      * @return inter signal delay
  189.      */
  190.     public T getIscL1CD() {
  191.         return iscL1CD;
  192.     }

  193.     /**
  194.      * Setter for inter Signal Delay for L1 CD.
  195.      * @param delay delay to set
  196.      */
  197.     public void setIscL1CD(final T delay) {
  198.         this.iscL1CD = delay;
  199.     }

  200.     /**
  201.      * Getter for inter Signal Delay for L1 CP.
  202.      * @return inter signal delay
  203.      */
  204.     public T getIscL1CP() {
  205.         return iscL1CP;
  206.     }

  207.     /**
  208.      * Setter for inter Signal Delay for L1 CP.
  209.      * @param delay delay to set
  210.      */
  211.     public void setIscL1CP(final T delay) {
  212.         this.iscL1CP = delay;
  213.     }

  214.     /**
  215.      * Getter for inter Signal Delay for L2 C.
  216.      * @return inter signal delay
  217.      */
  218.     public T getIscL2C() {
  219.         return iscL2C;
  220.     }

  221.     /**
  222.      * Setter for inter Signal Delay for L2 C.
  223.      * @param delay delay to set
  224.      */
  225.     public void setIscL2C(final T delay) {
  226.         this.iscL2C = delay;
  227.     }

  228.     /**
  229.      * Getter for inter Signal Delay for L5I.
  230.      * @return inter signal delay
  231.      */
  232.     public T getIscL5I5() {
  233.         return iscL5I5;
  234.     }

  235.     /**
  236.      * Setter for inter Signal Delay for L5I.
  237.      * @param delay delay to set
  238.      */
  239.     public void setIscL5I5(final T delay) {
  240.         this.iscL5I5 = delay;
  241.     }

  242.     /**
  243.      * Getter for inter Signal Delay for L5Q.
  244.      * @return inter signal delay
  245.      */
  246.     public T getIscL5Q5() {
  247.         return iscL5Q5;
  248.     }

  249.     /**
  250.      * Setter for inter Signal Delay for L5Q.
  251.      * @param delay delay to set
  252.      */
  253.     public void setIscL5Q5(final T delay) {
  254.         this.iscL5Q5 = delay;
  255.     }

  256.     /**
  257.      * Getter for Elevation-Dependent User Range Accuracy.
  258.      * @return Elevation-Dependent User Range Accuracy
  259.      */
  260.     public int getUraiEd() {
  261.         return uraiEd;
  262.     }

  263.     /**
  264.      * Setter for Elevation-Dependent User Range Accuracy.
  265.      * @param uraiEd Elevation-Dependent User Range Accuracy
  266.      */
  267.     public void setUraiEd(final int uraiEd) {
  268.         this.uraiEd = uraiEd;
  269.     }

  270.     /**
  271.      * Getter for term 0 of Non-Elevation-Dependent User Range Accuracy.
  272.      * @return term 0 of Non-Elevation-Dependent User Range Accuracy
  273.      */
  274.     public int getUraiNed0() {
  275.         return uraiNed0;
  276.     }

  277.     /**
  278.      * Setter for term 0 of Non-Elevation-Dependent User Range Accuracy.
  279.      * @param uraiNed0 term 0 of Non-Elevation-Dependent User Range Accuracy
  280.      */
  281.     public void setUraiNed0(final int uraiNed0) {
  282.         this.uraiNed0 = uraiNed0;
  283.     }

  284.     /**
  285.      * Getter for term 1 of Non-Elevation-Dependent User Range Accuracy.
  286.      * @return term 1 of Non-Elevation-Dependent User Range Accuracy
  287.      */
  288.     public int getUraiNed1() {
  289.         return uraiNed1;
  290.     }

  291.     /**
  292.      * Setter for term 1 of Non-Elevation-Dependent User Range Accuracy.
  293.      * @param uraiNed1 term 1 of Non-Elevation-Dependent User Range Accuracy
  294.      */
  295.     public void setUraiNed1(final int uraiNed1) {
  296.         this.uraiNed1 = uraiNed1;
  297.     }

  298.     /**
  299.      * Getter for term 2 of Non-Elevation-Dependent User Range Accuracy.
  300.      * @return term 2 of Non-Elevation-Dependent User Range Accuracy
  301.      */
  302.     public int getUraiNed2() {
  303.         return uraiNed2;
  304.     }

  305.     /**
  306.      * Setter for term 2 of Non-Elevation-Dependent User Range Accuracy.
  307.      * @param uraiNed2 term 2 of Non-Elevation-Dependent User Range Accuracy
  308.      */
  309.     public void setUraiNed2(final int uraiNed2) {
  310.         this.uraiNed2 = uraiNed2;
  311.     }

  312.     /** Get the flags.
  313.      * @return flags
  314.      * @since 14.0
  315.      */
  316.     public int getFlags() {
  317.         return flags;
  318.     }

  319.     /** Set the flags.
  320.      * @param flags flags
  321.      * @since 14.0
  322.      */
  323.     public void setFlags(final int flags) {
  324.         this.flags = flags;
  325.     }

  326. }