Siemens S7 Series, S7-1200, S7-1500 Communication Instruction Manual

Communication with S7 CPU via KNX Gateway

S7-1200, S7-1500, PROFINET, “Triple-X PROFINET + KNX” Universal Gateway
Siemens Industry Online Support

Warranty and Liability

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
2
Siemens AG 2017 All rights reserved
Note
The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These Application Examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these Application Examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority.
Security informa­tion
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 only form one element of such a concept. Customer is responsible to prevent unauthorized access to its plants, systems, machines and networks. Systems, machines and components should only be connected to the enterprise network or the internet if and to the extent necessary and with appropriate security measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be
taken into account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them
more secure. Siemens strongly recommends to apply product updates as soon as available and to always use the latest product versions. Use of product versions that are no longer supported, and failure to apply latest updates may increase customer’s exposure to cyber threats. To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under http://www.siemens.com/industrialsecurity.
Warranty and Liability
We do not accept any liability for the information contained in this document. Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract
(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of the Siemens AG.
Table of Contents
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
3
Siemens AG 2017 All rights reserved
Table of Contents
Warranty and Liability ................................................................................................. 2
1 Task ..................................................................................................................... 4
1.1 Introduction ........................................................................................... 4
1.2 Overview of the automation task .......................................................... 4
2 Solution............................................................................................................... 5
2.1 Overview............................................................................................... 5
2.2 Description of the core functionality ..................................................... 7
2.3 Hardware and software components ................................................... 8
3 Mode of Operation ........................................................................................... 10
3.1 Data points and signal chart ............................................................... 10
3.2 Data point mapping ............................................................................ 11
3.3 Correlation of the gateway configuration files .................................... 12
4 Configuration and Project Engineering ......................................................... 14
4.1 STEP 7 (TIA Portal) device configuration .......................................... 14
4.2 Gateway: Setting the LAN IP address ................................................ 16
4.3 Gateway: Data backup ....................................................................... 18
4.4 Gateway: Editing configuration files ................................................... 19
4.4.1 Editing in the integrated web server ................................................... 19
4.4.2 Configuration files ............................................................................... 20
4.4.3 “eib1.cfg” gateway file ........................................................................ 20
4.4.4 “eib1.txt” gateway file ......................................................................... 21
4.4.5 “pnetd1.txt” gateway file ..................................................................... 22
4.4.6 “pnetd1.cfg” gateway file .................................................................... 23
4.4.7 “dispatch.txt” gateway file ................................................................... 24
4.5 Gateway: Overview of the configuration ............................................ 25
4.6 Gateway: Restart ................................................................................ 26
5 Installation and Commissioning .................................................................... 27
5.1 Installing the software ......................................................................... 27
5.2 Installing the hardware ....................................................................... 27
5.2.1 Installation under laboratory conditions .............................................. 27
5.2.2 Installation under plant conditions ...................................................... 28
5.3 Commissioning ................................................................................... 29
5.3.1 Commissioning the gateway .............................................................. 29
5.3.2 Commissioning the S7-1200 CPU ..................................................... 31
6 Operation of the Application Example .......................................................... 33
7 Links & Literature ............................................................................................ 35
8 MBS GmbH – Contact ...................................................................................... 35
9 History............................................................................................................... 36

1 Task

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
4
Siemens AG 2017 All rights reserved
KNX devices
KNX
gateway
PROFINET
SIMATIC
CPU
KNX
1 Task

1.1 Introduction

Gateways enable communication between two networks/bus systems that use different communications protocols.
KNX is a fieldbus for building automation. Technically, KNX is the successor to the European Installation Bus (EIB), adding communication mechanisms and transmission media.
The functionality of a KNX system can be extended by integrating an S7 CPU into a KNX system via a gateway. An S7 CPU enables the use of various functions and statements for creating a control program and processing data.
The “LGF (Library of general functions)” for STEP 7 (TIA Portal) and S7-1200 / S7­1500 additionally provides complementary functions such as an astronomical clock, weekly timer, FIFO and many more (see \4\).

1.2 Overview of the automation task

The task is to establish, using a KNX gateway, a communication connection between an S7 CPU via PROFINET (PN) and a KNX device via the KNX bus.
Each KNX device has a physical address (PA) via which the device can be accessed. The individual functions of a KNX device are addressed by group addresses (GA).
Through bidirectional data exchange between a KNX gateway and an S7 CPU, signals of a KNX device are to be processed in the S7 CPU or KNX devices are to be controlled using the S7 CPU.
The figure below provides an overview of the automation task. Figure 1-1: Block diagram of the automation task

2 Solution

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
5
Siemens AG 2017 All rights reserved
Triple-X PROFINET+KNX universal gateway
PROFINET
KNX devices
S7-1200 CPU
KNX
1
2 Solution

2.1 Overview

Diagrammatic representation
Representing all SIMATIC controllers, this solution uses an S7-1200 CPU. The diagrammatic representation below shows the most important components for communication between an S7-1200 CPU and a KNX network using the “Triple­X PROFINET + KNX” universal gateway from MBS GmbH.
Figure 2-1: Block diagram of the solution with the components used
The “Triple-X PROFINET + KNX” universal gateway enables communication between an S7-1200 CPU and KNX devices via PROFINET and the KNX bus.
In this example, the KNX devices consist of:
KNX wall switch triple  KNX room control unit  KNX power supply1
Correct communication is verified with the KNX devices and a STEP 7 (TIA Portal) watch table.
An external KNX power supply is necessary for operating a KNX network and is no
communication node in the network.
2 Solution
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
6
Siemens AG 2017 All rights reserved
Interface label
Communication
medium
Network
Connected device
PROFINET 1 or PROFINET 2
Ethernet
PROFINET
SIMATIC CPU (S7-1200 CPU)
LAN
Ethernet
LAN
PG / PC
KNX
Twisted pair cable
KNX
KNX devices (incl. KNX power supply)
2
Advantages
The following table shows the relevant interfaces of the gateway for this application example:
Table 2-1: Gateway interfaces
The solution presented here offers the following advantages: Easy adaptation to other controller families. Representing all other SIMATIC
controllers with a PROFINET IO interface, this solution uses the S7-1200 CPU.
Easy adaptation when expanding plants. The gateway is configured directly in
the gateway’s integrated web server.
Integration of the gateway as a PROFINET IO device via a GSD file.  Gateway as distributed I/O with up to 340 bytes of input and 340 bytes of
output.
Up to 2500 data points possible for communication between PROFINET and
KNX.
Scope
This document does not replace the gateway manual. If there are any
differences in the documentation, the documentation provided by MBS GmbH always takes precedence.
This application example only describes how to get started with KNX
communication with SIMATIC CPUs using a KNX gateway. For more information about the KNX gateway, please refer to the gateway manual or directly contact MBS GmbH.
Configuring the KNX devices using the ETS2 software and communication
between the gateway and the KNX devices are not part of this application example.
Sales, distribution, training, service and support for the “Triple-
X PROFINET + KNX” universal gateway are provided exclusively by MBS GmbH.
Required knowledge
Basic knowledge of STEP 7 (TIA Portal) programming and project engineering  Basic knowledge of PROFINET communication and configuration  Basic knowledge of the ETS software, KNX communication and KNX group
addresses
Engineering Tool Software (ETS) for programming nodes and assigning group addresses in a
KNX network.
2 Solution
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
7
Siemens AG 2017 All rights reserved
SIMATIC (S7-1200
CPU) Gateway
KNX
PROFINET
KNX
BOOL
BIT
UINT1 ↔ DPT-1
INT
SINT16
SINT16 ↔ DPT-7
REAL
FLOAT32
SFLOAT ← DPT-9

2.2 Description of the core functionality

Configuration
The connection between the S7-1200 CPU and the gateway is configured via
the configuration of the gateway as distributed I/O in STEP 7 (TIA Portal).  configuration files of the gateway (cfg and txt files) (see Figure 3-3) that
reference each other.
The configuration files are downloaded to the gateway using the integrated web server or directly edited.
Configuring and programming the gateway requires no ETS software. The gateway can access existing data points (group addresses) in the KNX network and provide its own data points locally on the gateway.
The assignment of the devices’ group addresses and physical addresses is not
part of this description. For more information, please refer to the supplied ETS5 sample project. The gateway’s physical address (KNX) is set using the “eib1.cfg” configuration file (see 4.4.3).
Function and data types
This application example contains a STEP 7 project and a data record for the gateway, where data of different data types is exchanged between an S7-1200 CPU and KNX devices in both directions via the gateway. A decimal value is transferred from the S7-1200 CPU to the KNX control room unit’s display and a status LED of the KNX wall switch is controlled via a binary signal. Conversely, the value of the integrated temperature sensor and a configurable decimal value are transferred from the KNX room control unit. Using the KNX wall switch, a boolean variable is set/reset in the S7-1200 CPU.
The following data types are used and parameterized:
Table 2-2: SIMATIC / gateway data types
2 Solution
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
8
Siemens AG 2017 All rights reserved
Component
No.
Article number
Note
POWER MODULE PM1207
1
6EP1332-1SH71
Power supply input: 120/230 V AC output: 24 V DC/2.5 A
SIMATIC S7-1214C DC/DC/DC FW4.2
1
6ES7214-1AG40­0XB0
Alternatively, any other S7-1200 CPU (FW4.1 or higher) or S7­1500 CPU (FW1.7 or higher) can be used.
Compact Switch Module
1
6GK7277-1AA00­0AA0
(optional) The switch is only required if you
want to simultaneously access (without “replugging”) the S7-1200 and the gateway from the PG/PC.
“Triple-X PROFINET + KNX”
universal gateway (RS485)
1
Manufacturer: MBS GmbH
Operating system: Linux 2.6.34.7 #267 Software module: V2_05W Hardware module:
15.1.1
http://www.mbs­solutions.de/profinet-knx
For the versions on the left, visit
the gateway web server’s page,
“Help > Device info”.
Alternative: RS232
Siemens Gamma KNX room control unit
1
5WG1227-2AB11
Operating and installation instructions
https://support.industry.siemens.c om/cs/ww/en/view/76776544
Siemens Gamma KNX wall switch triple
1
5WG1223-2DB13
-
Siemens Gamma KNX bus coupling unit
1
5WG1117-2AB12
-
Siemens Gamma KNX power supply
1
5WG1125-1AB01
Siemens Gamma KNX USB interface
1
5WG1148-1AB12
Optional. Interface for programming the KNX devices.

2.3 Hardware and software components

This application example was created with the following components:
Hardware components
Table 2-3: Hardware components
2 Solution
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
9
Siemens AG 2017 All rights reserved
Component
No.
Article number
Note
SIMATIC STEP 7 Professional V14 (TIA Portal)
1
6ES7822-1..04-..
-
GSDML-V2.31-MBS­MICRO3004-20150206
1
Manufacturer: MBS GmbH
The latest GSDML files are available directly from MBS GmbH. The GSDMLV2.31 file was used in this example. The files are available in the “AdditionalFiles – GSD” folder in the STEP 7 project. When opening the project, the GSD file is installed automatically.
ETS5 Demo
1
https://www.knx.org/kn x­en/software/ets/downl oad/index.php
Maximum of 5 KNX devices per project.
Component
Note
109739689_KNX_DOC_V10_en.pdf
This document
109739689_KNX_S7_PROJ_V10.zip
This .zip file contains the “MBS_KNX” STEP 7 project.
109739689_KNX_Gateway_RestoreFile_V10.zip
This zip file contains the
“ugwbackup.tgz” gateway
data backup with the configuration files.
109739689_KNX_ETS5_PROJ_V10.zip
This .zip file contains the ETS5 project.
Software components
Table 2-4: Software components
Sample files and projects
The following list contains all files and projects that are used in this example.
Table 2-5: Download files

3 Mode of Operation

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
10
Siemens AG 2017 All rights reserved
E
PROFINET KNX
Gateway
Q
outbit
outbyte
GA
S7-1200 CPU
KNX device
Signal chart
Q
Signal
Data point
E
GA
E
PROFINET KNX
Q Output
GA Group address
Type
Meaning
M
Integer value (binary data points, counts) that can only be read by the gateway.
S
Integer value that can be read and written by the gateway.
X
Analog value (with decimal places) that can only be read by the gateway.
Y
Analog value (with decimal places) that can be read and written by the gateway.
3 Mode of Operation
The data between the two bus systems, PROFINET and KNX, is exchanged between the drivers (PROFINET, KNX) in the gateway via data point mapping.
The data points are described in the pnetd1.txt and eib1.txt configuration files and mapped to each other in the dispatch.txt dispatch file.
For each data point, the format specifies how the driver should interpret the data at the data point address.

3.1 Data points and signal chart

Each interface of a device (CPU, KNX) that is used to transfer data represents a data point. As the gateway connects two different bus systems, it has two data points – the source data point and the target data point.
The example in the following figure shows a signal that is generated in the S7-1200 CPU and transmitted to the gateway via PROFINET. The gateway converts the PROFINET signal to a KNX telegram and sends it to the appropriate group address of the KNX device. In the same way, a signal can also be transmitted from a KNX device to the S7-1200 CPU.
Figure 3-1: S7-1200 CPU KNX device – signal chart
For the KNX driver and all other gateway drivers, the following types apply to the definition of the data types:
Table 3-1: Definition of the data point types
For a definition of “data points”, please refer to the gateway manual (\3\), section 6 “Protocol properties and data points”.
3 Mode of Operation
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
11
Siemens AG 2017 All rights reserved
OW 100
IW 100
O 102.0
O 102.0
setValInt
readValInt
setValBool
readValBool
PLC tags
Gateway
Name Data type
Length
Address Name AddressFormat
Length
PROFINET
S7-1200 CPU
Integrated
I/O
KNX-->S7 value
S inbyte 0SINT16
2 bytes
S7-->KNX statusLED
M outbit 2.0BIT
1 bit
KNX-->S7 switch
S inbit 2.0BIT
1 bit
S7-->KNX value
M outbyte 0
SINT16 2 bytes
INT
2 bytes
INT 2 bytes
BOOL 1 bit
BOOL 1 bit
PROFINET
AddressFormat
Length
M 1/1/1SINT16
2 bytes
S 1/1/4
UINT1 1 bit
M 1/1/3UINT1
1 bit
S 1/1/2SINT16
2 bytes
EIB/KNX
KNX
Process image
PLC_1 DI14
I 0 *
I/O Address
INPUT_32B_1 I
100..131
OUTPUT_32B_1 O
100..131
O 0 *
PLC_1 DO10_1
Data points
KNX devices
(wall switches, actuators…)
ID 103
readTemprInt REAL
4 bytes
KNX-->S7
temperature
Y inbyte 3
FLOAT32
4 bytes
X 1/1/5SFLOAT
2 bytes
Note
*Compact CPUs (e.g., S7-1200) with integrated digital inputs and outputs: In STEP 7 (TIA Portal), the smallest address 0 is automatically assigned to the
integrated digital inputs and outputs. Other modules / I/O are automatically assigned to the next available address.
Here, the address space starting with 100 was selected in the process image. This makes it easier to identify the connected tags between the S7-1200 CPU and the gateway.

3.2 Data point mapping

The following figure shows all of the data used and the process image of the S7­1200 CPU for the configuration with the gateway.
Please note: The input or output signal type always refers to the “perspective” of
the respective device.
Figure 3-2: Interaction between the process image of the S7 CPU and the data points in the gateway
3 Mode of Operation
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
12
Siemens AG 2017 All rights reserved
pnetd1.cfg
PROFINET
pnetd1.txt
dispatch.txt
eib1.cfg
KNX
Protocol
information
Definition of
data points
Definition of
data points
Protocol
information
Assignment between
data points
eib1.txt
File
Contents
Description
pnetd1.cfg
PROFINET protocol information
This file contains information and settings for the PROFINET network, including the I/O used in the network.
Here: I/O configuration of the gateway in STEP 7 (TIA Portal)
pnetd1.txt
Definition of the PROFINET data points
Defines how and with which data type the data points are interpreted.
dispatch.txt
Assignment between KNX data points and PROFINET data points
This file describes the assignment of the data points between the PROFINET side (pnetd1.txt) and the KNX side (eib1.txt).
eib1.txt
Defines the KNX data points
This file contains the description of the individual data points on the KNX side.
eib1.cfg
KNX protocol information
This file contains information and settings for the KNX protocol.

3.3 Correlation of the gateway configuration files

The gateway is configured using various configuration files (cfg, txt files). Once programming is complete, these files are uploaded in a text editor (for example, Notepad++) using the integrated web server in the gateway or directly edited and enabled in the integrated web server. A configuration check is performed in the gateway and any errors are displayed.
As the gateway supports different bus systems (PROFINET, KNX, BACnet…),
there are different driver files with protocol information (files with the .cfg extension) and a file with the definition of the data points (.txt extension).
The dispatch file (dispatch.txt) is an integral part. It contains the mapping of the data points of the different protocols to each other.
The data points are programmed as objects. For the exact meaning and structure of these files, please refer to the gateway manual (\3\). The gateway data backup cfg and txt files also contain this information as comment lines.
For the complete configuration, please refer to the supplied “ugwbackup.tgz”
gateway data backup in the “ugw > config” folder and the included comments
(109740160_KNX_Gateway_RestoreFile_Vxx.zip). Figure 3-3: Gateway configuration files
Table 3-2: Gateway configuration files
3 Mode of Operation
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
13
Siemens AG 2017 All rights reserved
Note
In the gateway configuration files, KNX objects are identified by “eib…” and
PROFINET objects are identified by “pnetd…”.
Note
In addition, the following configuration files exist that need to be downloaded to the gateway but not edited:
driver.cfg  ugwc1.cfg  ugwc1.txt  gateway.cfg  ntp.cfg  plants.cfg
These files are not described in greater detail in this application. If you require more information, please contact MBS GmbH.
This application example describes how to edit and customize these files so that they can be used for data exchange (see Chapter 4.4 Gateway: Editing
configuration files). Along with this description, you are provided with a data backup
file with the ready-to-use sample files that you can customize for your own application.

4 Configuration and Project Engineering

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
14
Siemens AG 2017 All rights reserved
Note
Before you can configure the gateway in STEP 7 (TIA Portal), you must install
the gateway’s GSD file. The GSD file can be found on the gateway’s web user
interface, “Profinet > GSDML file”. \6\ provides a description of how to install a
GSD file in TIA Portal.
When you open the supplied “MBS_KNX” STEP 7 project, the GSD file is
installed automatically, see 5.3.2 Commissioning the S7-1200 CPU.
No.
Action
Comment
1.
Create a STEP 7 (TIA Portal) project and insert an S7-1200 CPU (S7-1214C DC/DC/DC FW4.2).
Requirement: You have STEP 7 (TIA Portal) V14 or higher installed on your computer.
2.
In “Devices & networks”, open the “Network
view”.
In the hardware catalog, navigate to “Head
module”, “UGW-micro”.
Make sure that the firmware version (V2.31) is correct.
4 Configuration and Project Engineering
This chapter describes the configuration in STEP 7 (TIA Portal) and the programming of the gateway configuration files.
If you want to use the sample configuration of this application example without any changes, you can download the STEP 7 project directly to the S7-1200 CPU and the gateway configuration to the gateway (see Chapter 5.3.1 Commissioning the
gateway).

4.1 STEP 7 (TIA Portal) device configuration

Table 4-1: Device configuration in STEP 7 (TIA Portal)
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
15
Siemens AG 2017 All rights reserved
No.
Action
Comment
3.
Use drag and drop to move the “UGW-micro”
from the hardware catalog to the “Devices &
networks” editor.
4.
Click “Not assigned”) for the UGW-micro and select the interface of the S7-1200 CPU used (“PLC_1.PROFINET…”).
5.
Set the following PROFINET IP address: S7-1200 CPU: 192.168.0.1 UGW-micro: 192.168.0.2
6.
Double-click the UGW-micro to open the UGW-micro device view.
7.
Open the hardware catalog and navigate to the gateway’s input/output modules.
Equip the UGW-micro with the required modules.
Change the I/Q addresses to the range starting with 100.
8.
Create a PLC tag table, for example
“TagsUGW”, as shown in the figure on the
right.
9.
Create the watch table, for example
“WatchTableUGW”, to monitor and modify the
tags.
Note
As the tags directly access the process image, no system blocks (SFC, SFB) are necessary.
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
16
Siemens AG 2017 All rights reserved
No.
Action
Comment
1.
Make sure that your computer is in the same subnet as all
the components involved,
all the components are connected using
LAN cables,
all the components are connected to a
power supply and turned on.
See Chapter 5.2 Installing the hardware
2.
Start your preferred web browser and connect to the gateway web server.
Factory default: IP address: 169.254.0.1 User name: gw Password: GATEWAY
3.
Select “General > IP-Network” to set the IP address of the gateway’s LAN interface.
4.
1. Change the IP address.
2. Select “Save” to save the setting.
Note After saving, you need to reconnect to the gateway using the new IP address you have just set.
Note For successful communication with the gateway, the IP address of your PC must be in the same subnet. If necessary, change the IP address of your PC.

