﻿<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
  <POU Name="DeckHPU" Id="{822dcf3a-85f6-416a-8a4a-752d32cc7501}" SpecialFunc="None">
    <Declaration><![CDATA[FUNCTION_BLOCK DeckHPU // custom made HPU class for Mbari (2 pumps, remote start from IMACS etc.)
VAR_INPUT
	IO_In : REFERENCE TO deckHPU_IO_In;
	IO_Out : REFERENCE TO deckHPU_IO_Out;
	emergencyStop : p6com.IEmergencyStop;
END_VAR

VAR
	//{attribute 'hide'} _Alarm : BOOL;
	_opState 		: p7type.P6OpState;
	PumpState1 		:  (* ARRAY [1..2]  OF *) deckPumpState;			//SM
	PumpState2 		:  (* ARRAY [1..2]  OF *)deckPumpState;			//SM
	_HPUstart		: BOOL;
	_HPUstop		: BOOL;
	_PStart			: ARRAY [1..2] OF BOOL ;
	_PStop			: ARRAY [1..2] OF BOOL ;
//	_PStart1		:  BOOL ;
//	_PStop1			:  BOOL ;
//	_PStart2		:  BOOL ;
//	_PStop2			:  BOOL ;
	
	{attribute 'hide'} oilTempWarning			: p6com.AlarmDigital(TC_EVENTS.LibPowerEvtClass.CRANEHPU_TEMPERATURE_ERROR);  
	{attribute 'hide'} motor1Overload			: p6com.AlarmDigital(TC_EVENTS.LibPowerEvtClass.CRANEHPU_OVERLOAD); 
	{attribute 'hide'} motor2Overload			: p6com.AlarmDigital(TC_EVENTS.LibPowerEvtClass.CRANEHPU_OVERLOAD); 
	{attribute 'hide'} oilLevelWarning			: p6com.AlarmDigital(TC_EVENTS.LibPowerEvtClass.CRANEHPU_LEVELSWITCH_ERROR);  
	{attribute 'hide'} oilLevelShutdown			: p6com.AlarmDigital(TC_EVENTS.LocalEvents.CRANEHPU_OIL_LEVEL_SHUTDOWN);
	{attribute 'hide'} externalShutdown			: p6com.AlarmDigital(TC_EVENTS.LocalEvents.CRANEHPU_EXTERNAL_SHUTDOWN);    
END_VAR

VAR CONSTANT
	startWaitTime 		: TIME := T#18S;		// waiting for run feedback before giving up
	outputContactTime 	: TIME := T#1S;			// time to hold stop/start relay on
END_VAR]]></Declaration>
    <Implementation>
      <ST><![CDATA[// start/stop signals will arrive from Imac system (PLC IO) or radio controls (CAN) Using DeckHPU.Start/Stop property
// local start/stop on HPU cabinet is not wired to PLC, but state machine should change accordingly if run signal goes on/off

updateAlarms();

(* OpState logic *)
IF  io_in.Pump1_Tripped AND  io_in.Pump2_Tripped OR NOT io_in.externalShutdown_OK OR NOT io_in.OilLevelShutdown_OK  THEN
	_opstate := P6OpState.NOTAVAILABLE;	
ELSIF
	io_in.Pump1_Running OR  io_in.Pump2_Running THEN
	_opstate := P6OpState.RUN;	
ELSE
	_opstate := P6OpState.STOPPED;	
END_IF

(* IMACS signals for pump running *)
IO_Out.Pump1_Running := io_in.Pump1_Running;
IO_Out.Pump2_Running := io_in.Pump2_Running;

(* IMACS Alarm *)
IO_Out.GeneralAlarm_OK := IO_In.OilLevelShutdown_OK AND NOT IO_In.Pump1_Tripped AND NOT IO_In.Pump2_Tripped AND IO_In.externalShutdown_OK;
	
(* IMACS Tripped *)
IO_Out.Pump1_Not_Tripped := NOT IO_In.Pump1_Tripped;
IO_Out.Pump2_Not_Tripped := NOT IO_In.Pump2_Tripped;

(*Logic*)
CheckStartSignals(); // ...start and stop commands.
whichPumpToStart();		// select a pump if a general start signal is received

UpdatePump_1(	(* pumpindex := 1,*)
			running := IO_In.Pump1_Running,
			tripped := IO_In.Pump1_Tripped,
			StartRelay := IO_Out.Pump1_StartCommand,
			StopRelay := IO_Out.Pump1_StopCommand);
			
UpdatePump_2(	(* pumpindex := 2, *)
			running := IO_In.Pump2_Running,
			tripped := IO_In.Pump2_Tripped,
			StartRelay := IO_Out.Pump2_StartCommand,
			StopRelay := IO_Out.Pump2_StopCommand);
			
_HPUstop := FALSE; // turn off


]]></ST>
    </Implementation>
    <Property Name="StopPump1" Id="{0e8475b2-e381-4439-9fe9-796bdbd0864a}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY StopPump1 : bool]]></Declaration>
      <Set Name="Set" Id="{88320044-eb8d-4924-a5f5-5a75ee9b9287}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF StopPump1 THEN
	_PStop[1] := TRUE;	
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
    <Property Name="Pump1_Running" Id="{104a5876-3513-43ac-b26a-11f83e3d2bbf}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY Pump1_Running : BOOL]]></Declaration>
      <Get Name="Get" Id="{475b9144-5ef4-4282-a941-deb60e70d75b}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[Pump1_Running := IO_In.Pump1_Running;]]></ST>
        </Implementation>
      </Get>
    </Property>
    <Property Name="Start" Id="{283d5cec-652a-4370-a0fa-6a7803b2d091}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY Start : bool]]></Declaration>
      <Set Name="Set" Id="{fb6bda4e-1b3d-4152-9e0f-3b27df3c1062}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF  Start THEN
	_HPUstart := TRUE;
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
    <Method Name="updatePump_1" Id="{2c8cfcbf-ee95-00ac-074c-b78f0e36042e}">
      <Declaration><![CDATA[METHOD PROTECTED updatePump_1 : BOOL

VAR_INPUT
	//1 	: UINT;					// 1 or 2
	running 	: BOOL;
	tripped		: BOOL;
	StartRelay	: REFERENCE TO BOOL;	
	StopRelay	: REFERENCE TO BOOL;
END_VAR

VAR_INST
	startupTimer 	: (* ARRAY [1..2] OF *) TON; 	// waiting for run feedback
	startSignalOut	:(* ARRAY [1..2] OF *) TOF;	// for holding start/stop relay
	stopSignalOut	:(* ARRAY [1..2] OF *) TOF;	// for holding start/stop relay
END_VAR

VAR
	
END_VAR

]]></Declaration>
      <Implementation>
        <ST><![CDATA[startupTimer();

// state machine for pump

CASE PumpState1 OF (*Logic*)
	deckPumpState.ESTOP: 	// check for Estop, release to Idle
		IF NOT emergencyStop.Activated THEN
			PumpState1 := deckPumpState.IDLE;
		END_IF
	
	deckPumpState.NOTREADY: // oil level or tripped pump
		IF emergencyStop.Activated THEN
			PumpState1 := deckPumpState.ESTOP;
		ELSE 
			IF IO_In.OilLevelShutdown_OK AND NOT tripped AND io_in.externalShutdown_OK THEN
				PumpState1 := deckPumpState.IDLE;
			END_IF
		END_IF	
		
	deckPumpState.IDLE: 			// Idle to start or to set exception
		IF emergencyStop.Activated THEN
			PumpState1 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT IO_In.externalShutdown_OK THEN
			PumpState1 := deckPumpState.NOTREADY;
		END_IF
		
		IF _PStart[1] THEN
			PumpState1 := deckPumpState.STARTING;
			startupTimer(in := FALSE);							// reset timer
			startupTimer(in := TRUE,Pt := startWaitTime, );		//...and start again
			startSignalOut(IN := TRUE,PT := outputContactTime);	// trigger start signal
		END_IF
		// in case HPU is started locally
		IF running THEN
			PumpState1 := deckPumpState.RUNNING;
		END_IF
		
	deckPumpState.STARTING: // In starting until feedback we are in run.
		IF emergencyStop.Activated THEN
			PumpState1 := deckPumpState.ESTOP;
		END_IF
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			DebugMessage('HPU Pump ','1', ' - Startup failed: Tripped, oil level or External stop');
			PumpState1 := deckPumpState.NOTREADY;
		END_IF
		IF running THEN
			PumpState1 := deckPumpState.RUNNING;
		END_IF
		IF _Pstop[1] OR _HPUstop THEN
			DebugMessage('HPU Pump ','1', ' - Stop signal while starting');
			stopSignalOut(IN := TRUE,PT := outputContactTime);	
			PumpState1 := deckPumpState.STOPPING;
		END_IF
		IF startupTimer.Q THEN				// timeout waiting for start
			DebugMessage('HPU Pump ','1', ' - startup failed : Timeout');
			PumpState1 := deckPumpState.IDLE;
		END_IF
		
	deckPumpState.RUNNING: // In run until stop or exception
		IF emergencyStop.Activated THEN
			PumpState1 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			PumpState1 := deckPumpState.NOTREADY;
			DebugMessage('HPU Pump ','1', ' - Tripped, oil level or External stop');
		END_IF
		
		IF _PStop[1] OR _HPUstop THEN
			PumpState1 := deckPumpState.STOPPING;
			stopSignalOut(IN := TRUE,PT := outputContactTime);				// trigger stop signal
		END_IF
		
		// if turned off locally
		IF NOT running THEN
			PumpState1 := deckPumpState.IDLE;
		END_IF
		
	deckPumpState.STOPPING: // To stop
		IF emergencyStop.Activated THEN
			PumpState1 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			PumpState1 := deckPumpState.NOTREADY;
		END_IF
		
		IF NOT IO_IN.Pump1_Running THEN
			PumpState1 := deckPumpState.IDLE;
		END_IF
		// Starting while stopping
		IF _PStart[1] THEN
			PumpState1 := deckPumpState.STARTING;
			startupTimer(in := FALSE);							// reset timer
			startupTimer(in := TRUE,Pt := startWaitTime, );		//...and start again
			startSignalOut(IN := TRUE,PT := outputContactTime);	// trigger start signal
		END_IF
		// send another stop signal if stop button is pressed
		IF _PStop[1] OR _HPUstop THEN
			stopSignalOut(IN := TRUE,PT := outputContactTime);				
		END_IF
		
END_CASE

StartRelay := startSignalOut.Q AND NOT stopSignalOut.Q ;			// Will stay on for specified time unless stopped
StopRelay  := stopSignalOut.Q;			// Will stay on for specified time.
startSignalOut(IN := FALSE);				// turn off trigger signal
stopSignalOut(IN := FALSE);				// turn off trigger signal

_PStart[1] := FALSE;
_PStop[1] := FALSE;


]]></ST>
      </Implementation>
    </Method>
    <Property Name="StartPump2" Id="{3ee4e388-80e5-4d9f-b258-cafdf2f4d3df}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY StartPump2 : BOOL
]]></Declaration>
      <Set Name="Set" Id="{235921f7-59eb-44e1-8fdb-88a20a5c827d}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF StartPump2 THEN
	_PStart[2] := TRUE;	
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
    <Property Name="StartPump1" Id="{4132f3b5-325b-4074-a860-df7b035a1395}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY StartPump1 : bool]]></Declaration>
      <Set Name="Set" Id="{e51a7011-e908-43cf-ac91-dd90e15395aa}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF StartPump1 THEN
	_PStart[1] := TRUE;	
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
    <Method Name="updatePump_2" Id="{44ddb39a-b303-45bc-a143-a38b0a61bf6e}">
      <Declaration><![CDATA[METHOD PROTECTED updatePump_2 : BOOL

VAR_INPUT
	//2 	: UINT;					// 1 or 2
	running 	: BOOL;
	tripped		: BOOL;
	StartRelay	: REFERENCE TO BOOL;	
	StopRelay	: REFERENCE TO BOOL;
END_VAR

VAR_INST
	startupTimer 	: (* ARRAY [1..2] OF *) TON; 	// waiting for run feedback
	startSignalOut	:(* ARRAY [1..2] OF *) TOF;	// for holding start/stop relay
	stopSignalOut	:(* ARRAY [1..2] OF *) TOF;	// for holding start/stop relay
END_VAR

VAR
	
END_VAR

]]></Declaration>
      <Implementation>
        <ST><![CDATA[startupTimer();


// state machine for pump

CASE PumpState2 OF (*Logic*)
	deckPumpState.ESTOP: 	// check for Estop, release to Idle
		IF NOT emergencyStop.Activated THEN
			PumpState2 := deckPumpState.IDLE;
		END_IF
	
	deckPumpState.NOTREADY: // oil level or tripped pump
		IF emergencyStop.Activated THEN
			PumpState2 := deckPumpState.ESTOP;
		ELSE 
			IF IO_In.OilLevelShutdown_OK AND NOT tripped AND io_in.externalShutdown_OK THEN
				PumpState2 := deckPumpState.IDLE;
			END_IF
		END_IF	
		
	deckPumpState.IDLE: 			// Idle to start or to set exception
		IF emergencyStop.Activated THEN
			PumpState2 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT IO_In.externalShutdown_OK THEN
			PumpState2 := deckPumpState.NOTREADY;
		END_IF
		
		IF _PStart[2] THEN
			PumpState2 := deckPumpState.STARTING;
			startupTimer(in := FALSE);							// reset timer
			startupTimer(in := TRUE,Pt := startWaitTime, );		//...and start again
			startSignalOut(IN := TRUE,PT := outputContactTime);	// trigger start signal
		END_IF
		// in case HPU is started locally
		IF running THEN
			PumpState2 := deckPumpState.RUNNING;
		END_IF
		
	deckPumpState.STARTING: // In starting until feedback we are in run.
		IF emergencyStop.Activated THEN
			PumpState2 := deckPumpState.ESTOP;
		END_IF
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			DebugMessage('HPU Pump ','2', ' - Startup failed: Tripped, oil level or External stop');
			PumpState2 := deckPumpState.NOTREADY;
		END_IF
		IF running THEN
			PumpState2 := deckPumpState.RUNNING;
		END_IF
		IF _Pstop[2] OR _HPUstop THEN
			DebugMessage('HPU Pump ','2', ' - Stop signal while starting');
			stopSignalOut(IN := TRUE,PT := outputContactTime);	
			PumpState2 := deckPumpState.STOPPING;
		END_IF
		IF startupTimer.Q THEN				// timeout waiting for start
			DebugMessage('HPU Pump ','2', ' - startup failed : Timeout');
			PumpState2 := deckPumpState.IDLE;
		END_IF
		
	deckPumpState.RUNNING: // In run until stop or exception
		IF emergencyStop.Activated THEN
			PumpState2 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			PumpState2 := deckPumpState.NOTREADY;
			DebugMessage('HPU Pump ','2', ' - Tripped, oil level or External stop');
		END_IF
		
		IF _PStop[2] OR _HPUstop THEN
			PumpState2 := deckPumpState.STOPPING;
			stopSignalOut(IN := TRUE,PT := outputContactTime);				// trigger stop signal
		END_IF
		
		// if turned off locally
		IF NOT running THEN
			PumpState2 := deckPumpState.IDLE;
		END_IF
		
	deckPumpState.STOPPING: // To stop
		IF emergencyStop.Activated THEN
			PumpState2 := deckPumpState.ESTOP;
		END_IF
		
		IF NOT IO_In.OilLevelShutdown_OK OR tripped OR NOT io_in.externalShutdown_OK THEN
			PumpState2 := deckPumpState.NOTREADY;
		END_IF
		
		IF NOT IO_IN.Pump1_Running THEN
			PumpState2 := deckPumpState.IDLE;
		END_IF
		// Starting while stopping
		IF _PStart[2] THEN
			PumpState2 := deckPumpState.STARTING;
			startupTimer(in := FALSE);							// reset timer
			startupTimer(in := TRUE,Pt := startWaitTime, );		//...and start again
			startSignalOut(IN := TRUE,PT := outputContactTime);	// trigger start signal
		END_IF
		// send another stop signal if stop button is pressed
		IF _PStop[2] OR _HPUstop THEN
			stopSignalOut(IN := TRUE,PT := outputContactTime);				
		END_IF
		
END_CASE

StartRelay := startSignalOut.Q AND NOT stopSignalOut.Q ;			// Will stay on for specified time unless stopped
StopRelay  := stopSignalOut.Q;			// Will stay on for specified time.
startSignalOut(IN := FALSE);				// turn off trigger signal
stopSignalOut(IN := FALSE);				// turn off trigger signal

_PStart[2] := FALSE;
_PStop[2] := FALSE;


]]></ST>
      </Implementation>
    </Method>
    <Method Name="whichPumpToStart" Id="{4b4e4617-72ab-4c5d-a3ee-3cae8806cba2}">
      <Declaration><![CDATA[METHOD PRIVATE whichPumpToStart : BOOL
VAR_INPUT
END_VAR

VAR_INST
	togglePump : bool;
END_VAR]]></Declaration>
      <Implementation>
        <ST><![CDATA[
IF _HPUstart AND _opstate <> P6OpState.NOTAVAILABLE THEN 
	
	IF PumpState1 = deckPumpState.STOPPING  THEN		// Start while stopping
		_PStart[1] := TRUE;
	ELSIF PumpState2 = deckPumpState.STOPPING  THEN	// Start while stopping
		_PStart[2] := TRUE;
	ELSIF PumpState2 = deckPumpState.NOTREADY THEN	// other pump tripped
		_PStart[1] := TRUE;
	ELSIF PumpState1 = deckPumpState.NOTREADY THEN 	// other pump tripped
		_PStart[2] := TRUE;
	ELSIF PumpState1 = deckPumpState.IDLE AND PumpState2 = deckPumpState.IDLE THEN		// normal cold start
		IF togglePump THEN
			_PStart[1] := TRUE;
		ELSE
			_PStart[2] := TRUE;
		END_IF
		togglePump := NOT togglePump;					// start other pump next time....
	END_IF
	
END_IF
_HPUstart := FALSE;

]]></ST>
      </Implementation>
    </Method>
    <Property Name="opState" Id="{70d00523-6211-4c42-81c8-3228220d96b0}">
      <Declaration><![CDATA[{attribute 'monitoring' := 'call'}
{attribute 'TcRpcEnable'}
PROPERTY opState : p7type.P6OpState
]]></Declaration>
      <Get Name="Get" Id="{b303e5cd-5470-42d6-bd53-9a12ec08965e}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[opState := THIS^._opState;]]></ST>
        </Implementation>
      </Get>
    </Property>
    <Property Name="state" Id="{94620ca1-e35e-4ac7-aefa-d25b642b20cf}">
      <Declaration><![CDATA[{attribute 'monitoring' := 'call'}
{attribute 'TcRpcEnable'}
PROPERTY state : SlackWireSM]]></Declaration>
      <Get Name="Get" Id="{fb7de7b8-8410-4d88-8886-0130ad453538}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[//state := _state;]]></ST>
        </Implementation>
      </Get>
    </Property>
    <Property Name="Pump2_Running" Id="{aeb68334-1a0c-4ef0-b2a3-4468ab82fcaf}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY Pump2_Running : BOOL]]></Declaration>
      <Get Name="Get" Id="{94f2abd3-4855-4198-b7ea-b310d065252d}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[Pump2_Running := IO_In.Pump2_Running;]]></ST>
        </Implementation>
      </Get>
    </Property>
    <Property Name="StopPump2" Id="{c370ecee-8602-49eb-9bca-d3ea0b7f5e98}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY StopPump2 : bool]]></Declaration>
      <Set Name="Set" Id="{4cfcaabe-431d-4ca1-b170-7e92db9ad6eb}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF StopPump2 THEN
	_PStop[2] := TRUE;	
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
    <Method Name="updateAlarms" Id="{cc7bf6d7-6e01-4d66-8f7a-1b0e2bcc3a12}">
      <Declaration><![CDATA[METHOD PRIVATE updateAlarms : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
      <Implementation>
        <ST><![CDATA[(*
Alarm class 012
CRANEHPU_EXTERNAL_SHUTDOWN          012014 (local)
CRANEHPU_OIL_LEVEL_SHUTDOWN			012015 (local)
 CRANEHPU_TEMPERATURE_ERROR			012011	Temperature too high (power lib)
 CRANEHPU_OVERLOAD					012012	Motor protection switched motor off. (power lib)
 CRANEHPU_LEVELSWITCH_ERROR			012007	oil level low (power lib)

 
*)

oilTempWarning	(ID :=0,IDName :='CraneHPU',Value := NOT io_in.OilTemp_OK,TimeSpan := T#2S);
motor1Overload	(ID :=1,IDName :='Motor 1',	Value := io_in.Pump1_Tripped, TimeSpan := T#1S);
motor2Overload	(ID :=2,IDName :='motor 2',	Value := io_in.Pump2_Tripped ,TimeSpan := T#1S);
oilLevelWarning	(ID :=0,IDName :='CraneHPU',Value := io_in.OilLevelWarning,TimeSpan := T#2S);
oilLevelShutdown(ID :=0,IDName :='CraneHPU',Value := NOT io_in.OilLevelShutdown_OK,TimeSpan := T#1S);
externalShutdown(ID :=0,IDName :='CraneHPU',Value := NOT io_in.externalShutdown_OK,TimeSpan := T#1S);
]]></ST>
      </Implementation>
    </Method>
    <Method Name="CheckStartSignals" Id="{d906f6bf-c18a-4c79-82f4-7dd49f1e48dc}">
      <Declaration><![CDATA[METHOD PRIVATE CheckStartSignals : BOOL
VAR_INPUT
END_VAR

VAR_INST
	trigger1 : r_trig;
	trigger2 : r_trig;
	trigger3 : r_trig;
	trigger4 : r_trig;
END_VAR]]></Declaration>
      <Implementation>
        <ST><![CDATA[TRIGGER1(clk:= IO_In.Pump1_StartRequest);
TRIGGER2(clk:= IO_In.Pump2_StartRequest);
TRIGGER3(clk:= IO_In.Pump1_StopRequest);
TRIGGER4(clk:= IO_In.Pump2_StopRequest);

//SEL (Condition, FALSE, TRUE)
_PStart[1] := SEL(TRIGGER1.Q,_PStart[1],TRUE);	// set high if triggered
_PStart[2] := SEL(TRIGGER2.Q,_PStart[2],TRUE);	// set high if triggered
_PStop[1] := SEL(TRIGGER3.Q,_PStop[1],TRUE);	// set high if triggered
_PStop[2] := SEL(TRIGGER4.Q,_PStop[2],TRUE);	// set high if triggered

StartPump1 := FALSE;


	]]></ST>
      </Implementation>
    </Method>
    <Property Name="Stop" Id="{e6150b17-d82c-4265-9b71-15226f09c897}">
      <Declaration><![CDATA[{attribute 'TcRpcEnable'}
{attribute 'monitoring' := 'call'}
PROPERTY Stop : bool]]></Declaration>
      <Set Name="Set" Id="{03246f30-3b8d-49e9-b6c6-4cead58003bd}">
        <Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
        <Implementation>
          <ST><![CDATA[IF Stop THEN
	_HPUstop := TRUE;
END_IF
]]></ST>
        </Implementation>
      </Set>
    </Property>
  </POU>
</TcPlcObject>