PPS-Client  1.4.0
Client for synchronizing the system clock to a GPS PPS source
Data Fields
G Struct Reference

Struct for program-wide global variables showing those important to the controller. More...

#include <pps-client.h>

Data Fields

int ppsGPIO
 The PPS GPIO interrupt number read from pps-client.conf and passed to the driver. More...
 
int outputGPIO
 The calibrate GPIO output number read from pps-client.conf and passed to the driver. More...
 
int intrptGPIO
 The calibrate GPIO interrupt number read from pps-client.conf and passed to the driver. More...
 
bool isVerbose
 Enables continuous printing of PPS-Client status params when "true". More...
 
bool configWasRead
 True if pps-client.conf was read at least once. More...
 
unsigned int seq_num
 Advancing count of the number of PPS interrupt timings that have been received. More...
 
bool isControlling
 Set "true" by getAcquireState() when the control loop can begin to control the system clock frequency. More...
 
unsigned int activeCount
 Advancing count of controller cycles once G.isControlling is "true". More...
 
bool interruptReceived
 Set "true" when makeTimeCorrection() processes an interrupt time from the PPS-Client device driver. More...
 
bool interruptLost
 Set "true" when a PPS interrupt time fails to be received. More...
 
int interruptLossCount
 Records the number of consecutive lost PPS interrupt times. More...
 
struct timeval t
 Time of system response to the PPS interrupt. Received from the PPS-Client device driver. More...
 
int interruptTime
 Fractional second part of G.t received from PPS-Client device driver. More...
 
int tm [6]
 Returns the interrupt calibration reception and response times from the PPS-Client device driver. More...
 
int t_now
 Whole seconds of current time reported by gettimeofday(). More...
 
int t_count
 Whole seconds counted at the time of G.t_now. More...
 
double t_mono_now
 Current monotonic count of passing seconds. More...
 
double t_mono_last
 Last recorded monotonic count used to determine a lost PPS update. More...
 
double zeroAccum
 Accumulator to test nearness to zero in isNearZero() More...
 
int intrptDelay
 Value of the interrupt delay calibration measurement received from the PPS-Client device driver. More...
 
int intrptError
 Set equal to "intrptDelay - sysDelay" in getInterruptDelay(). More...
 
unsigned int intrptCount
 Advancing count of intrptErrorDistrib[] entries made by detectDelayPeak(). More...
 
double delayMedian
 Median of G.intrptDelay values calculated in getInterruptDelay(). More...
 
int sysDelay
 
int rawError
 Set equal to G.interruptTime - G.sysDelay in makeTimeCorrection(). More...
 
int delayShift
 Interval of a delay shift when one is detected by detectDelayPeak(). More...
 
int sysDelayShift
 Assigned from G.delayShift and subtracted from G.rawError in correctDelayPeak() when a delay shift occurs. More...
 
int delayPeakLen
 Counts the length of a delay peak that is being corrected in correctDelayPeak(). More...
 
bool disableDelayShift
 Suspends delay shift correction in correctDelayPeak() when G.delayPeakLen exceeds MAX_SPIKES. More...
 
int disableDelayCount
 
double rawErrorDistrib [ERROR_DISTRIB_LEN]
 The distribution used to detect a delay shift in detectDelayPeak(). More...
 
int delayMinIdx
 If a delay shift occurs, the minimum value preceding the delay peak in rawErrorDistrib[]. More...
 
unsigned int ppsCount
 Advancing count of G.rawErrorDistrib[] entries made by detectDelayPeak(). More...
 
int nIntrptDelaySpikes
 
int noiseLevel
 PPS time delay value beyond which a delay is defined to be a delay spike. More...
 
int nDelaySpikes
 Current count of continuous delay spikes made by detectDelaySpike(). More...
 
bool isDelaySpike
 Set "true" by detectDelaySpike() when G.rawError exceeds G.noiseLevel. More...
 
double slewAccum
 Accumulates G.rawError in getTimeSlew() and is used to determine G.avgSlew. More...
 
int slewAccum_cnt
 Count of the number of times G.rawError has been summed into G.slewAccum. More...
 
double avgSlew
 Average slew value determined by getTimeSlew() from the average of G.slewAccum each time G.slewAccum_cnt reaches SLEW_LEN. More...
 
