06/05/2025
How-To

How to monitor and analyze energy data with ctrlX OS and Janitza energy analyzer over Modbus TCP

In this article you will learn how to easily read, store, visualize and evaluate energy data from a Janitza energy analyzer with a ctrlX CORE device.

Prerequisites

Hardware:

  • ctrlX OS device (minimum ctrlX CORE X3) + power supply

  • Janitza energy analyzer with Modbus TCP interface e.g. UMG96 or UMG 800

  • Power clamps (depending on application)

  • Engineering PC

Software:

  • Operating system on ctrlX OS device: ctrlX OS (last tested with Automation Core V 2.6.1 and core22)

  • Apps installed on ctrlX OS device:

    • Modbus TCP (last tested with V2.6.1)

    • Telegraf (last tested with V2.4.0+1.28.2)

    • InfluxDB (last tested with V2.6.0+2.7.5)

    • (optional) IoT Dashboard (last tested with V2.4.0+10.1.2)

    • (optional) Node-RED (last tested with V2.4.0+3.1.0-ctrlx)


Disclaimer: This How-To requires basic knowledge on ctrlX OS and ctrlX CORE (commissioning, installation, licensing, ctrlX Data Layer) as well as access to the Bosch Rexroth ctrlX STORE (Collaboration Room). If you’re new to ctrlX AUTOMATION find some basic information below:


Hint: If you don’t have access to the Bosch Rexroth ctrlX STORE (Collaboration Room), you can request access FAQ for ctrlX Store.



Overview

Figure 1: System architecture


Find the necessary apps and their purpose below:

  • ModbusTCP: Reads the energy measurement values from the Janitza energy analyzer and publishes them into the ctrlX Data Layer

  • Telegraf: Telegraf is an agent to automatically run scripts. A configurable script is provided in this How-To which writes the measurement values from the ctrlX Data Layer into the InfluxDB database.

  • InfluxDB: The InfluxDB database is our database of choice to store the measurement values in a lightweight environment. In addition, visualizations can be created with simple queries without programming knowledge.

  • IoT Dashboard (optional): If desired, extended monitoring and comparing of measurement data can be realized with our IoT Dashboard application.

  • Node-RED (optional): To further process your energy measurement data use the widespread IoT application Node-RED and enable applications such as condition monitoring.

In this How-To

The following chapters will lead you stepwise to the solution:

Enable communication between ctrlX CORE device and Janitza energy analyzer

This chapter contains the commissioning and connection between the ctrlX CORE device and the Janitza energy analyzer.

Hardware commissioning and connection

1. To commission the hardware components, follow the manufacturers specification.

2. To connect the ctrlX CORE device with the Janitza energy analyzer, use a network cable (RJ45) and plug it into the XF51 port on the ctrlX (visually labeled on the device). Next, plug the other end of the network cable into the network adapter of the Janitza energy analyzer, to allow a TCP/IP-connection.

Hint: The IP of the ctrlX CORE device isn’t activated per default and must be set manually (e.g. 192.168.0.1). For further information, follow the First Steps documents linked on the top of this article.

Note: The default setting of the Janitza energy analyzer is dynamic IP (DHCP). To enable a communication, change the IP adress of the Janitza energy analyzer to a static IP address in the same IP address range as the ctrlX CORE device (e.g. 192.168.0.99). More information can be found here: User manuals.

3. As a final step to prepare the network connection between the devices, activate the Modbus gateway in the Janitza energy analyzer. More information can be found here: User manuals.

 

Set up Modbus communication

1. To read the measurement values from the Janitza energy analyzer, click on the Modbus TCP app in the UI of your ctrlX CORE device and select “Client”.

→ The Modbus TCP Client view appears.

2. To create the Janitza energy analyzer as a device in the app, click on “Add Modbus TCP Device” or on the “+” button in the upper right corner.

Figure 2: Add new Modbus TCP device

→ The following dialog appears:

Figure 3: Configuring of new Modbus TCP device


3. To enable communication between the Janitza energy analyzer and your ctrlX CORE device, enter the requested information of the Janitza energy analyzer.

  • Name: Name of the Janitza energy analyzer: Can be freely chosen (e.g. “Janitza Device 1”).

  • IP-address: Use the IP address of your Janitza energy analyzer defined in “Hardware commissioning and connection”.

  • Port: Enter the port of the Modbus gateway (per default it is “502” → can be changed in the Janitza energy analyzer settings in the parameters of Modbus settings).

  • Unit Id: Depends on the configuration of the Janitza energy analyzer.

4. After you defined the connection parameters, click on “Save”.

→ The Janitza energy analyzer now appears in the Modbus TCP client view.

5. To define which values you want to read of the Janitza energy analyzer, click on the “+”-button next to the Modbus device you just created.

Figure 4: Add Modbus TCP subscription

→ The following dialog appears:

