Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
571 B
6
Indexable
Never
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 
	PRun:=TRUE;
	PFail:=FALSE;
	ELSE IF PFail THEN 
		PTrip:=TRUE;
		PRun:=FALSE;
	ELSE
			PTrip:=FALSE;
	END_IF
END_IF

IF PStop AND NOT prevPStop THEN 
	PRun:=FALSE;
END_IF


prevPStart:=PStart;
prevPStop:=PStop;
prevPtrip:=PTrip;

Leave a Comment