4.2 Gateway: Setting the LAN IP address

Table 4-2: Setting the IP address of the gateway
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
17
Siemens AG 2017 All rights reserved
No.
Action
Comment
5.
When you have logged back on to the gateway using the new IP address, a complete system restart is required.
Click the “Restart required!” button to perform
a restart.
Use the “complete system restart” option to
restart the gateway as described in Chapter
4.6.
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
18
Siemens AG 2017 All rights reserved
No.
Action
Comment
1.
Make sure that your computer is in the same subnet as all
the components involved,
all the components are connected using
LAN cables,
all the components are connected to a
power supply and turned on.
See Chapter 5.2 Installing the hardware
2.
Start your preferred web browser and connect to the gateway web server.
Default settings:
IP address: 169.254.0.1  User: “gw” Password: “GATEWAY”
3.
If necessary, back up all gateway configuration
files using the “Backup/Restore” menu that
allows you to restore the default settings if
necessary (see the “Help > Online help” UGW
menu item).
To back up data, navigate to “General >
Backup/Restore > Backup gateway
configuration”. Click “Start” and follow the menu prompts.

4.3 Gateway: Data backup

Table 4-3: Perform the gateway data backup
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
19
Siemens AG 2017 All rights reserved
No.
Action
Comment
1.
From the top menu bar, select “EIB” to edit the
configuration files for the KNX protocol. Alternative: From the top menu bar, select
“Profinet” to edit the files of the PROFINET protocol.
2.
From the left menu bar, select “Files”.
3.
Click the Edit icon of the configuration file you want to edit.
4.
A new window opens where you can make the changes.
Click “Save” to save the changes.
5.
After saving, the window closes automatically and the “Restart required!” message appears.
Restart the gateway as described in Chapter
4.6.

