Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
gnsstk::PNBBDSD2NavDataFactory Class Reference

Detailed Description

This class provides a factory that processes PackedNavBits data containing BeiDou D2 NAV data as defined in the BeiDou ICD. The results of the addData method (in the navOut argument) may contain any number of BDSD2NavAlm, BDSD2NavEph, BDSD2NavHealth or BDSD2NavTimeOffset objects, according to what data is fed to the method and what data is requested via the validity and type filters (see PNBNavDataFactory).

The D2 NAV data structure is set up to provide almanac and health data for PRNs >30 by flagging it in other almanac pages using the AmEpID. My interpretation of the ICD, and data seems to back this up, is that AmEpID is only meaningful when it is equal to 3 (b11) in subframe 4, pages 11-24. In this case, the subframe 5 page (11-24) in that same frame will correspond to the information in sections 5.2.4.14, 5.2.4.15 and 5.2.4.17. AmEpID can be set to 3 for other pages, but it doesn't seem to carry a meaning in that context.

With respect to validity checking, the following checks are performed:

The following data are discarded and never returned due to the fact that attempting to provide the data to users would result in exceptions and other software internal errors:

Currently ignored:

Definition at line 85 of file PNBBDSD2NavDataFactory.hpp.

#include <PNBBDSD2NavDataFactory.hpp>

Inheritance diagram for gnsstk::PNBBDSD2NavDataFactory:
Inheritance graph
[legend]

Classes

class  AmEpID
 Store transmit time and corresponding AmEpID for amEpIDMap. More...
 

Public Member Functions

bool addData (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut, double cadence=-1) override
 
void dumpState (std::ostream &s) const
 
bool filterTimeOffset (double a0, double a1)
 Return true if a0 and a1 are zero and double 0 filtering is enabled. More...
 
