[119] | 1 | /* |
---|
| 2 | \file |
---|
| 3 | \brief Common simulation profiles for PMSM experiments |
---|
| 4 | \author Vaclav Smidl. |
---|
| 5 | |
---|
| 6 | ----------------------------------- |
---|
| 7 | BDM++ - C++ library for Bayesian Decision Making under Uncertainty |
---|
| 8 | |
---|
| 9 | Using IT++ for numerical operations |
---|
| 10 | ----------------------------------- |
---|
| 11 | */ |
---|
| 12 | |
---|
[224] | 13 | /*! \addtogroup PMSM |
---|
| 14 | @{ |
---|
| 15 | */ |
---|
| 16 | |
---|
[119] | 17 | void sim_profile_steps1(double &Ww,bool load=false) { |
---|
| 18 | |
---|
| 19 | if (t>0.2) x[8]=1.2; // 1A //0.2ZP |
---|
| 20 | if (t>0.4) x[8]=10.8; // 9A |
---|
| 21 | if (t>0.6) x[8]=25.2; // 21A |
---|
| 22 | |
---|
| 23 | if (t>0.7) Ww=2.*M_PI*10.; |
---|
| 24 | if (t>1.0) x[8]=1.2; // 1A |
---|
| 25 | if (t>1.2) x[8]=10.8; // 9A |
---|
| 26 | if (t>1.4) x[8]=25.2; // 21A |
---|
| 27 | |
---|
| 28 | if (t>1.6) Ww=2.*M_PI*50.; |
---|
| 29 | if (t>1.9) x[8]=1.2; // 1A |
---|
| 30 | if (t>2.1) x[8]=10.8; // 9A |
---|
| 31 | if (t>2.3) x[8]=25.2; // 21A |
---|
| 32 | |
---|
| 33 | if (t>2.5) Ww=2.*M_PI*100; |
---|
| 34 | if (t>2.8) x[8]=1.2; // 1A |
---|
| 35 | if (t>3.0) x[8]=10.8; // 9A |
---|
| 36 | if (t>3.2) x[8]=25.2; // 21A |
---|
| 37 | |
---|
| 38 | if (t>3.4) Ww=2.*M_PI*150; |
---|
| 39 | if (t>3.7) x[8]=1.2; // 1A |
---|
| 40 | if (t>3.9) x[8]=10.8; // 9A |
---|
| 41 | if (t>4.1) x[8]=25.2; // 21A |
---|
| 42 | |
---|
| 43 | if (t>4.3) Ww=2.*M_PI*0; |
---|
| 44 | if (t>4.8) x[8]=-1.2; // 1A |
---|
| 45 | if (t>5.0) x[8]=-10.8; // 9A |
---|
| 46 | if (t>5.2) x[8]=-25.2; // 21A |
---|
| 47 | |
---|
| 48 | if (t>5.4) Ww=2.*M_PI*(-10.); |
---|
| 49 | if (t>5.7) x[8]=-1.2; // 1A |
---|
| 50 | if (t>5.9) x[8]=-10.8; // 9A |
---|
| 51 | if (t>6.1) x[8]=-25.2; // 21A |
---|
| 52 | |
---|
| 53 | if (t>6.3) Ww=2.*M_PI*(-50.); |
---|
| 54 | if (t>6.7) x[8]=-1.2; // 1A |
---|
| 55 | if (t>6.9) x[8]=-10.8; // 9A |
---|
| 56 | if (t>7.1) x[8]=-25.2; // 21A |
---|
| 57 | |
---|
| 58 | if (t>7.3) Ww=2.*M_PI*(-100.); |
---|
| 59 | if (t>7.7) x[8]=-1.2; // 1A |
---|
| 60 | if (t>7.9) x[8]=-10.8; // 9A |
---|
| 61 | if (t>8.1) x[8]=-25.2; // 21A |
---|
| 62 | if (t>8.3) x[8]=10.8; // 9A |
---|
| 63 | if (t>8.5) x[8]=25.2; // 21A |
---|
| 64 | |
---|
| 65 | if (t>9) Ww=2.*M_PI*0; |
---|
| 66 | //remove load if load=false |
---|
| 67 | if (!load) x[8]=0.0; |
---|
| 68 | } |
---|
[215] | 69 | |
---|
| 70 | void sim_profile_2slowrevs(double &Ww,bool load=false) { |
---|
[218] | 71 | static int k_rampa=1; |
---|
[215] | 72 | |
---|
| 73 | if ((t>0.2)&&(t<0.8)) { |
---|
| 74 | if ((t>0.4)&&(t<0.7)) |
---|
| 75 | Ww+=k_rampa*2.*M_PI*4e-5; //1000Hz/s |
---|
| 76 | else |
---|
| 77 | Ww-=k_rampa*2.*M_PI*4e-5; //1000Hz/s |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | if (!load) x[8]=0.0; |
---|
| 81 | } |
---|
[218] | 82 | |
---|
| 83 | void sim_profile_vec01t(double &Ww, vec &vecWw){ |
---|
| 84 | static int ind=0; |
---|
| 85 | static double dW; |
---|
[223] | 86 | if (t>=0.1*ind) { |
---|
[218] | 87 | ind++; |
---|
| 88 | dW = vecWw(ind)-vecWw(ind-1); |
---|
| 89 | } |
---|
| 90 | Ww=vecWw(ind-1)+(t-0.1*(ind-1))*dW/0.1; |
---|
[224] | 91 | } |
---|
| 92 | /*! @} */ |
---|