Changed from ISA88 to PackML
- 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
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
<?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[FUNCTION_BLOCK FINAL FB_KukaRobot EXTENDS FB_Isa88_SM
|
||||
<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
|
||||
@@ -45,46 +49,106 @@ VAR
|
||||
_asiMotorTemps1To4 AT %I* : ARRAY[0..3] OF SINT;
|
||||
_asiMotorTemps5To8 AT %I* : ARRAY[0..3] OF SINT;
|
||||
|
||||
END_VAR
|
||||
VAR CONSTANT
|
||||
// Bit indices for robot interface
|
||||
NOT_DISABLE_AXES : USINT := 0;
|
||||
ENABLE_AXES : USINT := 1;
|
||||
ENABLE_MOVE : USINT := 2;
|
||||
CONF_MESS : USINT := 3;
|
||||
_eRobotJob : E_KukaRobot_JobNumberRobot;
|
||||
_ePlcJob :E_KukaRobot_JobNumerPLC;
|
||||
|
||||
// Array indices for Job interface
|
||||
ROBOT_JOB : USINT := 0;
|
||||
PLC_JOB_FINISHED : USINT := 1;
|
||||
_xRobotReady : BOOL;
|
||||
|
||||
// Array indices for tools and plate positions
|
||||
GRIPPER_NR : USINT := 0;
|
||||
TURN_TABLE_NR : USINT := 1;
|
||||
HEATING_PLATE_POS : USINT := 2;
|
||||
COOLING_PLATE_POS : USINT := 3;
|
||||
_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[// Positionen in um <=> 0.001mm
|
||||
<ST><![CDATA[// =============
|
||||
// Handle alarms
|
||||
// =============
|
||||
|
||||
// Zur Sicherheit im T2 Zustand die Fahrfreigabe wegnehmen (da standardpasswort bleibt)
|
||||
_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^();]]></ST>
|
||||
// =============================
|
||||
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_StateIdle" Id="{025437ab-beb0-4ad6-bdc3-468dec599ff4}">
|
||||
<Declaration><![CDATA[METHOD M_StateIdle
|
||||
<Method Name="M_Idle" Id="{025437ab-beb0-4ad6-bdc3-468dec599ff4}">
|
||||
<Declaration><![CDATA[METHOD M_Idle
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Allow robot to be moved with programming pendant
|
||||
_uCtrl.stCtrl.bNotDisableAxes := 1;
|
||||
_uCtrl.stCtrl.bEnableAxes := 1;
|
||||
_uCtrl.stCtrl.bEnableMove := 1;
|
||||
_uCtrl.stCtrl.bConfMess := 0;
|
||||
<ST><![CDATA[_uCtrl.stCtrl.bConfMess := 0;
|
||||
|
||||
// Deselect all jobs and set plc finished job to none
|
||||
//_awJobs[ROBOT_JOB] := 0;
|
||||
//_awJobs[PLC_JOB_FINISHED] := 0;]]></ST>
|
||||
_eRobotJob := E_KukaRobot_JobNumberRobot.NO_JOB;
|
||||
_ePlcJob := E_KukaRobot_JobNumerPLC.NO_JOB;
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
|
||||
Reference in New Issue
Block a user