Aligner ======= - Fixed Aligner during resetting with library update to 1.3.4 - Added Vacuum valve to HMI Etcher ====== - Added Vacuum valve to HMI TrayFeeder ========== - Fixed a bug in protocoll parsing - Added automatic reconnect tries to protocoll handler - Added buttons to hmi interface for tray feeding and unloading
287 lines
7.2 KiB
XML
287 lines
7.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1">
|
|
<POU Name="FB_TrayFeeder" Id="{e2e3e993-37de-42b1-80e1-7dba99a66e94}" SpecialFunc="None">
|
|
<Declaration><![CDATA[FUNCTION_BLOCK FINAL FB_TrayFeeder EXTENDS FB_PackMLGeneric
|
|
VAR_INPUT
|
|
xReleaseAlarms : BOOL;
|
|
xConfirmAlarms : BOOL;
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
xBusy : BOOL;
|
|
xDone : BOOL;
|
|
xError : BOOL;
|
|
END_VAR
|
|
VAR_IN_OUT
|
|
stHMIInterface : ST_HMI_TrayFeeder;
|
|
END_VAR
|
|
VAR
|
|
_sIpAddr : STRING(15);
|
|
_udiPort : UDINT;
|
|
|
|
_sResponse : STRING(255);
|
|
|
|
_fbProtocolHandler : FB_TFProtocol;
|
|
_xConnect : BOOL := TRUE;
|
|
|
|
// Execute command flags
|
|
_xFeedNextTray : BOOL;
|
|
|
|
// Tray feed params
|
|
_iNextTray : INT := -1;
|
|
|
|
// Ouput buffer
|
|
_xBusy : BOOL;
|
|
_xDone : BOOL;
|
|
_xError : BOOL;
|
|
END_VAR
|
|
VAR CONSTANT
|
|
MIN_TRAY_INDEX : INT := 1;
|
|
MAX_TRAY_INDEX : INT := 18;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// IPs
|
|
// 192.168.1.10
|
|
// 192.168.1.11
|
|
_fbProtocolHandler(
|
|
sIpAddr:= _sIpAddr,
|
|
udiPort:= _udiPort,
|
|
xConnect := _xConnect,
|
|
xReleaseAlarms := xReleaseAlarms,
|
|
xConfirmAlarms:= xConfirmAlarms,
|
|
xConnected=> ,
|
|
xNewResponseReady=> ,
|
|
xBusy=> ,
|
|
xError=> );
|
|
|
|
// Call isa88 base state machine
|
|
SUPER^(stPackMLHMIInterface := stHMIInterface.stStationCmds);
|
|
|
|
// Copy output buffer to output
|
|
xBusy := _xBusy;
|
|
xDone := _xDone;
|
|
xError := _xError;]]></ST>
|
|
</Implementation>
|
|
<Folder Name="Commands" Id="{d13eb874-134c-4022-b2e9-6079a2e962f7}" />
|
|
<Folder Name="States" Id="{e8ab6d03-ac10-44ac-b36d-f343f7404100}" />
|
|
<Method Name="FB_init" Id="{6c7048d9-3836-4289-b5f3-f8878267494f}">
|
|
<Declaration><![CDATA[//FB_Init ist immer implizit verfügbar und wird primär für die Initialisierung verwendet.
|
|
//Der Rückgabewert wird nicht ausgewertet. Für gezielte Einflussnahme können Sie
|
|
//die Methoden explizit deklarieren und darin mit dem Standard-Initialisierungscode
|
|
//zusätzlichen Code bereitstellen. Sie können den Rückgabewert auswerten.
|
|
METHOD FB_Init: BOOL
|
|
VAR_INPUT
|
|
bInitRetains: BOOL; // TRUE: Die Retain-Variablen werden initialisiert (Reset warm / Reset kalt)
|
|
bInCopyCode: BOOL; // TRUE: Die Instanz wird danach in den Kopiercode kopiert (Online-Change)
|
|
|
|
sIPAddr : STRING(15);
|
|
udiPort : UDINT;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Save connection settings
|
|
_sIpAddr := sIPAddr;
|
|
_udiPort := udiPort;
|
|
|
|
// Config state machine
|
|
_stSMConfig.xStartingDisabled := TRUE;
|
|
_stSMConfig.xStoppingDisabled := TRUE;
|
|
_stSMConfig.xAbortingDisabled := TRUE;
|
|
_stSMConfig.xCompletingDisabled := TRUE;
|
|
_stSMConfig.xSuspendingDisabled := TRUE;
|
|
_stSMConfig.xUnsuspendingDisabled := TRUE;
|
|
_stSMConfig.xHoldingDisabled := TRUE;
|
|
_stSMConfig.xUnholdingDisabled := TRUE;
|
|
_stSMConfig.xSuspededDisabled := TRUE;
|
|
_stSMConfig.xCompletedDisabled := TRUE;
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Clearing" Id="{c748d77d-f0af-4f18-845f-a10049447b5b}" FolderPath="States\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Clearing
|
|
VAR_INST
|
|
_tonReconnect : TON;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE _iSSM OF
|
|
// Check state of connection
|
|
0:
|
|
IF _fbProtocolHandler.xConnected THEN
|
|
_iSSM := 10;
|
|
ELSE
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
// Send reset command
|
|
10:
|
|
IF _fbProtocolHandler.M_SendCmd('SYST-RESE:') THEN
|
|
_iSSM := 20;
|
|
ELSE
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
// Wait for reset command to be finished
|
|
20:
|
|
IF (NOT _fbProtocolHandler.xBusy) AND (NOT _fbProtocolHandler.xError) THEN
|
|
//_xConnect := FALSE;
|
|
_iSSM := 30;
|
|
END_IF
|
|
|
|
IF _fbProtocolHandler.xError THEN
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
30:
|
|
_tonReconnect(IN := TRUE, PT := T#5S);
|
|
|
|
IF _tonReconnect.Q THEN
|
|
_tonReconnect(IN := FALSE, PT := T#5S);
|
|
_xConnect := TRUE;
|
|
_iSSM := 40;
|
|
END_IF
|
|
|
|
35:
|
|
// Wait for reset message
|
|
IF _fbProtocolHandler.stStatus.eState <> E_TrayFeederState.HOLD THEN
|
|
_iSSM := 40;
|
|
END_IF
|
|
|
|
// Check tray feeder status
|
|
40:
|
|
_xError := FALSE;
|
|
_xBusy := FALSE;
|
|
_xDone := TRUE;
|
|
M_StateComplete();
|
|
|
|
// Error state
|
|
90:
|
|
_xError := TRUE;
|
|
_xDone := FALSE;
|
|
_xBusy := FALSE;
|
|
M_CmdAbort();
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_CmdFeedNextTray" Id="{265f9335-abc0-4f81-922d-74061b2b7735}" FolderPath="Commands\">
|
|
<Declaration><![CDATA[METHOD M_CmdFeedNextTray : BOOL
|
|
VAR_INPUT
|
|
iTrayNr : INT := -1;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.EXECUTE) AND (NOT _xBusy) THEN
|
|
_xFeedNextTray := TRUE;
|
|
_xDone := FALSE;
|
|
_xBusy := TRUE;
|
|
M_CmdFeedNextTray := TRUE;
|
|
ELSE
|
|
M_CmdFeedNextTray := FALSE;
|
|
END_IF]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Execute" Id="{615f393e-f45c-4e99-890d-36c504a262b8}" FolderPath="States\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Execute
|
|
VAR
|
|
_xResult : BOOL;
|
|
_sTemp : STRING(18);
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE _iSSM OF
|
|
// Feed new tray if we still need to produce parts
|
|
0:
|
|
IF _xFeedNextTray THEN
|
|
_xFeedNextTray := FALSE;
|
|
_iSSM := 10;
|
|
END_IF
|
|
|
|
// Goto held state if door is opened
|
|
IF _fbProtocolHandler.stStatus.xDoorOpen THEN
|
|
M_CmdHold();
|
|
END_IF
|
|
|
|
// Choose to feed next tray or specific tray number
|
|
10:
|
|
// Feed next tray
|
|
IF _iNextTray < MIN_TRAY_INDEX THEN
|
|
_xResult := _fbProtocolHandler.M_SendCmd('TRAY-FEED:');
|
|
ELSIF _iNextTray <= MAX_TRAY_INDEX THEN
|
|
// Cmd: 'TRAY-FEED:Tray=[1..18];'
|
|
_sTemp := 'TRAY-FEED:Tray=';
|
|
_sTemp := CONCAT(_sTemp, INT_TO_STRING(_iNextTray));
|
|
_sTemp := CONCAT(_sTemp, ';');
|
|
_xResult := _fbProtocolHandler.M_SendCmd(_sTemp);
|
|
ELSE
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
// Check command result
|
|
IF _xResult THEN
|
|
_iSSM := 20;
|
|
ELSE
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
// Wait for command to be handled
|
|
20:
|
|
IF (NOT _fbProtocolHandler.xBusy) AND (NOT _fbProtocolHandler.xError) THEN
|
|
_xBusy := FALSE;
|
|
_xDone := TRUE;
|
|
_iSSM := 0;
|
|
END_IF
|
|
|
|
IF _fbProtocolHandler.xError THEN
|
|
// Goto error state
|
|
_iSSM := 90;
|
|
END_IF
|
|
|
|
// Error occured
|
|
90:
|
|
_xDone := FALSE;
|
|
_xBusy := FALSE;
|
|
_xError := TRUE;
|
|
M_CmdAbort();
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Held" Id="{5480e446-8eb4-4576-8bbd-9839c54f1c69}" FolderPath="States\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Held
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Unhold if door is closed
|
|
IF (NOT _fbProtocolHandler.stStatus.xDoorOpen) THEN
|
|
M_CmdUnhold();
|
|
END_IF]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Resetting" Id="{d821c17b-c2d1-4267-b49d-1f82be218ca5}" FolderPath="States\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Resetting
|
|
VAR_INST
|
|
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE _iSSM OF
|
|
// Unload tray and move elevator to load position
|
|
0:
|
|
_fbProtocolHandler.M_SendCmd('ELEV-UNLO:');
|
|
_iSSM := 10;
|
|
|
|
// Await response
|
|
10:
|
|
// If cmd could be executed we are done here
|
|
IF (NOT _fbProtocolHandler.xBusy) THEN
|
|
M_StateComplete();
|
|
END_IF
|
|
|
|
// On error go to abort state
|
|
IF _fbProtocolHandler.xError THEN
|
|
M_CmdAbort();
|
|
END_IF
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
</POU>
|
|
</TcPlcObject> |