Untitled
FUNCTION_BLOCK PumpControl VAR_INPUT PStart:BOOL; PStop: BOOL; PFail:BOOL; END_VAR VAR_OUTPUT PRun:BOOL; PTrip:BOOL; END_VAR VAR prevPStart:BOOL; prevPStop:BOOL; prevPtrip:BOOL; END_VAR #method IF prevPtrip THEN PFail:=FALSE; END_IF IF PStart AND NOT prevPStart THEN StartPump(); PFail:=FALSE; ELSE IF PFail THEN PTrip:=TRUE; StopPump(); ELSE PTrip:=FALSE; END_IF END_IF IF PStop AND NOT prevPStop THEN StopPump(); END_IF prevPStart:=PStart; prevPStop:=PStop; prevPtrip:=PTrip; #Start action PRun:=TRUE; #Stop action PRun:=FALSE;
Leave a Comment