bool slewIsLow
 Set to "true" in getAcquireState() when G.avgSlew is less than SLEW_MAX. This is a precondition for getAcquireState() to set G.isControlling to "true". More...
 
int zeroError
 The controller error resulting from removing jitter noise from G.rawError in removeNoise(). More...
 
int hardLimit
 An adaptive limit value determined by setHardLimit() and applied to G.rawError by clampJitter() as the final noise reduction step to generate G.zeroError. More...
 
int invProportionalGain
 Controller proportional gain configured inversely to use as an int divisor. More...
 
int timeCorrection
 Time correction value constructed in makeTimeCorrection() by dividing G.zeroError by G.invProportionalGain. More...
 
struct timex t3
 Passes G.timeCorrection to the system function adjtimex() in makeTimeCorrection(). More...
 
double avgCorrection
 A one-minute rolling average of G.timeCorrection values generated by getAverageCorrection(). More...
 
int correctionFifo [OFFSETFIFO_LEN]
 Contains the G.timeCorrection values from over the previous 60 seconds. More...
 
int correctionFifoCount
 Signals that G.correctionFifo contains a full count of G.timeCorrection values. More...
 
int correctionAccum
 Accumulates G.timeCorrection values from G.correctionFifo in getAverageCorrection() in order to generate G.avgCorrection. More...
 
double integral [NUM_INTEGRALS]
 Array of integrals constructed by makeAverageIntegral(). More...
 
double avgIntegral
 One-minute average of the integrals in G.integral[]. More...
 
int integralCount
 Counts the integrals formed over the last 10 controller cycles and signals when all integrals in G.integral have been constructed. More...
 
int correctionFifo_idx
 Advances G.correctionFifo on each controller cycle in integralIsReady() which returns "true" every 60 controller cycles. More...
 
double integralGain
 Current controller integral gain. More...
 
double integralTimeCorrection
 Integral or average integral of G.timeCorrection returned by getIntegral();. More...
 
double freqOffset
 System clock frequency correction calculated as G.integralTimeCorrection * G.integralGain. More...
 
int consensusTimeError
 Consensus value of whole-second time corrections for DST or leap seconds from Internet SNTP servers. More...
 
char linuxVersion [20]
 Array for recording the Linux version. More...
 

Detailed Description

Struct for program-wide global variables showing those important to the controller.

Definition at line 146 of file pps-client.h.

Field Documentation

◆ activeCount

unsigned int G::activeCount

Advancing count of controller cycles once G.isControlling is "true".

Definition at line 158 of file pps-client.h.

◆ avgCorrection

double G::avgCorrection

A one-minute rolling average of G.timeCorrection values generated by getAverageCorrection().

Definition at line 213 of file pps-client.h.

◆ avgIntegral

double G::avgIntegral

One-minute average of the integrals in G.integral[].

Definition at line 219 of file pps-client.h.

◆ avgSlew

double G::avgSlew

Average slew value determined by getTimeSlew() from the average of G.slewAccum each time G.slewAccum_cnt reaches SLEW_LEN.

Definition at line 204 of file pps-client.h.

◆ configWasRead

bool G::configWasRead

True if pps-client.conf was read at least once.

Definition at line 153 of file pps-client.h.

◆ consensusTimeError

int G::consensusTimeError

Consensus value of whole-second time corrections for DST or leap seconds from Internet SNTP servers.

Definition at line 228 of file pps-client.h.

◆ correctionAccum

int G::correctionAccum

Accumulates G.timeCorrection values from G.correctionFifo in getAverageCorrection() in order to generate G.avgCorrection.

Definition at line 216 of file pps-client.h.

◆ correctionFifo

int G::correctionFifo[OFFSETFIFO_LEN]

Contains the G.timeCorrection values from over the previous 60 seconds.

Definition at line 214 of file pps-client.h.

◆ correctionFifo_idx

int G::correctionFifo_idx

Advances G.correctionFifo on each controller cycle in integralIsReady() which returns "true" every 60 controller cycles.

Definition at line 222 of file pps-client.h.

◆ correctionFifoCount

int G::correctionFifoCount

Signals that G.correctionFifo contains a full count of G.timeCorrection values.

