#include <streamdrivensystem.h>
Inheritance diagram for simth::StreamDrivenSystem:
Public Member Functions | |
StreamDrivenSystem (const std::string &fileName) | |
virtual | ~StreamDrivenSystem () |
virtual void | connectInterface (ControlInterface *interface, const std::string &varName) |
virtual const Device * | device (int deviceNr) const |
virtual double | mainSimulationLoop (int mode=0) |
virtual void | print (std::ostream &os) const |
Signals from Devices to the System | |
virtual void | queueForProcess (Device *dev) |
virtual void | stopIteration () |
virtual void | stopSimulationPremature () |
The connection between the interfaces of the device blocks (see FreeConnectionSystem) is defined by the help of a connection file. The name of this file and other parameters are defined in a so-called parameter file. The name of that file is passed as argument in the constructor.
The simulation is started with the start device, i.e. the device that ID equals the start device number. This number can set by the parameter 'start_device_number' in the parameter file. By default this number is set to zero. The start device has to be a special device that needs no input data to start processing. An example for such an block is a BitGenerator defined in SimtheticLib. The function Device::process() of that device will be invoked by the StreamDrivenSimulationSystem to start the simulation.
If the process queue runs empty, the process() function of the start device is called.
If a device calls stopIterator(), the StreamDrivenSystem stops the current iteration. This means, that no new(!) request for processing will be accepted by the StreamDrivenSystem and the process function of the start device will not be called if the process queue runs empty. With other words, only 'request for processing' that had been queued in the process queue, will be processed by the StreamDrivenSimulationSystem, i.e. the process functions of the corresponding devices will be called.
|
Constructor of the stream driven simulation system. The passed argument specifies the name of the parameter file. |
|
|
|
Connects a ControlInterface of the Device calling this function to a loop control of the StreamDrivenSystem.
Implements simth::DeviceSystemIntf. |
|
Returns a pointer to the specified device (constant version). Implements simth::DeviceSystemIntf. |
|
Main function of the stream driven simulation system. This function is called by the main function to start the simulation.
Implements simth::SimulationSystem. |
|
Queue the given device for Device::process() in the process queue. If a device sends this 'READY_TO_PROCESS' signal, the StreamDrivenSystem will queue a request for processing of that device in a 'process queue'. During a simulation run, the StreamDrivenSystem calls the process functions of the device whose 'request for processing' is in the first position of the process queue, and then consecutively every next device.
Reimplemented from simth::DeviceSystemIntf. |
|
Stops the current iteration. This means, that no new(!) request for processing will be accepted by the StreamDrivenSystem and the process function of the start device will not be called if the process queue runs empty. With other words, only 'request for processing' that had been queued in the process queue, will be processed by the StreamDrivenSimulationSystem, i.e. the process functions of the corresponding devices will be called. Reimplemented from simth::DeviceSystemIntf. |
|
Stops not only the current iteration, but also the complete simulation run no matter how many iterations are still undone. This also calls stopIteration() internally. Reimplemented from simth::DeviceSystemIntf. |
|
Prints information about the simulation system to the given ostream. In order to give more detailed information, a derived class shoul reimplement this function.
Reimplemented from simth::SimulationSystem. |