ModelSpace
Documentation for ModelSpace models and classes.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
modelspace::LatencyUtil< T > Class Template Reference

Latency model. More...

#include <LatencyUtil.hpp>

Public Member Functions

 LatencyUtil (SimulationExecutive &exc)
 
int start (int latency=0, T start_val=T())
 Starting the latency model. More...
 
int step (T input_value, T &output_value)
 Step the latency model. More...
 
int reset ()
 Function for reseting the latency queue. More...
 

Protected Attributes

std::queue< T > _latency_queue
 Buffer to hold latency values. More...
 
SimulationExecutive_exc
 Reference to the simulation executive. More...
 
clockwerk::Time _lat_sim_rate
 Simulation rate in milliseconds. More...
 
_default_value
 Default value to fill the queue with. More...
 

Detailed Description

template<typename T>
class modelspace::LatencyUtil< T >

Latency model.

This model implements a latency mechanism that delays the output value by a specified latency.

The model uses a queue to store the input values and outputs them after a specified latency. The latency is specified in milliseconds.

Author
Will Burken will..nosp@m.burk.nosp@m.en@at.nosp@m.tx.t.nosp@m.ech

Constructor & Destructor Documentation

◆ LatencyUtil()

template<typename T >
modelspace::LatencyUtil< T >::LatencyUtil ( SimulationExecutive exc)
inline

Member Function Documentation

◆ reset()

template<typename T >
int modelspace::LatencyUtil< T >::reset

Function for reseting the latency queue.

Returns
Error code corresponding to success/failure

◆ start()

template<typename T >
int modelspace::LatencyUtil< T >::start ( int  latency = 0,
start_val = T() 
)

Starting the latency model.

Parameters
latencyThe latency in milliseconds
start_valThe value to start the queue with
Returns
Error code corresponding to success/failure
Note
This function will fill the queue with the start value for the number of steps corresponding to the latency. The queue will be filled with the start value for the number of steps corresponding to the latency.

◆ step()

template<typename T >
int modelspace::LatencyUtil< T >::step ( input_value,
T &  output_value 
)

Step the latency model.

Parameters
input_valueThe input value to write to the queue
output_valueThe output value to read from the queue
Returns
Error code corresponding to success/failure
Note
This function will write the input value to the queue and read the output value from the queue. The output value will be the value at the front of the queue, which will be delayed by the latency.

Member Data Documentation

◆ _default_value

template<typename T >
T modelspace::LatencyUtil< T >::_default_value
protected

Default value to fill the queue with.

◆ _exc

template<typename T >
SimulationExecutive& modelspace::LatencyUtil< T >::_exc
protected

Reference to the simulation executive.

◆ _lat_sim_rate

template<typename T >
clockwerk::Time modelspace::LatencyUtil< T >::_lat_sim_rate
protected

Simulation rate in milliseconds.

◆ _latency_queue

template<typename T >
std::queue<T> modelspace::LatencyUtil< T >::_latency_queue
protected

Buffer to hold latency values.


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