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.
 
 
 
 
 
 

193 lines
5.4 KiB

FUNCTION_BLOCK IJ_DAHU
VAR_EXTERNAL
END_VAR
VAR_INPUT
DAHU_STRUCT_IN :DAHU_IN;
END_VAR
VAR_OUTPUT
DAHU_STRUCT_OUT :DAHU_OUT;
END_VAR
VAR
DAHU_RunTime :BS_Runtime;
DAHU_WVCTEMP :REAL;
RunTon1 :TON;
RunTon2 :TON;
RunTof1 :TOF;
RunTof2 :TOF;
DevCheck1_time :TIME :=t#15s; (**)
DevCheck2_time :TIME :=t#15s; (**)
Status0 :INT;
Status1 :INT;
Status2 :INT;
Status3 :INT;
DAHU_SPID_VP :REAL;
DAHU_SPID_VI :REAL;
DAHU_WPID_VP :REAL;
DAHU_WPID_VI :REAL;
PID_in :BOOL;
PID_timer :TON;
FPSSIM_timer :TON;
END_VAR
(*
20201120
1.5
DAHU_STRUCT_IN.
SM :INT ; 季节模式 0夏季 1冬季 2过渡
Run :BOOL; 运行状态
Fault :BOOL; 故障状态
Auto :BOOL; 自动状态
Control :BOOL; 程序控制
TSET :REAL; 温度设定
WVMC :BOOL; 水阀手动控制
WVMV :REAL; 水阀手动控制值
RTS :REAL; 回风温度
RST :BOOL; 运行时间累计重置
RSTV :REAL; 运行时间累计重置值
FPS :BOOL; 风机压差
ISO1 :BOOL; 运行故障反馈隔离
ISO2 :BOOL; 风机压差反馈隔离
VP :REAL; PI设定值P
VI :REAL; PI设定值I
DAHU_STRUCT_OUT.
WVCS :INT ; 水阀控制转换值100
Control :BOOL; 启停控制
RH :REAL; 运行小时
SN :INT ; 设备状态代码
FPSSIM :BOOL; 压差模拟输出
1.,
2.PID/
3.
4.
BS_Runtime;
*)
(************************************************************************************************************)
RunTon1( IN:=DAHU_STRUCT_IN.Control , PT:=DevCheck1_time);
RunTof1( IN:=DAHU_STRUCT_IN.Control , PT:=DevCheck1_time);
RunTon2( IN:=DAHU_STRUCT_IN.Control , PT:=DevCheck2_time);
RunTof2( IN:=DAHU_STRUCT_IN.Control , PT:=DevCheck2_time);
(*Status0*);
DAHU_STRUCT_OUT.Control:=DAHU_STRUCT_IN.Control;
if DAHU_STRUCT_IN.ISO1=0 then
if RunTon1.q or not RunTof1.q then
if DAHU_STRUCT_OUT.Control<>DAHU_STRUCT_IN.Run then
Status0:=1;
else
Status0:=0;
end_if;
if DAHU_STRUCT_IN.Fault=1 then
Status1:=1;
else
Status1:=0;
end_if;
end_if;
else
Status0:=0;
Status1:=0;
end_if;
(**);
if DAHU_STRUCT_IN.ISO2=0 then
if RunTon2.q or not RunTof2.q then
if DAHU_STRUCT_OUT.Control<>DAHU_STRUCT_IN.FPS then
Status2:=1;
else
Status2:=0;
end_if;
end_if;
else
Status2:=0;
end_if;
(**)
if DAHU_STRUCT_OUT.Control<>0 then
DAHU_STRUCT_OUT.SN := Status0*1 + Status1*2 + Status2*4;
else
DAHU_STRUCT_OUT.SN := 0 ;
end_if;
(********************************************************************************************************)
(********************************************使使**************************************************)
FPSSIM_timer( IN:=DAHU_STRUCT_IN.Run , PT:=t#5s );
if DAHU_STRUCT_IN.Run=1 and DAHU_STRUCT_IN.Fault=0 then
DAHU_STRUCT_OUT.FPSSIM:=FPSSIM_timer.q;
else
DAHU_STRUCT_OUT.FPSSIM:=0;
end_if;
(************************************************************************************************************)
PID_in:= not PID_timer.q;
PID_timer(in:=PID_in, pt:=t#1s );(*PID积分时间*)
if DAHU_STRUCT_IN.WVMC=0 then
if DAHU_STRUCT_IN.Run=1 then
(**)
if DAHU_STRUCT_IN.SM=0 then
if DAHU_STRUCT_IN.RTS-DAHU_STRUCT_IN.TSET>=2.0 then
DAHU_WVCTEMP:=100.0;
end_if;
if DAHU_STRUCT_IN.RTS-DAHU_STRUCT_IN.TSET>0.2 and DAHU_STRUCT_IN.RTS-DAHU_STRUCT_IN.TSET<2.0 then (**)
if PID_timer.q then
DAHU_WVCTEMP:=(DAHU_STRUCT_IN.RTS-DAHU_STRUCT_IN.TSET)*50.0;
end_if;
end_if;
if DAHU_STRUCT_IN.RTS-DAHU_STRUCT_IN.TSET<=0.0 then
DAHU_WVCTEMP:=0.0;
end_if;
end_if;
(**)
if DAHU_STRUCT_IN.SM=1 then
if DAHU_STRUCT_IN.TSET-DAHU_STRUCT_IN.RTS>=2.0 then
DAHU_WVCTEMP:=100.0;
end_if;
if DAHU_STRUCT_IN.TSET-DAHU_STRUCT_IN.RTS>0.2 and DAHU_STRUCT_IN.TSET-DAHU_STRUCT_IN.RTS<2.0 then (**)
if PID_timer.q then
DAHU_WVCTEMP:=(DAHU_STRUCT_IN.TSET-DAHU_STRUCT_IN.RTS)*50.0;
end_if;
end_if;
if DAHU_STRUCT_IN.TSET-DAHU_STRUCT_IN.RTS<=0.0 then
DAHU_WVCTEMP:=0.0;
end_if;
end_if;
(**)
if DAHU_STRUCT_IN.SM=2 then
DAHU_WVCTEMP:=0.0;
end_if;
else
DAHU_WVCTEMP:=0.0;
end_if;
else
DAHU_WVCTEMP:=DAHU_STRUCT_IN.WVMV;
end_if;
(**)
DAHU_STRUCT_OUT.WVCS:=REAL_TO_INT(DAHU_WVCTEMP*100.0);
(************************************************************************************************************)
DAHU_RunTime(RUN :=DAHU_STRUCT_IN.Run , RUNTIMESET :=DAHU_STRUCT_IN.RSTV , RUNTIMERST :=DAHU_STRUCT_IN.RST ,RunTimeRec_In :=DAHU_STRUCT_OUT.RH | DAHU_STRUCT_OUT.RH:= RUNTIME);
END_FUNCTION_BLOCK