Changeset 654 for applications/pmsm/pmsmDS.h
- Timestamp:
- 10/12/09 19:38:57 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/pmsm/pmsmDS.h
r384 r654 11 11 */ 12 12 13 #include < stat/loggers.h>13 #include <base/loggers.h> 14 14 #include <estim/kalman.h> 15 15 #include "simulator_zdenek/simulator.h" … … 71 71 ind++; 72 72 // check omega profile and set dW 73 if ( ind<profileWw.length() ) 73 if ( ind <2 && profileWw.length() ==1 ) 74 { 75 Ww=profileWw ( 0 ); 76 dW=0.0; 77 } 78 if ( ind<profileWw.length() ) 74 79 { 75 //linear increase76 if ( profileWw.length() ==1 )77 {78 Ww=profileWw ( 0 );79 dW=0.0;80 }81 else82 {83 80 dW = profileWw ( ind )-profileWw ( ind-1 ); 84 81 dW *=125e-6/dt_prof; 85 }86 82 } 87 83 else … … 167 163 void from_setting( const Setting &root ) 168 164 { 169 UI::SettingResolver params_exp(root["params"]); 170 const Setting& params=params_exp.result; 171 165 const SettingResolver& params_l(root["params"]); 166 const Setting ¶ms = params_l.result; 172 167 set_parameters ( params["Rs"], params["Ls"], params["Fmag"], \ 173 168 params["Bf"], params["p"], params["kp"], \ … … 214 209 { 215 210 static vec umin(2); 216 vec u(2); 217 //assume we know state exactly: 211 vec u(2); 212 vec &mu = est->_mu(); 213 //assume we know state exactly: 218 214 vec true_state=vec(x,4); // read from pmsm 219 E.set_mu(true_state);220 215 mu=true_state; 221 216 … … 228 223 229 224 //second derivative 230 IMpmsm2o* pf = dynamic_cast<IMpmsm2o*>(pfxu );225 IMpmsm2o* pf = dynamic_cast<IMpmsm2o*>(pfxu.get()); 231 226 if (pf) 232 227 { … … 254 249 void from_setting( const Setting &root ) 255 250 { 256 diffbifn*IM = UI::build<diffbifn>(root, "IM");257 diffbifn*OM = UI::build<diffbifn>(root, "OM");251 shared_ptr<diffbifn> IM = UI::build<diffbifn>(root, "IM"); 252 shared_ptr<diffbifn> OM = UI::build<diffbifn>(root, "OM"); 258 253 259 254 //parameters … … 289 284 290 285 //connect 291 RV*drv = UI::build<RV>(root, "drv");286 shared_ptr<RV> drv = UI::build<RV>(root, "drv"); 292 287 set_drv(*drv); 293 RV*rv = UI::build<RV>(root, "rv");288 shared_ptr<RV> rv = UI::build<RV>(root, "rv"); 294 289 set_rv(*rv); 295 290 } … … 317 312 true_state(4)=x[8]; 318 313 319 E.set_mu(true_state);314 vec &mu = est->_mu(); 320 315 mu = true_state; 321 316 //hack for ut … … 334 329 void from_setting( const Setting &root ) 335 330 { 336 diffbifn*IM = UI::build<diffbifn>(root,"IM");337 diffbifn*OM = UI::build<diffbifn>(root,"OM");331 shared_ptr<diffbifn> IM = UI::build<diffbifn>(root,"IM"); 332 shared_ptr<diffbifn> OM = UI::build<diffbifn>(root,"OM"); 338 333 339 334 //statistics … … 367 362 368 363 //connect 369 RV*drv = UI::build<RV>(root, "drv");364 shared_ptr<RV> drv = UI::build<RV>(root, "drv"); 370 365 set_drv(*drv); 371 RV*rv = UI::build<RV>(root, "rv");366 shared_ptr<RV> rv = UI::build<RV>(root, "rv"); 372 367 set_rv(*rv); 373 368 }