📄 triger_3.m
字号:
function triger = triger_3(u)
global a_ab1;
global a_bc1;
global a_ca1;
global a_ab2;
global a_bc2;
global a_ca2;
global t_ab1;
global t_bc1;
global t_ca1;
global t_ab2;
global t_bc2;
global t_ca2;
global triger_sign;
if isempty(triger_sign)
triger_sign=[0 0 0 0 0 0];
end
if isempty(a_ab1)
a_ab1=3*pi/4;
end
if isempty(a_bc1)
a_bc1=3*pi/4;
end
if isempty(a_ca1)
a_ca1=3*pi/4;
end
if isempty(a_ab2)
a_ab2=3*pi/4;
end
if isempty(a_bc2)
a_bc2=3*pi/4;
end
if isempty(a_ca2)
a_ca2=3*pi/4;
end
if isempty(t_ab1)
t_ab1=0;
end
if isempty(t_bc1)
t_bc1=0;
end
if isempty(t_ca1)
t_ca1=0;
end
if isempty(t_ab2)
t_ab2=0;
end
if isempty(t_bc2)
t_bc2=0;
end
if isempty(t_ca2)
t_ca2=0;
end
triger_time=u(4,1);
time_now=u(5,1);%三角波
per_v=u(6,1);%方波
if per_v<35000
per_v=40000;
end
temp_ab=u(1,1);
temp_bc=u(2,1);
temp_ca=u(3,1);
if (temp_ab>(pi*719/720))
temp_ab=pi*719/720;
elseif (temp_ab<(pi*361/720))
temp_ab=pi*361/720;
end
if (temp_bc>(pi*719/720))
temp_bc=pi*719/720;
elseif (temp_bc<(pi*361/720))
temp_bc=pi*361/720;
end
if (temp_ca>(pi*719/720))
temp_ca=pi*719/720;
elseif (temp_ca<(pi*361/720))
temp_ca=pi*361/720;
end
switch triger_time %根据compare.m中计算出来的状态值选择触发哪相 TCR
case 1
a_ab1=temp_ab;
t_ab1=tri_time(a_ab1,per_v,time_now);
case 2
a_ab2=temp_ab;
t_ab2=tri_time(a_ab2,per_v,time_now);
case 3
a_bc1=temp_bc;
t_bc1=tri_time(a_bc1,per_v,time_now);
case 4
a_bc2=temp_bc;
t_bc2=tri_time(a_bc2,per_v,time_now);
case 5
a_ca1=temp_ca;
t_ca1=tri_time(a_ca1,per_v,time_now);
case 6
a_ca2=temp_ca;
t_ca2=tri_time(a_ca2,per_v,time_now);
end
if time_now==t_ab1
triger_sign(1,1)=1;
else
triger_sign(1,1)=0;
end
if time_now==t_ab2
triger_sign(1,2)=1;
else
triger_sign(1,2)=0;
end
if time_now==t_bc1
triger_sign(1,3)=1;
else
triger_sign(1,3)=0;
end
if time_now==t_bc2
triger_sign(1,4)=1;
else
triger_sign(1,4)=0;
end
if time_now==t_ca1
triger_sign(1,5)=1;
else
triger_sign(1,5)=0;
end
if time_now==t_ca2
triger_sign(1,6)=1;
else
triger_sign(1,6)=0;
end
triger=triger_sign;
function t_tri = tri_time(a , per, time_n)
ref_time=fix((per*(a-pi/2))/(2*pi))+time_n;
if (ref_time>per)
t_tri=ref_time-per;
else
t_tri=ref_time;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -