Effacer les filtres
Effacer les filtres

Modeling of PMSM motor in Simulink embedded MATLAB Function

2 vues (au cours des 30 derniers jours)
Kuba Wozniak
Kuba Wozniak le 27 Mar 2018
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)

Réponses (1)

Andrey Er
Andrey Er le 19 Nov 2019
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.

Communautés

Plus de réponses dans  Power Electronics Control

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by