使用simulink进行双三相电机的SVM-DTC两矢量的仿真,扇区波形大致的趋势是对的,但是会有跳变是为什么
下面是扇区判断的代码
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
不知道你这个问题是否已经解决, 如果还没有解决的话: #define SVC_STACK 0xd0037d80
// 设置SVC栈
ldr sp, =SVC_STACK
//调用C语言函数
bl xxx //xxx是代表函数名,也就是函数的地址,这里代表的函数是不需要传参时候的调用