Serial port server modbus performance test method, system and device

By determining the number of master station query frames, slave station response data flag information, and the number of received data frames in the Modbus serial server performance test, the problem of difficulty in locating packet loss devices in the prior art is solved, and fast and accurate packet loss analysis is achieved.

CN116723130BActive Publication Date: 2026-01-02武汉迈威通信股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310718179.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2026-01-02
Estimated Expiration
2043-06-15

AI Technical Summary

Technical Problem

In Modbus serial server performance testing, existing technologies struggle to accurately pinpoint packet loss devices, especially when the data volume is large or the packet loss is small, requiring significant time and effort to organize and filter data frames.

Method used

By determining the number of master station query frames corresponding to the Modbus data frames sent by the PLC device, counting the flag information of the slave station response data in the preset storage area, and using a serial port debugging assistant to determine the number of received data frames, data packet loss analysis is performed based on this information.

Benefits of technology

This technology enables rapid and accurate location of packet-losing devices during Modbus performance testing of serial servers, reducing the time spent manually sorting and filtering data frames and improving testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116723130B_ABST
    Figure CN116723130B_ABST
Patent Text Reader

Abstract

The application discloses a serial port server Modbus performance test method, system and equipment, the method comprises the following steps: determining the number of master station inquiry frames corresponding to the Modbus data frame sent by the PCL equipment; determining the flag bit information corresponding to the slave station response data in the preset storage area, the flag bit information comprising a first flag bit count result and a second flag bit count result; determining the number of received data frames corresponding to the serial port communication data through a serial port debugging assistant; when the serial port server Modbus performance test is completed, performing data packet loss analysis based on the number of master station inquiry frames, the flag bit information and the number of received data frames. In the application, the PLC equipment is used as the upper computer to send the Modbus data frame at a fixed time, and the number of inquiry frames sent by the upper computer in a certain period is counted by using a counter, and then the data packet loss is accurately positioned based on the number of master station inquiry frames, the flag bit information and the number of received data frames.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication equipment maintenance, in particular to a serial port server Modbus performance test method, system and equipment. BACKGROUND

[0002] When using a serial port server to test the communication performance of Modbus networking, the host computer is prone to data packet loss and other phenomena. Currently, only the packet capture or statistical data frame function of the debugging tool can be used for troubleshooting, and when the data volume is large or the packet loss is small, it takes a lot of time and effort to sort and screen the data frames to achieve the purpose of troubleshooting. In addition, in networking, the serial port server generally converts data protocols, involving the host computer and the Modbus terminal, which makes it impossible to locate the packet loss device. Therefore, how to accurately locate the packet loss device during serial port server Modbus performance testing has become a problem to be solved.

[0003] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0004] The main purpose of the present application is to provide a serial port server Modbus performance test method, system and equipment, which aims to solve the technical problem of how to accurately locate the packet loss device during serial port server Modbus performance testing.

[0005] To achieve the above purpose, the present application provides a serial port server Modbus performance test method, which comprises:

[0006] determining the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device;

[0007] determining the flag bit information corresponding to the slave station response data in the preset storage area, the flag bit information including a first flag bit count result and a second flag bit count result;

[0008] determining the number of received data frames corresponding to the serial communication data through a serial debugging assistant;

[0009] When the serial port server Modbus performance test is completed, performing data packet loss analysis based on the number of master station inquiry frames, the flag bit information and the number of received data frames.

[0010] Optionally, the step of determining the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device comprises:

[0011] when the rising edge detects the clock pulse signal, counting the number of triggers of the rising edge through a high-speed counter;

[0012] determining the number of master station inquiry frames corresponding to the PLC device sending Modbus data frames according to the trigger number.

[0013] Optionally, the step of determining the flag bit information corresponding to the slave station response data in the preset storage area, the flag bit information including a first flag bit count result and a second flag bit count result, further comprises:

[0014] determining whether the slave station response data in the preset storage area is an initial value;

[0015] If not, the flag bit M0 is set, and the first flag bit count result is counted by a counter;

[0016] If yes, the flag bit M1 is set, and the second flag bit count result is counted by the counter.

[0017] Optionally, the step of determining the number of received data frames corresponding to the serial communication data by the serial port debugging assistant comprises:

[0018] receiving serial communication data by the serial port debugging assistant, and determining the total number of received data frames corresponding to the serial communication data;