4.4 Gateway: Editing configuration files

This chapter provides a detailed description of the structure and editing of the gateway configuration files.
You can edit the files directly in the integrated web server or download the files, edit them with a text editor (for example, Notepad++) and then upload them back to the gateway.
Chapter 3.3 Correlation of the gateway configuration files provides you with an overview of how the configuration files correlate.

4.4.1 Editing in the integrated web server

The following instructions describe how to edit the configuration files directly in the integrated web server.
Table 4-4: Editing in the integrated web server
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
20
Siemens AG 2017 All rights reserved
No.
Description
Comment
1.
Make the necessary parameter settings such as the physical address in the KNX network (PhysicalAddress). The physical address must be freely available in the KNX network.
You can also keep the default setting. For a detailed description of the individual
parameters, please refer to the “eib1.cfg” file’s comment.
[EIB]
Baudrate = 38400 Queuesize = 2000
ForceAuto = 0 MonitorMode = 0
AliveCheck = 0
BcuType = 2 PhysicalAddress = 1.1.99

4.4.2 Configuration files

For the configuration of the gateway, the following files are edited and then downloaded to the gateway using the integrated web server or directly edited in the integrated web server.
pnetd1.cfg  pnetd1.txt  eib1.cfg  eib1.txt  dispatch.txt

