Matlab 仿真实现TI Instaspin 的Foc 逆Clarke变换和SVPWM

一直没搞明白TI 的Instaspin的SVPWM实现原理,最后只能在Matlab里仿真看看输出波形是不是和普通的SVPWM实现输出的波形一样,用M文件实现,下面是代码:

clear all;

theta = 0:1:360;
vd = 0.0;
vq = 1.15;
Valpha =  zeros(size(theta)); 
Vbeta =  zeros(size(theta));
Vx = zeros(size(theta));
Vy = zeros(size(theta));
Vz = zeros(size(theta));

N = length(theta);

for i=1:N
    Valpha(i) = vd*cos(i/180*pi)-vq*sin(i/180*pi);
    Vbeta(i) = vq*cos(i/180*pi)+vd*sin(i/180*pi);
    va = Valpha(i);
    vb = -0.5*Valpha(i) +sqrt(3)/2*Vbeta(i);
    vc = -0.5*Valpha(i) -sqrt(3)/2*Vbeta(i);
    vmax = 0;
    vmin = 0;
    if (va > vb)
        vmax = va;
        vmin = vb;
    else
        vmax = vb;
        vmin = va;
    end
    
    if(vc > vmax)
        vmax = vc;
    elseif (vc < vmin)
        vmin = vc;
    end
    
    vcom = (vmax+vmin)/2;
    Vx(i) = vcom - va;
    Vy(i) = vcom - vb;
    Vz(i) = vcom - vc;
        
end

plot(theta, Valpha);
hold on
plot(theta, Vbeta);
hold on

plot(theta, Vx,'Color','red');
hold on
plot(theta, Vy,'Color','yellow');

hold on
plot(theta, Vz,'Color','green');

仿真的波形:

posted @ 2015-09-08 13:53  吾乐  阅读(5531)  评论(0编辑  收藏  举报