[0019] determining the number of received data frames according to the total number of received data frames and the number of bytes per frame.

[0020] Optionally, the step of performing data packet loss analysis based on the number of master station inquiry frames, the flag bit information and the number of received data frames when the serial server Modbus performance test is completed comprises:

[0021] When the number of master station inquiry frames, the first flag bit count result and the number of received data frames are consistent when the serial server Modbus performance test is completed, it is determined that data is not lost in the serial server Modbus performance test process.

[0022] Optionally, the step of performing data packet loss analysis based on the number of master station inquiry frames, the flag bit information and the number of received data frames when the serial server Modbus performance test is completed further comprises:

[0023] When the number of master station inquiry frames is greater than the first flag bit count result, and the first flag bit count result is equal to the number of received data frames when the serial server Modbus performance test is completed, it is determined that data loss in the serial server Modbus performance test process is on the serial terminal side.

[0024] Optionally, the step of performing data packet loss analysis based on the number of master station inquiry frames, the flag information and the number of received data frames at the end of the Modbus performance test of the serial server further comprises:

[0025] At the end of the Modbus performance test of the serial server, if the number of master station inquiry frames is equal to the number of received data frames, and the number of master station inquiry frames is greater than the first flag count result, it is determined that data loss in the Modbus performance test process of the serial server is on the serial server side.

[0026] In addition, to achieve the above-mentioned purpose, the application further provides a serial server Modbus performance test system, which comprises:

[0027] A determination module is configured to determine the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device;

[0028] The determination module is further configured to determine the flag information corresponding to the slave station response data in the preset storage area, and the flag information comprises a first flag count result and a second flag count result;

[0029] The determination module is further configured to determine the number of received data frames corresponding to the serial communication data through the serial debugging assistant;

[0030] An analysis module is configured to perform data packet loss analysis based on the number of master station inquiry frames, the flag information and the number of received data frames at the end of the Modbus performance test of the serial server.

[0031] In addition, to achieve the above-mentioned purpose, the application further provides a serial server Modbus performance test device, which comprises a memory, a processor and a serial server Modbus performance test program stored in the memory and executable on the processor, and the serial server Modbus performance test program is configured to implement the steps of the serial server Modbus performance test method as described above.

[0032] In addition, to achieve the above-mentioned purpose, the application further provides a storage medium, which stores a serial server Modbus performance test program, and the serial server Modbus performance test program implements the steps of the serial server Modbus performance test method as described above when executed by a processor.

[0033] Firstly, the application determines the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device, then determines the flag bit information corresponding to the slave station response data in the preset storage area, the flag bit information includes the first flag bit count result and the second flag bit count result, then determines the number of received data frames corresponding to the serial port communication data through the serial port debugging helper, and finally, when the serial port server Modbus performance test ends, the data packet loss analysis is carried out based on the number of master station inquiry frames, the flag bit information and the number of received data frames. Compared with the prior art, only the packet capture or data frame statistical function of the debugging tool can be used for troubleshooting, when the data volume is large or the packet loss volume is small, a lot of time and effort are needed to arrange and screen the data frames to achieve the purpose of troubleshooting, and the serial port server generally converts the data protocol, involves the host computer and the Modbus terminal, so that the packet loss device cannot be located, and in the application, the PLC device is used as the host computer to send the Modbus data frame at regular intervals, and the number of inquiry frames sent by the host computer in a certain period is counted by using the counter, then the initial value is set in the PLC receiving area, and whether the receiving area data is equal to the initial value is compared to count the number of received data frames, the serial port debugging helper is used on the serial port communication side to listen to the Modbus data frame, and after the test is completed, only a few sets of statistical values need to be compared to determine whether there is packet loss in the test period, and the specific packet loss device is accurately determined by comparing the statistical values. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 is a structural schematic diagram of a serial port server Modbus performance test device of a hardware running environment related to the embodiment scheme of the application.

[0035] Figure 2 is a flowchart of the serial port server Modbus performance test method of the first embodiment of the application.

[0036] Figure 3 is a test topology diagram of the serial port server Modbus performance test method of the first embodiment of the application.

[0037] Figure 4 is a test flowchart of the serial port server Modbus performance test method of the first embodiment of the application.

[0038] Figure 5 is a structural block diagram of the serial port server Modbus performance test system of the first embodiment of the application.

[0039] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0040] It should be understood that the specific embodiments described herein are merely illustrative of the present application and should not be used to limit the present application in any manner.

[0041] Referring to Figure 1 , Figure 1 The serial server Modbus performance test device structure diagram of the hardware running environment involved in the embodiment of the present application is shown.

[0042] As Figure 1 shown, the serial server Modbus performance test device can include a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between the components. The user interface 1003 can include a display screen, an input unit such as a keyboard, and can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (Wi-Fi) interface). The memory 1005 can be a high-speed random access memory (RAM), or a stable non-volatile memory (NVM) such as a disk memory. The memory 1005 can also be an independent storage system from the aforementioned processor 1001.

[0043] Those skilled in the art can understand that Figure 1 the structure shown in the figure does not constitute a limitation on the serial server Modbus performance test device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.

[0044] As Figure 1 shown, the memory 1005 as a storage medium can include an operating system, a network communication module, a user interface module, and a serial server Modbus performance test program.

[0045] In Figure 1The network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the serial server Modbus performance test device can be arranged in the serial server Modbus performance test device, the serial server Modbus performance test device calls the serial server Modbus performance test program stored in the memory 1005 through the processor 1001, and executes the serial server Modbus performance test method provided in the embodiment of the application.

[0046] The embodiment of the application provides a serial server Modbus performance test method, referring to Figure 2 , Figure 2 The embodiment of the application provides a serial server Modbus performance test method, referring to

[0047] In the embodiment, the serial server Modbus performance test method comprises the following steps:

[0048] Step S10: determining the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device.

[0049] It is easy to understand that, referring to Figure 3 and Figure 4 , Figure 3 The embodiment of the application provides a serial server Modbus performance test method, referring to Figure 4 The embodiment of the application provides a serial server Modbus performance test method, referring to

[0050] Further, when the rising edge of the clock pulse signal is detected, the number of trigger times of the rising edge is counted through the high-speed counter, and the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device is determined according to the number of trigger times.

[0051] In the specific implementation, the test mode is determined, and the serial server is set to the Modbus RTU Slave mode; in this scheme, the host computer PLC serves as a master station, and the serial terminal serves as a slave station.

[0052] PLC in this mode uses MBUS_CLIENT module for data receiving and sending, wherein the Req pin uses clock pulse to control the transmission cycle of Modbus request data frame in the form of rising edge, and the minimum value of time pulse should be greater than the time required for specific scene byte transmission. High-speed counter is used to count the number of rising edge triggers to achieve the purpose of counting the number of transmitted request data frames (the number of master inquiry frames corresponding to the transmitted Modbus data frame).

[0053] In this embodiment, the Modbus master PLC uses Siemens S7-200, and the function module for Modbus RTU Slave mode communication is MBUS_CLIENT. The Req pin is used to allow the program to send Modbus requests to the server. In order to facilitate the control of the transmission cycle of Modbus request data frame, clock pulse plus rising edge check is used to control the transmission cycle.

[0054] The rising edge is triggered once when the clock pulse signal changes from 0 to 1. High-speed counter is used to count the number of rising edge triggers, and the counting result is stored in the data block. The count result, i.e. the number of master inquiry frames, is recorded as S1.

[0055] It should be noted that the clock pulse trigger cycle T1 cannot be less than the shortest time of the test scene byte transmission. Assuming that the master inquiry data frame in the test scene is 8 bytes, the slave response data frame is 10 bytes, and the Modbus 1-8-1 no check format is used for transmission, and the communication baud rate is set to 9600bps, the shortest time T2 required for the master to transmit 8 bytes is 8*10*1000 / 9600=8.33ms, and the shortest transmission time T3 of the slave response 10 bytes is 10*10*1000 / 9600=10.42ms, then the setting value of T1 should be not less than T2+T3=18.75ms.

[0056] Step S20: Determine the flag bit information corresponding to the slave response data in the preset storage area, wherein the flag bit information includes a first flag bit count result and a second flag bit count result.

[0057] It should be noted that the preset storage area is a received data storage area, and the MBUS_CLIENT module DataPtr pin is a received data storage area. Space needs to be applied in the system to store the received data. After the application is completed, the data area is filled into the pin according to the syntax format.

[0058] Further, it is determined whether the slave response data (Modbus slave) in the preset storage area is an initial value. If not, the flag bit M0 is set, and the first flag bit count result is counted by the counter. If yes, the flag bit M1 is set, and the second flag bit count result is counted by the counter.

[0059] In a specific implementation, the data receiving area is written with an initial value in each scanning period after the program starts to execute, and the data in the receiving storage area is automatically overwritten after receiving the real slave station response data. A comparison instruction is used to compare whether the area value is the initial value. If the value is not the initial value, the flag bit M0 is set. If the value is consistent with the initial value, the flag bit M1 is set. Different flag bits are added to the rising edge logic to trigger the counter to work. The counter detects the rising edge to be triggered, that is, the counting is one time. After the counting is completed, the flag bit is reset. The flag bit M0 triggers the counter result, that is, the first flag bit counting result is recorded as S2. The flag bit M1 triggers the counter result, that is, the second flag bit counting result is recorded as S3.

[0060] Step S30: Determine the number of received data frames corresponding to the serial port communication data through the serial port debugging assistant.

[0061] In this embodiment, the serial port communication data is received through the serial port debugging assistant, and the total number of received data frames corresponding to the serial port communication data is determined. The number of received data frames is determined according to the total number of received data frames and the number of bytes of each frame of data.

[0062] In a specific implementation, Figure 3 A group of RS485 debugging cables are connected to the RS485 section. The serial port debugging assistant of the test computer is used to receive serial port communication data. The total number of received data frames is divided by the number of bytes of each frame of data, and the result is the number of received data frames, which is recorded as S4.

[0063] Step S40: When the serial port server Modbus performance test is completed, data packet loss analysis is performed based on the number of master station inquiry frames, the flag bit information, and the number of received data frames.

[0064] It should be noted that the control of the EN pin of the MBUS_CLIENT module can control whether the communication module is enabled, so as to end the serial port server Modbus performance test process.

[0065] It should be understood that the data packet loss is automatically calculated after the serial port server Modbus performance test is completed. The packet loss rate = total number of lost data frames / total number of sent data frames * 100% = S3 / S1*100%.

[0066] Further, when the serial port server Modbus performance test is completed, if the number of master station inquiry frames, the first flag bit counting result, and the number of received data frames are consistent, it is determined that no data is lost in the serial port server Modbus performance test process.

[0067] When the serial server Modbus performance test ends, if the number of master station inquiry frames is greater than the first flag bit count result, and the first flag bit count result is equal to the number of received data frames, it is determined that the data loss in the serial server Modbus performance test process is on the serial terminal side.

[0068] When the serial server Modbus performance test ends, if the number of master station inquiry frames is equal to the number of received data frames, and the number of master station inquiry frames is greater than the first flag bit count result, it is determined that the data loss in the serial server Modbus performance test process is on the serial server side.

[0069] In a specific implementation, if S1=S2=S4, it indicates that no data is lost in the entire test process; if S1>S2 and S2=S4, it indicates that the data loss occurs on the serial terminal side; and if S1=S4 and S1>S2, it indicates that the data loss occurs on the serial server side.

[0070] In the embodiment, first, the number of master station inquiry frames corresponding to the Modbus data frames sent by the PLC device is determined, then the flag bit information corresponding to the slave station response data in the preset storage area is determined, the flag bit information includes the first flag bit count result and the second flag bit count result, then the number of received data frames corresponding to the serial communication data is determined through the serial debugging assistant, and finally, when the serial server Modbus performance test ends, the data packet loss analysis is performed based on the number of master station inquiry frames, the flag bit information and the number of received data frames. Compared with the prior art, only the packet capture or statistical data frame function of the debugging tool can be used for troubleshooting, when the data volume is large or the packet loss volume is small, a lot of time and effort are needed to arrange and screen the data frames to achieve the purpose of troubleshooting, and the serial server generally converts the data protocol, involves the host computer and the Modbus terminal, and cannot locate the packet loss device. In the embodiment, the PLC device is used as the host computer to send the Modbus data frame at regular intervals, the number of inquiry frames sent by the host computer in a certain period is counted through the counter, then the initial value is set in the PLC receiving area, and whether the receiving area data is equal to the initial value is compared to count the number of received data frames. The serial communication side uses the serial debugging assistant to listen to the Modbus data frame, and only a few sets of statistical values need to be compared to determine whether there is packet loss in the test period. When the data loss occurs, the troubleshooting of the loss device is more convenient, and the analysis of the test result is more convenient.

