Test method and device for evaluating communication mode between PLC and upper computer
By systematically evaluating the communication methods between PLC and the host computer, including real-time, reliability, security and fault recovery testing, the problem of low efficiency and accuracy of the existing testing methods is solved, and the communication methods between PLC and the host computer is realized. Comprehensive, accurate and efficient evaluation.
Patent Information
- Application Number
- CN202411096121.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-24
AI Technical Summary
The existing PLC and upper computer communication testing methods lack comprehensiveness, especially in terms of safety and failure recovery capabilities, and the performance of communication methods cannot be comprehensively evaluated.
Provide a testing method and device, by selecting RS-232, RS-485, Ethernet or wireless communication methods, configure and test the PLC and the host computer to perform real-time, reliability, security, multi-protocol compatibility and Fault detection and recovery testing, using high-precision data capture module, automatic interference simulator, simulated attack platform and intelligent fault injection system for systematic evaluation.
It realizes a comprehensive, accurate and efficient evaluation of the communication methods between PLC and the host computer, covers a variety of communication methods commonly used in the field of industrial automation, reduces manual intervention and error rates, and improves the reliability and comprehensiveness of the test results.
Smart Images

Figure CN119182684A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of communication testing, and in particular to a testing method and device for evaluating the communication mode between a PLC and a host computer. Background Art
[0002] In the field of industrial automation, in order to ensure a comprehensive evaluation of the communication performance between the programmable logic controller (PLC) and the host computer, it is crucial to conduct detailed testing of the communication method. This can not only effectively verify the stability and efficiency of the communication method, but also evaluate its performance under different workloads.
[0003] However, the test methods in related technologies often perform limited inter-module tests through specific test items, lacking comprehensive tests on a wider range of communication methods. In addition, there is a lack of direct and systematic evaluation of the communication method itself, especially in terms of security and fault recovery capabilities. The test efficiency and accuracy of the communication method are low. Therefore, there is an urgent need for a comprehensive, accurate and efficient test method for evaluating the communication method between PLC and host computer. Summary of the invention
[0004] The present disclosure provides a test method and device for evaluating the communication mode between a PLC and a host computer, aiming to solve the problems existing in the above-mentioned background technology.
[0005] In order to solve the above technical problems, the present disclosure is implemented as follows:
[0006] In a first aspect, an embodiment of the present disclosure provides a test method for evaluating a communication mode between a PLC and a host computer, the method comprising:
[0007] Select the target communication mode that needs to be tested from RS-232 serial communication mode, RS-485 serial communication mode, Ethernet communication mode and wireless communication mode;
[0008] According to the type of the target communication mode, respectively configure the PLC and the host computer accordingly;
[0009] Performing communication testing and debugging between the PLC and the host computer;
[0010] Transmitting an evaluation test data packet between the host computer and the PLC, and performing an evaluation test on the target communication mode, wherein the evaluation test includes: a real-time test, a reliability test, a security test, a multi-protocol compatibility test, and a fault detection and recovery test;
[0011] The next communication mode to be tested is selected as a new target communication mode, and the steps are performed: according to the type of the target communication mode, the PLC and the host computer are configured accordingly.
[0012] Optionally, according to the type of the target communication mode, the PLC and the host computer are configured accordingly, including:
[0013] When the target communication mode is an RS-232 serial communication mode or an RS-485 serial communication mode, the corresponding serial port interface of the PLC is connected to the serial port interface of the host computer through a serial port cable of the corresponding serial port type;
[0014] Configuring first communication parameters on the PLC, the first communication parameters including: baud rate, data bit, stop bit and check mode;
[0015] A serial port driver required for communicating with the PLC is installed on the host computer, and second communication parameters matching the first communication parameters are configured on the host computer.
[0016] Optionally, according to the type of the target communication mode, the PLC and the host computer are configured accordingly, including:
[0017] When the target communication mode is an Ethernet communication mode, the Ethernet interface of the PLC and the Ethernet interface of the host computer are connected through a network cable, and the PLC and the host computer are in the same network segment;
[0018] Configuring first communication parameters on the PLC, the first communication parameters including: IP address, subnet mask and gateway;
[0019] A second communication parameter is configured on the host computer, wherein the second communication parameter is configured so that the PLC and the host computer are in the same subnet.
[0020] Optionally, according to the type of the target communication mode, the PLC and the host computer are configured accordingly, including:
[0021] In the case where the target communication mode is a wireless communication mode, checking whether the PLC and the host computer are both equipped with a wireless communication module, wherein the wireless communication module includes a wifi module;
[0022] In the case where both the PLC and the host computer are equipped with wireless communication modules, configuring first communication parameters on the PLC, wherein the first communication parameters include a wireless network name and a password of the wireless network;
[0023] A second communication parameter is configured on the host computer, wherein the second communication parameter is configured to enable the host computer to connect to the same wireless network as the PLC.
[0024] Optionally, the communication test and debugging between the PLC and the host computer includes:
[0025] Writing a test program on the host computer, wherein the test program is used to send a test data packet to the PLC;
[0026] Writing a data receiving program on the PLC, wherein the data receiving program is used to receive and store test data packets from the host computer;
[0027] In the case that the PLC fails to receive the test data packet, fault detection and repair are performed through the debugging tools of the PLC and the host computer so that the PLC successfully receives and stores the test data packet. The debugging tools include PLC programming software and serial port debugging tools.
[0028] Optionally, perform a real-time test as follows:
[0029] A high-precision data capture module is installed between the PLC and the host computer, wherein the high-precision data capture module includes a high-precision clock synchronization unit and a data capture unit;
[0030] The high-precision clock synchronization unit provides a synchronous clock through a high-precision clock source, and the synchronous clock is used to perform clock synchronization between the PLC and the host computer, and the high-precision clock source includes GPS, Beidou and atomic clock;
[0031] The high-resolution timer records the timestamp of each test packet sent and received at microsecond accuracy.
[0032] Through the data capture unit, the data transmission time of each evaluation test data packet is determined according to the timestamps of sending and receiving each evaluation test data packet, and compared with the synchronization clock, the delay and jitter of the data transmission between the PLC and the host computer are calculated.
[0033] Optionally, the method further comprises:
[0034] Installing a real-time analysis tool between the PLC and the host computer;
[0035] The real-time analysis tool is used to collect the delay and jitter of data transmission between the PLC and the host computer, and generate a real-time test report, which includes the record and statistical analysis results of the delay and jitter of data transmission between the PLC and the host computer.
[0036] Optionally, perform reliability testing as follows:
[0037] An automatic interference simulator and a data monitoring module are installed between the PLC and the host computer, wherein the automatic interference simulator is used to generate a variety of interference source signals, wherein the interference source signals include electromagnetic interference, radio frequency interference and power supply noise;
[0038] Adjusting the interference degree and frequency of the automatic interference simulator to generate a target interference source signal;
[0039] Injecting the target interference source signal into the communication line between the PLC and the host computer through a coupler or an antenna;
[0040] The data monitoring module monitors and records in real time the loss rate and bit error rate of the evaluation test data packet transmitted under the target interference source signal.
[0041] Optionally, the method further comprises:
[0042] Installing a reliability analysis tool between the PLC and the host computer;
[0043] The reliability analysis tool collects the loss rate and bit error rate of the evaluation test data packet transmitted under different interference source signals, and generates an anti-interference capability evaluation report, which includes the record and statistical analysis results of the loss rate and bit error rate of the evaluation test data packet.
[0044] Optionally, perform security testing as follows:
[0045] Installing a simulated attack platform and an automated tool between the PLC and the host computer, wherein the simulated attack platform includes a penetration testing tool and a data analysis tool;
[0046] Selecting a target attack method through the penetration testing tool, wherein the target attack method includes a man-in-the-middle attack, a data packet tampering, and a replay attack;
[0047] Encrypting the evaluation test data packet, and executing the target attack means between the PLC and the host computer through the automation tool;
[0048] Recording the evaluation test data packets captured during the attack process using the penetration testing tool;
[0049] The data analysis tool is used to perform real-time analysis on captured evaluation test data packets to detect potential security loopholes in the data transmission process between the PLC and the host computer.
[0050] Optionally, the method further comprises:
[0051] Installing a safety analysis tool between the PLC and the host computer;
[0052] The security analysis tool collects the analysis results of the data analysis tool on the captured evaluation test data packets, calculates the attack success rate, and generates a security test report, which includes potential security vulnerabilities and attack success rates.
[0053] Optionally, perform a multi-protocol compatibility test as follows:
[0054] A multi-protocol test platform is installed between the PLC and the host computer, wherein the multi-protocol test platform includes a protocol switching unit and a compatibility test unit;
[0055] The protocol switching unit selects and switches to a target communication protocol that needs to be tested currently from a plurality of industrial communication protocols, wherein the protocol switching unit is configured with an intelligent switching algorithm, and the industrial communication protocols include Modbus RTU / ASCII protocol, Modbus TCP protocol, Profinet protocol and Ethernet / IP protocol;
[0056] Simulating the communication environment under the target communication protocol by the compatibility testing unit, and recording the transmission performance of the evaluation test data packet under the target communication protocol;
[0057] Identifying and recording interoperability problems that occur when switching between various industrial communication protocols through the compatibility testing unit;
[0058] A compatibility test report is generated by the compatibility test unit, wherein the compatibility test report includes the transmission performance of the evaluation test data packet under the target communication protocol and interoperability problems that occur when switching between various industrial communication protocols.
[0059] Optionally, perform a fault detection and recovery test as follows:
[0060] An intelligent fault injection system is installed between the PLC and the host computer, wherein the intelligent fault injection system includes a fault simulation unit and a fault analysis unit;
[0061] Select the type of target fault that needs to be simulated currently, where the target fault type includes communication link disconnection, data packet loss, and device power failure;
[0062] By means of the fault simulation unit, a selected target fault is injected between the PLC and the host computer according to a preset time and intensity;
[0063] The fault analysis unit monitors the operating status of the PLC and the host computer in real time, and records the time when the target fault occurs and is restored;
[0064] The fault analysis unit analyzes the cause of the target fault and generates a fault report, wherein the fault report includes the time when the target fault occurs and is recovered, and the cause of the target fault.
[0065] In a second aspect, an embodiment of the present disclosure provides a test device for evaluating a communication mode between a PLC and a host computer, the device comprising:
[0066] A selection module is used to select the target communication mode currently to be tested from RS-232 serial communication mode, RS-485 serial communication mode, Ethernet communication mode and wireless communication mode;
[0067] A configuration module, used to configure the PLC and the host computer respectively according to the type of the target communication mode;
[0068] A communication test and debugging module, used for performing communication test and debugging between the PLC and the host computer;
[0069] An evaluation test module, used for transmitting an evaluation test data packet between the host computer and the PLC, and performing an evaluation test on the target communication mode, wherein the evaluation test includes: a real-time test, a reliability test, a security test, a multi-protocol compatibility test, and a fault detection and recovery test;
[0070] The repeated execution module is used to select the next communication mode to be tested as a new target communication mode, and execute the steps: according to the type of the target communication mode, respectively configure the PLC and the host computer accordingly.
[0071] Optionally, the configuration module includes:
[0072] A serial port connection submodule, used for connecting the corresponding serial port interface of the PLC and the serial port interface of the host computer through a serial port cable of the corresponding serial port type when the target communication mode is of RS-232 serial port communication mode or RS-485 serial port communication mode;
[0073] A first configuration submodule, used to configure first communication parameters on the PLC, wherein the first communication parameters include: baud rate, data bit, stop bit and check mode;
[0074] The second configuration submodule is used to install a serial port driver required for communicating with the PLC on the host computer, and configure second communication parameters matching the first communication parameters on the host computer.
[0075] Optionally, the configuration module includes:
[0076] A network cable connection submodule, used for connecting the Ethernet interface of the PLC and the Ethernet interface of the host computer through a network cable when the category of the target communication mode is the Ethernet communication mode, and the PLC and the host computer are in the same network segment;
[0077] A third configuration submodule, configured to configure first communication parameters on the PLC, wherein the first communication parameters include: an IP address, a subnet mask, and a gateway;
[0078] The fourth configuration submodule is used to configure a second communication parameter on the host computer, wherein the second communication parameter is configured so that the PLC and the host computer are in the same subnet.
[0079] Optionally, the configuration module includes:
[0080] A checking submodule, used for checking whether the PLC and the host computer are both equipped with wireless communication modules when the category of the target communication mode is a wireless communication mode, wherein the wireless communication module includes a wifi module;
[0081] A fifth configuration submodule, configured to configure a first communication parameter on the PLC when both the PLC and the host computer are installed with a wireless communication module, wherein the first communication parameter includes a wireless network name and a password of the wireless network;
[0082] The sixth configuration submodule is used to configure a second communication parameter on the host computer, wherein the second communication parameter is configured to enable the host computer to connect to the same wireless network as the PLC.
[0083] Optionally, the communication testing and debugging module includes:
[0084] A test program writing submodule, used for writing a test program on the host computer, wherein the test program is used for sending a test data packet to the PLC;
[0085] A data receiving program submodule, used for writing a data receiving program on the PLC, wherein the data receiving program is used for receiving and storing a test data packet from the host computer;
[0086] The fault detection and repair submodule is used to perform fault detection and repair through the debugging tools of the PLC and the host computer when the PLC fails to receive the test data packet, so that the PLC can successfully receive and store the test data packet. The debugging tools include PLC programming software and serial port debugging tools.
[0087] Optionally, the device further comprises:
[0088] A first installation module, used for installing a high-precision data capture module between the PLC and the host computer, wherein the high-precision data capture module includes a high-precision clock synchronization unit and a data capture unit;
[0089] A clock synchronization module, used for the high-precision clock synchronization unit to provide a synchronous clock through a high-precision clock source, the synchronous clock is used to perform clock synchronization between the PLC and the host computer, and the high-precision clock source includes GPS, Beidou and atomic clock;
[0090] A timestamp recording module, used to record the sending and receiving timestamps of each evaluation test data packet with microsecond accuracy through a high-resolution timer;
[0091] The data transmission time analysis module is used to determine the data transmission time of each evaluation test data packet according to the timestamps of sending and receiving each evaluation test data packet through the data capture unit, and compare it with the synchronous clock to calculate the delay and jitter of the data transmission between the PLC and the host computer.
[0092] Optionally, the device further comprises:
[0093] A second installation module is used to install a real-time analysis tool between the PLC and the host computer;
[0094] The real-time test report generation module is used to collect the delay and jitter of data transmission between the PLC and the host computer through the real-time analysis tool, and generate a real-time test report, wherein the real-time test report includes the record and statistical analysis results of the delay and jitter of data transmission between the PLC and the host computer.
[0095] Optionally, the device further comprises:
[0096] A third installation module is used to install an automatic interference simulator and a data monitoring module between the PLC and the host computer, wherein the automatic interference simulator is used to generate multiple interference source signals, and the interference source signals include electromagnetic interference, radio frequency interference and power supply noise;
[0097] An adjustment module, used to adjust the interference degree and frequency of the automatic interference simulator to generate a target interference source signal;
[0098] An injection module, used to inject the target interference source signal into the communication line between the PLC and the host computer through a coupler or an antenna;
[0099] The interference data recording module is used to monitor and record the loss rate and bit error rate of the evaluation test data packet transmitted under the target interference source signal in real time through the data monitoring module.
[0100] Optionally, the device further comprises:
[0101] A fourth installation module, used for installing a reliability analysis tool between the PLC and the host computer;
[0102] The anti-interference capability evaluation report generation module is used to collect the loss rate and bit error rate of the evaluation test data packet transmitted under different interference source signals through the reliability analysis tool, and generate an anti-interference capability evaluation report, wherein the anti-interference capability evaluation report includes the record and statistical analysis results of the loss rate and bit error rate of the evaluation test data packet.
[0103] Optionally, the device further comprises:
[0104] A fifth installation module, used to install a simulated attack platform and an automation tool between the PLC and the host computer, wherein the simulated attack platform includes a penetration testing tool and a data analysis tool;
[0105] An attack simulation module, used to select a target attack method through the penetration testing tool, wherein the target attack method includes a man-in-the-middle attack, a data packet tampering and a replay attack;
[0106] An attack execution module, used for encrypting the evaluation test data packet and executing the target attack means between the PLC and the host computer through the automation tool;
[0107] An attack capture module, used to record the evaluation test data packets captured during the attack process through the penetration testing tool;
[0108] The data analysis tool analysis module is used to perform real-time analysis on the captured evaluation test data packets through the data analysis tool to detect potential security holes in the data transmission process between the PLC and the host computer.
[0109] Optionally, the device further comprises:
[0110] A sixth installation module, used for installing a safety analysis tool between the PLC and the host computer;
[0111] The security test report generation module is used to collect the analysis results of the data analysis tool on the captured evaluation test data packets through the security analysis tool, calculate the attack success rate, and generate a security test report, wherein the security test report includes potential security vulnerabilities and attack success rate.
[0112] Optionally, the device further comprises:
[0113] A seventh installation module, used to install a multi-protocol test platform between the PLC and the host computer, wherein the multi-protocol test platform includes a protocol switching unit and a compatibility test unit;
[0114] A communication protocol selection module, used to select and switch to a target communication protocol currently required to be tested from a plurality of industrial communication protocols through the protocol switching unit, wherein the protocol switching unit is configured with an intelligent switching algorithm, and the industrial communication protocols include Modbus RTU / ASCII protocol, Modbus TCP protocol, Profinet protocol and Ethernet / IP protocol;
[0115] A communication environment simulation module, used to simulate the communication environment under the target communication protocol through the compatibility test unit, and record the transmission performance of the evaluation test data packet under the target communication protocol;
[0116] An interoperability problem recording module, used to identify and record interoperability problems that occur when switching between various industrial communication protocols through the compatibility testing unit;
[0117] A compatibility test report generation module is used to generate a compatibility test report through the compatibility test unit, wherein the compatibility test report includes the transmission performance of the evaluation test data packet under the target communication protocol, and interoperability problems that occur when switching between various industrial communication protocols.
[0118] The device also includes:
[0119] An eighth installation module, used to install an intelligent fault injection system between the PLC and the host computer, wherein the intelligent fault injection system includes a fault simulation unit and a fault analysis unit;
[0120] A target fault selection module is used to select the type of target fault that needs to be simulated currently, and the types of target faults include communication link disconnection, data packet loss and device power failure;
[0121] A target fault injection module, used to inject a selected target fault between the PLC and the host computer according to a preset time and intensity through the fault simulation unit;
[0122] A fault data recording module, used to monitor the operating status of the PLC and the host computer in real time through the fault analysis unit, and record the time when the target fault occurs and recovers;
[0123] The fault report generating module is used to analyze the fault cause of the target fault through the fault analysis unit and generate a fault report, wherein the fault report includes the time when the target fault occurs and is restored, and the fault cause of the target fault.
[0124] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0125] This disclosure comprehensively covers a variety of communication methods commonly used in the field of industrial automation. By selecting and configuring different target communication methods and systematically evaluating the performance of these communication methods under different workloads, the comprehensiveness and reliability of the test results are ensured.
[0126] In the evaluation test process disclosed in the present invention, real-time test, reliability test, security test, multi-protocol compatibility test and fault detection and recovery test were carried out, and the performance evaluation of the communication mode was comprehensively covered. In addition, the test method disclosed in the present invention can efficiently carry out the evaluation test through automated configuration and test process, reduce manual intervention and error rate, and can comprehensively, accurately and efficiently evaluate the communication mode between PLC and host computer. BRIEF DESCRIPTION OF THE DRAWINGS
[0127] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for describing the embodiments of the present disclosure are briefly introduced below.
[0128] Figure 1 It is a schematic diagram of the steps of a test method for evaluating the communication mode between a PLC and a host computer shown in an embodiment of the present disclosure;
[0129] Figure 2 is a schematic diagram of the steps of a real-time test shown in an embodiment of the present disclosure;
[0130] Figure 3 is a schematic diagram of a reliability test step shown in an embodiment of the present disclosure;
[0131] Figure 4 is a schematic diagram of steps of a security test shown in an embodiment of the present disclosure;
[0132] Figure 5 This is a schematic diagram of the steps of a multi-protocol compatibility test shown in an embodiment of the present disclosure;
[0133] Figure 6 is a schematic diagram of the steps of a fault detection and recovery test shown in an embodiment of the present disclosure;
[0134] Figure 7 It is a structural block diagram of a test device for evaluating the communication mode between a PLC and a host computer shown in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0135] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0136] In modern industrial automation, a good communication environment between PLC and host computer is a key link to ensure the stable operation of the production line. The choice of communication mode not only affects the speed and efficiency of data transmission, but also affects the security, reliability and compatibility of the system. The present invention provides a test method for evaluating the communication mode between PLC and host computer. By simulating various situations that may be encountered in the actual working environment, the real-time, reliability, security, multi-protocol compatibility and fault detection and recovery capabilities of the selected communication mode are comprehensively detected and evaluated, which not only helps engineers make more informed decisions when designing and implementing automation systems, but also helps on-site technicians quickly locate problems during system maintenance and troubleshooting.
[0137] Figure 1 FIG. 1 is a schematic diagram of a test method for evaluating the communication mode between a PLC and a host computer according to an embodiment of the present disclosure. Figure 1 As shown, the method includes:
[0138] Step S101, selecting a target communication mode currently to be tested from RS-232 serial communication mode, RS-485 serial communication mode, Ethernet communication mode and wireless communication mode.
[0139] Step S102: According to the type of the target communication mode, the PLC and the host computer are configured accordingly.
[0140] Step S103, performing communication testing and debugging between the PLC and the host computer.
[0141] Step S104, transmitting an evaluation test data packet between the host computer and the PLC, and performing an evaluation test on the target communication mode, wherein the evaluation test includes: real-time test, reliability test, security test, multi-protocol compatibility test and fault detection and recovery test.
[0142] Step S105, selecting the next communication mode to be tested as a new target communication mode, and executing the steps: configuring the PLC and the host computer accordingly according to the type of the target communication mode.
[0143] Involving step S101, considering the characteristics of complex and changeable application scenarios in the field of industrial automation, different communication methods have their own advantages and disadvantages, and are suitable for different application scenarios. The present disclosure uses the preferred communication methods in various typical industrial scenarios as test objects to achieve a comprehensive coverage of communication methods evaluation in multiple scenarios. For example, a PLC on a production line needs to communicate with a host computer, and the PLC and the host computer are close. At this time, the RS-232 serial port is preferred because the RS-232 serial port communication method is simple and low-cost, which is sufficient to meet the short-distance, point-to-point communication requirements. For example, a large manufacturing workshop requires multiple PLCs to communicate high-speed data with the host computer in the central control room. At this time, the Ethernet communication method is preferred because the Ethernet communication method supports high-speed, large data volume transmission, and can realize network management, which is suitable for complex industrial environments. The present disclosure selects the target communication method that needs to be tested from the RS-232 serial port communication method, the RS-485 serial port communication method, the Ethernet communication method, and the wireless communication method, and starts subsequent targeted testing and evaluation.
[0144] Involving step S102, since different communication modes have different communication parameters and configuration requirements, in order to ensure that PLC and host computer can communicate correctly under the target communication mode currently selected for testing, it is necessary to configure accordingly for the specific communication mode to ensure the effectiveness and stability of communication. Specifically, each communication mode has its specific communication parameters, such as baud rate, data bit, stop bit, verification mode, etc. The above communication parameters need to be configured consistently between PLC and host computer to achieve correct data transmission. For example, the baud rate, data bit, stop bit, etc. of RS-232 and RS-485 serial communication modes need to be configured consistently with PLC and host computer.
[0145] Involving step S103, in this step, the communication test and debugging between the PLC and the host computer is carried out to ensure that a good communication environment is established between the PLC and the host computer, which is equivalent to providing a healthy communication premise. If the communication test is abnormal, corresponding debugging is required to make the communication between the PLC and the host computer in the correct state, ensure that the communication parameters match, and the hardware connection is reliable, thereby laying the foundation for a series of subsequent evaluation tests, so that the results of the evaluation tests are accurate and reliable.
[0146] Involving step S104, the evaluation data test package is a specific data set used by the present disclosure to test and evaluate communication performance. The evaluation test data packet contains different types of data, including text, numbers, binary data, etc., to simulate the data transmission requirements in actual applications. An evaluation test data packet is generated on the host computer and sent to the PLC through the selected target communication method. The content of the evaluation test data packet can be adjusted according to the test purpose, including data packets of different sizes and data in different formats. The evaluation test includes: real-time test, reliability test, security test, multi-protocol compatibility test and fault detection and recovery test, which respectively cover the instant transmission capability, transmission stability and accuracy, security and protection capability, flexibility and scalability, and fault detection and recovery capability of the communication method, comprehensively covering a variety of performance evaluations, helping to identify and solve potential problems in communication, ensuring the stable, safe and efficient operation of the system, thereby providing engineers and technicians with effective design and maintenance references.
[0147] Involving step S105, after the target communication mode currently to be tested completes the series of evaluation tests described in step S104, the next communication mode to be tested is selected as the new target communication mode, and steps S102 to S105 are repeated until all communication modes have completed the final evaluation test.
[0148] This disclosure comprehensively covers a variety of communication methods commonly used in the field of industrial automation. By selecting and configuring different target communication methods and systematically evaluating the performance of these communication methods under different workloads, the comprehensiveness and reliability of the test results are ensured.
[0149] In the evaluation test process disclosed in the present invention, real-time test, reliability test, security test, multi-protocol compatibility test and fault detection and recovery test were carried out, and the performance evaluation of the communication mode was comprehensively covered. In addition, the test method disclosed in the present invention can efficiently carry out the evaluation test through automated configuration and test process, reduce manual intervention and error rate, and can comprehensively, accurately and efficiently evaluate the communication mode between PLC and host computer.
[0150] Exemplarily, according to the category of the target communication mode, the PLC and the host computer are configured accordingly, including: when the category of the target communication mode is RS-232 serial port communication mode or RS-485 serial port communication mode, the corresponding serial port interface of the PLC and the serial port interface of the host computer are connected through a serial port cable of the corresponding serial port type; the first communication parameters are configured on the PLC, and the first communication parameters include: baud rate, data bits, stop bits and check mode; the serial port driver required for communication with the PLC is installed on the host computer, and the second communication parameters matching the first communication parameters are configured on the host computer.
[0151] RS-232 (Recommended Standard 232) is a standard for serial communication, widely used in short-distance, point-to-point data transmission between computers and peripheral devices. RS-485 (Recommended Standard 485) is a standard for multi-point communication, suitable for longer distances and more complex communication environments. When the target communication mode is RS-232 serial communication mode or RS-485 serial communication mode, select a serial cable of the corresponding serial port type. Specifically, RS-232 serial communication can use DB9 or DB25 serial cables, while RS-485 serial communication uses cables with differential pairs to adapt to half-duplex or full-duplex communication. Connect the corresponding serial port interface of the PLC and the serial port interface of the host computer through the serial cable. For example, when the RS-232 serial communication mode is selected, use a DB9 serial cable to connect the RS-232 interface of the PLC and the serial port interface of the host computer.
[0152] Enter the communication setting interface of the PLC, and set the corresponding communication parameters according to the selected communication method, including baud rate, data bit, stop bit and check mode. Specifically, configure the first communication parameters on the PLC, install the serial port driver required to communicate with the PLC on the host computer, and configure the second communication parameters that match the first communication parameters on the host computer. For example, enter the communication setting interface of the PLC, set the first communication parameters to: baud rate: 9600bps; data bit: 8 bits; stop bit: 1 bit; check mode: no check. In the device manager of the host computer, find the corresponding serial port device and install the driver. Open the serial communication software (such as HyperTerminal or other communication debugging software), set the second communication parameters that match the PLC: baud rate: 9600bps; data bit: 8 bits; stop bit: 1 bit, to ensure consistent communication.
[0153] Exemplarily, according to the category of the target communication mode, the PLC and the host computer are configured accordingly, including: when the category of the target communication mode is the Ethernet communication mode, the Ethernet interface of the PLC and the Ethernet interface of the host computer are connected through a network cable, and the PLC and the host computer are in the same network segment; the first communication parameters are configured on the PLC, and the first communication parameters include: IP address, subnet mask and gateway; the second communication parameters are configured on the host computer, and the second communication parameters are configured to make the PLC and the host computer in the same subnet.
[0154] Ethernet is the most common local area network (LAN) technology. It defines cable types and signal processing standards for transmitting data in a LAN. Ethernet communication is applicable to many fields such as industrial control, office networks, and home networks. It has the advantages of fast transmission speed, large data capacity, high reliability, and easy expansion. When the target communication method is Ethernet communication, use a standard Ethernet cable (such as CAT5e or CAT6) to connect the Ethernet interface of the PLC to the Ethernet interface of the host computer, and ensure that the PLC and the host computer are in the same network segment.
[0155] Configure the first communication parameters on the PLC. At this time, the first communication parameters are network communication parameters, including IP address, subnet mask and gateway. For example, configure the first communication parameters as follows: IP address: 192.168.1.100; subnet mask: 255.255.255.0; gateway: usually the IP address of the router connected to the external network. The configured gateway needs to enable the PLC to communicate with devices outside the local area network. Configure the second communication parameters on the host computer so that it is in the same subnet as the PLC and can communicate normally. For example, configure the first communication parameters as follows: 192.168.1.101; subnet mask: 255.255.255.0; gateway: configured to be consistent with the gateway address of the PLC so that it can communicate with devices outside the local area network.
[0156] Exemplarily, according to the category of the target communication mode, the PLC and the host computer are configured accordingly, including: when the category of the target communication mode is the wireless communication mode, checking whether the PLC and the host computer are both installed with wireless communication modules, and the wireless communication modules include a wifi module; when the PLC and the host computer are both installed with wireless communication modules, configuring the first communication parameters on the PLC, and the first communication parameters include the wireless network name and password of the wireless network; configuring the second communication parameters on the host computer, and the second communication parameters are configured to enable the host computer to connect to the same wireless network as the PLC.
[0157] Wireless communication uses radio waves to transmit data. Common wireless communication technologies include Wi-Fi, Bluetooth, ZigBee, etc. In the field of industrial automation, Wi-Fi is one of the most commonly used wireless communication methods. It is suitable for scenarios that require flexibility, high-speed data transmission and difficult wiring. Wi-Fi communication has the advantages of convenience of wireless connection, support for high-bandwidth transmission, easy installation and configuration, etc. In the case where the category of the target communication method is wireless communication, ensure that both the PLC and the host computer are equipped with wireless communication modules (such as Wi-Fi modules) and are correctly installed and in working condition. If the device does not have a built-in wireless module, an external adapter is required.
[0158] Configure the first communication parameters on the PLC so that it can connect to the target wireless network. At this time, the first communication parameters are wireless network parameters, including the wireless network name SSID and password. Specifically, enter the network configuration interface of the PLC, enter the SSID and password in the wireless network settings, save the configuration and restart the wireless module to apply the new configuration. The wireless network name SSID must be consistent with the SSID of the target wireless network. If the network is open (without password), the password configuration can be omitted. Configure the second communication parameters on the host computer so that it can connect to the same wireless network as the PLC. For example, on the PLC, configure the first communication parameters, enter the wireless network name SSID as: "FactoryNetwork"; enter the wireless network password as "password123". Then configure the second communication parameters on the host computer to connect to the same wireless network as the PLC, select the wireless network with SSID "FactoryNetwork", enter the password "password123" and connect.
[0159] Exemplarily, the communication test and debugging between the PLC and the host computer includes: writing a test program on the host computer, the test program being used to send a test data packet to the PLC; writing a data receiving program on the PLC, the data receiving program being used to receive and store the test data packet from the host computer; in the event that the PLC fails to receive the test data packet, performing fault detection and repair through debugging tools of the PLC and the host computer, so that the PLC successfully receives and stores the test data packet, the debugging tools including PLC programming software and serial port debugging tools.
[0160] In order to ensure that the communication between PLC and host computer can be carried out normally, comprehensive communication testing and debugging must be carried out before the evaluation test is carried out. A test program is written on the host computer, and the main function of the test program is to send a test data packet to the PLC. The specific functions of the test program include generating a test data packet containing different types of data (such as text, numbers, binary data) and sending the test data packet to the PLC through the selected target communication mode. Correspondingly, a data receiving program is written on the PLC, and the data receiving program is used to receive and store the test data packet from the host computer. The format and content of the test data packet are not limited in this disclosure.
[0161] When the PLC fails to successfully receive the test data packet sent by the host computer, fault detection and repair are required. Optionally, detailed diagnosis and debugging can be performed through PLC programming software (such as Siemens TIA Portal, Allen-Bradley RSLogix) and serial port debugging tools (such as Tera Term, PuTTY, etc.). Specifically, start the PLC programming software and connect to the PLC. Check the communication status and error information of the PLC, and confirm that the communication parameters of the PLC and the host computer are consistent. If necessary, modify the PLC receiving program to add more error handling and debugging information. Connect to the serial port of the host computer through the serial port debugging tool, send a test data packet, check the receiving status of the PLC, and further analyze and repair the communication problem according to the error information displayed by the serial port debugging tool. Through the above steps, the communication test and debugging between the PLC and the host computer can be effectively carried out to ensure that the communication parameters match and the hardware connection is reliable, thus laying the foundation for subsequent evaluation tests.
[0162] Figure 2 is a schematic diagram of a real-time test step shown in an embodiment of the present disclosure, such as Figure 2 As shown, illustratively, the real-time test is performed according to the following steps:
[0163] Step S201, installing a high-precision data capture module between the PLC and the host computer, wherein the high-precision data capture module includes a high-precision clock synchronization unit and a data capture unit.
[0164] Step S202: The high-precision clock synchronization unit provides a synchronous clock through a high-precision clock source, and the synchronous clock is used to perform clock synchronization between the PLC and the host computer. The high-precision clock source includes GPS, Beidou and atomic clock.
[0165] The high-precision clock synchronization unit uses a high-precision clock source (such as GPS, Beidou or atomic clock) to provide a synchronous clock signal. The synchronous clock signal is used to calibrate the internal clocks of the PLC and the host computer, reducing the clock deviation between the two to the microsecond level to ensure that the timestamp record of the data packet is accurate.
[0166] Step S203: Record the sending and receiving timestamps of each evaluation test data packet with microsecond accuracy using a high-resolution timer.
[0167] Use a high-resolution timer to record the send and receive times of each evaluation test packet. The high-resolution timer has microsecond accuracy, which is critical for evaluating the latency and jitter of packet transmission. The send timestamp is recorded when the packet leaves the host computer, and the receive timestamp is recorded when the evaluation packet arrives at the PLC. For example, when the host computer sends an evaluation packet containing production instructions, the high-resolution timer records the send timestamp. The send time can be recorded as 10:23:45.123456. Then, when the PLC receives this packet, the timer records the receive timestamp, such as 10:23:45.123789.
[0168] Step S204, through the data capture unit, the data transmission time of each evaluation test data packet is determined according to the timestamp of sending and receiving each evaluation test data packet, and compared with the synchronization clock to calculate the delay and jitter of data transmission between the PLC and the host computer.
[0169] The data capture unit compares the sending and receiving timestamps to calculate the transmission time (i.e., delay) of each evaluation test packet. At the same time, the jitter (i.e., the change in delay) is calculated through the delay values of multiple transmissions. If the sending and receiving timestamps of three evaluation test packets are as follows:
[0170] Packet 1: sent 10:23:45.123456, received 10:23:45.123789 (delay 333 microseconds);
[0171] Packet 2: sent 10:23:46.234567, received 10:23:46.234900 (delay 333 microseconds);
[0172] Packet 3: sent at 10:23:47.345678, received at 10:23:47.345999 (delay of 321 microseconds). By analyzing these delay values, the average value and jitter range of the transmission delay can be obtained, thereby evaluating the real-time and stability of the communication. For example, the average delay is 329 microseconds and the jitter is 12 microseconds.
[0173] Exemplarily, the method also includes: installing a real-time analysis tool between the PLC and the host computer; collecting the delay and jitter of data transmission between the PLC and the host computer through the real-time analysis tool, and generating a real-time test report, wherein the real-time test report includes records and statistical analysis results of the delay and jitter of data transmission between the PLC and the host computer.
[0174] The real-time analysis tool is a device or software provided by the present disclosure for monitoring and analyzing the data transmission performance between the PLC and the host computer. It can collect the delay and jitter information of the data transmission in real time and perform statistical analysis on these data. The real-time analysis tool helps to fully understand and record the communication performance during the data transmission process. The real-time analysis tool records the sending and receiving time of each evaluation test data packet and calculates the transmission delay of each evaluation test data packet. At the same time, the real-time analysis tool records the delay change of each transmission and calculates the jitter. All these data will be collected in real time and stored in the database of the real-time analysis tool.
[0175] For example, after the real-time test is completed, the real-time analysis tool generates a real-time test report based on the data captured and recorded during the real-time test. The real-time test report includes the record and statistical analysis results of the delay and jitter of the data transmission between the PLC and the host computer. The content of the real-time test report can be shown in Table 1:
[0176] Number of transmitted packets Average latency Maximum delay Minimum delay Latency Standard Deviation Average jitter 1000 334 microseconds 340 microseconds 330 microseconds 3 microseconds 2 microseconds
[0177] Table 1
[0178] In addition to providing detailed data information, the real-time analysis tool can also be configured to display the changing trends of latency and jitter as required, allowing engineers to intuitively understand communication performance.
[0179] Figure 3 FIG. 1 is a schematic diagram of a reliability test step shown in an embodiment of the present disclosure. Figure 3 As shown, illustratively, the reliability test is performed according to the following steps:
[0180] Step S301, installing an automatic interference simulator and a data monitoring module between the PLC and the host computer, wherein the automatic interference simulator is used to generate a variety of interference source signals, and the interference source signals include electromagnetic interference, radio frequency interference and power supply noise.
[0181] The present disclosure provides an automatic interference simulator and a data monitoring module for reliability testing, wherein the automatic interference simulator is used to generate various interference signals, including electromagnetic interference (EMI), radio frequency interference (RFI) and power supply noise, to simulate interference conditions in an industrial environment. The data monitoring module is used to monitor the stability of a communication channel in real time and record the packet loss rate and bit error rate.
[0182] Step S302, adjusting the interference degree and frequency of the automatic interference simulator to generate a target interference source signal.
[0183] According to the test requirements, adjust the parameters of the automatic interference simulator, including the interference level (intensity) and interference frequency, generate interference source signals under specific conditions, and simulate various interference situations in the real environment. For example, before the reliability test begins, set the electromagnetic interference intensity to medium (e.g., 50% interference intensity) and the frequency to 1kHz to simulate the common electromagnetic noise environment in the factory workshop.
[0184] Step S303: inject the target interference source signal into the communication line between the PLC and the host computer through a coupler or an antenna.
[0185] Use a coupler or antenna to inject the set interference signal into the communication line between the PLC and the host computer, so that the entire communication process is affected by the set interference signal, thereby evaluating the performance of the system under interference conditions. Specifically, assume that a coupler is used, connect the coupler to the communication line, and inject the target interference source signal into the communication line between the PLC and the host computer through the coupler, so that the data transmission process is affected by simulated interference.
[0186] Step S304: monitor and record in real time, through the data monitoring module, the loss rate and bit error rate of the evaluation test data packet transmitted under the target interference source signal.
[0187] The data monitoring module will record the status of data packets transmitted under interference conditions in real time, including key performance indicators such as loss rate and bit error rate, to help evaluate the system's anti-interference ability. Assume that after 10 minutes of reliability testing, the monitoring module records the following results: total number of transmitted data packets is 1000; number of data packet losses is 15; number of data packet errors is 8. It can be obtained that the data packet loss rate is 1.5% and the bit error rate is 0.8%.
[0188] Exemplarily, the method also includes: installing a reliability analysis tool between the PLC and the host computer; collecting the loss rate and bit error rate of the evaluation test data packet transmitted under different interference source signals through the reliability analysis tool, and generating an anti-interference capability evaluation report, wherein the anti-interference capability evaluation report includes the record and statistical analysis results of the loss rate and bit error rate of the evaluation test data packet.
[0189] The reliability analysis tool is used to collect and analyze the loss rate and bit error rate of data packets transmitted under different interference conditions. Optionally, the reliability tool is a hardware device or software tool that can monitor and record various abnormal conditions that occur during the communication process in real time. The reliability analysis tool collects and records the loss rate and bit error rate of data packets in real time under different interference source signals. For example, under simulated electromagnetic interference (EMI) and radio frequency interference (RFI), the reliability analysis tool records the following data:
[0190] Under 100Hz EMI conditions, the packet loss rate is 2% and the bit error rate is 1%;
[0191] Under 500Hz EMI conditions, the packet loss rate is 3% and the bit error rate is 1.5%;
[0192] Under 2.4GHz RFI conditions, the packet loss rate is 5% and the bit error rate is 3%. The reliability analysis tool organizes and analyzes the collected data to generate an anti-interference capability evaluation report, which records in detail the packet loss rate and bit error rate under various interference conditions, and evaluates the overall anti-interference capability of the system through statistical analysis. As described in this example, the content of the anti-interference capability evaluation report can be shown in Table 2:
[0193]
[0194]
[0195] Table 2
[0196] Figure 4 FIG. 1 is a schematic diagram of a safety test step shown in an embodiment of the present disclosure. Figure 4 As shown, illustratively, the security test is performed according to the following steps:
[0197] Step S401, installing a simulated attack platform and an automation tool between the PLC and the host computer, wherein the simulated attack platform includes a penetration testing tool and a data analysis tool.
[0198] A simulated attack platform is installed between the PLC and the host computer for security testing. The simulated attack platform includes penetration testing tools and data analysis tools, which can simulate various attack methods and record and analyze security issues in data transmission.
[0199] Step S402, selecting a target attack method through the penetration testing tool, wherein the target attack method includes a man-in-the-middle attack, a data packet tampering and a replay attack.
[0200] Use the penetration testing tool to select specific attack methods as the target tool MITM. The target attack methods include man-in-the-middle attack, data packet tampering and replay attack. Each attack method simulates different types of security threats to comprehensively evaluate the security of the communication system. Among them, the man-in-the-middle attack method is to intercept and modify the data packets transmitted between the PLC and the host computer, the data packet tampering method is to tamper with the content of the data packet during the data transmission process, and the replay attack method is to capture the data packet and resend it at a later time to test the system's ability to handle repeated data packets.
[0201] Step S403, encrypting the evaluation test data packet, and executing the target attack means between the PLC and the host computer through the automation tool.
[0202] The evaluation test data packets are encrypted, and the AES encryption algorithm can be used to encrypt the evaluation test data packets. And the selected attack methods are executed using automated tools (such as scripts or dedicated attack software) to test whether the encrypted data can resist these attacks during transmission.
[0203] Step S404: Record the evaluation test data packets captured during the attack process using the penetration testing tool.
[0204] During the attack, the penetration testing tool will record all captured evaluation test packets and use the recorded packets for subsequent analysis to determine the impact of the attack on data transmission.
[0205] Step S405: Perform real-time analysis on the captured evaluation test data packets through the data analysis tool to detect potential security loopholes in the data transmission process between the PLC and the host computer.
[0206] Using data analysis tools to analyze captured data packets in real time to detect security vulnerabilities exposed during the attack process helps identify and fix potential security issues in the system.
[0207] For example, use data analysis tools to analyze the captured data packets. Through analysis, some security vulnerabilities were found. It was found that the encryption strength of some data packets was insufficient under man-in-the-middle attacks and they were easily cracked. At the same time, after the data packets were tampered, the system did not detect data anomalies in time. In addition, the replay attack was successful and the system did not effectively identify and reject duplicate data packets. Based on the potential security vulnerabilities found above, engineers can choose to improve the encryption algorithm and data packet verification mechanism to enhance the security of the system.
[0208] Exemplarily, the method also includes: installing a security analysis tool between the PLC and the host computer; collecting, through the security analysis tool, analysis results of the data analysis tool on the captured evaluation test data packets, calculating the attack success rate, and generating a security test report, wherein the security test report includes potential security vulnerabilities and attack success rates.
[0209] A security analysis tool is installed between the PLC and the host computer to further analyze and evaluate the test data packets. The security analysis tool can work in conjunction with the data analysis tool to provide a more comprehensive security assessment. Through the security analysis tool, the analysis results of the data analysis tool on the captured evaluation test data packets are collected. The analysis results include the impact of various attack methods, the status of the evaluation test data packets, and the response of the system. According to the data analysis results, the success rate of each attack method is calculated. The attack success rate refers to the frequency or proportion of the attack method successfully affecting the system during the simulated attack process, which is used to help engineers evaluate the system's protection capabilities. For example, in a simulated man-in-the-middle attack, the engineer made 100 attempts to intercept data packets, of which 85 successfully modified the data packet content and were not detected by the system. Therefore, the success rate of the man-in-the-middle attack is 85%. Based on the collected analysis results and the calculated attack success rate, a security test report is generated. The security test report includes potential security vulnerabilities and attack success rates. The content of the security test report can be shown in Table 3:
[0210]
[0211]
[0212] Table 3
[0213] According to the security test report, the security of the communication method between PLC and host computer can be comprehensively evaluated, which not only helps to identify potential security vulnerabilities, but also provides specific suggestions for improving the security of the communication system between PLC and host computer, ensuring the robustness and reliability of the system under various attack methods.
[0214] Figure 5 FIG. 1 is a schematic diagram of a multi-protocol compatibility test step according to an embodiment of the present disclosure. Figure 5 As shown, illustratively, the multi-protocol compatibility test is performed according to the following steps:
[0215] Step S501, installing a multi-protocol test platform between the PLC and the host computer, the multi-protocol test platform comprising a protocol switching unit and a compatibility test unit.
[0216] A multi-protocol test platform is installed between the PLC and the host computer, including a protocol switching unit and a compatibility test unit. The protocol switching unit is responsible for switching between different industrial communication protocols, while the compatibility test unit simulates various communication environments and records the transmission performance.
[0217] Step S502, through the protocol switching unit, select and switch to the target communication protocol currently required to be tested from multiple industrial communication protocols, the protocol switching unit is configured with an intelligent switching algorithm, and the industrial communication protocols include Modbus RTU / ASCII protocol, Modbus TCP protocol, Profinet protocol and Ethernet / IP protocol.
[0218] Through the protocol switching unit, select and switch from multiple industrial communication protocols to the target communication protocol that currently needs to be tested. The protocol switching unit is equipped with an intelligent switching algorithm to ensure smooth transition and seamless communication during protocol switching. Industrial communication protocols include Modbus RTU / ASCII, Modbus TCP, Profinet, and Ethernet / IP. For example, when the performance of the Modbus TCP protocol needs to be tested, use the multi-protocol test platform and select the Modbus TCP protocol through the software interface. The intelligent switching algorithm runs in the background so that the switching process from Modbus RTU to Modbus TCP does not affect the communication stability.
[0219] Step S503: simulating the communication environment under the target communication protocol through the compatibility testing unit, and recording the transmission performance of the evaluation test data packet under the target communication protocol.
[0220] Step S504: identifying and recording interoperability problems that occur when switching between industrial communication protocols through the compatibility testing unit.
[0221] The compatibility test unit identifies and records interoperability issues that occur when switching between different industrial communication protocols. Interoperability issues include incompatible data formats, communication interruptions, etc. For example, when switching from Modbus TCP protocol to Profinet protocol, it was found that the PLC could not correctly parse the data packets from the host computer. The compatibility test unit automatically records this interoperability issue.
[0222] Step S505: Generate a compatibility test report through the compatibility test unit, wherein the compatibility test report includes the transmission performance of the evaluation test data packet under the target communication protocol and interoperability problems that occur when switching between various industrial communication protocols.
[0223] After completing the test of all protocols, a compatibility test report is generated through the compatibility test unit. The compatibility test report includes the transmission performance of the test data packet under the target communication protocol and the interoperability issues that occur when switching between various industrial communication protocols. The content of the compatibility test report can be shown in Table 4:
[0224]
[0225]
[0226] Table 4
[0227] Figure 6 FIG. 1 is a schematic diagram of a fault detection and recovery test step according to an embodiment of the present disclosure. Figure 6 As shown, illustratively, the fault detection and recovery test is performed according to the following steps:
[0228] Step S601: installing an intelligent fault injection system between the PLC and the host computer, wherein the intelligent fault injection system includes a fault simulation unit and a fault analysis unit.
[0229] An intelligent fault injection system is installed between the PLC and the host computer. The intelligent fault injection system includes a fault simulation unit and a fault analysis unit, which are used to generate and monitor various faults.
[0230] Step S602: Select the type of target fault that needs to be simulated currently. The target fault types include communication link disconnection, data packet loss, and device power failure.
[0231] Step S603: injecting a selected target fault between the PLC and the host computer through the fault simulation unit according to a preset time and intensity.
[0232] Through the fault simulation unit, the selected target fault is injected between the PLC and the host computer according to the preset time and intensity. It can be understood as introducing a specific type of fault in the controlled environment between the PLC and the host computer to simulate various abnormal situations that may occur in reality, so as to verify the stability, reliability and fault recovery ability of the system. For example, the disconnection time is set to 30 seconds on the fault injection system, and the intensity is set to completely disconnect. After startup, the fault injection system will cut off the communication link between the PLC and the host computer at the preset time point and automatically recover after 30 seconds.
[0233] Step S604: monitor the operating status of the PLC and the host computer in real time through the fault analysis unit, and record the time when the target fault occurs and is restored.
[0234] The fault analysis unit monitors the operating status of the PLC and the host computer in real time, records the time of occurrence and recovery of the target fault, and the status data of the PLC and the host computer during operation. Optionally, the operating status of the system can be viewed in real time through the monitoring interface.
[0235] Step S605: Analyze the cause of the target fault by the fault analysis unit and generate a fault report, wherein the fault report includes the time when the target fault occurs and is restored, and the cause of the target fault.
[0236] Through the fault analysis unit, based on the intelligent analysis algorithm, the cause of the target fault is analyzed, and a fault report is generated. The fault report includes the time when the target fault occurs and recovers, and the cause of the target fault. Specifically, the intelligent analysis algorithm may include the following steps: data preprocessing, feature extraction, pattern recognition, and cause inference. The fault report may be shown in Table 5:
[0237]
[0238] Table 5
[0239] Please refer to Table 5. In the scenario shown in the fault report, the target fault type is set to "communication link disconnection" and the link disconnection time is set to 20 seconds. At the set time point, the fault simulation unit cuts off the communication link between the PLC and the host computer and restores the connection after 20 seconds. The operating status of the PLC and the host computer is monitored in real time by the fault analysis unit, and the time when the target fault occurs and recovers, as well as the status data of the PLC and the host computer during operation are recorded. According to the steps of the intelligent analysis algorithm provided by the present disclosure, the collected data is first cleaned and standardized, and key features such as communication error codes, device logs, error frequencies, etc. are extracted from the data. Then, a machine learning model (such as a neural network) is used for pattern recognition to analyze features and identify fault modes. Based on the model of the pre-trained learning model, the cause of the fault is inferred to be "during the link disconnection, a transient fault occurred in the network switch, resulting in communication interruption".
[0240] Through the above steps, the fault detection and recovery capabilities of the PLC and the host computer under various communication modes can be fully tested and evaluated, providing an effective reference for fault handling and system optimization in practical applications.
[0241] Figure 7 is a structural block diagram of a test device for evaluating the communication mode between a PLC and a host computer shown in an embodiment of the present disclosure, such as Figure 7 As shown, the device comprises:
[0242] The selection module 701 is used to select the target communication mode currently to be tested from the RS-232 serial communication mode, the RS-485 serial communication mode, the Ethernet communication mode and the wireless communication mode;
[0243] Configuration module 702, used to configure the PLC and the host computer respectively according to the type of the target communication mode;
[0244] Communication test and debugging module 703, used for communication test and debugging between the PLC and the host computer;
[0245] An evaluation test module 704 is used to transmit an evaluation test data packet between the host computer and the PLC, and to perform an evaluation test on the target communication mode, wherein the evaluation test includes: a real-time test, a reliability test, a security test, a multi-protocol compatibility test, and a fault detection and recovery test;
[0246] The module 705 is repeatedly executed to select the next communication mode to be tested as a new target communication mode, and execute the steps: according to the type of the target communication mode, the PLC and the host computer are configured accordingly.
[0247] Optionally, the configuration module includes:
[0248] A serial port connection submodule, used for connecting the corresponding serial port interface of the PLC and the serial port interface of the host computer through a serial port cable of the corresponding serial port type when the target communication mode is of RS-232 serial port communication mode or RS-485 serial port communication mode;
[0249] A first configuration submodule, used to configure first communication parameters on the PLC, wherein the first communication parameters include: baud rate, data bit, stop bit and check mode;
[0250] The second configuration submodule is used to install a serial port driver required for communicating with the PLC on the host computer, and configure second communication parameters matching the first communication parameters on the host computer.
[0251] Optionally, the configuration module includes:
[0252] A network cable connection submodule, used for connecting the Ethernet interface of the PLC and the Ethernet interface of the host computer through a network cable when the category of the target communication mode is the Ethernet communication mode, and the PLC and the host computer are in the same network segment;
[0253] A third configuration submodule, configured to configure first communication parameters on the PLC, wherein the first communication parameters include: an IP address, a subnet mask, and a gateway;
[0254] The fourth configuration submodule is used to configure a second communication parameter on the host computer, wherein the second communication parameter is configured so that the PLC and the host computer are in the same subnet.
[0255] Optionally, the configuration module includes:
[0256] A checking submodule, used for checking whether the PLC and the host computer are both equipped with wireless communication modules when the category of the target communication mode is a wireless communication mode, wherein the wireless communication module includes a wifi module;
[0257] A fifth configuration submodule, configured to configure a first communication parameter on the PLC when both the PLC and the host computer are installed with a wireless communication module, wherein the first communication parameter includes a wireless network name and a password of the wireless network;
[0258] The sixth configuration submodule is used to configure a second communication parameter on the host computer, wherein the second communication parameter is configured to enable the host computer to connect to the same wireless network as the PLC.
[0259] Optionally, the communication testing and debugging module includes:
[0260] A test program writing submodule, used for writing a test program on the host computer, wherein the test program is used for sending a test data packet to the PLC;
[0261] A data receiving program submodule, used for writing a data receiving program on the PLC, wherein the data receiving program is used for receiving and storing a test data packet from the host computer;
[0262] The fault detection and repair submodule is used to perform fault detection and repair through the debugging tools of the PLC and the host computer when the PLC fails to receive the test data packet, so that the PLC can successfully receive and store the test data packet. The debugging tools include PLC programming software and serial port debugging tools.
[0263] Optionally, the device further comprises:
[0264] A first installation module, used for installing a high-precision data capture module between the PLC and the host computer, wherein the high-precision data capture module includes a high-precision clock synchronization unit and a data capture unit;
[0265] A clock synchronization module, used for the high-precision clock synchronization unit to provide a synchronous clock through a high-precision clock source, the synchronous clock is used to perform clock synchronization between the PLC and the host computer, and the high-precision clock source includes GPS, Beidou and atomic clock;
[0266] A timestamp recording module, used to record the sending and receiving timestamps of each evaluation test data packet with microsecond accuracy through a high-resolution timer;
[0267] The data transmission time analysis module is used to determine the data transmission time of each evaluation test data packet according to the timestamps of sending and receiving each evaluation test data packet through the data capture unit, and compare it with the synchronous clock to calculate the delay and jitter of the data transmission between the PLC and the host computer.
[0268] Optionally, the device further comprises:
[0269] A second installation module is used to install a real-time analysis tool between the PLC and the host computer;
[0270] The real-time test report generation module is used to collect the delay and jitter of data transmission between the PLC and the host computer through the real-time analysis tool, and generate a real-time test report, wherein the real-time test report includes the record and statistical analysis results of the delay and jitter of data transmission between the PLC and the host computer.
[0271] Optionally, the device further comprises:
[0272] A third installation module is used to install an automatic interference simulator and a data monitoring module between the PLC and the host computer, wherein the automatic interference simulator is used to generate multiple interference source signals, and the interference source signals include electromagnetic interference, radio frequency interference and power supply noise;
[0273] An adjustment module, used to adjust the interference degree and frequency of the automatic interference simulator to generate a target interference source signal;
[0274] An injection module, used to inject the target interference source signal into the communication line between the PLC and the host computer through a coupler or an antenna;
[0275] The interference data recording module is used to monitor and record the loss rate and bit error rate of the evaluation test data packet transmitted under the target interference source signal in real time through the data monitoring module.
[0276] Optionally, the device further comprises:
[0277] A fourth installation module, used for installing a reliability analysis tool between the PLC and the host computer;
[0278] The anti-interference capability evaluation report generation module is used to collect the loss rate and bit error rate of the evaluation test data packet transmitted under different interference source signals through the reliability analysis tool, and generate an anti-interference capability evaluation report, wherein the anti-interference capability evaluation report includes the record and statistical analysis results of the loss rate and bit error rate of the evaluation test data packet.
[0279] Optionally, the device further comprises:
[0280] A fifth installation module, used to install a simulated attack platform and an automation tool between the PLC and the host computer, wherein the simulated attack platform includes a penetration testing tool and a data analysis tool;
[0281] An attack simulation module, used to select a target attack method through the penetration testing tool, wherein the target attack method includes a man-in-the-middle attack, a data packet tampering and a replay attack;
[0282] An attack execution module, used for encrypting the evaluation test data packet and executing the target attack means between the PLC and the host computer through the automation tool;
[0283] An attack capture module, used to record the evaluation test data packets captured during the attack process through the penetration testing tool;
[0284] The data analysis tool analysis module is used to perform real-time analysis on the captured evaluation test data packets through the data analysis tool to detect potential security holes in the data transmission process between the PLC and the host computer.
[0285] Optionally, the device further comprises:
[0286] A sixth installation module, used for installing a safety analysis tool between the PLC and the host computer;
[0287] The security test report generation module is used to collect the analysis results of the data analysis tool on the captured evaluation test data packets through the security analysis tool, calculate the attack success rate, and generate a security test report, wherein the security test report includes potential security vulnerabilities and attack success rate.
[0288] Optionally, the device further comprises:
[0289] A seventh installation module, used to install a multi-protocol test platform between the PLC and the host computer, wherein the multi-protocol test platform includes a protocol switching unit and a compatibility test unit;
[0290] A communication protocol selection module, used to select and switch to a target communication protocol currently required to be tested from a plurality of industrial communication protocols through the protocol switching unit, wherein the protocol switching unit is configured with an intelligent switching algorithm, and the industrial communication protocols include Modbus RTU / ASCII protocol, Modbus TCP protocol, Profinet protocol and Ethernet / IP protocol;
[0291] A communication environment simulation module, used to simulate the communication environment under the target communication protocol through the compatibility test unit, and record the transmission performance of the evaluation test data packet under the target communication protocol;
[0292] An interoperability problem recording module, used to identify and record interoperability problems that occur when switching between various industrial communication protocols through the compatibility testing unit;
[0293] A compatibility test report generation module is used to generate a compatibility test report through the compatibility test unit, wherein the compatibility test report includes the transmission performance of the evaluation test data packet under the target communication protocol, and interoperability problems that occur when switching between various industrial communication protocols.
[0294] The device also includes:
[0295] An eighth installation module, used to install an intelligent fault injection system between the PLC and the host computer, wherein the intelligent fault injection system includes a fault simulation unit and a fault analysis unit;
[0296] A target fault selection module is used to select the type of target fault that needs to be simulated currently, and the types of target faults include communication link disconnection, data packet loss and device power failure;
[0297] A target fault injection module, used to inject a selected target fault between the PLC and the host computer according to a preset time and intensity through the fault simulation unit;
[0298] A fault data recording module, used to monitor the operating status of the PLC and the host computer in real time through the fault analysis unit, and record the time when the target fault occurs and recovers;
[0299] The fault report generating module is used to analyze the fault cause of the target fault through the fault analysis unit and generate a fault report, wherein the fault report includes the time when the target fault occurs and is restored, and the fault cause of the target fault.
[0300] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods and devices. Therefore, the embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0301] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods and devices according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0302] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.
[0303] Finally, it should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "include..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements. The above is a detailed introduction to a test method and device for evaluating the communication mode between a PLC and a host computer provided by the present disclosure. The present disclosure is explained in detail using specific examples in this article. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure; at the same time, for those of ordinary skill in the art, according to the idea of the present disclosure, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A test method for evaluating the communication mode between a PLC and a host computer, characterized in that: The method comprises: Select the target communication mode that needs to be tested from RS-232 serial communication mode, RS-485 serial communication mode, Ethernet communication mode and wireless communication mode; According to the type of the target communication mode, respectively configure the PLC and the host computer accordingly; Performing communication testing and debugging between the PLC and the host computer; Transmitting an evaluation test data packet between the host computer and the PLC, and performing an evaluation test on the target communication mode, wherein the evaluation test includes: a real-time test, a reliability test, a security test, a multi-protocol compatibility test, and a fault detection and recovery test; The next communication mode to be tested is selected as a new target communication mode, and the steps are performed: according to the type of the target communication mode, the PLC and the host computer are configured accordingly.
2. The method according to claim 1, characterized in that According to the type of the target communication mode, the PLC and the host computer are configured accordingly, including: When the target communication mode is an RS-232 serial communication mode or an RS-485 serial communication mode, the corresponding serial port interface of the PLC is connected to the serial port interface of the host computer through a serial port cable of the corresponding serial port type; Configuring first communication parameters on the PLC, the first communication parameters including: baud rate, data bit, stop bit and check mode; A serial port driver required for communicating with the PLC is installed on the host computer, and second communication parameters matching the first communication parameters are configured on the host computer.
3. The method according to claim 1, characterized in that: According to the type of the target communication mode, the PLC and the host computer are configured accordingly, including: When the target communication mode is an Ethernet communication mode, the Ethernet interface of the PLC and the Ethernet interface of the host computer are connected through a network cable, and the PLC and the host computer are in the same network segment; Configuring first communication parameters on the PLC, the first communication parameters including: IP address, subnet mask and gateway; A second communication parameter is configured on the host computer, wherein the second communication parameter is configured so that the PLC and the host computer are in the same subnet.
4. The method according to claim 1, characterized in that According to the type of the target communication mode, the PLC and the host computer are configured accordingly, including: In the case where the target communication mode is a wireless communication mode, checking whether the PLC and the host computer are both equipped with a wireless communication module, wherein the wireless communication module includes a wifi module; In the case where both the PLC and the host computer are equipped with wireless communication modules, configuring first communication parameters on the PLC, wherein the first communication parameters include a wireless network name and a password of the wireless network; A second communication parameter is configured on the host computer, wherein the second communication parameter is configured to enable the host computer to connect to the same wireless network as the PLC.
5. The method according to claim 1, characterized in that: The communication test and debugging between the PLC and the host computer includes: Writing a test program on the host computer, wherein the test program is used to send a test data packet to the PLC; Writing a data receiving program on the PLC, wherein the data receiving program is used to receive and store test data packets from the host computer; In the case that the PLC fails to receive the test data packet, fault detection and repair are performed through the debugging tools of the PLC and the host computer so that the PLC successfully receives and stores the test data packet. The debugging tools include PLC programming software and serial port debugging tools.
6. The method according to claim 1, characterized in that Follow the steps below to perform a real-time test: A high-precision data capture module is installed between the PLC and the host computer, wherein the high-precision data capture module includes a high-precision clock synchronization unit and a data capture unit; The high-precision clock synchronization unit provides a synchronous clock through a high-precision clock source, and the synchronous clock is used to perform clock synchronization between the PLC and the host computer, and the high-precision clock source includes GPS, Beidou and atomic clock; The high-resolution timer records the timestamp of each test packet sent and received at microsecond accuracy. Through the data capture unit, the data transmission time of each evaluation test data packet is determined according to the timestamps of sending and receiving each evaluation test data packet, and compared with the synchronization clock, the delay and jitter of the data transmission between the PLC and the host computer are calculated.
7. The method according to claim 6, characterized in that The method further comprises: Installing a real-time analysis tool between the PLC and the host computer; The real-time analysis tool is used to collect the delay and jitter of data transmission between the PLC and the host computer, and generate a real-time test report, which includes the record and statistical analysis results of the delay and jitter of data transmission between the PLC and the host computer.
8. The method according to claim 1, characterized in that Follow the steps below to perform a reliability test: An automatic interference simulator and a data monitoring module are installed between the PLC and the host computer, wherein the automatic interference simulator is used to generate a variety of interference source signals, wherein the interference source signals include electromagnetic interference, radio frequency interference and power supply noise; Adjusting the interference degree and frequency of the automatic interference simulator to generate a target interference source signal; Injecting the target interference source signal into the communication line between the PLC and the host computer through a coupler or an antenna; The data monitoring module monitors and records in real time the loss rate and bit error rate of the evaluation test data packet transmitted under the target interference source signal.
9. The method according to claim 8, characterized in that The method further comprises: Installing a reliability analysis tool between the PLC and the host computer; The reliability analysis tool collects the loss rate and bit error rate of the evaluation test data packet transmitted under different interference source signals, and generates an anti-interference capability evaluation report, which includes the record and statistical analysis results of the loss rate and bit error rate of the evaluation test data packet.
10. The method according to claim 1, characterized in that Follow the steps below to perform a safety test: Installing a simulated attack platform and an automated tool between the PLC and the host computer, wherein the simulated attack platform includes a penetration testing tool and a data analysis tool; Selecting a target attack method through the penetration testing tool, wherein the target attack method includes a man-in-the-middle attack, a data packet tampering, and a replay attack; Encrypting the evaluation test data packet, and executing the target attack means between the PLC and the host computer through the automation tool; Recording the evaluation test data packets captured during the attack process using the penetration testing tool; The data analysis tool is used to perform real-time analysis on captured evaluation test data packets to detect potential security loopholes in the data transmission process between the PLC and the host computer.
11. The method according to claim 10, characterized in that The method further comprises: Installing a safety analysis tool between the PLC and the host computer; The security analysis tool collects the analysis results of the data analysis tool on the captured evaluation test data packets, calculates the attack success rate, and generates a security test report, which includes potential security vulnerabilities and attack success rates.
12. The method according to claim 1, characterized in that Follow the steps below to perform multi-protocol compatibility testing: A multi-protocol test platform is installed between the PLC and the host computer, wherein the multi-protocol test platform includes a protocol switching unit and a compatibility test unit; The protocol switching unit selects and switches to a target communication protocol that needs to be tested currently from a plurality of industrial communication protocols, wherein the protocol switching unit is configured with an intelligent switching algorithm, and the industrial communication protocols include Modbus RTU / ASCII protocol, Modbus TCP protocol, Profinet protocol and Ethernet / IP protocol; Simulating the communication environment under the target communication protocol by the compatibility testing unit, and recording the transmission performance of the evaluation test data packet under the target communication protocol; Identifying and recording interoperability problems that occur when switching between various industrial communication protocols through the compatibility testing unit; A compatibility test report is generated by the compatibility test unit, wherein the compatibility test report includes the transmission performance of the evaluation test data packet under the target communication protocol and interoperability problems that occur when switching between various industrial communication protocols.
13. The method according to claim 1, characterized in that Follow the steps below to perform a fault detection and recovery test: An intelligent fault injection system is installed between the PLC and the host computer, wherein the intelligent fault injection system includes a fault simulation unit and a fault analysis unit; Select the type of target fault that needs to be simulated currently, where the target fault type includes communication link disconnection, data packet loss, and device power failure; By means of the fault simulation unit, a selected target fault is injected between the PLC and the host computer according to a preset time and intensity; The fault analysis unit monitors the operating status of the PLC and the host computer in real time, and records the time when the target fault occurs and is restored; The fault analysis unit analyzes the cause of the target fault and generates a fault report, wherein the fault report includes the time when the target fault occurs and is recovered, and the cause of the target fault.
14. A test device for evaluating the communication mode between a PLC and a host computer, characterized in that: The device comprises: A selection module is used to select the target communication mode currently to be tested from RS-232 serial communication mode, RS-485 serial communication mode, Ethernet communication mode and wireless communication mode; A configuration module, used to configure the PLC and the host computer respectively according to the type of the target communication mode; A communication test and debugging module, used for performing communication test and debugging between the PLC and the host computer; An evaluation test module, used for transmitting an evaluation test data packet between the host computer and the PLC, and performing an evaluation test on the target communication mode, wherein the evaluation test includes: a real-time test, a reliability test, a security test, a multi-protocol compatibility test, and a fault detection and recovery test; The repeated execution module is used to select the next communication mode to be tested as a new target communication mode, and execute the steps: according to the type of the target communication mode, respectively configure the PLC and the host computer accordingly.
Citation Information
Patent Citations
PLC (programmable logic controller) communication module testing method, device and system and computer equipment
CN110032134A
Multi-PLC (Programmable Logic Controller) protocol analysis method and system for data acquisition of cloud-side collaborative equipment, and medium
CN113867249A
Network environment test method and system of PLC system
CN116165961A
Industrial control safety prevention and control terminal
CN117420784A
Computer-implemented method and data processing system for testing device security
US20190258805A1
Cited By
S7 protocol communication test method and device, equipment and storage medium
CN120871734A
