| 18 | | //! Low-level class for design of control strategy |
| 19 | | class Designer { |
| | 18 | //! Base class for adaptive controllers |
| | 19 | //! The base class is, however, non-adaptive, method \c adapt() is empty. |
| | 20 | //! \note advanced Controllers will probably include estimator as their internal attribute (e.g. dual controllers) |
| | 21 | class Controller : public root { |
| | 22 | protected: |
| | 23 | //! identifier of the designed action; |
| | 24 | RV rv; |
| | 25 | //! identifier of the conditioning variables; |
| | 26 | RV rvc; |
| | 27 | public: |
| | 28 | //! function processing new observations and adapting control strategy accordingly |
| | 29 | virtual void redesign(const vec &data){}; |
| | 30 | //! returns designed control action |
| | 31 | virtual vec ctrlaction(const vec &cond){return vec(0);} |
| | 32 | |
| | 33 | void from_setting(const Setting &set){ |
| | 34 | UI::get(rv,set,"rv",UI::optional); |
| | 35 | UI::get(rvc,set,"rvc",UI::optional); |
| | 36 | } |
| | 37 | //! access function |
| | 38 | const RV& _rv() {return rv;} |
| | 39 | //! access function |
| | 40 | const RV& _rvc() {return rvc;} |
| | 41 | //! register this controller with given datasource under name "name" |
| | 42 | virtual void log_register (logger &L, int level, const string &prefix ) { } |
| | 43 | //! write requested values into the logger |
| | 44 | virtual void log_write ( ) const { } |
| | 45 | |
| | 46 | }; |
| 118 | | //! Base class for adaptive controllers |
| 119 | | //! The base class is however non-adaptive, method \c adapt() is empty. |
| 120 | | //! \note advanced Controllers will probably include estimator as their internal attribute (e.g. dual controllers) |
| 121 | | class Controller : public root { |
| 122 | | protected: |
| 123 | | //! identifier of the system output; |
| 124 | | RV yrv; |
| 125 | | //! identifier of the system input; |
| 126 | | RV urv; |
| 127 | | //! description of data needed for \c ctrlaction , required for automatic connection to DS |
| 128 | | RV drv; |
| 129 | | //! vector of logger IDs |
| 130 | | ivec LIDs; |
| 131 | | public: |
| 132 | | //! function processing new observations and adapting control strategy accordingly |
| 133 | | virtual void adapt(const vec &data){}; |
| 134 | | //! returns designed control action |
| 135 | | virtual vec ctrlaction(const vec &data){return vec(0);} |
| 136 | | |
| 137 | | void from_setting(const Setting &set){ |
| 138 | | UI::get(yrv,set,"yrv",UI::optional); |
| 139 | | UI::get(yrv,set,"urv",UI::optional); |
| 140 | | } |
| 141 | | //! access function |
| 142 | | const RV& _urv() {return urv;} |
| 143 | | //! access function |
| 144 | | const RV& _yrv() {return yrv;} |
| 145 | | //! access function |
| 146 | | const RV& _drv() {return drv;} |
| 147 | | //! register this controller with given datasource under name "name" |
| 148 | | virtual void log_register (logger &L, int level, const string &prefix ) { } |
| 149 | | //! write requested values into the logger |
| 150 | | virtual void log_write ( ) const { } |
| 151 | | |
| 152 | | }; |