PPS-Client  2.0.0
Client for synchronizing the system clock to a GPS PPS source
Public Attributes | List of all members
G Struct Reference

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

#include <pps-client.h>

Public Attributes

int nCores
 If PPS-Client is segregated, identifies the number of processor cores. More...
 
int useCore
 If PPS-Client is segregated, the core on which it runs. More...
 
int cpuVersion
 The principle CPU version number for Raspberry Pi processors else 0. 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...
 
int ppsTimestamp
 Fractional second value of the PPS timestamp from the kernel driver. 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 active (not skipped) controller cycles once G.isControlling is "true". More...
 
bool interruptReceived
 Set "true" when makeTimeCorrection() processes an interrupt time from the Linux PPS 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 Linux PPS device driver. More...
 
int tm [6]
 Returns the timestamp from the Linux PPS device driver as a pair of ints. More...
 
int t_now
 Rounded seconds of current time reported by gettimeofday(). More...
 
int t_count
 Rounded seconds counted at the time of G.t_now. More...
 
double t_mono_now
 Current monotonic time. More...
 
double t_mono_last
 Last recorded monotonic time. More...
 
int zeroOffset
 
double noiseLevel
 PPS time delay value beyond which a delay is defined to be a delay spike. More...
 
int ppsPhase
 Accounts for a possible hardware inversion of the PPS signal. More...
 
int rawError
 Signed difference: G.ppsTimestamp - G.zeroOffset in makeTimeCorrection(). More...
 
double rawErrorDistrib [ERROR_DISTRIB_LEN]
 The distribution of rawError values accumulated in buildRawErrorDistrib(). More...
 
unsigned int ppsCount
 Advancing count of G.rawErrorDistrib[] entries made by buildRawErrorDistrib(). 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...
 
int minSustainedDelay
 The observed minimum delay value of a sustained sequence of delay spikes. More...
 
bool clockChanged
 Set true if an external clock change is detected. 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...
 
bool clampAbsolute
 Hard limit relative to zero if true else relative to average G.rawError. More...
 
int invProportionalGain
 Controller proportional gain configured inversely to use as an int divisor. More...
 
int timeCorrection
 Time correction value constructed in makeTimeCorrection(). 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 getMovingAverage(). 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 getMovingAverage() 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...
 
bool doNISTsettime
 
bool nistTimeUpdated
 
int consensusTimeError
 Consensus value of whole-second time corrections for DST or leap seconds from Internet NIST servers. More...
 
bool doSerialsettime
 
bool serialTimeUpdated
 
int serialTimeError
 Error reported by GPS serial port.S. 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 167 of file pps-client.h.

Member Data Documentation

◆ activeCount

unsigned int G::activeCount

Advancing count of active (not skipped) controller cycles once G.isControlling is "true".

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

Referenced by loadLastState(), makeTimeCorrection(), saveLastState(), and setHardLimit().

◆ avgCorrection

double G::avgCorrection

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

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

Referenced by bufferStateParams(), makeTimeCorrection(), and removeNoise().

◆ avgIntegral

double G::avgIntegral

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

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

Referenced by getIntegral(), loadLastState(), makeAverageIntegral(), and saveLastState().

◆ 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 213 of file pps-client.h.

Referenced by detectExteralSystemClockChange(), getAcquireState(), getTimeSlew(), readPPS_SetTime(), and setHardLimit().

◆ clampAbsolute

bool G::clampAbsolute

Hard limit relative to zero if true else relative to average G.rawError.

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

Referenced by bufferStateParams(), detectDelaySpike(), and removeNoise().

◆ clockChanged

bool G::clockChanged

Set true if an external clock change is detected.

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

Referenced by detectExteralSystemClockChange().

◆ configWasRead

bool G::configWasRead

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

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

◆ consensusTimeError

int G::consensusTimeError

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

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

Referenced by doTimeFixups(), and setClocktoNISTtime().

◆ correctionAccum

int G::correctionAccum

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

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

Referenced by getMovingAverage(), loadLastState(), and saveLastState().

◆ correctionFifo

int G::correctionFifo[OFFSETFIFO_LEN]

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

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

Referenced by getMovingAverage(), loadLastState(), and saveLastState().

◆ 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 232 of file pps-client.h.

Referenced by getMovingAverage(), integralIsReady(), loadLastState(), makeAverageIntegral(), and saveLastState().

◆ correctionFifoCount

int G::correctionFifoCount

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

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

Referenced by getMovingAverage(), loadLastState(), and saveLastState().

◆ cpuVersion

int G::cpuVersion

The principle CPU version number for Raspberry Pi processors else 0.

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

Referenced by initialize().

◆ doNISTsettime

bool G::doNISTsettime

◆ doSerialsettime

bool G::doSerialsettime

◆ freqOffset

double G::freqOffset

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

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

Referenced by bufferStateParams(), loadLastState(), makeTimeCorrection(), recordFrequencyVars(), recordOffsets(), and saveLastState().

◆ hardLimit

int G::hardLimit

◆ integral

double G::integral[NUM_INTEGRALS]

Array of integrals constructed by makeAverageIntegral().

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

Referenced by getIntegral(), loadLastState(), makeAverageIntegral(), and saveLastState().

◆ 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 231 of file pps-client.h.

Referenced by getIntegral(), loadLastState(), makeAverageIntegral(), and saveLastState().

