Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
684 B
1
Indexable
Never
FUNCTION_BLOCK Manager
VAR_INPUT
	MyPump: POINTER TO PumpControl;
	FStart:BOOL;
	FStop:BOOL;
END_VAR
VAR_OUTPUT
	Trip:BOOL;
	Available:BOOL;
END_VAR
    prevPStart, prevPStop:BOOL;
VAR
	
END_VAR


IF FStart AND NOT prevFStart AND NOT MyPump^.PFail THEN
    StartRequest();
END_IF

IF FStop AND NOT prevFStop THEN
    StopRequest();
END_IF

prevFStart:=ThisObj^.FStart;
prevFstop:=ThisObj^.FStop;

IF MyPump^.PFail THEN 
	Trip := TRUE;
END_IF

IF NOT MyPump^.PRun AND NOT MyPump^.PFail THEN
    Available:=TRUE;
END_IF
IF Available AND Trip THEN 
	Available:=FALSE;
END_IF

# StartRequest
MyPump^.StartPump();

#StopRequest
MyPump^.StopPump();
Leave a Comment