双三相SVM-DTC

使用simulink进行双三相电机的SVM-DTC两矢量的仿真,扇区波形大致的趋势是对的,但是会有跳变是为什么

img

下面是扇区判断的代码

a=delta_flux_alpha;
b=delta_flux_beta;
c=ialpha;
d=ibeta;

Rs=0.08; Ts=0.00001;

ualpha=a/Ts+Rs*c;
ubeta=b/Ts+Rs*d;
uref=sqrt((ualpha)^2+(ubeta)^2);
e=ualpha;
f=ubeta;

if e>0 && f>0
    theta_ur=atan(f/e);
elseif e>0 && f<0
    theta_ur=2*pi+atan(f/e);
elseif e<0 && f>0
    theta_ur=pi+atan(f/e);
elseif e<0 && f<0
    theta_ur=pi+atan(f/e);
else
    theta_ur=0;
end

if theta_ur>=0 && theta_ur12
    N=1;
    alfa=theta_ur+pi/12;
elseif theta_ur>=23*pi/12 && theta_ur<2*pi
    N=1;
    alfa=theta_ur-23*pi/12;
elseif theta_ur>=pi/12 && theta_ur<3*pi/12
    N=2;
    alfa=theta_ur-pi/12;
elseif theta_ur>=3*pi/12 && theta_ur<5*pi/12
    N=3;
    alfa=theta_ur-3*pi/12;
elseif theta_ur>=5*pi/12 && theta_ur<7*pi/12
    N=4;
    alfa=theta_ur-5*pi/12;
elseif theta_ur>=7*pi/12 && theta_ur<9*pi/12
    N=5;
    alfa=theta_ur-7*pi/12;
elseif theta_ur>=9*pi/12 && theta_ur<11*pi/12
    N=6;
    alfa=theta_ur-9*pi/12;
elseif theta_ur>=11*pi/12 && theta_ur<13*pi/12
    N=7;
    alfa=theta_ur-11*pi/12;
elseif theta_ur>=13*pi/12 && theta_ur<15*pi/12
    N=8;
    alfa=theta_ur-13*pi/12;
elseif theta_ur>=15*pi/12 && theta_ur<17*pi/12
    N=9;
    alfa=theta_ur-15*pi/12;
elseif theta_ur>=17*pi/12 && theta_ur<19*pi/12
    N=10;
    alfa=theta_ur-17*pi/6;
elseif theta_ur>=19*pi/12 && theta_ur<21*pi/12
    N=11;
    alfa=theta_ur-19*pi/6;
elseif theta_ur>=21*pi/12 && theta_ur<23*pi/12
    N=12;
    alfa=theta_ur-21*pi/6;
else
    N=1;
    alfa=theta_ur+pi/12;
end

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 你可以看下这个问题的回答https://ask.csdn.net/questions/7519120
  • 除此之外, 这篇博客: 汇编程序调用C语言中的 4.2.2 设置SVC的栈 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:
    	#define SVC_STACK	0xd0037d80
    
    	// 设置SVC栈
    	ldr sp, =SVC_STACK
    	
    	//调用C语言函数
    	bl xxx //xxx是代表函数名,也就是函数的地址,这里代表的函数是不需要传参时候的调用	
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^