# QZSI SVPWM ZSVM6 method help

7 views (last 30 days)
tcagdas on 10 May 2023
Answered: Joel Van Sickel on 23 May 2023
Hello, there are a few points in the simulation file in the link below that I don't understand. I hope you can help. I'm particularly stuck on the SVM block. I have no problem producing normal svpwm, but I can't create the switching table for sectors with the values in this block. The articles mentioned also do not provide a table. I would appreciate it if you could help me with the switching table for ZSVM6.
https://www.mathworks.com/matlabcentral/fileexchange/98889-svpwm-quasi-z-source-three-phase-inverter?s_tid=prof_contriblnk
Joel Van Sickel on 22 May 2023
Cagdas Tunceroglu on 22 May 2023
Hello, can you explain to me exactly what operations the sw_array and time perform in this code? Also, why does sw_array have 13 columns? And can you give me some examples of the mathematical operations represented by sw_array(:,:,2) = [0 1 0 1 1 1 1 1 1 1 0 1 0]? I've been struggling with understanding the code for the past three weeks, but I couldn't grasp it. Thanks in advance.
Best regards.
function [t1,t2,t0,int1,int2,int3,int4,int5,...
int6,int7,int8,int9,int10,int11,int12] ...
= fcn(M,angle,Sector,D,Ts)
a = M;
n = Sector;
t1 = a*Ts*sin(n*pi/3 - angle);
t2 = a*Ts*sin(angle - ((n-1)*pi/3));
t0 = Ts - t1 - t2;
tsh = D*Ts;
switch Sector
case 1
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t1/2;
int4 = int3 + tsh/6;
int5 = int4 + t2/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t2/2;
int10 = int9 + tsh/6;
int11 = int10 + t1/2;
int12 = int11 + tsh/6;
case 2
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t2/2;
int4 = int3 + tsh/6;
int5 = int4 + t1/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t1/2;
int10 = int9 + tsh/6;
int11 = int10 + t2/2;
int12 = int11 + tsh/6;
case 3
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t1/2;
int4 = int3 + tsh/6;
int5 = int4 + t2/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t2/2;
int10 = int9 + tsh/6;
int11 = int10 + t1/2;
int12 = int11 + tsh/6;
case 4
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t2/2;
int4 = int3 + tsh/6;
int5 = int4 + t1/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t1/2;
int10 = int9 + tsh/6;
int11 = int10 + t2/2;
int12 = int11 + tsh/6;
case 5
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t1/2;
int4 = int3 + tsh/6;
int5 = int4 + t2/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t2/2;
int10 = int9 + tsh/6;
int11 = int10 + t1/2;
int12 = int11 + tsh/6;
otherwise
int1 = t0/4 - tsh/4;
int2 = int1 + tsh/6;
int3 = int2 + t2/2;
int4 = int3 + tsh/6;
int5 = int4 + t1/2;
int6 = int5 + tsh/6;
int7 = int6 + t0/2 - tsh/2;
int8 = int7 + tsh/6;
int9 = int8 + t1/2;
int10 = int9 + tsh/6;
int11 = int10 + t2/2;
int12 = int11 + tsh/6;
end
function [Time_int,S1,S2,S3,S4,S5,S6] = ...
fcn(int1,int2,int3,int4,int5,int6,int7,int8,int9,int10,int11,...
int12,ref,Sector)
Time_int = 1+(ref>=int1) + (ref>=int2) + (ref>=int3) + (ref>=int4) ...
+ (ref >= int5) + (ref >= int6) + (ref >= int7) + (ref >= int8) ...
+ (ref >= int9) + (ref >= int10) + (ref >= int11) + (ref >= int12);
%% format of the array sw_array(x,y,z)
sw_array = zeros(6,13,6); %initialize the switching table
% x=[LegA LegB LegC] % y=[Timeint1 timeint2 ..] % z=[sector1 sector2 ..]
sw_array(:,:,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1 1 0 1 1 1 1 1 1; ...
0 1 0 1 1 1 1 1 1 1 0 1 0; ...
1 1 1 1 0 1 0 1 0 1 1 1 1];
S1 = sw_array(1,Time_int,Sector);
S2 = sw_array(2,Time_int,Sector);
S3 = sw_array(3,Time_int,Sector);
S4 = sw_array(4,Time_int,Sector);
S5 = sw_array(5,Time_int,Sector);
S6 = sw_array(6,Time_int,Sector);

Joel Van Sickel on 23 May 2023
I can't tell you exactly what is going on any more than the code can. This shared file is made by an individual user and you can try contacting them if you want, but what their software is doing is right there in the code. The way they chose to implement this algorithm is only one way of many, and one that probably made more sense to them, but might not make sense to you. Specifically, they are breaking the PWM sequence into 13 time slots, the intervals boundaries are defined by int1 through 12. With 12 time points, there are 13 time zones between those points, so that is why there are 13 columns. You can see how these times are derived/modified in the code. the values in those arrays (sw_array) are the exact switch values to implement the pwm algorithm. This is different than just using a comparator. The code looks at what switch needs to be controlled (1st index), looks at the time interval they are in (1-13) for index 2, and then looks at wich of the 6 svpwm sectors they are in. Based on that, they look at the table and pick the correct value of on or off for the specific switch.