Definition at line 215 of file pps-client.h.

◆ delayMedian

double G::delayMedian

Median of G.intrptDelay values calculated in getInterruptDelay().

Definition at line 178 of file pps-client.h.

◆ delayMinIdx

int G::delayMinIdx

If a delay shift occurs, the minimum value preceding the delay peak in rawErrorDistrib[].

Definition at line 193 of file pps-client.h.

◆ delayPeakLen

int G::delayPeakLen

Counts the length of a delay peak that is being corrected in correctDelayPeak().

Definition at line 186 of file pps-client.h.

◆ delayShift

int G::delayShift

Interval of a delay shift when one is detected by detectDelayPeak().

Definition at line 184 of file pps-client.h.

◆ disableDelayCount

int G::disableDelayCount

Delay shift correction is suspended if a continuous sequence of delay spikes is longer than MAX_SPIKES because that indicates that a shift in the control point is required.

Definition at line 189 of file pps-client.h.

◆ disableDelayShift

bool G::disableDelayShift

Suspends delay shift correction in correctDelayPeak() when G.delayPeakLen exceeds MAX_SPIKES.

Definition at line 187 of file pps-client.h.

◆ freqOffset

double G::freqOffset

System clock frequency correction calculated as G.integralTimeCorrection * G.integralGain.

Definition at line 226 of file pps-client.h.

◆ hardLimit

int G::hardLimit

An adaptive limit value determined by setHardLimit() and applied to G.rawError by clampJitter() as the final noise reduction step to generate G.zeroError.

Definition at line 208 of file pps-client.h.

◆ integral

double G::integral[NUM_INTEGRALS]

Array of integrals constructed by makeAverageIntegral().

Definition at line 218 of file pps-client.h.

◆ integralCount

int G::integralCount

Counts the integrals formed over the last 10 controller cycles and signals when all integrals in G.integral have been constructed.

Definition at line 220 of file pps-client.h.

◆ integralGain

double G::integralGain

Current controller integral gain.

Definition at line 224 of file pps-client.h.

◆ integralTimeCorrection

double G::integralTimeCorrection

Integral or average integral of G.timeCorrection returned by getIntegral();.

Definition at line 225 of file pps-client.h.

◆ interruptLossCount

int G::interruptLossCount

Records the number of consecutive lost PPS interrupt times.

Definition at line 162 of file pps-client.h.

◆ interruptLost

bool G::interruptLost

Set "true" when a PPS interrupt time fails to be received.

Definition at line 161 of file pps-client.h.

◆ interruptReceived

bool G::interruptReceived

Set "true" when makeTimeCorrection() processes an interrupt time from the PPS-Client device driver.

Definition at line 160 of file pps-client.h.

◆ interruptTime

int G::interruptTime

Fractional second part of G.t received from PPS-Client device driver.

Definition at line 165 of file pps-client.h.

◆ intrptCount

unsigned int G::intrptCount

Advancing count of intrptErrorDistrib[] entries made by detectDelayPeak().

Definition at line 177 of file pps-client.h.

◆ intrptDelay

int G::intrptDelay

Value of the interrupt delay calibration measurement received from the PPS-Client device driver.

Definition at line 175 of file pps-client.h.

◆ intrptError

int G::intrptError

Set equal to "intrptDelay - sysDelay" in getInterruptDelay().

Definition at line 176 of file pps-client.h.

◆ intrptGPIO

int G::intrptGPIO

The calibrate GPIO interrupt number read from pps-client.conf and passed to the driver.

Definition at line 149 of file pps-client.h.

◆ invProportionalGain

int G::invProportionalGain

Controller proportional gain configured inversely to use as an int divisor.

Definition at line 209 of file pps-client.h.

◆ isControlling

bool G::isControlling

Set "true" by getAcquireState() when the control loop can begin to control the system clock frequency.

Definition at line 157 of file pps-client.h.

◆ isDelaySpike

bool G::isDelaySpike

Set "true" by detectDelaySpike() when G.rawError exceeds G.noiseLevel.

Definition at line 200 of file pps-client.h.

◆ isVerbose

bool G::isVerbose

Enables continuous printing of PPS-Client status params when "true".

Definition at line 151 of file pps-client.h.

◆ linuxVersion

