You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
1.8 KiB

FUNCTION_BLOCK BS_EVC
VAR_EXTERNAL
END_VAR
VAR_INPUT
RUN : BOOL ; (* PID功能块启用 *)
SET : REAL ; (* 调节目标值 *)
FB : REAL ; (* 调节目标值的反馈值 *)
Dead_Band : REAL :=0.5 ; (* 死区 *)
Delay : TIME :=t#30s;(* 延时时间 *)
SW : INT ; (* 季节模式 0夏季 1冬季 2过渡 *)
END_VAR
VAR_OUTPUT
EVC : BOOL ; (* 电磁阀控制 *)
END_VAR
VAR
ton1 : TON ;
ton2 : TON ;
END_VAR
(*
时 间:20191003
版 本:1.0
作 者:姚立
名 称:电磁阀/开关阀值控程序
说 明:用于电磁阀/开关阀类的开关量阀门的值控程序
备 注:适用于温度、湿度等控制
依赖块:无
输入变量
RUN : BOOL ; PID功能块启用
SET : REAL ; 调节目标值
FB : REAL ; 调节目标值的反馈值
Dead_Band : REAL ; 死区,默认0.5
Delay : TIME ; 延时时间,默认30S
SW : INT ; 季节模式 0夏季 1冬季
输出变量
EVC : BOOL ; 电磁阀/开关阀控制输出
*)
(*
夏季:FB>SET EVC:=1
FB-(SET+D)>=0 EVC:=1
FB-(SET-D)<0 EVC:=0
冬季:SET>FB EVC:=1
(SET-D)-FB>=0 EVC:=1
(SET+D)-FB<0 EVC:=0
*)
ton1(pt:=Delay);
ton2(pt:=Delay);
if RUN =1 then
if SW=0 then
if FB-(SET+Dead_Band)>=0.0 then
ton1.in:=1;
else
ton1.in:=0;
end_if;
if ton1.q=1 then
EVC:=1;
end_if;
if FB-(SET-Dead_Band)<0.0 then
ton2.in:=1;
else
ton2.in:=0;
end_if;
if ton2.q=1 then
EVC:=0;
end_if;
else
if (SET-Dead_Band)-FB>=0.0 then
ton1.in:=1;
else
ton1.in:=0;
end_if;
if ton1.q=1 then
EVC:=1;
end_if;
if (SET+Dead_Band)-FB<0.0 then
ton2.in:=1;
else
ton2.in:=0;
end_if;
if ton2.q=1 then
EVC:=0;
end_if;
end_if;
end_if;
END_FUNCTION_BLOCK