0% found this document useful (0 votes)
86 views2 pages

MATLAB Simulation of Electrical Machine Dynamics

This document contains code that models the operation of a three-phase inverter. It defines system parameters, initializes arrays to store simulation results, and contains a for loop that uses numerical integration to simulate the system over time. Key variables like currents, voltages, speeds, and torques are calculated at each time step. Plots of current, speed, and torque vs. time are generated to visualize the simulation results.

Uploaded by

Vinay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views2 pages

MATLAB Simulation of Electrical Machine Dynamics

This document contains code that models the operation of a three-phase inverter. It defines system parameters, initializes arrays to store simulation results, and contains a for loop that uses numerical integration to simulate the system over time. Key variables like currents, voltages, speeds, and torques are calculated at each time step. Plots of current, speed, and torque vs. time are generated to visualize the simulation results.

Uploaded by

Vinay Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

clear

clc;
V=220;
rs=0.435;
Xls=0.754;
XM=26.13;
Xlr=0.754;
rr=0.816;
J=0.089;
TL=0;
Wb=2*pi*50;
P=4;
Lls=Xls/Wb;
Llr=Xlr/Wb;
M=XM/Wb;
Lss=Lls+M;
Lrr=Llr+M;
D=Lss*Lrr-M^2;
h=1e-5;
Tfinal=1;
n=round(Tfinal/h)+1;
psi_qs = zeros(1,n);
psi_ds = zeros(1,n);
psi_qr = zeros(1,n);
psi_dr = zeros(1,n);
Wrm = zeros(1,n);
Wrm = zeros(1,n);
i_qs = zeros(1,n);
i_ds = zeros(1,n);
i_qr = zeros(1,n);
i_dr = zeros(1,n);
Wr = zeros(1,n);
Tem = zeros(1,n);
i_as = zeros(1,n);
i_bs = zeros(1,n);
i_cs = zeros(1,n);
i_ar = zeros(1,n);
i_br = zeros(1,n);
i_cr = zeros(1,n);
v_qs = zeros(1,n);
v_ds = zeros(1,n);
v_qr = zeros(1,n);
v_dr = zeros(1,n);
TL = zeros(1,n);

B = [1 0 1;
-0.5 -sqrt(3)/2 1;
-0.5 sqrt(3)/2 1];

%numerical integration
time=0;
k(1)=0;
k(2)=0;
TL(1)=0;
TL(2)=0;
for i=3:n
time=time+h;
k(i)=k(i-1)+1;
TL(i)=0;

va=V*sqrt(2/3)*sin(Wb*time);
vb=V*sqrt(2/3)*sin(Wb*time-2*3.1415/3);
vc=V*sqrt(2/3)*sin(Wb*time+2*3.1415/3);
v_qs(i)=2/3*(va-((vb+vc)/2));
v_ds(i)=2/3*((-vb+vc)*sqrt(3)/2);

psi_ds(i) = psi_ds(i-1)+(h*(v_ds(i-1)-rs*i_ds(i-1)));
psi_qs(i) = psi_qs(i-1)+(h*(v_qs(i-1)-rs*i_qs(i-1)));
psi_dr(i) = psi_dr(i-1)+(h*(v_dr(i-1)-rr*i_dr(i-1)-Wr(i-
1)*psi_qr(i-1)));
psi_qr(i) = psi_qr(i-1)+(h*(v_qr(i-1)-rr*i_qr(i-1)+Wr(i-
1)*psi_dr(i-1)));
Wrm(i) = Wrm(i-1)+(h*((Tem(i-1)-TL(i-1))/J));
i_ds(i)=(Lrr*psi_ds(i)-(M*psi_dr(i)))/D;
i_qs(i)=(Lrr*psi_qs(i)-(M*psi_qr(i)))/D;
i_dr(i)=(Lss*psi_dr(i)-(M*psi_ds(i)))/D;
i_qr(i)=(Lss*psi_qr(i)-(M*psi_qs(i)))/D;
Tem(i)= (P/2)*(psi_qr(i)*i_dr(i)-psi_dr(i)*i_qr(i));
Wr(i) = (P/2)*Wrm(i);

i_as(i)=i_qs(i);
i_bs(i)=-i_qs(i)/2+(i_ds(i)*(-sqrt(3)/2));
i_cs(i)=-i_qs(i)/2+(i_ds(i)*(sqrt(3)/2));

end
t=0:h:Tfinal;
plot(t,i_as)
figure();
plot(t,Wr)
figure();
plot(t,Tem)

You might also like