Recalculating incoming and outgoing data values

A very common use case is the recalculation of incoming data point values. Data point values from field devices have dedicated format and range which cannot be changed. Thus, they need recalculation. A typical use case is a smart meter that provides consumption values in Wh but kWh is required in the BMS.

Within this tutorial, it is shown how incoming KNX temperature values can be converted from degrees Celsius to degrees Fahrenheit. Consider the following KNX project is used – a hotel with 2 floors, each floor has 10 hotel rooms and each hotel room has a room controller that measures the current room temperature:

To convert the group address of the current room temperature of Room 101 to degrees Fahrenheit, open the parsing definition within the menu Modules > Logic:

Add the following definition:

  • Item suffix: Fahrenheit
    This means that the item ID of the virtual item that will be created by the Logic module will have the suffix Fahrenheit. This suffix will be appended to the original item ID followed by a dot. In our example the item ID will be NETx\XIO\KNX\NETx KNX IP Router Room 101\01/1/010.Fahrenheit
  • Base path or Item ID: empty
    If multiple items shall be recalculated, a base path for start searching for items can be specified here. If only 1 single item is selected, this parameter is ignored.
  • Selector: NETx\XIO\KNX\NETx KNX IP Router Room 101\01/1/010
    Here the source item is specified. If multiple items shall be recalculated, the selector for pattern matching must be specified. 
  • Data type: float
    Here the data type of the created virtual item is defined. In our case we will take a real since the source item is also of type real.
  • In calculation function:
    Here the mathematical expression for the recalculation is defined. The incoming value is specified by the keyword value. In our example, the equation for converted degrees Celsius to Fahrenheit is entered here.

All other parameters can be left empty since they are not mandatory. The definition looks as follows:

After saving the parsing definitions, the configuration will be reloaded automatically – restarting the Core Server is not necessary. If everything works as expected, the following item will appear within the item tree:

Applying the same control functionality to multiple items

In most uses cases, the same control functionality has to be added to multiple items. Defining the functionality for each item separately is a time-consuming and error-prone task. Therefore, pattern matching can be used to implement the same functionality for multiple items with just a single definition line. 

Consider the KNX hotel project example which contains two floor and 10 rooms for each floor. Each room has a KNX group address that provides the current room temperature in degrees Celsius. The advantage of this KNX project is that is using recurring group address schema. The item ID of the KNX group address that provides the room temperature has the following form: 

NETx\XIO\KNX\NETx KNX IP Router Room <floor no><room no>\0<floor no>/1/<room no>0. 

For room 01 at floor 1, the item ID is NETx\XIO\KNX\NETx KNX IP Router Room 101\01/1/010. For room 05 at floor 2, the item ID is NETx\XIO\KNX\NETx KNX IP Router Room 205\02/1/050. 

To avoid a separate definition for each group address, the following definition uses a regular expression for pattern matching:

  • Base path: it defines the starting point for searching for item. NETx\XIO\KNX means that all children of the KNX branch are considered for pattern matching. If base path is left empty, all items are considered. 
  • Selector: here the regular expression for pattern matching has to be defined. Regular expressions (short called regex) are a well-defined form of matching text. Within this example. the regex [0-9]{2}/1/[0-9]{2}0 is used. It matches all item IDs that have to two digits ([0-9]{2}) followed by the text /1/, followed by another two digits ([0-9]{2}) followed by the digit 0. 

More information and tutorials about regular expressions can be found within the Internet. Here you can find an online for testing regular expressions: https://regexr.com/


After saving the definition file, 20 new virtual items are created – 1 for each room: