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 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 ()

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.

See also:
Sequence diagram of Main Simulation Loop
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).

See also:
Sequence diagram of Device::Process with output
If a device calls queueForProcess(), 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 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 & 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 double simth::StreamDrivenSystem::mainSimulationLoop int  mode = 0  )  [virtual]
 

Main function of the stream driven simulation system.

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

See also:
Sequence diagram of Main Simulation Loop
Returns:
simulation time in seconds

Implements simth::SimulationSystem.

virtual void simth::StreamDrivenSystem::queueForProcess Device dev  )  [virtual]
 

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.

Parameters:
dev Pointer to the device that should be queued for process.
See also:
Sequence diagram of Device::Process with output

Reimplemented from simth::DeviceSystemIntf.

virtual void simth::StreamDrivenSystem::stopIteration  )  [virtual]
 

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.

virtual void simth::StreamDrivenSystem::stopSimulationPremature  )  [virtual]
 

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.

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 Apr 24 21:19:20 2006 for simthetic by  doxygen 1.4.1