First version Tray Feeder ready for test

- Tray feeder implementation ready for first tests
- Some refactoring of packml function names
- Added .xtv file to project again because of linking issues
- Added hmi button for packml complete command
- Started media cabinet
This commit is contained in:
2026-03-03 14:11:58 +01:00
parent dbfa6fc7cc
commit 0ea0887bb4
17 changed files with 4430 additions and 486 deletions

View File

@@ -7,6 +7,9 @@ VAR_INPUT
xConfirmAlarms : BOOL;
END_VAR
VAR_OUTPUT
xBusy : BOOL;
xDone : BOOL;
xError : BOOL;
END_VAR
VAR_IN_OUT
stHMIInterface : ST_HMI_TrayFeeder;
@@ -19,6 +22,21 @@ VAR
_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>
@@ -37,8 +55,15 @@ _fbProtocolHandler(
xError=> );
// Call isa88 base state machine
SUPER^(stPackMLHMIInterface := stHMIInterface.stStationCmds);]]></ST>
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
@@ -58,66 +83,21 @@ _sIpAddr := sIPAddr;
_udiPort := udiPort;
// Config state machine
_stSMConfig.xStartingDisabled := TRUE;
_stSMConfig.xStoppingDisabled := TRUE;
_stSMConfig.xAbortingDisabled := TRUE;
_stSMConfig.xCompletingDisabled := TRUE;
_stSMConfig.xCompletedDisabled := TRUE;
_stSMConfig.xHeldDisabled := TRUE;
_stSMConfig.xSuspendingDisabled := TRUE;
_stSMConfig.xUnsuspendingDisabled := TRUE;
_stSMConfig.xHoldingDisabled := TRUE;
_stSMConfig.xUnholdingDisabled := TRUE;
_stSMConfig.xSuspededDisabled := TRUE;
_stSMConfig.xAbortingDisabled := TRUE;]]></ST>
_stSMConfig.xCompletedDisabled := TRUE;
]]></ST>
</Implementation>
</Method>
<Method Name="M_Clearing" Id="{c748d77d-f0af-4f18-845f-a10049447b5b}">
<Declaration><![CDATA[METHOD PROTECTED M_Clearing]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _iSSM OF
// Request feeder status
0:
_fbProtocolHandler.M_SendCmd('STAT-FEED:');
_iSSM := 10;
// Await response
10:
IF (NOT _fbProtocolHandler.xBusy) THEN
_iSSM := 40;
END_IF
40:
M_StateComplete();
END_CASE]]></ST>
</Implementation>
</Method>
<Method Name="M_Execute" Id="{615f393e-f45c-4e99-890d-36c504a262b8}">
<Declaration><![CDATA[METHOD PROTECTED M_Execute
]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _iSSM OF
0:
IF _fbProtocolHandler.M_SendCmd('TRAY-FEED:') THEN
_iSSM := 10;
ELSE
_eCmd := E_PackMLCmd.STOP;
END_IF
10:
IF (NOT _fbProtocolHandler.xBusy) AND (NOT _fbProtocolHandler.xError) THEN
_iSSM := 20;
END_IF
IF _fbProtocolHandler.xError THEN
_eCmd := E_PackMLCmd.STOP;
END_IF
20:
IF _fbProtocolHandler.stStatus.xInPickPosition THEN
_eCmd := E_PackMLCmd.COMPLETE;
END_IF
END_CASE]]></ST>
</Implementation>
</Method>
<Method Name="M_Resetting" Id="{d821c17b-c2d1-4267-b49d-1f82be218ca5}">
<Declaration><![CDATA[METHOD PROTECTED M_Resetting
<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>
@@ -128,7 +108,8 @@ END_VAR]]></Declaration>
IF _fbProtocolHandler.xConnected THEN
_iSSM := 10;
ELSE
_eCmd := E_PackMLCmd.STOP;
// Goto error state
_iSSM := 90;
END_IF
// Send reset command
@@ -136,7 +117,8 @@ END_VAR]]></Declaration>
IF _fbProtocolHandler.M_SendCmd('SYST-RESE:') THEN
_iSSM := 20;
ELSE
_eCmd := E_PackMLCmd.STOP;
// Goto error state
_iSSM := 90;
END_IF
// Wait for reset command to be finished
@@ -147,7 +129,8 @@ END_VAR]]></Declaration>
END_IF
IF _fbProtocolHandler.xError THEN
_eCmd := E_PackMLCmd.STOP;
// Goto error state
_iSSM := 90;
END_IF
30:
@@ -167,7 +150,136 @@ END_VAR]]></Declaration>
// 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>