root/applications/pmsm/Barcelona/pwm.m @ 1083

Revision 706, 2.0 kB (checked in by smidl, 15 years ago)

eol-native

  • Property svn:eol-style set to native
Line 
1function pwm(compute)
2if nargin<1,
3    compute=1;
4end
5
6if compute
7    M=pmsm_estim_mex('pwm_mx.cfg');
8    save pwm M
9else
10    load pwm
11end
12
13time =0.000125*[0:size(M.xia,1)-1];
14
15%%%%%%%%%%%%%% U
16figure(1);
17detail=14000:20000;
18% ua
19subplot(2,2,1);
20plot(time(detail),M.oua(detail)-M.tua(detail));
21title('Difference between simulated and non-compensated observed u_{s,\alpha} (detail)')
22
23subplot(2,2,2);
24hist(M.oua-M.tua,30);
25title('Histogram of difference on the full data record of 8s')
26
27%ub
28subplot(2,2,3);
29plot(time(detail),M.modelua(detail)-M.tua(detail));
30title('Difference between simulated and compensated observed u_{s,\alpha} (detail)')
31
32subplot(2,2,4);
33hist(M.modelua-M.tua,30);
34title('Histogram of difference on the full data record of 8s')
35
36dt=0.000125;
37Ls=0.003465;
38
39bnds = [max(abs(M.modelua-M.tua)), max(abs(M.modelub-M.tub)) 0 0];
40Qpwm = (dt/Ls)^2*[1 1 0 0]%(2*bnds).^2/12
41
42figure(3);
43plot(M.xom);
44
45%%%%%%%%%%%%%%% Integration
46
47figure(2)
48subplot(4,2,1); plot(time,M.erria);xlabel('time [s]');
49title('Integration error on state variables')
50ylabel('Error on i_{s,\alpha}')
51subplot(4,2,2); hist(M.erria,30);
52title('Histogram of errors on state variables')
53
54subplot(4,2,3); plot(time,M.errib);xlabel('time [s]');
55ylabel('Error on i_{s,\beta}')
56subplot(4,2,4); hist(M.errib,30);
57%title('Histogram of error on i_{s,\beta}')
58
59subplot(4,2,5); plot(time,M.errom);xlabel('time [s]');
60ylabel('Error on \omega_{me}')
61subplot(4,2,6); hist(M.errom,30);
62%title('Histogram of error on \omega_{me}')
63
64subplot(4,2,7); plot(time,M.errth); xlabel('time [s]');
65ylabel('Error on \vartheta_{me}')
66subplot(4,2,8); hist(M.errth,30);
67%title('Histogram of error on \vartheta_{me}')
68
69Qint=[var(M.erria), var(M.errib), var(M.errom), var(M.errth)]
70
71bnds=[max(abs(M.erria)), max(abs(M.errib)), max(abs(M.errom)), max(abs(M.errth))]
72Qint = [(2*bnds).^2/12]
73
74%%%%%%%%%%%%%%%% Mz prop
75Fmag= 0.1989;
76p = 4.0;
77J = 0.04;   
78
79Tl=10;
80dom = p/J*Tl*dt
81Qrat=(2*[Fmag/Ls*dt,Fmag/Ls*dt, 1, dt]).^2/12
82
83Qtot=Qpwm+Qint
84Qtot+Qrat
85
86%%%%%%%%%%%%%%%% R
87R=(2*0.085)^2/12*[1 1]
Note: See TracBrowser for help on using the browser.