Automatic test system and method based on HMI drive
Through the automatic testing system of HMI and PLC, the read and write testing logic is used to solve the problems of low efficiency and susceptibility to human factors in existing HMI driver testing, and efficient driving detection is achieved.
Patent Information
- Application Number
- CN202411056584.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing HMI-driven testing methods require manual observation, which leads to low detection efficiency and is susceptible to human interference, and the testing process is cumbersome and time-consuming.
The automatic testing system is adopted to set the read test and write test logic through the communication connection between HMI and PLC, and use read and write operation logic to replace manual detection, reducing the influence of human factors and improving detection efficiency.
It realizes HMI-driven automated testing, improves detection efficiency, reduces the influence of human factors, and simplifies the testing process.
Smart Images

Figure CN119126657A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial control technology, and in particular to a system and method for HMI drive testing. Background Art
[0002] Programmable Logic Controller (PLC) is an electronic system commonly used in industrial control systems for digital logic operation and storage. It uses a programmable storage unit, and the programmer can perform logic operations, sequence control, timing, technology and mathematical operations on its memory unit. The programmable digital logic operation memory unit is mapped to various mechanical devices connected to the controller to achieve the purpose of indirectly controlling the operation of the equipment, so that various mechanical devices can participate in the production process according to the set logic.
[0003] Programmable controller PLC has the characteristics of high reliability, strong anti-interference ability, good flexibility and strong expansion performance, fast control speed and strong stability, convenient delay adjustment and high precision, fast system design and installation, and convenient maintenance. In complex industrial production environments, due to the above characteristics of PLC, PLC is the most commonly used industrial control system calculation and monitoring unit.
[0004] In actual applications, the data in the storage unit of the PLC needs to be connected to the PLC programming software and the monitoring mode of the PLC programming software can be turned on to observe the data stored in the storage unit. However, due to the complexity of the industrial production environment and the fact that the PLC is often embedded in the equipment as a core unit, it is usually impossible to access the programming software on the PC after it is put into production. In the use of industrial equipment, HMI touch screens are generally used instead of PC configuration software to realize the functions of monitoring and controlling PLC. HMI acts as a host computer to control the data stored in the PLC memory unit, thereby realizing the entire control system.
[0005] As two independent devices, HMI and PLC cannot communicate with each other. PLC sends data with information to HMI. After HMI receives it, it cannot understand the data that PLC wants to transmit without corresponding translation tools. The driver plays the role of a translator here, translating the information that PLC and HMI want to transmit into information that both parties can understand normally. HMI can often connect to different PLC devices. Each PLC device that can communicate normally with it has a corresponding driver on the HMI side. Therefore, the translation function of the driver is mainly based on the PLC side protocol, and the protocol is the language for communication between HMI and PLC. The function of the driver is: translate the actions performed on the HMI side according to the PLC specified protocol and send them to PLC; parse the data received from the PLC side into data one by one according to the protocol and put them in the corresponding place on the HMI side.
[0006] From the above, we can know that the driver is related to whether the HMI can communicate normally with the PLC. After a driver is developed, in order to verify the correctness of the developed driver, it is often necessary to conduct detailed tests on each type of PLC storage unit involved in the driver; and after the driver is modified, in order to ensure that the modified content does not affect the overall use of the driver, even if the change is not large, the entire driver needs to be tested.
[0007] The primary purpose of the driver test is to test whether the HMI can read the data from the PLC storage unit and whether the changed HMI data can be written to the corresponding storage unit of the PLC. The existing test method requires connecting the PLC to the corresponding PLC programming software, comparing the HMI display data and the data of this address monitored in the PLC programming software to see if they are consistent, and monitoring whether the address changes to the HMI write data in the PLC programming software after changing the HMI data. When fully testing the driver, all registers contained in the driver and the data types in the registers need to be tested, resulting in a lot of time spent on establishing the configuration test project and the test process.
[0008] Therefore, the existing testing method is time-consuming and laborious due to the complexity of the test points and the repeated tests, and the testing method by the tester's visual inspection is often interfered by the tester's human factors. This testing method needs to be improved. Summary of the invention
[0009] The technical problem to be solved by the present invention is to provide an HMI-driven automatic testing system and method, which uses read-write operation logic to replace the detection means of manual observation, reduces the influence of human factors, and improves the detection efficiency.
[0010] In order to solve the above technical problems, the technical solution adopted by the present invention is: an automatic test system based on HMI drive, which includes: HMI and PLC, and the HMI and PLC are connected in communication;
[0011] The HMI end is provided with an HMI end driver test configuration project, which sets the original value for the register of the HMI driver to be tested on the HMI end, and sets the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E;
[0012] The PLC has a PLC test project to set the original value for the data in the A address of the PLC;
[0013] The HMI-side driver test configuration project and the PLC test project are used in conjunction with each other to perform read test and write test;
[0014] The read test includes: the HMI end driving test configuration project reads the data in the A address of the PLC to the HMI end, and then writes the read data in the A address to the B address of the PLC; the PLC test project compares the data in the A address and the data in the B address to form a read test comparison result, and stores the read test comparison result in the C address of the PLC; the HMI end driving test configuration project reads the data in the C address to determine whether there is a read error, wherein the equal read test comparison results represent a correct read, and the unequal read test comparison results represent a read error;
[0015] The write test includes: the HMI-side drive test configuration project writes the original value of the register to the D address of the PLC; the PLC test project copies the data in the D address to the E address; the HMI-side drive test configuration project reads the data in the E address of the PLC, and then compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error, wherein equal write test comparison results represent correct writing, and unequal write test comparison results represent a write error.
[0016] As a further technical solution, the register includes multiple data types, and original values are set for the registers according to each data type, and original values are set for the data in address A of the PLC; the HMI-side drive test configuration project and the PLC test project perform the read test and write test on the multiple data types of the register.
[0017] As a further technical solution, the original value of the register and the original value of the data in the A address of the PLC are the maximum value, minimum value, 0 and / or 1 corresponding to the various data types; the HMI-end drive test configuration project and the PLC test project perform the read test and write test on the maximum value, minimum value, 0 and / or 1 corresponding to each data type of the register.
[0018] As a further technical solution, the data type includes one or more of the following: bit, 8-bit unsigned binary, 8-bit signed binary, 8-bit 2-bit BCD, 16-bit unsigned binary, 16-bit signed binary, 16-bit 4-bit BCD, 32-bit unsigned binary, 32-bit signed binary, 32-bit 8-bit BCD, 32-bit floating point, 64-bit unsigned binary, 64-bit signed binary, 64-bit 16-bit BCD, 64-bit floating point, ASCII string;
[0019] The registers of the HMI drive to be tested include one or more of the following: I input relay, Q output relay, M internal relay and V data register.
[0020] As a further technical solution, the communication connection is a serial port communication connection or an Ethernet port communication connection.
[0021] In order to solve the above technical problems, another technical solution adopted by the present invention is: an automatic testing method based on HMI drive, which comprises the following steps:
[0022] Obtain register information contained in the HMI driver to be tested on the HMI end, set the original value for the register, and set the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E;
[0023] Set the original value for the data in address A of the PLC;
[0024] Read test steps: read the data in address A of the PLC to the HMI end, then write the read data in address A to address B of the PLC through the HMI end, then the PLC compares the data in address A and the data in address B to form a read test comparison result, and stores the read test comparison result in address C of the PLC, and then the HMI end reads the data in address C to determine whether there is a read error, wherein, equal read test comparison results represent correct reading, and unequal read test comparison results represent a read error;
[0025] Write test steps: The HMI end writes the original value of the register to the D address of the PLC, and the PLC then copies the data in the D address to the E address. The HMI end reads the data in the E address of the PLC, and then the HMI end compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error. Among them, equal write test comparison results indicate correct writing, and unequal write test comparison results indicate a write error.
[0026] As a further technical solution, the register includes multiple data types, and original values are set for the registers according to each data type, and original values are set for the data in address A of the PLC; the read test steps and write test steps are performed on the multiple data types of the registers respectively.
[0027] As a further technical solution, the original value of the register, the original value of the data in the A address of the PLC is the maximum value, minimum value, 0 and / or 1 corresponding to the various data types; the read test step and the write test step are performed on the maximum value, minimum value, 0 and / or 1 corresponding to each data type of the register.
[0028] As a further technical solution, the data types include one or more of the following: bit, 8-bit unsigned binary, 8-bit signed binary, 8-bit 2-bit BCD, 16-bit unsigned binary, 16-bit signed binary, 16-bit 4-bit BCD, 32-bit unsigned binary, 32-bit signed binary, 32-bit 8-bit BCD, 32-bit floating point, 64-bit unsigned binary, 64-bit signed binary, 64-bit 16-bit BCD, 64-bit floating point, ASCII string.
[0029] As a further technical solution, the register of the HMI drive to be tested includes one or more of the following: I input relay, Q output relay, M internal relay and V data register.
[0030] The present invention has the following beneficial technical effects: the present invention provides an HMI-driven automatic testing system and method, which uses read-write operation logic to replace manual observation detection means, reduces the impact of human factors, and improves detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic structural diagram of an embodiment of the present invention.
[0032] Figure 2 It is a logic principle diagram of a read-write test according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. The preferred embodiments are only for illustrating the use of the present invention, and are not intended to limit the protection scope of the present invention.
[0034] The present invention is a new automatic test solution for the read and write functions of HMI drivers. The purpose of the automatic test is to test whether the driver used for communication between HMI and PLC is normal, including read test and write test. The purpose of the read test is to test whether the data displayed by the HMI is consistent with the data stored in the corresponding address of the PLC. The purpose of the write test is to test whether the address data corresponding to the PLC end is consistent with the written data when the HMI end writes data.
[0035] like Figure 1 As shown, an embodiment of the present invention is an automatic test system based on HMI drive, which includes: HMI and PLC, HMI and PLC are connected in communication. The communication connection is generally a serial communication connection or a network port communication connection.
[0036] The HMI end is provided with an HMI end driver test configuration project, which sets the original value for the register of the HMI driver to be tested on the HMI end, and sets the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E;
[0037] The PLC has a PLC test project to set the original value for the data in the A address of the PLC;
[0038] The HMI driver test configuration project and the PLC test project are used together to perform read and write tests;
[0039] The read test includes: the HMI-side driver test configuration project reads the data in the A address of the PLC to the HMI side, and then writes the read data in the A address to the B address of the PLC; the PLC test project compares the data in the A address and the data in the B address to form a read test comparison result, and stores the read test comparison result in the C address of the PLC; the HMI-side driver test configuration project reads the data in the C address to determine whether there is a read error, wherein the equal read test comparison results represent a correct read, and the unequal read test comparison results represent a read error;
[0040] The write test includes: the HMI-side driver test configuration project writes the original value of the register to the D address of the PLC; the PLC test project copies the data in the D address to the E address; the HMI-side driver test configuration project reads the data in the E address of the PLC, and then compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error, where equal write test comparison results represent correct writing, and unequal write test comparison results represent a write error.
[0041] Set the read test comparison result to 1 if it is equal and 0 if it is not equal. Read the read test comparison result to the HMI end and associate it with the display control. If it is equal, it will be displayed in green, and if it is not equal, it will be displayed in red. The tester can see the test result at a glance.
[0042] Set the write test comparison result to 1 if it is equal and 0 if it is not equal. The HMI end associates the write test comparison result with the display control. If it is equal, it will be displayed in green, and if it is not equal, it will be displayed in red. The tester can see the test result clearly at a glance.
[0043] On the HMI side, one interface corresponds to one test of one register. A single test interface will test the data type contained in the current register and the maximum value, minimum value, 0 and 1 corresponding to the data type. A complete drive read and write function test will poll all register test interfaces from the main interface. When the main interface is returned after one round of polling, if an error occurs at the test point, the test results of all points will be exported. If there is no error at the test point, the test results will be exported regularly. The test results are stored in a table format.
[0044] See also Figure 2 The data storage unit is stored in units of addresses on the PLC side and in the form of variables on the HMI side. The variables are named according to the read-write test flag_register number_read-write comparison state operation_data type_test value. R_1_R_BUB_MAX is translated as the maximum value of the eight-bit unsigned data type corresponding to the No. 1 register read test operation, and W_1_R_BUB_MAX is translated as the maximum value of the eight-bit unsigned data type corresponding to the No. 1 register write test operation. Figure 2 The present invention separates the reading and writing of the HMI driver test, performs an initialization operation before the test, assigns values to the PLC internal storage unit, and then performs the read and write test by window polling.
[0045] An embodiment of an automatic test method based on HMI drive of the present invention comprises the following steps:
[0046] Obtain register information contained in the HMI driver to be tested on the HMI end, set the original value for the register, and set the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E;
[0047] Set the original value for the data in address A of the PLC;
[0048] Read test steps: read the data in address A of the PLC to the HMI end, then write the read data in address A to address B of the PLC through the HMI end, then the PLC compares the data in address A and the data in address B to form a read test comparison result, and stores the read test comparison result in address C of the PLC, and then the HMI end reads the data in address C to determine whether there is a read error, wherein, equal read test comparison results represent correct reading, and unequal read test comparison results represent a read error;
[0049] Write test steps: The HMI end writes the original value of the register to the D address of the PLC, and the PLC then copies the data in the D address to the E address. The HMI end reads the data in the E address of the PLC, and then the HMI end compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error. Among them, equal write test comparison results indicate correct writing, and unequal write test comparison results indicate a write error.
[0050] In the above two embodiments, the HMI driver includes four types of registers, namely, I input relay, Q output relay, M internal relay and V data register, and the data types include BT (bit), BUB (8-bit unsigned binary), BB (8-bit signed binary), BD (8-bit BCD code), WUB (16-bit unsigned binary), WB (16-bit signed binary), WD (16-bit BDC code), DUB (32-bit unsigned binary), DB (32-bit signed binary), DD (32-bit BCD code), DF (32-bit floating point number), LDF (64-bit floating point number) and STR (ASCII string).
[0051] The configuration information of the above HMI driver is shown in Table 1, which includes eight columns: channel name [register], data type, read / write type, PLC address representation system, addressing mode, data block number, register name in PLC, and data type mapping in PLC.
[0052] Table 1
[0053]
[0054] Different HMI drivers include different registers. In a specific embodiment, an HMI driver may include one or more of the following registers: I input relay, Q output relay, M internal relay, and V data register.
[0055] The data types of the registers include: BT bit, BUB 8-bit unsigned binary, BB 8-bit signed binary, BD 8-bit 2-bit BCD, WUB 16-bit unsigned binary, WB 16-bit signed binary, WD 16-bit 4-bit BCD, DUB 32-bit unsigned binary, DB 32-bit signed binary, DD 32-bit 8-bit BCD, DF 32-bit floating point, LUB 64-bit unsigned binary, LB 64-bit signed binary, LDD 64-bit 16-bit BCD, LDF 64-bit floating point, STR ASCII string. Different driver registers correspond to different data types. In a specific embodiment, when configuring register information, select from the data types listed above. Among them, BCD is a BCD code (Binary-Coded Decimal), which uses 4-bit binary numbers to represent the 10 digits 0 to 9 in a 1-bit decimal number.
[0056] The above embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Any equivalent substitution or change made by a person skilled in the art based on the present invention is within the protection scope of the present invention.
Claims
1. An automatic test system based on HMI drive, characterized in that: It includes: HMI and PLC, HMI and PLC communication connection; The HMI end is provided with an HMI end driver test configuration project, which sets the original value for the register of the HMI driver to be tested on the HMI end, and sets the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E; The PLC has a PLC test project to set the original value for the data in the A address of the PLC; The HMI-side driver test configuration project and the PLC test project are used in conjunction with each other to perform read test and write test; The read test includes: the HMI end driving test configuration project reads the data in the A address of the PLC to the HMI end, and then writes the read data in the A address to the B address of the PLC; the PLC test project compares the data in the A address and the data in the B address to form a read test comparison result, and stores the read test comparison result in the C address of the PLC; the HMI end driving test configuration project reads the data in the C address to determine whether there is a read error, wherein the equal read test comparison results represent a correct read, and the unequal read test comparison results represent a read error; The write test includes: the HMI-side drive test configuration project writes the original value of the register to the D address of the PLC; the PLC test project copies the data in the D address to the E address; the HMI-side drive test configuration project reads the data in the E address of the PLC, and then compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error, wherein equal write test comparison results represent correct writing, and unequal write test comparison results represent a write error.
2. The HMI-driven automatic test system according to claim 1, characterized in that: The register includes multiple data types, and original values are set for the registers according to the data types, and the original values are set for the data in the A address of the PLC; The HMI-side driver test configuration project and the PLC test project respectively perform the read test and write test on multiple data types of the register.
3. The HMI-driven automatic test system according to claim 2, characterized in that: The original value of the register, the original value of the data in the A address of the PLC is the maximum value, the minimum value, 0 and / or 1 corresponding to each data type; The HMI-side driver test configuration project and the PLC test project respectively perform the read test and write test on the maximum value, minimum value, 0 and / or 1 corresponding to each data type of the register.
4. The HMI-driven automatic test system according to claim 1, characterized in that: The data types include one or more of: bit, 8-bit unsigned binary, 8-bit signed binary, 8-bit 2-bit BCD, 16-bit unsigned binary, 16-bit signed binary, 16-bit 4-bit BCD, 32-bit unsigned binary, 32-bit signed binary, 32-bit 8-bit BCD, 32-bit floating point, 64-bit unsigned binary, 64-bit signed binary, 64-bit 16-bit BCD, 64-bit floating point, ASCII string; The registers of the HMI drive to be tested include one or more of the following: I input relay, Q output relay, M internal relay and V data register.
5. The HMI-driven automatic test system according to claim 1, characterized in that: The communication connection is a serial port communication connection or an Ethernet port communication connection.
6. An automatic testing method based on HMI drive, characterized in that: It includes the following steps: Obtain register information contained in the HMI driver to be tested on the HMI end, set the original value for the register, and set the corresponding PLC internal storage unit address for the register, including: the read test original value address is address A, the read test write value address is address B, the read test comparison status value address is address C, the write test write value address is address D, and the write test copy value address is address E; Set the original value for the data in address A of the PLC; Read test steps: read the data in address A of the PLC to the HMI end, then write the read data in address A to address B of the PLC through the HMI end, then the PLC compares the data in address A and the data in address B to form a read test comparison result, and stores the read test comparison result in address C of the PLC, and then the HMI end reads the data in address C to determine whether there is a read error, wherein, equal read test comparison results represent correct reading, and unequal read test comparison results represent a read error; Write test steps: The HMI end writes the original value of the register to the D address of the PLC, and the PLC then copies the data in the D address to the E address. The HMI end reads the data in the E address of the PLC, and then the HMI end compares the data written to the D address with the data read in the E address to form a write test comparison result to determine whether there is a write error. Among them, equal write test comparison results indicate correct writing, and unequal write test comparison results indicate a write error.
7. The HMI-driven automatic testing method according to claim 6, characterized in that: The register includes multiple data types, and original values are set for the registers according to the data types, and the original values are set for the data in the A address of the PLC; The read test step and the write test step are respectively performed on multiple data types of the register.
8. The HMI-driven automatic testing method according to claim 7, characterized in that: The original value of the register, the original value of the data in the A address of the PLC is the maximum value, the minimum value, 0 and / or 1 corresponding to each data type; The read test step and the write test step are respectively performed on the maximum value, the minimum value, 0 and / or 1 corresponding to each data type of the register.
9. The HMI-driven automatic testing method according to claim 6, characterized in that: The data types include one or more of: bit, 8-bit unsigned binary, 8-bit signed binary, 8-bit 2-bit BCD, 16-bit unsigned binary, 16-bit signed binary, 16-bit 4-bit BCD, 32-bit unsigned binary, 32-bit signed binary, 32-bit 8-bit BCD, 32-bit floating point, 64-bit unsigned binary, 64-bit signed binary, 64-bit 16-bit BCD, 64-bit floating point, ASCII string.
10. The HMI-driven automatic testing method according to claim 6, characterized in that: The registers of the HMI drive to be tested include one or more of the following: I input relay, Q output relay, M internal relay and V data register.
Citation Information
Patent Citations
PCC programable controller and HITECH touch screen data interchanging method
CN101339422A
Dual-port memory-oriented reliability test method and system
CN107451017A
Method and system for testing touch screen interface
CN117421166A
Method for automatic translation of ladder logic to a SMT-based model checker in a network
US20230059985A1