4.4.3 “eib1.cfg” gateway file

The KNX protocol settings are made in the “eib1.cfg” configuration file.
Table 4-5: Structure of the “eib1.cfg” gateway file
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
21
Siemens AG 2017 All rights reserved
No.
Description
Comment
1.
The KNX data points have the following structure:
[<def> <group address>] name = <name> format = <format>
<def>:For the definition of data points, see
Table 3-1: Definition of the data point types
<group address>: Two- or three-digit KNX group address.
Two-digit: <maj>/<min> Three-digit: <maj>/<mid>/<ext>
<maj>: 0-31 <min>: 0-2047 <mid>: 0-7 <ext>: 0-255
<name>: Optional; you can specify plain text for the data point.
<format>: Protocol-dependent properties of the data point such as the data point for interpreting the information stored at the
address. If necessary, more parameters can be added
to the format, for example the poll rate (here: P:10 for read value every 10 seconds):
format = <format> [F:<fact>] [P:<poll>][U:<upd>] [I:<opt>] [L:<loc>] [H:<prio>] [R:<addr>] [D:<dly>]
For more driver-specific information such as type, address, formats and other parameters, please refer to the online documentation provided by MBS at the following link:
http://wiki.mbs­software.info/doku.php?id=eib_knx
[M failure]
name = EIB Failure
[M 1/1/1]
name = KNX-->S7 value format = SINT16
[S 1/1/2]
name = S7-->KNX value
format = SINT16
[M 1/1/3]
name = KNX-->S7 switch format = UINT1
[S 1/1/4]
name = S7-->KNX statusLED
format = UINT1
[X 1/1/5]
name = KNX-->S7 temperature format = SFLOAT P:10
Note
For the driver to be provided with current values for all data points when starting up the gateway, all data points defined in the driver must have the read flag set on the ETS side.

