Professional Documents
Culture Documents
Abstract—The KNX Standard was developed by the Konnex each bus within a KNX system has a physical and group
Association for the design of home automation applications, address. The physical addresses are used for initialization,
so the Engineering Tool Software (ETS) was created for the programming, operations diagnostics. Group addresses are
control of smart buildings and it works with its own protocol,
the KNXnet/IP protocol. However, the KNXnet/IP protocol is used for communication during operations, as well as for
designed exclusively for home automation applications and it is communication via multicast [2].
intended to be implemented in different areas, such as biometric The propose to emulate the KNX telegrams is using soft-
applications, for future projects. To achieve this, it is proposed ware for simulation of models and system, as well as data
to understand and emulate the operation of the KNXnet/IP acquisition tools. In this case, MATLAB/Simulink software
telegrams. Wireshark software was used to interpret the protocol
telegrams and replicate their operation using MATLAB/Simulink will be used for the emulation of KNX telegrams; and the use
tools. The development of the program on MATLAB/Simulink of Wireshark software for reading and interpretation of the
managed to effectively emulate the behavior of the KNXnet/IP data that will be sent to the KNX control board.
protocol and establish an adequate communication between the
computer and the KNX control board. II. T HE KNX NET /IP P ROTOCOL
Index Terms—Home Automation, KNX, Telegrams, MATLAB,
Simulink. KNXnet/IP Protocol was developed for the exchange of
KNX telegrams between devices in a KNX system via Ether-
net. Ethernet [5] is a IEEE Standard (802.3) for local and wide
I. I NTRODUCTION
networks. Generally, Ethernet is used for local area networks
The KNX Standard is an open standard developed by in conjunction with Internet. This standard defines the physical
Konnex Association for home automation and building control layers in the transmission media in the OSI model. However,
(ISO/ICE 14543, CENELEC EN 50090, CEN EN 13321-1, the operation of the network layer has yet to be defined.
GB/Z 20965), based on home automation protocols BatiBus, The network layer is managed through the Internet Protocol
the European Installation Bus (EIB) and the European Home (IP), this protocol [6] is used to send data packets between
System (EHS) [1]. KNX Standard supports different communi- devices in a network through IP addresses. KNX systems
cation media such as Twisted Pair (KNX TP), Powerline (KNX are decentralized, User Datagram Protocol (UDP) is for the
PL), Radio Frequency (KNX RF) and tunneling IP (KNX IP) transport layer. UDP protocol is one of the most used protocols
[2]. For purposes of this article, the communication media for building control, and it is needed in systems where there is
used is KNX IP. no problem that some data packets go missing [3]. The overall
KNX Standard works with its own system, KNX system. behavior is shown in Figure 1.
The KNX system is a bus system for building control, making The system that works with KNXnet/IP uses two communi-
every device in a KNX system use the same transmission cation methods via Ethernet: Tunneling and Routing, and both
method and exchange data via a common bus network. The use UDP protocol.
KNX system uses a decentralized bus system [3], this means
that if one device does not function, the others continue to A. KNXnet/IP tunneling
work correctly. Tunneling is used for KNX system applications in which
For planification, project design and commissioning of KNX KNX telegrams are sent in a connection-oriented manner using
installations, both the designer and the electrical installer a framework IP. This method is applied when a physical
have one program that combines project design and start-up address is used as a destination address. The communication
tools for these installations, this program is the Engineering always takes place via IP device that is being used for
Tool Software (ETS) [4]. The communication between the tunneling.
devices is using telegrams. The telegrams [3] are data packets
containing data that will be exchanged in a bus system. B. KNXnet/IP routing
Finally, one of the key features of the KNX operating Routing method is used when it is needed to send telegrams
mode is the use of an address system, which means that simultaneously in a connectionless manner to different devices
data between devices. sary for the performance of the requested function.
• KNX subnetwork that will be used as communication
medium.
• KNXnet/IP router for the connection between IP network
and KNX subnetwork.
130
Fig. 4. Data traffic in the KNXnet/IP System.
encapsulated and how it will operate. The part that will be Using Wireshark, it was found that the KNX system devices
used is the KNXnet/IP section. The KNXnet/IP telegram is must be configured first before sending orders to the actuators
composed by two parts, header and body. Wireshark indicates and sensors. The order of the execution of the KNX telegrams
us how the telegram bytes are organized and their function obtained using ETS is the following:
within the telegram. However, only raw data is needed for the • Connect Request
creation of our own telegrams in the MATLAB environment, • Connect Response
raw data is indicated in the lower part of the Wireshark • Device Configuration Request
interface; Another important point is that the raw data used • Device Configuration Acknowledge
in the KNXnet/IP protocol is written in hexadecimal. For the • Description Request
emulation of the KNXnet/IP protocol behavior, the sequence • Description Response
of the KNXnet/IP telegram structure must follow the exact • Device Configuration Request
same order. • Device Configuration Acknowledge
• Disconnect Request
• Disconnect Acknowledge
131
translation from hexadecimal to decimal must be applied in VI. R ESULTS
all the telegrams that will be sent. During the realization of
this paper, the MATLAB and MATLAB/Simulink version used A MATLAB/Simulink interface was developed to create a
in the experiment is MATLAB R2015a. communication between the PC and the KNX devices without
the need of the ETS (Figure 9). This program can send and
receive KNXnet/IP telegrams.
Fig. 7. Connect Request KNXnet/IP Telegram in Wireshark and MATLAB The received KNXnet/IP telegrams data were stored on
constant
the MATLAB workspace in a 2D array format, making them
accessible to be read and take the elements needed to modify
KNXnet/IP telegrams are sent and received entirely in form other KNXnet/IP telegrams (e.g. Communication Channel ID)
of 8 bit characters. MATLAB/Simulink blocks that could send that will be sent. The data obtained from the KNXnet/IP router
and receive data in this manner are To Instrument and Query is accommodated without indicating which bit corresponds
Instrument blocks, respectively. To Instrument block [9] opens to each part of the KNXnet/IP telegram. In Figure 10, it is
an interface to the KNXnet/IP router, initialize the router and shown how Wireshark was used to verify that the obtained
sends the KNXnet/IP telegrams to the router. Query Instrument KNXnet/IP telegram bits (raw data) are correctly positioned
block [10] does the same steps as To Instrument block, but in the MATLAB variable saved in the workspace.
in this case, it queries the data from the router. Both blocks
parameters do not required to be modified, they only need
to call the UDP object located in the Matlab workspace to
generate a communication between the PC and the KNX
Module.
Each KNXnet/IP telegram that will be sent are stored in
a MATLAB/Simulink Constant block connected to the To
Instrument block (Figure 8), this Constant blocks call the
KNXnet/IP telegrams created as variable from the MATLAB
workspace.
132
Fig. 11. Connect Request and Connect Response MATLAB/Simulink program.
133