Revision 1249, 0.6 kB
(checked in by zimamiro, 14 years ago)
|
|
Rev | Line | |
---|
[1249] | 1 | function [best_control system]=simple_control(system,x_hat) |
---|
| 2 | omegar=system.x_opt(3); |
---|
| 3 | |
---|
| 4 | i_d=x_hat(1)*cos(x_hat(4))+x_hat(2)*sin(x_hat(4)); |
---|
| 5 | i_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 | |
---|
| 11 | u_d=u_d-0.003465*x_hat(3)*i_q_bar; |
---|
| 12 | u_q=u_q+0.1989*x_hat(3); |
---|
| 13 | |
---|
| 14 | U=sqrt(u_d^2+u_q^2); |
---|
| 15 | fi=atan(u_q/u_d)+x_hat(4); |
---|
| 16 | if u_d<0 |
---|
| 17 | fi=fi+pi; |
---|
| 18 | end |
---|
| 19 | |
---|
| 20 | best_control(1,1) = U*cos(fi); |
---|
| 21 | best_control(2,1) = U*sin(fi); |
---|
| 22 | |
---|
| 23 | n=best_control'*best_control; |
---|
| 24 | if n>100 |
---|
| 25 | best_control=best_control*sqrt(100/n); |
---|
| 26 | end |
---|
| 27 | end |
---|