[ PMSM ] 基于d-q旋轉(zhuǎn)坐標(biāo)系的PMSM建模 離散化腳本實(shí)現(xiàn)

電壓方程:
function [id,iq] = fcn(ud,uq,Omgea_e)
persistent R
??if isempty(R)
????R = 2.875;
??end
persistent phif
??if isempty(phif)
????phif = 0.175;
??end
persistent Ld
??if isempty(Ld)
????Ld = 0.0085;
??end
persistent Lq
??if isempty(Lq)
????Lq = 0.0085;
??end
persistent id_1
?if isempty(id_1)
???id_1 = 0;
?end
persistent iq_1
?if isempty(iq_1)
???iq_1 = 0;
?end
OH_d_to_q = Omgea_e*(Ld*id_1+phif);
OH_q_to_d = Omgea_e*(Lq*iq_1);
id = id_1+0.0001*(ud-R*id_1+OH_q_to_d)/Ld;
iq = iq_1+0.0001*(uq-R*iq_1-OH_d_to_q)/Lq;
id_1 = id;
iq_1 = iq;
轉(zhuǎn)矩方程:
function Te = fcn(id,iq)
persistent Pn
??if isempty(Pn)
????Pn = 4;
??end
persistent Ld
??if isempty(Ld)
????Ld = 0.0085;
??end
persistent Lq
??if isempty(Lq)
????Lq = 0.0085;
??end
persistent phif
??if isempty(phif)
????phif = 0.175;
??end
Te = (3/2)*Pn*iq*(id*(Ld-Lq)+phif);
機(jī)械方程:
function Omgea_m = fun(TL,Te)
persistent Omgea_m_1
?if isempty(Omgea_m_1)
???Omgea_m_1 = 0;
?end
persistent J
??if isempty(J)
????J = 0.001;
??end
persistent B
??if isempty(B)
????B = 0.008;
??end
Omgea_m = Omgea_m_1+(0.0001/J)*(Te-TL-B*Omgea_m_1);
Omgea_m_1 = Omgea_m;