1 | <?xml version='1.0' encoding='UTF-8' standalone='no'?> |
---|
2 | <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6"> |
---|
3 | <compounddef id="pwm_8cpp" kind="file"> |
---|
4 | <compoundname>pwm.cpp</compoundname> |
---|
5 | <includes local="no">math.h</includes> |
---|
6 | <includes local="no">stdlib.h</includes> |
---|
7 | <includes refid="pwm_8h" local="yes">pwm.h</includes> |
---|
8 | <incdepgraph> |
---|
9 | <node id="775"> |
---|
10 | <label>pwm.h</label> |
---|
11 | <link refid="pwm_8h-source"/> |
---|
12 | </node> |
---|
13 | <node id="774"> |
---|
14 | <label>stdlib.h</label> |
---|
15 | </node> |
---|
16 | <node id="772"> |
---|
17 | <label>work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp</label> |
---|
18 | <link refid="pwm.cpp"/> |
---|
19 | <childnode refid="773" relation="include"> |
---|
20 | </childnode> |
---|
21 | <childnode refid="774" relation="include"> |
---|
22 | </childnode> |
---|
23 | <childnode refid="775" relation="include"> |
---|
24 | </childnode> |
---|
25 | </node> |
---|
26 | <node id="773"> |
---|
27 | <label>math.h</label> |
---|
28 | </node> |
---|
29 | </incdepgraph> |
---|
30 | <sectiondef kind="define"> |
---|
31 | <memberdef kind="define" id="pwm_8cpp_1525335710b53cb064ca56b936120431e" prot="public" static="no"> |
---|
32 | <name>_USE_MATH_DEFINES</name> |
---|
33 | <briefdescription> |
---|
34 | </briefdescription> |
---|
35 | <detaileddescription> |
---|
36 | </detaileddescription> |
---|
37 | <inbodydescription> |
---|
38 | </inbodydescription> |
---|
39 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="12" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="12" bodyend="-1"/> |
---|
40 | </memberdef> |
---|
41 | </sectiondef> |
---|
42 | <sectiondef kind="var"> |
---|
43 | <memberdef kind="variable" id="pwm_8cpp_1daf2100f703a9431b674c5210eeb65a3" prot="public" static="yes" mutable="no"> |
---|
44 | <type>double</type> |
---|
45 | <definition>double up</definition> |
---|
46 | <argsstring></argsstring> |
---|
47 | <name>up</name> |
---|
48 | <briefdescription> |
---|
49 | </briefdescription> |
---|
50 | <detaileddescription> |
---|
51 | </detaileddescription> |
---|
52 | <inbodydescription> |
---|
53 | </inbodydescription> |
---|
54 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/> |
---|
55 | </memberdef> |
---|
56 | <memberdef kind="variable" id="pwm_8cpp_12f875ebe908810d9666a2dcb4a28bd8e" prot="public" static="yes" mutable="no"> |
---|
57 | <type>double</type> |
---|
58 | <definition>double up2</definition> |
---|
59 | <argsstring></argsstring> |
---|
60 | <name>up2</name> |
---|
61 | <briefdescription> |
---|
62 | </briefdescription> |
---|
63 | <detaileddescription> |
---|
64 | </detaileddescription> |
---|
65 | <inbodydescription> |
---|
66 | </inbodydescription> |
---|
67 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/> |
---|
68 | </memberdef> |
---|
69 | <memberdef kind="variable" id="pwm_8cpp_13d0e10d2a152c348be161be18c1deb5a" prot="public" static="yes" mutable="no"> |
---|
70 | <type>double</type> |
---|
71 | <definition>double dup</definition> |
---|
72 | <argsstring></argsstring> |
---|
73 | <name>dup</name> |
---|
74 | <briefdescription> |
---|
75 | </briefdescription> |
---|
76 | <detaileddescription> |
---|
77 | </detaileddescription> |
---|
78 | <inbodydescription> |
---|
79 | </inbodydescription> |
---|
80 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="29" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="29" bodyend="-1"/> |
---|
81 | </memberdef> |
---|
82 | <memberdef kind="variable" id="pwm_8cpp_1a25c32c8e1605293535ff9baa435b758" prot="public" static="yes" mutable="no"> |
---|
83 | <type>int</type> |
---|
84 | <definition>int smer</definition> |
---|
85 | <argsstring></argsstring> |
---|
86 | <name>smer</name> |
---|
87 | <briefdescription> |
---|
88 | </briefdescription> |
---|
89 | <detaileddescription> |
---|
90 | </detaileddescription> |
---|
91 | <inbodydescription> |
---|
92 | </inbodydescription> |
---|
93 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="30" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="30" bodyend="-1"/> |
---|
94 | </memberdef> |
---|
95 | <memberdef kind="variable" id="pwm_8cpp_1e2040e9b4693cfc54938a3b2d062591c" prot="public" static="yes" mutable="no"> |
---|
96 | <type>int</type> |
---|
97 | <definition>int smer2</definition> |
---|
98 | <argsstring></argsstring> |
---|
99 | <name>smer2</name> |
---|
100 | <briefdescription> |
---|
101 | </briefdescription> |
---|
102 | <detaileddescription> |
---|
103 | </detaileddescription> |
---|
104 | <inbodydescription> |
---|
105 | </inbodydescription> |
---|
106 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="30" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="30" bodyend="-1"/> |
---|
107 | </memberdef> |
---|
108 | <memberdef kind="variable" id="pwm_8cpp_1911020f0c2ee7248d3575189b06398c2" prot="public" static="yes" mutable="no"> |
---|
109 | <type>int</type> |
---|
110 | <definition>int citac</definition> |
---|
111 | <argsstring></argsstring> |
---|
112 | <name>citac</name> |
---|
113 | <briefdescription> |
---|
114 | </briefdescription> |
---|
115 | <detaileddescription> |
---|
116 | </detaileddescription> |
---|
117 | <inbodydescription> |
---|
118 | </inbodydescription> |
---|
119 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/> |
---|
120 | </memberdef> |
---|
121 | <memberdef kind="variable" id="pwm_8cpp_1abf693f6b07594a20f4aa8d02a875399" prot="public" static="yes" mutable="no"> |
---|
122 | <type>int</type> |
---|
123 | <definition>int citac2</definition> |
---|
124 | <argsstring></argsstring> |
---|
125 | <name>citac2</name> |
---|
126 | <briefdescription> |
---|
127 | </briefdescription> |
---|
128 | <detaileddescription> |
---|
129 | </detaileddescription> |
---|
130 | <inbodydescription> |
---|
131 | </inbodydescription> |
---|
132 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/> |
---|
133 | </memberdef> |
---|
134 | <memberdef kind="variable" id="pwm_8cpp_1278b61cc75f0dcbf7685ad230b12b1a4" prot="public" static="yes" mutable="no"> |
---|
135 | <type>int</type> |
---|
136 | <definition>int citac_PR</definition> |
---|
137 | <argsstring></argsstring> |
---|
138 | <name>citac_PR</name> |
---|
139 | <briefdescription> |
---|
140 | </briefdescription> |
---|
141 | <detaileddescription> |
---|
142 | </detaileddescription> |
---|
143 | <inbodydescription> |
---|
144 | </inbodydescription> |
---|
145 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="32" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="32" bodyend="-1"/> |
---|
146 | </memberdef> |
---|
147 | <memberdef kind="variable" id="pwm_8cpp_17a680e4d7a5e9346e499145d368b3425" prot="public" static="no" mutable="no"> |
---|
148 | <type>double</type> |
---|
149 | <definition>double ladeni_pila</definition> |
---|
150 | <argsstring></argsstring> |
---|
151 | <name>ladeni_pila</name> |
---|
152 | <briefdescription> |
---|
153 | </briefdescription> |
---|
154 | <detaileddescription> |
---|
155 | </detaileddescription> |
---|
156 | <inbodydescription> |
---|
157 | </inbodydescription> |
---|
158 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="34" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="34" bodyend="-1"/> |
---|
159 | </memberdef> |
---|
160 | <memberdef kind="variable" id="pwm_8cpp_10395b9b0cf279728c73762ea8b38752d" prot="public" static="no" mutable="no"> |
---|
161 | <type>double</type> |
---|
162 | <definition>double ladeni_ur</definition> |
---|
163 | <argsstring></argsstring> |
---|
164 | <name>ladeni_ur</name> |
---|
165 | <briefdescription> |
---|
166 | </briefdescription> |
---|
167 | <detaileddescription> |
---|
168 | </detaileddescription> |
---|
169 | <inbodydescription> |
---|
170 | </inbodydescription> |
---|
171 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="34" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="34" bodyend="-1"/> |
---|
172 | </memberdef> |
---|
173 | </sectiondef> |
---|
174 | <sectiondef kind="func"> |
---|
175 | <memberdef kind="function" id="pwm_8cpp_17513b869bbedd804e88eacb29ce7ce65" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
176 | <type>void</type> |
---|
177 | <definition>void pwm_full_init</definition> |
---|
178 | <argsstring>(double Ucn, double fc, double DT)</argsstring> |
---|
179 | <name>pwm_full_init</name> |
---|
180 | <param> |
---|
181 | <type>double</type> |
---|
182 | <declname>Ucn</declname> |
---|
183 | </param> |
---|
184 | <param> |
---|
185 | <type>double</type> |
---|
186 | <declname>fc</declname> |
---|
187 | </param> |
---|
188 | <param> |
---|
189 | <type>double</type> |
---|
190 | <declname>DT</declname> |
---|
191 | </param> |
---|
192 | <briefdescription> |
---|
193 | </briefdescription> |
---|
194 | <detaileddescription> |
---|
195 | </detaileddescription> |
---|
196 | <inbodydescription> |
---|
197 | </inbodydescription> |
---|
198 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="17" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="36" bodyend="48"/> |
---|
199 | </memberdef> |
---|
200 | <memberdef kind="function" id="pwm_8cpp_11f94887ac28aad48fbc0a58158d1bfc9" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
201 | <type>void</type> |
---|
202 | <definition>void pwm_full</definition> |
---|
203 | <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *i, double fc, double *va_char, unsigned int pocet, double h)</argsstring> |
---|
204 | <name>pwm_full</name> |
---|
205 | <param> |
---|
206 | <type>double *</type> |
---|
207 | <declname>us</declname> |
---|
208 | </param> |
---|
209 | <param> |
---|
210 | <type>double *</type> |
---|
211 | <declname>u</declname> |
---|
212 | </param> |
---|
213 | <param> |
---|
214 | <type>double *</type> |
---|
215 | <declname>Iz</declname> |
---|
216 | </param> |
---|
217 | <param> |
---|
218 | <type>double</type> |
---|
219 | <declname>Ucn</declname> |
---|
220 | </param> |
---|
221 | <param> |
---|
222 | <type>double</type> |
---|
223 | <declname>Uc</declname> |
---|
224 | </param> |
---|
225 | <param> |
---|
226 | <type>double *</type> |
---|
227 | <declname>i</declname> |
---|
228 | </param> |
---|
229 | <param> |
---|
230 | <type>double</type> |
---|
231 | <declname>fc</declname> |
---|
232 | </param> |
---|
233 | <param> |
---|
234 | <type>double *</type> |
---|
235 | <declname>va_char</declname> |
---|
236 | </param> |
---|
237 | <param> |
---|
238 | <type>unsigned int</type> |
---|
239 | <declname>pocet</declname> |
---|
240 | </param> |
---|
241 | <param> |
---|
242 | <type>double</type> |
---|
243 | <declname>h</declname> |
---|
244 | </param> |
---|
245 | <briefdescription> |
---|
246 | </briefdescription> |
---|
247 | <detaileddescription> |
---|
248 | </detaileddescription> |
---|
249 | <inbodydescription> |
---|
250 | </inbodydescription> |
---|
251 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="18" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="50" bodyend="127"/> |
---|
252 | </memberdef> |
---|
253 | <memberdef kind="function" id="pwm_8cpp_1e1c2432789266f899d9b76a1116671ab" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
254 | <type>void</type> |
---|
255 | <definition>void pwm_full_new_init</definition> |
---|
256 | <argsstring>(double h, double fc, double DT, int citac_init, int D_smer, int D_smer2)</argsstring> |
---|
257 | <name>pwm_full_new_init</name> |
---|
258 | <param> |
---|
259 | <type>double</type> |
---|
260 | <declname>h</declname> |
---|
261 | </param> |
---|
262 | <param> |
---|
263 | <type>double</type> |
---|
264 | <declname>fc</declname> |
---|
265 | </param> |
---|
266 | <param> |
---|
267 | <type>double</type> |
---|
268 | <declname>DT</declname> |
---|
269 | </param> |
---|
270 | <param> |
---|
271 | <type>int</type> |
---|
272 | <declname>citac_init</declname> |
---|
273 | </param> |
---|
274 | <param> |
---|
275 | <type>int</type> |
---|
276 | <declname>D_smer</declname> |
---|
277 | </param> |
---|
278 | <param> |
---|
279 | <type>int</type> |
---|
280 | <declname>D_smer2</declname> |
---|
281 | </param> |
---|
282 | <briefdescription> |
---|
283 | </briefdescription> |
---|
284 | <detaileddescription> |
---|
285 | </detaileddescription> |
---|
286 | <inbodydescription> |
---|
287 | </inbodydescription> |
---|
288 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="20" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="217" bodyend="230"/> |
---|
289 | </memberdef> |
---|
290 | <memberdef kind="function" id="pwm_8cpp_1c56bd9c40bf614797dcf24aaa772cb13" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
291 | <type>void</type> |
---|
292 | <definition>void pwm_full_new</definition> |
---|
293 | <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *is, double *va_char, unsigned int pocet)</argsstring> |
---|
294 | <name>pwm_full_new</name> |
---|
295 | <param> |
---|
296 | <type>double *</type> |
---|
297 | <declname>us</declname> |
---|
298 | </param> |
---|
299 | <param> |
---|
300 | <type>double *</type> |
---|
301 | <declname>u</declname> |
---|
302 | </param> |
---|
303 | <param> |
---|
304 | <type>double *</type> |
---|
305 | <declname>Iz</declname> |
---|
306 | </param> |
---|
307 | <param> |
---|
308 | <type>double</type> |
---|
309 | <declname>Ucn</declname> |
---|
310 | </param> |
---|
311 | <param> |
---|
312 | <type>double</type> |
---|
313 | <declname>Uc</declname> |
---|
314 | </param> |
---|
315 | <param> |
---|
316 | <type>double *</type> |
---|
317 | <declname>is</declname> |
---|
318 | </param> |
---|
319 | <param> |
---|
320 | <type>double *</type> |
---|
321 | <declname>va_char</declname> |
---|
322 | </param> |
---|
323 | <param> |
---|
324 | <type>unsigned int</type> |
---|
325 | <declname>pocet</declname> |
---|
326 | </param> |
---|
327 | <briefdescription> |
---|
328 | </briefdescription> |
---|
329 | <detaileddescription> |
---|
330 | </detaileddescription> |
---|
331 | <inbodydescription> |
---|
332 | </inbodydescription> |
---|
333 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="21" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="150" bodyend="215"/> |
---|
334 | </memberdef> |
---|
335 | <memberdef kind="function" id="pwm_8cpp_190a472aec25336c72743a4b078251e3d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
336 | <type>void</type> |
---|
337 | <definition>void pwm_full_new_init_3h</definition> |
---|
338 | <argsstring>(double h, double fc, double DT, int citac_init, int D_smer, int D_smer2)</argsstring> |
---|
339 | <name>pwm_full_new_init_3h</name> |
---|
340 | <param> |
---|
341 | <type>double</type> |
---|
342 | <declname>h</declname> |
---|
343 | </param> |
---|
344 | <param> |
---|
345 | <type>double</type> |
---|
346 | <declname>fc</declname> |
---|
347 | </param> |
---|
348 | <param> |
---|
349 | <type>double</type> |
---|
350 | <declname>DT</declname> |
---|
351 | </param> |
---|
352 | <param> |
---|
353 | <type>int</type> |
---|
354 | <declname>citac_init</declname> |
---|
355 | </param> |
---|
356 | <param> |
---|
357 | <type>int</type> |
---|
358 | <declname>D_smer</declname> |
---|
359 | </param> |
---|
360 | <param> |
---|
361 | <type>int</type> |
---|
362 | <declname>D_smer2</declname> |
---|
363 | </param> |
---|
364 | <briefdescription> |
---|
365 | </briefdescription> |
---|
366 | <detaileddescription> |
---|
367 | </detaileddescription> |
---|
368 | <inbodydescription> |
---|
369 | </inbodydescription> |
---|
370 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="24" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="233" bodyend="246"/> |
---|
371 | </memberdef> |
---|
372 | <memberdef kind="function" id="pwm_8cpp_18dd985080259d21d1c0505551e3d187e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
373 | <type>void</type> |
---|
374 | <definition>void pwm_full_new_3h</definition> |
---|
375 | <argsstring>(double *us, double *u, double *Iz, double Ucn, double Uc, double *is, double *va_char, unsigned int pocet, unsigned int mod)</argsstring> |
---|
376 | <name>pwm_full_new_3h</name> |
---|
377 | <param> |
---|
378 | <type>double *</type> |
---|
379 | <declname>us</declname> |
---|
380 | </param> |
---|
381 | <param> |
---|
382 | <type>double *</type> |
---|
383 | <declname>u</declname> |
---|
384 | </param> |
---|
385 | <param> |
---|
386 | <type>double *</type> |
---|
387 | <declname>Iz</declname> |
---|
388 | </param> |
---|
389 | <param> |
---|
390 | <type>double</type> |
---|
391 | <declname>Ucn</declname> |
---|
392 | </param> |
---|
393 | <param> |
---|
394 | <type>double</type> |
---|
395 | <declname>Uc</declname> |
---|
396 | </param> |
---|
397 | <param> |
---|
398 | <type>double *</type> |
---|
399 | <declname>is</declname> |
---|
400 | </param> |
---|
401 | <param> |
---|
402 | <type>double *</type> |
---|
403 | <declname>va_char</declname> |
---|
404 | </param> |
---|
405 | <param> |
---|
406 | <type>unsigned int</type> |
---|
407 | <declname>pocet</declname> |
---|
408 | </param> |
---|
409 | <param> |
---|
410 | <type>unsigned int</type> |
---|
411 | <declname>mod</declname> |
---|
412 | </param> |
---|
413 | <briefdescription> |
---|
414 | </briefdescription> |
---|
415 | <detaileddescription> |
---|
416 | </detaileddescription> |
---|
417 | <inbodydescription> |
---|
418 | </inbodydescription> |
---|
419 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="25" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="249" bodyend="341"/> |
---|
420 | </memberdef> |
---|
421 | <memberdef kind="function" id="pwm_8cpp_1868d0eed8fe05ebbce87ae4297619983" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
422 | <type>double</type> |
---|
423 | <definition>static double ubytek</definition> |
---|
424 | <argsstring>(double *va_char, double I, unsigned int pocet)</argsstring> |
---|
425 | <name>ubytek</name> |
---|
426 | <param> |
---|
427 | <type>double *</type> |
---|
428 | <declname>va_char</declname> |
---|
429 | </param> |
---|
430 | <param> |
---|
431 | <type>double</type> |
---|
432 | <declname>I</declname> |
---|
433 | </param> |
---|
434 | <param> |
---|
435 | <type>unsigned int</type> |
---|
436 | <declname>pocet</declname> |
---|
437 | </param> |
---|
438 | <briefdescription> |
---|
439 | </briefdescription> |
---|
440 | <detaileddescription> |
---|
441 | </detaileddescription> |
---|
442 | <inbodydescription> |
---|
443 | </inbodydescription> |
---|
444 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" line="27" bodyfile="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp" bodystart="129" bodyend="147"/> |
---|
445 | </memberdef> |
---|
446 | </sectiondef> |
---|
447 | <briefdescription> |
---|
448 | </briefdescription> |
---|
449 | <detaileddescription> |
---|
450 | </detaileddescription> |
---|
451 | <programlisting> |
---|
452 | <codeline lineno="1"><highlight class="comment">/*<sp/>modul<sp/>PWM<sp/>modulace</highlight></codeline> |
---|
453 | <codeline lineno="2"><highlight class="comment"><sp/><sp/><sp/>ubytky<sp/>a<sp/>mrtve<sp/>casy</highlight></codeline> |
---|
454 | <codeline lineno="3"><highlight class="comment"></highlight></codeline> |
---|
455 | <codeline lineno="4"><highlight class="comment"><sp/><sp/><sp/>shodna<sp/>verze<sp/>s<sp/>PWM_FULL_LC</highlight></codeline> |
---|
456 | <codeline lineno="5"><highlight class="comment"></highlight></codeline> |
---|
457 | <codeline lineno="6"><highlight class="comment"><sp/><sp/><sp/>31.5.<sp/>2007</highlight></codeline> |
---|
458 | <codeline lineno="7"><highlight class="comment"></highlight></codeline> |
---|
459 | <codeline lineno="8"><highlight class="comment"><sp/><sp/><sp/>VER.<sp/>zmenena<sp/>metoda<sp/>vypoctu<sp/>pily<sp/>(nove<sp/>funkce)</highlight></codeline> |
---|
460 | <codeline lineno="9"><highlight class="comment"><sp/><sp/><sp/>31.5.2007<sp/><sp/><sp/><sp/>Doplnena<sp/>PWM<sp/>se<sp/>treti<sp/>harmonickou<sp/>-<sp/>fce<sp/>pwm_full_new_3h(...)<sp/>-<sp/>prepinani<sp/>mezi<sp/>sinusovou<sp/>PWM<sp/>a<sp/>3.<sp/>harmonickou<sp/>pomoci<sp/>priznaku<sp/>mod!</highlight></codeline> |
---|
461 | <codeline lineno="10"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
462 | <codeline lineno="11"><highlight class="normal"></highlight></codeline> |
---|
463 | <codeline lineno="12"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>_USE_MATH_DEFINES</highlight></codeline> |
---|
464 | <codeline lineno="13"><highlight class="preprocessor"></highlight><highlight class="preprocessor">#include<sp/><math.h></highlight><highlight class="normal"></highlight></codeline> |
---|
465 | <codeline lineno="14"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><stdlib.h></highlight><highlight class="normal"></highlight></codeline> |
---|
466 | <codeline lineno="15"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"pwm.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
467 | <codeline lineno="16"><highlight class="normal"></highlight></codeline> |
---|
468 | <codeline lineno="17"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT);</highlight></codeline> |
---|
469 | <codeline lineno="18"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*i,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h);</highlight></codeline> |
---|
470 | <codeline lineno="19"><highlight class="normal"></highlight></codeline> |
---|
471 | <codeline lineno="20"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2);</highlight></codeline> |
---|
472 | <codeline lineno="21"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet);</highlight></codeline> |
---|
473 | <codeline lineno="22"><highlight class="normal"></highlight></codeline> |
---|
474 | <codeline lineno="23"><highlight class="normal"></highlight><highlight class="comment">//<sp/>PWM<sp/>se<sp/>treti<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline> |
---|
475 | <codeline lineno="24"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2);</highlight></codeline> |
---|
476 | <codeline lineno="25"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mod);</highlight></codeline> |
---|
477 | <codeline lineno="26"><highlight class="normal"></highlight></codeline> |
---|
478 | <codeline lineno="27"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ubytek(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>I,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet);</highlight></codeline> |
---|
479 | <codeline lineno="28"><highlight class="normal"></highlight></codeline> |
---|
480 | <codeline lineno="29"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>up,<sp/>up2,<sp/>dup;</highlight></codeline> |
---|
481 | <codeline lineno="30"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>smer,<sp/>smer2;</highlight></codeline> |
---|
482 | <codeline lineno="31"><highlight class="normal"></highlight></codeline> |
---|
483 | <codeline lineno="32"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac,<sp/>citac2,<sp/>citac_PR;</highlight></codeline> |
---|
484 | <codeline lineno="33"><highlight class="normal"></highlight></codeline> |
---|
485 | <codeline lineno="34"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ladeni_pila,<sp/>ladeni_ur;</highlight></codeline> |
---|
486 | <codeline lineno="35"><highlight class="normal"></highlight></codeline> |
---|
487 | <codeline lineno="36"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT)</highlight></codeline> |
---|
488 | <codeline lineno="37"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
489 | <codeline lineno="38"><highlight class="comment">Ucn<sp/>...<sp/>jmenovite<sp/>napeti<sp/>kondenzatoru<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
490 | <codeline lineno="39"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline> |
---|
491 | <codeline lineno="40"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline> |
---|
492 | <codeline lineno="41"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline> |
---|
493 | <codeline lineno="42"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
494 | <codeline lineno="43"><highlight class="normal">{</highlight></codeline> |
---|
495 | <codeline lineno="44"><highlight class="normal"><sp/><sp/>smer=-1;<sp/>smer2=1;</highlight></codeline> |
---|
496 | <codeline lineno="45"><highlight class="normal"><sp/><sp/>up=Ucn/2;</highlight></codeline> |
---|
497 | <codeline lineno="46"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up=0.;</highlight><highlight class="normal"></highlight></codeline> |
---|
498 | <codeline lineno="47"><highlight class="normal"><sp/><sp/>up2=up-2*Ucn*fc*DT;</highlight></codeline> |
---|
499 | <codeline lineno="48"><highlight class="normal">}</highlight></codeline> |
---|
500 | <codeline lineno="49"><highlight class="normal"></highlight></codeline> |
---|
501 | <codeline lineno="50"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h)</highlight></codeline> |
---|
502 | <codeline lineno="51"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
503 | <codeline lineno="52"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti</highlight></codeline> |
---|
504 | <codeline lineno="53"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline> |
---|
505 | <codeline lineno="54"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
506 | <codeline lineno="55"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
507 | <codeline lineno="56"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline> |
---|
508 | <codeline lineno="57"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline> |
---|
509 | <codeline lineno="58"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline> |
---|
510 | <codeline lineno="59"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline> |
---|
511 | <codeline lineno="60"><highlight class="comment">h<sp/><sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline> |
---|
512 | <codeline lineno="61"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
513 | <codeline lineno="62"><highlight class="normal">{</highlight></codeline> |
---|
514 | <codeline lineno="63"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
515 | <codeline lineno="64"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline> |
---|
516 | <codeline lineno="65"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline> |
---|
517 | <codeline lineno="66"><highlight class="normal"></highlight></codeline> |
---|
518 | <codeline lineno="67"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline> |
---|
519 | <codeline lineno="68"><highlight class="normal"></highlight></codeline> |
---|
520 | <codeline lineno="69"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline> |
---|
521 | <codeline lineno="70"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
522 | <codeline lineno="71"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
523 | <codeline lineno="72"><highlight class="normal"></highlight></codeline> |
---|
524 | <codeline lineno="73"><highlight class="normal"><sp/><sp/>ur[0]=*u;</highlight></codeline> |
---|
525 | <codeline lineno="74"><highlight class="normal"><sp/><sp/>ur[1]=(-*u+sqrt(3.)**(u+1))/2.;</highlight></codeline> |
---|
526 | <codeline lineno="75"><highlight class="normal"><sp/><sp/>ur[2]=(-*u-sqrt(3.)**(u+1))/2.;</highlight></codeline> |
---|
527 | <codeline lineno="76"><highlight class="normal"></highlight></codeline> |
---|
528 | <codeline lineno="77"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
529 | <codeline lineno="78"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline> |
---|
530 | <codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline> |
---|
531 | <codeline lineno="80"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
532 | <codeline lineno="81"><highlight class="normal"></highlight></codeline> |
---|
533 | <codeline lineno="82"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline> |
---|
534 | <codeline lineno="83"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
535 | <codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]>=0)</highlight></codeline> |
---|
536 | <codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]>up)<sp/>&&<sp/>(ur[i]>up2))</highlight></codeline> |
---|
537 | <codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline> |
---|
538 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
539 | <codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline> |
---|
540 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
541 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]<up)<sp/>&&<sp/>(ur[i]<up2))</highlight></codeline> |
---|
542 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline> |
---|
543 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
544 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline> |
---|
545 | <codeline lineno="94"><highlight class="normal"></highlight></codeline> |
---|
546 | <codeline lineno="95"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline> |
---|
547 | <codeline lineno="96"><highlight class="normal"><sp/><sp/>ua=(2*ustr[0]-ustr[1]-ustr[2])/3;</highlight></codeline> |
---|
548 | <codeline lineno="97"><highlight class="normal"><sp/><sp/>ub=(2*ustr[1]-ustr[0]-ustr[2])/3;</highlight></codeline> |
---|
549 | <codeline lineno="98"><highlight class="normal"><sp/><sp/>uc=(2*ustr[2]-ustr[0]-ustr[1])/3;</highlight></codeline> |
---|
550 | <codeline lineno="99"><highlight class="normal"></highlight></codeline> |
---|
551 | <codeline lineno="100"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline> |
---|
552 | <codeline lineno="101"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline> |
---|
553 | <codeline lineno="102"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline> |
---|
554 | <codeline lineno="103"><highlight class="normal"></highlight></codeline> |
---|
555 | <codeline lineno="104"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily<sp/>pro<sp/>PWM<sp/>a<sp/>pily<sp/>pro<sp/>mrtve<sp/>casy</highlight><highlight class="normal"></highlight></codeline> |
---|
556 | <codeline lineno="105"><highlight class="normal"><sp/><sp/>dup=2.*Ucn*fc*h;</highlight></codeline> |
---|
557 | <codeline lineno="106"><highlight class="normal"><sp/><sp/>up+=smer*dup;</highlight></codeline> |
---|
558 | <codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up>Ucn/2)</highlight></codeline> |
---|
559 | <codeline lineno="108"><highlight class="normal"><sp/><sp/>{<sp/>up-=2*dup;</highlight></codeline> |
---|
560 | <codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/>smer=-1;</highlight></codeline> |
---|
561 | <codeline lineno="110"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
562 | <codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up<-Ucn/2)</highlight></codeline> |
---|
563 | <codeline lineno="112"><highlight class="normal"><sp/><sp/>{<sp/>up+=2.*dup;</highlight></codeline> |
---|
564 | <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/>smer=1;</highlight></codeline> |
---|
565 | <codeline lineno="114"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
566 | <codeline lineno="115"><highlight class="normal"></highlight></codeline> |
---|
567 | <codeline lineno="116"><highlight class="normal"><sp/><sp/>up2+=smer2*dup;</highlight></codeline> |
---|
568 | <codeline lineno="117"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up2>Ucn/2)</highlight></codeline> |
---|
569 | <codeline lineno="118"><highlight class="normal"><sp/><sp/>{<sp/>up2-=2.*dup;</highlight></codeline> |
---|
570 | <codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/>smer2=-1;</highlight></codeline> |
---|
571 | <codeline lineno="120"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
572 | <codeline lineno="121"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(up2<-Ucn/2)</highlight></codeline> |
---|
573 | <codeline lineno="122"><highlight class="normal"><sp/><sp/>{<sp/>up2+=2.*dup;</highlight></codeline> |
---|
574 | <codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/>smer2=1;</highlight></codeline> |
---|
575 | <codeline lineno="124"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
576 | <codeline lineno="125"><highlight class="normal"></highlight></codeline> |
---|
577 | <codeline lineno="126"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]>0)*iabc[0]+(ustr[1]>0)*iabc[1]+(ustr[2]>0)*iabc[2];</highlight></codeline> |
---|
578 | <codeline lineno="127"><highlight class="normal">}</highlight></codeline> |
---|
579 | <codeline lineno="128"><highlight class="normal"></highlight></codeline> |
---|
580 | <codeline lineno="129"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ubytek(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>I,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet)</highlight></codeline> |
---|
581 | <codeline lineno="130"><highlight class="normal">{</highlight></codeline> |
---|
582 | <codeline lineno="131"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ii;</highlight></codeline> |
---|
583 | <codeline lineno="132"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>delta_u;</highlight></codeline> |
---|
584 | <codeline lineno="133"><highlight class="normal"></highlight></codeline> |
---|
585 | <codeline lineno="134"><highlight class="normal"><sp/><sp/>ii=0;</highlight></codeline> |
---|
586 | <codeline lineno="135"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((*(va_char+ii)<I)<sp/>&&<sp/>(ii<(pocet-1)))</highlight></codeline> |
---|
587 | <codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/>ii++;</highlight></codeline> |
---|
588 | <codeline lineno="137"><highlight class="normal"></highlight></codeline> |
---|
589 | <codeline lineno="138"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ii==(pocet-1))<sp/><sp/></highlight><highlight class="comment">//<sp/>konec<sp/>va_char<sp/>-<sp/>predpoklad<sp/>nasyceni<sp/>charky</highlight><highlight class="normal"></highlight></codeline> |
---|
590 | <codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/>delta_u=*(va_char+ii+pocet);</highlight></codeline> |
---|
591 | <codeline lineno="140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
592 | <codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ii==0)</highlight></codeline> |
---|
593 | <codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>delta_u=0;</highlight></codeline> |
---|
594 | <codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
595 | <codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>delta_u=*(va_char+ii-1+pocet)+(I-*(va_char+ii-1))/(*(va_char+ii)-*(va_char+ii-1))*(*(va_char+ii+pocet)-*(va_char+ii-1+pocet));</highlight></codeline> |
---|
596 | <codeline lineno="145"><highlight class="normal"></highlight></codeline> |
---|
597 | <codeline lineno="146"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>delta_u;</highlight></codeline> |
---|
598 | <codeline lineno="147"><highlight class="normal">}</highlight></codeline> |
---|
599 | <codeline lineno="148"><highlight class="normal"></highlight></codeline> |
---|
600 | <codeline lineno="149"><highlight class="normal"></highlight></codeline> |
---|
601 | <codeline lineno="150"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet)</highlight></codeline> |
---|
602 | <codeline lineno="151"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
603 | <codeline lineno="152"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti</highlight></codeline> |
---|
604 | <codeline lineno="153"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline> |
---|
605 | <codeline lineno="154"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
606 | <codeline lineno="155"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
607 | <codeline lineno="156"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline> |
---|
608 | <codeline lineno="157"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline> |
---|
609 | <codeline lineno="158"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline> |
---|
610 | <codeline lineno="159"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline> |
---|
611 | <codeline lineno="160"><highlight class="comment">t<sp/><sp/><sp/><sp/>...<sp/>aktualni<sp/>cas<sp/>simulace</highlight></codeline> |
---|
612 | <codeline lineno="161"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
613 | <codeline lineno="162"><highlight class="normal">{</highlight></codeline> |
---|
614 | <codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
615 | <codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline> |
---|
616 | <codeline lineno="165"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline> |
---|
617 | <codeline lineno="166"><highlight class="normal"></highlight></codeline> |
---|
618 | <codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily</highlight><highlight class="normal"></highlight></codeline> |
---|
619 | <codeline lineno="168"><highlight class="normal"><sp/><sp/>up=(double)citac/citac_PR*Ucn/2.;</highlight></codeline> |
---|
620 | <codeline lineno="169"><highlight class="normal"><sp/><sp/>up2=(double)citac2/citac_PR*Ucn/2.;</highlight></codeline> |
---|
621 | <codeline lineno="170"><highlight class="normal"></highlight></codeline> |
---|
622 | <codeline lineno="171"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline> |
---|
623 | <codeline lineno="172"><highlight class="normal"></highlight></codeline> |
---|
624 | <codeline lineno="173"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline> |
---|
625 | <codeline lineno="174"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
626 | <codeline lineno="175"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
627 | <codeline lineno="176"><highlight class="normal"></highlight></codeline> |
---|
628 | <codeline lineno="177"><highlight class="normal"><sp/><sp/>ur[0]=*u;</highlight></codeline> |
---|
629 | <codeline lineno="178"><highlight class="normal"><sp/><sp/>ur[1]=(-*u+sqrt(3.)**(u+1))/2.;</highlight></codeline> |
---|
630 | <codeline lineno="179"><highlight class="normal"><sp/><sp/>ur[2]=(-*u-sqrt(3.)**(u+1))/2.;</highlight></codeline> |
---|
631 | <codeline lineno="180"><highlight class="normal"></highlight></codeline> |
---|
632 | <codeline lineno="181"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
633 | <codeline lineno="182"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline> |
---|
634 | <codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline> |
---|
635 | <codeline lineno="184"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
636 | <codeline lineno="185"><highlight class="normal"></highlight></codeline> |
---|
637 | <codeline lineno="186"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline> |
---|
638 | <codeline lineno="187"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
639 | <codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]>=0)</highlight></codeline> |
---|
640 | <codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]>up)<sp/>&&<sp/>(ur[i]>up2))</highlight></codeline> |
---|
641 | <codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline> |
---|
642 | <codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
643 | <codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline> |
---|
644 | <codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
645 | <codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]<up)<sp/>&&<sp/>(ur[i]<up2))</highlight></codeline> |
---|
646 | <codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline> |
---|
647 | <codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
648 | <codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline> |
---|
649 | <codeline lineno="198"><highlight class="normal"></highlight></codeline> |
---|
650 | <codeline lineno="199"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline> |
---|
651 | <codeline lineno="200"><highlight class="normal"><sp/><sp/>ua=(2*ustr[0]-ustr[1]-ustr[2])/3;</highlight></codeline> |
---|
652 | <codeline lineno="201"><highlight class="normal"><sp/><sp/>ub=(2*ustr[1]-ustr[0]-ustr[2])/3;</highlight></codeline> |
---|
653 | <codeline lineno="202"><highlight class="normal"><sp/><sp/>uc=(2*ustr[2]-ustr[0]-ustr[1])/3;</highlight></codeline> |
---|
654 | <codeline lineno="203"><highlight class="normal"></highlight></codeline> |
---|
655 | <codeline lineno="204"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline> |
---|
656 | <codeline lineno="205"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline> |
---|
657 | <codeline lineno="206"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline> |
---|
658 | <codeline lineno="207"><highlight class="normal"></highlight></codeline> |
---|
659 | <codeline lineno="208"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]>0)*iabc[0]+(ustr[1]>0)*iabc[1]+(ustr[2]>0)*iabc[2];</highlight></codeline> |
---|
660 | <codeline lineno="209"><highlight class="normal"></highlight></codeline> |
---|
661 | <codeline lineno="210"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>posun<sp/>pily<sp/>...<sp/>inkrement<sp/>citacu</highlight><highlight class="normal"></highlight></codeline> |
---|
662 | <codeline lineno="211"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac==citac_PR)||(citac==-citac_PR))<sp/>smer*=-1;</highlight></codeline> |
---|
663 | <codeline lineno="212"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac2==citac_PR)||(citac2==-citac_PR))<sp/>smer2*=-1;</highlight></codeline> |
---|
664 | <codeline lineno="213"><highlight class="normal"><sp/><sp/>citac+=smer;</highlight></codeline> |
---|
665 | <codeline lineno="214"><highlight class="normal"><sp/><sp/>citac2+=smer2;</highlight></codeline> |
---|
666 | <codeline lineno="215"><highlight class="normal">}</highlight></codeline> |
---|
667 | <codeline lineno="216"><highlight class="normal"></highlight></codeline> |
---|
668 | <codeline lineno="217"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2)</highlight></codeline> |
---|
669 | <codeline lineno="218"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
670 | <codeline lineno="219"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline> |
---|
671 | <codeline lineno="220"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline> |
---|
672 | <codeline lineno="221"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline> |
---|
673 | <codeline lineno="222"><highlight class="comment">citac_init<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>citace</highlight></codeline> |
---|
674 | <codeline lineno="223"><highlight class="comment">D_smer,<sp/>D_smer1<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>smeru<sp/>citani</highlight></codeline> |
---|
675 | <codeline lineno="224"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
676 | <codeline lineno="225"><highlight class="normal">{</highlight></codeline> |
---|
677 | <codeline lineno="226"><highlight class="normal"><sp/><sp/>smer=D_smer;<sp/>smer2=D_smer2;</highlight></codeline> |
---|
678 | <codeline lineno="227"><highlight class="normal"><sp/><sp/>citac=citac_init;</highlight></codeline> |
---|
679 | <codeline lineno="228"><highlight class="normal"><sp/><sp/>citac2=citac_init-(int)(DT/h);</highlight></codeline> |
---|
680 | <codeline lineno="229"><highlight class="normal"><sp/><sp/>citac_PR=(int)(1./4./fc/h);</highlight></codeline> |
---|
681 | <codeline lineno="230"><highlight class="normal">}</highlight></codeline> |
---|
682 | <codeline lineno="231"><highlight class="normal"></highlight></codeline> |
---|
683 | <codeline lineno="232"><highlight class="normal"></highlight></codeline> |
---|
684 | <codeline lineno="233"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_init_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>h,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>fc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>DT,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>citac_init,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>D_smer2)</highlight></codeline> |
---|
685 | <codeline lineno="234"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
686 | <codeline lineno="235"><highlight class="comment">fc<sp/><sp/>...<sp/>spinaci<sp/>frekvence</highlight></codeline> |
---|
687 | <codeline lineno="236"><highlight class="comment">h<sp/><sp/><sp/>...<sp/>krok<sp/>simulace</highlight></codeline> |
---|
688 | <codeline lineno="237"><highlight class="comment">DT<sp/><sp/>...<sp/>velikost<sp/>mrtveho<sp/>casu</highlight></codeline> |
---|
689 | <codeline lineno="238"><highlight class="comment">citac_init<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>citace</highlight></codeline> |
---|
690 | <codeline lineno="239"><highlight class="comment">D_smer,<sp/>D_smer1<sp/>...<sp/>pocatecni<sp/>nastaveni<sp/>smeru<sp/>citani</highlight></codeline> |
---|
691 | <codeline lineno="240"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
692 | <codeline lineno="241"><highlight class="normal">{</highlight></codeline> |
---|
693 | <codeline lineno="242"><highlight class="normal"><sp/><sp/>smer=D_smer;<sp/>smer2=D_smer2;</highlight></codeline> |
---|
694 | <codeline lineno="243"><highlight class="normal"><sp/><sp/>citac=citac_init;</highlight></codeline> |
---|
695 | <codeline lineno="244"><highlight class="normal"><sp/><sp/>citac2=abs(citac_init-(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(DT/h));</highlight></codeline> |
---|
696 | <codeline lineno="245"><highlight class="normal"><sp/><sp/>citac_PR=(int)(1./2./fc/h);</highlight></codeline> |
---|
697 | <codeline lineno="246"><highlight class="normal">}</highlight></codeline> |
---|
698 | <codeline lineno="247"><highlight class="normal"></highlight></codeline> |
---|
699 | <codeline lineno="248"><highlight class="normal"></highlight></codeline> |
---|
700 | <codeline lineno="249"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pwm_full_new_3h(</highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*us,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*u,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Iz,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Ucn,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Uc,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*is,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*va_char,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pocet,<sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mod)</highlight></codeline> |
---|
701 | <codeline lineno="250"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline> |
---|
702 | <codeline lineno="251"><highlight class="comment">u<sp/><sp/><sp/><sp/>...<sp/>pozadovane<sp/>napeti<sp/>ve<sp/>formatu<sp/>u={Um,<sp/>beta}</highlight></codeline> |
---|
703 | <codeline lineno="252"><highlight class="comment">us<sp/><sp/><sp/>...<sp/>[usx,<sp/>usy]...vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight></codeline> |
---|
704 | <codeline lineno="253"><highlight class="comment">Iz<sp/><sp/><sp/>...<sp/>proud<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
705 | <codeline lineno="254"><highlight class="comment">Ucn<sp/><sp/>...<sp/>jmenovite<sp/>nap.<sp/>v<sp/>ss<sp/>obvodu</highlight></codeline> |
---|
706 | <codeline lineno="255"><highlight class="comment">Uc<sp/><sp/><sp/>...<sp/>skutecne<sp/>napeti<sp/>na<sp/>C</highlight></codeline> |
---|
707 | <codeline lineno="256"><highlight class="comment">is<sp/><sp/><sp/>...<sp/>[isx,<sp/>isy]...proud<sp/>motorem</highlight></codeline> |
---|
708 | <codeline lineno="257"><highlight class="comment">va_char<sp/>...<sp/>VA-char<sp/>vykonovych<sp/>spinacu</highlight></codeline> |
---|
709 | <codeline lineno="258"><highlight class="comment">pocet<sp/><sp/><sp/>...<sp/>pocet<sp/>bodu<sp/>VA-charky</highlight></codeline> |
---|
710 | <codeline lineno="259"><highlight class="comment">t<sp/><sp/><sp/><sp/>...<sp/>aktualni<sp/>cas<sp/>simulace</highlight></codeline> |
---|
711 | <codeline lineno="260"><highlight class="comment">mod<sp/>...<sp/>mod=<sp/>-<sp/>sinusova<sp/>PWM;<sp/>mod=1<sp/>-<sp/>PWM<sp/>se<sp/>3.<sp/>harmonickou</highlight></codeline> |
---|
712 | <codeline lineno="261"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline> |
---|
713 | <codeline lineno="262"><highlight class="normal">{</highlight></codeline> |
---|
714 | <codeline lineno="263"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
715 | <codeline lineno="264"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>iabc[3],<sp/>ur[3],ustr[3],ua,ub,uc;</highlight></codeline> |
---|
716 | <codeline lineno="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>dtr[3],dd[3];<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ubytky<sp/>na<sp/>polovodicich</highlight><highlight class="normal"></highlight></codeline> |
---|
717 | <codeline lineno="266"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Um,<sp/>beta;</highlight></codeline> |
---|
718 | <codeline lineno="267"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>U3;<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>korekce<sp/>3.<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline> |
---|
719 | <codeline lineno="268"><highlight class="normal"></highlight></codeline> |
---|
720 | <codeline lineno="269"><highlight class="normal"></highlight></codeline> |
---|
721 | <codeline lineno="270"><highlight class="normal"><sp/><sp/>Um=*u;</highlight></codeline> |
---|
722 | <codeline lineno="271"><highlight class="normal"><sp/><sp/>beta=*(u+1);</highlight></codeline> |
---|
723 | <codeline lineno="272"><highlight class="normal"></highlight></codeline> |
---|
724 | <codeline lineno="273"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily</highlight><highlight class="normal"></highlight></codeline> |
---|
725 | <codeline lineno="274"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up=(double)citac/citac_PR*Ucn/2.;</highlight><highlight class="normal"></highlight></codeline> |
---|
726 | <codeline lineno="275"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>up2=(double)citac2/citac_PR*Ucn/2.;</highlight><highlight class="normal"></highlight></codeline> |
---|
727 | <codeline lineno="276"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>vypocet<sp/>pily<sp/>presne<sp/>jako<sp/>v<sp/>procesoru</highlight><highlight class="normal"></highlight></codeline> |
---|
728 | <codeline lineno="277"><highlight class="normal"><sp/><sp/>up=((double)citac/citac_PR-0.5)*Ucn;</highlight></codeline> |
---|
729 | <codeline lineno="278"><highlight class="normal"><sp/><sp/>up2=((double)citac2/citac_PR-0.5)*Ucn;</highlight></codeline> |
---|
730 | <codeline lineno="279"><highlight class="normal"></highlight></codeline> |
---|
731 | <codeline lineno="280"><highlight class="normal"><sp/><sp/>ladeni_pila=up;</highlight></codeline> |
---|
732 | <codeline lineno="281"><highlight class="normal"></highlight></codeline> |
---|
733 | <codeline lineno="282"><highlight class="normal"><sp/><sp/>iabc[0]=*is;</highlight></codeline> |
---|
734 | <codeline lineno="283"><highlight class="normal"><sp/><sp/>iabc[1]=(-*is+sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
735 | <codeline lineno="284"><highlight class="normal"><sp/><sp/>iabc[2]=(-*is-sqrt(3.)**(is+1))/2.;</highlight></codeline> |
---|
736 | <codeline lineno="285"><highlight class="normal"></highlight></codeline> |
---|
737 | <codeline lineno="286"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(mod==0)<sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>sinusova<sp/>PWM</highlight><highlight class="normal"></highlight></codeline> |
---|
738 | <codeline lineno="287"><highlight class="normal"><sp/><sp/>{</highlight></codeline> |
---|
739 | <codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[0]=Um*cos(beta);</highlight></codeline> |
---|
740 | <codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[1]=Um*cos(beta-2./3.*M_PI);</highlight></codeline> |
---|
741 | <codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[2]=Um*cos(beta+2./3.*M_PI);</highlight></codeline> |
---|
742 | <codeline lineno="291"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
743 | <codeline lineno="292"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>PWM<sp/>se<sp/>3.<sp/>harmonickou</highlight><highlight class="normal"></highlight></codeline> |
---|
744 | <codeline lineno="293"><highlight class="normal"><sp/><sp/>{</highlight></codeline> |
---|
745 | <codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>dle<sp/>Karla</highlight><highlight class="normal"></highlight></codeline> |
---|
746 | <codeline lineno="295"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/>U3=0.13*cos(3.*beta);</highlight><highlight class="normal"></highlight></codeline> |
---|
747 | <codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>moje</highlight><highlight class="normal"></highlight></codeline> |
---|
748 | <codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>U3=0.17*cos(3.*beta);</highlight></codeline> |
---|
749 | <codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[0]=Um*(cos(beta)-U3);</highlight></codeline> |
---|
750 | <codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[1]=Um*(cos(beta-2./3.*M_PI)-U3);</highlight></codeline> |
---|
751 | <codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/>ur[2]=Um*(cos(beta+2./3.*M_PI)-U3);</highlight></codeline> |
---|
752 | <codeline lineno="301"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
753 | <codeline lineno="302"><highlight class="normal"></highlight></codeline> |
---|
754 | <codeline lineno="303"><highlight class="normal"><sp/><sp/>ladeni_ur=ur[0];</highlight></codeline> |
---|
755 | <codeline lineno="304"><highlight class="normal"></highlight></codeline> |
---|
756 | <codeline lineno="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
757 | <codeline lineno="306"><highlight class="normal"><sp/><sp/>{<sp/>dtr[i]=ubytek(va_char,fabs(iabc[i]),pocet);</highlight></codeline> |
---|
758 | <codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/>dd[i]=dtr[i]*.73;</highlight></codeline> |
---|
759 | <codeline lineno="308"><highlight class="normal"><sp/><sp/>}</highlight></codeline> |
---|
760 | <codeline lineno="309"><highlight class="normal"></highlight></codeline> |
---|
761 | <codeline lineno="310"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>implementace<sp/>ubytku<sp/>a<sp/>mrtvych<sp/>casu</highlight><highlight class="normal"></highlight></codeline> |
---|
762 | <codeline lineno="311"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i=0;i<3;i++)</highlight></codeline> |
---|
763 | <codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iabc[i]>=0)</highlight></codeline> |
---|
764 | <codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]>up)<sp/>&&<sp/>(ur[i]>up2))</highlight></codeline> |
---|
765 | <codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2-dtr[i];</highlight></codeline> |
---|
766 | <codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
767 | <codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2+dd[i]);</highlight></codeline> |
---|
768 | <codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
769 | <codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ur[i]<up)<sp/>&&<sp/>(ur[i]<up2))</highlight></codeline> |
---|
770 | <codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=-(Uc/2-dtr[i]);</highlight></codeline> |
---|
771 | <codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
772 | <codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ustr[i]=Uc/2+dd[i];</highlight></codeline> |
---|
773 | <codeline lineno="322"><highlight class="normal"></highlight></codeline> |
---|
774 | <codeline lineno="323"><highlight class="normal"></highlight><highlight class="comment">//<sp/>fazova<sp/>napeti<sp/>zateze</highlight><highlight class="normal"></highlight></codeline> |
---|
775 | <codeline lineno="324"><highlight class="normal"><sp/><sp/>ua=(2.*ustr[0]-ustr[1]-ustr[2])/3.;</highlight></codeline> |
---|
776 | <codeline lineno="325"><highlight class="normal"><sp/><sp/>ub=(2.*ustr[1]-ustr[0]-ustr[2])/3.;</highlight></codeline> |
---|
777 | <codeline lineno="326"><highlight class="normal"><sp/><sp/>uc=(2.*ustr[2]-ustr[0]-ustr[1])/3.;</highlight></codeline> |
---|
778 | <codeline lineno="327"><highlight class="normal"></highlight></codeline> |
---|
779 | <codeline lineno="328"><highlight class="normal"></highlight><highlight class="comment">//<sp/>vystupni<sp/>napeti<sp/>stridace<sp/>v<sp/>(x,y)</highlight><highlight class="normal"></highlight></codeline> |
---|
780 | <codeline lineno="329"><highlight class="normal"><sp/><sp/>*us=(2.*ua-ub-uc)/3.;</highlight></codeline> |
---|
781 | <codeline lineno="330"><highlight class="normal"><sp/><sp/>*(us+1)=(ub-uc)/sqrt(3.);</highlight></codeline> |
---|
782 | <codeline lineno="331"><highlight class="normal"></highlight></codeline> |
---|
783 | <codeline lineno="332"><highlight class="normal"><sp/><sp/>*Iz=(ustr[0]>0)*iabc[0]+(ustr[1]>0)*iabc[1]+(ustr[2]>0)*iabc[2];</highlight></codeline> |
---|
784 | <codeline lineno="333"><highlight class="normal"></highlight></codeline> |
---|
785 | <codeline lineno="334"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>posun<sp/>pily<sp/>...<sp/>inkrement<sp/>citacu</highlight><highlight class="normal"></highlight></codeline> |
---|
786 | <codeline lineno="335"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>if<sp/>((citac==citac_PR)||(citac==-citac_PR))<sp/>smer*=-1;</highlight><highlight class="normal"></highlight></codeline> |
---|
787 | <codeline lineno="336"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/>if<sp/>((citac2==citac_PR)||(citac2==-citac_PR))<sp/>smer2*=-1;</highlight><highlight class="normal"></highlight></codeline> |
---|
788 | <codeline lineno="337"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac==citac_PR)||(citac==0))<sp/>smer*=-1;</highlight></codeline> |
---|
789 | <codeline lineno="338"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((citac2==citac_PR)||(citac2==0))<sp/>smer2*=-1;</highlight></codeline> |
---|
790 | <codeline lineno="339"><highlight class="normal"><sp/><sp/>citac+=smer;</highlight></codeline> |
---|
791 | <codeline lineno="340"><highlight class="normal"><sp/><sp/>citac2+=smer2;</highlight></codeline> |
---|
792 | <codeline lineno="341"><highlight class="normal">}</highlight></codeline> |
---|
793 | </programlisting> |
---|
794 | <location file="/home/smidl/work/git/mixpp/pmsm/simulator_zdenek/ekf_example/pwm.cpp"/> |
---|
795 | </compounddef> |
---|
796 | </doxygen> |
---|