⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calindex.m

📁 永磁同步电机的仿真模型
💻 M
字号:
function [u]=calindex(Ud,Uq,Udc)
if(Udc<0.001)
    m=0;
else
    m=(Ud^2+Uq^2)^0.5/((2/3)^0.5*Udc);  %the modulation index
end
if(m<=0.86605)                    %the voltage vetor is inside the inscribed circle of the hexagon
    u=[Ud,Uq,m];
else
    %compute the cross angle
    if(abs(Ud)<eps)
        ang=pi/2;
    else
        ang=atan(abs(Uq/Ud));
    end
    if(ang>pi/3)
        ang=ang-pi/3;
    end
    %compute the voltage sector
    if(Ud>=0)
        if(Uq>=0)
            if(Uq<sqrt(3)*Ud)
                theta=0;
            else
                theta=pi/3;
            end
        else
            if(-Uq<=sqrt(3)*Ud)
                theta=5*pi/3;
                ang=pi/3-ang;
            else
                theta=4*pi/3;
                ang=pi/3-ang;
            end
        end
    else
        if(Uq>0)
            if(Uq<=-sqrt(3)*Ud)
                theta=2*pi/3;
                ang=pi/3-ang;
            else
                theta=pi/3;
                ang=pi/3-ang;
            end
        else
            if(-Uq<-sqrt(3)*Ud)
                theta=pi;
            else
                theta=4*pi/3;
            end
        end
    end
    %compute the amplitude of voltage
    amp=sqrt(Ud*Ud+Uq*Uq);
    R=sqrt(2/3)*Udc;
    %moderate the voltage
    if(m<=0.9094)
        l=sqrt(abs(1-2*pi/3/sqrt(3)*m*m))*R;
        h=R-0.5*l;
        alpha=atan(sqrt(3)/2*l/h);
        if(ang<alpha)
            Up=h/cos(alpha);
        else
            if(ang<=pi/3-alpha)
                Up=sqrt(3)/2*R/sin(ang+pi/3);
            else
                Up=h/cos(pi/3-alpha);
            end 
        end
        Ud_new=Up*cos(theta+ang);
        Uq_new=Up*sin(theta+ang);
 %       m=(Ud_new^2+Uq_new^2)^0.5/((2/3)^0.5*Udc);  %the modulation index
        u=[Ud_new,Uq_new,m];
    else
        %compute alpha_h
        if(m>=1)
            alpha_h=pi/6;
        else
           alpha_h=20.3*m^3-49.77*m+29.99;
        end
        if(ang<=alpha_h)
            alpha_p=0;
        else
            if(ang<(pi/3-alpha_h))
                alpha_p=pi/6*((ang-alpha_h)/(pi/6-alpha_h));
            else
                alpha_p=pi/3;
            end
        end
        Up=sqrt(3)/2*R/sin(pi/3+alpha_p);
        Ud_new=Up*cos(theta+alpha_p);
        Uq_new=Up*sin(theta+alpha_p);
%        m=(Ud_new^2+Uq_new^2)^0.5/((2/3)^0.5*Udc);  %the modulation index
        u=[Ud_new,Uq_new,m];
    end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -