Changeset 1261 for applications
- Timestamp:
- 12/09/10 16:33:44 (14 years ago)
- Location:
- applications
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/dual/texts/pmsm_system.lyx
r1248 r1261 715 715 716 716 \begin_layout Subsection 717 Cautious LQG control 718 \end_layout 719 720 \begin_layout Standard 721 Uncertainty in 722 \begin_inset Formula $A$ 723 \end_inset 724 725 . 726 \end_layout 727 728 \begin_layout Standard 729 Sigma points: 730 \begin_inset Formula $x^{(i)}=\hat{x}+hv_{i}$ 731 \end_inset 732 733 , 734 \begin_inset Formula $v_{i}$ 735 \end_inset 736 737 are eigenvectors of 738 \begin_inset Formula $P$ 739 \end_inset 740 741 . 742 \end_layout 743 744 \begin_layout Standard 745 \begin_inset Formula \begin{eqnarray*} 746 E\{x'A(x)QA(x)x\} & = & \frac{1}{n}\sum x'A(x^{(i)})QA^{(i)}(x)x\\ 747 & = & x'Zx'\end{eqnarray*} 748 749 \end_inset 750 751 752 \end_layout 753 754 \begin_layout Standard 755 Uncented transform... 756 \end_layout 757 758 \begin_layout Subsection 717 759 Poor-man's dual LQG control 718 760 \end_layout -
applications/pmsm/experiments/ctrl_lq.cfg
r1258 r1261 7 7 system= { 8 8 class= "pmsmDSctrl"; 9 params = "pmsm107@. /cfg/zcu.cfg";9 params = "pmsm107@../cfg/zcu.cfg"; 10 10 tstep = 1; // steps for profile in [s] 11 profileW = [0, 30, 0, 2 ];11 profileW = [0, 10, 0, 2 ]; 12 12 // profileW = [0, -10, 30, 60, 90, 60, 30, 0, -30, -60, -30]; 13 13 // profileW = [1, 10, 50, 200, 200, 30, 0, 0, -30, -30, -100, -100, -40, 0, 0]; … … 16 16 }; 17 17 18 UD = {class="EKF Ch";18 UD = {class="EKFfull"; 19 19 IM = {class="IMpmsmStat"; 20 params = "pmsm107@. /cfg/zcu.cfg";20 params = "pmsm107@../cfg/zcu.cfg"; 21 21 }; 22 22 OM = {class="OMpmsm";}; 23 dQ=[0. 01, 0.01, 0.0001, 0.000001];23 dQ=[0.1, 0.1, 0.1, 0.01]; ///??????????????? 24 24 dR=[0.05, 0.05]; 25 25 //connect 26 log_level="logmean ,logU,logG,logD";26 log_level="logmean"; 27 27 name = "Est0"; 28 28 }; … … 31 31 class = "PMSM_LQCtrl"; 32 32 estim = "UD"; 33 r = 0.05; 34 h = 10; 33 35 } 34 36 ); -
applications/pmsm/pmsm_ctrl.h
r1259 r1261 63 63 PMSMCtrl():Controller() { 64 64 rv = RV("{ua ub }"); 65 rvc = RV("{o_ia o_ib o_ua o_ub o_om o_th Ww }");65 rvc = RV("{o_ia o_ib t_ua t_ub o_om o_th Ww }"); 66 66 } 67 67 … … 176 176 177 177 //receding horizon 178 constint rec_hor;178 int rec_hor; 179 179 180 180 //system matrices … … 202 202 r(0.005), Dt(0.000125), rec_hor(10), //for r is a default value rewrited by pcp.txt file value 203 203 A(5, 5), B(5, 2), Q(5, 5), R(2, 2), 204 uab(2), icond(6), MAXu(100.0), 205 p_isa(rec_hor+1), p_isb(rec_hor+1), p_ome(rec_hor+1), p_the(rec_hor+1) 206 { 204 uab(2), icond(6), MAXu(100.0) { 207 205 //set fix matrices elements & dimensions 208 206 A.zeros(); … … 219 217 Q(2, 2) = 1.0; 220 218 R.zeros(); 221 //load input penalty r from file222 ifstream pcpfile;223 double pcp;224 225 pcpfile.open("pcp.txt");226 if(pcpfile){227 if(pcpfile >> pcp) r = pcp;228 pcpfile.close();229 }230 R(0, 0) = R(1, 1) = r;231 219 232 //set lq233 lq.rv = RV("u", 2, 0);234 lq.set_rvc(RV("x", 5, 0));235 lq.horizon = rec_hor;236 237 Array<linfnEx> model(2);238 model(0).A = A;239 model(0).B = vec("0 0 0 0 0");240 model(0).rv = RV("x", 5, 0);241 model(0).rv_ret = RV("x", 5, 1);242 model(1).A = B;243 model(1).B = vec("0 0");244 model(1).rv = RV("u", 2, 0);245 model(1).rv_ret = RV("x", 5, 1);246 lq.Models = model;247 248 Array<quadraticfn> qloss(2);249 qloss(0).Q.setCh(Q);250 qloss(0).rv = RV("x", 5, 1);251 qloss(1).Q.setCh(R);252 qloss(1).rv = RV("u", 2, 0);253 lq.Losses = qloss;254 255 lq.finalLoss.Q.setCh(Q);256 lq.finalLoss.rv = RV("x", 5, 1);257 258 lq.validate();259 260 uab.zeros();261 220 } 262 221 … … 309 268 icond(3) = the; 310 269 icond(4) = Ww; 311 icond(5) = 0;270 icond(5) = 1; 312 271 vec tmp = L*icond; 313 272 … … 321 280 return uab; 322 281 }; 282 void from_setting(const Setting &set){ 283 PMSMCtrl::from_setting(set); 284 UI::get(r,set, "r", UI::optional); 285 UI::get(rec_hor,set, "h", UI::optional); 286 } 287 288 void validate(){ 289 R(0,0)=R(1,1)=r; 290 291 p_isa.set_length(rec_hor+1); 292 p_isb.set_length(rec_hor+1); 293 p_ome.set_length(rec_hor+1); 294 p_the.set_length(rec_hor+1); 295 296 Array<quadraticfn> qloss(2); 297 qloss(0).Q.setCh(Q); 298 qloss(0).rv = RV("x", 5, 1); 299 qloss(1).Q.setCh(R); 300 qloss(1).rv = RV("u", 2, 0); 301 lq.Losses = qloss; 302 303 //set lq 304 lq.rv = RV("u", 2, 0); 305 lq.set_rvc(RV("x", 5, 0)); 306 lq.horizon = rec_hor; 307 308 Array<linfnEx> model(2); 309 model(0).A = A; 310 model(0).B = vec("0 0 0 0 0"); 311 model(0).rv = RV("x", 5, 0); 312 model(0).rv_ret = RV("x", 5, 1); 313 model(1).A = B; 314 model(1).B = vec("0 0"); 315 model(1).rv = RV("u", 2, 0); 316 model(1).rv_ret = RV("x", 5, 1); 317 lq.Models = model; 318 319 lq.finalLoss.Q.setCh(Q); 320 lq.finalLoss.rv = RV("x", 5, 1); 321 322 lq.validate(); 323 324 uab.zeros(); 325 326 } 323 327 }; 324 328 UIREGISTER(PMSM_LQCtrl);