TwinCAT
Application Note DK9322-0810-0036
TwinCAT, Building Automation
Keywords
M-Bus
Master
counter
consumption measurement
Building Automation
energy measurement
EN 1434
EN 13757
flow measurement
calorimetry
IEC 870
EN 1434-3
M-Bus connection for energy and consumption meters
via TwinCAT
This application example from the ‘Building Automation Sub-bus Systems’ series describes the basic
principles of M-Bus, the KL6781 M-Bus master terminal and the functionality and of the TwinCAT PLC
library M-Bus from Beckhoff. The M-Bus is predominately used in buildings and properties with a large
number of end users. Through serial data transmission a KL6781 M-Bus master can read up to 40 energy and
consumption meters.
1. The M-Bus
The M-Bus (meter bus) is a fieldbus for logging, analyzing, optimizing and controlling energy and process data. It is as used as
a standardized system for reading energy and consumption meters or other end devices or actuators. Signals are transferred
serially from the connected slaves (measuring devices) to a master via a reverse polarity protected two-wire line. Depending
on the application the data are stored or prepared for further processing. The field devices can be supplied with power via the
bus cable. M-Bus is a typical single-master bus, in which the master requests and picks up the data from the slaves. With a
primary address space of 250 addresses, up to 250 slaves can be connected to a master. Via modem interfaces, large distances
can be covered in order to bring together modular extensions or complex systems. The M-Bus system is predominately used
by operating companies supplying a large number of end users (e.g. industrial and technology parks, trade shows, building
management systems, etc.).
Meanwhile the M-Bus has become established as a separate standard in EN 13757. This standard describes the M-Bus for
application via a two-wire bus (part 2) and for radio transmission (part 4). However, standardization at the protocol level is
incomplete. The data telegram features a freely available segment which manufacturers can use for transferring various (non-
For application notes see disclaimer on the last page
Beckhoff
New Automation Technology
1
TwinCAT
Application Note DK9322-0810-0036
TwinCAT, Building Automation
standardized) data or control characters. Before using new slaves it is therefore important to verify compatibility with the
evaluation unit. All manufacturers of M-Bus meters offer downloadable specifications of the M-Bus protocols for their meters.
2. Typical field devices
The field devices used for M-Bus are typically meters for measuring tasks within a building. Examples of field devices include
heat meters, water meters, hot water meters, electricity meters, pulse meters, switching devices, and heating cost distributors.
A distinction is made between the reading mode. For local reading only one meter is connected, for remote reading several
meters are integrated. The following data transfer options are available, depending on the reading type. The transfer protocol
according to IEC 870 and EN1434-3 is used for all transfer routes.
2.1 Local reading (single meter)
– one optical interface (EN 61107 section 3.2)
– one inductive interface (CEN TC176/WG4)
– one 20 mA current loop, CL (EN 61107 section 3.1)
2.2 Remote reading (several meters)
– one two-wire fieldbus, meter bus (CEN TC176/WG4)
– one 11-bit modem
– radio system (433 or 868 MHz)
3. Master versions
The master can be an independent device or a PC with level converter. It reads the data of the connected field devices at
configurable intervals and stores the meter readings permanently. In conjunction with the KL6781 M-Bus master terminal and
the TwinCAT PLC M-Bus library, all Industrial and Embedded PCs from Beckhoff as well as the BC and BX series Bus Terminal
Controllers can be used as M-Bus master. The Beckhoff Bus Terminal Controllers from the BC and BX series (except for BCxx50)
can also be used as a master, although in this case the limited transfer rates, the limited multi-tasking functionality and the
longer cycle times must be taken into account. In addition, the program memory and, consequently the mapping is limited
depending on the Bus Terminal Controller, so the number of meters that can be read is limited as a result.
Notes regarding the use of devices from the Beckhoff BC/BX series:
M-Bus devices may deliver very large values (that may exceed the DWord value range) and are therefore output in string
format. Conversion to the Real format may result in inaccuracies or even invalid values. Conversion to the LReal format is
therefore preferable. This approach is not available on controllers from the BC/BX series. If the values have to be provided in a
number format, controllers from the BC/BX series are unsuitable if those values exceed the DWord value range.
For application notes see disclaimer on the last page
Beckhoff
New Automation Technology
2
TwinCAT
Slave
Slave
Slave
Slave
Slave
Slave
SlaveSlave
M-Bus
master
Slave
Slave
Slave
Slave
Slave
Slave
Slave
Slave
M-Bus
master
Application Note DK9322-0810-0036
TwinCAT, Building Automation
4. Topologies
Devices can be connected to M-Bus in a strand or star topology. The maximum number of meters per segment is 250. Larger
systems can be formed and cascaded with the aid of repeaters.
Fig. 1 Possible M-Bus topologies
One of the factors limiting the size of an M-Bus network is the wire cross-section. Wiring of an existing building is very complex
and expensive, which is why in such applications radio solutions with lower infrastructure costs tend to be used.
When configuring an M-Bus topology it should be noted that the plug connectors of the bus cable are not standardized, which
may result in complications if components from different manufacturers are used.
4.1 Laying system, cross-section and cable lengths
The lower the line resistance, the longer the cable can be. However, as a basic rule the cross-section should not be less than
0.5 mm² (#20 AWG). Transmission errors may occur if the maximum cable length is exceeded or if the cable cross-section is too
small. A normal telephone cable of type J-Y(ST)Y n x 2 x 0.8 mm (#20 AWG standard twisted-pair) can be used.
Figure 2 shows the number of M-Bus devices that can be connected in relation to the cable length of the M-Bus.
For application notes see disclaimer on the last page
Beckhoff
New Automation Technology
3