Development of diagnostic software for FCS using PROFIBUS-DP

Publisher:GoldenSerenityLatest update time:2010-06-12 Source: 中电网Keywords:Fieldbus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

PROFIBUS is a fieldbus technology with the highest market share in the field of industrial automation. It includes PROFIBUS-DP for manufacturing automation and PROFIBUS-PA for process industry. It is currently the only national fieldbus standard in China. As more and more industrial control systems adopt PROFIBUS fieldbus technology, specific, intuitive and real-time online analysis and diagnosis of these control systems has become the most basic requirement. To complete such a task, corresponding engineering analysis and diagnosis tools are needed. The bus performance analysis and diagnosis engineering tools currently studied at home and abroad have problems such as insufficient functions, imperfect interfaces, high prices, and unsuitability for China's national conditions. Developing a convenient and cost-effective analysis and diagnosis engineering tool that can analyze and diagnose the bus system will surely become a much-needed product.

Because the PRIFBUS transmission message can reflect many parameters of the bus performance, including various fault states. For example, the relationship between the master station and the slave station, the operation mode of the slave station, including channel parameters, function settings, device parameters and ID number, can be seen from the parameterized message. The I/O type and nature of the slave station, as well as the I/O nature and data type of the module can be seen from the configuration message. From the diagnostic message, we can see the various parameter setting errors, various configuration errors, and device module error types of the slave station. Therefore, the author of this article developed a PROFIBUS performance analysis and diagnostic software based on serial communication using VC++ 6.0 based on a detailed analysis of the PROFIBUS-DP message.

1 PROFIBUS working mechanism

1.1 PROFIBUS-DP encoding technology

PROFIBUS-DP uses asynchronous transmission technology and NRZ encoding to exchange data. The signal level of the NRZ-encoded binary signal "0" or "1" remains unchanged during the duration of the signal. Figure 1 shows the NRZ code signal diagram.



Figure 1 Non-return-to-zero signal

Each data link layer protocol data unit should consist of a certain number of characters, each of which is a start-stop character for asynchronous transmission.

Each character consists of 11 bits, including a start bit (ST) that is always binary "0", 8 information bits that can be either binary "0" or binary "1", an even parity bit (P) that can be either binary "1" or binary "0", and a stop bit that is always binary "1", as shown in Figure 2.


Figure 2 Single character format

The bit synchronization of the receiver always starts from the falling edge of the start bit, that is, it starts at the transition from binary "1" to binary "0". The start bit and all subsequent bits should be scanned in the middle of the bit time. In the middle of the bit time, the start bit should be binary "0", otherwise the synchronization is considered to have failed and the synchronization process is stopped. The synchronization of the character is ended with a stop bit of binary "1". If a binary "0" appears to replace this stop bit at this time, a synchronization error or character error should be considered and reported, and the leading edge of the next start bit should be waited.

1.2 Message format

As shown in Figure 3, PRFIBUS-DP has the following 5 message formats. Among them, SYN is the synchronization period, which is a minimum time interval. During this time interval, each station should receive an idle state (idle = binary "1") from the transmission medium before it can receive the send/request message frame or the start part of the token. The minimum synchronization cycle is 33 line idle bits; SD is the start delimiter, DA is the destination address, SA is the source address, FC is the control frame; FCS is the frame checksum, ED is the end delimiter, the value is 16h, L is the information field length, where SD1 = 10h, used to request FDL status, find a new active site, the message length is fixed, there is no data unit; SD2 = 68h, used for SRD service, the data length of the message is variable; SD3 = A2h, the data unit length is fixed (L is always 8 bytes); SD4 = DCh, indicating that the message is a token message; SC = E5h, short confirmation message.


Figure 3 PROFIBUS-DP link layer message format

2 Implementation of message diagnosis software

2.1 Experimental platform

Figure 4 is the structure diagram of the PROFIBUS-DP network experimental system built by the author. In the network system, the class 1 master station is the CPU315-2DP PLC of SIEMENS, the PC industrial computer is the class 2 master station, connected to the DP bus through the fieldbus interface card CP5611, and PLC devices such as WAGO's 750-333, BECKHOFF's BK3120, SIEMENS' ET200-L and Hollysys' LM3107 PLC are connected to the DP network as slave stations.



Figure 4 PROFIBUS-DP network experimental system structure diagram

2.2 Software Development Environment

The software development tool is VC++6.0. Through the computer standard serial port communication, the PROFIBUS-DP message is collected to the host computer for processing. The PROFIBUS-DP system is used as an experimental platform. The RS485/RS232 communication cable is used to connect the RS485 end of the PROFIBUS-DP network connector to the back plug interface, and the RS232 end is directly connected to the serial port of the PC.

2.3 Basic program flowchart of the software system

The basic program architecture flowchart of the software system is shown in Figure 5.



Figure 5 Basic program framework flow chart

The entire system software includes the following modules:

1) Program main control module: responsible for implementing program logic and main interface, calling serial communication module and receiving display module.

2) Serial communication module: responsible for implementing serial communication tasks, PROFIBUS-DP message data collection and serial port parameter settings.

