With the development of computer network and fieldbus technology, PLC and HMI are widely used in industrial control and building automation. The integrated monitoring system composed of fieldbus technology and bus interface module, intelligent instrument and control equipment has become an important direction of the development of automation technology.

In the field of industrial control, the technology of combining PLC with HMI has been more and more understood and familiar by engineers. Because HMI is easy to operate and with direct interface, and programming easy to master, and because it communicates well with PLC and has strong anti-interference ability, it is rapidly infiltrating into various industries and giving full play to the greatest advantages of automatic control.

PROFIBUS provides two communication protocols: DP and FMS, and Fuji UG series HMI supports DP protocol.
Fuji HMI has strong compatibility. It can communicate with PLC of nearly 30 manufacturers, and it can also communicate with computer (open communication protocol).

Through the connection with interface unit, UG031-P communication card and bus, UG HMI can communicate with Siemens S7-300 or S7-400 series PLC as slave station and master station.

Figure 1 shows the network structure of PROFIBUS-DP.



PLC is connected to the HMI and other devices under the DP protocol

Figure 1: Network structure of PROFIBUS-DP

1. System Structure

The background of this article is a control system of a food processing plant. This system includes the main line system composed of raw material mixing line, potato cake production line and packaging line, as well as auxiliary system composed of steam boiler system, water system, compressed air system, lighting system, ventilation system and fire protection system.

The positions of each system are relatively scattered, and there are many control points, including more than 140 motors, 29 frequency converters and 15 temperature and humidity control points.

Because the system is complex, the control adopts hierarchical control strategy. The two upper computers complete the factory level monitoring and data management functions. HMI and PLC complete the field level control, and they communicate with each other by using PROFIBUS Fieldbus.

The upper computer has interface, which can connect LAN and WAN, so as to further develop. Among them, there are more than 900 digital input points, more than 400 digital output points, and 20 analog input points.

Taking this food processing plant as an example to form a centralized control system, and the system structure is shown in Figure 2.



the devices and types of PLC and HMI in the centralized control system

Figure 2: Structure of centralized control system with PLC and HMI



PLC (1) is used for main system and PLC (2) is used for auxiliary system. The composition of auxiliary system is similar to that of the main system, so it is omitted in the figure. Choose CPU315-2DP PLC of S7-300 series and CPU226 PLC of S7-200 series, FM355C PID module, CP342-5 communication module, IM153-1 extension module. I / O module is used: digital input module selects SM321, digital output is SM322, analog input is SM331. The upper computer is Siemens industrial control computer, which has a CP5611 card with PCI interface, which is used to communicate with PLC.

The CPU315-2DP of S7-300 series is selected to extend I / O module to meet the requirements of control points. The selection of IM module for extension is based on the distance between IM module and CPU315-2DP of central controller.

Since all I / O modules are placed in the same control cabinet, IM153-1 with communication distance within 5 meters is selected. When the IM module is far away from the central controller, the IM module with communication range of 100 meters can be selected.

The HMI is Fuji UG420H-SC1, which is displayed in 10.4-inch and 128 color STN. It is a special configuration software based on WINOOWs95/98/NT operating platform.

Its interface is friendly and intuitive, easy to learn and easy to use, greatly saving the product development cycle. There are a large number of graphics library (switch, lamp, bar chart) in the programming software for selection. Fuji UG420H-SC1 can also edit the required process graphics according to the user's needs, and can convert BMP files and DXF files in AUTOCAD.

2. Communication Setting and Interface Design of HMI

After the hardware connection is completed, we need to specify the hardware configuration of the system and set some communication parameters in the configuration software.

First of all, determine the type of the HMI. Here, the default UG420 (640*480 10.4 inches) is selected.

The second step is to specify the PLC type and model to communicate with the HMI. Here, Siemens S7-PROFIBUS is selected.

Finally, specify the parameters of read area and write area.



Siemens PLC 6AG1214-1BD23-2XB0

Figure 3: Siemens PLC 6AG1214-1BD23-2XB0



Read area refers to the buffer used to read data from PLC. If the trend chart needs to be displayed in the system, the read area should be larger, which is generally 1000 words. The write area is used to display the status of the storage screen, page number, picture stacking, alarm status and so on.

In addition, in the dialog box No.of Word Setting for I / O, you need to indicate the MPI address of the HMI and the frame length of transmission. MPI address has been defined in the hardware configuration of PLC. The MPI address of HMI and PLC must be consistent, otherwise communication error will occur.

Moreover, the frame length is 32 bytes; parity check is odd check; the data length is 8 bits; stop bit is 1 bit and communication mode is RS-485.

UG00S-CW is equipped with perfect and powerful configuration function. In the development of configuration, developers can not consider the problem of communication protocol, because Fuji has shielded all the technical details.

UG00S-CW is characterized in intelligent addressing. When creating a button, the button is defined in advance in PLC (for Siemens PLC, both digital and analog quantities are defined in DB block).

