clock_synch¶
The clock synchronization module is used to slave the simulation to realtime. The module is controlled by specifying an acceleration factor which can be adjusted dynamically if the timeInitialized factor is also reset dynamically.
- 
class ClockSynch: public SysModel¶
- Public Functions - 
ClockSynch()¶
- This is the constructor for the clock synch model. It sets default variable values and initializes the various parts of the model 
 - 
~ClockSynch()¶
- Destructor. Nothing here. 
 - 
void SelfInit()¶
- This is the self-init routine for the clock synch model. It initializes the output message for the model which is used for diagnostic information on the model’s behavior. - Return
- void 
 
 - 
void CrossInit()¶
- This method is blank but included in case we need to add functionality to the model. - Return
- void 
 
 - 
void Reset(uint64_t currentSimNanos)¶
- Reset the module variables. - Return
- void 
 
 - 
void UpdateState(uint64_t currentSimNanos)¶
- This method performs all of the runtime behavior for the clock synch model. It initializes the timers present in the model on the first pass and then ensures that the model stays stuck on the synchronization pulse. Note that we do the init on the first pass instead of the init routines so that we don’t have a big lag between initialization and runtime which messes up our clocking. - Return
- void 
- Parameters
- CurrentSimNanos: The clock time associated with the model call
 
 
 - Public Members - 
double accelFactor¶
- [-] Factor used to accelerate sim-time relative to clock 
 - 
SynchClockSimMsg outputData¶
- [-] Output data for the synch module 
 - 
std::string clockOutputName¶
- [-] Name of the output message that we are using, default is clock_synch_data 
 - 
uint64_t outputBufferCount¶
- [-] Count on the number of output buffers that we have, default is 2 
 - 
int64_t accuracyNanos¶
- ns Level of accuracy that we want out of the timer, default is 10ms 
 - 
bool displayTime¶
- [-] Flag indicating that we want to display the time elapsed in cmd line, default is off 
 
-