This is an old revision of the document!
Subsystems
A subsystem is a block containing several other blocks. It is often advantageous to pack several blocks which belong together into a subsystem. Consider the example of an observer. An observer might be part of your control system and it will itself contain a multitude of blocks.
Define a Subsystem
In order to create a subsystem you have to create a custom made block (see Custom Blocks) . Define the necessary inner blocks in your custom class. In the constructor you create the inner blocks and connect them among each other.
class Observer : public eeros::control::Block { public: Observer() : gain1(5.0) ... { sum1.negateInout(1); sum1.getIn(0).connect(sum2.getOut()); ... } virtual ~Observer() { } virtual void run() { sum2.run(); sum1.run(); ... gain1.run(); } virtual eeros::control::Input<double>& getSum1In() {return sum1.getIn();} virtual eeros::control::Input<double>& getSum2In() {return sum2.getIn();} virtual eeros::control::Output<double>& getGain1Out() {return gain1.getOut();} private: eeros::control::Gain<double> gain1; eeros::control::Sum<2, double> sum1, sum2; ... };
The whole subsystem is now a block for itself. It can be added to a control system (or an outer subsystem). Its run-method will be called automatically as soon as it is added to a time domain which itself must be started by the executor.