Revision 723, 0.9 kB
(checked in by smidl, 15 years ago)
|
Big commit of LQG stuff
|
-
Property svn:eol-style set to
native
|
Line | |
---|
1 | #include "ctrlbase.h" |
---|
2 | |
---|
3 | namespace bdm{ |
---|
4 | |
---|
5 | void LQG::set_system(shared_ptr<StateSpace<chmat> > S0){ |
---|
6 | S = S0; |
---|
7 | } |
---|
8 | |
---|
9 | void LQG::set_control_parameters(const mat &Qy0, const mat &Qu0, const vec &y_req0, int horizon0){ |
---|
10 | Qy=Qy0; |
---|
11 | Qu=Qu0; |
---|
12 | y_req=y_req0; |
---|
13 | horizon = horizon0; |
---|
14 | } |
---|
15 | |
---|
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 |
---|
25 | bdm_assert ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); |
---|
26 | bdm_assert ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); |
---|
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(); |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | } |
---|