[0071] Reference Figure 5 , Figure 5 The figure is a structural block diagram of the serial server Modbus performance test system according to the first embodiment of the application.

[0072] As Figure 5As shown, the serial server Modbus performance test system provided by the embodiment of the application comprises:

[0073] The determining module 5001 is configured to determine the number of master station inquiry frames corresponding to the Modbus data frame transmitted by the PLC device.

[0074] Further, when the rising edge of the clock pulse signal is detected, the number of triggering times of the rising edge is counted by the high-speed counter, and the number of master station inquiry frames corresponding to the Modbus data frame transmitted by the PLC device is determined according to the number of triggering times.

[0075] In a specific implementation, a test mode is determined, and the serial server is set to the Modbus RTU Slave mode. In this scheme, the upper computer PLC serves as the master station, and the serial terminal serves as the slave station.

[0076] The PLC uses the MBUS_CLIENT module to receive and transmit data in this mode. The Req pin uses the clock pulse in combination with the rising edge to control the transmission period of the Modbus request data frame. The minimum value of the time pulse should be greater than the time required for byte transmission in a specific scenario. The high-speed counter is used to count the number of triggering times of the rising edge to achieve the purpose of counting the transmitted request data frame (the number of master station inquiry frames corresponding to the Modbus data frame).

[0077] In this embodiment, the Modbus master station PLC uses Siemens S7-200. The function module for Modbus RTU Slave mode communication of the device is MBUS_CLIENT. The Req pin is used to allow the program to send Modbus requests to the server. In order to facilitate the control of the transmission period of the Modbus request data frame, the clock pulse in combination with the rising edge inspection is used to control the transmission period.

[0078] The rising edge triggers once when the clock pulse signal changes from 0 to 1. The high-speed counter is used to count the number of triggering times of the rising edge, and the counting result is stored in the data block. The counting result, i.e., the number of master station inquiry frames, is recorded as S1.

[0079] It should be further noted that the clock pulse triggering period T1 cannot be less than the shortest time of byte transmission in the test scenario. Assuming that the master station inquiry data frame is 8 bytes and the slave station response data frame is 10 bytes in the test scenario, the Modbus 1-8-1 no-check format is used for transmission, and the communication baud rate is set to 9600bps. The shortest time T2 required for the master station to transmit 8 bytes is 8*10*1000 / 9600=8.33ms, and the shortest transmission time T3 of the slave station to respond to 10 bytes is 10*10*1000 / 9600=10.42ms. Therefore, the setting value of T1 should be no less than T2+T3=18.75ms.

[0080] The determination module 5001 is further configured to determine flag bit information corresponding to the slave station response data in the preset storage area, the flag bit information including a first flag bit count result and a second flag bit count result.

[0081] It should be further noted that the preset storage area is a receiving data storage area, the MBUS_CLIENT module DataPtr pin is the receiving data storage area, and space needs to be applied in the system to store the received data. After the application is completed, the data area is filled into the pin according to the syntax format.

[0082] Further, it is determined whether the slave station (Modbus slave station) response data in the preset storage area is an initial value. If not, the flag bit M0 is set, and the first flag bit count result is counted by the counter. If yes, the flag bit M1 is set, and the second flag bit count result is counted by the counter.

[0083] In a specific implementation, the data receiving area is written with an initial value in each scanning period after the program starts to execute. After receiving the real slave station response data, the received storage area data is automatically overwritten. A comparison instruction is used to compare whether the area value is the initial value. If the initial value is not set, the flag bit M0 is set. If the initial value is consistent, the flag bit M1 is set. Different flag bits are added with rising edge logic to trigger the counter to work. The counter detects the rising edge triggered once, and the counting is completed. After that, the flag bit is reset. The flag bit M0 triggers the counter result, which is the first flag bit count result S2. The flag bit M1 triggers the counter result, which is the second flag bit count result S3.

[0084] The determination module 5001 is further configured to determine the number of received data frames corresponding to the serial port communication data by using a serial port debugging assistant.

[0085] In this embodiment, the serial port communication data is received by using the serial port debugging assistant, and the total number of received data frames corresponding to the serial port communication data is determined. The number of received data frames is determined according to the total number of received data frames and the number of bytes of each frame of data.

[0086] In a specific implementation, Figure 3 A group of RS485 debugging cables are connected to the RS485 segment. A test computer is used to open the serial port debugging assistant to receive serial port communication data. The total number of received data frames is divided by the number of bytes of each frame of data, and the result is the number of received data frames S4.

