PLC communicates with VFD (Variable-frequency Drive) through free communication port
1 Introduction
In the traditional plc-frequency conversion control integrated system, the start/stop and fault monitoring of VFD (Variable-frequency Drive) are controlled end-to-end by plc through switches. The VFD (Variable-frequency Drive) frequency is controlled by the plc outputting 0-5 (10) v or 4-20ma signals through the analog output port, which requires expensive analog output port modules for the plc. When the VFD (Variable-frequency Drive) fails, the plc reads the fault alarm contact of the VFD (Variable-frequency Drive). The specific cause of the fault is not clear. You need to check the VFD (Variable-frequency Drive) alarm information before reading the VFD (Variable-frequency Drive) manual to know. With the development of AC frequency conversion control system and communication technology, the serial communication between PLC and VFD (Variable-frequency Drive) can be used to realize the control of VFD (Variable-frequency Drive) by PLC.
2 Selection of VFD (Variable-frequency Drive)
danfoss vlt series frequency converters provide support for serial communication technology. The serial communication technology it supports includes a variety of field bus methods including standard rs-485, profidrive, and lonworks. Among them, the rs-485 communication method provides users with the cheapest and most practical serial communication method without any additional costs. Only need to send data according to the communication data structure, control word and status word format stipulated by danfoss vlt VFD (Variable-frequency Drive) to realize the communication with VLT frequency conversion. vlt provides users with two control word and status word format standards: the danfoss fc protocol of the danfoss standard and the profidrive protocol of the profibus standard. Among them, the fc protocol provides users with more control information and status information related to vlt. The danfoss fc protocol is used in this project.
3 PLC selection
Siemens industrial control products have a relatively high market share in the industrial control field application market. The s7-200 series is a small-scale plc member in the Siemens simatic plc family. The free communication port mode is a characteristic function of the s7-200 plc, which allows the user to define the communication protocol for the s7-200 plc. In favor of free communication port, plc can be connected with VFD (Variable-frequency Drive) and conveniently in this system. The plc communicates with the VFD (Variable-frequency Drive) through the free communication port, controls the operation of the VFD (Variable-frequency Drive), and reads the voltage, current, power, frequency, overvoltage and overvoltage of the VFD (Variable-frequency Drive) itself. It has higher reliability than controlling the operation of VFD (Variable-frequency Drive) through external ports, saves precious I/O ports of PLC, and obtains a large number of VFDs ( Variable-frequency Drive) information. In this example, the author will program the free port of s7-200 according to the danfoss fc protocol.
4 vlt serial communication
4.1 VLT communication principle
The serial communication of vltVFD (Variable-frequency Drive) is an asynchronous half-duplex method, using byte parity check and block transmission XOR check method. Each VFD (Variable-frequency Drive) is equipped with a standard rs-485 communication port, so that the protocol can be transmitted through the rs-485 electrical interface. The plc is the master, and the VFD (Variable-frequency Drive) is the slave. The transmission of the system code is controlled by the master. The master continuously sends a code of a certain address to the slave, waiting for the response from the slave. The master can have up to 31 slaves. In the case of repeaters, it can be increased to 126 slaves, that is, the address of the slave can be set up to 126. During communication, each byte is transmitted from a start bit, and then 8 data bits are transmitted to form a byte accordingly. Each byte is verified by a parity bit to verify the correctness of the transmission, and then by A stop bit ends. Such a byte consists of 11 bits in total.
4.2 vlt code structure
Each code starts with a start byte (stx), which is stx=02h. This is followed by a byte representing the length of the code (lge) and a byte (adr) representing the address of the VFD (Variable-frequency Drive). Then some data bytes (varies with code type). The entire code is terminated by a data control byte (bcc). The structure is as attached table.
Schedule vlt code structure
领英推荐
In the above data structure:
(1) pke occupies two bytes, including parameter command type and parameter number;
(2) ind is the index, which also occupies two bytes. The index byte is used to indicate whether it is a read command or a write command. Must have the format 0400h in the read command and 0500h in the write command;
(3) pwe is the parameter value block. Occupies four bytes, divided into high word (pwe h) and low word (pwe l). "For example, if the host wants to change the current VFD (Variable-frequency Drive) parameters, the new parameters should be written in the parameter pwe and sent to VFD (Variable-frequency Drive);"
(4) pcd is a process block, occupying 4 bytes. It has two states. When the master sends it to the slave, pcd1 is the control word, and pcd2 is the reference value; when the slave sends it to the master, pcd1 is the status word, and pcd2 is the current output frequency;
(5) bcc is the data control byte. It is used to check whether the received command is correct or not. It starts with 0, and then XORs all bytes before that byte.
5 plc programming example
5.1 VFD (Variable-frequency Drive) initialization subroutine
The plc executes the initialization subroutine during the first scan, and initializes the port and rcv instructions. In order to increase the reliability of the program, after the initialization is completed, if the port is detected to be idle, the rcv command is run to make the port in the accepting state. The initialization subroutine is as follows:
network 1 // network title
The idle detection port can be edited in the main program
// Set port properties
ld sm0.0
movb 73, smb30
network 2
// receive message status
&nb