32 | | AimsunDS () : DS() |
33 | | { |
34 | | Dt=125; |
35 | | Yrv=RV ( "{o_ua o_ub o_ia o_ib t_ua t_ub o_om o_th Mz }" ); |
36 | | ytsize = Yrv._dsize(); |
37 | | Drv = Yrv; |
38 | | } |
39 | | void set_parameters ( double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0 ) |
40 | | { |
41 | | pmsmsim_set_parameters ( Rs0, Ls0, Fmag0, Bf0, p0, kp0, J0, Uc0, DT0, dt0 ); |
42 | | } |
43 | | //! parse options: "modelu" => opt_modu=true; |
44 | | void set_options ( string &opt ) |
45 | | { |
46 | | opt_modu = ( opt.find ( "modelu" ) !=string::npos ); |
47 | | } |
48 | | void getdata ( vec &dt ) const |
49 | | { |
50 | | dt.set_subvector(0,vec ( KalmanObs,6 )); |
51 | | dt(6)=x[2]; |
52 | | dt(7)=x[3]; |
53 | | dt(8)=x[8]; |
54 | | } |
55 | | void write ( vec &ut ) {} |
| 35 | AimsunDS (); |
57 | | void step() |
58 | | { |
59 | | static int ind=0; |
60 | | static double dW; // increase of W |
61 | | static double Ww; // W |
62 | | static double Mz; // W |
63 | | if ( t>=dt_prof*ind ) |
64 | | { |
65 | | ind++; |
66 | | // check omega profile and set dW |
67 | | if ( ind <2 && profileWw.length() ==1 ) |
68 | | { |
69 | | Ww=profileWw ( 0 ); |
70 | | dW=0.0; |
71 | | } |
72 | | if ( ind<profileWw.length() ) |
73 | | { |
74 | | dW = profileWw ( ind )-profileWw ( ind-1 ); |
75 | | dW *=125e-6/dt_prof; |
76 | | } |
77 | | else |
78 | | { |
79 | | dW = 0; |
80 | | } |
81 | | // Check Mz profile and set Mz |
82 | | if ( ind<profileMz.length() ) |
83 | | { |
84 | | //sudden increase |
85 | | Mz = profileMz(ind); |
86 | | } |
87 | | else |
88 | | { |
89 | | Mz = 0; |
90 | | } |
91 | | } |
92 | | Ww += dW; |
93 | | //Simulate Dt seconds! |
94 | | for ( int i=0; i<Dt; i++ ) |
95 | | { |
96 | | pmsmsim_step ( Ww , Mz); |
97 | | } |
98 | | // for ( int i=0;i<Dt;i++ ) { pmsmsim_noreg_step ( Ww , Mz);} |
| 37 | //! Get measurements and signal plans from ELS3 controllers |
| 38 | void getdata ( vec &dt ) const; |