4.4.4 “eib1.txt” gateway file

The data points of the KNX protocol and their properties are defined in the “eib1.txt” configuration file.
Table 4-6: Structure of the “eib1.txt” gateway file
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
22
Siemens AG 2017 All rights reserved
No.
Description
Comment
1.
The addresses of the PROFINET data points have the following structure:
[<def> <type> <byte>.<bit>]
name = <name> format = <format>
<def>: For the definition of data points, see
Table 3-1: Definition of the data point types
<type>: inbyte: Byte value that can be read by the
controller inbit: Single bit that can be read by the
controller outbyte: Byte value that can be written by
the controller outbit: Single bit that can be written by the
controller
<byte>: 0..339 ( nth byte in the input/output register)
<bit>: 0..7 (single bit within the nth byte)
<name>: Optional; you can specify plain text for the data point.
<format>: Protocol-dependent properties of the data point such as the data point for interpreting the information stored at the address.
If necessary, more parameters can be added to the format, for example a poll rate (P:x):
format = <format> [F:<fact>] [P:<poll>][U:<upd>] [I:<opt>] [L:<loc>] [H:<prio>] [R:<addr>]
[D:<dly>]
For more driver-specific information such as type, address, formats and other parameters, please refer to the online documentation provided by MBS at the following link or the “pnetd1.txt” file:
http://wiki.mbs­software.info/doku.php?id=profinet_io-device
#---------------------------------
# STATUS #---------------------------------
[M failure]
name = profinet communication state 0=ok / 1=fail
format = BIT
#---------------------------------
# INPUT BUFFER (max 340 bytes)
#--------------------------------­[S inbyte 0]
name = KNX-->S7 16-bit dec
format = SINT16
[S inbit 2.0] name = KNX-->S7 1-bit
format = BIT
[Y inbyte 3]
name = KNX-->S7 temperature
format = FLOAT32
#--------------------------------­# OUTPUT BUFFER (max 340 bytes)
#---------------------------------
[M outbyte 0] name = S7-->KNX 16-bit dec
format = SINT16
[M outbit 2.0]
name = S7-->KNX 1-bit
format = BIT

