|
|
新人Show
| 论坛注册会员名: |
xueshoudaoke |
| 研究方向/专业工种: |
自动控制 |
| 课题项目/专业特长: |
控制、检测、测试 |
| 兴趣爱好: |
篮球 |
| 居住地: |
郑州 |
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
最近在做电流预测控制算法,在本论坛找到了这个模型,想研究一下,有些问题需要大家给予解释一下,在此谢谢大家了!!!!!我把预测控制器的代码给贴在下面,谁能给我解释一下?
+ }2 z" j3 c$ j T# f%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 N; Z% S W2 A7 k# f3 K% This function contains the algorithm for the predictive current control ; R+ Y* V: T/ a# G0 Z4 V
% of a two-level voltage source inverter.4 i9 N3 O( @# q/ P
% Inputs:
4 u2 H8 c d4 O8 z4 F% I_ref := Two-element vector containing the reference current in / l7 l" `; ?# E% ?+ m5 d' E- T
% alpha-beta coordinates.9 }1 ?' u& T' A9 i
% I_meas := Two-element vector containing the measured current in . O/ H- |8 b) W- C) e
% alpha-beta coordinates.
( N1 x) I! f' B* X% {) z% Parameters (defined in the file parameters.m):
7 i7 {( p6 _+ h$ I; |8 s6 n# c! Z% R := Load resistance9 G! o6 O4 B6 W8 d* ?
% L := Load inductance
, u: S9 H# I4 a% Ts := Sampling time
5 S+ L! M1 X2 U# t% v := Eight-element vector containing the voltage vectors that can, W, a9 ?. ^) k4 q2 M4 R
% be generated by the inverter, in alpha-beta coordinates.
5 P* E0 g6 ~$ b) v% states := Eight-by-three array containing the switching states for 9 o* q5 i5 w" U$ W) p: O. H# P
% each voltage vector.1 h/ S. w7 w( r( X. j- @; p$ E
% Outputs:
1 F3 o3 V! ^1 p% ^4 u6 _% [Sa, Sb, Sc] := switching state corresponding to the optimum vector to 8 W0 ~/ X& R" P2 |: f8 E$ q
% be applied in the next sampling period.
( [0 G2 b! K( D b9 j# d%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
) I) j) B+ e3 Z7 m* T0 m* H9 q) l1 o+ v8 q" V
function [Sa,Sb,Sc] = control(I_ref,I_meas,R,L,Ts,v,states)
0 B! C! m- L! p( J5 A% Optimum vector and measured current at instant k-1
) y9 ^- i d, m' Jpersistent x_old i_old ) {! e9 E0 \% N% Z6 g3 g& K& V
% Initialize values
7 V8 U; @% B0 d- J. {1 x4 |/ A8 W& uif isempty(x_old), x_old = 1; end
: o! w% r0 Z% H: w1 Hif isempty(i_old), i_old = 0+1j*0; end/ o0 M, w/ `: ?0 U1 Q t
g = zeros(1,8);
$ R2 O, [5 ?5 a% Read current reference inputs at sampling instant k
5 Q, G$ D' @. T$ _% ]4 Jik_ref = I_ref(1) + 1j*I_ref(2);
5 b0 n& U# ^0 F& I* u% Read current measurements at sampling instant k
! @" ?8 Y0 R' ]7 iik = I_meas(1) + 1j*I_meas(2);: i. l0 Q' q3 n' {6 S) W U
% Back-EMF estimate
% l- q. a' k G% U' x$ K O$ W De = v(x_old) - L/Ts*ik - (R - L/Ts)*i_old;; N" \0 }, n9 k: J/ p9 M/ A4 @8 E
% Store the measured current for the next iteration- J- E- W. t: O& d, I' h9 }
i_old = ik;5 w* f1 v' c* x6 G3 _ d" m
for i = 1:8% m9 C/ r4 b# Z9 j
% i-th voltage vector for current prediction
0 Y2 l$ j5 T* e6 ~4 J0 h v_o1 = v(i);1 ?5 q/ V, R* D7 y$ e
% Current prediction at instant k+1
: l, i6 W2 B) ]! a, V ik1 = (1 - R*Ts/L)*ik + Ts/L*(v_o1 - e);9 I/ F+ p7 [0 V5 u
% Cost function, W2 k8 @% Q, i+ V; r- s8 g
g(i) = abs(real(ik_ref - ik1)) + abs(imag(ik_ref - ik1));
: e! s- y! r. z0 X0 Eend
M, B8 r* A! E% Optimization4 \3 L% j) p* `$ v% Z0 m8 q
[~,x_opt] = min(g);
& X. E: g% T4 S) e% Store the present value of x_opt
$ m k% B' l3 I( sx_old = x_opt;
+ |8 h" z2 Z/ R \) }% Output switching states4 B6 E3 @, W" A! y! i3 J
Sa = states(x_opt,1);
, T% C1 v' _$ ]Sb = states(x_opt,2);
8 P1 H+ I) u# m: p8 n: SSc = states(x_opt,3); |
|