[0087] The analysis module 5002 is configured to perform data packet loss analysis based on the number of master station inquiry frames, the flag bit information, and the number of received data frames when the serial port server Modbus performance test is completed.

[0088] It is also necessary to explain that the control of the EN pin of the MBUS_CLIENT module can control whether the communication module is enabled to end the serial server Modbus performance test process.

[0089] It should also be understood that the serial server Modbus performance test is automatically calculated after the end of the data packet loss, and the packet loss rate = total number of lost data frames / total number of transmitted data frames * 100% = S3 / S1*100%.

[0090] Further, at the end of the serial server Modbus performance test, if the number of master station inquiry frames, the first flag bit count result and the received data frame number are consistent, it is determined that the data is not lost in the serial server Modbus performance test process.

[0091] At the end of the serial server Modbus performance test, if the number of master station inquiry frames is greater than the first flag bit count result, and the first flag bit count result is equal to the received data frame number, it is determined that the data loss occurs in the serial terminal side in the serial server Modbus performance test process.

[0092] At the end of the serial server Modbus performance test, if the number of master station inquiry frames is equal to the received data frame number, and the number of master station inquiry frames is greater than the first flag bit count result, it is determined that the data loss occurs in the serial server side in the serial server Modbus performance test process.

[0093] In a specific implementation, if S1=S2=S4, it indicates that the data is not lost in the entire test process; if S1>S2 and S2=S4, it indicates that the data loss occurs in the serial terminal side; if S1=S4 and S1>S2, it indicates that the data loss occurs in the serial server side.

[0094] In the embodiment, firstly, the number of master station inquiry frames corresponding to the PLC device sending Modbus data frames is determined, then the flag bit information corresponding to the slave station response data in the preset storage area is determined, the flag bit information includes the first flag bit count result and the second flag bit count result, then the number of received data frames corresponding to the serial port communication data is determined through the serial port debugging assistant, and finally, when the serial port server Modbus performance test ends, the data packet loss analysis is performed based on the number of master station inquiry frames, the flag bit information and the number of received data frames. Compared with the prior art, only the packet capture or data frame statistical function of the debugging tool can be used for troubleshooting, when the data volume is large or the packet loss volume is small, a lot of time and effort are needed to arrange and screen the data frames to achieve the purpose of troubleshooting, and the serial port server generally converts the data protocol, involves the host computer and the Modbus terminal, and cannot locate the packet loss device, while in the embodiment, the PLC device is used as the host computer to send the Modbus data frames at regular time, the number of inquiry frames sent by the host computer in a certain period is counted by using the counter, then the initial value is set in the PLC receiving area, and whether the receiving area data is equal to the initial value is compared to count the number of received data frames, the serial port debugging assistant is used on the serial port communication side to listen to the Modbus data frames, and only a few sets of statistical values need to be compared to determine whether there is packet loss in the test period after the test, so that the troubleshooting of the lost device is more convenient, and the analysis of the test result is more convenient.

[0095] Other embodiments or specific implementations of the serial port server Modbus performance test system of the application can refer to the above-mentioned method embodiments, which will not be described here.

[0096] It should be noted that in this paper, the term "including", "containing" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or system. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or system including the element.

[0097] The above-mentioned serial number of the embodiments of the application is only for description, not representing the advantages and disadvantages of the embodiments.

[0098] Those skilled in the art can clearly understand the above-mentioned example method can be realized by means of software and the necessary general hardware platform, of course, also can be through hardware, but in many cases the former is a better implementation. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art contribution can be embodied in the form of software products, the computer software product is stored in a storage medium (such as read-only memory / random access memory, disk, optical disc), including a number of instructions to make a terminal device (may be a mobile phone, computer, server, or network equipment, etc.) executes the method described in various embodiments of the present application.

