Files
banban/ql-kernel/threadx/common/include/RXN_MSL_Ephemeris.h
T

259 lines
21 KiB
C

/*
* Copyright (c) 2021 Rx Networks, Inc. All rights reserved.
*
* Property of Rx Networks
* Proprietary and Confidential
* Do NOT distribute
*
* Any use, distribution, or copying of this document requires a
* license agreement with Rx Networks.
* Any product development based on the contents of this document
* requires a license agreement with Rx Networks.
* If you have received this document in error, please notify the
* sender immediately by telephone and email, delete the original
* document from your electronic files, and destroy any printed
* versions.
*
* This file contains sample code only and the code carries no
* warranty whatsoever.
* Sample code is used at your own risk and may not be functional.
* It is not intended for commercial use.
*
* Example code to illustrate how to integrate Rx Networks PG Lite
* System into a client application.
*
* The emphasis is in trying to explain what goes on in the software,
* and how to the various API functions relate to each other,
* rather than providing a fully optimized implementation.
*
*************************************************************************
* $LastChangedDate: 2021-01-14 17:51:14 -0800 (Thu, 14 Jan 2021) $
* $Revision: 158469 $
*************************************************************************
*/
#ifndef RXN_MSL_EPHEMERIS_H
#define RXN_MSL_EPHEMERIS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "RXN_data_types.h" /* Defines RXN Data Types. */
#define MSL_NUM_BITS_PER_BYTE 8
#define MSL_GPS_RTCM_BITS_PER_PRN 488
#define MSL_BDS_RTCM_BITS_PER_PRN 512 /* 511 bits plus 1 fill bit (zero). */
#define MSL_GAL_RTCM_BITS_PER_PRN 504
#define MSL_QZS_RTCM_BITS_PER_PRN 488 /* 485 bits plus 3 fill bits (zeros). */
#define MSL_MAX_GPS_RTCM_DATA_BYTES 1952 /* 488 * 32 / 8 = 1952. */
#define MSL_MAX_BDS_RTCM_DATA_BYTES 4032 /* 512 * 63 / 8 = 4032. */
#define MSL_MAX_GAL_RTCM_DATA_BYTES 2268 /* 504 * 36 / 8 = 2268. */
#define MSL_MAX_QZS_RTCM_DATA_BYTES 610 /* 488 * 10 / 8 = 610. */
#define RXN_MAX_GLO_KEP_RTCM_DATA_BYTES 1464
/**
* \brief
* A structure containing GPS ephemeris data elements.
*
* Please refer to the RTCM Standard 10403.3 for more information
* on the elements in this structure.
* The scale factor is assumed to be 1.0, if not specified otherwise.
*
* \see
* RXN_MSL_GetGpsEphemeris()
*
* \since
* 1.0.0
*/
typedef struct RXN_MSL_GPS_Ephem
{
unsigned short msgNumber; /*!< \brief Message 1019. */
unsigned char prn; /*!< \brief A GPS Satellite ID number from 1 to 32 refers to the PRN code of the GPS satellite. */
unsigned short gpsWeek; /*!< \brief Roll-over every 1024 weeks starting from Midnight on the night of January 5/Morning January 6, 1980. Range: (0..1023). */
unsigned char ura; /*!< \brief User Range Accuracy index. Range: (0..15). */
unsigned char codeOnL2; /*!< \brief Code on L2. 00 - Reserved. 01 - P code ON. 10 - C/A code ON. 11 - L2C ON. Range: (0..3). */
signed short idot; /*!< \brief Rate of inclination (semi-circle per sec). Scale: 2^-43. Range: (-8192..8191). */
unsigned char iode; /*!< \brief Issue Of Data (Ephemeris). Range: (0..255). */
unsigned short toc; /*!< \brief Time Of Clock or time of week. Scale: 2^4. Unit: seconds. Range: (0..75599). */
signed char af2; /*!< \brief Clock Drift Rate Correction Coefficient. Scale: 2^-55. Unit: sec/sec^2. Range: (-128..127). */
signed short af1; /*!< \brief Clock Drift Correction Coefficient. Scale: 2^-43. Unit: sec/sec. Range: (-32768..32767). */
signed int af0; /*!< \brief Clock Bias Correction Coefficient. Scale: 2^-31. Unit: sec. Range: (-2097152..2097151). */
unsigned short iodc; /*!< \brief Issue Of Data (Clock). Range: (0..1023). */
signed short crs; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Unit: meters. Range = (-32,768..32,767). */
signed short deltaN; /*!< \brief Mean Motion Difference from Computed Value. Scale: 2^-43. Unit: semi-circles/sec. */
signed int m0; /*!< \brief Mean Anomaly at Reference Time. Scale: 2^-31. Unit: semi-circles. */
signed short cuc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Arguement of Latitude. Scale: 2^-29. Unit: radians. */
unsigned int e; /*!< \brief Eccentricity. Scale: 2^-33. Unit: N/A. */
signed short cus; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. Scale: 2^-29. Unit: radians. */
unsigned int sqrtA; /*!< \brief Square Root of the Semi-Major Axis. Scale: 2^-19. Unit: square root of meters. */
unsigned short toe; /*!< \brief Time Of Ephemeris. Scale: 2^4. Unit: seconds. */
signed short cic; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Unit: radians. */
signed int omega0; /*!< \brief Longitude of Ascending Node of Orbit Plane and Weekly Epoch. Scale: 2^-31. Unit: semi-circles. */
signed short cis; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Unit: radians. */
signed int i0; /*!< \brief Inclination Angle at Reference Time. Scale: 2^-31. Unit: semi-circles. */
signed short crc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Unit: meters. */
signed int omega; /*!< \brief Argumentof Perigee. Scale: 2^-31. Unit: semi-circles. */
signed int omegaDot; /*!< \brief Rate of Right Ascension. Scale: 2^-43. Unit: semi-circles/sec. */
signed char tgd; /*!< \brief Group Delay. Scale: 2^-31. Unit: sec. */
unsigned char health; /*!< \brief Corresponds to the SV health value. 6 bits. MSb: 0 - all NAV data are OK. 1 - some or all NAV data are bad. See GPS SPS Signal Spec, 2.4.3.3. */
unsigned char flag; /*!< \brief GPS L2 P data flag. 1 bit. 0 - L2 P-Code NAV data ON. 1 - L2 P-Code NAV data OFF. */
unsigned char fit; /*!< \brief GPS Fit Interval. 1 bit. 0 - curve-fit interval is 4 hours. 1 - curve-fit is greater than 4 hours. */
} RXN_MSL_GPS_Ephem_t;
/**
* \brief
* A structure containing Beidou ephemeris data elements.
*
* Please refer to the RTCM Standard 10403.3 for more information
* on the elements in this structure.
* The scale factor is assumed to be 1.0, if not specified otherwise.
*
* \see
* RXN_MSL_GetBeidouEphemeris()
*
* \since
* 1.0.0
*/
typedef struct RXN_MSL_Beidou_Ephem
{
unsigned short msgNumber; /*!< \brief Message 1042. */
unsigned char prn; /*!< \brief Ephemeris PRN or SV. Range: (1..63). */
unsigned short bdsWeek; /*!< \brief BDT week number. Range: (0..8191). Roll-over every 8192 weeks starting from 00:00:00 UTC on Jan. 1, 2006 of BDT. */
unsigned char urai; /*!< \brief User Range Accuracy Index. Range: (0..15). See BDS-SIS-ICD-2.0 5.2.4.5. */
signed short idot; /*!< \brief Rate of Inclination Angle. Scale: 2^-43. Units: semi-circles/sec. See See BDS-SIS-ICD-2.0 5.2.4.12. */
unsigned char aode; /*!< \brief Age of Data Ephemeris. Range: (0..31). See BDS-SIS-ICD-2.0 5.2.4.11. */
unsigned int toc; /*!< \brief Time Of Clock or time of week for BEIDOU time system. Scale: 2^3. Units: seconds. See BDS-SIS-ICD-2.0 5.2.4.10. */
signed short af2; /*!< \brief Clock Drift Rate Correction Coefficient. Scale: 2^-66. Units: sec/sec^2. See BDS-SIS-ICD-2.0 5.2.4.10. */
signed int af1; /*!< \brief Clock Drift Correction Coefficient. Scale: 2^-50. Units: sec/sec. See BDS-SIS-ICD-2.0 5.2.4.10. */
signed int af0; /*!< \brief Clock Bias Correction Coefficient. Scale: 2^-33. Units: sec. See BDS-SIS-ICD-2.0 5.2.4.10. */
unsigned char aodc; /*!< \brief Age of Data Clock. Range: (0..31). See BDS-SIS-ICD-2.0 5.2.4.9. */
signed int crs; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. Scale: 2^-6. Units: meters. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed short deltaN; /*!< \brief Mean Motion Difference from Computed Value. Scale: 2^-43. Units: semi-circles/sec. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int m0; /*!< \brief Mean Anomaly at Reference Time. Scale: 2^-31. Units: semi-circles. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int cuc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Arguement of Latitude. Scale: 2^-31. Units: radians. See BDS-SIS-ICD-2.0 5.2.4.12. */
unsigned int e; /*!< \brief Eccentricity. Scale: 2^-33. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int cus; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. Scale: 2^-31. Units: radians. See BDS-SIS-ICD-2.0 5.2.4.12. */
unsigned int sqrtA; /*!< \brief Square Root of the Semi-Major Axis. Range: (0..8192). Scale: 2^-19. Units: square root of meters. See BDS-SIS-ICD-2.0 5.2.4.12. */
unsigned int toe; /*!< \brief Time Of Ephemerisfor BEIDOU time system. Scale: 2^3. Units: seconds. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int cic; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Angle of Inclination. Scale: 2^-31. Units: radians. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int omega0; /*!< \brief Longitude of Ascending Node of Orbit Plane and Weekly Epoch. Scale: 2^-31. Units: semi-circles. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int cis; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. Scale: 2^-31. Units: radians. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int i0; /*!< \brief Inclination Angle at Reference Time. Scale: 2^-31. Units: semi-circles. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int crc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Orbit Radius. Scale: 2^-6. Units: meters. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int omega; /*!< \brief Argument of Perigee. Scale: 2^-31. Units: semi-circles. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed int omegaDot; /*!< \brief Rate of Right Ascension. Scale: 2^-43. Units: semi-circles/sec. See BDS-SIS-ICD-2.0 5.2.4.12. */
signed short tgd1; /*!< \brief Equipment Group Delay Differential. Scale: 0.1. Units: nanosec. See BDS-SIS-ICD-2.0 5.2.4.8. */
signed short tgd2; /*!< \brief Equipment Group Delay Differential. Scale: 0.1. Units: nanosec. See BDS-SIS-ICD-2.0 5.2.4.8. */
unsigned char health; /*!< \brief Autonomous satellite health flag. Range: (0..1). See BDS-SIS-ICD-2.0 5.2.4.6. */
} RXN_MSL_Beidou_Ephem_t;
typedef struct RXN_MSL_Glo_Ephem
{
} RXN_MSL_Glo_Ephem_t;
/**
* \brief
* A structure containing Galileo ephemeris data elements.
*
* Please refer to the RTCM Standard 10403.3 for more information
* on the elements in this structure.
* The scale factor is assumed to be 1.0, if not specified otherwise.
*
* \see
* RXN_MSL_GetGalileoEphemeris()
*
* \since
* 1.0.0
*/
typedef struct RXN_MSL_Galileo_Ephem
{
unsigned short msgNumber; /*!< \brief Message 1046. */
unsigned char prn; /*!< \brief Ephemeris PRN or SV. Range: (1..36). */
unsigned short galWeek; /*!< \brief GAL Week Number. Roll-over every 4096 weeks (about 78 years). Range: (0..4095). */
unsigned short iodnav; /*!< \brief Issue of Data for navigation data (IODnav). Range: (0..1023). */
unsigned char sisa; /*!< \brief Galileo SV SISA (SIS Accuracy). */
signed short idot; /*!< \brief Rate of Inclination Angle. Scale: 2^-43. Units: semi-circles/sec. See OS SIS ICD Issue 1.2. */
unsigned short toc; /*!< \brief Time Of Clock or time of week for GALILEO time system. Scale: 60. Units: seconds. See OS SIS ICD Issue 1.2. */
signed char af2; /*!< \brief Clock Drift Rate Correction Coefficient. Scale: 2^-59. Units: sec/sec^2. See OS SIS ICD Issue 1.2. */
signed int af1; /*!< \brief Clock Drift Correction Coefficient. Scale: 2^-46. Units: sec/sec. See OS SIS ICD Issue 1.2. */
signed int af0; /*!< \brief Clock Bias Correction Coefficient. Scale: 2^-34. Units: sec. See OS SIS ICD Issue 1.2. */
signed short crs; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Units: meters. See OS SIS ICD Issue 1.2. */
signed short deltaN; /*!< \brief Mean Motion Difference from Computed Value. Scale: 2^-43. Units: semi-circles/sec. See OS SIS ICD Issue 1.2. */
signed int m0; /*!< \brief Mean Anomaly at Reference Time. Scale: 2^-31. Units: semi-circles. See OS SIS ICD Issue 1.2. */
signed short cuc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Arguement of Latitude. Scale: 2^-29. Units: radians. See OS SIS ICD Issue 1.2. */
unsigned int e; /*!< \brief Eccentricity. Scale: 2^-33. Units: N/A - Dimensionless. See OS SIS ICD Issue 1.2. */
signed short cus; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. Scale: 2^-29. Units: radians. See OS SIS ICD Issue 1.2. */
unsigned int sqrtA; /*!< \brief Square Root of the Semi-Major Axis. Scale: 2^-19. Units: square root of meters. See OS SIS ICD Issue 1.2. */
unsigned short toe; /*!< \brief Time Of Ephemeris for GALILEO time system. Scale: 60. Units: seconds. See OS SIS ICD Issue 1.2. */
signed short cic; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Units: radians. See OS SIS ICD Issue 1.2. */
signed int omega0; /*!< \brief Longitude of Ascending Node of Orbit Plane and Weekly Epoch. Scale: 2^-31. Units: semi-circles. See OS SIS ICD Issue 1.2. */
signed short cis; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Units: radians. See OS SIS ICD Issue 1.2. */
signed int i0; /*!< \brief Inclination Angle at Reference Time. Scale: 2^-31. Units: semi-circles. See OS SIS ICD Issue 1.2. */
signed short crc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Units: meters. See OS SIS ICD Issue 1.2. */
signed int w; /*!< \brief Argument of Perigee. Scale: 2^-31. Units: semi-circles. See OS SIS ICD Issue 1.2. */
signed int omegaDot; /*!< \brief Rate of Right Ascension. Scale: 2^-43. Units: semi-circles/sec. See OS SIS ICD Issue 1.2. */
signed short bgde5a; /*!< \brief E1/E5a Broadcast Group Delay. Scale: 2^-32. Units: sec. */
signed short bgde5b; /*!< \brief Broadcast Group Delay E5b/E1 (reserved). Scale: 2^-32. Units: sec. */
unsigned char e5bHealth; /*!< \brief The E5b Signal Health Status Bit Values are: 0 - Signal OK, 1 - Signal out of service, 2 - Signal will be out of service, 3 - Signal Component currently in Test. */
unsigned char e5bValidity; /*!< \brief Galileo SOL NAV Data Validity Status (SOLDVS). */
unsigned char e1bHealth; /*!< \brief The E1b Signal Health Status Bit Values are: 0 - Signal OK, 1 - Signal out of service, 2 - Signal will be out of service, 3 - Signal Component currently in Test. */
unsigned char e1bValidity; /*!< \brief Galileo E1-B Data Validity Status. */
unsigned char reserved; /*!< \brief All reserved bits should be set to "0". However, since the value is subject to change in future versions, decoding should not rely on a zero value. */
} RXN_MSL_Galileo_Ephem_t;
/**
* \brief
* A structure containing QZSS ephemeris data elements.
*
* Please refer to the RTCM Standard 10403.3 for more information
* on the elements in this structure.
* The scale factor is assumed to be 1.0, if not specified otherwise.
*
* \see
* RXN_MSL_GetQzssEphemeris()
*
* \since
* 1.0.0
*/
typedef struct RXN_MSL_QZSS_Ephem
{
unsigned short msgNumber; /*!< \brief Message 1044. */
unsigned char satID; /*!< \brief QZSS Satellite ID. Range: (1..10). The ID map to the PRN numbers as follows: 1: 193, 2: 194, ..., 10: 202. */
unsigned short toc; /*!< \brief Time Of Clock or time of week. Scale: 2^4. Units: seconds. */
signed char af2; /*!< \brief Clock Drift Rate Correction Coefficient. Scale: 2^-55. Units: sec/sec^2. */
signed short af1; /*!< \brief Clock Drift Correction Coefficient. Scale: 2^-43. Units: sec/sec. */
signed int af0; /*!< \brief Clock Bias Correction Coefficient. Scale: 2^-31. Units: sec. */
unsigned char iode; /*!< \brief Issue Of Data (Ephemeris). */
signed short crs; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Units: meters. */
signed short deltaN; /*!< \brief Mean Motion Difference from Computed Value. Scale: 2^-43. Units: semi-circles/sec. */
signed int m0; /*!< \brief Mean Anomaly at Reference Time. Scale: 2^-31. Units: semi-circles. */
signed short cuc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Arguement of Latitude. Scale: 2^-29. Units: radians. */
unsigned int e; /*!< \brief Eccentricity. Scale: 2^-33. Units: N/A - Dimensionless. */
signed short cus; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. Scale: 2^-29. Units: radians. */
unsigned int sqrtA; /*!< \brief Square Root of the Semi-Major Axis. Scale: 2^-19. Units: square root of meters. */
unsigned short toe; /*!< \brief Time Of Ephemeris. Scale: 2^4. Units: seconds. */
signed short cic; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Units: radians. */
signed int omega0; /*!< \brief Longitude of Ascending Node of Orbit Plane and Weekly Epoch. Scale: 2^-31. Units: semi-circles. */
signed short cis; /*!< \brief Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. Scale: 2^-29. Units: radians. */
signed int i0; /*!< \brief Inclination Angle at Reference Time. Scale: 2^-31. Units: semi-circles. */
signed short crc; /*!< \brief Amplitude of the Cos Harmonic Correction Term to the Orbit Radius. Scale: 2^-5. Units: meters. */
signed int w; /*!< \brief Argument of Perigee. Scale: 2^-31. Units: semi-circles. */
signed int omegaDot; /*!< \brief Rate of Right Ascension. Scale: 2^-43. Units: semi-circles/sec. */
signed short idot; /*!< \brief Rate of Inclination Angle. Scale: 2^-43. Units: semi-circles/sec. */
unsigned char codeOnL2; /*!< \brief QZSS Codes Code on L2 Channel. Range: (0..3). */
unsigned short qzsWeek; /*!< \brief GPS week number Range: (0..1023). Roll-over every 1024 weeks starting from Midnight on the night of January 5/Morning January 6, 1980. */
unsigned char ura; /*!< \brief User Range Accuracy index. Actual URA from broadcast ephemeris or estimated URA from predicted ephemeris. See IS-QZSS Section 5.1.2.1.3.2. */
unsigned char health; /*!< \brief Corresponds to the SV health value. 6 bits as described within See IS-QZSS 5.2.2.2.3(4). */
signed char tgd; /*!< \brief Group Delay. Scale: 2^-31. Units: sec. */
unsigned short iodc; /*!< \brief Issue Of Data (Clock). Range: (0..1023). */
unsigned char fit; /*!< \brief Fit interval relating to the fit interval flag. 0: curve-fit interval is 2 hours. 1: curve-fit is greater than 2 hours. */
} RXN_MSL_QZSS_Ephem_t;
unsigned short RXN_MSL_GetGpsEphemeris(RXN_MSL_GPS_Ephem_t* ephemeris, unsigned char maxPrnNum);
unsigned short RXN_MSL_GetBeidouEphemeris(RXN_MSL_Beidou_Ephem_t* ephemeris, unsigned char maxPrnNum);
unsigned short RXN_MSL_GetGalileoEphemeris(RXN_MSL_Galileo_Ephem_t* ephemeris, unsigned char maxPrnNum);
unsigned short RXN_MSL_GetQzssEphemeris(RXN_MSL_QZSS_Ephem_t* ephemeris, unsigned char maxPrnNum);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* RXN_MSL_EPHEMERIS_H */