You are on page 1of 61

Communication with

S7-CPU via BACnet


Gateway

S7-1200 CPU / S7-1500 CPU and


Siemens
UGW//micro PROFINET RS232/RS485 Industry
Online
https://support.industry.siemens.com/cs/ww/en/view/109476182 Support
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
© Siemens AG 2019 All rights reserved

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.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 2
Table of contents

Table of contents
Legal information ......................................................................................................... 2
1 Introduction ........................................................................................................ 4
1.1 Overview............................................................................................... 4
1.2 Principle of operation............................................................................ 6
1.2.1 Data points and signal processing ....................................................... 6
1.2.2 Process image: S7-CPU and UGW (BACnet)...................................... 8
1.2.3 Context of the UGW configuration files ................................................ 9
1.3 Components used .............................................................................. 11
2 Engineering ...................................................................................................... 13
2.1 Hardware setup .................................................................................. 13
2.1.1 Assembly under laboratory conditions ............................................... 14
2.1.2 Assembly under plant conditions ....................................................... 15
2.2 Installing the software ......................................................................... 16
2.3 Configuration ...................................................................................... 17
2.3.1 STEP 7 (TIA Portal) Device Configuration ......................................... 17
2.3.2 Editing the UGW configuration files ................................................... 20
2.4 Commissioning ................................................................................... 27
2.4.1 Commissioning UGW ......................................................................... 27
2.4.2 Commissioning S7-1200 CPU ........................................................... 30
2.5 Operation ............................................................................................ 35
2.5.1 Changing values in the S7-1200 CPU ............................................... 35
© Siemens AG 2019 All rights reserved

2.5.2 Changing values on the BACnet side ................................................ 41


3 Useful information ........................................................................................... 47
3.1 UGW configuration data ..................................................................... 47
3.1.1 UGW file "pnetd1.cfg" ......................................................................... 48
3.1.2 UGW file "pnetd1.txt" .......................................................................... 49
3.1.3 UGW file "dispatch.txt" ....................................................................... 52
3.1.4 UGW file "bac1.txt" ............................................................................. 54
3.1.5 UGW file "bac1.cfg" ............................................................................ 57
3.2 Details on functionality ....................................................................... 58
4 Appendix .......................................................................................................... 60
4.1 Service and support ........................................................................... 60
4.2 Contact MBS GmbH ........................................................................... 61
4.3 Links and literature ............................................................................. 61
4.4 Change documentation ...................................................................... 61

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 3
1 Introduction

1 Introduction
Gateways enable communication between two networks using different
communication protocols.
BACnet (Building Automation and Control Networks) is a network protocol that is
used in technical building automation.

1.1 Overview
This application example shows how to establish a communication connection to a
BACnet gateway via the integrated PROFINET interface of a SIMATIC S7-CPU.

Figure 1-1
S7-CPU
BACnet
Gateway

BACnet devices
© Siemens AG 2019 All rights reserved

PROFINET / IE LAN / BACnet

This application example uses an S7-1200 CPU and the universal gateway
"UGW/micro PROFINET RS232/485" (UGW) from MBS GmbH.
The UGW enables communication via different bus systems (PROFINET, BACnet,
etc.) and different communication protocols between a S7-1200 CPU and BACnet
devices.
In this example no BACnet devices are used. With the web server of the UGW and
the optional software BACeye of the company MBS GmbH the correct
communication is verified.

