GPS X2 Sequencer. Applied Research Laboratories, The University of Texas at Austin August 2003
X2Sequence is a static class (one instance per executable) that contains a little more than a six-second (four Z-count) sequence of the combined X2A/X2B data for the GPS constellation. The X2 sequence repeats roughly every 1.5s (each X1 epoch) and is identical for all SVs. The progressive "slip" in the relative relationship between X1 and X2 is responsible for progressing the P-code bitstream in time while a beginning of week offset is responsible to differentiating between unique satellite codes.
These two slips are responsbile for some special circumstances in the X2 bit sequence. The satelite differentiation is handled by "holding" the X2 state at the beginning of week bit for a delay equivalent to the PRN ID of the satellite. This is handled by replicating the first bit of the combined X2A/X2B bitstream 37 times at the front of the bit sequence. Therefore, a bit index of "1" will be internally interpreted as 38. At the beginning of the week, the calling application shall coerce the beginning bit of the first call to X2 sequence to be 1-PRNID.
The other delay is a 37 chip delay at the end of each X2A epoch. During this delay, the X2 state is "held" in the final bit state.
Given these considerations, the following caluclations derive the number of bits that make up an X2Sequence and the number of unsigned 32-bit words required to hold these bits:
Base number of bits in a X2A epoch: 4092 chips Number of X2A epochs in an X2 Epoch: 3750 epochs (cycles) Delay at end of each X2 Epoch: 37 chips Number of bits required for a SINGLE X2 Epoch: 4092 * 3750 + 37 = 15,345,037 bits. Number of bits in FOUR X2 Epochs (corresponding to FOUR X1 Epochs): 4 * 15,345,037 = 61,380,148 bits. Number of PRN delay bits to be added to FRONT of array to be us at the beginning of week: 37.
Total number of bits required: 61,380,148 + 37 = 61,380,185 bits. Number of 32 bit words required: 61,380,185 / 32 = 1,918,131 (1,918,130 Remainder of 25).
SPECIAL CONDITION The final X2 sequence of the week is both truncated and unique. X2Sequence makes special provision for handing this condition. The final X2 epoch starts well into the final X1 epoch, consequently, the final X2 epoch contains ?? X2A cycles at which point, the final X2A chips is "held" until week rollover occurs. The final X2 epoch contains ?? X2B cycles at which point, the final X2B chip is "held" (repeated) until week rollover occurs. This means bits ??-?? of the X2Sequence differ for this final cycle (and the end of this final X2 cycle is at bit ??).
It's important to avoid having a conditional in the inline subscript operator. Therefore, the design implements two buffers. Each are 6+ seconds long. The two buffers only differ in the 1069 chip span (34 words) where there are two different patterns.
The internal points unsigned long *bitsP is used to track which buffer (X2bits[] or X2bitsEOW[] is in use at a particular time. The method setEOWX2Epoch( bool tf ) is used to control the buffer to which *bitsP currently points. X2Sequence initialize2 the bitsP pointer to point to the regular array. The calling application will need to manage the timing of calling setEOWX2Epoch. This needs to be done for EACH X2Sequence object - X2Bits and X2BitsEOW are static, but the bitsP pointer is a member veriable of the class and NOT static.
Definition at line 135 of file X2Sequence.hpp.
#include <X2Sequence.hpp>
Public Member Functions | |
uint32_t | operator[] (long i) |
void | setEOWX2Epoch (const bool tf) |
X2Sequence () | |
~X2Sequence () | |
Static Public Member Functions | |
static void | allocateMemory () |
static void | deAllocateMemory () |
Private Attributes | |
uint32_t * | bitsP |
Static Private Attributes | |
static uint32_t | EOWEndOfSequence [LENGTH_OF_EOW_OVERLAP] |
static bool | isInit = false |
static uint32_t * | X2Bits = 0 |
static uint32_t * | X2BitsEOW = 0 |
gnsstk::X2Sequence::X2Sequence | ( | ) |
Initialize the local variables associated with this object. In the case of this class, this is a significant amount of work. The X2A/X2B process described in ICD-GPS-200B is followed in order to fill the X2Bits array.
Definition at line 74 of file X2Sequence.cpp.
|
inline |
Definition at line 144 of file X2Sequence.hpp.
|
static |
The X2 sequence requires two 6-second buffers of 10MBit/sec samples. This comes to approximately 4 million four-byte unsigned integers. These data are the same for all PRN codes To minimize the memory footprint, these data are stored in a dynamically-allocated static array. It is
The X2Sequence::deAllocateMemory() method may be called to release the memory (if desired) but it should only be called after all X2Sequence objects have been "destroyed".
Definition at line 88 of file X2Sequence.cpp.
|
static |
Definition at line 220 of file X2Sequence.cpp.
|
inline |
Given a bit number from -37 to X2Length-37, stuff the 32 bits starting with that bit and continuing for the next 31 bits into an unsigned long and return this as the result. Conditional code (compiled only for debug) will confirm that the requested bit number is >=-37 and <(61,380,185-32) and will halt the program if this assertion is violated. NOTE: operator[] should never have to worry about rollovers. The length of the X2 array shall be set such that the maximum number of X2 bits needed will be available. The reset will be driven by the occurrence of the next X1 epoch and be tracked one level up in the corresponding SVPcodeGen object.
Definition at line 199 of file X2Sequence.hpp.
void gnsstk::X2Sequence::setEOWX2Epoch | ( | const bool | tf | ) |
Controls whether the X2 Epoch is set to EOW condition or normal condition. Should only be set true for the final X2 epoch of the week.
Definition at line 232 of file X2Sequence.cpp.
|
private |
Definition at line 187 of file X2Sequence.hpp.
|
staticprivate |
Definition at line 190 of file X2Sequence.hpp.
|
staticprivate |
Definition at line 191 of file X2Sequence.hpp.
|
staticprivate |
Definition at line 188 of file X2Sequence.hpp.
|
staticprivate |
Definition at line 189 of file X2Sequence.hpp.