Nov 27, 2020
Communication control system of touch screen-PLC-frequency converter based on Modbus protocol
Modbus protocol is a communication protocol applied to various intelligent electronic controllers. It has become a mainstream industrial standard (China National Industrial Automation Standard gb/z 19582.x-2004). Through this protocol, controllers can communicate with each other and between controllers and other devices. This makes it possible for control devices manufactured by different manufacturers that comply with the modbus protocol to form an industrial network for centralized control.
There are mainly two traditional inverter control methods: one is through the operation panel of the inverter, and the other is through the control terminal of the inverter. The first way is to set parameters such as operating frequency and acceleration/deceleration time through the operation panel, and then realize the start and stop control of the motor through the buttons on the operation panel. The second is to logically combine multiple operating frequencies at the input port of the inverter control terminal in advance, or input a signal of 0～10v or 4-20ma through the analog input terminal to change the given frequency, and then start/stop the motor through the control terminal. The traditional frequency converter parameter monitoring is mainly to read various operating parameters through pointer instruments.
In the above-mentioned control mode, the information interaction between the control system and the inverter is very limited. The reading of multiple parameters depends on multiple pointer instruments, which makes the system bulky, the wiring is complicated, and the analog input signal is vulnerable. The problem of interference and short transmission distance. This article introduces a real-time monitoring system for frequency converters based on fieldbus technology, which not only solves the problems of traditional monitoring methods, but also meets the requirements of networking.
2 modbus protocol
2.1 Protocol principle
The modbus protocol is a master-slave protocol. At the same time, only one master station and a maximum of 247 slave stations can be connected to the bus. Modbus communication is always initiated by the master station. When the slave station does not receive a request from the master station, it will not send data. The master station can only start one modbus transaction at the same time, and the slave stations cannot communicate with each other. The master station sends a modbus request to the slave station in two modes: unicast mode and broadcast mode. Unicast mode means that the master station addresses a single slave station, and after the slave station receives and processes the request, it returns a response to the master station. Broadcast mode means that the master station can send requests to all slave stations, and the slave station does not respond to the request broadcast by the master station. The broadcast request must be a write command, and all devices must receive the broadcast of the write command. Address 0 is reserved to identify broadcast communications.
The standard modbus protocol uses rs-232c compatible serial interface, which defines the pins, cables, signal bits, transmission baud rate, and parity of the connection port. Modbus systems can also use different physical interfaces, for example, rs-485 and rs-232.
2.2 Transmission mode and modbus message frame
In the standard modbus network, modbus message data is divided into two transmission modes: ascii and rtu. In the two transmission modes, the sending device converts the modbus message into a data frame with a starting point and an ending point, and the receiving device starts working at the starting point of the message, and can set the communication error to the return result.
The ascii message frame uses ascii mode. The message starts with a colon (:) character (ascii code 3ah) and ends with a carriage return and line feed (ascii code 0dh, 0ah). The transmission characters that can be used for other codes are hexadecimal 0...9, a...f.
rtu message frame, using rtu mode, the message transmission must start with a pause interval of at least 3.5 characters. The first code transmitted is the device address. The transmission characters that can be used are hexadecimal 0...9, a...f.
3 system design
3.1 Hardware connection
According to the system's requirements for real-time control of inverter actions and real-time monitoring of inverter operating parameters through communication, the system adopts a combination of man-machine interface + plc + inverter. The human-machine interface adopts Delta dop-a series touch screen, the core control part is Schneider Electric twido plc (16 points and above), and the actuator is Emerson ev2000 general-purpose inverter.
In terms of device connection, twido plc needs 2 communication interfaces. It has 1 rs-485 interface (com1), and then expand a rs-485 interface (com2). twido plc uses com1 port to communicate with dop-a, dop-a as modbus master station, twido plc as slave station to realize real-time monitoring of inverter operating parameters; use com2 port to communicate with ev2000, twido plc as modbus master station, ev2000 works as a slave station to realize real-time control of the inverter actions.
The dop-a series touch screen comes with 1 usb port (for programming) and 2 serial ports (com1, com2). com1 is rs-232, com2 is rs-232/485. It is used as the human-machine interface of the system to monitor the operating status of the system and read the inverter operating parameters collected by the plc and display them on the monitoring interface.
ev2000 has its own rs-485 interface, which is used to realize the communication connection with plc. The rs-485 communication distance is long, the wiring is simple, and the anti-interference ability is strong. All the control of the inverter is completed through the rs-485 communication link, which achieves the goal of economy and efficiency.
3.2 Inverter, plc, touch screen serial communication parameter settings
Plc is connected to the inverter and the touch screen through two interfaces respectively, and the whole system adopts the transmission mode of modbus rtu. The main points of ev2000 inverter communication parameter setting:
(1) The communication parameters must be consistent with the twido plc com2 port;
(2) The inverter must have its own unique address;
(3) The communication jumper switch cn14 of the inverter is set in the rs-485 direction;
(4) The delay response of the inverter is set to (ff.03) 30-50ms.
Dop-a touch screen communication parameter setting should be consistent with twido plc com1 port. The specific parameters need to be set through the programming software screen editor and take effect after being downloaded to the touch screen. Both dop-a and twido plc support modbus protocol, so they can be connected via modbus. In the PLC communication program, an assignment statement (for example: %mw2999:=0) should be written to open up memory space for the system control area and system status area of the dop-a touch screen, otherwise communication will not be possible. The internal bit %m0 in twido plc corresponds to b1 in dop-a, and the internal word %mw0 corresponds to w40001.
Twido plc com1 and com2 ports can be configured with the same baud rate, data bits, check mode and other parameters, but they should be configured with different and unique addresses.
3.3 Monitoring interface development
The monitoring screen of the whole system is divided into monitoring interface, operation interface and fault code query interface. It mainly completes the setting of inverter start, stop, acceleration/deceleration operation, fault reset and operating frequency. At the same time, it is connected to the fault code query interface for the operator to query and use.
4 PLC communication program development
4.1 Selection of modbus function code
twido plc and ev2000 both support modbus protocol, but there are differences in specific details. Therefore, the function code supported by both parties is used to write the program. Modbus function code supported by ev2000; modbus function code supported by twido plc.
4.2 comm communication macro and grafect step programming method
The comm communication macro instruction of twido plc uses a macro instruction to represent a group of list language instructions to achieve complex functions. PLC controls the frequency converter through the communication way, need to write a large number of functional program blocks. It is written in the form of a general modbus communication word list, and the program is lengthy and difficult to read. Use comm communication macro instruction, no need to write word table for communication exchange when programming, just use one macro instruction (for example: c_wrnw 0 2).
In order to facilitate the debugging of the program, the Grafect stepping programming language of twido plc is used when programming. This language is a language that divides control into multiple "steps" and transition conditions between "steps" and "steps". Each "step" is regarded as the working state of the control system. For the entire system, the working state is divided into steady state and transient state. The steady state is the state in which the system can exist stably, the transient state is the transition state when the system transitions from one steady state to another steady state, and the transient state can be a blank state. The operation of the inverter is in a steady state. In this state, the system finishes reading the operating parameters and scans whether there is an input signal that makes the system switch to other steady states. The start of the inverter is a transient state, which is a transitional state when the inverter switches from standby to running. Therefore, when programming, the transient state (functional program block) is separately written in a "step", and the work to be completed in the steady state is written in another "step". The use of Grafect stepping language simplifies the logic design of the system, facilitates the debugging of the program, and lays the foundation for the expansion of system functions.
4.3 PLC and inverter modbus communication program
The following is part of the communication program between twido plc and ev2000:
... program initialization
-*- 2 Variable frequency operation status, stop status, fault status
ld %m10 reads various parameters in real time.
[c_rdnw 0 2]
-*- 3 Frequency conversion start and frequency conversion speed regulation
[c_wrnw 0 2]
-*- 4 Frequency conversion stop and fault reset
This article introduces a frequency converter communication control technology that integrates real-time control of the frequency converter and real-time monitoring of operating parameters. When plc is networked with multiple inverters, the modbus bus can be time-division multiplexed to avoid communication conflicts. The plc and frequency converter used in the system come from different manufacturers, so there is a certain reference significance for the communication and networking of smart devices from different manufacturers. The system adopts communication control mode, and the line maintenance is simple.