|
|
新人Show
| 论坛注册会员名: |
xueshoudaoke |
| 研究方向/专业工种: |
自动控制 |
| 课题项目/专业特长: |
控制、检测、测试 |
| 兴趣爱好: |
篮球 |
| 居住地: |
郑州 |
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
最近在做电流预测控制算法,在本论坛找到了这个模型,想研究一下,有些问题需要大家给予解释一下,在此谢谢大家了!!!!!我把预测控制器的代码给贴在下面,谁能给我解释一下?5 j0 C( B) t' z1 W0 b; W& L; }5 J3 t
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% `1 |, a, Z, E. g3 F( ?' e
% This function contains the algorithm for the predictive current control
" Y Z2 k4 ^' @& a6 ^% X. i% of a two-level voltage source inverter.
1 s, @( `* f+ v6 j4 y% }( [% Inputs: R& e" A( P- c5 i
% I_ref := Two-element vector containing the reference current in ( t# X% M7 ]& R4 c$ @" w
% alpha-beta coordinates.! e9 B9 S% F O* p9 h
% I_meas := Two-element vector containing the measured current in % `, I+ N9 R- j
% alpha-beta coordinates.; H$ |) h& n3 w7 r& i, M
% Parameters (defined in the file parameters.m):
' \/ b1 Q! H1 }0 M& a2 w% R := Load resistance! k' N$ m2 q9 t2 U) \
% L := Load inductance' r/ b% a7 \7 Q. \, z8 `& `* f
% Ts := Sampling time
6 u1 u0 A5 h- F2 j2 Y% v := Eight-element vector containing the voltage vectors that can
7 ?# M) O S5 O' | _% be generated by the inverter, in alpha-beta coordinates. 7 y9 e) }$ ^# J( y* V4 Q: `7 I2 t
% states := Eight-by-three array containing the switching states for ( e" U- b8 @/ H2 w, w
% each voltage vector.
" ^8 U' r- v+ C2 ?- [% Outputs:4 a9 G$ ]) d8 H
% [Sa, Sb, Sc] := switching state corresponding to the optimum vector to 1 b! B# n/ m0 r" H1 `; J
% be applied in the next sampling period.
0 Z' V% J. q6 i' j+ d5 T%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L( D- f. M& J* _) I8 U" t2 `4 ?
: l$ f; p2 y D0 z- k& k+ A% D4 k& lfunction [Sa,Sb,Sc] = control(I_ref,I_meas,R,L,Ts,v,states)
% R; h6 g2 m' Z9 ]3 v$ w, Y% Optimum vector and measured current at instant k-1
4 o6 P4 g {3 V }* F" i7 e- Tpersistent x_old i_old
: q# \' ~! L i( }! ^% Initialize values$ T$ k$ G( j) U B7 r( w& ]
if isempty(x_old), x_old = 1; end
3 G2 J' _0 K& y9 G. Tif isempty(i_old), i_old = 0+1j*0; end& D: W; k6 _8 {% C9 l- J
g = zeros(1,8);1 D! h( ~2 w+ W
% Read current reference inputs at sampling instant k
: `; ^3 U4 z, y' G$ uik_ref = I_ref(1) + 1j*I_ref(2);0 ]2 \: E& q, Y4 i
% Read current measurements at sampling instant k7 B7 h5 l2 Y8 x {9 \4 h" V
ik = I_meas(1) + 1j*I_meas(2); Q z5 O- ]6 S, Y' K6 P( {* R& O
% Back-EMF estimate9 m, T# u# j) V2 V3 M/ N# `* p' v, n
e = v(x_old) - L/Ts*ik - (R - L/Ts)*i_old;! f8 } k* Y S& L5 H* w* y2 D
% Store the measured current for the next iteration
7 P6 V+ U' l9 `5 p1 T* ni_old = ik;& q2 b- Z6 M7 X( u, f5 v
for i = 1:8. `8 Y& S3 y: h$ W
% i-th voltage vector for current prediction
. |& I L9 n6 \+ e3 S z4 z6 | v_o1 = v(i);1 h1 C, `' T$ }7 r5 F0 m# S3 E
% Current prediction at instant k+1 o' l7 e' n E9 z7 D
ik1 = (1 - R*Ts/L)*ik + Ts/L*(v_o1 - e);% I. B& F& r0 Y% `3 Z8 T
% Cost function
$ i7 q% c# {3 H# h* ] g(i) = abs(real(ik_ref - ik1)) + abs(imag(ik_ref - ik1));) z3 D: P8 f4 m& a3 y& Y
end3 K7 j! ~- w( H$ D0 S3 z7 @* c
% Optimization R$ g5 Y! i j+ z- ?8 \3 k7 }
[~,x_opt] = min(g);
# X( A5 e+ E" g, G; T# L- U% Store the present value of x_opt; v9 K9 x+ H3 {5 g! g4 z
x_old = x_opt;
% E% P/ k# \5 Y, f% Output switching states# x: Q& K$ g9 T) `! E
Sa = states(x_opt,1);4 l9 d7 q! e, c- @2 ^/ S i
Sb = states(x_opt,2);* ~; [* L3 [) O3 c! b/ E
Sc = states(x_opt,3); |
|