1 | /*! |
---|
2 | \file |
---|
3 | \brief Simulation of disturbances in PMSM model, PWM and integration disturbances are distinguished |
---|
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 | |
---|
13 | #include "pmsm_ui.h" |
---|
14 | #include "sim_profiles.h" |
---|
15 | #include <stat/loggers_ui.h> |
---|
16 | |
---|
17 | using namespace bdm; |
---|
18 | int main() { |
---|
19 | UIFile F("sim.txt"); |
---|
20 | |
---|
21 | logger* L; |
---|
22 | UIbuild(F.lookup("logger"),L); |
---|
23 | pmsmDS * DS; |
---|
24 | UIbuild(F.lookup("system"),DS); |
---|
25 | int Ndat; |
---|
26 | F.lookupValue("ndat",Ndat); |
---|
27 | // SET SIMULATOR |
---|
28 | |
---|
29 | DS->log_add(*L); |
---|
30 | |
---|
31 | // int L_KO=L->add(RV("{ua ub ia ib ta tb }"),""); |
---|
32 | L->init(); |
---|
33 | |
---|
34 | pmsmsim_set_parameters ( 0.28,0.003465,0.1989,0.0,4,1.5,0.04, 200., 3e-6, 1e-6 ); |
---|
35 | |
---|
36 | double Ww=0.0; |
---|
37 | vec vecW = "1 2 4 8 4 2 0 -4 -9 -16 -4 0 0 0"; |
---|
38 | for ( int tK=1;tK<9000;tK++ ) { |
---|
39 | if (0) |
---|
40 | { |
---|
41 | for(int tt =0; tt<125; tt++){ |
---|
42 | sim_profile_steps1 ( Ww , false); |
---|
43 | //sim_profile_vec01t ( Ww,vecW ); |
---|
44 | pmsmsim_step ( Ww ); |
---|
45 | } |
---|
46 | } |
---|
47 | else {DS->step();} |
---|
48 | // DS->step(); |
---|
49 | DS->logit(*L); |
---|
50 | // L->logit(L_KO,vec(KalmanObs,6)); |
---|
51 | L->step(); |
---|
52 | } |
---|
53 | |
---|
54 | L->finalize(); |
---|
55 | |
---|
56 | delete L; |
---|
57 | //delete DS; |
---|
58 | return 0; |
---|
59 | } |
---|