Programming a
KUKA Robot with a
SIMATIC S7-1500
SIMATIC S7-1500 / TIA Portal V15
KUKA.PLC mxAutomation
https://support.industry.siemens.com/cs/ww/en/view/109482123
Siemens
Industry
Online
Support
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
Legal information
Legal information
Use of application examples
Application examples illustrate the solution of automation tasks through an interaction of several
components in the form of text, graphics and/or software modules. The application examples are
a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-
binding and make no claim to completeness or functionality regarding configuration and
equipment. The application examples merely offer help with typical tasks; they do not constitute
customer-specific solutions. You yourself are responsible for the proper and safe operation of the
products in accordance with applicable regulations and must also check the function of the
respective application example and customize it for your system.
Siemens grants you the non-exclusive, non-sublicensable and non-transferable right to have the
application examples used by technically trained personnel. Any change to the application
examples is your responsibility. Sharing the application examples with third parties or copying the
application examples or excerpts thereof is permitted only in combination with your own products.
The application examples are not required to undergo the customary tests and quality inspections
of a chargeable product; they may have functional and performance defects as well as errors. It is
your responsibility to use them in such a manner that any malfunctions that may occur do not
result in property damage or injury to persons.
Disclaimer of liability
Siemens shall not assume any liability, for any legal reason whatsoever, including, without
limitation, liability for the usability, availability, completeness and freedom from defects of the
application examples as well as for related information, configuration and performance data and
any damage caused thereby. This shall not apply in cases of mandatory liability, for example
under the German Product Liability Act, or in cases of intent, gross negligence, or culpable loss of
life, bodily injury or damage to health, non-compliance with a guarantee, fraudulent
non-disclosure of a defect, or culpable breach of material contractual obligations. Claims for
damages arising from a breach of material contractual obligations shall however be limited to the
foreseeable damage typical of the type of agreement, unless liability arises from intent or gross
negligence or is based on loss of life, bodily injury or damage to health. The foregoing provisions
do not imply any change in the burden of proof to your detriment. You shall indemnify Siemens
against existing or future claims of third parties in this connection except where Siemens is
mandatorily liable.
By using the application examples you acknowledge that Siemens cannot be held liable for any
damage beyond the liability provisions described.
Other information
Siemens reserves the right to make changes to the application examples at any time without
notice. In case of discrepancies between the suggestions in the application examples and other
Siemens publications such as catalogs, the content of the other documentation shall have
precedence.
The Siemens terms of use (https://support.industry.siemens.com) shall also apply.
Security information
Siemens provides products and solutions with industrial security functions that support the secure
operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is necessary
to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept.
Siemens’ products and solutions constitute one element of such a concept.
Customers are responsible for preventing unauthorized access to their plants, systems, machines
and networks. Such systems, machines and components should only be connected to an
enterprise network or the Internet if and to the extent such a connection is necessary and only
when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit
https://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them more secure.
Siemens strongly recommends that product updates are applied as soon as they are available
and that the latest product versions are used. Use of product versions that are no longer
supported, and failure to apply the latest updates may increase customer’s exposure to cyber
threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed
at: https://www.siemens.com/industrialsecurity.
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
2
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
Table of Contents
Table of Contents
Legal information ......................................................................................................... 2
1
Introduction ........................................................................................................ 5
1.1
1.2
1.3
1.4
Overview............................................................................................... 5
How it works ......................................................................................... 5
Aim of this Application Example ........................................................... 7
Components used ................................................................................ 7
2
Basics ................................................................................................................. 9
2.1
2.2
2.2.1
2.2.2
2.2.3
2.3
2.3.1
2.3.2
Configuration of an industrial robot ...................................................... 9
KUKA.PLC mxAutomation.................................................................. 10
Overview............................................................................................. 10
KUKA.PLC mxAutomation block library ............................................. 11
Interpreter on the KUKA robot controller ............................................ 11
Configuration of the block library ........................................................ 11
Block types ......................................................................................... 11
Block inputs and outputs .................................................................... 12
3
Creating a program .......................................................................................... 14
Hardware configuration ...................................................................... 14
3.1
Robot as PROFINET device .............................................................. 14
3.1.1
Installing the GSDML file of the robot ................................................ 14
3.1.2
Integrating a robot into the hardware configuration ........................... 16
3.1.3
Connecting the SIMATIC S7 and the robot ........................................ 18
3.1.4
Controlling several robots using a SIMATIC S7 ................................. 18
3.1.5
Importing a block library ..................................................................... 19
3.2
Unpacking a block library ................................................................... 19
3.2.1
Opening a block library ....................................................................... 19
3.2.2
Transferring blocks to the user program ............................................ 20
3.2.3
Basic program structure ..................................................................... 21
3.3
"SiemensKuka" block ......................................................................... 22
3.4
KRC_ReadAxisGroup ........................................................................ 23
3.4.1
KRC_WriteAxisGroup ......................................................................... 23
3.4.2
Function blocks for robot movements ................................................ 24
3.4.3
"KukaControl" function block .............................................................. 25
3.5
KRC_Initialize ..................................................................................... 27
3.5.1
KRC_ReadMXAStatus ....................................................................... 27
3.5.2
KRC_ReadKRCError .......................................................................... 28
3.5.3
KRC_Diag .......................................................................................... 29
3.5.4
KRC_ReadMXAError ......................................................................... 30
3.5.5
KRC_MessageReset .......................................................................... 31
3.5.6
KRC_AutomaticExternal..................................................................... 31
3.5.7
KRC_AutoStart ................................................................................... 32
3.5.8
3.5.9
KRC_SetOverride ............................................................................... 33
3.5.10 KRC_ReadActualPosition .................................................................. 34
3.5.11 KRC_ReadActualAxisPos .................................................................. 36
3.5.12 KRC_Jog ............................................................................................ 37
3.5.13 KRC_TouchUP ................................................................................... 38
"PickPlace" block ................................................................................ 39
3.6
3.6.1
KRC_Abort ......................................................................................... 41
KRC_Interrupt .................................................................................... 41
3.6.2
KRC_Continue ................................................................................... 41
3.6.3
mxA_ValuesToCOORDSYS .............................................................. 42
3.6.4
mxA_ValuesToAPO ........................................................................... 42
3.6.5
3.6.6
MC_MoveAxisAbsolute ...................................................................... 44
MC_MoveLinearAbsolute ................................................................... 46
3.6.7
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
3
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
Table of Contents
3.7
3.7.1
3.7.2
3.7.3
3.8
3.8.1
3.8.2
3.8.3
3.8.4
3.9
3.9.1
3.9.2
3.9.3
3.9.4
"Circle" block ...................................................................................... 48
mxA_ValuesToE6POS ....................................................................... 50
MC_MoveDirectAbsolute.................................................................... 51
MC_MoveCircAbsolute ....................................................................... 52
Operation ............................................................................................ 55
Status bar and Override ..................................................................... 55
Control functions ................................................................................ 56
Jogging the robot ................................................................................ 57
Example Programs ............................................................................. 58
Error handling ..................................................................................... 59
HMI only shows rhombuses ............................................................... 59
No connection to the robot controller ................................................. 60
MxA interface is not initialized ............................................................ 60
The robot cannot be switched on ....................................................... 61
4
Additional function .......................................................................................... 62
4.1
4.1.1
4.1.2
4.1.3
4.2
Safety Integrated ................................................................................ 62
Components ....................................................................................... 62
Functionality ....................................................................................... 62
Control ................................................................................................ 62
Receive robot messages in plain text ................................................ 63
5
Appendix .......................................................................................................... 64
Advanced Example ............................................................................ 64
Service and support ........................................................................... 65
Contact partners ................................................................................. 66
KUKA Roboter GmbH ........................................................................ 66
KUKA Roboter GmbH Hotline ............................................................ 66
Sales and Marketing for KUKA.PLC mxAutomation .......................... 66
Links and Literature ............................................................................ 67
Change documentation ...................................................................... 68
5.1
5.2
5.3
5.3.1
5.3.2
5.3.3
5.4
5.5
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
4
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
1 Introduction
1
Introduction
The use of industrial robots continues to grow. They are increasingly being used in
machines and plants. Their standardized mechanics are well-developed and highly
flexible in terms of their movement; as a result, robots are increasingly replacing
expensive specialist mechanics. This also enables production from the first
production batch without expensive modifications to machines and plants.
Unfortunately, plant controllers and robot controllers usually constitute two different
systems. Communication between the two controllers usually occurs solely on the
bit level and the movement programs of the robot are stored on the robot controller
and may only be called up by the plant controller. It is therefore difficult to trigger
flexible robot reactions to specific plant events.
Also, the plant controller and the robot are usually very different in terms of their
programming, which means that it is not possible for one person to control both
systems. Interface and coordination problems are therefore pre-programmed.
1.1
Overview
A complete integration of the actuation and the movement control of the robot into
the machine and plant controller should make the use of the industrial robot in a
production plant easier and more flexible.
The following requirements are imposed on the automation task:
• The robot should be fully programmable via the machine and plant controller
(PLC).
• The robot can be operated via the same HMI of the PLC/machine (Single Point
of Operation).
• Robot diagnostics should be fully possible via the PLC.
•
It should be possible to integrate further functions such as Safety Integrated
and PROFIenergy and control them via the PLC.
1.2
How it works
A KUKA industrial robot is to be fully programmed and operated using a SIMATIC
S7-1500 controller. The KUKA.PLC mxAutomation block library in the TIA Portal is
used; this provides all the function blocks required for this purpose. Additional
programming of the robot controller is therefore not required.
Communication between the SIMATIC S7-1500 controller and the KUKA industrial
robot takes place via a PROFINET connection. All commands and status
information between the SIMATIC controller and the robot are exchanged via this
connection.
Note
With a SIMATIC S7-1500 controller, up to five KUKA industrial robots can be
simultaneously controlled in the TIA Portal using the KUKA.PLC mxAutomation
block library.
The Application Example presented here, however, is limited to the coupling of a
robot to a SIMATIC S7-1500.
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
5
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
1 Introduction
Diagram
The following diagram provides a schematic representation of the most important
components of the Application Example:
Figure 1-1: Schematic overview of the Application Example
The movement control of the KUKA industrial robot is fully programmed in the
SIMATIC controller using the KUKA.PLC mxAutomation block library. The robot is
assigned to the SIMATIC controller via a PROFINET connection as an I/O device.
The KUKA industrial robot consists of the KUKA robot controller KR C4 and the
robot arm. The interpreter for the KUKA.PLC mxAutomation block library
commands is installed on the robot controller. The interpreter receives the
SIMATIC controller commands and executes these, including the kinematics
transformation, via the robot mechanics.
Advantages
Programming a KUKA industrial robot using a SIMATIC S7-1500 controller with the
KUKA.PLC mxAutomation block library in the TIA Portal offers the following
advantages:
• All programming of robots and plants is performed in the TIA Portal. Training in
a robot manufacturer-specific development environment is not necessary.
• The movement program of the robot is fully integrated into the plant control
program and can be archived together with this program.
• The robot cell can be fully integrated into the SIMATIC plant controller.
• The operation of the robot can be integrated into the HMI user interface of the
plant.
• Diagnostic messages of the robot are sent to the SIMATIC controller where
they can be further processed and displayed on the HMI user interface of the
plant.
• Remote access to the SIMATIC controller for service and maintenance is
possible via standard functions and can be extended to the robot.
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
6
PROFINET / IESIMATIC CPUS7-1516FKR C4 compactKR 6 R900 SIXX(KR AGILUS)
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
1 Introduction
1.3
Aim of this Application Example
The Application Example provided here provides an example of how the
KUKA.PLC mxAutomation block library in the TIA Portal is used and shows which
functions are required to program and operate a KUKA robot using a SIMATIC
controller.
The Application Example is intended to familiarize you with the basic functions of
the KUKA.PLC mxAutomation block library in the TIA Portal and to serve as a
guide for decision-making and planning your own projects and user programs with
a KUKA industrial robot.
The functionality of the blocks from the KUKA.PLC mxAutomation block library is
shown by means of the creation of three function blocks in which the following
functions of the robot are programmed:
• Switching on the robot (KukaControl)
•
Implementation of a simple pick & place movement (PickPlace)
• Moving the robot on a circular path (Circle)
The Application Example is suitable for programming a basic control of the robot in
the SIMATIC controller.
Based on this Application Example, a further example which shows the use of a
KUKA industrial robot with an extended range of functions, including the required
HMI user interface, can be requested from Siemens Robotics Support. For more
information on this topic, refer to chapter 5.1
A detailed description of the function and application of the KUKA.PLC
mxAutomation block library can be found in the KUKA documentation for the
KUKA.PLC mxAutomation library which can be found in chapter 5.4.
Required knowledge
Basic knowledge of the creation of a user program on the SIMATIC S7-1500 in the
TIA Portal or the hardware configuration is not taught in this Application Example,
but is assumed.
In addition, this Application Example is not an introduction to robotics. Basic
knowledge of the application and the capabilities of an industrial robot are also
required.
1.4
Components used
The Application Example was created with the following hardware and software
components:
Table 1-1: SIEMENS components
Component
Number
Article number
Note
SIMATIC CPU S7-1516F
1
6ES7 516-3FN01-0AB0 Firmware version 2.5
TIA Portal V15
STEP 7 Professional
1
6ES7822-1AE05-0YA5
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
7
d
e
v
r
e
s
e
r
s
t
h
g
i
r
l
l
A
8
1
0
2
G
A
s
n
e
m
e
S
i
1 Introduction
Table 1-2: KUKA components
Component
Number
Article number
Note
KR C4 compact with
Firmware V8.5
KR 6 R700 SIXX (KR
AGILUS)
KUKA.PLC
mxAutomation
1
1
1
204-949
205-456
253-517
KUKA.PROFINET device 1
244-976
KUKA GSD file for KRC4
with Firmware V8.5
1
Robot controller
Robot arm
Version: V3.0.2
Version: V4.1
Consequently, the robot
can be used as a
PROFINET device.
Version 2.33
This Application Example consists of the following components:
Table 1-3
Component
Documentation
File name
109482123_S7-1500_KUKA_
mxAutomation_DOKU_v12_de.pdf
Note
This document.
TIA V15 Project
KUKA_BASIC_EXAMPLE_V15_ 1516F.zip
Example Program
S7-1500 / KUKA mxAutomation
Entry ID: 109482123, V1.2, 05/2018
8