Documentation of UrbanFireXDT
Documentation of UrbanFireXDT
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CUControllerWorkerThread Class Reference

#include <worker_threads.hpp>

Public Member Functions

 CUControllerWorkerThread (const std::list< ControlUnit * > *connected_units_, CUControllerThreadGroupManager &caller)
 
 CUControllerWorkerThread (CUControllerThreadGroupManager &caller)
 
 ~CUControllerWorkerThread ()
 
void start ()
 Starts this thread. This method has to be called before the call of executeOneStepForAllConnCUs().
 
void stop ()
 Stops this working thread.
 
void executeOneStepForAllConnCUs (unsigned long ts)
 
bool isIdling () const
 
bool errorHappened () const
 

Detailed Description

This class represents a working thread that calls the method ControlUnit::compute_next_value() for all connected units on request. The thread sleeps until it is activated using the public method executeOneStepForAllConnCUs().

Constructor & Destructor Documentation

◆ CUControllerWorkerThread() [1/2]

CUControllerWorkerThread::CUControllerWorkerThread ( const std::list< ControlUnit * > *  connected_units_,
CUControllerThreadGroupManager caller 
)

Constructs a new working thread for a list of controlled control units (CUs). Attention: A control unit MUST ONLY be connected to ONE working thread! Otherwise ControlUnit::compute_next_value() is called more than once for the control units connected!

Parameters
connected_units_The list of control units that are connected to this working thread
callerThe reference to the thread group manager object

◆ CUControllerWorkerThread() [2/2]

CUControllerWorkerThread::CUControllerWorkerThread ( CUControllerThreadGroupManager caller)

Constructs a new working thread in the case of using work stealing.

Parameters
callerThe reference to the thread group manager object

◆ ~CUControllerWorkerThread()

CUControllerWorkerThread::~CUControllerWorkerThread ( )

Member Function Documentation

◆ errorHappened()

bool CUControllerWorkerThread::errorHappened ( ) const
inline

This method returns true if an error happend and complete simulation must be stopped.

◆ executeOneStepForAllConnCUs()

void CUControllerWorkerThread::executeOneStepForAllConnCUs ( unsigned long  ts)

This method notifies the thread to start working. This means that the thread will start to call ControlUnit::compute_next_value() iteratively for all control units connected. Basically, it sets atomic_flag_exec to true.

Parameters
tsThe current time step (required for calling ControlUnit::compute_next_value())
dayOfWeek_lThe day of the week (left aligned) of the current time step (required for calling ControlUnit::compute_next_value())
hourOfDay_lThe hour of the day (left aligned) of the current time step (required for calling ControlUnit::compute_next_value())
subsectionIf the simulation should only be executed for a subset of instances, it can be defined here

◆ isIdling()

bool CUControllerWorkerThread::isIdling ( ) const
inline

This function returns true if the thread is idling, i.e., it is running, but not currently working and has also no planned work.

◆ start()

void CUControllerWorkerThread::start ( )

Starts this thread. This method has to be called before the call of executeOneStepForAllConnCUs().

◆ stop()

void CUControllerWorkerThread::stop ( )

Stops this working thread.


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