Changeset 723 for library/bdm/design/ctrlbase.cpp
- Timestamp:
- 11/15/09 23:02:02 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/design/ctrlbase.cpp
r706 r723 3 3 namespace bdm{ 4 4 5 void LQG::set_system(shared_ptr<StateSpace< fsqmat> > S0){5 void LQG::set_system(shared_ptr<StateSpace<chmat> > S0){ 6 6 S = S0; 7 dimx= S->_A().rows();8 dimy= S->_C().rows();9 dimu= S->_B().cols();10 pr=zeros(dimx+dimu+dimy, dimu+dimx+dimu+dimy);11 pr.set_submatrix(dimx, dimu+dimx, eye(dimu+dimy));12 7 } 13 8 … … 17 12 y_req=y_req0; 18 13 horizon = horizon0; 19 validate();20 initialize();21 14 } 22 15 23 16 void LQG::validate() { 17 // set properties from S 18 dimx= S->_A().rows(); 19 dimy= S->_C().rows(); 20 dimu= S->_B().cols(); 21 pr=zeros(dimx+dimu+dimy, dimu+dimx+dimu+dimy); 22 pr.set_submatrix(dimx, dimu+dimx, eye(dimu+dimy)); 23 24 //penalization 24 25 bdm_assert ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); 25 26 bdm_assert ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); 26 27 bdm_assert ( y_req.length() == dimy, "LQG: wrong dimensions of y_req " ); 28 29 qux=zeros(dimu,dimx+2*dimu+dimy); 30 qyx=zeros(dimy, dimx+dimy+dimu); 31 32 // 33 initial_belmann(); 34 // parts of QR 35 post_qr = zeros(pre_qr.rows(), pre_qr.cols()); 36 37 update_system(); 27 38 } 28 39 29 void LQG::initialize(){30 // set parameter matrix31 pr.set_submatrix(0,0,S->_B());32 pr.set_submatrix(0,dimu, S->_A());33 34 //penalization35 qux=zeros(dimu,dimx+2*dimu+dimy);36 qux.set_submatrix(0,0,Qu);37 qux.set_submatrix(0,dimx+dimu+dimy,Qu);38 39 qyx=zeros(dimy, dimx+dimy+dimu);40 qyx.set_submatrix(0,0,S->_C());41 qyx.set_submatrix(0,dimx,-eye(dimy));42 43 //44 s=1e-5*eye(dimx+dimu+dimy);45 // parts of QR46 hqy=Qy*qyx*pr;47 48 // pre_qr49 pre_qr = concat_vertical(s*pr, concat_vertical(hqy, qux));50 post_qr = zeros(pre_qr.rows(), pre_qr.cols());51 }52 40 53 41 }