Figure 5: Configure Modbus TCP subscription

In this dialog the subscription to the measurement values from the Janitza energy analyzer needs to be defined. Modbus communication is defined in operations which are defined in so called function codes.

6. To subscribe to the measurement values from the Janitza energy analyzer, choose the option “FC4 – read multiple input register” from the “Function code” dropdown menu.

7. Add the following required information:

Info: For each measurement value a name needs to be defined. Additionally, the data type of the value as well as the register address and the quantity are requested. This information can be found in the device manufacturer's address list of the Janitza energy analyzer.

8. Last, the poll interval has to be set. The poll interval equals the measurement frequency of the Janitza energy analyzer or can be lower if desired.

9. After you defined the subscription parameters, click on “Save”.

→ The measurement values can now be monitored in real-time, when you expand your created device in the Modbus TCP Client view with the ▼-button.

Note: The ctrlX CORE device has to be in the “Operating” mode to enable real-time data editing and monitoring. For further information, follow the First Steps documents linked on the top of this article.

 

Write energy measurement data in the ctrlX Data Layer

If the Modbus communication is established, all as subscription defined measurement values automatically appear in the ctrlX Data Layer. Each measurement value appears as own node and has its unique path.

1. To access the Data Layer, click on “Settings > Data Layer” in the ctrlX CORE main view.

Figure 6: Access the ctrlX Data Layer

2. To view the energy measurement data in real-time, navigate to “fieldbuses > modbustcp > client > realtime_data > input > data > YOUR_DEVICE”.

Figure 7: Find energy measurement data in ctrlX Data Layer

Publish energy measurement data into a database

This chapter describes how the energy measurement data can automatically be pushed into a database.

Set up InfluxDB database

The InfluxDB database can either be hosted locally on your ctrlX CORE device or on several hardware. Locally, the database can be stored on a micro-SD card in the card slot of your ctrlX CORE device (CF01).

Warning: This tutorial only describes how the database can be hosted on a micro-SD card in your ctrlX CORE device.

To host the database locally on your ctrlX CORE device on a micro-SD card, follow the steps below:

1. To insert, format and mount a compatible micro-SD card, follow the steps described in this application manual.

Hint: Further information on compatible micro-SD cards, can be found in the application manual.

2. To initiate the database, the InfluxDB needs to be set up. To do so, follow the steps described in this application manual.

Caution: The following link describes how to adapt the configuration of the InfluxDB. The configuration can be found in the app data area of your ctrlX CORE device. To access this, select the icon highlighted in the screenshot in the main view of your ctrlX CORE device first (“Manages app data”) and click on “InfluxDB configuration” second. Then continue with the pasted link.

Figure 8: Access ctrlX CORE device app data

Warning: The InfluxDB automatically creates an API Token. It will be displayed during the setup. Afterwards it can’t be viewed anymore. Optionally, a new token can be created under “Data > API Tokens”.

→ The InfluxDB database will now be hosted on your micro-SD card.

Transfer energy measurement data from ctrlX Data Layer into InfluxDB with Telegraf script

The Telegraf app uses a script to collect the energy measurement data from the ctrlX Data Layer and push it into the InfluxDB database. A basic template for the script is provided in the following link and just need to be adapted regarding the ctrlX Data Layer paths of the energy measurement data and the InfluxDB properties.

The automatic running of the script is done by a so-called configuration.

1. To set up the transfer of the energy measurement data from ctrlX Data Layer into the InfluxDB, open the Telegraf app in the main view of your ctrlX CORE device.

2. To add a new configuration, click on [+].

→ The window “Create new Telegraf configuration” appears.

Figure 9: Create new Telegraf configuration


3. To create a configuration that automatically pushes the desired energy measurement data from the ctrlX Data Layer into the InfluxDB database, enter a configuration name and select the template “Configuration template: ctrlX Data Layer sse input and InfluxDB V2 output“.

4. To adapt the template to our needs, click on the pencil symbol.

Figure 10: Edit the template

→ The template opens. The following parameters need to be adapted: 

  • token = The token you created while setting up the InfluxDB.

Warning: The InfluxDB automatically creates an API Token. It will be displayed during the setup. Afterwards it can’t be viewed anymore. Optionally, a new token can be created under “Data > API Tokens”. 

  • organization = The organization you defined while setting up the InfluxDB.

  • bucket = The bucket you defined while setting up the InfluxDB.

  • username = The username of your ctrlX CORE device account.

  • password = The password of your ctrlX CORE device account.

5. To define the energy measurement values to be written into the InfluxDB database, paste the names and the ctrlX Data Layer paths of the nodes into the following section of the template.

Figure 11: Add the desired ctrlX Data Layer nodes

Hint: To find the necessary path in the Data Layer, click on “Settings > Data Layer” in the ctrlX CORE main view and navigate to “fieldbuses > modbustcp > client > realtime_data > input > data > YOUR_DEVICE”. It is also possible to copy the path directly from here.

