|
|
新人Show
| 论坛注册会员名: |
xueshoudaoke |
| 研究方向/专业工种: |
自动控制 |
| 课题项目/专业特长: |
控制、检测、测试 |
| 兴趣爱好: |
篮球 |
| 居住地: |
郑州 |
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
最近在做电流预测控制算法,在本论坛找到了这个模型,想研究一下,有些问题需要大家给予解释一下,在此谢谢大家了!!!!!我把预测控制器的代码给贴在下面,谁能给我解释一下?
# x# H6 J8 q' Q/ d; y# F; E+ \" y%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%6 ~0 P9 j" W: K4 t
% This function contains the algorithm for the predictive current control ! W/ h7 ^ q# ]8 X; `
% of a two-level voltage source inverter.
9 n% x: z' @$ L4 E8 d1 v; w% Inputs:
/ c: R2 E- k2 s: k% I_ref := Two-element vector containing the reference current in
0 ~! W- p" F9 v) ]% x! r6 T% alpha-beta coordinates.5 U; h) w1 B: D q% m
% I_meas := Two-element vector containing the measured current in
e$ ~( D$ ]( ?1 b% alpha-beta coordinates.
4 G& r1 `! L' ]4 u5 b% Parameters (defined in the file parameters.m):0 x9 o1 s, A% _: K1 W t- R" U
% R := Load resistance7 w4 E' g4 h# x) i
% L := Load inductance
8 v. h p/ ^. Q/ A5 H3 u% s7 r% Ts := Sampling time
% y5 U$ d- k# j9 A5 p% v := Eight-element vector containing the voltage vectors that can0 L, ~1 s+ B" _- A4 W0 @
% be generated by the inverter, in alpha-beta coordinates.
" i. S" J+ ^& k5 N% states := Eight-by-three array containing the switching states for / {8 l# u* k3 P$ x% Q. u
% each voltage vector.
/ }. l5 {$ U+ K* j% Outputs:6 |! Z: E) m$ {- C+ B5 K/ W) c) @
% [Sa, Sb, Sc] := switching state corresponding to the optimum vector to
* Z- w! B* T9 x4 C9 b% be applied in the next sampling period.
' o9 z ?5 E* d; y0 b%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%8 A* z: A+ o2 {' y0 ~
8 _, V9 x6 O [5 Z/ }6 Wfunction [Sa,Sb,Sc] = control(I_ref,I_meas,R,L,Ts,v,states)! t* W5 D( M0 d# j# @8 }2 w
% Optimum vector and measured current at instant k-1
Y& |" ]( k5 {1 S/ u- Hpersistent x_old i_old 2 Q+ `& a( h2 A. ?/ P4 | U
% Initialize values C: m+ E- s9 ]* o) E( G
if isempty(x_old), x_old = 1; end$ O: e) `9 N' x9 Q+ X0 O9 g" `
if isempty(i_old), i_old = 0+1j*0; end. j/ U0 U9 M6 P: Z% _6 E8 q
g = zeros(1,8);: @. H, L+ g }. S5 X2 n6 g
% Read current reference inputs at sampling instant k5 M; e- u9 o( Y8 P: h0 O
ik_ref = I_ref(1) + 1j*I_ref(2);
$ L' ^9 h* J. C( W" i. s% Read current measurements at sampling instant k, t1 Z1 |% l6 o+ n6 J" J* w3 V1 h
ik = I_meas(1) + 1j*I_meas(2);
5 ?0 R" s9 g$ m/ X' I& d' j5 |) _% Back-EMF estimate
9 C# ?5 B/ s' w0 e. ?9 E h8 ge = v(x_old) - L/Ts*ik - (R - L/Ts)*i_old;
; D; Q1 T% J" N7 M8 K* X9 O% Store the measured current for the next iteration
3 c- z8 B' O/ ~ A: \i_old = ik;/ v/ I* ~" A' m8 z; Y) F3 [
for i = 1:81 H5 f" Y* D" ]. h1 J9 D& s- E# X2 d
% i-th voltage vector for current prediction
6 t9 U+ X- V" t( p* ~& i v_o1 = v(i);& T: z: p- f9 ^* Z7 i
% Current prediction at instant k+1
- g8 E7 R" @6 z- A) e0 V/ P) L! C ik1 = (1 - R*Ts/L)*ik + Ts/L*(v_o1 - e);9 R2 [7 T W$ [+ l9 B
% Cost function. d0 a# V2 x. {/ V
g(i) = abs(real(ik_ref - ik1)) + abs(imag(ik_ref - ik1));
6 B, D y1 S. e, P2 Wend. {& K, k v8 m$ H
% Optimization
% @1 J$ Q7 S4 j3 C6 {[~,x_opt] = min(g);
1 V/ G, N. T8 Q/ Z7 z. S! _ |% Store the present value of x_opt
5 h0 ?5 }) d7 V+ {/ Sx_old = x_opt;! ]) k7 \$ K9 Z2 @3 w L% R
% Output switching states
8 L r9 L* d/ C8 q6 a0 FSa = states(x_opt,1);" s4 b7 E7 h, l! J' H
Sb = states(x_opt,2);
( t ?, i6 m0 l( h& u$ hSc = states(x_opt,3); |
|