Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simth::StreamDrivenSystem Class Reference

This class represents an stream driven system. More...

#include <streamdrivensystem.h>

Inheritance diagram for simth::StreamDrivenSystem:

simth::FreeConnectionSystem simth::SimulationSystem simth::DeviceSystemIntf List of all members.

Public Member Functions

 StreamDrivenSystem (const std::string &fileName)
virtual ~StreamDrivenSystem ()
virtual void connectInterface (ControlInterface *interface, const std::string &varName)
virtual const Devicedevice (int deviceNr) const
virtual void acceptSignal (Device *dev, process_signal sig)
virtual double startSimulation (int mode=0)
virtual void print (std::ostream &os) const

Detailed Description

This class represents an stream driven system.

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. The output of the start device will be the input data of other devices (that are connected with that start device). If a device gets new input data to one of its input interfaces, the function acceptNewData() of that device is called (by the connected device that send the data). Since the function acceptNewData() is declared virtual, a device can react to incomming data by its own choice implementing its own version of acceptNewData(). (The standard implementation of acceptNewData() checks the current lengths of stored input data of all input interfaces and sends the READY_TO_PROCESS signal if each of them exceeds a certain length.)

If a device sends a '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.

If the process queue runs empty, the process() function of the start device is called.

If a device sends a 'STOP_ITERATION' signal, 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 & Destructor Documentation

simth::StreamDrivenSystem::StreamDrivenSystem const std::string &  fileName  ) 
 

Constructor of the stream driven simulation system. The passed argument specifies the name of the parameter file.

virtual simth::StreamDrivenSystem::~StreamDrivenSystem  )  [virtual]
 


Member Function Documentation

virtual void simth::StreamDrivenSystem::connectInterface ControlInterface interface,
const std::string &  varName
[virtual]
 

Connects a ControlInterface of the Device calling this function to a loop control of the StreamDrivenSystem.

Parameters:
interface pointer to control interface
varName name of the loop control the controlInterface is connected to

Implements simth::DeviceSystemIntf.

virtual const Device* simth::StreamDrivenSystem::device int  deviceNr  )  const [virtual]
 

Returns a pointer to the specified device (constant version).

Implements simth::DeviceSystemIntf.

virtual void simth::StreamDrivenSystem::acceptSignal Device dev,
process_signal  sig
[virtual]
 

Receive a signal from the specified device.

WATCH OUT: These 'signals' are only signalled through functions in the simth::Device class. In any derived Device, you should only call the funtions in the Device base class, not directly the acceptSignal() function.

Parameters:
dev Pointer to the device sending the signal. For some signals, this might simply be ignored.
sig The type of signal, see process_signal

Implements simth::DeviceSystemIntf.

virtual double simth::StreamDrivenSystem::startSimulation int  mode = 0  )  [virtual]
 

Main function of the stream driven simulation system.

This function is called by the main function to start the simulation.

Returns:
simulation time in seconds

Implements simth::SimulationSystem.

virtual void simth::StreamDrivenSystem::print std::ostream &  os  )  const [virtual]
 

Prints information about the simulation system to the given ostream. In order to give more detailed information, a derived class shoul reimplement this function.

Parameters:
os The ostream to print more info to.

Reimplemented from simth::SimulationSystem.


Generated on Mon Aug 15 13:54:41 2005 for simthetic by  doxygen 1.4.1