Suppose the address of this button is DB2.DBX2.0 (it means 0 bit of the second byte in the second DB block). And the address of the button in the HMI should be expressed as DB2: 2-0. We can see that you hardly need to do any other work except the way of writing addresses. You don't need to define variables, just let alone the frame structure of communication and so on.

The same is true for analog quantity. But, for analog quantity, you need to point out the number of bytes occupied by analog quantity, and others are as simple as digital quantity. It is very simple and convenient to use UG00S-CW to process basic analog and digital quantity, but unexpected problems will occur when it deals with some more complex situations.

In the centralized control system of this food production line, there is a problem of communication format error between Fuji HMI and Siemens PLC.

Some PID control analog quantities in the system need to be displayed by trend diagram. It is not difficult to make the trend diagram display in UG00S-CW. You first click the icon of trend chart, select the type of trend chart in the pop-up dialog box, and then select the corresponding address of each curve. However, communication error information always appears when debugging online. After checking, we find that the problem is on the trend chart.

If the trend diagram is removed from the program, everything is normal. Later, we try to read the corresponding analog data in Siemens PLC into the buffer of HMI (i.e. internal storage area), and then change the address of each curve of the trend diagram to the corresponding internal address. After online debugging, we found that the communication error information no longer appears, but the curve of trend graph is not displayed normally. After observation, we find that the curve shows normal except when the value of the analog is zero, but the curve of the analog value is not zero, the curve points to infinity. We were beset by this problem. But we worked out that it was possible that Siemens PLC and Fuji HMI might not be compatible in storage format.

The original trend diagram of Fuji HMI is generally double word (4 bytes). The order of reading from Siemens PLC is to read the higher bits first and the lower bits second, while the storage of analog quantity in Siemens PLC is to store lower bits before storing higher bits. So the data read is just reversed. The value of the analog quantity is relatively small, the higher bit is zero, which is equivalent to multiplying the original value by the number of 216, far beyond the upper limit of the analog quantity, so the above situation occurs.



Fuji HMI Industrial HMI UF5310-2

Figure 4: Fuji HMI Industrial HMI UF5310-2



In order to solve the above problem, we need to read the data in the PLC, then reverse the higher and lower bits in turn, and then point the curve address of the trend diagram to the internal address where the correction data is stored.

And to ensure this function, we need to use the macro commands of UG00S-CW. Fuji UG00S-CW platform provides a rich set of macro commands, which mainly includes the following categories:

2.1 Screen

Open macro that can be executed when an interface is opened, close macro that can be executed when an interface is closed. And cycle macro that can be executed continuously after an interface is opened until the interface is closed.

2.2 Button

On macro that can be executed when a button is pressed and off macro that can be executed when a button is released.

2.3 Macro Mode

The macro program segment is controlled by a bit. When this bit is 1, it will be executed, and when it is 0, it will stop. This bit can be the address in PLC or the internal address of HMI.

Fuji UG00S-CW's macro command set is very similar to assembly language. In addition, many system command functions and auxiliary functions are added to make the development program more convenient and fast. The storage format in the HMI is word, and the address is expressed by $u. For example, $u1000 represents the 1000th word and $u1000-14 represents the 14th bit of the 1000th word. There is no address representation for byte in the HMI.

There are several PID control loops in this food production line, and each loop corresponds to a trend diagram. Take the first loop as an example, it occupies buffer1 (up to 12 buffers available). The trend diagram has three curves PV, SP and OP, and their corresponding PLC addresses are DB10:DBD0, DB10:DBD4, DB10:DBD8, and then save the adjusted address to $u500~$u505. The program section is as follows:

First, read the analog into the HMI by using the block to assign BMOV instruction, which is to assign DB10: DBD0~ DB10: DBD8 to $u500~$u505.
$u500=DB0010: 0000 C: 12(BMOV)

Next, invert the high and low characters of each quantity.
$u600=$u500 (W)
$u500=$u501 (W)
$u501=$u600 (W)
$u602=$u502 (W)
$u502=$u503 (W)
$u503=$u602 (W)
$u604=$u504 (W)
$u500=$u505 (W)
$u505=$u604 (W)

Then copy this program segment to the cycle macro of each screen, point the buffer address to $500, set the sampling mode as constant sample, set the No. of Word as 3, the storage length as 500, set the rest as the default value. And change the addresses of the corresponding three curves in the trend chart to $U500, $u502 and $u504. In this way, the data in the HMI and PLC can be updated at the same time. Download the program to the HMI, and after online test, everything is normal.

3. Summary

Since Fuji HMI and Siemens PLC products both have an advantage of strong stability, and efficiency in software development, the combination of the two is a good choice for industrial control which can give full play to the advantages of both.

However, because they are not the same manufacturer after all, it is inevitable that there will be errors in the compatibility of some details, which we should pay special attention to when designing the industrial control system. Solving the hardware error by software is an eternal problem in IT industry. Before developers can make their products perfect, we should use our own techniques to improve the system.