Description
Data integration is crucial in DCS systems. A typical DCS system can be divided into four levels in structure: on-site level, control level, monitoring level, and governance level. This article discusses the monitoring level, where there are many parallel sub stations. Generally, computers are used as machine interfaces, and each station can be divided according to its function to collect corresponding on-site signals and control certain local devices. However, each site is not isolated, they must cooperate and coordinate with each other to ensure product quality and achieve continuous production, which requires each site to be able to communicate information. In addition, the higher-level governance network also needs to interact with monitoring level sub stations to achieve global monitoring and optimization.
However, the sub station is a heterogeneous system composed of different development platforms and communication protocols, which may be developed by different manufacturers and individuals. Writing a conversion interface or driver for each protocol is quite cumbersome, especially when there are many sites and protocols. Therefore, how to effectively integrate data and avoid the emergence of information silos is one of the difficult problems often encountered in DCS systems.
A better approach is for each site to use standard protocols for data communication, without the need to develop a communication interface for each protocol. Currently, there are many protocols in this area, and Modbus is one of them.
Introduction to Modbus Protocol
The Modbus protocol includes ASCII, RTU, PLUS, TCP, etc., and does not specify a physical layer. This protocol defines the message structures that the controller can be familiar with and use, regardless of the network they communicate over [2]. The standard Modicon controller uses RS232C to achieve serial Modbus. RS232C specifies information such as connector pins, wiring, signal level, baud rate, parity, etc. Based on this, the ASC water and RTU protocols of Modbus specify the structure of messages, data, commands, and response methods, as shown in Figure 1. The data communication adopts the Master/Slave method. The Master sends a data request message, and the Slave receives the correct message before sending data to the Master in response to the request; The Master side can also directly send messages to modify Slave’s real data, achieving bidirectional reading and writing.
Figure 2 is a typical example of Modbus application. Modbus can be applied between PICs and PLCs that support the Modbus protocol, between PLCs and personal computers, between computers and calculations, between remote PLCs and computers, and between remote computers (connected through Modem), indicating that the application of Modbus is quite extensive. Due to Modbus being a de facto industry standard, many manufacturers’ PLCs, HMIs, and configuration software support Modbus. Moreover, Modbus is an open standard, and its protocol content can be obtained for free. Some small manufacturers or even individuals can develop products or software that support Modbus based on the protocol standard, thereby connecting their products to Modbus’s data network. Therefore, Modbus has a broad application foundation.
In practical applications, RS232, RS485/422, Modem with telephone lines, and even TCP/IP can be used for networking. So, there are many types of transmission media for Modbus, which can be selected based on the transmission interval.
2. Specific Applications of Modbus
The specific application of Modbus introduced here is the quality control system for cement raw material production in a certain factory. There are a total of 5 sub stations in this system: calcium iron analyzer, four element analyzer, material level/slurry plug, batching scale, and blending warehouse. Each substation consists of a computer and related software and hardware, and the control system composition is shown in Figure 3.
From Figure 3, it can be seen that the system basically consists of two control circuits: one is composed of a calcium iron analyzer, a batching scale, and a control algorithm, which realizes pre grinding precision matching, i.e. online real-time closed-loop control of the quality of raw meal produced during grinding; The other is composed of four element analyzer, slurry plug and material level meter to realize the mixing after friction, that is, the homogenization control of slurry quality before entering the kiln. The library allocation algorithm plays a role in controlling, optimizing, and network interface in the second loop. The change in system control parameters is triggered by two events: the results of calcium iron analyzer analysis and the results of four element analysis. These two analysis results are obtained from the analysis of actual production samples regularly collected by users. From Figure 3, it can also be seen that each station is interconnected and their collaboration is related to the quality of raw material production.
In network design, it is not only necessary to achieve data exchange between stations, but also to consider the flexibility, universality, and scalability of the network. For example, the data source site should be able to easily increase or decrease data, there may be multiple target sites, the data flow should be bidirectional, and all raw material system data needs to be sent to the factory level DCS, so the implementation of the network is relatively complex.
Due to the diversity and reliability of the Modbus protocol, as well as being an industry-level standard protocol, it is fully suitable for specific applications. Therefore, the network is implemented using Modbus.
It is not possible to implement Modbus using source programs at each site, as application development platforms are different, such as Visual C++, making it impossible to achieve code reuse. However, the manipulation of reading and writing Modbus data is the same for each site. To solve this problem, we use COM technology. COM is also the standard for data communication between software modules. The characteristics of COM are language independence, transparency in time history, and the ability to achieve binary reuse. Due to its open interface, client programs that support COM technology can call the internal functions of COM components through its public interface. As is well known, in Windows 2000, COM+is even the foundation of the operating system.
Finally, two COM components were developed using ATL, namely Modbus Master component and Modbus Slave component. ATL is a framework based on C++simulation technology, mainly used in software development of even COM. Using it can greatly simplify the development process of components and improve code efficiency [5]. Both the Master and Slave components include three methods: ASCII, RTU, and TCP, which implement the functions specified in Class0 and Class1 [3]. The client program of each sub station does not need to know the specific protocol and implementation method of Modbus, but only needs to call the publicly available methods of the components to exchange data with remote computers, achieving Modbus protocol transparency and network data transmission transparency. For example, if a Slave is a component, the client only needs to modify its connection data to reflect the changes to the Master. After the Master modifies the data, the Slave will trigger an event to notify the client.