Show
Ignore:
Timestamp:
03/15/11 17:15:51 (13 years ago)
Author:
smidl
Message:

zmena PMSM_CTRL - akceptuje 2d modely
Pokusy v lq_dq2.cfg

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/pmsm/pmsm_ctrl.h

    r1294 r1298  
    22#define PMSM_CTR_H 
    33 
     4#include <estim/particles.h> 
    45#include <design/ctrlbase.h> 
    56#include <design/lq_ctrl.h> 
     
    4445 * I.e. it must have rv={ia, ib} and rvc={ua,ub}, any other BM will not work. 
    4546 *  
     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. 
    4651 */ 
    4752class PMSMCtrl: public Controller{ 
     
    6368        PMSMCtrl():Controller() { 
    6469                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 }"); 
    6671        } 
    6772         
     
    7075                        vec y=data.get(0,1); 
    7176                        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                         
    7388                } 
    7489        } 
     
    7893                 
    7994                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 { 
    80102                        vec x_est=Est->posterior().mean(); 
    81103                        isa=x_est(0); 
     
    83105                        ome=x_est(2); 
    84106                        the=x_est(3); 
     107                        } 
    85108                } else { 
    86109                        isa=cond(0);//x_est(0);