Network anomaly test method based on PLC
Through the PLC-based network abnormality testing method, the stability of the data transmission line is evaluated using simulation analysis technology, and the problems of unreliability and resource waste of existing testing methods are solved, and efficient and convenient network abnormality detection is achieved.
Patent Information
- Application Number
- CN202411807273.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-02-28
AI Technical Summary
The existing network abnormality testing methods have problems such as unreliable test results, waste of resources, high learning and work costs, especially the methods of manually plugging data transmission lines, software simulation and special testing equipment have their own disadvantages.
The network abnormality testing method based on PLC is adopted, and the delay stability level, packet loss stability level and interrupt stability level of the data transmission line are collected and analyzed through delay simulation analysis, packet loss simulation analysis, interrupt simulation analysis and line simulation analysis, and a stable evaluation index is generated and early warning is made.
A comprehensive stability test of data transmission lines is realized, potential network abnormalities are effectively detected, learning costs and resource waste are reduced, and the reliability and convenience of testing are improved.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of network testing, and in particular to a PLC-based network anomaly testing method. Background Art
[0002] Network communication is everywhere, and the stability of network communication between devices has become an extremely important indicator. From the initial stage of product development to commissioning, the communication quality needs to be tested repeatedly. PLC is a programmable computing electronic device that can perform complex calculations on external electrical signals and output expected electrical signals to the outside. Therefore, a network anomaly testing method based on PLC is needed.
[0003] The commonly used testing methods for network anomalies in the prior art are manually plugging and unplugging data transmission lines, simulating network anomalies with software under the operating system, and using dedicated test equipment to create network anomalies. The above three testing methods all have their own disadvantages: first, manually plugging and unplugging data transmission lines cannot control the time point of plugging and unplugging, and sometimes it is impossible for one person to observe the test situation and plug and unplug the data transmission line at the same time. Therefore, plugging and unplugging the data transmission line will not only lead to unreliable test results, but also cause waste of human resources; secondly, software simulation cannot simulate network anomaly testing for devices without operating systems or products that have been finalized and cannot be verified by software simulation for network anomalies; finally, dedicated test equipment needs to be specially purchased and learned to use, which increases the equipment procurement cost and causes waste of resources, and requires special personnel to debug, increasing learning and work costs. Summary of the invention
[0004] In view of the above-mentioned technical deficiencies, the object of the present invention is to provide a network anomaly testing method based on PLC.
[0005] To solve the above technical problems, the present invention adopts the following technical solutions: The present invention provides a PLC-based network anomaly testing method, comprising the following steps: Step 1, delay simulation analysis: using network simulator software to set different degrees of network delays on key link nodes, collecting delay simulation data, and analyzing the delay simulation data based on the delay simulation model to obtain the delay stability level of each data transmission line.
[0006] Step 2: Packet loss simulation analysis: Use a network simulator to set different packet loss rates in the PLC network. During the packet loss simulation process, collect packet loss simulation data. Based on the packet loss simulation model, analyze the packet loss simulation data to obtain the packet loss stability level of each data transmission line.
[0007] Step 3: Interruption simulation analysis: Use the relay interruption model to simulate the network interruption, collect the interruption simulation data of the equipment during the network interruption, analyze the interruption simulation data based on the interruption simulation model, and obtain the interruption stability level of each data transmission line.
[0008] Step 4: Line simulation analysis: analyze the delay stability level, packet loss stability level, and interruption stability level of each data transmission line to obtain the stability evaluation index of each data transmission line and issue an early warning.
[0009] Preferably, the collection of interruption simulation data, the specific collection process is as follows: the interruption simulation data includes the maintenance function operation time of each data transmission line, the network recovery time and the synchronization data time, each interface of the analyzer acquisition signal is connected to each data transmission line of the bus correspondingly, and then the analyzer is connected to the PC with a USB cable, and a test program is written on the host computer according to the test plan and downloaded to the PLC, and the on-off time and on-off number of each data transmission line are controlled through the timer function block and the counter function block in the ladder diagram programming language; Each data transmission line uses two timers and an adding counter to implement the control logic. The two timers are used to control the on and off time of the corresponding data transmission line, and the adding counter is used to control the on and off times of the corresponding data transmission line. After the control program starts to execute, the first timer starts timing. When the timing value of the first timer is equal to the preset value, the relay coil of the first channel of the DO module is energized and the contacts are attracted to cause the corresponding data transmission line to be connected and remain connected. At this moment, the second timer starts timing. When the timing value of the second timer is equal to the preset value, the relay coil of the first channel of the DO module is de-energized and the contacts are disconnected to cause the corresponding data transmission line to be disconnected and remain disconnected. At this moment, the input signals of the first timer and the second timer are Disconnect, the timing value is reset, and the count value of the add-on counter is increased by 1. If the count value of the add-on counter is not equal to the preset value, the first timer and the second timer are executed cyclically, so that the corresponding data transmission line is alternately connected and disconnected at a certain frequency until the count value of the add-on counter is equal to the preset value, and the entire control program is stopped. The relay contacts of the first channel of the DO module are disconnected, and the corresponding data transmission line is disconnected and remains disconnected. The count values of the two timers and one add-on counter are reset, and the maintenance function operation time, network recovery time and synchronization data time of the preset timing value of the corresponding data transmission line disconnection are collected through the analysis software on the PC, so as to obtain the maintenance function operation time, network recovery time and synchronization data time of each data transmission line.
[0010] The beneficial effects of the present invention are: 1. The present invention first collects delay simulation data, and obtains the delay stability level of each data transmission line through the delay simulation model analysis data; secondly, the packet loss simulation data is collected, and the packet loss stability level of each data transmission line is obtained based on the packet loss simulation model analysis data; then, the interruption simulation data of the device in the network is collected, and the interruption stability level of each data transmission line is obtained based on the interruption simulation model analysis data; finally, according to the delay stability level, packet loss stability level and interruption stability level of each data transmission line, an early warning is issued. The present invention can comprehensively perform stability tests on the data transmission lines and effectively detect potential network abnormalities.
[0011] 2. PLC programming is simple, and wiring is convenient for network fault testing. There is no need to specially train engineers, which reduces learning costs and improves the testing efficiency of novices. During the test, the on-off time and number of on-off times of the communication line can be accurately controlled by writing PLC programs, and the on-off time and number of on-off times can be flexibly adjusted, which greatly improves the reliability and convenience of the test. On the other hand, there is no need to test network anomalies by plugging and unplugging data transmission lines, which saves human resources and meets the needs of network anomaly testing for equipment that cannot install communication fault simulation software, increases the test scope of the test method, increases adaptability, and does not require the purchase of special test equipment, saving procurement costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0013] Figure 1 The present invention is a schematic flow chart of the steps for implementing the method.
[0014] Figure 2 The reference numeral ① is a schematic diagram showing that the transmission line is connected in series to the output channel of the DO module.
[0015] Figure 2 The number ② is the wiring diagram of the analyzer between the transmission line and the PC.
[0016] Figure 3 This is an example of a ladder diagram program. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] according to Figure 1 As shown, the present invention provides a PLC-based network anomaly testing method, comprising the following steps: Step 1, delay simulation analysis: using network simulator software to set different degrees of network delays on key link nodes, collecting delay simulation data, and analyzing the delay simulation data based on a delay simulation model to obtain the delay stability level of each data transmission line.
[0019] In a specific embodiment, the delay simulation data is collected, and the specific collection process is as follows: the delay simulation data includes the sequence accuracy, transmission error rate and control instruction execution exception rate of each transmission interval duration of each data transmission line. In the PLC programming software, the program is written in a programming language, and the timer instruction is used to set the delay time, so as to simulate different transmission interval durations for each data transmission line.
[0020] In the delay simulation, the contents of the data packets before and after transmission are collected. If the order of words in the contents of the data packets before and after transmission is consistent within the preset collection time, it indicates that the order is correct within the preset collection time. In this way, the number of correct sequence times and the number of collection times for each transmission interval duration of each data transmission line are obtained. The number of correct sequence times for each transmission interval duration of each data transmission line is divided by the number of collection times to obtain the sequence accuracy rate for each transmission interval duration of each data transmission line.
[0021] When the sending end sends data, a check code is generated at the same time. After the receiving end receives the data, the check code is recalculated and compared with the check code of the sending end. If they are inconsistent, the transmission is determined to be a transmission error. A counter is used to record the number of transmission errors and the total number of transmissions. The number of transmission errors is divided by the total number of transmissions to obtain the transmission error rate. In this way, the transmission error rate of each transmission interval length of each data transmission line is obtained.
[0022] In PLC programming, a normal execution time range is set for each control instruction. When the instruction execution starts, the timer is started. When the instruction execution ends, the timer value is read. If the value exceeds the normal execution time range, the execution of the data transmission is judged to be abnormal. The number of instructions with abnormal execution and the total number of instructions are recorded through a counter. The number of instructions with abnormal execution is divided by the total number of instructions to obtain the execution abnormality rate of each transmission interval of each data transmission line.
[0023] In a specific embodiment, the delay simulation data is analyzed, and the specific analysis process is as follows: the sequence accuracy, transmission error rate and control instruction execution abnormality rate of each transmission interval duration of each data transmission line are input into the delay simulation model to obtain the output result of each data transmission line, and the output result is the delay stability level.
[0024] In a specific embodiment, the delay simulation model expression is: ,in, For the The output result of the data transmission line is is the number of the data transmission line, , , , and Respectively The first data transmission line The sequence accuracy rate, transmission error rate and control instruction execution abnormality rate of class transmission interval duration, is the number of the transmission interval duration type, , , is the total number of transmission interval duration types, For the preset The weight factor of the class transmission interval duration, , , , and They are the preset standard sequence accuracy rate, standard transmission error rate and standard control instruction execution abnormality rate. , and are the weight factors of the preset sequence accuracy, transmission error rate and control instruction execution abnormality rate, respectively. , , , , , , and They are the preset first delay stability evaluation index, Delay stability evaluation index, Delay Stability Evaluation Index and Delay stability evaluation index.
[0025] It should be noted that the standard sequence accuracy The sequence accuracy threshold of normal data transmission. When the sequence accuracy is lower than the standard sequence accuracy, it indicates that the sequence accuracy of the current data transmission is too low, which is abnormal data transmission. The value of the quasi-sequence accuracy is set by the staff. Weight factor for class transmission interval duration Set by the staff. When the device is running, the more delays occur for a certain transmission interval, the greater the weight factor of the transmission interval. The standard parameter , , , , and Setup process and standard parameters The setup process is the same as 0.6 0.7 1.3 1.6 is 1.65 and is 1.91, the weight factor , and The setting process and weight factor The setup process is the same as is 0.2, is 0.2 and is 0.6.
[0026] Step 2: Packet loss simulation analysis: Use a network simulator to set different packet loss rates in the PLC network. During the packet loss simulation process, collect packet loss simulation data. Based on the packet loss simulation model, analyze the packet loss simulation data to obtain the packet loss stability level of each data transmission line.
[0027] In a specific embodiment, the packet loss simulation data is collected, and the specific collection process is as follows: the packet loss simulation data includes the automatic recovery time of each packet loss rate of each data transmission line, the total time of equipment malfunction and the time of suspension of operation, the topology structure of the PLC network is created in the network simulator, and various proportions of packet loss rate scenarios are set on each data transmission line for simulation testing, and packet capture tools are deployed on key nodes or devices in the PLC network.
[0028] The data packets in the network are captured to obtain the timestamp and serial number of each data packet. If the serial numbers of a pair of adjacent data packets are discontinuous, the timestamp corresponding to the pair of adjacent data packets is recorded as the timestamp of the starting time point of the packet loss. When the serial numbers of the received data packets are restored to be continuous again and can be reasonably connected with the serial number sequence of the pair of adjacent data packets before the packet loss, the timestamp corresponding to the restored continuous data packet is recorded as the timestamp of the recovery time point of the packet loss event, thereby obtaining the timestamp of the recovery time point of each packet loss event and the timestamp of the starting time point of the packet loss. The timestamp of the recovery time point of each packet loss event is subtracted from the timestamp of the starting time point of the packet loss to obtain the automatic recovery duration of the packet loss event, thereby obtaining the automatic recovery duration of each packet loss rate of each data transmission line.
[0029] The device operation video is collected by the camera, and the device error operation duration and device stop duration are obtained through machine vision technology, so as to obtain the device error action occurrence duration and stop operation duration of each packet loss rate of each data transmission line.
[0030] In a specific embodiment, the packet loss simulation data is analyzed, and the specific analysis process is as follows: the automatic recovery time of each packet loss rate of each data transmission line, the duration of device error action and the duration of shutdown are input into the packet loss simulation model, and the output result of each data transmission line is obtained, and the value of the output result is is the packet loss stability level, , , This is the maximum packet loss stability level.
[0031] In a specific embodiment, the packet loss simulation model expression is: , among which, is The output result of the data transmission line is , and Respectively The first data transmission line Automatic recovery time of similar packet loss rate, total duration of device malfunction and downtime, is the type number of the packet loss rate, , , is the total number of types of packet loss rate, , and They are the preset standard automatic recovery time, the total duration of standard equipment malfunction and the standard shutdown time. For the preset The weight factor of the class packet loss rate, , , , and They are the weight factors of the preset automatic recovery time, the total duration of equipment malfunction, and the duration of downtime. , , , , , , and They are the preset first packet loss stability evaluation index, Packet loss stability evaluation index, Packet loss stability evaluation index and Packet loss stability evaluation index.
[0032] It should be noted that the standard parameters , , , , , and Setup process and standard parameters The setup process is the same as 1.3 1.25, 1.36, 1.14, 1.23, is 1.24 and is 1.96, the weight factor , , and The setting process and weight factor The setup process is the same as 0.16 is 0.3, is 0.3 and is 0.4.
[0033] Step 3: Interruption simulation analysis: Use the relay interruption model to simulate the network interruption, collect the interruption simulation data of the equipment during the network interruption, analyze the interruption simulation data based on the interruption simulation model, and obtain the interruption stability level of each data transmission line.
[0034] In a specific embodiment, the interruption simulation data is collected, and the specific collection process is as follows: the interruption simulation data includes the maintenance function operation time, network recovery time and synchronization data time of each data transmission line, and each interface of the analyzer acquisition signal is connected to the corresponding data transmission line of the bus, and then the analyzer is connected to the PC with a USB cable. According to the test plan, a test program is written in the host computer and downloaded to the PLC, and the on-off time and on-off number of each data transmission line are controlled through the timer function block and counter function block in the ladder diagram programming language.
[0035] Each data transmission line uses two timers and an adding counter to implement the control logic. The two timers are used to control the on and off time of the corresponding data transmission line, and the adding counter is used to control the on and off times of the corresponding data transmission line. After the control program starts to execute, the first timer starts timing. When the timing value of the first timer is equal to the preset value, the relay coil of the first channel of the DO module is energized and the contacts are attracted to cause the corresponding data transmission line to be connected and remain connected. At this moment, the second timer starts timing. When the timing value of the second timer is equal to the preset value, the relay coil of the first channel of the DO module is de-energized and the contacts are disconnected to cause the corresponding data transmission line to be disconnected and remain disconnected. At this moment, the input signals of the first timer and the second timer are Disconnect, the timing value is reset, and the count value of the add-on counter is increased by 1. If the count value of the add-on counter is not equal to the preset value, the first timer and the second timer are executed cyclically, so that the corresponding data transmission line is alternately connected and disconnected at a certain frequency until the count value of the add-on counter is equal to the preset value, and the entire control program is stopped. The relay contacts of the first channel of the DO module are disconnected, and the corresponding data transmission line is disconnected and remains disconnected. The count values of the two timers and one add-on counter are reset, and the maintenance function operation time, network recovery time and synchronization data time of the preset timing value of the corresponding data transmission line disconnection are collected through the analysis software on the PC, so as to obtain the maintenance function operation time, network recovery time and synchronization data time of each data transmission line.
[0036] In another specific embodiment, the collection of interruption simulation data, the specific collection process is as follows: First, the CAN bus uses differential signals to transmit data, and the transmission line consists of two data lines CAN_H and CAN_L. Before the formal test, the CAN_H and CAN_L lines are connected in series to the first and second channels of the PLC relay type DO module respectively, so as to control the on and off of the two lines separately. The wiring diagram is shown in Figure 2 Label ①.
[0037] Secondly, connect the two interfaces CAN_H and CAN_L of the CAN analyzer to the two lines CAN_H and CAN_L of the CAN bus, and then connect the CAN analyzer to the PC with a USB cable. Use the CAN message analysis software in the PC to collect the data sent to the bus when multiple CAN nodes communicate. The wiring diagram is shown in Figure 2 Label ②.
[0038] Next, write a test program on the host computer according to the test plan and download it to the PLC. You can use the timer function block and counter function block in the ladder diagram programming language to realize the control of the on-off time and the number of on-off times of the PLC relay-type DO module channel, so as to accurately control the on-off time and the number of times the CAN_H and CAN_L lines are on and off. Each line can use two timers and an adding counter to realize the control logic. Timer T1 is used to control the on-time of CAN_H, timer T2 is used to control the off-time of CAN_H, and the adding counter C1 is used to control the on-off times of CAN_H. After the control program starts to execute, timer T1 starts timing. When the timing value of timer T1 is equal to the preset value, the relay coil of the first channel of the DO module is energized and the contacts are closed to connect the CAN_H line and keep it on. At this moment, timer T2 starts timing. When the timing value of timer T2 is equal to the preset value, the relay coil of the first channel of the DO module loses power and the contacts are disconnected. The CAN_H line is disconnected and remains disconnected. At this moment, the input signals of timer T1 and timer T2 are disconnected, the timing value is reset, and the adder C1 is incremented by 1. If the count value of adder C1 is not equal to the preset value, timer T1 and timer T2 are executed cyclically, so that the line CAN_H is alternately connected and disconnected at a certain frequency until the count value of adder C1 is equal to the preset value. The entire control program is stopped, the relay contacts of the first channel of the DO module are disconnected, the line CAN_H is disconnected and remains disconnected, and the count values of the two timers and an adder are reset to complete the test of the line CAN_H. CAN_L is tested according to the test method of the line CAN_H. Before the test starts, start the CAN message analysis software on the PC, collect the CAN messages on the CAN bus during the test, and obtain the maintenance function operation time, network recovery time and synchronization data time of CAN_H and CAN_L from the CAN messages. For an example of the ladder diagram program, see Figure 3 .
[0039] In a specific embodiment, the interruption simulation data is analyzed, and the specific analysis process is as follows: the maintenance function operation time, network recovery time and synchronization data time of each data transmission line are input into the interruption simulation model, and the output result of each data transmission line is obtained, and the value of the output result is The interrupt stability level, , , This is the maximum interrupt stability level.
[0040] In a specific embodiment, the interruption simulation model expression is: ,in For the The output result of the data transmission line is , and Respectively The data transmission line maintenance function operation time, network recovery time and data synchronization time, , and They are the preset standard function maintenance operation time, standard network recovery time and standard data synchronization time. , and They are respectively the weight factors of the preset maintenance function operation time, the weight factors of the standard network recovery time and the weight factors of the standard synchronization data time. , , , , , , and They are respectively the preset first interruption stability assessment index, the first interruption stability assessment index, the first interruption stability assessment index and the first interruption stability assessment index.
[0041] It should be noted that the standard parameters , , , , , and Setup process and standard parameters The setup process is the same as 1.6 1.3 1.7 1.25, 2.35, is 2.41 and is 3.17, the weight factor , and The setting process and weight factor The setup process is the same as 0.25, is 0.35 and is 0.4.
[0042] Step 4: Line simulation analysis: analyze the delay stability level, packet loss stability level, and interruption stability level of each data transmission line to obtain the stability evaluation index of each data transmission line and issue an early warning.
[0043] In a specific embodiment, the delay stability level, packet loss stability level and interruption stability level of each data transmission line are analyzed, and the specific analysis process is as follows: a delay stability assessment index corresponding to the delay stability level, a packet loss stability assessment index corresponding to the packet loss stability level and an interruption stability assessment index corresponding to the interruption stability level of each data transmission line are obtained from a database, and the delay stability assessment index, the packet loss stability assessment index and the interruption stability assessment index of each data transmission line are weightedly calculated to obtain a stability assessment index of each data transmission line. If the delay stability level of a data transmission line is less than a preset delay stability level, or the packet loss stability level of the data transmission line is less than a preset packet loss stability level, or the interruption stability level of the data transmission line is less than a preset interruption stability level, or the stability assessment index of the data transmission line is less than a preset stability assessment index, it indicates that the data transmission line is faulty and is recorded as a faulty transmission line. When a faulty transmission line occurs, an early warning prompt is given.
[0044] The above contents are merely examples and explanations of the concept of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in a similar manner. As long as they do not deviate from the concept of the invention or exceed the scope defined in this specification, they shall all fall within the protection scope of the present invention.
Claims
1. A PLC-based network anomaly testing method, characterized in that: The steps include: Step 1: Delay simulation analysis: Use network simulator software to set different degrees of network delay on key link nodes, collect delay simulation data, analyze the delay simulation data based on the delay simulation model, and obtain the delay stability level of each data transmission line; Step 2: Packet loss simulation analysis: Use a network simulator to set different packet loss rates in the PLC network. During the packet loss simulation process, collect packet loss simulation data. Based on the packet loss simulation model, analyze the packet loss simulation data to obtain the packet loss stability level of each data transmission line. Step 3: Interruption simulation analysis: Use the relay interruption model to simulate the network interruption, collect the interruption simulation data of the equipment during the network interruption, analyze the interruption simulation data based on the interruption simulation model, and obtain the interruption stability level of each data transmission line; Step 4: Line simulation analysis: analyze the delay stability level, packet loss stability level, and interruption stability level of each data transmission line to obtain the stability evaluation index of each data transmission line and issue an early warning.
2. A PLC-based network anomaly testing method according to claim 1, characterized in that: The specific acquisition process of the delayed simulation data is as follows: The delay simulation data includes the sequence correctness rate, transmission error rate and control instruction execution abnormality rate of each transmission interval length of each data transmission line. In the PLC programming software, the program is written in the programming language and the timer instruction is used to set the delay time, so as to simulate different transmission interval lengths for each data transmission line; In the delay simulation, the contents of the data packets before and after transmission are collected. If the word order in the contents of the data packets before and after transmission is consistent within the preset collection time, it indicates that the order is correct within the preset collection time. Thus, the number of correct order times and the number of collection times for each transmission interval duration of each data transmission line are obtained. The number of correct order times for each transmission interval duration of each data transmission line is divided by the number of collection times to obtain the correct order rate for each transmission interval duration of each data transmission line. When the sending end sends data, a check code is generated at the same time. After the receiving end receives the data, the check code is recalculated and compared with the check code of the sending end. If they are inconsistent, the transmission is determined to be a transmission error. The number of transmission errors and the total number of transmissions are recorded using a counter. The number of transmission errors is divided by the total number of transmissions to obtain the transmission error rate. In this way, the transmission error rate of each transmission interval length of each data transmission line is obtained. In PLC programming, a normal execution time range is set for each control instruction. When the instruction execution starts, the timer is started. When the instruction execution ends, the timer value is read. If the value exceeds the normal execution time range, the execution of the data transmission is judged to be abnormal. The number of instructions with abnormal execution and the total number of instructions are recorded through a counter. The number of instructions with abnormal execution is divided by the total number of instructions to obtain the execution abnormality rate of each transmission interval of each data transmission line.
3. A PLC-based network anomaly testing method according to claim 2, characterized in that: The delay simulation data is analyzed, and the specific analysis process is as follows: The sequence accuracy, transmission error rate and control instruction execution abnormality rate of each transmission interval of each data transmission line are input into the delay simulation model to obtain the output result of each data transmission line, which is the delay stability level.
4. A PLC-based network anomaly testing method according to claim 3, characterized in that: The delay simulation model expression is: ,in, For the The output result of the data transmission line is is the number of the data transmission line, , , , and Respectively The first data transmission line The sequence accuracy rate, transmission error rate and control instruction execution abnormality rate of class transmission interval duration, is the number of the transmission interval duration type, , , is the total number of transmission interval duration types, For the preset The weight factor of the class transmission interval duration, , , , and They are the preset standard sequence accuracy rate, standard transmission error rate and standard control instruction execution abnormality rate. , and are the weight factors of the preset sequence accuracy, transmission error rate and control instruction execution abnormality rate, respectively. , , , , , , and They are the preset first delay stability evaluation index, Delay stability evaluation index, Delay Stability Evaluation Index and Delay stability evaluation index.
5. A PLC-based network anomaly testing method according to claim 1, characterized in that: The specific collection process of the packet loss simulation data is as follows: The packet loss simulation data includes the automatic recovery time of each packet loss rate of each data transmission line, the total duration of equipment malfunction and the duration of shutdown. The topology of the PLC network is created in the network simulator, and various proportions of packet loss rate scenarios are set on each data transmission line for simulation testing. Packet capture tools are deployed on key nodes or devices in the PLC network. The data packets in the network are captured to obtain the timestamp and serial number of each data packet. If the serial numbers of a pair of adjacent data packets are discontinuous, the timestamp corresponding to the pair of adjacent data packets is recorded as the timestamp of the starting time point of the packet loss. When the serial numbers of the received data packets are restored to be continuous again and can be reasonably connected with the serial number sequence of the pair of adjacent data packets before the packet loss, the timestamp corresponding to the restored continuous data packet is recorded as the timestamp of the recovery time point of the packet loss event, thereby obtaining the timestamp of the recovery time point of each packet loss event and the timestamp of the starting time point of the packet loss. The timestamp of the starting time point of the packet loss is subtracted from the timestamp of the recovery time point of each packet loss event to obtain the automatic recovery time length of the packet loss event, thereby obtaining the automatic recovery time length of each packet loss rate of each data transmission line; The device operation video is collected by the camera, and the device error operation duration and device stop duration are obtained through machine vision technology, so as to obtain the device error action occurrence duration and stop operation duration of each packet loss rate of each data transmission line.
6. A PLC-based network anomaly testing method according to claim 5, characterized in that: The packet loss simulation data is analyzed, and the specific analysis process is as follows: The automatic recovery time of each packet loss rate of each data transmission line, the duration of device error action and the duration of shutdown are input into the packet loss simulation model to obtain the output results of each data transmission line and the value of the output results. is the packet loss stability level, , , This is the maximum packet loss stability level.
7. A PLC-based network anomaly testing method according to claim 6, characterized in that: The packet loss simulation model expression is: , among which, is The output result of the data transmission line is is the number of the data transmission line, , , , and Respectively The first data transmission line Automatic recovery time of similar packet loss rate, total duration of device malfunction and downtime, is the type number of the packet loss rate, , , is the total number of types of packet loss rate, , and They are the preset standard automatic recovery time, the total duration of standard equipment malfunction and the standard shutdown time. For the preset The weight factor of the class packet loss rate, , , , and They are the weight factors of the preset automatic recovery time, the total duration of equipment malfunction, and the duration of shutdown. , , , , , , and They are the preset first packet loss stability evaluation index, Packet loss stability evaluation index, Packet loss stability evaluation index and Packet loss stability evaluation index.
8. A PLC-based network anomaly testing method according to claim 1, characterized in that: The collection interruption simulation data, the specific collection process is as follows: The interruption simulation data includes the maintenance function operation time, network recovery time and synchronization data time of each data transmission line. Connect each interface of the analyzer to each data transmission line of the bus, and then connect the analyzer to the PC with a USB cable. According to the test plan, write the test program on the host computer and download it to the PLC. Through the timer function block and counter function block in the ladder diagram programming language, control the on-off time and on-off number of each data transmission line. Each data transmission line uses two timers and an adding counter to implement the control logic. The two timers are used to control the on and off time of the corresponding data transmission line, and the adding counter is used to control the on and off times of the corresponding data transmission line. After the control program starts to execute, the first timer starts timing. When the timing value of the first timer is equal to the preset value, the relay coil of the first channel of the DO module is energized and the contacts are attracted to cause the corresponding data transmission line to be connected and remain connected. At this moment, the second timer starts timing. When the timing value of the second timer is equal to the preset value, the relay coil of the first channel of the DO module is de-energized and the contacts are disconnected to cause the corresponding data transmission line to be disconnected and remain disconnected. At this moment, the input signals of the first timer and the second timer are Disconnect, the timing value is reset, and the count value of the add-on counter is increased by 1. If the count value of the add-on counter is not equal to the preset value, the first timer and the second timer are executed cyclically, so that the corresponding data transmission line is alternately connected and disconnected at a certain frequency until the count value of the add-on counter is equal to the preset value, and the entire control program is stopped. The relay contacts of the first channel of the DO module are disconnected, and the corresponding data transmission line is disconnected and remains disconnected. The count values of the two timers and one add-on counter are reset, and the maintenance function operation time, network recovery time and synchronization data time of the preset timing value of the corresponding data transmission line disconnection are collected through the analysis software on the PC, so as to obtain the maintenance function operation time, network recovery time and synchronization data time of each data transmission line.
9. A PLC-based network anomaly testing method according to claim 8, characterized in that: The interrupt simulation data is analyzed, and the specific analysis process is as follows: Input the maintenance function operation time, network recovery time and synchronization data time of each data transmission line into the interruption simulation model to obtain the output results of each data transmission line and the value of the output result This is the interrupt stability level. , , This is the maximum interrupt stability level.
10. A PLC-based network anomaly testing method according to claim 9, characterized in that: The interruption simulation model expression is: ,in For the The output result of the data transmission line is is the number of the data transmission line, , , , and Respectively The data transmission line maintenance function operation time, network recovery time and data synchronization time, , and They are the preset standard function maintenance operation time, standard network recovery time and standard data synchronization time. , and They are respectively the weight factors of the preset maintenance function operation time, the weight factors of the standard network recovery time and the weight factors of the standard synchronization data time. , , , , , , and They are respectively the preset first interruption stability assessment index, the first interruption stability assessment index, the first interruption stability assessment index and the first interruption stability assessment index.