[0099] The above is only the preferred embodiment of the present application, not therefore limit the patent scope of the present application, any equivalent structure or equivalent flow transformation using the content of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for testing the performance of a serial port server using Modbus, characterized in that, The Modbus performance testing method for the serial port server includes the following steps: Determine the number of master station query frames corresponding to the Modbus data frames sent by the PLC device; Determine the flag information corresponding to the slave station response data within a preset storage area, wherein the flag information includes a first flag count result and a second flag count result; Use a serial port debugging assistant to determine the number of received data frames corresponding to the serial port communication data. At the end of the Modbus serial server performance test, data packet loss analysis is performed based on the number of master station query frames, the flag information, and the number of received data frames. The step of determining the flag information corresponding to the slave station response data within the preset storage area, wherein the flag information includes a first flag count result and a second flag count result, further includes: Determine whether the slave station response data within the preset storage area is the initial value; If not, set the flag M0 and count the result of the first flag using a counter; If so, set the flag bit M1 and count the result of the second flag bit using the counter; The step of determining the number of received data frames corresponding to the serial communication data through a serial port debugging assistant includes: Receive serial communication data through a serial port debugging assistant and determine the total number of received data frames corresponding to the serial communication data. The number of received data frames is determined based on the total number of received data frames and the number of data bytes per frame. The step of performing data packet loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus serial server performance test includes: When the Modbus performance test of the serial port server ends, if the number of master station query frames, the first flag count result and the number of received data frames are consistent, it is determined that no data was lost during the Modbus performance test of the serial port server. The step of performing data packet loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus serial server performance test further includes: When the Modbus performance test of the serial port server ends, if the number of query frames from the master station is greater than the first flag count result, and the first flag count result is equal to the number of received data frames, then it is determined that data was lost on the serial port terminal side during the Modbus performance test of the serial port server. The step of performing data packet loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus serial server performance test further includes: When the Modbus performance test of the serial port server ends, if the number of master station query frames is equal to the number of received data frames, and the number of master station query frames is greater than the first flag count result, then it is determined that data was lost on the serial port server side during the Modbus performance test of the serial port server.

2. The method as described in claim 1, characterized in that, The step of determining the number of master station query frames corresponding to the Modbus data frames sent by the PLC device includes: When a clock pulse signal is detected at the rising edge, a high-speed counter is used to count the number of times the rising edge is triggered. The number of master station query frames corresponding to the Modbus data frames sent by the PLC device is determined based on the number of triggers.

3. A Modbus performance testing system for serial port servers, characterized in that, The Modbus serial port server performance testing system includes: The determination module is used to determine the number of master station query frames corresponding to the Modbus data frames sent by the PLC device. The determining module is further configured to determine the flag information corresponding to the slave station response data within the preset storage area, wherein the flag information includes a first flag count result and a second flag count result; The determining module is also used to determine the number of received data frames corresponding to the serial port communication data through a serial port debugging assistant; The analysis module is used to perform data packet loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus serial server performance test. The step of determining the flag information corresponding to the slave station response data in the preset storage area, wherein the flag information includes the first flag count result and the second flag count result, further includes: determining whether the slave station response data in the preset storage area is an initial value; if not, setting the flag M0 and counting the first flag count result using a counter; if yes, setting the flag M1 and counting the second flag count result using the counter; the step of determining the number of received data frames corresponding to the serial port communication data through a serial port debugging assistant includes: receiving the serial port communication data through a serial port debugging assistant and determining the total number of received data frames corresponding to the serial port communication data; determining the number of received data frames based on the total number of received data frames and the data bytes per frame; the step of performing data packet loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the serial port server Modbus performance test includes: at the end of the serial port server Modbus performance test, if the number of master station query frames, the first flag count result, and the number of received data frames are consistent, If the data loss during the Modbus performance test of the serial port server is not determined, then the data loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus performance test of the serial port server further includes: if the number of master station query frames is greater than the first flag count result and the first flag count result is equal to the number of received data frames at the end of the Modbus performance test of the serial port server, then the data loss during the Modbus performance test of the serial port server is determined to be on the serial port terminal side; the data loss analysis based on the number of master station query frames, the flag information, and the number of received data frames at the end of the Modbus performance test of the serial port server further includes: if the number of master station query frames is equal to the number of received data frames and the number of master station query frames is greater than the first flag count result at the end of the Modbus performance test of the serial port server, then the data loss during the Modbus performance test of the serial port server is determined to be on the serial port server side.

4. A Modbus performance testing device for serial port servers, characterized in that, The device includes: a memory, a processor, and a serial port server Modbus performance testing program stored in the memory and executable on the processor, the serial port server Modbus performance testing program being configured to implement the steps of the serial port server Modbus performance testing method as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Method, device and system for testing packet loss

    CN104917641A

  • Modbus communication quality and slave station response performance testing method

    CN106941396A