- Added PackML Base FB's - Added Unit Tests for PackML Base State Machine - Added Robot job numbers according to new interface - Added PLC job number for robot to call according to new interface - Change Robot to PackML interface
155 lines
3.8 KiB
XML
155 lines
3.8 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
|
|
xConfirmAlarms : BOOL;
|
|
END_VAR
|
|
VAR_OUTPUT
|
|
xReady : BOOL;
|
|
xError : BOOL;
|
|
END_VAR
|
|
VAR
|
|
// 0 - Nicht aus
|
|
// 1 - Enable
|
|
// 2 - Enable move
|
|
// 3 - Conf_Mess (Reset)
|
|
_uCtrl AT %Q* : U_KukaRobot_Ctrl;
|
|
|
|
// 0 -> Robot job to do
|
|
// 1 -> PLC job which is finished
|
|
_uJobs AT %Q* : U_KukaRobot_Jobs;
|
|
|
|
// 0 - Greifer nummer
|
|
// 1 - Drehteller Nummer
|
|
// 2 - Position Heizplatte
|
|
// 3 - Position Kuehlplatte
|
|
_abToolsAndPositions AT %Q* : ARRAY[0..3] OF BYTE;
|
|
|
|
// Positions in um
|
|
_diOffsetPosX AT %Q* : DINT;
|
|
_diOffsetPosY AT %Q* : DINT;
|
|
_diThickness AT %Q* : DINT;
|
|
|
|
// Inputs
|
|
_uState AT %I* : U_KukaRobot_State;
|
|
_dwErrorBits AT %I* : DWORD;
|
|
_awJobStatesFromRobot AT %I* : ARRAY[0..1] OF WORD;
|
|
_dwJobForPLC AT %I* : DWORD;
|
|
|
|
_abMirrorToolsAndPositions AT %I* : ARRAY[0..3] OF BYTE;
|
|
|
|
// Position mirrors
|
|
_diMirrorOffsetPosX AT %I* : DINT;
|
|
_diMirrorOffsetPosY AT %I* : DINT;
|
|
_diMirrorThickness AT %I* : DINT;
|
|
|
|
// Motortemperaturen
|
|
_asiMotorTemps1To4 AT %I* : ARRAY[0..3] OF SINT;
|
|
_asiMotorTemps5To8 AT %I* : ARRAY[0..3] OF SINT;
|
|
|
|
_eRobotJob : E_KukaRobot_JobNumberRobot;
|
|
_ePlcJob :E_KukaRobot_JobNumerPLC;
|
|
|
|
_xRobotReady : BOOL;
|
|
|
|
_xError : BOOL;
|
|
|
|
// ======
|
|
// Alarms
|
|
// ======
|
|
|
|
_fbAlarmNotInExtMode : FB_AlarmMessage(stEventEntry := TC_EVENTS.RobotEvents.RobotNotInExtMode, xWithConfirmation := FALSE);
|
|
_fbAlarmEStopActive : FB_AlarmMessage(stEventEntry := TC_EVENTS.RobotEvents.RobotEStopActive, xWithConfirmation := FALSE);
|
|
_fbAlarmOperatorSafetyNotOk : FB_AlarmMessage(stEventEntry := TC_EVENTS.RobotEvents.OperatorSafetyNotOk, xWithConfirmation := FALSE);
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// =============
|
|
// Handle alarms
|
|
// =============
|
|
|
|
_fbAlarmNotInExtMode(
|
|
xActive:= (NOT _uState.stState.bExt),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
_fbAlarmEStopActive(
|
|
xActive:= (NOT _uState.stState.bAlarmStop),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
_fbAlarmOperatorSafetyNotOk(
|
|
xActive:= (NOT _uState.stState.bUserSAF),
|
|
xRelease:= TRUE,
|
|
xAcknowledge:= xConfirmAlarms,
|
|
timOnDelay:= T#0S,
|
|
timOffDelay:= T#0S);
|
|
|
|
|
|
// =======================
|
|
// Check if robot is ready
|
|
// =======================
|
|
|
|
_xRobotReady := _uState.stState.bExt
|
|
AND _uState.stState.bAlarmStop
|
|
AND _uState.stState.bUserSAF
|
|
AND _uState.stState.bPeriRdy
|
|
AND _uState.stState.bIOActConf
|
|
AND (NOT _uState.stState.bStopMess);
|
|
|
|
|
|
// =============================
|
|
// Call isa88 base state machine
|
|
// =============================
|
|
SUPER^();
|
|
|
|
|
|
// ==============================
|
|
// Handle general control outputs
|
|
// ==============================
|
|
|
|
// Allow robot to be moved with programming pendant
|
|
_uCtrl.stCtrl.bNotDisableAxes := 1;
|
|
|
|
// Disable move if in T2 for safety reasons
|
|
IF (NOT _uState.stState.bT2) THEN
|
|
_uCtrl.stCtrl.bEnableMove := 1;
|
|
ELSE
|
|
_uCtrl.stCtrl.bEnableMove := 0;
|
|
END_IF
|
|
|
|
|
|
// ==================
|
|
// Write job outputs
|
|
// ==================
|
|
|
|
_uJobs.stJobs.wJobNrForRobot := _eRobotJob;
|
|
_uJobs.stJobs.wFinishedJobNrFromPlc := _ePlcJob;
|
|
|
|
|
|
// =================
|
|
// Write fb outputs
|
|
// =================
|
|
|
|
xReady := _xRobotReady;
|
|
xError := _xError;]]></ST>
|
|
</Implementation>
|
|
<Method Name="M_Idle" Id="{025437ab-beb0-4ad6-bdc3-468dec599ff4}">
|
|
<Declaration><![CDATA[METHOD M_Idle
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[_uCtrl.stCtrl.bConfMess := 0;
|
|
|
|
_eRobotJob := E_KukaRobot_JobNumberRobot.NO_JOB;
|
|
_ePlcJob := E_KukaRobot_JobNumerPLC.NO_JOB;
|
|
]]></ST>
|
|
</Implementation>
|
|
</Method>
|
|
</POU>
|
|
</TcPlcObject> |