This tutorial explains how to configure platform-to-device communication by using the Modbus protocol. In the software platform, the Devices module manages communication with field devices through the Channels, Nodes, and Points by allowing stable and secure data exchange between multiple devices across different networks.
The presented concepts apply to all communication drivers. You can define multiple protocol interfaces using the abstraction layers such as Channels and Nodes. The only big difference in using one or another protocol is the syntax on the STATION and ADDRESS fields. All the configuration and testing procedures are similar for all communication protocol drivers.
Note that not all available protocols may be installed on your computer. Check the Communication Drivers page for more detailed information about what you must do if you require a device protocol not listed on your system.
On this page:
Technical Overview
All initial configurations for devices in the solutions on the software platform encompass the following workflow:
- Defining a Channel using a target communication Protocol. It will create the base instance for linking a Node;
- Defining the Node linked to the created Channel;
- Defining the Point that you would like to monitor.
Protocols define communication rules between the platform and devices. Channels define global parameters for the usage of a communication protocol. Nodes represent the physical field devices (like a PLC) with a unique field address (PrimaryStation). Points represent tags within a device. Additionally, AccessType defines how the device interacts with the platform (Read and Write).
Solution creation
Solutions refer to the applications developed on the software platform. Their purpose is to store all configuration information for applications. The solution saves its configuration in a file with the ".dbsln" extension. It is a database file that stores all configuration items of an application, such as Tags, Alarms, Devices configurations, graphical displays, scripts, etc.
You open the solution file on Solution Manager and edit the solution through the Solution Designer. These interfaces allow you to manage and design your solutions on the software platform. The Solution Designer organizes engineering configurations by modules. They are on the left, in the Solution Explorer menu.
Installing the software platform is the only requirement to create a solution. Once installed, go to Solution Manager and create a new Solution to configure the device.
To create a new Solution, on the Solution Manager at the top of the solution list, click the New... button to start the New Solution Wizard:
- Define the Product Series for your solution by selecting the product family and the product model.
- Define the target platform for your solution by selecting Windows or Multi-platform.
- Define the name and location for saving your solution file. Then, you can select a solution template and press the Create New Solution button. Or only press the button to create. When you do this, it will create a new Solution using a blank template.
Once created, go to Solution Manager and double-click to open it in Solution Designer.
After that, you can start the device configuration by creating a Channel.
Channels configuration
Channels refer to implemented communication protocol within a solution. Their purpose is to define global parameters for the protocol usage. They group the devices that use the same protocol logically.
Creating a Solution within the software platform is the only requirement for configuring a Channel in the Devices module.
To create a new Channel, follow the steps:
- On the Solution Designer, find the left menu, go to Devices, and expand it. There are two following ways to create a Device's Channel:
- Go to Devices → Protocols, select the desired protocol on the main grid, then click the New Channel button to open the Create New Channel dialog.
- Go to Devices → Channels, click the Add button on the grid's top-left to open the Create New Channel dialog.
- In the Create New Channel dialog:
- Select the Modbus Master Protocol.
- Choose a name for the Channel.
- Select the interface. For this tutorial, select TCPIP.
- Press the OK button to create a Channel using the selected protocol.
It will insert a new line in the Channels data grid. Some configurations are accessible through the Channels data grid, such as ProtocolOptions, Channel Settings, Timeout, and InitialState options, but they are optional and detailed in the Additional Configurations section.
Nodes configuration
Nodes refer to an individual representation of each physical device on the platform. Its purpose is to identify and address devices uniquely, allowing individual access and control.
Creating a Channel within the Solution is the only requirement for configuring a Node on the Devices module.
To create a new Node, follow the steps:
- On the Solution Designer, go to Devices → Nodes, and click the Add button to open the Create New Node screen.
- Select the previously created channel and click OK.
It will insert a new line in the Nodes data grid.
After that, you must configure the PrimaryStation, to do this:
On the Devices → Nodes, find the column PrimaryStation. This column contains the network IP and port necessary to find the device into the network. Into the specific created Node, on the PrimaryStation cell there is a comboBox to help with this configuration.
- IP: In this case, because we will use the simulator on the same machine as the solution, the IP can be the localhost IP: 127.0.0.1, but if you have a physical device on your network, you can use the IP from there.
- Port: We will use the default port 502. Generally, each protocol has our default port.
The PrimaryStation configuration can change according to each protocol.
Points configuration
Points refer to specific tags within a device, information units such as a temperature value, or an engine start command. Its purpose is to allow granular access to device data and functionalities, enabling monitoring and controlling each point.
Creating a Node within the Channel and having a tag are the only requirements for configuring a Point on the Devices module.
To create a new Point follow the steps:
- On the Solution Designer, go to Devices → Points, click on the first line of the data grid and insert the tag name.
- On the Node column, select the target Node and press Enter.
It will insert a new line in the Points data grid.
Additionally, there are some configurations accessible through the Points data grid, such as Address, DataType, AccessType, Modifiers, Scaling and more, but they are optional and detailed at the Additional configurations section.
Modbus Protocols
The Modbus communication protocols allow data exchange between a master and a slave. The master-slave principle is a model for a communication protocol in which one device (the master) controls one or more other devices (the slaves). A standard Modbus network can have one master and many slaves. Each side uses a different protocol, which means that the master protocol defines the communication for the master and the slave protocol does the same for the slaves. Because of this, there is one protocol for the Master and another for the Slaves. Both are available on the software platform.
You can check and manage which protocols are available by clicking on the Product Series on the Solution Manager. You can check it on the Solution Designer, too. To do this, go to Devices/Protocols or Devices/Channels. Both interfaces allow you to start the device configuration by creating a channel using a target protocol.
Modbus Master Configuration
The Modbus Master protocol dynamically creates blocks based on the AccessType configurations set for each data point. It allows for selecting message encoding types such as ASCII, RTU, or RTU TCP - a combination of RTU and TCP/IP. It is worth noting that TCP/IP and UDP/IP are transport layer protocols in the OSI model.
The Modbus Master Protocol supports serial, multi-serial, and TCP/IP interfaces. It results in slight differences in some attributes for each supported interface. For example, considering the Modbus Master Protocol, the Settings column presents different parameters according to the selected communication interface. It happens on the Nodes, where the PrimaryStation settings differ according to each protocol. However, generally, the procedure is very similar, and most settings are the same.
Additional configurations
The additional configurations refer to settings that allow protocol fine-tuning.
Modbus Simulator
The Modbus Simulator is a tool for testing communication drivers. It simulates interactions between a software platform and field devices or other automation systems on a Modbus TCP/IP network. This ensures that components can communicate before deployment in a production environment.
In a Modbus network, a Channel is a communication path established by the Master to manage interactions with Nodes. The simulator enables the creation and Node configuration, allowing test network scenarios and topologies without needing a physical network.
Each node within the network represents a device or a logical entity capable of communication via the Modbus protocol. Nodes can be configured within the simulator with communication properties such as IP addresses, ports, and device IDs. This feature allows for testing of integration and communication among devices and nodes without a physical environment.
Communication test
The PrimaryStation defines the essential parameters for communication with a target device. In the context of this tutorial, the Modbus Simulator emulates a Master device in the Modbus Network.
Follow the steps to test communication:
Step 1: Run the Modbus Simulator before starting.
To run the Modbus Simulator:
On Solution Designer, use the Solution Explorer to navigate to:
A. Devices/Channels: select a Channel created using the Modbus Master Protocol;
B. Devices/Nodes: select a Node linked to the created Modbus Channel;
The Modbus Simulator button will appear on the top of the data grid. Press the button to start the simulator.
Step 2: Configure and test PrimaryStation.
To configure the PrimaryStation:
On Solution Designer, use the Solution Explorer to navigate to Devices/Nodes:
- Select a Node linked to a created Modbus Channel;
- Click the PrimaryStation cell to edit;
- Change the default IP address
[192.168.0.1]
to[127.0.0.1].
- Press the Test button to test.
Testing on Runtime
You can use a display to view and interact with device data to test communication with the device during the solution runtime. You can include the Test tag that will reflect the data from a Modbus device and configure a "Set Value" action for the Test tag. It will enable the manual setting of a new value to the Test tag, helping verify the communication between the Solution and the device.
Diagnostic Tools
Diagnostics tools refer to the Property Watch, Trace Window, and Module Information. These tools identify communication blocks and address errors, allow property access to pinpoint error causes, and display system messages for device management and troubleshooting, offering a comprehensive approach to device management and troubleshooting for Solutions on the software platform.
Module Information
This tool provides insights into module operations and communication channels, offering information about virtual reading groups, error codes, and communication events. It helps users identify communication blocks and effectively address errors in industrial automation systems.
Property Watch
This tool enables users to access, read, and write tags and internal properties of the system. It assists in identifying the root cause of errors through negative error codes, allowing for real-time adjustments and optimizations to the system configuration.
Trace Window
This tool displays system messages in a data grid interface, providing information about the status of reads, writes, and communication frames. It is particularly useful for various PLCs and communication protocols, as it presents invalid addresses in the configuration, assisting in device management and troubleshooting.
In this section: