root/applications/dual/SIDP/SIDPS/motor_sidps/simple_control.asv @ 1323

Revision 1249, 0.6 kB (checked in by zimamiro, 14 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()*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
23n=best_control'*best_control;
24if n>100
25    best_control=best_control*sqrt(100/n);
26end
27end
Note: See TracBrowser for help on using the browser.