4.4.5 “pnetd1.txt” gateway file

The data points of the PROFINET protocol and their properties are defined in the “pnetd1.txt” configuration file.
Table 4-7: Structure of the “pnetd1.txt” gateway file
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
23
Siemens AG 2017 All rights reserved
No.
Description
Comment
1.
The device configuration of the gateway can be found in STEP 7 (TIA Portal).
2.
In the pnetd1.cfg configuration file, the device configuration of the gateway is programmed line by line according to the device configuration in STEP 7 (TIA Portal).
Each device is referred to as a module (Mod001, Mod002,..).
For an example of how to parameterize each module type, please refer to the “pnetd1.cfg” file.
Mod001 = ID:0x16 IN:32 OUT:0 #INPUT_32B
Mod002 = ID:0x26 IN:0 OUT:32 #OUTPUT_32B
Note
When configuring, please note the following: All modules following “Mod001” must be numbered consecutively and
without gaps.
Upper limit: 60 modules (“Mod060”) The configuration is not applied until a power cycle (turn off and back on) of
the gateway is complete.

4.4.6 “pnetd1.cfg” gateway file

The PROFINET device settings are made in the “pnetd1.cfg” configuration file. When configuring, make sure that the STEP 7 configuration and the gateway’s configuration file match exactly.
Table 4-8: Structure of the “pnetd1.cfg” gateway file
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
24
Siemens AG 2017 All rights reserved
No.
Description
Comment
1.
Syntax of a dispatch entry:
[<route source> <type source> <address>]
target = <route target> <type target> <address>
<route source>: Source driver routing address
<type source>: Source driver name <route target>: Target driver routing
address
<type target>: Target driver name
<address>: Data point address
Note For a data point to be used in the dispatch.txt file, the data point must have previously been declared in the driver-specific *.txt files.
# S7 --> KNX
[1190 pnetd outbyte 0] target = 70 eib 1/1/2
[1190 pnetd outbit 2.0] target = 70 eib 1/1/4
# KNX --> S7
[70 eib 1/1/1]
target = 1190 pnetd inbyte 0
[70 eib 1/1/3]
target = 1190 pnetd inbit 2.0
[70 eib 1/1/5]
target = 1190 pnetd inbyte 3
2.
For a driver’s routing address and name, go to
“General > Overview”.
Note
In the dispatch file, you can use formulas for calculating data points. For more information about this and the dispatch mechanism, please refer to Links & Literature, \5\.