3) Data processing module: according to the PROFIBUS-DP protocol message format, the collected data is processed according to the message format and stored in the temporary buffer.

4) Receiving display module: responsible for processing and displaying received data.

5) Database module and data query module, used to analyze and query the historical data collected from the message.

2.4 Key technologies

The software mainly realizes the extraction of PROFIBUS messages, realizes the online collection of PROFIBUS-DP message data, analyzes various messages from the perspective of the data link layer, completes the display of various types of messages, completes the extraction and display of information such as message type, service type, address, data length and data unit, and performs detailed analysis on the data units of diagnostic messages, parameterized messages and configuration messages, etc., obtains various parameters of bus performance and causes of failures, stores the analyzed data into the database, stores it in the temporary buffer, and stores the analyzed message information into the database as needed to realize historical query.

How to realize the extraction of message frames is a key issue in the design of this software. Since there are many types of PROFIBUS message formats, including variable messages with unfixed data length. Although various messages have fixed headers and trailers, the problem is that the headers and trailers are not specific characters, and may be the same as the content of the data unit in the message, so it is not feasible to use the headers and trailers to extract messages here. Here, the author uses the synchronization characters before various message frames to extract messages. That is to say, before each complete message frame is transmitted, there is a synchronization time of no less than 33 bits in front of it. There is no interval in the middle of the message frame. Using this synchronization time, the timeout function is used in VC++ to completely extract the message frame.

In addition, due to the large amount of communication data and the high speed, WINDOWS multi-threading technology is used here. One thread is the monitoring thread, which monitors the serial port communication, one is the main thread for data processing, and the other is the thread for timing database refresh. When the monitoring thread monitors that data has arrived in the serial port, it triggers a message to notify the main thread for data processing. The main thread for data processing takes out the data from the serial port buffer and processes the data. The timer thread regularly refreshes the database display to realize the real-time display function.

During the process of writing the program, the author found that the database could not be refreshed in real time. Later, it was found that the problem was with the WM_TIMER timer of WINDOWS. Since the priority of the timer message is low, it may cause the loss of WM_TIMER message, so the real-time refresh of the database cannot be realized. The solution is to use the multimedia timer of WINDOWS. In the process of using multimedia timers, the selection of timing intervals is a key issue. If the timing interval is too small, a large amount of CPU memory will be consumed, causing the system to "freeze". If the timing interval is too large, the "real-time" display function cannot be completed. This involves the issue of PROFIBUS bus information cycle time, which is related to the baud rate of bus transmission, the number of slave stations, the number of I/O data, the delay time required by the slave station, and the idle time of the master station. The author has found a suitable timer interval through a lot of calculations and multiple experimental debugging.

2.5 Display interface

The program interface of the PROFIBUS-DP message analysis software includes the main interface, serial port configuration interface, message filtering interface, message query interface, database storage interface, and historical query interface. The

main interface of the PROFIBUS-DP analysis and diagnosis software is shown in Figure 6. The "Current Profibus Message" group box in the upper left part of the window stores the recently collected PROFIBUS-DP message information, and the record can be scrolled through the record move button on the toolbar; the "Information Panel" in the upper right is used to display the detailed information of all viewed messages. The lower part of the window displays the PROFIBUS-DP historical information in a grid format.

If you need to open the serial port and start receiving PROFIBUS message information, you can select the "Start Receiving" item under the "Command" menu; if you need to stop receiving PROFIBUS message information, you can select the "Stop Receiving" item under the "Command" menu; if you need to configure the serial port parameters, you can select the "Serial Port Configuration" item under the "Command" menu, and the "Serial Port Configuration Dialog Box" will pop up. If you need to clear all current records, you can select the "Clear All Record Items" command under the "Record" menu. If you need to view various messages by category, you can select "Message Query" under the "View" command menu, and the "Message Query Dialog Box" will pop up, and you can view the messages by category as needed.



Figure 6 Main interface of software operation

3 Conclusion

The author has repeatedly run and debugged the software on the PROFIBUS network experimental system. The results show that the software can analyze several PROFIBUS messages and complete the functions of acquisition, display, analysis, storage and query, laying a foundation for future research and development, and has certain practical value.

Keywords:Fieldbus Reference address:Development of diagnostic software for FCS using PROFIBUS-DP

Previous article:Design of infrared remote control keyboard for industrial control computers
Next article:Application of Modbus Communication in PLC Channel Detection

Recommended ReadingLatest update time:2024-11-16 19:50

Profibus-DP communication example between Siemens and ABB robots
1. Configuration of TIA Portal A Create a new project in the TIA Portal software. In this case, S7-300 is selected, and its model is 313C-2DP. This PLC is an integrated PLC with its own PROFIBUS-DP port. It can be used as a master station or a slave station. In this case, the PLC acts as a master station.
[robot]
Constant Temperature Control System Based on PROFIBUS-DP Fieldbus
1 Introduction In the cigarette filter production line, there are 6 temperature signals including paper heating, preheating, seam nozzle, glue container temperature, etc. They have very high temperature requirements and require the temperature to be maintained at a constant temperature of about 140°C. Pract
[Industrial Control]
Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号