A PLC testing system and method
Patent Information
- Application Number
- CN202280006560.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-04-02
AI Technical Summary
[0006]鉴于此,本申请的目的在于提供一种PLC测试系统及方法,以改善现有测试方案对外部设备的运动控制不闭环,进而导致测试可靠性不高的问题
Smart Images

Figure CN117178236B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of testing technology, specifically relating to a PLC testing system and method. The application also relates to the field of vehicles, specifically to a torque compensation method for vehicles, a torque compensation device for vehicles, and an associated computer-readable storage medium. Background Technology
[0002] In testing PLCs (Programmable Logic Controllers) in a real external environment, unit testers, system integration tests, or system comprehensive tests are often used. Because the signals and stimuli required for the testing process all originate from real external devices, this results in a complex testing environment, low testing efficiency, poor test coverage, and a lack of fault injection methods.
[0003] To address this, the existing technology provides a testing method, as follows: S1, based on the test task of the PLC under test, select the PLC control instruction corresponding to the test task from the pre-set PLC test script library; S2, construct test cases based on the PLC control instruction and the built-in instructions of TCL (Tool Command Language), and send the test cases to the lower-level machine system;
[0004] S3. The lower-level system generates an excitation signal according to the test case and sends the excitation signal to the PLC under test; S4. The PLC under test is tested based on the excitation signal.
[0005] The existing technology uses TCL scripts to build PLC peripheral device equivalents to replace the PLC's real peripheral environment. While this simplifies the complexity of the real environment and the cumbersome testing steps, it also simplifies the motion mechanism of the external device. The main function of the external device's motion mechanism is to execute the PLC's control commands and feed back signals related to the control commands to the PLC through sensors. Because the motion mechanism of the external device is simplified, the PLC's motion control of the external device is not closed-loop, which leads to low test reliability. Summary of the Invention
[0006] Therefore, the purpose of this application is to provide a PLC testing system and method to improve the problem that existing testing schemes do not have closed-loop motion control for external devices, which leads to low testing reliability.
[0007] The embodiments of this application are implemented as follows:
[0008] In a first aspect, embodiments of this application provide a PLC testing system, including: a virtual device simulating a real field device, a testing tool, and a PLC device. The testing tool is used to inject a fault into the virtual device by initiating preset test cases; the PLC device is used to execute preset fault handling logic when it receives a fault signal generated by the virtual device based on the injected fault simulating a field fault, the preset fault handling logic including sending alarm information to the virtual device; the testing tool is also used to test whether the fault handling logic of the PLC device is normal by detecting whether the alarm information forwarded by the virtual device matches the expectation of the fault injected by the preset test cases.
[0009] In this embodiment, a virtual device is used to simulate the real equipment on site, so that the corresponding fault signal can be generated by simulating the on-site fault and sent to the PLC device, so that the PLC device executes the corresponding fault handling logic, thereby achieving the effect of closed-loop verification of the PLC's fault handling logic, thereby improving the reliability of the test.
[0010] In one possible implementation of the first aspect embodiment, the testing tool is further configured to send a manual switching signal simulating on-site human intervention to the virtual device after detecting whether the alarm information forwarded by the virtual device meets the expectation of the fault injection of the preset test case; correspondingly, the PLC device is further configured to control the virtual device to switch to manual mode when it receives the manual switching signal forwarded by the virtual device.
[0011] In this embodiment, by simulating on-site manual intervention, the virtual device is switched to manual mode, thereby preventing the virtual device from continuing to run automatically and causing errors. At the same time, by switching the virtual device to manual mode, it is convenient to perform manual intervention on it.
[0012] In one possible implementation of the first aspect embodiment, the testing tool is further configured to send a short reset signal simulating on-site manual intervention to the virtual device after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case; correspondingly, the PLC device is further configured to reset and clear the preset fault handling logic when receiving the short reset signal forwarded by the virtual device, and control the virtual device to clear the alarm information.
[0013] In this embodiment, a short reset signal is sent by simulating on-site manual intervention to reset and clear the preset fault handling logic of the PLC device and the alarm information on the virtual device, so as to facilitate subsequent automated continuous testing and improve testing efficiency.
[0014] In one possible implementation of the first aspect embodiment, the testing tool is further configured to send a start signal simulating on-site manual intervention to the virtual device when it detects that the virtual device has cleared the alarm information; correspondingly, the PLC device is further configured to control the virtual device to operate normally according to a preset automated production process when it receives the start signal forwarded by the virtual device.
[0015] In this embodiment, when the alarm information of the virtual device is cleared is detected, a start signal is sent simulating on-site manual intervention, so that the PLC device controls the virtual device to operate normally according to the preset automated production process, which provides a guarantee for realizing automated continuous testing and ensures the reliability of subsequent continuous testing.
[0016] In one possible implementation of the first aspect embodiment, the testing tool is further configured to, upon detecting that the virtual device has resumed normal operation, initiate new preset test cases to inject new faults into the virtual device, so as to continue testing whether the remaining fault handling logic of the PLC device is normal.
[0017] In this embodiment, when the virtual device is detected to have resumed normal operation, a new preset test case is initiated to inject new faults into the virtual device in order to continue testing whether the remaining fault handling logic of the PLC device is normal, thereby achieving automated continuous testing efficiently.
[0018] In one possible implementation of the first aspect embodiment, the testing tool is further configured to send a switching automatic signal simulating on-site manual intervention to the virtual device after sending the switching manual signal to the virtual device; correspondingly, the PLC device is further configured to control the virtual device to switch from manual mode to automatic mode when receiving the switching automatic signal forwarded by the virtual device.
[0019] In this embodiment, after sending a manual switch signal to the virtual device, a simulated on-site manual intervention switch signal is sent to the virtual device to switch the virtual device from manual mode to automatic mode, so that the virtual device can be controlled to operate normally according to the generation process.
[0020] In one possible implementation of the first aspect embodiment, the PLC testing system further includes a display module; the display module is used to display the operating status of the virtual device, and / or to display alarm information sent by the PLC device when executing preset fault handling logic.
[0021] In this embodiment, the operating status of the virtual device is displayed through a display module, making the operation of the virtual device visible throughout the entire testing process; and / or, alarm information sent by the PLC device when executing preset fault handling logic is displayed. On the one hand, this makes it easier for staff to understand the test results more intuitively and conveniently. On the other hand, through the displayed alarm information, staff can subjectively judge whether the fault handling logic of the PLC device is normal.
[0022] In one possible implementation of the first aspect embodiment, the virtual device and the testing tool are deployed on an industrial control computer, and both the industrial control computer and the PLC device include the display module.
[0023] In this embodiment, the virtual device and the testing tool are deployed on the same industrial control computer, which facilitates signal interaction between the testing tool and the virtual device. At the same time, the use of a PLC device and an industrial control computer with a display module allows for the simultaneous display of the virtual device's operating status and the alarm information sent by the PLC device when executing preset fault handling logic.
[0024] In one possible implementation of the first aspect embodiment, the virtual device and the testing tool are deployed on an industrial control computer, and both the PLC device and the industrial control computer are connected to the display module.
[0025] In this embodiment, the virtual device and the testing tool are deployed on the same industrial control computer, which facilitates signal interaction between the testing tool and the virtual device. At the same time, by connecting both the PLC device and the industrial control computer to the display module, even if the PLC device and the industrial control computer do not contain a display screen, the operating status of the virtual device and the alarm information sent by the PLC device when executing the preset fault handling logic can still be displayed.
[0026] In one possible implementation of the first aspect embodiment, the virtual device and the testing tool are deployed on an industrial control computer.
[0027] In this embodiment, the virtual device and the testing tool are deployed on the same industrial control computer, which facilitates signal interaction between the testing tool and the virtual device.
[0028] In one possible implementation of the first aspect embodiment, the virtual device and the testing tool are deployed on an industrial control computer, which includes the PLC device.
[0029] In this embodiment, deploying the virtual device and the testing tool on the same industrial control computer facilitates signal interaction between the testing tool and the virtual device. Furthermore, by deploying the virtual device and the testing tool on the industrial control computer and setting the PLC device as part of the industrial control computer, the fault handling logic of the PLC can be tested through a single industrial control computer, greatly simplifying the hardware resources required to complete the test.
[0030] In one possible implementation of the first aspect embodiment, the preset test cases are generated based on historical fault data and can be continuously updated.
[0031] In this embodiment of the application, faults that actually occurred on the device in the past are converted into test cases and continuously updated to improve the test fault coverage.
[0032] Secondly, this application also provides a PLC testing method, comprising: a testing tool initiating a preset test case to inject a fault into a virtual device simulating a real field device; when the PLC device receives a fault signal generated by the virtual device simulating a field fault based on the injected fault, the PLC device executes a preset fault handling logic, the preset fault handling logic including sending an alarm message to the virtual device; the testing tool tests whether the fault handling logic of the PLC device is normal by detecting whether the alarm message forwarded by the virtual device conforms to the expectation of the fault injected by the preset test case.
[0033] In one possible implementation of the second aspect embodiment, after detecting whether the alarm information forwarded by the virtual device meets the expectation of the fault injection in the preset test case, the method further includes: the test tool sending a manual switching signal simulating on-site human intervention to the virtual device; and the PLC device controlling the virtual device to switch to manual mode when receiving the manual switching signal forwarded by the virtual device.
[0034] In a possible implementation of the second aspect embodiment, after detecting whether the alarm information forwarded by the virtual device meets the expectation of the preset test case injection fault, the method further includes: the test tool sending a short reset signal simulating on-site manual intervention to the virtual device; when the PLC device receives the short reset signal forwarded by the virtual device, it resets and clears the preset fault handling logic, and controls the virtual device to clear the alarm information.
[0035] In a possible implementation of the second aspect embodiment, the method further includes: when the testing tool detects that the virtual device has cleared the alarm information, it sends a start signal to the virtual device to simulate on-site manual intervention; when the PLC device receives the start signal forwarded by the virtual device, it controls the virtual device to operate normally according to a preset automated production process.
[0036] In a possible implementation of the second aspect embodiment, the method further includes: when the testing tool detects that the virtual device has resumed normal operation, it initiates a new preset test case to inject a new fault into the virtual device in order to continue testing whether the remaining fault handling logic of the PLC device is normal.
[0037] In one possible implementation of the second aspect embodiment, after sending the manual switching signal to the virtual device, the method further includes: the testing tool sending an automatic switching signal simulating on-site manual intervention to the virtual device; and the PLC device controlling the virtual device to switch from manual mode to automatic mode when receiving the automatic switching signal forwarded by the virtual device.
[0038] The technical effects that can be achieved by the second aspect and its various embodiments are the same as those in the first aspect, and will not be repeated here.
[0039] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing embodiments of this application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The above and other objects, features, and advantages of this application will become clearer through the drawings. The same reference numerals indicate the same parts in all the drawings. The drawings are not intentionally drawn to scale to actual size; the focus is on illustrating the main points of this application.
[0041] Figure 1 A schematic diagram of a PLC testing system provided in an embodiment of this application is shown.
[0042] Figure 2 A schematic diagram illustrating the testing principle of a PLC testing system provided in an embodiment of this application is shown.
[0043] Figure 3 This paper illustrates a schematic diagram of the hardware structure involved in a PLC testing system provided in an embodiment of this application.
[0044] Figure 4 A flowchart illustrating a PLC testing method provided in an embodiment of this application is shown. Detailed Implementation
[0045] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0046] It should be noted that similar reference numerals and letters in the following figures denote similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, relational terms such as "first," "second," etc., in the description of this application are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0047] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0048] In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, the term "multiple" refers to two or more (including two).
[0049] Given the current testing methods, the use of TCL scripts to build equivalent PLC (Programmable Logic Controller) peripheral devices to replace the actual PLC peripheral environment simplifies the complexity of the real environment and the cumbersome testing steps. However, it also simplifies the motion mechanism of the external device, resulting in the PLC's non-closed-loop motion control of the external device, which in turn leads to low test reliability.
[0050] After careful consideration, the applicant believes that if the PLC's motion control of external equipment is closed-loop, then the reliability of the test can be improved. Therefore, to solve the above-mentioned technical problems, this application provides a brand-new PLC testing system and method. By using virtual equipment (process simulation (PS) software running on an industrial control computer) to simulate real equipment in the field, the system can generate corresponding fault signals and send them to the PLC device when simulating field faults, so that the PLC device can execute the corresponding fault handling logic, thereby achieving the effect of closed-loop testing of the PLC device's fault handling logic, thus solving the problem of low reliability in existing testing methods.
[0051] The technical solution provided in this application can be applied to any PLC-controlled automated control system or intelligent device, and has universality. For better understanding, the following will combine... Figure 1 The PLC testing system shown is described below. This PLC testing system includes: a virtual device (PS) simulating real-world equipment, testing tools (such as the Ignition tool), and the PLC device.
[0052] The virtual device in this application is a 3D digital model simulating a real field device. It has the same functions as the real field device, including motion mechanisms and logic blocks. It can perform relevant actions according to the control signals of the PLC and feed back the execution results to the PLC device. When a fault is received, it can simulate a fault, generate a corresponding fault signal, and send it to the PLC device.
[0053] For example, in the post-assembly stage of lithium batteries, the main production equipment involved includes: ultrasonic welding equipment for tabs and adapters, laser welding equipment for adapters and top covers, Mylar packaging equipment, laser welding equipment for top covers and outer shells, and helium leak testing equipment. These devices cooperate under the control of a PLC to ultimately complete the assembly of the lithium batteries. Simulation software with the same functions as these real devices can be built using 3D modeling technology to simulate their operation. It should be understood that the real equipment used in different application scenarios varies, and therefore the corresponding virtual equipment and the logic executed also differ.
[0054] Among them, the ultrasonic welding equipment for tabs and adapters is used to weld the tabs and adapters together. The laser welding equipment for adapters and top covers is used to weld the adapters and top covers together. The Mylar coating equipment is used for coating. The laser welding equipment for top covers and outer shells is used to weld the top cover and outer shell together. The helium leak detection equipment is used to test the airtightness of the lithium battery after it is installed.
[0055] Due to their excellent programmability, PLC devices are widely used in various automated control systems. They are digital computing and operating electronic systems specifically designed for industrial environments. PLC devices control various types of machinery or production processes according to preset automated production flows. The functionality and performance of PLC devices are crucial to the correctness and stability of automatic control; therefore, it is necessary to test the functionality and performance of PLC devices, such as testing their fault handling logic.
[0056] When testing PLC devices, testing tools can be used to initiate preset test cases to inject faults into the virtual device. The virtual device then simulates a real-world fault based on the injected fault, generating a fault signal and sending it to the PLC device. Upon receiving the fault signal from the virtual device, the PLC device executes preset fault handling logic, which includes sending an alarm message to the virtual device. The fault handling logic of the PLC device is tested by using testing tools to check whether the alarm message forwarded by the virtual device matches the expected fault injected by the preset test cases. If the alarm message forwarded by the virtual device matches the expected fault injected by the preset test cases, the fault handling logic of the corresponding PLC device is considered normal.
[0057] As a testing tool for PLC devices, Ignition is primarily used to inject faults into a virtual device by initiating preset test cases. The virtual device then simulates a real-world fault based on the injected fault, generates a fault signal, and sends this signal to the PLC device. The testing tool is also used to test the PLC device's fault handling logic by checking whether the alarm information forwarded by the virtual device matches the expected faults injected in the preset test cases.
[0058] When a testing tool injects a fault into a virtual device by initiating a preset test case, in one implementation, the testing tool determines whether the fault injection test initiation conditions are met. If the conditions are met, the preset test case is initiated to inject the fault into the virtual device. Before testing, the PLC device is first started. The PLC device controls the virtual device to operate normally according to a preset automated production process. At this time, the three-color indicator light in the virtual device is green, indicating that the virtual device is in normal operating condition. The testing tool monitors the three-color indicator light of the virtual device and determines that the fault injection test initiation conditions are met. It then initiates the preset test case, such as preset test case 1, to inject fault 1 into the virtual device.
[0059] Test cases are used to inject faults into virtual devices. Since the automated control system controlled by the PLC performs various actions during automated production, various faults may occur, thus requiring various test cases. Preset test cases correspond one-to-one with the injected faults; different preset test cases inject different faults, thus simulating different real-world faults. For example, test case 1 corresponds to fault 1, test case 2 corresponds to fault 2, test case 3 corresponds to fault 3, and so on.
[0060] In this embodiment, the preset test cases are generated based on historical fault data, meaning they are generated based on faults that have actually occurred on the equipment controlled by the PLC. To improve fault coverage, these preset test cases can be continuously updated to cover all faults that have actually occurred on the equipment in the past. Since field equipment experiences not only the faults considered in the design phase during operation and maintenance, but also faults beyond the design considerations, and these faults accumulate continuously throughout the equipment's lifecycle, these accumulated faults are transformed into test cases to continuously improve fault coverage.
[0061] The aforementioned preset test cases can be imported as files, such as Excel files, into the industrial control computer. The test tools running on the industrial control computer can inject faults into the virtual device according to the user's configuration to test whether the PLC's fault handling logic is normal.
[0062] Since the automated control system controlled by the PLC equipment performs various actions during the automatic production process, various faults may occur. Different faults may correspond to different fault handling logics of the PLC equipment. Therefore, it is necessary to test the different fault handling logics of the PLC equipment one by one.
[0063] To accelerate testing efficiency, the testing tool may optionally also be used to: after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, if the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, send a short reset signal simulating on-site manual intervention to the virtual device. This short reset signal is used to reset and clear the preset fault handling logic of the PLC device. Correspondingly, the PLC device is also used to reset and clear the preset fault handling logic and control the virtual device to clear the alarm information when it receives the short reset signal forwarded by the virtual device.
[0064] Of course, it is understandable that even if the alarm information forwarded by the virtual device does not meet the expected fault injection of the preset test case, a short reset signal simulating on-site manual intervention can be sent to the virtual device. Therefore, the situation in the above example where "the test tool sends a short reset signal simulating on-site manual intervention to the virtual device when it detects that the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case" should not be interpreted as a limitation of this application.
[0065] The testing tool is also used to send a start signal simulating on-site manual intervention to the virtual device when an alarm message is detected being cleared. Correspondingly, the PLC device is also used to control the normal operation of the virtual device according to a preset automated production process upon receiving the start signal forwarded by the virtual device.
[0066] The testing tool is also used to inject new faults into the virtual device by starting new preset test cases when the virtual device is detected to have resumed normal operation, so as to continue testing whether the remaining fault handling logic of the PLC is normal. For example, the testing tool starts preset test case 2 to inject fault 2 into the virtual device. When the PLC device receives fault signal 2 generated by the virtual device based on the injected fault 2 simulating the field fault, it executes preset fault handling logic 2. The preset fault handling logic 2 includes sending alarm information 2 to the virtual device. The testing tool is also used to test whether the fault handling logic 2 of the PLC device is normal by detecting whether the alarm information 2 forwarded by the virtual device meets the expectation of the preset test case injected fault 2.
[0067] In one optional implementation, after the testing tool detects whether the alarm information forwarded by the virtual device meets the expected fault injection scenario of the preset test case, if the alarm information forwarded by the virtual device meets the expected fault injection scenario of the preset test case, it will also send a manual switching signal to the virtual device to simulate on-site manual intervention. Correspondingly, the PLC device is also used to control the virtual device to switch to manual mode when it receives the manual switching signal forwarded by the virtual device. It is understood that the testing tool can send a manual switching signal to the virtual device to simulate on-site manual intervention even if it detects that the alarm information forwarded by the virtual device does not meet the expected fault injection scenario of the preset test case.
[0068] The testing tool is also used to send a switch-to-automatic signal to the virtual device after sending a switch-to-manual signal to the virtual device; correspondingly, the PLC device is also used to control the virtual device to switch from manual mode to automatic mode when it receives the switch-to-automatic signal forwarded by the virtual device.
[0069] In automated control systems, intelligent devices typically operate in manual and automatic modes. In manual mode, the virtual device stops operating automatically and requires manual activation of buttons on the device to perform any operation. In automatic mode, the device automatically performs operations under the control of the PLC. Switching the virtual device to manual mode prevents errors caused by continued automatic operation. Furthermore, in automatic mode, manual intervention may be impossible. To perform manual intervention, such as a short reset, the device must be switched to manual mode first, followed by a short reset to clear all alarm information.
[0070] Therefore, to achieve automated continuous testing, in one optional implementation, when the testing tool detects that the alarm information forwarded by the virtual device matches the expected fault injection of a preset test case, it sends a manual switching signal simulating on-site human intervention to the virtual device. Upon receiving this manual switching signal, the PLC controls the virtual device to switch to manual mode. Then, the testing tool sends a short reset signal simulating on-site human intervention to the virtual device. Upon receiving this short reset signal, the PLC resets and clears the preset fault handling logic and controls the virtual device to clear the alarm information. Next, when the testing tool detects that the virtual device has cleared the alarm information, it sends an automatic switching signal simulating on-site human intervention to the virtual device. Upon receiving this automatic switching signal, the PLC controls the virtual device to switch from manual mode to automatic mode. Finally, the testing tool sends a start signal simulating on-site human intervention to the virtual device. Upon receiving this start signal, the virtual device operates normally according to a preset automated production process. Subsequently, when the testing tool detects that the virtual device has resumed normal operation, it initiates new preset test cases to inject new faults into the virtual device in order to continue testing whether the remaining fault handling logic of the PLC device is normal.
[0071] To better understand the testing principle of the PLC testing system shown in the embodiments of this application, the following will be combined with... Figure 2 The schematic diagram shown is used to illustrate the principle.
[0072] Initially, the PLC operates its automatic logic, controlling the virtual device to run normally according to the preset automated production process. At this time, the three-color indicator light in the virtual device is green, indicating that the virtual device is in normal operating condition. The testing tool determines whether the fault injection test start conditions are met by monitoring the color of the three-color indicator light in the virtual device. If the three-color indicator light in the virtual device is green, it is determined that the fault injection test start conditions are met.
[0073] The testing tool determines that the fault injection test start conditions are met and initiates a preset test, such as preset test case 1, to inject fault 1 into the virtual device. The virtual device simulates a field fault based on the injected fault, generates a fault signal, and sends the generated fault signal to the PLC device. After receiving the fault signal from the virtual device, the PLC device executes preset fault handling logic 1, which includes sending alarm information 1 to the virtual device and controlling the virtual device's tri-color indicator to turn red. The virtual device sends alarm information 1 to the testing tool. The testing tool monitors alarm information 1 and checks whether the alarm information 1 forwarded by the virtual device meets the expectations of fault 1 injected in preset test case 1, thereby testing whether the PLC device's fault handling logic 1 is normal.
[0074] To achieve automated continuous testing, after the testing tool checks whether the alarm information 1 forwarded by the virtual device meets the expected scenario of injecting fault 1 in the preset test case 1, it executes a delayed alarm clearing logic. This includes sending a manual switch signal and a short reset signal to the virtual device, simulating on-site manual intervention. The virtual device sends these two signals to the PLC. Upon receiving the manual switch signal, the PLC controls the virtual device to switch to manual mode. Upon receiving the short reset signal, the PLC controls the reset to clear the preset fault handling logic 1 and clears alarm information 1. At this time, the three-color indicator light on the virtual device turns yellow.
[0075] When the testing tool detects that the virtual device has cleared alarm message 1, it sends a switch-to-automatic signal and a start signal to the virtual device, simulating manual intervention. The virtual device then sends these signals to the PLC. Upon receiving the switch-to-automatic signal, the PLC controls the virtual device to switch to automatic mode. Upon receiving the start signal, the PLC runs the automatic logic to control the virtual device's normal operation according to the preset automated production process. At this point, the virtual device's three-color indicator lights return to green. The testing tool monitors the virtual device's three-color indicator lights and determines that preset test case 1 has passed. It then prepares to start the next preset test case, such as preset test case 2, by injecting a new fault 2 into the virtual device to continue testing whether the remaining fault handling logic of the PLC is functioning correctly.
[0076] In one implementation, the virtual device and the testing tool described above can be deployed on the same industrial control computer to facilitate signal interaction between the testing tool and the virtual device.
[0077] In one implementation, the PLC testing system may consist only of an industrial computer. In this case, the industrial computer is equipped with the aforementioned virtual devices and testing tools. The industrial computer includes the aforementioned PLC device. In this implementation, the PLC device is part of the industrial computer.
[0078] In one implementation, the PLC testing system may consist only of an industrial computer and a PLC device. In this case, the PLC device is electrically connected to the industrial computer and is an independent device. The industrial computer is equipped with the aforementioned virtual devices and testing tools. In this scenario, neither the industrial computer nor the PLC device may include a display module.
[0079] To make the entire testing process intuitive and visible, the PLC testing system also includes a display module. The display module shows the operating status of the virtual device, making its operation visible throughout the entire testing process; and / or, displays alarm information sent by the PLC device when executing preset fault handling logic. Based on the displayed alarm information, users can subjectively judge whether the PLC device's fault handling logic is normal.
[0080] In one optional implementation, both the industrial computer and the PLC device include a display module. In this case, the PLC testing system includes an industrial computer and a PLC device, with the PLC device electrically connected to the industrial computer. The display module on the industrial computer displays the operating status of the virtual device and the testing interface of the testing tool. The display module on the PLC device can display alarm information sent by the PLC when executing preset fault handling logic.
[0081] In one optional implementation, the PLC testing system may include an industrial computer, a PLC device, and a display module. The industrial computer, the PLC device, and the display module are electrically connected, and the three are independent devices. In this implementation, the number of display modules can be two, such as the industrial computer being electrically connected to one display module and the PLC device being electrically connected to the other display module. The hardware connection schematic of this PLC testing system is as follows: Figure 3 As shown.
[0082] When a PLC device includes a display module or a PLC testing system includes a display module electrically connected to the PLC device, the preset fault handling logic also includes controlling the display module to display alarm information sent by the PLC device when executing the preset fault handling logic.
[0083] Based on the same inventive concept, this application also provides a PLC testing method, the principle of which and the resulting technical effects are the same as those of the aforementioned PLC testing system. The following will combine... Figure 4 The PLC testing method provided in the embodiments of this application will be described.
[0084] S1: The testing tool starts preset test cases to inject faults into virtual devices that simulate real equipment in the field.
[0085] In one alternative implementation, when the testing tool determines that the fault injection test start conditions are met, such as when the testing tool monitors the three-color light of the virtual device to be green, it can start a preset test case, such as preset test case 1, to inject fault 1 into the virtual device.
[0086] S2: When the PLC device receives a fault signal generated by the virtual device based on the injected fault simulation field fault, it executes the preset fault handling logic, which includes sending alarm information to the virtual device.
[0087] S3: The testing tool detects whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test cases, and tests whether the fault handling logic of the PLC device is normal.
[0088] Optionally, after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, the method further includes: the test tool sending a switch to manual mode signal to the virtual device to simulate on-site manual intervention; when the PLC device receives the switch to manual mode signal forwarded by the virtual device, it controls the virtual device to switch to manual mode.
[0089] After sending a manual switching signal to the virtual device, the method further includes: the test tool sending a switching automatic signal to the virtual device simulating on-site manual intervention; when the PLC device receives the switching automatic signal forwarded by the virtual device, it controls the virtual device to switch from manual mode to automatic mode.
[0090] Optionally, after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, the method further includes: the test tool sending a short reset signal to the virtual device to simulate on-site manual intervention; when the PLC device receives the short reset signal forwarded by the virtual device, it resets and clears the preset fault handling logic and controls the virtual device to clear the alarm information.
[0091] The method also includes: when the testing tool detects that the virtual device has cleared the alarm information, it sends a start signal to the virtual device to simulate on-site manual intervention; when the PLC device receives the start signal forwarded by the virtual device, it controls the virtual device to operate normally according to the preset automated production process.
[0092] The method also includes: when the testing tool detects that the virtual device has resumed normal operation, it starts new preset test cases to inject new faults into the virtual device in order to continue testing whether the remaining fault handling logic of the PLC device is normal.
[0093] For example, in one alternative implementation, after detecting whether the alarm information forwarded by the virtual device meets the expectation of a preset test case injection fault, the method further includes:
[0094] The testing tool sends a manual switching signal to the virtual device, simulating on-site manual intervention. Upon receiving the manual switching signal from the virtual device, the PLC controls the virtual device to switch to manual mode. Then, the testing tool sends a short reset signal, simulating on-site manual intervention. Upon receiving this short reset signal, the PLC resets and clears the preset fault handling logic and controls the virtual device to clear alarm information. Afterward, upon detecting that the virtual device has cleared alarm information, the testing tool sends an automatic switching signal, simulating on-site manual intervention. Upon receiving this automatic switching signal, the PLC controls the virtual device to switch from manual to automatic mode. Next, the testing tool sends a start signal, simulating on-site manual intervention. Upon receiving this start signal, the PLC controls the virtual device to operate normally according to the preset automated production process. Finally, upon detecting that the virtual device has resumed normal operation, the testing tool initiates new preset test cases to inject new faults into the virtual device to continue testing whether the remaining fault handling logic of the PLC is normal.
[0095] The PLC testing method provided in this application embodiment has the same implementation principle and technical effect as the aforementioned PLC testing system embodiment. For the sake of brevity, any parts not mentioned in the method embodiment can be referred to the corresponding content in the aforementioned PLC testing system embodiment.
[0096] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed methods can also be implemented in other ways. The embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0098] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A PLC testing system, characterized in that, include: Virtual devices that simulate real-world equipment. Testing tools are used to initiate preset test cases to inject faults into the virtual device; A PLC device is used to execute preset fault handling logic when it receives a fault signal generated by the virtual device based on the injected fault simulation field fault. The preset fault handling logic includes sending alarm information to the virtual device. The testing tool is also used to test whether the fault handling logic of the PLC device is normal by detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case; The testing tool is also used to send a manual switching signal to the virtual device, simulating on-site human intervention, after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case; accordingly, The PLC device is also used to control the virtual device to switch to manual mode when it receives a manual switch signal forwarded by the virtual device; The testing tool is also used to send a short reset signal simulating on-site manual intervention to the virtual device after detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case; accordingly, The PLC device is also used to reset and clear the preset fault handling logic when it receives a short reset signal forwarded by the virtual device, and to control the virtual device to clear the alarm information.
2. The PLC testing system according to claim 1, characterized in that, The testing tool is also used to send a start signal simulating on-site manual intervention to the virtual device when it detects that the virtual device has cleared the alarm information; accordingly, The PLC device is also used to control the virtual device to operate normally according to a preset automated production process when it receives a start signal forwarded by the virtual device.
3. The PLC testing system according to claim 2, characterized in that, The testing tool is also used to inject new faults into the virtual device by starting new preset test cases when the virtual device is detected to have resumed normal operation, so as to continue testing whether the remaining fault handling logic of the PLC device is normal.
4. The PLC testing system according to claim 1, characterized in that, The testing tool is also used to send a switching automatic signal simulating on-site manual intervention to the virtual device after sending the manual switching signal to the virtual device; correspondingly, The PLC device is also used to control the virtual device to switch from manual mode to automatic mode when it receives the automatic switching signal forwarded by the virtual device.
5. The PLC testing system according to any one of claims 1-4, characterized in that, The PLC testing system also includes a display module; The display module is used to display the operating status of the virtual device, and / or to display alarm information sent by the PLC device when executing preset fault handling logic.
6. The PLC testing system according to claim 5, characterized in that, The virtual device and the testing tool are deployed on an industrial control computer, and both the industrial control computer and the PLC device include the display module.
7. The PLC testing system according to claim 5, characterized in that, The virtual device and the testing tool are deployed on an industrial control computer, and both the PLC device and the industrial control computer are connected to the display module.
8. The PLC testing system according to any one of claims 1-4, characterized in that, The virtual device and the testing tool are deployed on an industrial control computer.
9. The PLC testing system according to claim 7, characterized in that, The virtual device and the testing tool are deployed on an industrial control computer, which includes the PLC device.
10. The PLC testing system according to any one of claims 1-4, characterized in that, The preset test cases are generated based on historical fault data and can be continuously updated.
11. A PLC testing method, characterized in that, include: The testing tool initiates preset test cases to inject faults into virtual devices that simulate real-world equipment. When the PLC device receives a fault signal generated by the virtual device based on the injected fault simulation field fault, it executes a preset fault handling logic, which includes sending an alarm message to the virtual device. The testing tool tests whether the fault handling logic of the PLC device is normal by detecting whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case. After the testing tool detects whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, it sends a switch to manual mode signal to the virtual device to simulate on-site manual intervention. When the PLC device receives the manual switch signal forwarded by the virtual device, it controls the virtual device to switch to manual mode. After the testing tool detects whether the alarm information forwarded by the virtual device meets the expected fault injection of the preset test case, it sends a short reset signal to the virtual device to simulate on-site manual intervention. When the PLC receives a short reset signal forwarded by the virtual device, it resets and clears the preset fault handling logic and controls the virtual device to clear the alarm information.
Citation Information
Patent Citations
TCL script based method and apparatus for creating PLC peripheral device equivalent device
CN105426302A
Pump truck controller hardware-in-the-loop test system
CN215769467U