679 lines
18 KiB
XML
679 lines
18 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1">
|
|
<POU Name="FB_KukaRobot" Id="{6ca3e82a-4047-4132-872d-1f49057f08d6}" SpecialFunc="None">
|
|
<Declaration><![CDATA[// Positionen in um <=> 0.001mm
|
|
FUNCTION_BLOCK FINAL FB_KukaRobot EXTENDS FB_PackMLGeneric
|
|
VAR_INPUT
|
|
stJobParams : ST_KukaRobot_JobParams;
|
|
|
|
// Feedbacks from other units
|
|
// like if a door is open and such things
|
|
stUnitFeedbacks : ST_KukaRobot_UnitFeedbacks;
|
|
|
|
xAckPLCCmd : BOOL;
|
|
xPLCJobFailed : BOOL;
|
|
|
|
xReleaseAlarms : BOOL;
|
|
xConfirmAlarms : BOOL;
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
eCmdFromRobot : E_KukaRobot_JobNumerPLC;
|
|
xNewCmdRequested : BOOL;
|
|
|
|
xReady : BOOL;
|
|
xError : BOOL;
|
|
END_VAR
|
|
VAR_IN_OUT
|
|
stHMIInterface : ST_HMI_Kuka;
|
|
END_VAR
|
|
VAR
|
|
// 0 - Nicht aus
|
|
// 1 - Enable
|
|
// 2 - Enable move
|
|
// 3 - Conf_Mess (Reset)
|
|
stCtrl AT %Q* : ST_KukaRobot_Ctrl;
|
|
|
|
// 0 -> Robot job to do
|
|
// 1 -> PLC job which is finished
|
|
stJobs AT %Q* : ST_KukaRobot_Jobs;
|
|
|
|
// 0 - Greifer nummer
|
|
// 1 - Drehteller Nummer
|
|
// 2 - Position Heizplatte
|
|
// 3 - Position Kuehlplatte
|
|
abyToolsAndPositions AT %Q* : ARRAY[0..3] OF BYTE;
|
|
|
|
// Positions in um
|
|
diOffsetPosX AT %Q* : DINT;
|
|
diOffsetPosY AT %Q* : DINT;
|
|
diThickness AT %Q* : DINT;
|
|
|
|
// Offsets for etcher 1 in um
|
|
diOffsetXE1 AT %Q* : DINT := -280;
|
|
diOffsetYE1 AT %Q* : DINT := 340;
|
|
diOffsetZE1 AT %Q* : DINT := 0;
|
|
|
|
// Inputs
|
|
stState AT %I* : ST_KukaRobot_State;
|
|
dwErrorBits AT %I* : DWORD;
|
|
awJobStatesFromRobot AT %I* : ARRAY[0..1] OF WORD;
|
|
eJobForPLC AT %I* : E_KukaRobot_JobNumerPLC;
|
|
|
|
{attribute 'analysis' := '-33'}
|
|
abyMirrorToolsAndPositions AT %I* : ARRAY[0..3] OF BYTE;
|
|
|
|
// Position mirrors
|
|
diMirrorOffsetPosX AT %I* : DINT;
|
|
diMirrorOffsetPosY AT %I* : DINT;
|
|
diMirrorThickness AT %I* : DINT;
|
|
{attribute 'analysis' := '+33'}
|
|
|
|
// Motortemperaturen
|
|
asiMotorTemps1To4 AT %I* : ARRAY[0..3] OF SINT;
|
|
asiMotorTemps5To8 AT %I* : ARRAY[0..3] OF SINT;
|
|
|
|
_ePlcJob :E_KukaRobot_JobNumerPLC;
|
|
|
|
_xRobotReady : BOOL;
|
|
|
|
_xError : BOOL;
|
|
|
|
// Internal job params will be copied from input
|
|
// only from IDLE -> STARTING
|
|
_stJobParams : ST_KukaRobot_JobParams;
|
|
|
|
// ======
|
|
// Alarms
|
|
// ======
|
|
|
|
_fbAlarmNotInExtMode : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.NotInExtMode, xWithConfirmation := FALSE);
|
|
_fbAlarmEStopActive : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.EStopActive, xWithConfirmation := FALSE);
|
|
_fbAlarmOperatorSafetyNotOk : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.OperatorSafetyNotOk, xWithConfirmation := FALSE);
|
|
_fbAlarmRobotErrorResetTimeout : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.ErrorResetTimeout, xWithConfirmation := TRUE);
|
|
_fbAlarmDrivesEnableTimeout : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.DrivesEnableTimeout, xWithConfirmation := TRUE);
|
|
_fbAlarmWrongJobMirrored : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.WrongJobReadBack, xWithConfirmation := TRUE);
|
|
_fbAlarmWrongParamMirrored : FB_AlarmMessage(stEventEntry := TC_EVENTS.KukaRobot.WrongParamsReadBack, xWithConfirmation := TRUE);
|
|
END_VAR
|
|
VAR RETAIN
|
|
byCurrentGripper : BYTE := 2;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// =============
|
|
// Handle alarms
|
|
// =============
|
|
|
|
_fbAlarmNotInExtMode(
|
|
xActive:= (NOT stState.bExt),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
_fbAlarmEStopActive(
|
|
xActive:= (NOT stState.bAlarmStop),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
_fbAlarmOperatorSafetyNotOk(
|
|
xActive:= (NOT stState.bUserSAF) AND (stState.bExt),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
// Handled by M_Resetting
|
|
_fbAlarmDrivesEnableTimeout(
|
|
xRelease:= xReleaseAlarms,
|
|
xAcknowledge:= xConfirmAlarms);
|
|
|
|
// Handled by M_Resetting
|
|
_fbAlarmRobotErrorResetTimeout(
|
|
xRelease:= xReleaseAlarms,
|
|
xAcknowledge:= xConfirmAlarms);
|
|
|
|
// Handled by M_Starting
|
|
_fbAlarmWrongParamMirrored(
|
|
xRelease:= xReleaseAlarms,
|
|
xAcknowledge:= xConfirmAlarms);
|
|
|
|
// Handled by M_Starting
|
|
_fbAlarmWrongJobMirrored(
|
|
xRelease:= xReleaseAlarms,
|
|
xAcknowledge:= xConfirmAlarms);
|
|
|
|
|
|
// =======================
|
|
// Check if robot is ready
|
|
// =======================
|
|
|
|
_xRobotReady := stState.bExt
|
|
AND stState.bAlarmStop
|
|
AND stState.bUserSAF
|
|
AND stState.bPeriRdy
|
|
AND stState.bIOActConf
|
|
AND (NOT stState.bStopMess);
|
|
|
|
|
|
// =============================
|
|
// Call isa88 base state machine
|
|
// =============================
|
|
SUPER^(stPackMLHMIInterface := stHMIInterface.stStationCmds);
|
|
|
|
|
|
// ==============================
|
|
// Handle general control outputs
|
|
// ==============================
|
|
|
|
// Allow robot to be moved with programming pendant
|
|
stCtrl.bNotDisableAxes := 1;
|
|
|
|
// Disable move if in T2 for safety reasons
|
|
// IF _uState.stState.bT2 THEN
|
|
// _uCtrl.stCtrl.bEnableMove := 0;
|
|
// END_IF
|
|
|
|
|
|
// ============================
|
|
// Write unit feedbacks outputs
|
|
// ============================
|
|
|
|
stCtrl.bDoorEtcher1Open := stUnitFeedbacks.xDoorEtcher1Open;
|
|
stCtrl.bDoorEtcher2Open := stUnitFeedbacks.xDoorEtcher2Open;
|
|
stCtrl.bDoorHVTestHotOpen := stUnitFeedbacks.xDoorHVTestHotOpen;
|
|
stCtrl.bDoorHVTestColdOpen := stUnitFeedbacks.xDoorHVTestColdOpen;
|
|
|
|
M_HandlePLCJobs();
|
|
|
|
|
|
// =================
|
|
// Write fb outputs
|
|
// =================
|
|
|
|
xReady := _xRobotReady;
|
|
xError := _xError;]]></ST>
|
|
</Implementation>
|
|
<Folder Name="StateMachine" Id="{66d46722-f002-4d97-ae1f-63dcdad370cb}" />
|
|
<Method Name="FB_Init" Id="{71a3f6f0-d3bb-4348-acc7-be533d7488d2}">
|
|
<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)
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_stSMConfig.xStoppingDisabled := TRUE;
|
|
|
|
_stSMConfig.xCompletingDisabled := TRUE;
|
|
_stSMConfig.xCompletedDisabled := TRUE;
|
|
|
|
_stSMConfig.xAbortingDisabled := TRUE;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Aborted" Id="{0c0c17ce-5c1c-4640-9d39-f25b22309d5d}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Aborted
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Reset all relevant robot control signals
|
|
stCtrl.bConfMess := 0;
|
|
stCtrl.bExtStart := 0;
|
|
stCtrl.bEnableAxes := 0;
|
|
stCtrl.bEnableMove := 0;
|
|
stCtrl.bNotDisableAxes := 1;
|
|
stCtrl.bAbortJob := 1;
|
|
|
|
// Reset robot program and plc job number
|
|
stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
stJobs.wFinishedJobNrFromPlc := E_KukaRobot_JobNumerPLC.NO_JOB;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_CalcGripperNr" Id="{282207f3-bc23-43ae-a217-8c6b456b1a5f}">
|
|
<Declaration><![CDATA[METHOD PRIVATE M_CalcGripperNr : BYTE
|
|
VAR_INPUT
|
|
byGripperSide : BYTE;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[M_CalcGripperNr := (byCurrentGripper - 1) + byGripperSide;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Clearing" Id="{e6152288-8c7d-4b38-bfbc-4f861d76ccc5}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Clearing
|
|
VAR_INST
|
|
_tonWait : TON;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_tonWait(IN := TRUE, PT := T#1S);
|
|
stCtrl.bEnableMove := 1;
|
|
stCtrl.bAbortJob := 0;
|
|
|
|
IF _tonWait.Q THEN
|
|
_tonWait(IN := FALSE, PT := T#1S);
|
|
M_StateComplete();
|
|
END_IF
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Execute" Id="{bc86876c-a8db-4285-b95c-7c6858a2ca66}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Execute
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE stJobParams.eJob OF
|
|
E_KukaRobot_JobNumberRobot.WARMUP:
|
|
CASE _iSSM OF
|
|
0: // Wait for program to end
|
|
IF awJobStatesFromRobot[0] = 0 THEN
|
|
IF asiMotorTemps1To4[3] < 40 THEN
|
|
_iSSM := 10;
|
|
ELSE
|
|
_eCmd := E_PackMLCmd.COMPLETE;
|
|
END_IF
|
|
END_IF
|
|
|
|
10: // Write robot number 0
|
|
stJobs.wJobNrForRobot := stJobParams.eJob;
|
|
IF awJobStatesFromRobot[0] = stJobs.wJobNrForRobot THEN
|
|
stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
_iSSM := 0;
|
|
END_IF
|
|
|
|
ELSE
|
|
;
|
|
END_CASE
|
|
|
|
ELSE
|
|
// Wait for robot to be done
|
|
IF awJobStatesFromRobot[0] = 0 THEN
|
|
stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
_eCmd := E_PackMLCmd.COMPLETE;
|
|
END_IF
|
|
END_CASE
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_HandlePLCJobs" Id="{4e3710b4-697b-42e8-86b1-31b19b3023db}">
|
|
<Declaration><![CDATA[METHOD M_HandlePLCJobs
|
|
VAR_INST
|
|
_rtNewJob : R_TRIG;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_rtNewJob(CLK := (eJobForPLC <> E_KukaRobot_JobNumerPLC.NO_JOB));
|
|
|
|
IF _rtNewJob.Q THEN
|
|
eCmdFromRobot := eJobForPLC;
|
|
xNewCmdRequested := TRUE;
|
|
END_IF
|
|
|
|
IF xAckPLCCmd THEN
|
|
xNewCmdRequested := FALSE;
|
|
|
|
IF (NOT xPLCJobFailed) THEN
|
|
stJobs.wFinishedJobNrFromPlc := eJobForPLC;
|
|
ELSE
|
|
stJobs.wFinishedJobNrFromPlc := E_KukaRobot_JobNumerPLC.JOB_FAILED;
|
|
END_IF
|
|
|
|
eCmdFromRobot := E_KukaRobot_JobNumerPLC.NO_JOB;
|
|
END_IF
|
|
|
|
// Reset plc job done
|
|
IF (eJobForPLC = E_KukaRobot_JobNumerPLC.NO_JOB)
|
|
AND (stJobs.wFinishedJobNrFromPlc <> E_KukaRobot_JobNumberRobot.NO_JOB)
|
|
AND (NOT xPLCJobFailed)
|
|
THEN
|
|
stJobs.wFinishedJobNrFromPlc := E_KukaRobot_JobNumerPLC.NO_JOB;
|
|
END_IF]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Held" Id="{22ddbad0-0b66-427e-a2aa-f177f8adbc94}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Held
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Holding" Id="{ff8c2c8e-1fe0-4c63-ad7b-790d72bd9217}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Holding
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[stCtrl.bEnableMove := 0;
|
|
|
|
IF stState.bRobStopped THEN
|
|
M_StateComplete();
|
|
END_IF
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Idle" Id="{025437ab-beb0-4ad6-bdc3-468dec599ff4}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Idle
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_stJobParams := stHMIInterface.stJobParams;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Resetting" Id="{dfe4d36a-80aa-4364-bfd8-6ddd41636d59}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Resetting
|
|
VAR_INST
|
|
_tonTimeout : TON;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_tonTimeout(PT := T#10S);
|
|
|
|
CASE _iSSM OF
|
|
// Check if com interface is ok
|
|
0:
|
|
stCtrl.bEnableMove := 1;
|
|
stCtrl.bConfMess := 1;
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
IF stState.bIOActConf THEN
|
|
stCtrl.bConfMess := 0;
|
|
_iSSM := 10;
|
|
END_IF
|
|
|
|
// Timeout io_Act_conf ready
|
|
IF _tonTimeout.Q THEN
|
|
stCtrl.bConfMess := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
// Enable axes
|
|
10:
|
|
stCtrl.bEnableAxes := 1;
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
// Wait for drives to be ready
|
|
IF stState.bPeriRdy THEN
|
|
stCtrl.bEnableAxes := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
_iSSM := 20;
|
|
END_IF
|
|
|
|
// Timeout drives ready
|
|
IF _tonTimeout.Q THEN
|
|
stCtrl.bEnableAxes := 0;
|
|
_fbAlarmDrivesEnableTimeout.M_OneShot();
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
// Reset move stop
|
|
20:
|
|
stCtrl.bConfMess := 1;
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
// Wait for errors to be reset
|
|
IF (NOT stState.bStopMess) THEN
|
|
stCtrl.bConfMess := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
_iSSM := 30;
|
|
END_IF
|
|
|
|
// Timeout reset errors
|
|
IF _tonTimeout.Q THEN
|
|
_fbAlarmRobotErrorResetTimeout.M_OneShot();
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
// Start program
|
|
30:
|
|
stCtrl.bExtStart := 1;
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
IF _tonTimeout.Q THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
IF stState.bProAct THEN
|
|
stCtrl.bExtStart := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
M_StateComplete();
|
|
END_IF
|
|
|
|
ELSE
|
|
;
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Starting" Id="{011f85d8-1225-4288-876f-918df6e4f235}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Starting
|
|
VAR
|
|
_byGripperSideNrCalc : BYTE;
|
|
END_VAR
|
|
VAR_INST
|
|
_tonTimeout : TON;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[CASE _iSSM OF
|
|
// Check job parameters
|
|
0:
|
|
_byGripperSideNrCalc := M_CalcGripperNr(_stJobParams.byGripperNumber);
|
|
|
|
IF (_stJobParams.byGripperNumber > 4) // Wrong gripper number
|
|
//OR (_stJobParams.byChuckNumber < 1) OR (_stJobParams.byChuckNumber > 6) // Wrong chuck number
|
|
OR (_byGripperSideNrCalc < 1) OR (_byGripperSideNrCalc > 6) // Wrong gripper side
|
|
THEN
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
ELSE
|
|
_iSSM := 10;
|
|
END_IF
|
|
|
|
// BLOCKIERE GREIFER TAUSCH, DA AKTUELL KABEL DEFEKT !!!!!
|
|
// IF _stJobParams.eJob = E_KukaRobot_JobNumberRobot.CHANGE_GRIPPER THEN
|
|
// _eCmd := E_PackMLCmd.ABORT;;
|
|
// END_IF
|
|
|
|
// Transfer job data to robot
|
|
10:
|
|
// Pos x in um
|
|
diOffsetPosX := REAL_TO_DINT(_stJobParams.rPosX * 1000);
|
|
|
|
// Pos y in um
|
|
diOffsetPosY := REAL_TO_DINT(_stJobParams.rPosY * 1000);
|
|
|
|
// Thickness
|
|
diThickness := REAL_TO_DINT(_stJobParams.rThickness * 1000);
|
|
|
|
// Gripper side
|
|
stCtrl.byGripperSide := _stJobParams.byGripperSide;
|
|
|
|
// Scan QR code
|
|
IF stJobParams.xScanQRCode THEN
|
|
stCtrl.bScanQRCode := 1;
|
|
ELSE
|
|
stCtrl.bScanQRCode := 0;
|
|
END_IF
|
|
|
|
// Position on hotplate
|
|
abyToolsAndPositions[2] := _stJobParams.byPlaceOnHotplate;
|
|
|
|
// Position on coolplate
|
|
abyToolsAndPositions[3] := _stJobParams.byPlaceOnCoolPlate;
|
|
|
|
// Gripper number
|
|
abyToolsAndPositions[0] := _stJobParams.byGripperNumber;
|
|
|
|
// Chuck for etcher to load
|
|
abyToolsAndPositions[1] := _stJobParams.byChuckNumber;
|
|
|
|
// Safety reset timout fb
|
|
_tonTimeout(IN := FALSE);
|
|
|
|
_iSSM := 15;
|
|
|
|
// Check mirrored values
|
|
15:
|
|
_tonTimeout(IN := TRUE, PT := T#5S);
|
|
|
|
IF abyMirrorToolsAndPositions[0] = _stJobParams.byGripperNumber
|
|
AND abyMirrorToolsAndPositions[1] = _stJobParams.byChuckNumber
|
|
AND abyMirrorToolsAndPositions[2] = _stJobParams.byPlaceOnHotplate
|
|
AND abyMirrorToolsAndPositions[3] = _stJobParams.byPlaceOnCoolPlate
|
|
THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_iSSM := 20;
|
|
END_IF
|
|
|
|
IF _tonTimeout.Q THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_fbAlarmWrongParamMirrored.M_OneShot();
|
|
_eCmd := E_PackMLCmd.STOP;
|
|
END_IF
|
|
|
|
// Wait for robot program start
|
|
20:
|
|
// Write robot job number
|
|
stJobs.wJobNrForRobot := DINT_TO_WORD(_stJobParams.eJob);
|
|
|
|
_tonTimeout(IN := TRUE, PT := T#5S);
|
|
|
|
// If job number is read back correct, go to next state
|
|
IF awJobStatesFromRobot[0] = stJobs.wJobNrForRobot THEN
|
|
stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
_tonTimeout(IN := FALSE);
|
|
M_StateComplete();
|
|
END_IF
|
|
|
|
// Timeout occured
|
|
IF _tonTimeout.Q THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_fbAlarmWrongJobMirrored.M_OneShot();
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
// Robot has error
|
|
IF dwErrorBits <> 0 THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
ELSE
|
|
;
|
|
END_CASE
|
|
|
|
|
|
// Wrong job read back from robot -> Abort
|
|
// IF _awJobStatesFromRobot[0] <> 0 AND _awJobStatesFromRobot[0] <> E_KukaRobot_JobNumberRobot.WARMUP THEN
|
|
// _eCmd := E_PackMLCmd.ABORT;
|
|
// END_IF
|
|
//
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Stopped" Id="{50813767-4bd7-4147-b5dc-1bbd18ae1555}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Stopped
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// _uCtrl.stCtrl.bConfMess := 0;
|
|
stCtrl.bEnableAxes := 0;
|
|
stCtrl.bNotDisableAxes := 1;
|
|
stCtrl.bExtStart := 0;
|
|
|
|
stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
_ePlcJob := E_KukaRobot_JobNumerPLC.NO_JOB;]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Suspended" Id="{c2db015c-1cd0-491a-8ce6-6c0bffba7631}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Suspended
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Suspending" Id="{5b0e5227-d5bb-40c6-a1b8-8e81b852b9b9}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Suspending
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Unholding" Id="{786f4949-9630-4ace-9e30-65bea4e87cb2}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Unholding
|
|
VAR_INST
|
|
_tonTimeout : TON;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_tonTimeout(PT := T#10S);
|
|
|
|
CASE _iSSM OF
|
|
0:
|
|
stCtrl.bEnableMove := 1;
|
|
stCtrl.bEnableAxes := 1;
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
// Wait for drives to be ready
|
|
IF stState.bPeriRdy THEN
|
|
stCtrl.bEnableAxes := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
_iSSM := 10;
|
|
END_IF
|
|
|
|
// Timeout drives ready
|
|
IF _tonTimeout.Q THEN
|
|
stCtrl.bEnableAxes := 0;
|
|
_fbAlarmDrivesEnableTimeout.xRelease := TRUE;
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
10:
|
|
stCtrl.bConfMess := 1;
|
|
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
// Wait for errors to be reset
|
|
IF (NOT stState.bStopMess) THEN
|
|
stCtrl.bConfMess := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
_iSSM := 20;
|
|
END_IF
|
|
|
|
// Timeout reset errors
|
|
IF _tonTimeout.Q THEN
|
|
_fbAlarmRobotErrorResetTimeout.xRelease := TRUE;
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
20:
|
|
// Start main program
|
|
stCtrl.bExtStart := 1;
|
|
|
|
_tonTimeout.IN := TRUE;
|
|
|
|
IF _tonTimeout.Q THEN
|
|
_tonTimeout(IN := FALSE);
|
|
_eCmd := E_PackMLCmd.ABORT;
|
|
END_IF
|
|
|
|
IF stState.bProAct THEN
|
|
stCtrl.bExtStart := 0;
|
|
_tonTimeout(IN := FALSE);
|
|
M_StateComplete();
|
|
END_IF
|
|
|
|
ELSE
|
|
;
|
|
END_CASE]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
<Method Name="M_Unsuspending" Id="{d7ce33fd-cd94-44f1-9289-25a3ab3829eb}" FolderPath="StateMachine\">
|
|
<Declaration><![CDATA[METHOD PROTECTED M_Unsuspending
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
</POU>
|
|
</TcPlcObject> |