Advantages
• The application example can be easily adapted to other control families. An
S7-1200 CPU is used as a representative for all SIMATIC S7-CPUs with
integrated PROFINET interface. Thus, the solution is scalable and can be used
for the respective application.
• The application example can be easily adapted for system extensions. The
parameterization of the UGW is done with a standard text editor or directly in
the integrated web server of the UGW.
• No additional software is required for the parameterization and commissioning
of the UGW. Standard tools like a web browser such as Google Chrome or
Internet Explorer and a simple text editor are enough. A special project
planning tool for the UGW isn`t needed.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 4
1 Introduction

Delimitation
• In case of differences in the documentation concerning BACnet, the
documentation of the company MBS GmbH always has priority.
• This document does not replace the manual of the universal gateway
"UGW/micro PROFINET RS232/485".
• This application example only describes the introduction to BACnet
communication with a SIMATIC S7-CPU. Detailed information on BACnet
communication can be found in the Universal Gateway manual "UGW/micro
PROFINET RS232/485" or directly in contact with MBS GmbH.
• The communication between the UGW and BACnet devices is not part of this
application example.
• Training, service and support for the universal gateway "UGW/micro
PROFINET RS232/485" are provided exclusively by MBS GmbH. Siemens AG
does not conduct any training on the subject of BACnet.

Required knowledge
• Basic knowledge of programming in STEP 7 (TIA Portal) is required.
• Basic knowledge of PROFINET and BACnet communication is required.
© Siemens AG 2019 All rights reserved

Validity
This application is effective for:
• STEP 7 (TIA Portal) from V15.1
• S7-1200 CPU from Firmware V4.1 (adjustable for S7-1500 CPU from
Firmware V1.7)
• MBS UGW/micro PROFINET RS232 und MBS UGW/micro PROFINET RS485

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 5
1 Introduction

1.2 Principle of operation


The following steps are necessary to set up the connection between S7-1200 CPU
and UGW:
• Perform device configuration in STEP 7 (TIA Portal).
• Creating a configuration file:
The configuration files consist of CFG- and TXT-files which reference each
other. These files are loaded into the UGW via an integrated web server or
edited directly.
This application example contains a STEP 7 project and a data set for the UGW in
which data of different data types are exchanged in both directions between a
S7-1200 CPU and a UGW.
All common formats of the S7-1200 CPU and the UGW were parameterized
exemplarily.
Table 1-1
S7-1200 CPU UGW
BOOL ↔ BIT
USINT ↔ UINT8
UINT ↔ UINT16
UDINT ↔ UINT32
© Siemens AG 2019 All rights reserved

SINT ↔ SINT8
INT ↔ SINT16
DINT ↔ SINT32
REAL ↔ FLOAT32

1.2.1 Data points and signal processing

The communication between a S7-1200 CPU and a BACnet device can take place
in both directions.
The Figure 1-2 shows a signal which is generated by a BACnet device and read in
via an input of the S7-1200 CPU. The UGW converts the BACnet protocol into a
PROFINET protocol.
Each interface of a device over which the signal passes represents a data point.
The UGW connects two different bus systems and thus has two data points.
The data point is an intermediate format and is used to convert from input format to
output format. A detailed description can be found in the manual of the
"UGW/micro PROFINET RS232/485" (see \5\).

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 6
1 Introduction

Figure 1-2

Signal characteristic
UGW

BACnet S7-1200
device BACnet PROFINET CPU

BACnet E A E A PROFINET
A E

E E E

A E
outbit inbit
outbyte inbyte

Signal

Data point

E Input

A Output
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 7
1 Introduction

1.2.2 Process image: S7-CPU and UGW (BACnet)

The following figure shows all data used and how the process image of the
S7-1200 CPU is composed during project engineering with the UGW (BACnet).
Please note that the signal type input or output always refers to the view of the
respective device.
Figure 1-3
© Siemens AG 2019 All rights reserved

Note The following rules apply to compact CPUs, e.g. S7-1200 CPUs, with integrated
digital inputs and outputs:

• The integrated digital inputs and outputs in STEP 7 (TIA Portal) are
automatically preset with the smallest addresses 0.
• Further modules / peripherals are automatically assigned to the next free
address.
In this application example, the address space in the process image from 100
was deliberately selected. Thus, the connected variables between S7-1200 CPU
and UGW are more easily recognizable.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 8
1 Introduction

1.2.3 Context of the UGW configuration files

The project engineering of the UGW is carried out via various configuration files
(CFG, TXT). After programming, these files are uploaded in an editor, e.g.
Notepad++, via the integrated web server in the UGW or edited and activated
directly in the integrated web server. A configuration check is carried out in the
UGW and possible errors are displayed.
Since the UGW supports different bus systems (PROFINET, BACnet, ...), there are
different driver files (CFG) with protocol information. For each driver file there is a
configuration file (TXT) with the definition of the used data points.
The central component is the distribution file "dispatch.txt". It contains the
assignments of the data points of the different protocols to each other.
The data points are programmed as objects. The exact meaning and structure of
these files can be found in the manual "UGW/micro PROFINET RS232/485"
(see \5\). The CFG- and TXT-files also contain corresponding information as
comment lines.
The complete configuration can be found in the attached UGW data backup
"ugwbackup.tgz" under the folder "ugw > config" and the included comments
("109476182_BACnet_UGW_RestoreFile_Vxx.zip").

Figure 1-4

PROFINET BACnet
© Siemens AG 2019 All rights reserved

pnetd1.cfg pnetd1.txt dispatch.txt bac1.txt bac1.cfg

Devices Definition of the Assignment between Definition of the Devices


configuration data points data points data points configuration

Table 1-2
File Contents Description
pnet1.cfg Configuration of the This file contains information and settings for
PROFINET periphery the PROFINET network including the
periphery used there.
Here: Periphery configuration of the UGW in
STEP 7 (TIA Portal)
pnet1.txt Definition of This file defines how the data points are
PROFINET data points interpreted and with which data type the data
points are interpreted.
dispatch.txt Assignment between This file describes the assignment of the data
BACnet data points and points on the PROFINET side ("pnet1.txt") and
PROFINET data points the BACnet side (bac1.txt).
bac1.txt Definition of the This file contains the description of the
BACnet data points individual data points on the BACnet page.
bac1.cnf Configuration of the This file contains information and settings
BACnet device about the UGW on the BACnet side.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 9
1 Introduction

Note In the UGW configuration files, BACnet objects are described "bac..." and
PROFINET objects "pnetd...".

This application example describes how to edit and adapt these files so that they
can be used for data exchange. Together with this description, you receive a data
backup file with the ready-made example files that you can adapt for your own
application.

Note There are the following required configuration files, which need to be loaded into
the UGW but not edited:

• driver.cfg
• ugwc1.cfg
• ugwc1.txt
• gateway.cfg
• ntp.cfg
• plants.cfg
These files are not described further in this application. If you need further
information, please open these files or contact the company MBS GmbH.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 10
1 Introduction

1.3 Components used


The following hardware and software components were used to create this
application example:
Table 1-3
Component Quantit Article number Note
y
SIMATIC S7-1200 1 6ES7214-1AG40-0XB0 Alternatively, you can
use any other S7-1200
CPU from firmware V4.1
or S7-1500 CPU from
firmware V1.7.
Compact Switch 1 6GK7277-1AA10-0AA0 (optional)
Module CSM 1277 The switch is only
required if the S7-1200
CPU and the UGW are
to be addressed
simultaneously (without
"reconnecting") from the
PG/PC.
Alternatively, you can
use another switch
(SCALANCE X).
UGW//micro 1 Manufacturer: MBS GmbH: Manual of the UGW
© Siemens AG 2019 All rights reserved

PROFINET RS232 • Operating system: (see \5\)


UGW//micro Linux 2.6.34.7#89 In the manual you will
PROFINET • Software module: find the contact details of
RS485/RS232 V3_00_14 #fbcb6f84 MBS GmbH.
• Hardware module: You can find the
15.1.1 versions shown on the
left on the UGW web
server page under "Help
> Device info".
STEP 7 V15.1 1 6ES7822-1..05-.. −
GSDML-V2.31-MBS- 1 Manufacturer: MBS GmbH Current GSDML files are
MICRO3004- available directly from
20150206 MBS GmbH.
In this example the
GSDMLV2.31 was used.
You can find the files in
the folder
"AdditionalFiles > GSD"
of the project. When the
project is opened, the
GSD file is automatically
installed.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 11
1 Introduction

Component Quantit Article number Note


y
BACeye 1 Manufacturer MBS GmbH: (optional)
• Version 2.1.0.15 http://www.baceye.com

This tool is not


absolutely necessary for
plant operation. It is used
in this example to test
the BACnet network.
The full version as well
as the free demo
version, which only
reads and accesses
BACnet, can be
downloaded here.
The software version can
be read in BACeye via
the "Help" menu.
Alternatively, the
integrated UGW web
server can be used for
testing.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 12
2 Engineering

2 Engineering
This chapter describes the configuration in STEP 7 (TIA Portal) and programming
the UGW configuration files.
If you want to use the example configuration of this application example without
any changes, you can load the STEP 7 project directly into the S7-1200 CPU and
the UGW data backup into the UGW.

2.1 Hardware setup


The following figure shows the hardware configuration of the application example:

Figure 2-1

UGW//micro
S7-CPU PROFINET RS232/485 PG / PC

BACeye (optional)
Web browser
STEP 7 (TIA Portal)
© Siemens AG 2019 All rights reserved

PROFINET / IE

LAN / BACnet

BACnet devices

The relevant interfaces of the UGW for this application example are shown in the
following table.
Table 2-1
Interface Communication Network connected device
designation medium
PROFINET 1 or - Ethernet PROFINET SIMATIC S7-CPU,
PROFINET 2 e.g. S7-1200 CPU
LAN Ethernet LAN / BACnet PC / PG for
configuration or
BACnet devices

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 13
2 Engineering

Recommendation
Connect the S7-1200 CPU to the PROFINET interface of the UGW and the
BACnet devices to the LAN interface of the UGW to separate the two networks.
This allows you to manage the two networks independently of each other and, if
necessary, use the same IP addresses on PROFINET and BACnet.

Note The following installation guidelines must generally be observed:


• System Manual "SIMATIC S7 S7-1200 Automation System" (see \3\)
• User Manual "UGW/micro PROFINET RS232/485" (see \5\)

2.1.1 Assembly under laboratory conditions

For the functional test of this application under laboratory conditions the following
setup with use of a switch is suitable.

Figure 2-2

24V DC 24V DC 24V DC

PROFINET 1
© Siemens AG 2019 All rights reserved

PROFINET 2
IP: 192.168.16.2

LAN
IP: 192.168.16.5
CSM / Switch S7-1200 CPU

UGW//microPROFINET
PN
RS232/45 PN IP: 192.168.16.1

BACnet PROFINET

PG/PC
PROFINET

PROFINET
IP: 192.168.16.100

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 14
2 Engineering

Advantages
All networks used in this example are based on Ethernet. It does not contain
BACnet devices in the actual sense. This allows all of the following functions to be
operated simultaneously with a single PG/PC:
• STEP 7 (TIA Portal) Online functions: Configuration of the S7-1200 CPU and
test of communication
• BACeye / Web browser (UGW web server): Test of the BACnet communication
• UGW Web server: Configuration of BACnet

Disadvantages
• "Halving" the address scope, because there is only one common network
• No topological separation of PROFINET and BACnet
• The IP base addresses of all devices must be identical

2.1.2 Assembly under plant conditions

Under "real" conditions, two larger network topologies are usually interconnected
via a UGW, e.g. a network of several SIMATIC S7 CPUs (PROFINET) with a
building infrastructure network (BACnet). The UGW is integrated into a PROFINET
network via the two PROFINET interfaces and connected to the BACnet network
via the LAN interface.
© Siemens AG 2019 All rights reserved

Figure 2-3

24V DC 24V DC

PROFINET 1
SIMATIC
PROFINET 2
S7-CPU
IP: 192.168.16.2

LAN
IP: 192.168.16.5 BACnet device

UGW//micro PROFINET
PN
IP: 192.168.16.1 RS 232/485 LAN

PROFINET BACnet

Advantages
• Full address range in each of the two networks
• Topological separation of PROFINET and BACnet

Disadvantage
• In the case of diagnostics, a separate "diagnostic device" is required for each
network

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 15
2 Engineering

2.2 Installing the software


This chapter describes the steps to install the software.
1. Install STEP 7 (TIA Portal) V15.1 or higher on your computer.
2. Optionally install the diagnostic tool BACeye if you want to test (control and
monitor) the data communication via the BACnet network. Run the file
"BACeyeSetup.exe" and follow the installation instructions.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 16
2 Engineering

2.3 Configuration
2.3.1 STEP 7 (TIA Portal) Device Configuration

Note Before you can configure the UGW in STEP 7 (TIA Portal), the GSD file of the
UGW must be installed.
Unzip the file "109476182_BACnet_UGW_RestoreFile_Vxx.zip" and open the
STEP 7 project. The GSD will then be installed automatically.

3. Create a STEP 7 (TIA Portal) project and insert an S7-CPU, e.g. CPU 1214C.
4. Double-click in the project navigation on the entry "Devices & Networks". The
hardware and network editor opens in the workspace.
5. Change to the "Network view".
6. Navigate in the hardware catalog to the header module "UGW-micro". The
header module "UGW-micro" can be found under "Other field devices >
PROFINET IO > Gateway > MBS GmbH > UGW-micro". Note the firmware
(V2.31).
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 17
2 Engineering

7. Drag & drop the UGW-micro from the hardware catalog into the network view
of the hardware and network editor.
© Siemens AG 2019 All rights reserved

8. Click "Not assigned".

9. Select "PLC_1.PROFINET interface_1".

10. Set the following IP addresses:


– S7-1200 CPU:192.168.16.1
– UGW micro: 192.168.16.2

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 18
2 Engineering

11. Double-click on the UGW-micro to open the device view.


12. Open the hardware catalog and equip the UGW-micro with the required
modules.
13. Adapt the I/O addresses to the range from 100.
© Siemens AG 2019 All rights reserved

14. Create the PLC variable table "TagsUGW" as shown in the following figure.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 19
2 Engineering

15. Create the watch table "WatchTableUGW" with all variables.

Note No user program for the CPU is required for this simple application example. All
variables are observed and controlled with the watch table.
© Siemens AG 2019 All rights reserved

Since the variables access the process image directly, no system modules (SFC,
SFB) are required.

2.3.2 Editing the UGW configuration files

This chapter describes the procedure for editing the UGW configuration files. You
can edit the files directly in the integrated UGW web server or download the files
for editing with an editor (e.g. Notepad++) and upload them to the UGW again
afterwards.

Editing in the integrated UGW web server


The following instructions describe how to edit the configuration files directly in the
integrated UGW web server.
1. Start your preferred web browser and connect to the UGW web server.
The UGW is delivered with the following IP address and login data:
– IP address: 169.254.0.1
– User Name: gw
– Password: GATEWAY
2. Select "BACnet" from the upper menu bar to edit the configuration files for the
BACnet protocol.
Alternatively, select "Profinet" in the upper menu bar to edit the corresponding
files of the PROFINET protocol.
3. Select "Files" from the left menu bar.
4. Click on the edit icon of the configuration file to be edited. A new window opens
in which you can make the changes.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 20
2 Engineering

5. Click "Save" to save the changes.


The window closes automatically and the message "Restart required!"
appears.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 21
2 Engineering

6. Click on the message "Restart required". ("Restart required!").

7. The system automatically performs a configuration check.


The result of the configuration check is displayed.
8. Click "Next".
If the check was not error-free, cancel the restart and revise your change
according to the notes in the check result.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 22
2 Engineering

9. Click on "Restart" and confirm the other messages.


After the restart, the changes made are activated.

Editing in an editor, e.g. Notepad++


© Siemens AG 2019 All rights reserved

The following instructions describe how to edit the configuration files in an editor,
e.g. Notepad++.

Download
1. Start your preferred web browser and connect to the UGW web server.
The UGW is delivered with the following IP address and login data:
– IP address: 169.254.0.1
– Username: gw
– Password: GATEWAY
2. Select "BACnet" from the upper menu bar to edit the configuration files for the
BACnet protocol.
Alternatively, select "Profinet" in the upper menu bar to edit the corresponding
files of the PROFINET protocol.
3. Select "Files" from the left menu bar.
4. Click the "Start Download" button to download the configuration file you want to
edit.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 23
2 Engineering

5. Save the downloaded file in a directory on your PC.


6. Open the downloaded file with an editor, e.g. Notepad++, and make the
necessary changes.
7. Save the file.

Upload
1. Click the "Start Upload" button on the UGW web server to transfer the edited
file back to the UGW.
© Siemens AG 2019 All rights reserved

2. Click on the "Browse" button and navigate to the edited file in the directory of
your PC. Select it.
3. Click on the "Start" button to start the transfer of the edited file to the gateway.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 24
2 Engineering

4. Click in the menu item "General > Restart" on the "Restart" button.
The change is only activated after a restart.
© Siemens AG 2019 All rights reserved

5. The system automatically performs a configuration check.


The result of the configuration check is displayed.
6. Click "Next".
If the check was not error-free, cancel the restart and revise your change
according to the notes in the check result.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 25
2 Engineering

7. Click on "Restart" and confirm the other messages.


After the restart, the changes made are activated.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 26
2 Engineering

2.4 Commissioning
This chapter describes the steps to load the example code into the S7-1200 CPU
and the UGW.

2.4.1 Commissioning UGW

This chapter describes the commissioning of the UGW by restoring the backup file.
Unzip the file "109476182_BACnet_UGW_RestoreFile_Vxx.zip" and save the
backup file "ugwbackup.tgz" in any directory.

Note To access the UGW web server you need a username and a password.
The default setting (factory setting):
• IP address: 169.254.0.1
• Username: gw
• Password: GATEWAY
If this login does not work, please read the UGW manual or contact MBS GmbH.

1. Set up the hardware as described in chapter 2.1.1 and ensure that the
© Siemens AG 2019 All rights reserved

following requirements are met:


– Your computer is located in the same subnet as all components involved.
– All components are connected via LAN cables.
– All components are connected to a supply voltage and switched on.
2. Start your preferred web browser and connect to the UGW web server.
3. Navigate to the menu item "General > Backup/Restore".
4. Backup all UGW configuration files if necessary. Select the function "Backup
gateway configuration".
5. Click the "Start" button to start the backup.

6. Select the function "Restore gateway configuration".


7. Click the "Browse" button. Navigate to the backup file "ugwbackup.tgz".
8. Click on the "Start" button.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 27
2 Engineering

Note
The following files are overwritten in the UGW.
– pnetd1.cfg
– pnetd1.txt
– dispatch.txt
– bac1.txt
– bac1.cfg
© Siemens AG 2019 All rights reserved

– driver.cfg
– ugwc1.cfg
– ugwc1.txt
– gateway.cfg
– ntp.cfg
– plants.cfg

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 28
2 Engineering

9. Take note of the backup information and confirm the backup information with
"OK".
© Siemens AG 2019 All rights reserved

Note
The IP address setting is also changed when the data backup file supplied is
restored. The IP address is replaced by 192.168.16.5. Thus, all devices of this
application example are located in the same subnet.
You can change the IP address at any time under the menu item "General >
IP Network".
10. After a successful backup installation, trigger a system restart.

Note If error messages occur when transferring TXT and CFG files with correct
configurations to the UGW, comment lines (#...) can be the cause. In this case,
the comment line must be written in a separate line.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 29
2 Engineering

2.4.2 Commissioning S7-1200 CPU

Assign device name


1. Start STEP 7 (TIA Portal) and open the project in the packed file
"109476182_BACnet_S7_CODE_Vxx.zip".
2. Double-click in the project navigation on the entry "Devices & Networks". The
hardware and network editor opens in the workspace.
3. Right-click on the connection. The context menu opens.
4. Select the entry "Assign device name". The dialog "Assign PROFINET device
name" opens.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 30
2 Engineering

5. Select the device name of the UGW and click the "Assign name" button to
assign the device name to the UGW.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 31
2 Engineering

Compiling and downloading


1. Select the S7-1200 CPU in the project navigation.
2. Click on the "Compile" button in the function bar.
3. Click on the "Download to device" button in the function bar to load the
hardware configuration and the user program into the S7-1200 CPU.
© Siemens AG 2019 All rights reserved

4. If the access path from the PG/PC to the S7-1200 CPU has to be reset, the
dialog "Extended download to device" is opened automatically.
5. Make the following settings to access the S7 CPU via TCP/IP.
– Type of the PG/PC interface: PN/IE
– PG/PC interface: PG/PC network card
– Connection to interface/subnet: Subnet of the S7-1200 CPU, e.g. PN/IE_1
6. Select the "Show all compatible devices" option.
7. Click the "Start search" button.
8. Select the S7-1200 CPU as target device.
9. Click the "Load" button

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 32
2 Engineering
© Siemens AG 2019 All rights reserved

10. Confirm the download dialogs and set the S7-1200 CPU to the operating state
RUN.
After the download, the devices were also assigned their PROFINET IP
addresses.
If everything has been correctly parameterized and loaded, all icons are green.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 33
2 Engineering
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 34
2 Engineering

2.5 Operation
2.5.1 Changing values in the S7-1200 CPU

Since no program was created in the S7-1200, the variables are controlled and
monitored with the watch table in STEP 7 (TIA Portal).
1. Open the "Watch and force tables" folder in the project navigation.
2. Double-click on the watch table "WatchTableUGW" to open it in the workspace
of STEP 7 (TIA Portal).
© Siemens AG 2019 All rights reserved

3. Click the "Monitor all" button.


4. In the "Modify value" column, enter any control value for the out variables.
5. Click on "Modify all selected values once and now" button:
The control values are transferred to the out variables in the S7-1200 CPU and
displayed in the variable table in the "Monitor value" column.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 35
2 Engineering
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 36
2 Engineering

Monitor values in BACeye


1. Start BACeye.
2. Select as network adapter the network card of your computer which is
connected to the LAN interface of the UGW.
Note
If you alternatively want to use the integrated web server of the UGW to
monitor the BACnet variables, continue with chapter Monitor values in the
UGW Web server.
3. Click on the "Update" button.
© Siemens AG 2019 All rights reserved

4. Alternatively, search for the UGW via the menu "Edit > Search device by IP
address".

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 37
2 Engineering

5. Enter the IP address of the UGW and the UDP port 47808.
6. Click on the "Search" button.
7. Click the "Accept" button to add the UGW to the list of static device address
mappings.
© Siemens AG 2019 All rights reserved

8. Click on the listed UGW.

9. Select all variables and right-click on the selected variables. The context menu
opens.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 38
2 Engineering

10. Select the entry "Add to watchlist". The variables are added to the watch list.

11. Now you can monitor the values.


© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 39
2 Engineering

Monitor values in the UGW Web server


1. Start your preferred web browser and connect to the UGW web server
(IP address: 192.168.16.5).
2. To observe the values of the variables, navigate to the menu item "BACnet >
Status" and refresh the page.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 40
2 Engineering

2.5.2 Changing values on the BACnet side

The example of the signal "inBool" (PLC variable) shows how a signal is changed
on the BACnet side via BACeye or UGW web server and how the change is
observed in the S7-1200 CPU with the watch table "WatchTableUGW".

Change values via BACeye


1. Start BACeye.
2. Select as network adapter the network card of your computer which is
connected to the LAN interface of the UGW.
Note
If you alternatively want to use the integrated web server of the UGW to
monitor the BACnet variables, continue with chapter Change values via UGW
Web server.
3. Click on the "Update" button.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 41
2 Engineering

4. Alternatively, search for the UGW via the menu "Edit > Search device by
IP address".

5. Enter the IP address of the UGW and the UDP port 47808.
6. Click on the "Search" button.
7. Click the "Accept" button to add the UGW to the list of static device address
mappings.
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 42
2 Engineering

8. Click on the listed UGW.

9. In BACeye, double-click the "BO 0" variable.


© Siemens AG 2019 All rights reserved

10. Click the "1 ON" value in the "Present Value" drop-down list.

10

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 43
2 Engineering

11. Click on the "Send" button to transfer the value of the variable.

11

12. Open the "Watch and force tables" folder in the project navigation.
13. Double-click on the watch table "WatchTableUGW" to open it in the workspace
of STEP 7 (TIA Portal).
© Siemens AG 2019 All rights reserved

12

13

14. Click the "Monitor all" button.


15. In STEP 7 (TIA Portal) in the watch table, observe how the value has changed.

14

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 44
2 Engineering

Change values via UGW Web server


1. Start your preferred web browser and connect to the UGW web server
(IP address: 192.168.16.5).
2. To control the values of the variables, navigate to the menu item "BACnet >
Status" and refresh the page.
3. Select any UGW_out...-variables and activate the editing.
Figure 2-4
© Siemens AG 2019 All rights reserved

4. Change the value and confirm with "OK".

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 45
2 Engineering

5. Observe the behavior in the watch table in STEP 7 (TIA Portal).


© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 46
3 Useful information

3 Useful information
3.1 UGW configuration data
To configure the UGW, the following files are processed and then loaded into the
UGW via the integrated web server or processed directly in the integrated web
server.
• pnetd1.cfg
• pnetd1.txt
• dispatch.txt
• bac1.txt
• bac1.cfg

Note The following configuration files must also be loaded into the UGW, but not
edited:
• driver.cfg
• ugwc1.cfg
• ugwc1.txt
• gateway.cfg
• ntp.cfg
© Siemens AG 2019 All rights reserved

• plants.cfg
The file "109476182_BACnet_UGW_RestoreFile_Vxx.zip" contains all required
files in the data backup.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 47
3 Useful information

3.1.1 UGW file "pnetd1.cfg"

In STEP 7 (TIA Portal) you will find the device configuration of the UGW.
Figure 3-1
© Siemens AG 2019 All rights reserved

In the configuration file "pnetd1.cfg" the device configuration of the UGW is


programmed line by line according to the device configuration in STEP 7
(TIA Portal).
Each device is called a module (Mod001, Mod002, ...).
An example of how each module type is parameterized can be found in the file
"pnetd1.cfg".
Comments are marked with the control character "#".

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 48
3 Useful information
© Siemens AG 2019 All rights reserved

Note Further information can be found in the file "pnetd1.cfg" or in the UGW manual of
MBS GmbH.

3.1.2 UGW file "pnetd1.txt"

The PROFINET data points are programmed in the configuration file "pnetd1.txt".
The type and address are specified in the square brackets, e.g. [S inbit 0.0].
Each data point has different parameters, e. g:
• name: The parameter can be freely selected.
• format: The parameter "format" defines the respective data types of the UGW.
• query
• writecache

For more information about type, address, formats, and other parameters, see the
"pnetd1.txt" file in the backup file in the "config" folder.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 49
3 Useful information

Figure 3-2
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 50
3 Useful information

Figure 3-3
© Siemens AG 2019 All rights reserved

Note Further information can be found in the file "pnetd1.txt" or in the UGW manual
from MBS GmbH.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 51
3 Useful information

3.1.3 UGW file "dispatch.txt"

The assignment between BACnet data points and PROFINET data points is
programmed in the configuration file "dispatch.txt".
Here the data points in the networks BACnet (940 bac...) and Pnet (1190 pnet...)
are assigned to each other.
It must be ensured that the network addressing "940 bac" or "1190 pnet" and the
BACnet data network contain the value of "555", corresponding to the DeviceID in
the file "bac1.cfg".
The syntax is as follows:
[Net.Datapoint]
target = Net.Datapoint
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 52
3 Useful information

Figure 3-4
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 53
3 Useful information
© Siemens AG 2019 All rights reserved

Note Further information can be found in the file "dispatch.txt" or in the UGW manual
from MBS GmbH.

3.1.4 UGW file "bac1.txt"

The BACnet data points are programmed in the configuration file "bac1.txt".

The syntax is as follows:


[Type DeviceID.Datapoint]

The parameter "name" can be freely selected.


With the parameter "bac_description" a description of the data point can be freely
defined.
For binary signals, the parameter "bac_inactive_text" can be used to specify a text
for an inactive data value.
For binary signals, the parameter "bac_active_text" can be used to define a text for
an active data value.
The following parameters can also be defined for floating point numbers:
• bac_min_pres_value: Minimum value
• bac_max_pres_value: Maximum value
• bac_units: Unit
The start values can be set with the parameter "bac_relinquish_default".

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 54
3 Useful information

Figure 3-5
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 55
3 Useful information
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 56
3 Useful information

Note Further information can be found in the file "bac1.txt" or in the UGW manual from
MBS GmbH.

3.1.5 UGW file "bac1.cfg"

The BACnet device configuration is programmed in the configuration file


"bac1.cfg".
Necessary settings: DeviceID = 555.

The following figure shows a code excerpt from the configuration file "bac1.cfg".
Figure 3-6
© Siemens AG 2019 All rights reserved

Note Further information can be found in the file "bac1.cfg" or in the UGW manual
from MBS GmbH.

Note For information on how to edit the configuration files, see chapter 2.3.2.
How to load the configuration files into the UGW is described in chapter 2.3.2.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 57
3 Useful information

3.2 Details on functionality


The following overview shows you the context of the UGW configuration files.

pnetd1.cfg
Mod001 = ID:0x11 IN:1 OUT:0 # Mod001, INPUT_01B_1
Mod002 = ID:0x21 IN:0 OUT:1 # Mod002, OUTPUT_01B_1

pned1.txt
# 1.Bit of (INPUT_01B_1/Mod001)
[S inbit 0.0]
name = S7_inBool
format = BIT
query = pe
writecache = yes

# 1.Bit of (OUTPUT_01B_1/Mod002)
[M outbit 0.0]
name = S7_outBool
© Siemens AG 2019 All rights reserved

format = BIT
query = pe

dispatch.txt
# Mod001, see bac1.txt (object in BACnet device 555,
internal)
[940 bac 555.BO 0]
target = 1190 pnetd inbit 0.0

# Mod002, see bac1.txt (object in BACnet device 555,


internal)
[1190 pnetd outbit 0.0]
target = 940 bac 555.BI 0

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 58
3 Useful information

bac1.txt
# (Mod001, object in BACnet device 555, internal)
[S 555.BO 0]
name = UGW_outBit_0.0
bac_description = Bit / Bool -->S7
bac_inactive_text = OFF
bac_active_text = ON
bac_relinquish_default = 0

# (Mod002, object in BACnet device 555, internal)


[S 555.BI 0]
name = UGW_inBit_0.0
bac_description = Bit / Bool -->UGW
bac_inactive_text = OFF
bac_active_text = ON

bac1.cfg
DeviceID = 555
© Siemens AG 2019 All rights reserved

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 59
4 Appendix

4 Appendix
4.1 Service and support
Industry Online Support
Do you have any questions or need assistance?
Siemens Industry Online Support offers round the clock access to our entire
service and support know-how and portfolio.
The Industry Online Support is the central address for information about our
products, solutions and services.
Product information, manuals, downloads, FAQs, application examples and videos
– all information is accessible with just a few mouse clicks:
https://support.industry.siemens.com

Technical Support
The Technical Support of Siemens Industry provides you fast and competent
support regarding all technical queries with numerous tailor-made offers
– ranging from basic support to individual support contracts. Please send queries
to Technical Support via Web form:
www.siemens.com/industry/supportrequest
© Siemens AG 2019 All rights reserved

SITRAIN – Training for Industry


We support you with our globally available training courses for industry with
practical experience, innovative learning methods and a concept that’s tailored to
the customer’s specific needs.
For more information on our offered trainings and courses, as well as their
locations and dates, refer to our web page:
www.siemens.com/sitrain

Service offer
Our range of services includes the following:
• Plant data services
• Spare parts services
• Repair services
• On-site and maintenance services
• Retrofitting and modernization services
• Service programs and contracts
You can find detailed information on our range of services in the service catalog
web page:
https://support.industry.siemens.com/cs/sc

Industry Online Support app


You will receive optimum support wherever you are with the "Siemens Industry
Online Support" app. The app is available for Apple iOS, Android and Windows
Phone:
https://support.industry.siemens.com/cs/ww/en/sc/2067

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 60
4 Appendix

4.2 Contact MBS GmbH


MBS GmbH
Römerstraße 15
D-47809 Krefeld
Telephone +49 2151 7294-0
FAX +49 2151 7294-50
mailto: info@mbs-software.de

4.3 Links and literature


Table 4-1
No. Topic
\1\ Siemens Industry Online Support
https://support.industry.siemens.com
\2\ Link to the entry page of the application example
https://support.industry.siemens.com/cs/ww/en/view/109476182
\3\ SIMATIC S7 S7-1200 Programmable Controller
https://support.industry.siemens.com/cs/ww/en/view/109759862
© Siemens AG 2019 All rights reserved

\4\ BACeye User Manual


http://baceye.com/
\5\ Manual "UGW/micro PROFINET RS232/485"
http://download.mbs-solutions.de/handbuecher/de/MBS_Gateways_Handbuch.pdf
\6\ Overview via BACnet on Youtube
http://www.youtube.com/watch?feature=player_embedded&v=SigbjIBipaQ
\7\ MBS Wiki
http://proxy.mbs-software.info/doku.php?id=start

4.4 Change documentation


Table 4-2
Version Date Change
V1.0 05/2015 First version
V1.1 09/2015 Error correction
V1.2 05/2016 Documentation has been adapted to the new UGW web
server interfaces and associated changes.
V2.0 08/2019 • Upgrade of the project to STEP 7 (TIA Portal) V15.1
• Installation of the new software on the UGW
• Documentation has been adapted to the new UGW
web server interfaces and associated changes.

Communication with S7-CPU via BACnet Gateway


Entry ID: 109476182, V2.0, 08/2019 61

You might also like