4.4.7 “dispatch.txt” gateway file

The assignment between KNX data points and PROFINET data points is made in the “dispatch.txt” configuration file.
Table 4-9: Structure of the “dispatch.txt” gateway file
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
25
Siemens AG 2017 All rights reserved

4.5 Gateway: Overview of the configuration

The following overview shows you the correlation of the gateway configuration files.
eib1.txt
[M 1/1/3]
name = KNXS7 switch format = UINT1
[S 1/1/2]
name = S7KNX value format = UINT1
dispatch.txt
# S7 KNX
[1190 pnetd outbyte 0]
target = 70 eib 1/1/2
# KNX S7
[70 eib 1/1/3]
target = 1190 pnetd inbit 2.0
pnetd1.txt
[M outbyte 0]
name = S7KNX value
format = SINT16
[S inbit 2.0]
name = KNXS7 switch
format = BIT
pnetd1.cfg
Mod001 = ID:0x16 IN:32 OUT:0 # INPUT_32B
Mod002 = ID:0x26 IN:0 OUT:32 # OUTPUT_32B
4 Configuration and Project Engineering
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
26
Siemens AG 2017 All rights reserved
Note
For changes of the configuration files to be activated, restart the gateway. If changes are made in the “pnet1.cfg” PROFINET driver file, a complete restart
(de-energized) of the gateway is required.
No.
Action
Comment
1.
Click the “Restart required!” button.
Alternative: To restart the gateway, navigate to the
“General > Restart > Restart” menu item.
Alternative:
2.
The gateway automatically checks the
configuration files and, in the “Configuration check” tab, displays errors and warnings and
the specific file and line where the cause can be found.
Check the appropriate files/lines. If the current configuration in the gateway is
correct, click “Next”.
3.
Go to the “Restart Gateway” tab.
Optionally, you can check the “complete system restart” check box to perform a
complete system restart.
Click the “Restart” button to confirm the action
and follow the menu prompts.
4.
After the restart, the changes made are activated.
Note
After a complete system restart, you have to log back on to the gateway.
-

4.6 Gateway: Restart

Table 4-10: Restarting the gateway

5 Installation and Commissioning

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
27
Siemens AG 2017 All rights reserved
Note
Always follow the below installation guidelines:
“S7-1200 Programmable Controller” System Manual
Gateway manual
PROFINET 1 / 2
IP: 192.168.0.2
RS 232/485
PN
24V DC
LAN
PN
CSM / switch
24V DC
S7-1200 CPU
24V DC
PG/PC
IP: 192.168.0.1
IP: 192.168.0.3
KNX
+ -
Triple-X PROFINET + KNX universal gateway
KNX power supply
L
+
-
N PE
230 V AC
KNX wall switch
+
-
KNX room control unit
+
-
USB interface
+
-
KNX
PROFINET IE
LAN
USB
IP: 192.168.0.100
5 Installation and Commissioning
This chapter describes the steps necessary to start up the example.

5.1 Installing the software

Install the latest version (V14 or higher) of STEP 7 (TIA Portal) on your computer. No additional software is needed for configuring the “Triple-X PROFINET+KNX”
universal gateway. It is configured using the integrated web server.

5.2 Installing the hardware

5.2.1 Installation under laboratory conditions

For the function test of this application under laboratory conditions, the following installation using a switch is suitable. It allows you to simultaneously execute all of the below functions (see the following advantages) with a single PG/PC.
Figure 5-1: Installation under “laboratory conditions”
5 Installation and Commissioning
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
28
Siemens AG 2017 All rights reserved
PROFINET 1 / 2 IP: 192.168.0.2
RS 232/485
Triple-X PROFINET + KNX universal gatewy
LAN
PN
24V DC
S7-1200 CPU
24V DC
IP: 192.168.0.1
IP: 192.168.0.3
KNX
+ -
PROFINET IE
KNX
KNX power supply
+ -
L N PE
KNX wall switch
+ -
KNX room control unit
+ -
230V AC

5.2.2 Installation under plant conditions

Under “real” conditions, a SIMATIC controller is normally directly connected to a
KNX gateway. The gateway is integrated into a PROFINET network via the two PROFINET interfaces and connected to the KNX network via the KNX interface.
Figure 5-2: Installation under plant conditions
5 Installation and Commissioning
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
29
Siemens AG 2017 All rights reserved
Note
For some actions in the gateway web server, you need a user name and password.
Default setting (as-supplied state): User name: gw IP address: 169.254.0.1
Password: GATEWAY If this login does not work, please refer to the gateway manual or contact MBS
GmbH.
No.
Action
Comment
1.
Unzip the
“109740160_KNX_Gateway_RestoreFile_Vxx.
zip” file (e.g., using “7-Zip”).
You get the “ugwbackup.tgz” file.
2.
Start your preferred web browser and connect to the gateway web server.
Factory default: IP address: 169.254.0.1 User name: gw Password: GATEWAY
3.
Navigate to “General > Backup/Restore” and check the “Restore gateway configuration”
check box.
Click “Browse…” and navigate to the
“ugwbackup.tgz” file.
4.
Then click the “Start” button. The contained data is unzipped and
downloaded directly to the gateway.
The following files are overwritten in the gateway:
eib1.cfg  eib1.txt  dispatch.txt  driver.cfg  gateway.cfg  ntp.cfg  pnetd1.cfg  pnetd1.txt  ugwc1.cfg  ugwc1.txt

