SVPWM for three phase inverter coding
Afficher commentaires plus anciens
function SaSbSc = SVMCalculation(angle,Mag,Seq,ts)
Vdc = 100;
max_phase = Vdc;
mag = (Mag/max_phase)*ts*1.15;
t1 = [0 0 0 0 0 0 0 0];
sa = 0;
sb = 0;
sc = 0;
%%%%SECTOR I
if (angle>=0) && (angle<pi/3)
%calculation time switching
ta = mag*sin((pi/3)-angle);
tb = mag*sin(angle);
t0 = (ts-ta-tb);
t1 = [t0/2 ta tb t0/2 t0/2 tb ta t0/2];
t1 = cumsum(t1);
%sec 8 1 2 7 7 2 1 8
v1 = [0 1 1 1 1 1 1 0];
v2 = [0 0 1 1 1 1 0 0];
v3 = [0 0 0 1 1 0 0 0];
%compare to repeating sequence for timing signals during switching period
for j = 1:8
if(seq <= t1(j))
break
end
end
%apply vectors accordingly as a result of timing
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
%%%%sector II
if(angle>=pi/3) && (angle<2*pi/3)
adv=angle - (pi/3);
ta = (mag*sin(pi/3-adv));
tb = (mag*sin(adv));
t0 = ((ts-ta-tb));
t1 = [t0/2 ta tb t0/2 t0/2 tb ta t0/2];
t1 = cumsum(t1);
v1 = [0 0 1 1 1 1 0 0];
v2 = [0 1 1 1 1 1 1 0];
v3 = [0 0 0 1 1 0 0 0];
for j=1:8
if(seq <= t1(j))
break
end
end
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
%%%%sector III
if(angle>=2*pi/3) && (angle<pi)
adv=angle - ((2*pi)/3);
ta = (mag*sin(pi/3-adv));
tb = (mag*sin(adv));
t0 = ((ts-ta-tb));
t1 = [t0/2 ta tb t0/2 t0/2 tb ta t0/2];
t1 = cumsum(t1);
v1 = [0 0 0 1 1 0 0 0];
v2 = [0 1 1 1 1 1 1 0];
v3 = [0 0 1 1 1 1 0 0];
for j=1:8
if(seq <= t1(j))
break
end
end
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
%%%%sector IV
if (angle>=-pi) && (angle<-2*pi/3)
adv = angle + pi;
tb = (mag*sin(pi/3-adv));
ta = (mag*sin(adv));
t0 = ((ts-ta-tb));
t1 = [t0/2 ta tb t0/2 t0/2 tb ta to/2];
t1 = cumsum(t1);
v1 = [0 0 0 1 1 0 0 0];
v2 = [0 0 1 1 1 1 0 0];
v3 = [0 1 1 1 1 1 1 0];
for j=1:8
if(seq <= t1(j))
break
end
end
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
%%%%sector V
if (angle>=-2*pi) && (angle<-pi/3)
adv = angle + (2*pi)/3;
tb = (mag*sin(pi/3-adv));
ta = (mag*sin(adv));
t0 = ((ts-ta-tb));
t1 = [t0/2 ta tb t0/2 t0/2 tb ta to/2];
t1 = cumsum(t1);
v1 = [0 0 1 1 1 1 0 0];
v2 = [0 0 0 1 1 0 0 0];
v3 = [0 1 1 1 1 1 1 0];
for j=1:8
if(seq <= t1(j))
break
end
end
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
%%%%sector VI
if (angle>=-pi/3) && (angle<0)
adv = angle + pi/3;
tb = (mag*sin(pi/3-adv));
ta = (mag*sin(adv));
t0 = ((ts-ta-tb));
t1 = [t0/2 ta tb t0/2 t0/2 tb ta to/2];
t1 = cumsum(t1);
v1 = [0 1 1 1 1 1 1 0];
v2 = [0 0 0 1 1 0 0 0];
v3 = [0 0 1 1 1 1 0 0];
for j=1:8
if(seq <= t1(j))
break
end
end
sa = v1(j);
sb = v2(j);
sc = v3(j);
end
SaSbSc = [sa, sb, sc];
Why this error comes? Kindly fix it
Not enough input arguments.
Error in SVMCalculation (line 4)
mag = (Mag/max_phase)*ts*1.15;
Réponses (1)
Sabin
le 30 Jan 2023
0 votes
This function will compile if change either change Seq in the first line into seq or seq into Seq everywhere. I believe the error seen is due to incorrectly calling the function by not providing all input arguments. I cannot comment if the algorithm is correct as I was not checking it.
Catégories
En savoir plus sur Audio and Video Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!