Changeset 1298
- Timestamp:
- 03/15/11 17:15:51 (14 years ago)
- Location:
- applications/pmsm
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/experiments/ctrl_lq_dq2.cfg
r1290 r1298 2 2 3 3 experiment={ 4 Ndat = 20000;4 Ndat = 120000; 5 5 }; 6 6 … … 9 9 params = "pmsm107@./cfg/zcu.cfg"; 10 10 tstep = 1; // steps for profile in [s] 11 profileW = [0, 10, 0, 2 ];11 // profileW = [0, 10, 0, 2 ]; 12 12 // profileW = [0, -10, 30, 60, 90, 60, 30, 0, -30, -60, -30]; 13 //profileW = [1, 10, 50, 200, 200, 30, 0, 0, -30, -30, -100, -100, -40, 0, 0];13 profileW = [1, 10, 50, 200, 200, 30, 0, 0, -30, -30, -100, -100, -40, 0, 0]; 14 14 // profileM = [0, 30, 0, 0, 30, 0, 0, 0, 0, 0, 10, 0, 0]; 15 15 profileM = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; … … 28 28 }; 29 29 30 OT= {class="EKFfull"; 31 IM = {class="IMpmsmOT"; 32 params = "pmsm107@./cfg/zcu.cfg"; 33 }; 34 name = "ekf"; 35 OM = {class="OMpmsmOT"; 36 params = "pmsm107@./cfg/zcu.cfg"; 37 }; 38 dQ=[0.1, 0.01]; ///////// <====== OK 39 dR=[0.5, 0.5]; 40 dP0=[0.1, 0.1]; 41 //connect 42 log_level="logmean,logevidence,logbounds"; 43 }; 44 45 PF= {class = "PF";name="pf"; 46 particle = {class ="BootstrapParticle"; 47 parameter_pdf = {class="mgnorm<ldmat>"; 48 g={class="IMpmsmOT"; 49 params = "pmsm107@./cfg/zcu.cfg"; 50 }; 51 dR=[0.001,0.0001]; 52 rv ={class="RV";names=("om","th");}; 53 rvc ={class="RV";names=("om","th","o_ua","o_ub","o_ia","o_ib");times=[-1,-1,0,0,-1,-1];}; 54 }; 55 observation_pdf= {class="mgnorm<ldmat>"; 56 g={class="OMpmsmOT"; 57 params = "pmsm107@./cfg/zcu.cfg"; 58 }; 59 dR=[0.5,0.5]; 60 rv ={class="RV";names=("o_ia","o_ib");}; 61 rvc = {class="RV";names=("om","th","o_ua","o_ub","o_ia","o_ib");times=[0,0,0,0,-1,-1];}; 62 }; 63 }; 64 n = 100; 65 log_level="logbounds,logmean"; 66 prior = {class="euni"; 67 high = [ 0.1, 1.0]; 68 low = [ -0.1, -1.0]; 69 rv ={class="RV";names=("om","th");}; 70 }; 71 }; 72 73 74 30 75 controllers=({ 76 // class = "PMSM_PICtrl"; 31 77 class = "PMSM_LQCtrl_dq2"; 32 estim = "UD"; 78 // estim = "UD"; 79 estim = "PF"; 33 80 r = 0.0001; 34 81 h = 10; -
applications/pmsm/pmsm_ctrl.h
r1294 r1298 2 2 #define PMSM_CTR_H 3 3 4 #include <estim/particles.h> 4 5 #include <design/ctrlbase.h> 5 6 #include <design/lq_ctrl.h> … … 44 45 * I.e. it must have rv={ia, ib} and rvc={ua,ub}, any other BM will not work. 45 46 * 47 * Two cases are considered: 48 * - 4 dimensional rv={ia, ib, om, th} and rvc={ua,ub} 49 * - 2 dimensional rv={om, th} and rvc={ua,ub,ia_{t-1}, ib_{t-1} } 50 * These are hardcoded and sitched based on dimensionality. 46 51 */ 47 52 class PMSMCtrl: public Controller{ … … 63 68 PMSMCtrl():Controller() { 64 69 rv = RV("{ua ub }"); 65 rvc = RV("{o_ia o_ib o_ua o_ub o_om o_th Ww }");70 rvc = RV("{o_ia o_ib t_ua t_ub o_om o_th Ww }"); 66 71 } 67 72 … … 70 75 vec y=data.get(0,1); 71 76 vec u=data.get(2,3); 72 Est->bayes(y,u); 77 if (Est->dimension()==2){ 78 static vec cond(4); // 79 cond.set_subvector(0,1,u); 80 Est->bayes(y,cond); 81 cond.set_subvector(2,3,y); // save 1-step delayed vectors 82 83 } else { 84 Est->bayes(y,u); 85 86 } 87 73 88 } 74 89 } … … 78 93 79 94 if (estim){ 95 if (Est->dimension()==2){ 96 vec x_est=Est->posterior().mean(); 97 isa=cond(0); 98 isb=cond(1); 99 ome=x_est(0); 100 the=x_est(1); 101 } else { 80 102 vec x_est=Est->posterior().mean(); 81 103 isa=x_est(0); … … 83 105 ome=x_est(2); 84 106 the=x_est(3); 107 } 85 108 } else { 86 109 isa=cond(0);//x_est(0);