6. To save the configuration and start the configuration, first click on the "Save"- and afterwards on the "Play"-button":

→ The configuration is running – a log message appears.

 

Visualize energy measurement data – InfluxDB

This chapter describes how the energy measurement data can quickly be visualized in the InfluxDB app.

1. To visualize energy measurement data in the InfluxDB in a dashboard, open the InfluxDB app in the main view of your ctrlX CORE device and click on “Dashboards”.

2. To create a dashboard, click on “Create dashboard > New Dashboard”.

Figure 12: Create a new dashboard in InfluxDB app

3. To visualize energy measurement data, click on “Add Cell”. Additionally, you can name your dashboard in the upper left corner.

→ The query editor opens.

4. To build the query and visualize energy measurement data, select the bucket you named and choose the parameters you want to visualize.

Figure 13: Query overview in InfluxDB app

5.  (Optional) Select the visualization type from the visualization drop-down menu. There are many different visualization types available. For this How-To, use the default "Graph" visualization.

Note: The query time range selector defaults to querying data from the last hour (Past 1h). Click the time range selector drop-down menu and select “Custom Time Range”, if you want to define a custom time range.

Note: Make sure that your ctrlX OS device has the correct time assigned and operates in the correct time zone. Read more about it in the application manual.

6. To query and visualize the results, click on “Submit”.

7. To save the cell and return to the dashboard, click on “✓“.

Hint: For further options to query and visualize data in the InfluxDB, consult the InfluxDB documentation.

 

Visualize energy measurement data – IoT Dashboard (optional)

This chapter describes how the energy measurement data can quickly be visualized in the IoT Dashboard app with InfluxDB as data source.

1. To visualize energy measurement data in the IoT Dashboard app, open the IoT Dashboard app in the main view of your ctrlX CORE device and click on “Home > Connections > Data sources”.

Figure 14: Add a Data source in IoT Dashboard app

2. To use the InfluxDB database as data source, click on “Add new data source” and choose “InfluxDB”. 

3. To configure the InfluxDB database connection, define the following parameters as shown:

Figure 15: Define InfluxDB parameters
  • User: Your ctrlX CORE device user.

  • Password: Your ctrlX CORE device password.

4. To define the location of the data in the InfluxDB database and to access it, enter Organization, Token and Bucket of your InfluxDB.

5. To save and test the database connection, click on “Save & test”.

6. To build a dashboard, click on “Dashboards > Create Dashboard”.

7. To add a visualization to your dashboard, choose “Add visualization” and select your InfluxDB database as data source.

→ A query window opens. Now it is necessary to copy the query from the InfluxDB app.

8. To copy our created query from the InfluxDB database, open the InfluxDB app again. To do so, switch back to the main view of your ctrlX CORE device, open the InfluxDB app by clicking on it and click on “Dashboards”.

9. To access the query code, open your visualization as shown in the screenshot and click on “Script editor”.

Figure 16: Open query editor of a visualization query in InfluxDB app

 → The query code appears. 

10. To paste the query into the IoT Dashboard, copy the whole query, switch back to the IoT Dashboard app, click on “Pencil symbol” and paste the query code.

11. To apply the changes and visualize the data accessed from the query, click on “Save”.

Note: Make sure that your ctrlX OS device has the correct time assigned and operates in the correct time zone. Read more about here.

 

Visualize energy measurement data – Node-RED (optional)

This chapter describes how the energy measurement data can quickly be visualized in the Node-RED app.

1. To visualize energy measurement data in the Node-RED app, open the Node-RED app in the main view of your ctrlX CORE device by clicking on “Node-RED > Flow Editor”.

2. To access the energy measurement data from the ctrlX Data Layer and visualize it, create a new flow and drag and drop the following function nodes from the Palette. Next, connect them.

  • Data Layer Request

  • Gauge

Figure 17: Connect required nodes in Node-RED app


3. To enable Node-Red to access the ctrlX Data Layer, parametrize the “Data Layer Request”-node by double-clicking on it and entering the following information including the user credentials for your ctrlX CORE device.


4. To access the energy measurement data from the ctrlX Data Layer, configure the node as shown.

Figure 19: Define ctrlX Data Layer node to be read out


5. To visualize the selected energy measurement data point, configure the “Gauge”-node as desired.


6. To create a dashboard with all desired energy measurement data points, repeat the steps for the other data points.

7. To access the created dashboard, click on “Deploy” and choose “Node-RED > Dashboard” in the main view of your ctrlX CORE device.



Collection of mentioned links:

1
Types
How-to
Products
IOT
HMI
Markets
Building Automation
Manufacturing
Logistic
Packaging
Production Machines
Robotics
Semicon & Electronics

Latest published/updated articles