在生产中有时遇到与设备有连锁的流量、液位波动厉害的情况,此时需要进行小信号切除,于是自定义了一个CFC块,用于小信号切除,供大家参考
FUNCTION FC411:VOID NAME:'SEL_LOWA' VERSION:'1.1' FAMILY:BCM VAR_IN_OUT MODE :BOOL:=0; //1=invert signal,0=OUT=IN IN :BOOL:=0; //Input value QUALITY :BYTE:=16#00; //Quality code of IN signal END_VAR VAR_OUTPUT OUT :BOOL:=0; //OUT=not(IN)(MODE=1),OUT=IN(MODE=0,simulation,substitute value)
END_VAR
VAR
END_VAR BEGIN IF MODE THEN IF QUALITY =16#48 THEN OUT:=IN; ELSE OUT:=NOT(IN); END_IF; ELSE OUT:=IN; END_IF; |