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.
 
 
 
 
 
 

385 lines
10 KiB

FUNCTION_BLOCK BS_CMFCU
VAR_EXTERNAL
END_VAR
VAR_INPUT
FAU_STRUCT_IN :FAU_IN;
END_VAR
VAR_OUTPUT
FAU_STRUCT_OUT :FAU_OUT;
END_VAR
VAR
FAU_SPID :BS_PID;
FAU_WPID :BS_PID;
FAU_RunTime :BS_Runtime;
FAU_WVCTEMP :REAL;
RunTon1 :TON;
RunTon2 :TON;
RunTon3 :TON;
RunTon5 :TON;
FanTon1 :TON;
FanTon2 :TON;
FanTon2q :BOOL;
RunTof1 :TOF;
RunTof2 :TOF;
RunTof3 :TOF;
DevCheck1_time :TIME :=t#15s; (**)
DevCheck2_time :TIME :=t#15s; (**)
AFSDelay_time :TIME :=t#10s;
Status0 :INT;
Status1 :INT;
Status2 :INT;
Status3 :INT;
FAU_SPID_VP :REAL;
FAU_SPID_VI :REAL;
FAU_WPID_VP :REAL;
FAU_WPID_VI :REAL;
PID_in :BOOL;
PID_timer :TON;
AFSM :BOOL;
FDSM :BOOL;
FDOM :BOOL;
FDOTon :TON;
FDSTon :TON;
FAU_FEC :BS_FEC;
FAU_CM :BOOL;
FAU_VFCSM :INT;
ini :BOOL;
VFMVM :INT;
AFSON :BOOL;
AFSOF :BOOL;
AFSTON :TON;
AFSTOF :TOF;
FVCS :REAL;
END_VAR
(*
20201028
1.1
FAU_STRUCT_IN.
SM :INT ; 季节模式 0夏季 1冬季 2过渡
LM :LM ; 联动模式 0无联动 1联动
Run :BOOL; 运行状态
Fault :BOOL; 故障状态
Auto :BOOL; 自动状态
Control :BOOL; 程序控制
FVMC :BOOL; 风阀手动控制
FVMV :REAL; 风阀手动控制值
FVOCT :TIME; 风阀开启时间周期设定OpenCycleTime
FVOST :TIME; 风阀开启稳定时间设定OpenStableTime
TSET :REAL; 温度设定
WVMC :BOOL; 水阀手动控制
WVMV :REAL; 水阀手动控制值
VFMC :BOOL; 变频手动控制
VFMV :INT; 变频设定值
STS :REAL; 送风温度
RST :BOOL; 运行时间累计重置
RSTV :REAL; 运行时间累计重置值
FPS :BOOL; 风机压差
IPS :BOOL; 滤网压差
AFS :BOOL; 低温断路开关
ISO1 :BOOL; 运行故障反馈隔离
ISO2 :BOOL; 风机压差反馈隔离
ISO3 :BOOL; 低温断路报警隔离
VFBS :INT; 变频反馈
VP :REAL; PI设定值P
VI :REAL; PI设定值I
FDELAY :TIME; 风机启动延时
VDELAY :TIME; 风阀信号切除延时
FAU_STRUCT_OUT.
WVCS :INT ; 水阀控制转换值100
VFCS :INT ; 变频控制 (35~50)
FVCS :INT ; 风阀控制 (50~100)
Control :BOOL; 启停控制
RH :REAL; 运行小时
SN :INT ; 设备状态代码
1.,
2.PID/
3.
4.
5.50%OST100%OCT4小时100%OST
7.
8.
BS_PID;
BS_Runtime;
*)(*
if ini=0 then
FAU_STRUCT_IN.VFMV:=40;
ini:=1;
end_if;*)
(******************************************************CO2联动程序*******************************************************
if FAU_STRUCT_IN.LM=0 then
if FAU_STRUCT_IN.Control=1 then
FAU_CM:=1;
else FAU_CM:=0;
end_if;
end_if;
if FAU_STRUCT_IN.LM=1 then
FAU_FEC(RUN :=FAU_STRUCT_IN.CM , SET :=FAU_STRUCT_IN.CO2SET , FB :=FAU_STRUCT_IN.CO2S , DEAD_BAND :=10.0 , DELAY :=t#20s | FAU_CM:= DevC);
end_if;
*)
(**************************************************************************************************************)
if AFSM=0 then(**)
(**)
if FAU_STRUCT_IN.Control=1 then
FanTon1 ( IN:=FanTon2q , PT:=FAU_STRUCT_IN.FVOCT );
FanTon2 ( IN:=FanTon1.q , PT:=FAU_STRUCT_IN.FVOST );
FanTon2q:=not FanTon2.q;
if FAU_STRUCT_IN.FVMC=0 then
if FanTon1.q=1 and FanTon2.q=0 then
FAU_STRUCT_OUT.FVCS:=50;
else
FAU_STRUCT_OUT.FVCS:=100;
end_if;
else
FAU_STRUCT_OUT.FVCS:=FAU_STRUCT_IN.FVMV;
end_if;
end_if;
(*************************************************************************************)
RunTon3 ( IN:=FAU_STRUCT_IN.Control , PT:=FAU_STRUCT_IN.FDELAY | FAU_STRUCT_OUT.Control:=q );
if FAU_STRUCT_IN.Run=1 then
(**)
if FAU_STRUCT_IN.VFMC =1 then
if FAU_STRUCT_IN.VFMV<=50 and FAU_STRUCT_IN.VFMV>=35 then
FAU_STRUCT_OUT.VFCS:=FAU_STRUCT_IN.VFMV;
end_if;
if FAU_STRUCT_IN.VFMV>50 then
FAU_STRUCT_OUT.VFCS:=50;
end_if;
if FAU_STRUCT_IN.VFMV<35 then
FAU_STRUCT_OUT.VFCS:=35;
end_if;
else
FAU_STRUCT_OUT.VFCS:=50;
end_if;
else
FAU_STRUCT_OUT.VFCS:=0;
end_if;
(************************************************************************************************************)
PID_in:= not PID_timer.q;
PID_timer(in:=PID_in, pt:=t#1s );(*PID积分时间*)
if FAU_STRUCT_IN.WVMC=0 then
if FAU_STRUCT_IN.Run=1 then
if FAU_STRUCT_IN.VP<>0.0 and FAU_STRUCT_IN.VI<>0.0 then
FAU_SPID_VP:=-FAU_STRUCT_IN.VP;
FAU_SPID_VI:=-FAU_STRUCT_IN.VI;
FAU_WPID_VP:=FAU_STRUCT_IN.VP;
FAU_WPID_VI:=FAU_STRUCT_IN.VI;
else
FAU_SPID_VP:=-30.0;
FAU_SPID_VI:=-150.0;
FAU_WPID_VP:=30.0;
FAU_WPID_VI:=150.0;
end_if;
(**)
if FAU_STRUCT_IN.SM=0 then
if FAU_STRUCT_IN.STS-FAU_STRUCT_IN.TSET>=3.0 then
FAU_WVCTEMP:=100.0;
end_if;
if PID_timer.q then
FAU_SPID(RUN:= FAU_STRUCT_IN.RUN,STOP_D:=1,STOP_I:=0,SET:=FAU_STRUCT_IN.TSET,FB:=FAU_STRUCT_IN.STS,KFB:=1.0,KP:=FAU_SPID_VP,TI:=FAU_SPID_VI,TD:=-1.0,DEAD_BAND:=0.2,YMAX:=100.0,YMIN:=0.0 | FAU_WVCTEMP:=OUT);
end_if;
end_if;
(**)
if FAU_STRUCT_IN.SM=1 then
if FAU_STRUCT_IN.TSET-FAU_STRUCT_IN.STS>=3.0 then
FAU_WVCTEMP:=100.0;
end_if;
if PID_timer.q then
FAU_WPID(RUN:= FAU_STRUCT_IN.RUN,STOP_D:=1,STOP_I:=0,SET:=FAU_STRUCT_IN.TSET,FB:=FAU_STRUCT_IN.STS,KFB:=1.0,KP:=FAU_WPID_VP,TI:=FAU_WPID_VI,TD:=1.0,DEAD_BAND:=0.2,YMAX:=100.0,YMIN:=0.0 | FAU_WVCTEMP:=OUT);
end_if;
end_if;
(**)
if FAU_STRUCT_IN.SM=2 then
FAU_WVCTEMP:=0.0;
end_if;
else
FAU_WVCTEMP:=0.0;
end_if;
else
FAU_WVCTEMP:=FAU_STRUCT_IN.WVMV;
end_if;
end_if;(**)
(**)
FAU_STRUCT_OUT.WVCS:=REAL_TO_INT(FAU_WVCTEMP*100.0);
(************************************************************************************
FDOTon( IN:=FDOM , PT:=FAU_STRUCT_IN.VDELAY);
FDSTon( IN:=FDSM , PT:=FAU_STRUCT_IN.VDELAY);
if FDOM=1 and FDOTon.q=0 then
FAU_STRUCT_OUT.FDO:=1;
else FAU_STRUCT_OUT.FDO:=0;
end_if;
if FDSM=1 and FDSTon.q=0 then
FAU_STRUCT_OUT.FDS:=1;
else FAU_STRUCT_OUT.FDS:=0;
end_if;
*)
(**)
(*
,
RunTon5 ( IN:=RunTon5M , PT:=DevDelay5_time );
RunTon5M:= not RunTon5.q;
if RunTon3.Q =1 then
if RunTon5.Q then
FAU_VFCSM:=FAU_VFCSM+1;
end_if;
if FAU_VFCSM>FAU_STRUCT_IN.VFMV then
FAU_VFCSM:=FAU_STRUCT_IN.VFMV;
end_if;
end_if;
if FAU_CM =0 then
if RunTon5.Q then
FAU_VFCSM:=FAU_VFCSM-1;
end_if;
if FAU_VFCSM<1 then
FAU_VFCSM:=0;
FAU_STRUCT_OUT.Control :=0;
FDOM:=0;
FDSM:=1;
end_if;
end_if;
if RunTon3.q=1 then
if FAU_VFCSM=FAU_STRUCT_IN.VFMV then
FAU_STRUCT_OUT.Control:=1;
end_if;
if FAU_VFCSM=0 then
FAU_STRUCT_OUT.Control:=0;
end_if;
end_if;
FAU_STRUCT_OUT.VFCS :=FAU_VFCSM;
*)
(************************************************************************************************************)
if FAU_STRUCT_IN.ISO3=0 and FAU_STRUCT_IN.SM=1 then
AFSTON ( IN:=FAU_STRUCT_IN.AFS , PT:=AFSDelay_time | AFSON:=q );
AFSTOF ( IN:=FAU_STRUCT_IN.AFS , PT:=AFSDelay_time | AFSOF:=q );
if AFSON=1 and AFSOF=1 then
AFSM:=1 ;
end_if;
if AFSOF=0 and AFSON=0 then
AFSM:=0 ;
end_if;
if AFSM=1 then
FAU_STRUCT_OUT.Control:=0;
FAU_WVCTEMP:=100.0;
FDSM:=1;
FDOM:=0;
Status3:=1;
else
Status3:=0;
end_if;
end_if;
(**)
if FAU_STRUCT_IN.ISO3=1 or FAU_STRUCT_IN.SM<>1 then
AFSM:=0;
end_if;
(************************************************************************************************************)
RunTon1( IN:=FAU_STRUCT_IN.Control , PT:=DevCheck1_time);
RunTof1( IN:=FAU_STRUCT_IN.Control , PT:=DevCheck1_time);
RunTon2( IN:=FAU_STRUCT_IN.Control , PT:=DevCheck2_time);
RunTof2( IN:=FAU_STRUCT_IN.Control , PT:=DevCheck2_time);
(*Status0*);
if FAU_STRUCT_IN.ISO1=0 then
if RunTon1.q or not RunTof1.q then
if FAU_STRUCT_OUT.Control<>FAU_STRUCT_IN.Run then
Status0:=1;
else
Status0:=0;
end_if;
if FAU_STRUCT_IN.Fault=1 then
Status1:=1;
else
Status1:=0;
end_if;
end_if;
else
Status0:=0;
Status1:=0;
end_if;
(**);
if FAU_STRUCT_IN.ISO2=0 then
if RunTon2.q or not RunTof2.q then
if FAU_STRUCT_OUT.Control<>FAU_STRUCT_IN.FPS then
Status2:=1;
else
Status2:=0;
end_if;
end_if;
else
Status2:=0;
end_if;
(**)
if FAU_STRUCT_OUT.Control<>0 then
FAU_STRUCT_OUT.SN := Status0 * 1 + Status1* 2 + Status2* 4 + Status3*8;
else
FAU_STRUCT_OUT.SN := 0 ;
end_if;
(************************************************************************************************************)
FAU_RunTime(RUN :=FAU_STRUCT_IN.Run , RUNTIMESET :=FAU_STRUCT_IN.RSTV , RUNTIMERST :=FAU_STRUCT_IN.RST | FAU_STRUCT_OUT.RH:= RUNTIME);
END_FUNCTION_BLOCK