5.3 Commissioning

This chapter describes the steps for downloading the sample project to the S7-1200 CPU and the sample configuration to the gateway.

5.3.1 Commissioning the gateway

Table 5-1: Commissioning the gateway
5 Installation and Commissioning
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
30
Siemens AG 2017 All rights reserved
No.
Action
Comment
5.
Click “OK” to confirm the following message.
Note Restoring the data backup overwrites the
gateway’s IP address setting (here:
192.168.0.3).
6.
Enabling the restored configuration requires a restart.
Select “Yes” to confirm the message.
5 Installation and Commissioning
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
31
Siemens AG 2017 All rights reserved
No.
Action
Comment
1.
Start STEP 7 (TIA Portal) and open the
“MBS_KNX” STEP 7 project from the
“109740160_KNX_S7_PROJ_Vxx.zip” file.
Note
The gateway’s GSD file is installed
automatically.
Requirement: You have STEP 7 (TIA Portal) V14 or higher installed on your computer.
2.
Open “Devices & networks”.
-
3.
Right-click the connection and select “Assign device name”.
4.
Assign the PROFINET device name to the S7-1200 CPU and the gateway.
1. Select the device name you want to assign.
2. Click “Update List”. The suitable device type is automatically found in the network and displayed in the list.
3. From the list, select the device to which you want to assign the selected name.
4. Click “Assign name”.
5.
1. In the project tree, select the S7-1200 CPU (here: PLC_1).
2. In the menu bar, click the “Download to device” button.

5.3.2 Commissioning the S7-1200 CPU

Table 5-2: Commissioning the S7-1200 CPU
5 Installation and Commissioning
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
32
Siemens AG 2017 All rights reserved
No.
Action
Comment
6.
Acknowledge the download dialogs and set the S7-1200 CPU to RUN.
After the download, the devices have also been assigned their PROFINET IP addresses.
-
7.
In the project tree, select the S7-1200 (PLC_1) and in the menu bar, click “Go online”.
If everything was parameterized and downloaded correctly, all icons are green.

6 Operation of the Application Example

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
33
Siemens AG 2017 All rights reserved
No.
Action
Comment
1.
In STEP 7 (TIA Portal), open the “WatchTableUGW” watch table.
2.
1. Click the “Monitor all” button.
2. Monitor the room temperature of the KNX room control unit.
3.
Compare the room temperature from the watch table with the display in the KNX room control unit.
4.
On the KNX room control unit, navigate to the
“SET” function named “KNXS7” and set a
new value.
5.
In the watch table, monitor the value change of the “readValInt” tag.
2
6 Operation of the Application Example
You can verify communication between the S7-1200 and the KNX devices using the watch table in TIA Portal and the functions of the KNX devices.
Table 6-1: Monitoring and modifying tags using the watch table
6 Operation of the Application Example
Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
34
Siemens AG 2017 All rights reserved
No.
Action
Comment
6.
On the KNX wall switch triple, press A1.
7.
In the watch table, monitor the value change of the “readValBool” tag.
8.
1. Enter a new value for the “setValInt” tag.
2. Click the button to modify the value.
9.
On the KNX room control unit, navigate to the
“i” function named “S7KNX” and monitor the
value change.
10.
1. Right-click the “setValBool” tag.
2. In “Modify”, select the “Modify to 1” function.
11.
On the KNX switch, monitor the switching of status LED A2.

7 Links & Literature

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
35
Siemens AG 2017 All rights reserved
Topic
\1\
Siemens Industry Online Support
https://support.industry.siemens.com
\2\
Download page of the entry
https://support.industry.siemens.com/cs/ww/en/view/109739689
\3\
Product page with gateway data sheet, manual
http://www.mbs-solutions.de/profinet-knx
\4\
Library of general functions (LGF) for STEP 7 (TIA Portal) and S7-1200 / S7-1500
https://support.industry.siemens.com/cs/ww/en/view/109479728
\5\
Dispatch mechanism of the gateway
http://wiki.mbs-software.info/doku.php?id=the_dispatch-mechanism
\6\
How do you install a GSD file in STEP 7 (TIA Portal)?
https://support.industry.siemens.com/cs/ww/en/view/109738401
7 Links & Literature
Table 7-1: Links

8 MBS GmbH – Contact

Figure 8-1: MBS GmbH
MBS GmbH Römerstraße 15 47809 Krefeld, Germany Phone: +49 2151 7294-0 Fax: +49 2151 7294-50
info@mbs-software.de http://www.mbs-solutions.de/

9 History

Communication with S7 CPU via KNX Gateway Entry ID: 109739689, V1.0, 06/2017
36
Siemens AG 2017 All rights reserved
Version
Date
Modifications
V1.0
06/2017
First version
9 History
Table 9-1
Loading...