bool processAlm (unsigned pnum, const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processEph (unsigned long pgid, const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processSF5Pg101 (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processSF5Pg102 (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processSF5Pg116 (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processSF5Pg35 (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
bool processSF5Pg36 (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut)
 
void resetState () override
 
- Public Member Functions inherited from gnsstk::PNBNavDataFactory
 PNBNavDataFactory ()
 
virtual void setControl (const FactoryControl &ctrl)
 
virtual void setTypeFilter (const NavMessageTypeSet &nmts)
 
virtual void setValidityFilter (NavValidityType nvt)
 

Static Public Member Functions

static bool isAlmDefault (const PackedNavBitsPtr &navIn)
 

Protected Types

typedef std::shared_ptr< BDSD2NavAlmAlmPtr
 Alias for almanac objects. More...
 
typedef std::list< AlmPtrAlmPtrList
 Alias for list of almanac objects. More...
 

Protected Member Functions

bool finishAlm (AlmPtr &alm, bool fromWNa, const NavSatelliteID &key, NavDataPtrList &navOut)
 
void finishAlm (bool fromWNa, const NavSatelliteID &key, NavDataPtrList &navOut)
 
void makeHealth (const PackedNavBitsPtr &navIn, NavDataPtrList &navOut, unsigned long subjID, unsigned startBit1, unsigned numBits1, unsigned startBit2=0, unsigned numBits2=0)
 

Protected Attributes

std::map< NavSatelliteID, AlmPtrListalmAcc
 
std::map< NavSatelliteID, AmEpIDamEpIDMap
 
std::map< NavSatelliteID, std::vector< PackedNavBitsPtr > > ephAcc
 
std::map< unsigned, BDSWeekSecondfullWNaMap
 
std::map< NavSatelliteID, uint16_t > heaAcc
 
- Protected Attributes inherited from gnsstk::PNBNavDataFactory
FactoryControl factControl
 Configuration for the behavior of this factory. More...
 
NavValidityType navValidity
 Determines how the factory should filter added data. More...
 
bool processAlm
 If true, almanac data will be output by addData. More...
 
bool processEph
 If true, ephemeris data will be output by addData. More...
 
bool processHea
 If true, health data will be output by addData. More...
 
bool processIono
 If true, ionospheric data will be output by addData. More...
 
bool processISC
 If true, inter-signal correction data will be output by addData. More...
 
bool processTim
 If true, time offset data will be output by addData. More...
 

Member Typedef Documentation

◆ AlmPtr

typedef std::shared_ptr<BDSD2NavAlm> gnsstk::PNBBDSD2NavDataFactory::AlmPtr
protected

Alias for almanac objects.

Definition at line 227 of file PNBBDSD2NavDataFactory.hpp.

◆ AlmPtrList

typedef std::list<AlmPtr> gnsstk::PNBBDSD2NavDataFactory::AlmPtrList
protected

Alias for list of almanac objects.

Definition at line 229 of file PNBBDSD2NavDataFactory.hpp.

Member Function Documentation

◆ addData()

bool gnsstk::PNBBDSD2NavDataFactory::addData ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut,
double  cadence = -1 
)
overridevirtual

Process a PackedNavBits object, producing NavData objects as appropriate.

Parameters
[in]navInThe PackedNavBits data to process.
[out]navOutAny resulting NavData objects that were completed, usually as a result of adding navIn to the set of data.
[in]cadenceThis value is ignored in this class.
Returns
false on error.
Todo:
Implement a parity check

Implements gnsstk::PNBNavDataFactory.

Definition at line 71 of file PNBBDSD2NavDataFactory.cpp.

◆ dumpState()

void gnsstk::PNBBDSD2NavDataFactory::dumpState ( std::ostream &  s) const

For debugging purposes, dump the sizes of the accumulator maps.

Parameters
[in,out]sThe stream to write the debug output to.

Definition at line 976 of file PNBBDSD2NavDataFactory.cpp.

◆ filterTimeOffset()

bool gnsstk::PNBBDSD2NavDataFactory::filterTimeOffset ( double  a0,
double  a1 
)
inline

Return true if a0 and a1 are zero and double 0 filtering is enabled.

Definition at line 197 of file PNBBDSD2NavDataFactory.hpp.

◆ finishAlm() [1/2]

bool gnsstk::PNBBDSD2NavDataFactory::finishAlm ( PNBBDSD2NavDataFactory::AlmPtr alm,
bool  fromWNa,
const NavSatelliteID key,
NavDataPtrList navOut 
)
protected

Attempt to complete a single almanac object.

Parameters
[in,out]almA single almanac to potentially complete (set the "Toe"/"Toc" which are really the toa, health and fit interval).
[in]fromWNaIf true, this function is being called after processing subframe 5 page 8, which contains the WNa, which results in special processing.
[in]keyThe key used to look up the WNa for the almanac (the NavSatelliteID with the subject sat set to 0).
[out]navOutAny completed almanacs will be stored in here.
Returns
true if the given alm was completed or should be treated as such.
Todo:
see comment in BDSD2NavHealth::getHealth()
Todo:
see comment in BDSD2NavHealth::getHealth()

Definition at line 909 of file PNBBDSD2NavDataFactory.cpp.

◆ finishAlm() [2/2]

void gnsstk::PNBBDSD2NavDataFactory::finishAlm ( bool  fromWNa,
const NavSatelliteID key,
NavDataPtrList navOut 
)
protected

Search through the internal store of almanac data for almanacs that can be completed.

Parameters
[in]fromWNaIf true, this function is being called after processing subframe 5 page 8, which contains the WNa, which results in special processing.
[in]keyThe key used to look up the WNa for the almanac (the NavSatelliteID with the subject sat set to 0).
[out]navOutAny completed almanacs will be stored in here.

Definition at line 889 of file PNBBDSD2NavDataFactory.cpp.

◆ isAlmDefault()

bool gnsstk::PNBBDSD2NavDataFactory::isAlmDefault ( const PackedNavBitsPtr navIn)
static

Determine if a given page contains default data.

Note
This method does not check to see if navIn is an almanac page, only if bits are unset.
Parameters
[in]navInThe as-broadcast bits.
Returns
true if bits 90-289 are unset.

Definition at line 863 of file PNBBDSD2NavDataFactory.cpp.

◆ makeHealth()

void gnsstk::PNBBDSD2NavDataFactory::makeHealth ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut,
unsigned long  subjID,
unsigned  startBit1,
unsigned  numBits1,
unsigned  startBit2 = 0,
unsigned  numBits2 = 0 
)
protected

Create a BDSD2NavHealth object from the 9 bits of almanac health data. This method can be used for consecutive bits by specifying startBit2=0 and numBits2=0. Otherwise, if the health bits are split into to pieces, startBit1/2 and numBits1/2 are both used.

Parameters
[in]navInThe as-broadcast bits.
[out]navOutA BDSD2NavAlm object is added to this list (no checking is done at this level to see if health objects are desired).
[in]subjIDThe PRN ID of the satellite to which these health bits pertain.
[in]startBit1The first bit in navIn containing the MSBs of the health information.
[in]numBits1The number of bits in the MSB portion of the health bits.
[in]startBit2The first bit in navIn containing the LSBs of the health information.
[in]numBits2The number of bits in the LSB portion of the health bits.

Definition at line 832 of file PNBBDSD2NavDataFactory.cpp.

◆ processAlm()

bool gnsstk::PNBBDSD2NavDataFactory::processAlm ( unsigned  pnum,
const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process almanac messages. An almanac is placed in navOut, if such processing is enabled.

Parameters
[in]pnumThe page number (1-120) pertaining to navIn.
[in]navInThe as-broadcast almanac bits.
[out]navOutIf an almanac is completed and the data is requested, this will contain a BDSD2NavAlm object.
Returns
false on error.

Definition at line 167 of file PNBBDSD2NavDataFactory.cpp.

◆ processEph()

bool gnsstk::PNBBDSD2NavDataFactory::processEph ( unsigned long  pgid,
const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process ephemeris messages. A combination of ephemeris, iono and ISC objects are placed in navOut, depending on the type filter settings and input subframe.

Parameters
[in]pgidPage number (1-10) of the input data.
[in]navInThe as-broadcast ephemeris bits.
[out]navOutIf an ephemeris is completed and the data is requested, this will contain a BDSD2NavEph object. If the input is subframe 1 and data is requested, this will contain BDSD2NavIono and/or BDSD2NavISC objects.
Returns
false on error.
Bug:
I can't find in the ICD where it says what the scale factor is for the SOW field. It's stored in 20 bits even though 604800 only requires 19 bits.

Definition at line 302 of file PNBBDSD2NavDataFactory.cpp.

◆ processSF5Pg101()

bool gnsstk::PNBBDSD2NavDataFactory::processSF5Pg101 ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process subframe 5 page 101 which contains time offsets between BeiDou and other GNSSes.

Note
The ICD indicates this is currently unused. As such, the returned data will be marked invalid until real (non-zero) data is broadcast by BeiDou.
Parameters
[in]navInThe as-broadcast bits.
[out]navOutIf time offset data is requested, this will contain multiple time offset objects.
Returns
false on error.
Todo:
figure out what the reference time is supposed to be, which is not a high priority as the ICD itself says "Not broadcast temporarily".

Definition at line 656 of file PNBBDSD2NavDataFactory.cpp.

◆ processSF5Pg102()

bool gnsstk::PNBBDSD2NavDataFactory::processSF5Pg102 ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process subframe 5 page 102 which contains the time offset between BeiDou and UTC.

Parameters
[in]navInThe as-broadcast bits.
[out]navOutIf time offset data is requested, this will contain a single time offset object.
Returns
false on error.

Definition at line 730 of file PNBBDSD2NavDataFactory.cpp.

◆ processSF5Pg116()

bool gnsstk::PNBBDSD2NavDataFactory::processSF5Pg116 ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process subframe 5 page 116 which may contain health data for the extended constellation. This data is only present when the AmEpID bits are set to 3 and the AmID bits in this subframe 5 are non-zero.

Parameters
[in]navInThe as-broadcast bits.
[out]navOutIf an almanac is completed and the data is requested, this will contain one or more BDSD2NavAlm objects. If health data is requested, this will contain multiple health objects.
Returns
false on error.

Definition at line 776 of file PNBBDSD2NavDataFactory.cpp.

◆ processSF5Pg35()

bool gnsstk::PNBBDSD2NavDataFactory::processSF5Pg35 ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process subframe 5 page 35 which contains health data.

Parameters
[in]navInThe as-broadcast bits.
[out]navOutIf an almanac is completed and the data is requested, this will contain one or more BDSD2NavAlm objects. If health data is requested, this will contain multiple health objects.
Returns
false on error.

Definition at line 558 of file PNBBDSD2NavDataFactory.cpp.

◆ processSF5Pg36()

bool gnsstk::PNBBDSD2NavDataFactory::processSF5Pg36 ( const PackedNavBitsPtr navIn,
NavDataPtrList navOut 
)

Process subframe 5 page 36 which contains health data as well as the WNa for almanacs.

Parameters
[in]navInThe as-broadcast bits.
[out]navOutIf an almanac is completed and the data is requested, this will contain one or more BDSD2NavAlm objects. If health data is requested, this will contain multiple health objects.
Returns
false on error.

Definition at line 597 of file PNBBDSD2NavDataFactory.cpp.

◆ resetState()

void gnsstk::PNBBDSD2NavDataFactory::resetState ( )
overridevirtual

Reset the state of the data accumulator. Most PNBNavDataFactory child classes will maintain some state to assemble data prior to processing. This method is intended to be used to clear out that intermediate data to start from a fresh state, e.g. if you're loading discontinuous data.

Implements gnsstk::PNBNavDataFactory.

Definition at line 880 of file PNBBDSD2NavDataFactory.cpp.

Member Data Documentation

◆ almAcc

std::map<NavSatelliteID, AlmPtrList> gnsstk::PNBBDSD2NavDataFactory::almAcc
protected

Accumulate almanac orbital element pages (sf 4 pg 1-24, sf 5 pg 1-6) until a page sf 5 pg 8 becomes available to properly set the WNa. Key is the transmitting PRN (only xmitSat is set, sat is ignored).

Definition at line 237 of file PNBBDSD2NavDataFactory.hpp.

◆ amEpIDMap

std::map<NavSatelliteID, AmEpID> gnsstk::PNBBDSD2NavDataFactory::amEpIDMap
protected

Keep track of the most recent AmEpID for a given NavSatelliteID. This allows us to determine whether or not to emit an almanac for subframe 5, pages 11-23, or health for subframe 5, page 24.

Definition at line 242 of file PNBBDSD2NavDataFactory.hpp.

◆ ephAcc

std::map<NavSatelliteID, std::vector<PackedNavBitsPtr> > gnsstk::PNBBDSD2NavDataFactory::ephAcc
protected

Map PRN to a vector of PackedNavBits for accumulating ephemeris data, where index 0 is subframe 1 and so on.

Definition at line 245 of file PNBBDSD2NavDataFactory.hpp.

◆ fullWNaMap

std::map<unsigned, BDSWeekSecond> gnsstk::PNBBDSD2NavDataFactory::fullWNaMap
protected

Map transmit PRN to fully qualified week/second (WNa/toa). This is set by sf 5 pg 8.

Definition at line 232 of file PNBBDSD2NavDataFactory.hpp.

◆ heaAcc

std::map<NavSatelliteID, uint16_t> gnsstk::PNBBDSD2NavDataFactory::heaAcc
protected

Map PRN to health status to use in almanac objects. The data are pulled from sf 5, pg 7-8. Unfortunately, only pg 8 has toa in it, so really about the best we can do is store the most recent health bits and use them.

Definition at line 250 of file PNBBDSD2NavDataFactory.hpp.


The documentation for this class was generated from the following files:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:45