char G::linuxVersion[20]

Array for recording the Linux version.

Definition at line 230 of file pps-client.h.

◆ nDelaySpikes

int G::nDelaySpikes

Current count of continuous delay spikes made by detectDelaySpike().

Definition at line 199 of file pps-client.h.

◆ nIntrptDelaySpikes

int G::nIntrptDelaySpikes

Definition at line 196 of file pps-client.h.

◆ noiseLevel

int G::noiseLevel

PPS time delay value beyond which a delay is defined to be a delay spike.

Definition at line 198 of file pps-client.h.

◆ outputGPIO

int G::outputGPIO

The calibrate GPIO output number read from pps-client.conf and passed to the driver.

Definition at line 148 of file pps-client.h.

◆ ppsCount

unsigned int G::ppsCount

Advancing count of G.rawErrorDistrib[] entries made by detectDelayPeak().

Definition at line 194 of file pps-client.h.

◆ ppsGPIO

int G::ppsGPIO

The PPS GPIO interrupt number read from pps-client.conf and passed to the driver.

Definition at line 147 of file pps-client.h.

◆ rawError

int G::rawError

Set equal to G.interruptTime - G.sysDelay in makeTimeCorrection().

Definition at line 182 of file pps-client.h.

◆ rawErrorDistrib

double G::rawErrorDistrib[ERROR_DISTRIB_LEN]

The distribution used to detect a delay shift in detectDelayPeak().

Definition at line 192 of file pps-client.h.

◆ seq_num

unsigned int G::seq_num

Advancing count of the number of PPS interrupt timings that have been received.

Definition at line 155 of file pps-client.h.

◆ slewAccum

double G::slewAccum

Accumulates G.rawError in getTimeSlew() and is used to determine G.avgSlew.

Definition at line 202 of file pps-client.h.

◆ slewAccum_cnt

int G::slewAccum_cnt

Count of the number of times G.rawError has been summed into G.slewAccum.

Definition at line 203 of file pps-client.h.

◆ slewIsLow

bool G::slewIsLow

Set to "true" in getAcquireState() when G.avgSlew is less than SLEW_MAX. This is a precondition for getAcquireState() to set G.isControlling to "true".

Definition at line 205 of file pps-client.h.

◆ sysDelay

int G::sysDelay

System time delay between reception and response to an external interrupt. Calculated as the one-minute median of G.intrptDelay values in getInterruptDelay().

Definition at line 179 of file pps-client.h.

◆ sysDelayShift

int G::sysDelayShift

Assigned from G.delayShift and subtracted from G.rawError in correctDelayPeak() when a delay shift occurs.

Definition at line 185 of file pps-client.h.

◆ t

struct timeval G::t

Time of system response to the PPS interrupt. Received from the PPS-Client device driver.

Definition at line 164 of file pps-client.h.

◆ t3

struct timex G::t3

Passes G.timeCorrection to the system function adjtimex() in makeTimeCorrection().

Definition at line 211 of file pps-client.h.

◆ t_count

int G::t_count

Whole seconds counted at the time of G.t_now.

Definition at line 170 of file pps-client.h.

◆ t_mono_last

double G::t_mono_last

Last recorded monotonic count used to determine a lost PPS update.

Definition at line 172 of file pps-client.h.

◆ t_mono_now

double G::t_mono_now

Current monotonic count of passing seconds.

Definition at line 171 of file pps-client.h.

◆ t_now

int G::t_now

Whole seconds of current time reported by gettimeofday().

Definition at line 169 of file pps-client.h.

◆ timeCorrection

int G::timeCorrection

Time correction value constructed in makeTimeCorrection() by dividing G.zeroError by G.invProportionalGain.

Definition at line 210 of file pps-client.h.

◆ tm

int G::tm[6]

Returns the interrupt calibration reception and response times from the PPS-Client device driver.

Definition at line 167 of file pps-client.h.

◆ zeroAccum

double G::zeroAccum

Accumulator to test nearness to zero in isNearZero()

Definition at line 173 of file pps-client.h.

◆ zeroError

int G::zeroError

The controller error resulting from removing jitter noise from G.rawError in removeNoise().

Definition at line 207 of file pps-client.h.


The documentation for this struct was generated from the following file: