root/applications/dual/vahala/pcrb/pcrb_amptest.m @ 1465

Revision 1416, 3.6 kB (checked in by vahalam, 13 years ago)

pridani slozky pcrb s cramer-rao mezi

Line 
1%simulator PMSM for PCRB, choice: Ls/Ldq & control
2clear all;
3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6%   settings
7    % ON/OFF  MODEL       INDUCT. L
8model(1) = 1; % alpha-beta          Ls
9model(2) = 0; % alpha-beta          Ldq
10model(3) = 0; % reduced alpha-beta          Ls
11model(4) = 0;%zatim nefunguje % reduced alpha-beta          Ldq
12
13    % CONTROL
14    % 1 -   ome = ref_ome, the = integral(ome), ial = ibe = 0
15    % 2 -   PI control   
16    % 3 -   PI + injection (sin -> dq)
17    % 4 -   PI + injection (rect. -> dq)
18    % 5 -   PI + injection (const. -> ud) *J4 ~ 3e-6 for all exc. dq
19    % 6 -   PI + rnd error (ref_ome) *J4: dq bad; ab,5sc Ls ~ 4e-4; ab,5sc Ldq ~5e-6 
20    % 7 -   PI + injection (sin -> al-be)
21    % 8 -   PI + injection (rect. -> al-be)
22    % 9 -   PI + bicrit. (sign) *J4 ~ 1e-3 for all exc. dq
23    % 10 -  PI + rnd bicrit. selection (5)
24   
25% control = 2;
26control = 5;
27% control = 8; %high frekq.
28% control = 9;
29% control = 10;
30    % param. amp*phi(injom*dt*t) //phi = sin,cos,sign(sin),sing(cos)
31
32   
33% amp = 0.001 -- 10;
34injom = 5000;
35
36    %cov Q, R matrices
37%         %noise
38% Q = diag([0.0013 0.0013 5.0e-6 1.0e-10]);
39% R = diag([0.0006 0.0006]);
40%         %EKF
41Q = diag([0.1 0.1 0.1 0.001]);
42R = diag([0.05 0.05]);
43%         %test
44% Q = diag([0.1 0.1 0.1 10]);
45% R = diag([0.5 0.5]);
46
47%horizont
48T = 120000;
49
50%reference signal
51% ref_profile = [1, 10, 50, 200, 200, 30, 0, 0, -1, -10, -50, -200, -200, -30, 0];
52% ref_profile = [0, -1, 3, 6, 9, 6, 3, 0, 0, 0, 0, 0, 0,-3, -6, -3];
53ref_profile = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
54% ref_profile = ones(1,16);
55
56% [var_ome, var_th] = fpcrb2(model, control, amp, injom, Q, R, T, ref_profile, 100*eye(4));
57
58%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59%   plot
60
61p0 = 1;
62
63%axis
64xax = 1:T-1;
65dt = 0.000125;
66timex = (xax)*dt;
67cmp = hsv(10);
68
69[var_ome, var_th] = fpcrb2(model, control, 10, injom, Q, R, T, ref_profile, p0*eye(4));
70figure(1);
71hold on;
72plot(timex, var_th(xax,1),'Color',cmp(1,:));
73
74[var_ome, var_th] = fpcrb2(model, control, 1, injom, Q, R, T, ref_profile, p0*eye(4));
75figure(1);
76hold on;
77plot(timex, var_th(xax,1),'Color',cmp(2,:));
78
79[var_ome, var_th] = fpcrb2(model, control, 0.1, injom, Q, R, T, ref_profile, p0*eye(4));
80figure(1);
81hold on;
82plot(timex, var_th(xax,1),'Color',cmp(3,:));
83
84[var_ome, var_th] = fpcrb2(model, control, 0.02, injom, Q, R, T, ref_profile, p0*eye(4));
85figure(1);
86hold on;
87plot(timex, var_th(xax,1),'Color',cmp(4,:));
88
89[var_ome, var_th] = fpcrb2(model, control, 0.01, injom, Q, R, T, ref_profile, p0*eye(4));
90figure(1);
91hold on;
92plot(timex, var_th(xax,1),'Color',cmp(5,:));
93
94[var_ome, var_th] = fpcrb2(model, control, 0.005, injom, Q, R, T, ref_profile, p0*eye(4));
95figure(1);
96hold on;
97plot(timex, var_th(xax,1),'Color',cmp(6,:));
98
99[var_ome, var_th] = fpcrb2(model, control, 0.003, injom, Q, R, T, ref_profile, p0*eye(4));
100figure(1);
101hold on;
102plot(timex, var_th(xax,1),'Color',cmp(7,:));
103
104[var_ome, var_th] = fpcrb2(model, control, 0.002, injom, Q, R, T, ref_profile, p0*eye(4));
105figure(1);
106hold on;
107plot(timex, var_th(xax,1),'Color',cmp(8,:));
108
109[var_ome, var_th] = fpcrb2(model, control, 0.0015, injom, Q, R, T, ref_profile, p0*eye(4));
110figure(1);
111hold on;
112plot(timex, var_th(xax,1),'Color',cmp(9,:));
113
114[var_ome, var_th] = fpcrb2(model, control, 0.001, injom, Q, R, T, ref_profile, p0*eye(4));
115figure(1);
116hold on;
117plot(timex, var_th(xax,1),'Color',cmp(10,:));
118legend('10','1','0.1','0.02','0.01','0.005','0.003','0.002','0.0015','0.001','Location','NorthEastOutside');
119
120% sound(chirp(0:0.001:2,0,1,150));
Note: See TracBrowser for help on using the browser.