Modeling of PMSM motor in Simulink embedded MATLAB Function

조회 수: 2 (최근 30일)
Kuba Wozniak
Kuba Wozniak 2018년 3월 27일
답변: Andrey Er 2019년 11월 19일
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)

답변 (1개)

Andrey Er
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.

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 Permanent Magnet에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by