Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
627 B
4
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 
	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