Some improvements and fixes
- Added robot schift params for aligning etcher 1 position - Added HMI Interface to robot fb - Added machine LED's at main cabinet - Aligner now works in auto mode - Added HMI interface to etcher station - Added cReleaseAlarms to HeatCoolPlates - Added HMI interface to HVTester - STarted tray feeder response parsing - Fixed some packml base state machine bugs
This commit is contained in:
17
PLC/01_Stationen/TrayFeeder/E_TFInputStackState.TcDUT
Normal file
17
PLC/01_Stationen/TrayFeeder/E_TFInputStackState.TcDUT
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="E_TFInputStackState" Id="{116af561-bb7d-4305-a2c0-a49c88c2ea9c}">
|
||||
<Declaration><![CDATA[{attribute 'qualified_only'}
|
||||
{attribute 'strict'}
|
||||
{attribute 'to_string'}
|
||||
TYPE E_TFInputStackState :
|
||||
(
|
||||
UNDEFINED := 0,
|
||||
EMTPY,
|
||||
NO_MAGAZINE,
|
||||
ALMOST_EMPTY
|
||||
);
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
16
PLC/01_Stationen/TrayFeeder/E_TrayFeederState.TcDUT
Normal file
16
PLC/01_Stationen/TrayFeeder/E_TrayFeederState.TcDUT
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="E_TrayFeederState" Id="{daeef904-23f3-4403-9629-33fc3b92cc18}">
|
||||
<Declaration><![CDATA[{attribute 'qualified_only'}
|
||||
{attribute 'strict'}
|
||||
{attribute 'to_string'}
|
||||
TYPE E_TrayFeederState :
|
||||
(
|
||||
HOLD := 0,
|
||||
LOAD_POS,
|
||||
FEED_POS,
|
||||
BUSY
|
||||
);
|
||||
END_TYPE]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
51
PLC/01_Stationen/TrayFeeder/FB_StringRingbufferOwn.TcPOU
Normal file
51
PLC/01_Stationen/TrayFeeder/FB_StringRingbufferOwn.TcPOU
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_StringRingbufferOwn" Id="{b0c904f8-c254-4be5-aa41-60a384fcb4a2}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_StringRingbufferOwn
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
xHasData : BOOL;
|
||||
xFull : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_asBuffer : ARRAY[0..BUFFER_SIZE-1] OF STRING(255);
|
||||
_uiWriteIdx : UINT := 0;
|
||||
_uiReadIdx : UINT := 0;
|
||||
_uiCount : UINT := 0;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
BUFFER_SIZE : UINT := 10;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Write outputs
|
||||
xHasData := (_uiCount > 0);
|
||||
xFull := (_uiCount >= BUFFER_SIZE);]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_ReadData" Id="{2d123e62-f6df-4eb9-a215-009779534bc5}">
|
||||
<Declaration><![CDATA[METHOD M_ReadData : STRING(255)
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_WriteData" Id="{dc0dd3d7-badb-4886-8590-850ff7625fa1}">
|
||||
<Declaration><![CDATA[METHOD M_WriteData
|
||||
VAR_INPUT
|
||||
sData : STRING(255);
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Check if buffer is full
|
||||
IF _uiCount < BUFFER_SIZE THEN
|
||||
_asBuffer[_uiWriteIdx] := sData;
|
||||
_uiWriteIdx := (_uiWriteIdx + 1) MOD BUFFER_SIZE;
|
||||
_uiCount := _uiCount + 1;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -5,12 +5,13 @@
|
||||
VAR_INPUT
|
||||
sIpAddr : STRING(15);
|
||||
udiPort : UDINT;
|
||||
|
||||
xConnect : BOOL := TRUE;
|
||||
xReleaseAlarms : BOOL;
|
||||
xConfirmAlarms : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
stStatus : ST_TrayFeederStatus;
|
||||
xConnected : BOOL;
|
||||
|
||||
xNewResponseReady : BOOL;
|
||||
xBusy : BOOL;
|
||||
xError : BOOL;
|
||||
@@ -19,7 +20,6 @@ VAR
|
||||
// Connection settings
|
||||
_fbTcpConnection : FB_ClientServerConnection;
|
||||
_hSocket : T_HSOCKET;
|
||||
_xConnect : BOOL := TRUE;
|
||||
_xConnected : BOOL;
|
||||
|
||||
// Socket send
|
||||
@@ -29,20 +29,23 @@ VAR
|
||||
|
||||
// Socket receive
|
||||
_fbSocketReceive : FB_SocketReceive;
|
||||
_timReceiveTimeout : TIME := T#5S;
|
||||
_timReceiveTimeout : TIME := T#1M;
|
||||
_abyReceivedBuffer : ARRAY[0..100] OF BYTE;
|
||||
_sReceivedResponse : STRING(255);
|
||||
_udiResponseLength : UDINT;
|
||||
_udiReceivedBytes : UDINT;
|
||||
_timPollingTime : TIME := T#1S;
|
||||
_timPollingTime : TIME := T#100MS;
|
||||
_tonPollTimer : TON;
|
||||
_xEnableReceiveTimeout : BOOL;
|
||||
_timReceiveTimeoutTime : TIME := T#5S;
|
||||
_timReceiveResponseTimeout : TIME := T#5S;
|
||||
_tonReceiveTimeout : TON;
|
||||
|
||||
// Receive state machine
|
||||
_iStateReceive : INT;
|
||||
|
||||
// Command parser
|
||||
_fbParser : FB_TrayFeederParser;
|
||||
|
||||
// Command data
|
||||
_uiCmdId : UINT := 1;
|
||||
_sCmd : STRING(255);
|
||||
@@ -58,7 +61,15 @@ VAR
|
||||
_xReceivedResponseOk : BOOL;
|
||||
_uiReceivedCommandId : UINT;
|
||||
|
||||
// Alarms
|
||||
_fbWrongCmdIdAck : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.WrongCmdIdAck, xWithConfirmation := TRUE);
|
||||
_fbResponseNotOk : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.ReceivedResponseNotOk, xWithConfirmation := TRUE);
|
||||
_fbWrongResponseIndicator : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.WrongResponseIndicator, xWithConfirmation := TRUE);
|
||||
_fbSocketReadError : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.SocketReadError, xWithConfirmation := TRUE);
|
||||
_fbSocketWriteError : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.SocketWriteError, xWithConfirmation := TRUE);
|
||||
|
||||
// Buffer before output
|
||||
_sResponse : STRING(255);
|
||||
_xBusy : BOOL;
|
||||
_xError : BOOL;
|
||||
END_VAR
|
||||
@@ -75,7 +86,7 @@ _fbTcpConnection(
|
||||
nMode:= ,
|
||||
sRemoteHost:= sIpAddr,
|
||||
nRemotePort:= udiPort,
|
||||
bEnable:= _xConnect,
|
||||
bEnable:= xConnect,
|
||||
tReconnect:= T#2S,
|
||||
bBusy=> ,
|
||||
bError=> ,
|
||||
@@ -87,7 +98,7 @@ _fbTcpConnection(
|
||||
_xConnected := (_fbTcpConnection.eState = E_SocketConnectionState.eSOCKET_CONNECTED);
|
||||
|
||||
// Receive timeout after sending a command
|
||||
_tonReceiveTimeout(IN := _xEnableReceiveTimeout, PT := _timReceiveTimeoutTime);
|
||||
_tonReceiveTimeout(IN := _xEnableReceiveTimeout, PT := _timReceiveResponseTimeout);
|
||||
|
||||
// Receive state machine
|
||||
CASE _iStateReceive OF
|
||||
@@ -121,12 +132,12 @@ CASE _iStateReceive OF
|
||||
ELSE
|
||||
_iStateReceive := 15;
|
||||
END_IF
|
||||
|
||||
END_IF
|
||||
|
||||
// If we have an error, check if we are connected
|
||||
IF _fbSocketReceive.bError THEN
|
||||
_fbSocketReceive(bExecute := FALSE);
|
||||
_fbSocketReadError.xActive := TRUE;
|
||||
_iStateReceive := 0;
|
||||
END_IF
|
||||
|
||||
@@ -148,7 +159,8 @@ CASE _iStateReceive OF
|
||||
|
||||
// Check received data
|
||||
20:
|
||||
// Check if received command is complete
|
||||
// Get command
|
||||
MEMSET(destAddr := ADR(_sReceivedResponse), fillByte := 0, n := SIZEOF(_sReceivedResponse));
|
||||
MEMCPY(destAddr := ADR(_sReceivedResponse), srcAddr := ADR(_abyReceivedBuffer), n := _udiReceivedBytes);
|
||||
_udiResponseLength := _udiReceivedBytes;
|
||||
_udiReceivedBytes := 0;
|
||||
@@ -157,6 +169,14 @@ CASE _iStateReceive OF
|
||||
// Go back to polling wait state
|
||||
_iStateReceive := 15;
|
||||
|
||||
// Error
|
||||
90:
|
||||
_xError := TRUE;
|
||||
|
||||
IF xConfirmAlarms THEN
|
||||
_fbSocketReadError.xActive := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
ELSE
|
||||
;
|
||||
END_CASE
|
||||
@@ -179,6 +199,7 @@ _xRunSMAgain := FALSE;
|
||||
|
||||
IF _xSendCmd THEN
|
||||
_xSendCmd := FALSE;
|
||||
_xCmdReceived := FALSE;
|
||||
_xBusy := TRUE;
|
||||
_iState := 20;
|
||||
END_IF
|
||||
@@ -211,6 +232,7 @@ _xRunSMAgain := FALSE;
|
||||
|
||||
IF _fbSocketSend.bError THEN
|
||||
_fbSocketSend(bExecute := FALSE);
|
||||
_fbSocketWriteError.xActive := TRUE;
|
||||
_iState := 90;
|
||||
END_IF
|
||||
|
||||
@@ -245,13 +267,15 @@ _xRunSMAgain := FALSE;
|
||||
// Check for cmd id
|
||||
IF (_sReceivedResponse[0] <> UINT_TO_BYTE(_uiCmdId+16#30)) THEN
|
||||
// Wrong command id received
|
||||
_iState := 900;
|
||||
_fbWrongCmdIdAck.xActive := TRUE;
|
||||
_iState := 90;
|
||||
END_IF
|
||||
|
||||
// For for response indicator
|
||||
IF _sReceivedResponse[1] <> F_ToASC('<') THEN
|
||||
// Wrong response indicator
|
||||
_iState := 901;
|
||||
_fbResponseNotOk.xActive := TRUE;
|
||||
_iState := 90;
|
||||
END_IF
|
||||
|
||||
// Check for correct cmd
|
||||
@@ -267,11 +291,18 @@ _xRunSMAgain := FALSE;
|
||||
_xBusy := FALSE;
|
||||
_iState := 10;
|
||||
ELSE
|
||||
_iState := 902;
|
||||
_fbResponseNotOk.xActive := TRUE;
|
||||
_iState := 90;
|
||||
END_IF
|
||||
|
||||
// Got command from tray feeder which needs to be acknowledged
|
||||
50:
|
||||
IF _sReceivedResponse[1] <> F_ToASC('<') THEN
|
||||
xNewResponseReady := TRUE;
|
||||
MEMSET(ADR(_sResponse), 0, n := SIZEOF(_sResponse));
|
||||
MEMCPY(destAddr := ADR(_sResponse), srcAddr := ADR(_sReceivedResponse)+1, n := _udiResponseLength-1);
|
||||
END_IF
|
||||
|
||||
// Copy first 11 bytes
|
||||
FOR _diCounter := 0 TO 10 DO
|
||||
_sAck[_diCounter] := _sReceivedResponse[_diCounter];
|
||||
@@ -285,15 +316,14 @@ _xRunSMAgain := FALSE;
|
||||
// Get command id
|
||||
_uiReceivedCommandId := _sReceivedResponse[0] - 16#30;
|
||||
_xRunSMAgain := TRUE;
|
||||
_iState := 60;
|
||||
_iState := 70;
|
||||
ELSE
|
||||
_xRunSMAgain := TRUE;
|
||||
_iState := 10;
|
||||
END_IF
|
||||
|
||||
|
||||
// Send ack response
|
||||
60:
|
||||
70:
|
||||
// Ack is always 11 bytes long (11 characters)
|
||||
_fbSocketSend(
|
||||
sSrvNetId:= '',
|
||||
@@ -310,7 +340,7 @@ _xRunSMAgain := FALSE;
|
||||
_fbSocketSend(bExecute := FALSE);
|
||||
_xEnableReceiveTimeout := TRUE;
|
||||
_xBusy := FALSE;
|
||||
_iState := 10;
|
||||
_iState := 80;
|
||||
END_IF
|
||||
|
||||
IF _fbSocketSend.bError THEN
|
||||
@@ -318,6 +348,13 @@ _xRunSMAgain := FALSE;
|
||||
_iState := 90;
|
||||
END_IF
|
||||
|
||||
// Parse response
|
||||
80:
|
||||
_xRunSMAgain := TRUE;
|
||||
_fbParser.M_ParseCmd(_sResponse);
|
||||
stStatus := _fbParser.stStatus;
|
||||
_iState := 10;
|
||||
|
||||
// Error
|
||||
90:
|
||||
_xError := TRUE;
|
||||
@@ -326,6 +363,10 @@ _xRunSMAgain := FALSE;
|
||||
IF xConfirmAlarms THEN
|
||||
_xError := FALSE;
|
||||
_uiRetries := 0;
|
||||
_fbWrongCmdIdAck.xActive := FALSE;
|
||||
_fbResponseNotOk.xActive := FALSE;
|
||||
_fbWrongResponseIndicator.xActive := FALSE;
|
||||
_fbSocketWriteError.xActive := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -335,11 +376,43 @@ _xRunSMAgain := FALSE;
|
||||
UNTIL (NOT _xRunSMAgain)
|
||||
END_REPEAT
|
||||
|
||||
// Handle alarms
|
||||
_fbWrongCmdIdAck(
|
||||
xRelease:= xReleaseAlarms,
|
||||
xAcknowledge:= xConfirmAlarms);
|
||||
|
||||
_fbResponseNotOk(
|
||||
xRelease:= xReleaseAlarms,
|
||||
xAcknowledge:= xConfirmAlarms);
|
||||
|
||||
_fbWrongResponseIndicator(
|
||||
xRelease:= xReleaseAlarms,
|
||||
xAcknowledge:= xConfirmAlarms);
|
||||
|
||||
_fbSocketReadError(
|
||||
xRelease:= xReleaseAlarms,
|
||||
xAcknowledge:= xConfirmAlarms);
|
||||
|
||||
_fbSocketWriteError(
|
||||
xRelease:= xReleaseAlarms,
|
||||
xAcknowledge:= xConfirmAlarms);
|
||||
|
||||
// Copy output buffers to outputs
|
||||
stStatus := _fbParser.stStatus;
|
||||
xConnected := _xConnected;
|
||||
xBusy := _xBusy;
|
||||
xError := _xError;]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_GetResponse" Id="{7a67e859-37fc-4044-a956-f01ee59f215c}">
|
||||
<Declaration><![CDATA[METHOD M_GetResponse : STRING(255)
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[M_GetResponse := _sResponse;
|
||||
xNewResponseReady := FALSE;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_SendCmd" Id="{d00a8c1a-c183-4659-9c9e-be5b30566b7c}">
|
||||
<Declaration><![CDATA[METHOD M_SendCmd : BOOL
|
||||
VAR_INPUT
|
||||
@@ -364,11 +437,12 @@ END_IF
|
||||
// Create command with id
|
||||
_sCmd := CONCAT(UINT_TO_STRING(_uiCmdId), '>');
|
||||
_sCmd := CONCAT(_sCmd, sCmd);
|
||||
_iCmdLength := LEN(sCmd);
|
||||
_iCmdLength := LEN(_sCmd);
|
||||
|
||||
// start sendind command state machine
|
||||
// start sending command state machine
|
||||
_xSendCmd := TRUE;
|
||||
_xBusy := TRUE;
|
||||
xNewResponseReady := FALSE;
|
||||
|
||||
M_SendCmd := TRUE;]]></ST>
|
||||
</Implementation>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<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
|
||||
@@ -11,7 +12,10 @@ VAR
|
||||
_sIpAddr : STRING(15);
|
||||
_udiPort : UDINT;
|
||||
|
||||
_sResponse : STRING(255);
|
||||
|
||||
_fbProtocolHandler : FB_TFProtocol;
|
||||
_xConnect : BOOL := TRUE;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -21,6 +25,8 @@ END_VAR
|
||||
_fbProtocolHandler(
|
||||
sIpAddr:= _sIpAddr,
|
||||
udiPort:= _udiPort,
|
||||
xConnect := _xConnect,
|
||||
xReleaseAlarms := xReleaseAlarms,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xConnected=> ,
|
||||
xNewResponseReady=> ,
|
||||
@@ -28,7 +34,7 @@ _fbProtocolHandler(
|
||||
xError=> );
|
||||
|
||||
// Call isa88 base state machine
|
||||
SUPER^();]]></ST>
|
||||
SUPER^(stPackMLHMIInterface := THIS^.stPackMLHMIInterface);]]></ST>
|
||||
</Implementation>
|
||||
<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.
|
||||
@@ -59,9 +65,59 @@ _stSMConfig.xSuspededDisabled := TRUE;
|
||||
_stSMConfig.xAbortingDisabled := 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
|
||||
]]></Declaration>
|
||||
VAR_INST
|
||||
_tonReconnect : TON;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _iSSM OF
|
||||
// Check state of connection
|
||||
@@ -74,7 +130,7 @@ _stSMConfig.xAbortingDisabled := TRUE;]]></ST>
|
||||
|
||||
// Send reset command
|
||||
10:
|
||||
IF _fbProtocolHandler.M_SendCmd('SYST-RESE') THEN
|
||||
IF _fbProtocolHandler.M_SendCmd('SYST-RESE:') THEN
|
||||
_iSSM := 20;
|
||||
ELSE
|
||||
_eCmd := E_PackMLCmd.STOP;
|
||||
@@ -83,12 +139,32 @@ _stSMConfig.xAbortingDisabled := TRUE;]]></ST>
|
||||
// Wait for reset command to be finished
|
||||
20:
|
||||
IF (NOT _fbProtocolHandler.xBusy) AND (NOT _fbProtocolHandler.xError) THEN
|
||||
M_StateComplete();
|
||||
_xConnect := FALSE;
|
||||
_iSSM := 30;
|
||||
END_IF
|
||||
|
||||
IF _fbProtocolHandler.xError THEN
|
||||
_eCmd := E_PackMLCmd.STOP;
|
||||
END_IF
|
||||
|
||||
30:
|
||||
_tonReconnect(IN := TRUE, PT := T#5S);
|
||||
|
||||
IF _tonReconnect.Q THEN
|
||||
_tonReconnect(IN := FALSE, PT := T#5S);
|
||||
_xConnect := TRUE;
|
||||
_iSSM := 35;
|
||||
END_IF
|
||||
|
||||
35:
|
||||
// Wait for reset message
|
||||
IF _fbProtocolHandler.stStatus.eState <> E_TrayFeederState.HOLD THEN
|
||||
_iSSM := 40;
|
||||
END_IF
|
||||
|
||||
// Check tray feeder status
|
||||
40:
|
||||
M_StateComplete();
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
|
||||
271
PLC/01_Stationen/TrayFeeder/FB_TrayFeederParser.TcPOU
Normal file
271
PLC/01_Stationen/TrayFeeder/FB_TrayFeederParser.TcPOU
Normal file
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_TrayFeederParser" Id="{d60acdcf-8e59-48d2-93a2-171510b93e18}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_TrayFeederParser
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
stStatus : ST_TrayFeederStatus;
|
||||
END_VAR
|
||||
VAR
|
||||
_stStatus : ST_TrayFeederStatus;
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
MAX_PARAMS : UINT := 10;
|
||||
|
||||
PARAMS_SEP : STRING(1) := ';';
|
||||
VALUE_SEP : STRING(1) := '=';
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_EvenSystParams" Id="{29bd9922-3af8-4120-835a-1d02226f2809}">
|
||||
<Declaration><![CDATA[METHOD PRIVATE M_EvenSystParams
|
||||
VAR_INPUT
|
||||
sParam : STRING(30);
|
||||
END_VAR
|
||||
VAR
|
||||
_sParamName : STRING(15);
|
||||
_sParamValue : STRING(15);
|
||||
|
||||
_xSplitOk : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_xSplitOk := FindAndSplit(
|
||||
pSeparator := ADR(VALUE_SEP), pSrcString := ADR(sParam),
|
||||
pLeftString := ADR(_sParamName), nLeftSize := SIZEOF(_sParamName),
|
||||
pRightString := ADR(_sParamValue), nRightSize := SIZEOF(_sParamValue),
|
||||
bSearchFromRight := FALSE);
|
||||
|
||||
IF _xSplitOk THEN
|
||||
// Check for parameter names
|
||||
IF 'Door' = _sParamName THEN
|
||||
IF 'Opened' = _sParamValue THEN
|
||||
_stStatus.xDoorOpen := TRUE;
|
||||
ELSIF 'Closed' = _sParamValue THEN
|
||||
_stStatus.xDoorOpen := FALSE;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_NoteSystParams" Id="{d4055987-9814-4c22-8525-7aafb690c294}">
|
||||
<Declaration><![CDATA[METHOD PRIVATE M_NoteSystParams
|
||||
VAR_INPUT
|
||||
sParam : STRING(30);
|
||||
END_VAR
|
||||
VAR
|
||||
_sParamName : STRING(15);
|
||||
_sParamValue : STRING(15);
|
||||
|
||||
_xSplitOk : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_xSplitOk := FindAndSplit(
|
||||
pSeparator := ADR(VALUE_SEP), pSrcString := ADR(sParam),
|
||||
pLeftString := ADR(_sParamName), nLeftSize := SIZEOF(_sParamName),
|
||||
pRightString := ADR(_sParamValue), nRightSize := SIZEOF(_sParamValue),
|
||||
bSearchFromRight := FALSE);
|
||||
|
||||
IF _xSplitOk THEN
|
||||
// Check for parameter names
|
||||
IF 'InpStack' = _sParamName THEN
|
||||
IF 'Empty' = _sParamValue THEN
|
||||
_stStatus.eStateInputStack := E_TFInputStackState.EMTPY;
|
||||
ELSIF 'NoMaga' = _sParamValue THEN
|
||||
_stStatus.eStateInputStack := E_TFInputStackState.NO_MAGAZINE;
|
||||
ELSIF 'AlmEmpty' = _sParamValue THEN
|
||||
_stStatus.eStateInputStack := E_TFInputStackState.ALMOST_EMPTY;
|
||||
ELSE
|
||||
_stStatus.eStateInputStack := E_TFInputStackState.UNDEFINED;
|
||||
END_IF
|
||||
ELSIF 'Opera' = _sParamName THEN
|
||||
IF 'Busy' = _sParamValue THEN
|
||||
_stStatus.eState := E_TrayFeederState.BUSY;
|
||||
END_IF
|
||||
END_IF
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_ParseCmd" Id="{093187fd-e820-430f-868b-5e3643bdddf4}">
|
||||
<Declaration><![CDATA[METHOD M_ParseCmd
|
||||
VAR_INPUT
|
||||
sResponse : STRING(255);
|
||||
END_VAR
|
||||
VAR
|
||||
_iLength : INT;
|
||||
_sGAF : STRING(9);
|
||||
_sParams : STRING(255);
|
||||
_sParam : STRING(20);
|
||||
_sParamName : STRING(10);
|
||||
_sValue : STRING(10);
|
||||
|
||||
_xSplitResult : BOOL;
|
||||
|
||||
_uiCounter : UINT;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Get group and function
|
||||
_sGAF := MID(sResponse, 9, 2);
|
||||
|
||||
// Get length
|
||||
_iLength := LEN(sResponse);
|
||||
|
||||
IF 'STAT-FEED' = _sGAF THEN
|
||||
// Get parameter string
|
||||
_sParams := MID(sResponse, LEN(sResponse) - 12, 12);
|
||||
|
||||
FOR _uiCounter := 0 TO MAX_PARAMS DO
|
||||
_xSplitResult := FindAndSplit(
|
||||
pSeparator := ADR(PARAMS_SEP), pSrcString := ADR(_sParams),
|
||||
pLeftString := ADR(_sParam), nLeftSize := SIZEOF(_sParam),
|
||||
pRightString := ADR(_sParams), nRightSize := SIZEOF(_sParams),
|
||||
bSearchFromRight := FALSE);
|
||||
|
||||
IF _xSplitResult THEN
|
||||
M_StatFeedParams(_sParam);
|
||||
END_IF
|
||||
END_FOR
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'EVEN-SYST' = _sGAF THEN
|
||||
// Get parameter string
|
||||
_sParams := MID(sResponse, LEN(sResponse) - 11, 12);
|
||||
|
||||
FOR _uiCounter := 0 TO MAX_PARAMS DO
|
||||
_xSplitResult := FindAndSplit(
|
||||
pSeparator := ADR(PARAMS_SEP), pSrcString := ADR(_sParams),
|
||||
pLeftString := ADR(_sParam), nLeftSize := SIZEOF(_sParam),
|
||||
pRightString := ADR(_sParams), nRightSize := SIZEOF(_sParams),
|
||||
bSearchFromRight := FALSE);
|
||||
|
||||
IF _xSplitResult THEN
|
||||
M_EvenSystParams(_sParam);
|
||||
END_IF
|
||||
END_FOR
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'EVEN-INIT' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'EVEN-BUTT' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'EVEN-CONV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'EVEN-ELEV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'NOTE-SYST' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'NOTE-CONN' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'NOTE-ELEV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'INVA-SYST' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'INVA-CONV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'INVA-ELEV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'INVA-COMM' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-ELEV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-CONV' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-STAC' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-SYST' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-INIT' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-FATA' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
IF 'ERRO-DISP' = _sGAF THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
stStatus := _stStatus;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_StatFeedParams" Id="{0f709e96-deb5-41d4-a649-6a94f81e2861}">
|
||||
<Declaration><![CDATA[METHOD PRIVATE M_StatFeedParams
|
||||
VAR_INPUT
|
||||
sParam : STRING(30);
|
||||
END_VAR
|
||||
VAR
|
||||
_sParamName : STRING(15);
|
||||
_sParamValue : STRING(15);
|
||||
|
||||
_xSplitOk : BOOL;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_xSplitOk := FindAndSplit(
|
||||
pSeparator := ADR(VALUE_SEP), pSrcString := ADR(sParam),
|
||||
pLeftString := ADR(_sParamName), nLeftSize := SIZEOF(_sParamName),
|
||||
pRightString := ADR(_sParamValue), nRightSize := SIZEOF(_sParamValue),
|
||||
bSearchFromRight := FALSE);
|
||||
|
||||
IF _xSplitOk THEN
|
||||
// Check for parameter names
|
||||
IF 'Feeder' = _sParamName THEN
|
||||
IF 'LoadPos' = _sParamValue THEN
|
||||
_stStatus.eState := E_TrayFeederState.LOAD_POS;
|
||||
ELSIF 'FeedPos' = _sParamValue THEN
|
||||
_stStatus.eState := E_TrayFeederState.FEED_POS;
|
||||
ELSIF 'Busy' = _sParamValue THEN
|
||||
_stStatus.eState := E_TrayFeederState.BUSY;
|
||||
ELSIF 'Hold' = _sParamValue THEN
|
||||
_stStatus.eState := E_TrayFeederState.HOLD;
|
||||
END_IF
|
||||
ELSIF 'PickRdy' = _sParamName THEN
|
||||
IF 'True' = _sParamValue THEN
|
||||
_stStatus.xInPickPosition := TRUE;
|
||||
ELSIF 'False' = _sParamValue THEN
|
||||
_stStatus.xInPickPosition := FALSE;
|
||||
END_IF
|
||||
ELSIF 'TrayNbr' = _sParamName THEN
|
||||
_stStatus.uiActTray := STRING_TO_UINT(_sParamValue);
|
||||
END_IF
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
15
PLC/01_Stationen/TrayFeeder/ST_TrayFeederStatus.TcDUT
Normal file
15
PLC/01_Stationen/TrayFeeder/ST_TrayFeederStatus.TcDUT
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="ST_TrayFeederStatus" Id="{749afe59-cdec-4f20-a088-f36d2372ce96}">
|
||||
<Declaration><![CDATA[TYPE ST_TrayFeederStatus :
|
||||
STRUCT
|
||||
eState : E_TrayFeederState;
|
||||
xInPickPosition : BOOL;
|
||||
uiActTray : UINT;
|
||||
xDoorOpen : BOOL;
|
||||
eStateInputStack : E_TFInputStackState;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user