Changeset 686 for applications/pmsm
- Timestamp:
- 10/29/09 23:24:04 (15 years ago)
- Location:
- applications/pmsm
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/cfg/uni_test.cfg
r667 r686 5 5 }; 6 6 7 system 0= "system@cfg/sim.cfg";7 system= "system@cfg/sim.cfg"; 8 8 9 system = {9 system0= { 10 10 class = "ITppFileDS"; 11 11 filename = "Barcelona/tec0009ALL.it"; … … 32 32 prior = {class ="euni"; low = [-1,-1,-1,-1]; high=[1,1,1,1];}; 33 33 //connect 34 drv = {class="RV"; names=("o_ia","o_ib","o_ua","o_ub");}; 34 yrv = {class="RV"; names=("o_ia","o_ib");}; 35 rvc = {class="RV"; names=("o_ua","o_ub");}; 35 36 rv = {class="RV"; names=("e_ia","e_ib","e_om","e_th");}; 36 37 options = "logbounds"; -
applications/pmsm/filters.h
r654 r686 141 141 validate(); 142 142 } 143 void bayes ( const vec & data) {143 void bayes ( const vec &yt, const vec &cond ) { 144 144 const vec &mu = posterior().mean(); 145 145 const vec &Var = posterior().variance(); … … 163 163 #pragma parallel for 164 164 for ( i = 0; i < n; i++ ) { 165 BMs ( i ) -> condition ( pf->posterior()._sample ( i ) ); 166 BMs ( i ) -> bayes ( data ); 165 BMs ( i ) -> bayes ( yt, concat(cond, pf->posterior()._sample ( i )) ); 167 166 lls ( i ) += BMs ( i )->_ll(); 168 167 } -
applications/pmsm/pmsmDS.h
r679 r686 38 38 public: 39 39 //! Constructor with fixed sampling period 40 pmsmDS () 40 pmsmDS () : DS() 41 41 { 42 42 Dt=125; 43 Drv=RV ( "{o_ua o_ub o_ia o_ib t_ua t_ub o_om o_th Mz }" ); 43 Yrv=RV ( "{o_ua o_ub o_ia o_ib t_ua t_ub o_om o_th Mz }" ); 44 ytsize = Yrv._dsize(); 45 Drv = Yrv; 44 46 } 45 47 void set_parameters ( double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0 ) … … 210 212 static vec umin(2); 211 213 vec u(2); 212 vec &mu = est ->_mu();214 vec &mu = est._mu(); 213 215 //assume we know state exactly: 214 216 vec true_state=vec(x,4); // read from pmsm … … 312 314 true_state(4)=x[8]; 313 315 314 vec &mu = est ->_mu();316 vec &mu = est._mu(); 315 317 mu = true_state; 316 318 //hack for ut -
applications/pmsm/pmsm_estim.cpp
r676 r686 44 44 vec dt=zeros ( pDS->_drv()._dsize() ); //data variable 45 45 Array<datalink*> Dls(nE); 46 Array<datalink*> Dlsc(nE); 46 47 for (int i=0; i<nE; i++){ 47 Dls(i)=new datalink( Es(i)->_drv(),pDS->_drv() ); //datalink between a datasource and estimator 48 Dls(i)=new datalink( Es(i)->_yrv(),pDS->_drv() ); //datalink between a datasource and estimator 49 Dlsc(i)=new datalink( Es(i)->_rvc(),pDS->_drv() ); //datalink between a datasource and estimator 48 50 } 49 51 … … 57 59 // Estimators 58 60 for (int i=0; i<nE; i++){ 59 Es(i)->bayes ( Dls(i)->pushdown ( dt ) ); // update estimates61 Es(i)->bayes ( Dls(i)->pushdown ( dt ), Dlsc(i)->pushdown(dt) ); // update estimates 60 62 61 63 Es(i)->log_write (); … … 69 71 for (int i=0; i<nE; i++){ 70 72 delete Dls(i); 73 delete Dlsc(i); 71 74 } 72 75 return 0;