◆ integralGain

double G::integralGain

Current controller integral gain.

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

Referenced by initialize(), loadLastState(), and makeTimeCorrection().

◆ integralTimeCorrection

double G::integralTimeCorrection

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

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

Referenced by loadLastState(), makeTimeCorrection(), and saveLastState().

◆ interruptLossCount

int G::interruptLossCount

Records the number of consecutive lost PPS interrupt times.

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

Referenced by bufferStateParams(), and setSyncDelay().

◆ interruptLost

bool G::interruptLost

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

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

Referenced by readPPS_SetTime(), and waitForPPS().

◆ interruptReceived

bool G::interruptReceived

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

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

Referenced by makeTimeCorrection(), and setSyncDelay().

◆ invProportionalGain

int G::invProportionalGain

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

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

Referenced by initialize(), makeTimeCorrection(), and removeNoise().

◆ isControlling

bool G::isControlling

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

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

Referenced by detectDelaySpike(), detectExteralSystemClockChange(), loadLastState(), makeTimeCorrection(), readPPS_SetTime(), removeNoise(), saveLastState(), and waitForPPS().

◆ isDelaySpike

bool G::isDelaySpike

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

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

Referenced by makeTimeCorrection(), removeNoise(), and waitForPPS().

◆ isVerbose

bool G::isVerbose

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

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

Referenced by bufferStatusMsg(), initialize(), and waitForPPS().

◆ linuxVersion

char G::linuxVersion[20]

Array for recording the Linux version.

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

Referenced by getLinuxVersion().

◆ minSustainedDelay

int G::minSustainedDelay

The observed minimum delay value of a sustained sequence of delay spikes.

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

◆ nCores

int G::nCores

If PPS-Client is segregated, identifies the number of processor cores.

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

Referenced by assignProcessorAffinity(), getConfigs(), and initialize().

◆ nDelaySpikes

int G::nDelaySpikes

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

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

◆ nistTimeUpdated

bool G::nistTimeUpdated

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

Referenced by doTimeFixups(), and setClocktoNISTtime().

◆ noiseLevel

double 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.

◆ ppsCount

unsigned int G::ppsCount

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

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

Referenced by removeNoise().

◆ ppsPhase

int G::ppsPhase

Accounts for a possible hardware inversion of the PPS signal.

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

Referenced by getConfigs().

◆ ppsTimestamp

int G::ppsTimestamp

Fractional second value of the PPS timestamp from the kernel driver.

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

Referenced by makeTimeCorrection().

◆ rawError

int G::rawError

Signed difference: G.ppsTimestamp - G.zeroOffset in makeTimeCorrection().

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

Referenced by makeTimeCorrection().

◆ rawErrorDistrib

double G::rawErrorDistrib[ERROR_DISTRIB_LEN]

The distribution of rawError values accumulated in buildRawErrorDistrib().

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

Referenced by removeNoise().

◆ seq_num

unsigned int G::seq_num

◆ serialTimeError

int G::serialTimeError

Error reported by GPS serial port.S.

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

Referenced by doTimeFixups(), and setClockToGPStime().

◆ serialTimeUpdated

bool G::serialTimeUpdated

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

Referenced by doTimeFixups(), and setClockToGPStime().

◆ slewAccum

double G::slewAccum

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

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

Referenced by getTimeSlew().

◆ slewAccum_cnt

int G::slewAccum_cnt

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

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

Referenced by getAcquireState(), and getTimeSlew().

◆ 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 214 of file pps-client.h.

Referenced by getAcquireState(), loadLastState(), and saveLastState().

◆ t

struct timeval G::t

Time of system response to the PPS interrupt received from the Linux PPS device driver.

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

Referenced by readPPS_SetTime().

◆ t3

struct timex G::t3

◆ t_count

int G::t_count

Rounded seconds counted at the time of G.t_now.

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

Referenced by detectExteralSystemClockChange(), detectMissedPPS(), doTimeFixups(), makeTimeCorrection(), setClockFractionalSecond(), and waitForPPS().

◆ t_mono_last

double G::t_mono_last

Last recorded monotonic time.

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

Referenced by detectMissedPPS().

◆ t_mono_now

double G::t_mono_now

Current monotonic time.

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

Referenced by detectMissedPPS().

◆ t_now

int G::t_now

Rounded seconds of current time reported by gettimeofday().

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

Referenced by detectExteralSystemClockChange(), detectMissedPPS(), doTimeFixups(), makeTimeCorrection(), setClockFractionalSecond(), and waitForPPS().

◆ timeCorrection

int G::timeCorrection

Time correction value constructed in makeTimeCorrection().

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

Referenced by makeTimeCorrection().

◆ tm

int G::tm[6]

Returns the timestamp from the Linux PPS device driver as a pair of ints.

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

Referenced by readPPS_SetTime().

◆ useCore

int G::useCore

If PPS-Client is segregated, the core on which it runs.

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

Referenced by assignProcessorAffinity(), and getConfigs().

◆ zeroError

int G::zeroError

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

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

Referenced by makeTimeCorrection().

◆ zeroOffset

int G::zeroOffset

System time delay between rising edge and timestamp of the PPS interrupt including settling offset in microseconds. Assigned as a constant in pps-client.conf.

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

Referenced by getConfigs(), initialize(), and makeTimeCorrection().


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