FUNCTION_BLOCK IJ_AHU VAR_EXTERNAL END_VAR VAR_INPUT AHU_STRUCT_IN :AHU_IN; END_VAR VAR_OUTPUT AHU_STRUCT_OUT :AHU_OUT; END_VAR VAR AHU_SPID :BS_PID; AHU_WPID :BS_PID; AHU_RunTime :BS_Runtime; AHU_WVCTEMP :REAL; RunTon1 :TON; RunTon2 :TON; RunTon3 :TON; RunTon5 :TON; RunTof1 :TOF; RunTof2 :TOF; RunTof3 :TOF; DevCheck1_time :TIME :=t#15s; (*设备运行状态反馈*) DevCheck2_time :TIME :=t#15s; (*设备运行状态反馈*) AFSDelay_time :TIME :=t#60s; Status0 :INT; Status1 :INT; Status2 :INT; Status3 :INT; AHU_SPID_VP :REAL; AHU_SPID_VI :REAL; AHU_WPID_VP :REAL; AHU_WPID_VI :REAL; PID_in :BOOL; PID_timer :TON; AFSM :BOOL; FDSM :BOOL; FDOM :BOOL; FDOTon :TON; FDSTon :TON; (*AHU_FEC :BS_FEC;*) AHU_CM :BOOL; AHU_VFCSM :INT; ini :BOOL; VFMVM :INT; AFSON :BOOL; AFSOF :BOOL; AFSTON :TON; AFSTOF :TOF; END_VAR (* 时 间:20200724 版 本:1.0 作 者:潘平 名 称:吾悦影院空调机组程序功能块 说 明: 输入变量 AHU_IN:STRUCT SM :INT ; 季节模式 0夏季 1冬季 2过渡 LM :BOOL; 逻辑联动模式预留 0无联动 1联动 FM :BOOL; 风阀联动模式 0无联动 1联动 Run :BOOL; 运行状态 AHUlt :BOOL; 故障状态 Auto :BOOL; 自动状态 Control :BOOL; 程序控制 FDB :BOOL; 新风阀开度反馈 RDB :BOOL; 回风阀开度反馈 TSET :REAL; 温度设定 WVMC :BOOL; 水阀手动控制 WVMV :REAL; 水阀手动控制值 VFMV :INT; 变频手动控制值 RTS :REAL; 回风温度 RST :BOOL; 运行时间累计重置 RSTV :REAL; 运行时间累计重置值 IPS :BOOL; 滤网压差 AFS :BOOL; 低温断路开关 ISO1 :BOOL; 运行故障反馈隔离 ISO3 :BOOL; 低温断路报警隔离 VP :REAL; PI设定值P VI :REAL; PI设定值I FDELAY :TIME; 风机启动延时 CO2SET :REAL; 二氧化碳浓度设定 CO2S :REAL; 二氧化碳浓度 FDMV :INT; 新风阀手动控制值 RDMV :INT; 回风阀手动控制值 END_STRUCT; 输出变量 AHU_OUT:STRUCT WVCS :INT ; 水阀控制转换值,放大100倍 VFCS :INT; 变频控制 FDCS :INT; 新风阀控制 RDCS :INT; 回风阀控制 Control :BOOL; 启停控制 RH :REAL; 运行小时 SN :INT ; 设备状态代码 END_STRUCT; 包含以下几点功能 1.运行故障回检,输出故障代码,支持故障报警隔离 2.水阀PID调节/手动调节 3.运行时间累计 4.防冻联动程序 5.风阀联动程序,监测阀门到位后停止控制点输出 6.二氧化碳联动程序 7.风机启停联动程序 8.变频程序 备 注: 依赖块: BS_PID; BS_Runtime; *)(* if ini=0 then AHU_STRUCT_IN.VFMV:=40; ini:=1; end_if;*) (******************************************************风阀联动程序********************************************************) if AHU_STRUCT_IN.FM=0 then if (AHU_STRUCT_IN.Control=1 and AHU_STRUCT_IN.Auto=1) or (AHU_STRUCT_IN.Run=1 and AHU_STRUCT_IN.Auto=0) then AHU_STRUCT_OUT.FDCS:=100; AHU_STRUCT_OUT.RDCS:=100; else AHU_STRUCT_OUT.FDCS:=0; AHU_STRUCT_OUT.RDCS:=0; end_if; else AHU_STRUCT_OUT.FDCS:=AHU_STRUCT_IN.FDMV; AHU_STRUCT_OUT.RDCS:=AHU_STRUCT_IN.RDMV; end_if; (******************************************************CO2联动程序******************************************************* 暂时预留,根据需求调整 if AHU_STRUCT_IN.LM=1 then AHU_FEC(RUN :=AHU_STRUCT_IN.CM , SET :=AHU_STRUCT_IN.CO2SET , FB :=AHU_STRUCT_IN.CO2S , DEAD_BAND :=10.0 , DELAY :=t#20s | AHU_CM:= DevC); end_if; *) (******************************************************新风机启停程序********************************************************) if AFSM=0 then(*防冻报警触发隔离程序段起始*) (***************************************风机延时启动程序**********************************************) RunTon3 ( IN:=AHU_STRUCT_IN.Control , PT:=AHU_STRUCT_IN.FDELAY | AHU_STRUCT_OUT.Control:=q ); (*变频器输出赋值*) if AHU_STRUCT_IN.VFMV<=50 and AHU_STRUCT_IN.VFMV>=40 then AHU_STRUCT_OUT.VFCS:=AHU_STRUCT_IN.VFMV; end_if; if AHU_STRUCT_IN.VFMV>50 then AHU_STRUCT_OUT.VFCS:=50; end_if; if AHU_STRUCT_IN.VFMV<40 then AHU_STRUCT_OUT.VFCS:=40; end_if; (******************************************************水阀控制******************************************************) PID_in:= not PID_timer.q; PID_timer(in:=PID_in, pt:=t#1s );(*PID积分时间*) if AHU_STRUCT_IN.WVMC=0 then if AHU_STRUCT_IN.Run=1 then if AHU_STRUCT_IN.VP<>0.0 and AHU_STRUCT_IN.VI<>0.0 then AHU_SPID_VP:=-AHU_STRUCT_IN.VP; AHU_SPID_VI:=-AHU_STRUCT_IN.VI; AHU_WPID_VP:=AHU_STRUCT_IN.VP; AHU_WPID_VI:=AHU_STRUCT_IN.VI; else AHU_SPID_VP:=-30.0; AHU_SPID_VI:=-150.0; AHU_WPID_VP:=30.0; AHU_WPID_VI:=150.0; end_if; (*制冷季*) if AHU_STRUCT_IN.SM=0 then if AHU_STRUCT_IN.RTS-AHU_STRUCT_IN.TSET>=3.0 then AHU_WVCTEMP:=100.0; end_if; if PID_timer.q then AHU_SPID(RUN:= AHU_STRUCT_IN.RUN,STOP_D:=1,STOP_I:=0,SET:=AHU_STRUCT_IN.TSET,FB:=AHU_STRUCT_IN.RTS,KFB:=1.0,KP:=AHU_SPID_VP,TI:=AHU_SPID_VI,TD:=-1.0,DEAD_BAND:=0.2,YMAX:=100.0,YMIN:=0.0 | AHU_WVCTEMP:=OUT); end_if; end_if; (*制热季*) if AHU_STRUCT_IN.SM=1 then if AHU_STRUCT_IN.TSET-AHU_STRUCT_IN.RTS>=3.0 then AHU_WVCTEMP:=100.0; end_if; if PID_timer.q then AHU_WPID(RUN:= AHU_STRUCT_IN.RUN,STOP_D:=1,STOP_I:=0,SET:=AHU_STRUCT_IN.TSET,FB:=AHU_STRUCT_IN.RTS,KFB:=1.0,KP:=AHU_WPID_VP,TI:=AHU_WPID_VI,TD:=1.0,DEAD_BAND:=0.2,YMAX:=100.0,YMIN:=0.0 | AHU_WVCTEMP:=OUT); end_if; end_if; (*过渡季*) if AHU_STRUCT_IN.SM=2 then AHU_WVCTEMP:=0.0; end_if; else AHU_WVCTEMP:=0.0; end_if; else AHU_WVCTEMP:=AHU_STRUCT_IN.WVMV; end_if; end_if;(*防冻报警触发隔离程序段结束*) (*水阀赋值量程转换*) AHU_STRUCT_OUT.WVCS:=REAL_TO_INT(AHU_WVCTEMP*100.0); (*变频器软启动,软停机程序*) (*变频软启动、停止完成后开启主机,关闭主机,但因变频器一般自带软启动、软停止,暂时保留此功能 RunTon5 ( IN:=RunTon5M , PT:=DevDelay5_time ); RunTon5M:= not RunTon5.q; if RunTon3.Q =1 then if RunTon5.Q then AHU_VFCSM:=AHU_VFCSM+1; end_if; if AHU_VFCSM>AHU_STRUCT_IN.VFMV then AHU_VFCSM:=AHU_STRUCT_IN.VFMV; end_if; end_if; if AHU_CM =0 then if RunTon5.Q then AHU_VFCSM:=AHU_VFCSM-1; end_if; if AHU_VFCSM<1 then AHU_VFCSM:=0; AHU_STRUCT_OUT.Control :=0; FDOM:=0; FDSM:=1; end_if; end_if; if RunTon3.q=1 then if AHU_VFCSM=AHU_STRUCT_IN.VFMV then AHU_STRUCT_OUT.Control:=1; end_if; if AHU_VFCSM=0 then AHU_STRUCT_OUT.Control:=0; end_if; end_if; AHU_STRUCT_OUT.VFCS :=AHU_VFCSM; *) (******************************************************防冻联动程序******************************************************) if AHU_STRUCT_IN.ISO3=0 and AHU_STRUCT_IN.SM=1 then AFSTON ( IN:=AHU_STRUCT_IN.AFS , PT:=AFSDelay_time | AFSON:=q ); AFSTOF ( IN:=AHU_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 AHU_STRUCT_OUT.Control:=0; AHU_WVCTEMP:=100.0; AHU_STRUCT_OUT.FDCS:=0; AHU_STRUCT_OUT.RDCS:=0; Status3:=1; else Status3:=0; end_if; end_if; (*非冬季或隔离切除防冻报警*) if AHU_STRUCT_IN.ISO3=1 or AHU_STRUCT_IN.SM<>1 then AFSM:=0; end_if; (******************************************************运行故障回检******************************************************) RunTon1( IN:=AHU_STRUCT_IN.Control , PT:=DevCheck1_time); RunTof1( IN:=AHU_STRUCT_IN.Control , PT:=DevCheck1_time); RunTon2( IN:=AHU_STRUCT_IN.Control , PT:=DevCheck2_time); RunTof2( IN:=AHU_STRUCT_IN.Control , PT:=DevCheck2_time); (*设备电气控制箱控制指令与设备运行反馈不一致故障检测,检测故障产生原因电箱没电、断路器断开、中间继电器与接触器故障等为Status0*); if AHU_STRUCT_IN.ISO1=0 then if RunTon1.q or not RunTof1.q then if AHU_STRUCT_OUT.Control<>AHU_STRUCT_IN.Run then Status0:=1; else Status0:=0; end_if; if AHU_STRUCT_IN.fault=1 then Status1:=1; else Status1:=0; end_if; end_if; else Status0:=0; Status1:=0; end_if; (*设备电气控制箱控制指令与设备运行反馈不一致故障检测,检测故障产生风机压差无回检信号; 影院无风机压差 if AHU_STRUCT_IN.ISO2=0 then if RunTon2.q or not RunTof2.q then if AHU_STRUCT_OUT.Control<>AHU_STRUCT_IN.FPS then Status2:=1; else Status2:=0; end_if; end_if; else Status2:=0; end_if; *) (*输出故障代码*) if AHU_STRUCT_OUT.Control<>0 then AHU_STRUCT_OUT.SN := Status0 * 1 + Status1* 2 + Status2* 4 + Status3*8; else AHU_STRUCT_OUT.SN := 0 ; end_if; (******************************************************运行时间累计******************************************************) AHU_RunTime(RUN :=AHU_STRUCT_IN.Run , RUNTIMESET :=AHU_STRUCT_IN.RSTV , RUNTIMERST :=AHU_STRUCT_IN.RST | AHU_STRUCT_OUT.RH:= RUNTIME); END_FUNCTION_BLOCK