Modeling of PMSM motor in Simulink embedded MATLAB Function
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have implemented math model of PMSM motor using simulink blocks (Pic1) and equations (Pic2) of PMSM motor
Pic1
Pic2
I want to implement the same model using embedded MATLAB function block (Pic3)
Pic3
where id_m, iq_m are measured outputs PMSM model currents,
uqIN, udIN are measured outputs PI controller voltage,
omega_m is measured outputs PMSM model angular speed.
I don't know how to implement integrator in code.
My suggestion of code is below
function [idOut, iqOut] = EKF(idm, iqm, udm, uqm, omegam)
%dane silnika
Rs = 0.12;
Ld = 0.9e-3;
Lq = 1.05e-3;
Jm = 0.19;
Yf = 0.075;
p = 9;
Tl = 0;
persistent xhat;
if isempty (xhat)
xhat = [0.1; 0.1; 10];
end
xhat(1) = (p * xhat(3) * xhat(1) * Lq + udm - Rs*xhat(2)) * 1/Ld; %id
xhat(2) = (-p * xhat(3) * xhat(2) * Ld - Yf*p*xhat(3)+uqm-Rs*xhat(1))*1/Lq; %iq
xhat(3) = (3*p)/(2*Jm) * (Yf*xhat(2) + (Ld-Lq)*xhat(1)*xhat(2)) - Tl/Jm; %omega
xhat (1) = xhat(1) + idm;
xhat (2) = xhat(2) + iqm;
xhat (3) = xhat(3) + omegam;
idOut = xhat(1)
iqOut = xhat(2)
0 件のコメント
回答 (1 件)
Andrey Er
2019 年 11 月 19 日
Good day.
for integration use SUM with time coefficient T
like Xk+1=Xk+T*Var;
T must be constant or eual time step in model.
0 件のコメント
コミュニティ
その他の回答 パワー エレクトロニクス コミュニティ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!