root/applications/dual/SIDP/bakalarka/SIDPS/matlab/motor/simple_control.m @ 1351

Revision 1351, 0.7 kB (checked in by zimamiro, 13 years ago)
Line 
1function [best_control system]=simple_control(system,x_hat)
2omegar=system.x_opt(3);
3
4i_d=x_hat(1)*cos(x_hat(4))+x_hat(2)*sin(x_hat(4));
5i_q=x_hat(2)*cos(x_hat(4))-x_hat(1)*sin(x_hat(4));
6
7[i_q_bar system]=PI_controler(omegar-x_hat(3),system,1);
8[u_d system]=PI_controler(-i_d,system,2);
9[u_q system]=PI_controler(i_q_bar-i_q,system,3);
10
11u_d=u_d-0.003465*x_hat(3)*i_q_bar;
12u_q=u_q+0.1989*x_hat(3);
13
14U=sqrt(u_d^2+u_q^2);
15fi=atan(u_q/u_d)+x_hat(4);
16if u_d<0
17    fi=fi+pi;
18end
19
20best_control(1,1) = U*cos(fi);
21best_control(2,1) = U*sin(fi);
22
23%best_control(1,1) = 1;
24%best_control(2,1) = 1;
25
26n=best_control'*best_control;
27if n>100
28    best_control=best_control*sqrt(100/n);
29end
30end
Note: See TracBrowser for help on using the browser.