1. Introduction
The rapid development of modern industry has continuously promoted the rapid innovation of automatic control technology and equipment. At present, DCS, IPC, PLC and intelligent instruments have been widely used in factory on-site production control systems, and have developed into distributed industrial automatic control systems in which the above-mentioned equipment cooperate with each other and face the entire production process together. In this system, field communication technology is the key. However, due to the lack of a unified communication protocol standard at the beginning, the communication protocols of automatic control products of various manufacturers are independent, and the communication networks are each a system, which makes it difficult or even impossible to connect the network of automatic control equipment from different manufacturers, causing inconvenience to the flexible application of distributed control systems. In order to adapt to the market, some companies have made their own protocol standards public and can be used free of charge. After years of development, some communication protocols, such as Modicon's Modbus communication protocol, have been widely used in the industrial field due to their compatibility and ease of use, and have become a universal industrial communication standard. This article introduces the application of the communication network based on the Modbus protocol in the design of a distributed control system for a chemical fiber project.
2. System composition
1. System structure
The system structure is shown in Figure 1, in which the acquisition and control of field instrument signals are omitted. The system host computer uses Yokogawa CS3000 DCS distributed control system to centrally monitor the entire production process; the lower computer uses Omron's CS1H series PLC, which is distributed in 3 electrical control rooms and is responsible for the execution of field motors, OCV valves, flow switches, inverters, start and stop control of detection mechanisms, feedback signal acquisition, fault judgment and other operations.
Considering the real-time communication, the DCS and the three PLC control stations are divided into two relatively independent communication networks: PLC1 and PLC2 form network 1 with one port of DCS, and PLC3 forms network 2 with two ports of DCS. Since neither the upper nor the lower computer has communication equipment for the same protocol, it is difficult to design. After consideration, it is decided to use the Modbus communication protocol to form the communication network of this distributed control system.
2. Communication network composition
2.1 Communication Protocol
Modbus protocol is a master-slave serial communication protocol suitable for the field of industrial control. It uses query communication to transmit information between master and slave devices, and can address the device address range of 1-247. The protocol includes two methods: broadcast query and single device query. The difference between the two is that broadcast query does not require the slave device to respond to the information. The master-slave device query communication process is shown in Figure 2.
Modbus protocol has two transmission modes: ASCII mode and RTU mode. At the same baud rate, RTU mode can transmit more data than ASCII mode, so most industrial networks use RTU mode. The information transmission message format in RTU mode is shown in Figure 3.
It has no start bit and stop bit, but uses at least 3.5 character intervals as the start and end marks of the information. All character bits of the information frame are composed of hexadecimal characters 0-9 and AF. This design adopts the RTU mode communication method of single device query. According to the system structure, the DCS port one is set to two PLC slave addresses 01H and 02H, and the second port is set to a PLC slave address 01H, and the two function codes of the read word storage area 03H and the write word storage area 06H in the Modbus protocol are used.
2.2 Network composition and hardware introduction
The network uses RS485 serial interface, and the communication media is connected by 4-core shielded cable to connect the master and slave devices. The transmission distance is up to 1.5Km, full-duplex, and the serial port is set to a baud rate of 19200, 8 data bits, even parity, and 1 stop bit. The DCS communication part uses Yokogawa's communication module model ALR121, and is equipped with the Modbus communication software package provided by Yokogawa. The communication data capacity of this communication module is 4000 words. The PLC communication part uses Omron's C200H-ASCII 21 programmable special unit module (hereinafter referred to as ASCII module). This module supports BASIC language programming, has a 200K-byte program storage area, and is equipped with one RS232 and one RS485 communication serial port. By programming this module, various communications with peripheral devices can be realized. This system communicates with DCS based on the Modbus protocol through the ASCII module, converts the DCS's read and write instructions and data accordingly, and exchanges data with the PLC's CPU unit to achieve real-time transmission of upper and lower computer control information. As shown in Figure 4.
3. Software Implementation
1. Establish address allocation and correspondence table
The monitoring of graphic symbol objects for field instruments on the DCS human-machine monitoring interface (HMI) needs to be achieved by collecting field instrument signals through the DCS I/O physical address. The DCS monitoring of field electrical execution and detection mechanisms is completed by the one-to-one correspondence between the DCS communication I/O address and the PLC I/O physical address. For this reason, before programming, it is necessary to establish a distribution and correspondence table of DCS communication I/O addresses and PLC I/O addresses. Due to the needs of PLC logic control programming, it is inconvenient to directly correspond the PLC I/O physical address to the DCS communication I/O address, so an indirect address method is adopted. The specific design uses the PLC data storage area DM area as the indirect address area, establishes a connection with the DCS communication I/O area, and then corresponds the DM area to the PLC I/O area. If the DCS %WB000101 communication I/O address is matched with the D0000.00 address, and D0000.00 is compared with the PLC I0000.00 physical input point, the operating status of the on-site electrical actuator can be fed back to the HMI. According to this method, a table of upper and lower computer address allocation and correspondence is established, but due to space limitations, the table is omitted.
2. Programming
The ASCII module supports BASIC language programming. In addition, it has added a number of system and function instructions, such as receive and send buffer operation instructions, information transmission error control CRC, LRC check function instructions, and read and write instructions for data exchange with the CPU unit. Programming uses the Hyperterminal software attached to the WINDOWS operating system. Through this software, the PC can transmit and display text files with other PCs or serial terminal devices connected to the network. When programming, connect the PC serial port to the RS232 serial port of the ASCII module, run the software, and you can program, upload, and debug the ASCII module on its interface. You can also write the program through the WINDOWS system's writing board first, save it in text format, and then transfer the program to the ASCII module through Hyperterminal. The main workflow of the communication program is shown in Figure 5.
Some program codes are as follows:
OPTION BASE 0 //Define array
DIM R(128), FC(128)
R(48)=0:R(49)=1:R(50)=2:R(51)=3:R(52)=4:R(53)=5:R(54)=6:R (55)=7:R(56)=8
R(57)=9:R(65)=&h0a:R(66)=&h0b:R(67)=&h0c:R(68)=&h0d:R(69)=&h0e:R(70)=&h0f
R(97)=&h0a:R(98)=&h0b:R(99)=&h0c:R(100)=&h0d:R(101)=&h0e:R(102)=&h0f
OPEN #2, "COMU:19200, 8, E, 1" //Set serial port parameters
A%=LOC(2) //Judge the characters in the receiving buffer
IF A%=8 THEN
REX$=INPUT$(A%,#2)
……….
ENDIF
GOSUB *ZFCL //Decompose the information
IF ST=1 THEN *JAOY ELSE *BACK //Judge whether it is the information of this station
*JAOY
GOSUB *CRC //CRC cyclic redundancy check subroutine
IF R=CRC THEN *WORK ELSE *BACK //Information verification is correct
*WORK
IF (FU=3) THEN GOTO *DJS //Read the function code to judge and call the operation subroutine
IF (FU=6) THEN GOTO *XJS ELSE GOTO *BACK //Write function code judgment, call the operation subroutine
*DJS //Read subroutine
………
*XJS //Write subroutine
………
*CRC //CRC check subroutine
……….
*ZFCL //Character processing subroutine
………
Since the ASCII module supports ASCII code, and RTU is a hexadecimal character communication method based on binary code, a code conversion program is added to the program programming.
CH5$=MID$(REX$,5,1) :CH6$=MID$(REX$,6,1) //Extract character segment
VOL=ASC(CH5$)×256+ASC(CH6$) //Convert ASCII code characters to decimal numbers
VOL$=HEX$(VOL) //Convert decimal numbers into hexadecimal characters
3. Program optimization and safety measures
In the data exchange program between the ASCII module and the CPU unit, the ASCII module actively sends a read/write request signal to the CPU unit, and the CPU unit executes the data exchange program only when it receives the request. In this way, the PLC scan cycle is shortened and the real-time communication is improved.
In the information error control part, the CRC-16 cyclic redundancy check algorithm is used, which can reduce the information error rate to less than 10-14. If the information check error occurs, the program will clear the buffer and wait for the DCS information to be resent.
Previous article:EtherCAT to Modbus Gateway Using Modbus Slave to Simulate Slave Station Configuration Example
Next article:Design of polyester processing and drawing machine system using Siemens touch screen, PLC and inverter
- Popular Resources
- Popular amplifiers
- Mission-oriented wireless communications for cooperative sensing in intelligent unmanned systems
- ICCV2023 Paper Summary: Fairness, Privacy, Ethics, Social-good, Transparency, Accountability in Vision
- Introduction to Artificial Intelligence and Robotics (Murphy)
- Designing with Distributed Power Architecture
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- LOTO Practice [Dry Goods] 4 Unexpected Interference of Infrared Sensors osc802
- A5 RTL8188EU Guide
- Fudan Micro FM33xx full series offline burner firmware & host computer
- Award-winning live broadcast: Application of NXP LPC553x in dual motor control is in progress!
- 【Child care machine】+ ESP32-S3 VScode environment construction and hello_world project flashing
- Is there anyone in our forum in Zhangzhou?
- Gaoyun GW1NR-9 FPGA uses video frame buffer and the error "in hclk tree must have constraint" appears
- Issues with chip drive power and load size
- [NXP Rapid IoT Review] NO1. First experience with NXP Rapid LoT development kit
- [TI recommended course] #TPS65086100: User programming of multi-rail power management IC#