60 lines
1.8 KiB
XML
60 lines
1.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1">
|
|
<POU Name="FB_HVTest" Id="{b3445d38-3c32-4973-bf63-429552f0da50}" SpecialFunc="None">
|
|
<Declaration><![CDATA[FUNCTION_BLOCK FB_HVTest EXTENDS FB_BaseStation
|
|
VAR_INPUT
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
END_VAR
|
|
VAR
|
|
_iState : INT;
|
|
_tonProcessDuration : TON;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE _iState OF
|
|
// Wait for product
|
|
0:
|
|
IF _iFlowRecIdx <> -1 THEN
|
|
_xDone := FALSE;
|
|
_xBusy := TRUE;
|
|
_iState := 10;
|
|
END_IF
|
|
|
|
// Simulate process
|
|
10:
|
|
_tonProcessDuration(IN := TRUE, PT := T#10S);
|
|
IF _tonProcessDuration.Q THEN
|
|
_tonProcessDuration(IN := FALSE);
|
|
fbFlowRecHandler.M_ReportResult(iIdx := _iFlowRecIdx, xResult := TRUE);
|
|
_xProdAvail := TRUE;
|
|
_xBusy := FALSE;
|
|
_xDone := TRUE;
|
|
_iState := 20;
|
|
END_IF
|
|
|
|
// Wait for station to be empty again
|
|
20:
|
|
IF _iFlowRecIdx = -1 THEN
|
|
_iState := 0;
|
|
END_IF
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
<Method Name="FB_Init" Id="{c40e1a0c-0b45-4ca1-a647-10e90c1b54ce}">
|
|
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
|
|
//The return value is not evaluated. For a specific influence, you can also declare the
|
|
//methods explicitly and provide additional code there with the standard initialization
|
|
//code. You can evaluate the return value.
|
|
METHOD FB_Init: BOOL
|
|
VAR_INPUT
|
|
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
|
|
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Set station capabilities
|
|
_dwCapabilities := 16#0002;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
</POU>
|
|
</TcPlcObject> |