1 | %hlavni spousteci skript experimentu
|
---|
2 | % !!! potreba pridat pmsm_sim mex soubory sestavene pro pouzivane pc/os
|
---|
3 |
|
---|
4 | clear all;
|
---|
5 |
|
---|
6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
7 | %NASTAVENI:
|
---|
8 | %%%%%%%%%%%
|
---|
9 |
|
---|
10 | %horizont
|
---|
11 | T = 120000;
|
---|
12 | % T = 12000;
|
---|
13 |
|
---|
14 | %profil pozadovanych otacek
|
---|
15 | % ref_profile = [0, -1, 3, 6, 9, 6, 3, 0, 0, 0, 0, 0, 0,-3, -6, -3];%/9*200;
|
---|
16 | % ref_profile = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
---|
17 | % ref_profile = [0, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 0];
|
---|
18 | ref_profile = [1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]*10;
|
---|
19 | % ref_profile = [1, 10, 50, 200, 200, 30, 0, 0, -1, -10, -50, -200, -200, -30, 0];
|
---|
20 | % ref_profile = [20, 20, 20, 50, 50, 50, -10, -10, -10, 0, 0, 0, 20, 20, 20];
|
---|
21 |
|
---|
22 | %pocatecni odhad uhlu natoceni
|
---|
23 | theta0 = 0;
|
---|
24 | % theta0 = 0.5;
|
---|
25 | % theta0 = 1.5;
|
---|
26 | % theta0 = 1.7;
|
---|
27 | % theta0 = 3.14;
|
---|
28 |
|
---|
29 | %simulace
|
---|
30 | % simulator = 0; %matlab
|
---|
31 | % simulator = 1; %simulator pmsm bez kompenzace ubytku
|
---|
32 | simulator = 10; %simulator pmsm s kompenzaci ubytku
|
---|
33 | % simulator = 2; %matlab s ruznymi indukcnostmi
|
---|
34 |
|
---|
35 | %vykresleni grafu
|
---|
36 | % graf = 0; %ne
|
---|
37 | graf = 1; %ano
|
---|
38 |
|
---|
39 | %ruzne indukcnosti v osach d-q
|
---|
40 | inddq = 0; %ne
|
---|
41 | % inddq = 1; %ano - pro vetsi otacky selze protoze nefunguje kompenzace
|
---|
42 | % konstantniho clenu - tu je treba dodelat ale je to tezke
|
---|
43 |
|
---|
44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
---|
45 | %EXPERIMENT:
|
---|
46 | %%%%%%%%%%%%
|
---|
47 |
|
---|
48 | % tic
|
---|
49 | % ukf_comp(T, ref_profile, theta0, simulator, graf)
|
---|
50 | % toc
|
---|
51 |
|
---|
52 | iter = 1;%0;
|
---|
53 |
|
---|
54 | totalloss1 = 0;
|
---|
55 | totalloss2 = 0;
|
---|
56 | totalloss3 = 0;
|
---|
57 | totalloss4 = 0;
|
---|
58 |
|
---|
59 |
|
---|
60 | % t1 = tic;
|
---|
61 | % for i = 1:iter
|
---|
62 | % [loss1] = basic_main(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
63 | % totalloss1 = totalloss1 + loss1;
|
---|
64 | % end
|
---|
65 | % time1 = toc(t1)
|
---|
66 | % totalloss1
|
---|
67 |
|
---|
68 | % t2 = tic;
|
---|
69 | % for i = 1:iter
|
---|
70 | % [loss2] = main(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
71 | % totalloss2 = totalloss2 + loss2;
|
---|
72 | % end
|
---|
73 | % time2 = toc(t2)
|
---|
74 | % totalloss2
|
---|
75 | %
|
---|
76 | t3 = tic;
|
---|
77 | for i = 1:iter
|
---|
78 | [loss3] = basic_main_lq4(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
79 | totalloss3 = totalloss3 + loss3;
|
---|
80 | end
|
---|
81 | time3 = toc(t3)
|
---|
82 | totalloss3
|
---|
83 | %
|
---|
84 | % t4 = tic;
|
---|
85 | % for i = 1:iter
|
---|
86 | % [loss4] = main_lq4(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
87 | % totalloss4 = totalloss4 + loss4;
|
---|
88 | % end
|
---|
89 | % time4 = toc(t4)
|
---|
90 | % totalloss4
|
---|
91 |
|
---|
92 | % %znovu s jinym simulatorem
|
---|
93 | % simulator = 1;
|
---|
94 | %
|
---|
95 | %
|
---|
96 | % totalloss1 = 0;
|
---|
97 | % totalloss2 = 0;
|
---|
98 | % totalloss3 = 0;
|
---|
99 | % totalloss4 = 0;
|
---|
100 | %
|
---|
101 | %
|
---|
102 | % t1 = tic;
|
---|
103 | % for i = 1:iter
|
---|
104 | % [loss1] = basic_main(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
105 | % totalloss1 = totalloss1 + loss1;
|
---|
106 | % end
|
---|
107 | % time1 = toc(t1)
|
---|
108 | % totalloss1
|
---|
109 | %
|
---|
110 | % t2 = tic;
|
---|
111 | % for i = 1:iter
|
---|
112 | % [loss2] = main(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
113 | % totalloss2 = totalloss2 + loss2;
|
---|
114 | % end
|
---|
115 | % time2 = toc(t2)
|
---|
116 | % totalloss2
|
---|
117 | %
|
---|
118 | % t3 = tic;
|
---|
119 | % for i = 1:iter
|
---|
120 | % [loss3] = basic_main_lq4(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
121 | % totalloss3 = totalloss3 + loss3;
|
---|
122 | % end
|
---|
123 | % time3 = toc(t3)
|
---|
124 | % totalloss3
|
---|
125 | %
|
---|
126 | % t4 = tic;
|
---|
127 | % for i = 1:iter
|
---|
128 | % [loss4] = main_lq4(T, ref_profile, theta0, simulator, graf, inddq);
|
---|
129 | % totalloss4 = totalloss4 + loss4;
|
---|
130 | % end
|
---|
131 | % time4 = toc(t4)
|
---|
132 | % totalloss4
|
---|