PWM inverter matlab code/simulink

Thread Starter

h.immo

Joined Apr 17, 2012
10
hi everyone,
I need the matlab code or simulink for a 3-phase PWM inverter i found exactly what I need here
(www2.ece.ohio-state.edu/ems/PowerConverter/Sine_PWM_Inverter.pdf ) but it doesnt work correctly i get some error in the code and the simulink is also not working correct ( or at least i dont know how it works). It would be very nice if someone could help me with it.
thank you very much!
Regards
 

Thread Starter

h.immo

Joined Apr 17, 2012
10
Well if i implement the code i get the error that (Vi ) is undifiend
Have u tried the code? Is it working with u?
Sorry for bothering you
Thanks again
 

Thread Starter

h.immo

Joined Apr 17, 2012
10
Rich (BB code):
This is the code : if its working with u guys tell me plz :) % Input data Vdc= 400; % DC-link voltage Lf= 800e-6;% Inductance for output filter Cf= 400e-6; % Capacitance for output filter Lload = 2e-3; %Load inductance Rload= 5; % Load resistance f= 60; % Fundamental frequency fz = 3e3; % Switching frequency m= 0.8; % Modulation index % Coefficients for State-Space Model A=[zeros(3,3) eye(3)/(3*Cf) -eye(3)/(3*Cf) -eye(3)/Lf zeros(3,3) zeros(3,3) eye(3,3)/Lload zeros(3,3) -eye(3)*Rload/Lload]; % system matrix B=[zeros(3,3) eye(3)/Lf zeros(3,3)]; % coefficient for the control variable u C=[eye(9)]; % coefficient for the output y D=[zeros(9,3)]; % coefficient for the output y Ks = 1/3*[-1 0 1; 1 -1 0; 0 1 -1]; % Conversion matrix to transform [iiAB iiBC iiCA] to [iiA iiB iiC]​
A.2 Matlab Code for Plotting the Simulation Results​
% Written by Jin Woo Jung % Date: 02/20/05 % ECE743, Simulation Project #1 (Sine-PWM) % Matlab program for plotting Simulation Results % using Simulink ViAB = Vi(:,1); ViBC = Vi(:,2); ViCA = Vi(:,3); VLAB= VL(:,1); VLBC= VL(:,2); VLCA= VL(:,3); iiA= IiABC(:,1); iiB= IiABC(:,2); iiC= IiABC(:,3); iLA= ILABC(:,1); iLB= ILABC(:,2); iLC= ILABC(:,3); figure(1) subplot(3,1,1) plot(t,ViAB) axis([0.9 1 -500 500]) ylabel('V_i_A_B [V]') title('Inverter output line to line voltages (V_i_A_B, V_i_B_C, V_i_C_A)') grid subplot(3,1,2) plot(t,ViBC) axis([0.9 1 -500 500]) ylabel('V_i_B_C [V]') grid subplot(3,1,3) plot(t,ViCA) axis([0.9 1 -500 500]) ylabel('V_i_C_A [V]') xlabel('Time [Sec]') grid figure(2) subplot(3,1,1) plot(t,iiA) axis([0.9 1 -100 100]) ylabel('i_i_A [A]') title('Inverter output currents (i_i_A, i_i_B, i_i_C)') grid subplot(3,1,2) plot(t,iiB) axis([0.9 1 -100 100]) ylabel('i_i_B [A]') grid subplot(3,1,3) plot(t,iiC) axis([0.9 1 -100 100]) ylabel('i_i_C [A]') xlabel('Time [Sec]') grid figure(3) subplot(3,1,1) plot(t,VLAB) axis([0.9 1 -400 400]) ylabel('V_L_A_B [V]') title('Load line to line voltages (V_L_A_B, V_L_B_C, V_L_C_A)') grid subplot(3,1,2) plot(t,VLBC) axis([0.9 1 -400 400]) ylabel('V_L_B_C [V]') grid subplot(3,1,3) plot(t,VLCA) axis([0.9 1 -400 400]) ylabel('V_L_C_A [V]') xlabel('Time [Sec]') grid figure(4) subplot(3,1,1) plot(t,iLA) axis([0.9 1 -50 50]) ylabel('i_L_A [A]') title('Load phase currents (i_L_A, i_L_B, i_L_C)') grid subplot(3,1,2) plot(t,iLB) axis([0.9 1 -50 50]) ylabel('i_L_B [A]') grid subplot(3,1,3) plot(t,iLC) axis([0.9 1 -50 50]) ylabel('i_L_C [A]') xlabel('Time [Sec]') grid figure(5) subplot(4,1,1) plot(t,ViAB) axis([0.9 1 -500 500]) ylabel('V_i_A_B [V]') grid subplot(4,1,2) plot(t,iiA,'-', t,iiB,'-.',t,iiC,':') axis([0.9 1 -100 100]) ylabel('i_i_A, i_i_B, i_i_C [A]') legend('i_i_A', 'i_i_B', 'i_i_C') grid subplot(4,1,3) plot(t,VLAB,'-', t,VLBC,'-.',t,VLCA,':') axis([0.9 1 -400 400]) ylabel('V_L_A_B, V_L_B_C, V_L_C_A [V]') legend('V_L_A_B', 'V_L_B_C', 'V_L_C_A') grid subplot(4,1,4) plot(t,iLA,'-', t,iLB,'-.',t,iLC,':') axis([0.9 1 -50 50]) ylabel('i_L_A, i_L_B, i_L_C [A]') legend('i_L_A', 'i_L_B', 'i_L_C') xlabel('Time [Sec]') grid %For only Sine PWM figure(6) subplot(4,1,1) plot(t,Vtri,'-', t,Vsin,'-.') axis([0.9 0.917 -1.5 1.5]) ylabel('V_t_r_i, V_s_i_n [V]') legend('V_t_r_i', 'V_s_i_n') title('V_t_r_i and V_s_i_n') grid subplot(4,1,2) plot(t,ViAn) axis([0.9 0.917 -500 500]) ylabel('V_i_A_n [V]') grid subplot(4,1,3) plot(t,Vtri,'-', t,Vsin,'-.') axis([0.9 0.909 -1.5 1.5]) ylabel('V_t_r_i, V_s_i_n [V]') legend('V_t_r_i', 'V_s_i_n') grid subplot(4,1,4) plot(t,ViAn) axis([0.9 0.909 -500 500]) ylabel('V_i_A_n [V]') xlabel('Time [Sec]')​
grid
 
Last edited by a moderator:
Top