Automatic testing platform and method for supporting multiple protocol families of electric energy meter based on Lua
The Lua scripting language is written, combining protocol driver interface and communication interface module to realize automated testing of multiple power meter protocol families, solving the problems of complexity and low efficiency of traditional testing methods, and improving the flexibility and accuracy of testing and ensures test security through encryption machine.
Patent Information
- Application Number
- CN202411191843.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
Traditional electricity meter testing methods require different testing procedures for different protocol families, resulting in high workload, low efficiency and error proneness, and are unable to effectively support the automated testing of electricity meter multi-protocol families.
Use Lua scripting language to write test scripts, and use the Lua virtual machine resolution protocol interface, combined with the protocol driver interface and communication interface module to realize automated testing of a variety of power meter protocol families, including IEC 62056, DL/T645, DL/T698, DLMS /COSEM and ANSI protocols integrate the encrypted machine access interface of DL/T645 and DL/T698 to ensure the encrypted transmission and decryption verification of communication data.
It reduces the complexity of writing test programs for different protocol families, improves the flexibility and efficiency of testing, ensures the accuracy and security of testing, and reduces the cost of testing.
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of automatic testing of electric energy meters, in particular to an automatic testing implementation method supporting multiple protocol families of electric energy meters based on Lua scripts. Background Art
[0002] With the rapid development of smart grids, the stability and accuracy of the performance of electric energy meters, as important equipment in the power grid, directly affects the operating efficiency of the power grid and the safety of users' electricity use. However, due to the existence of multiple protocol families for electric energy meters, traditional testing methods often require writing different test programs for different protocol families, resulting in large testing workload, low efficiency, and easy errors.
[0003] Therefore, how to design a flexible and easy-to-use automated testing method that can support multiple protocol families of electric energy meters has important practical significance. Summary of the invention
[0004] The purpose of the present invention is to solve the problems of automatic testing of multiple protocol families of electric energy meters by proposing an automatic testing platform and method based on Lua that supports multiple protocol families of electric energy meters, aiming to solve the problems existing in the existing automatic testing methods. The method uses the lightweight and easy-to-expand characteristics of Lua scripts to write test cases into test scripts, realize automatic testing of electric energy meters of different protocol families, and improve test efficiency and accuracy.
[0005] The technical solution of the present invention is:
[0006] The present invention provides an automatic test platform for supporting multiple protocol families of electric energy meters based on Lua, comprising:
[0007] The test control module includes a protocol interface, a protocol driver interface and a Lua virtual machine. The Lua virtual machine is used to parse the interface and execute the test script by calling the corresponding protocol interface obtained through the parsing through the protocol driver interface;
[0008] The communication interface module is used to communicate with the electric energy meter, send test signals to the electric energy meter according to the instructions in the test script, and receive response data returned by the electric energy meter;
[0009] Data storage module, recording test instructions, electric energy meter response data and preliminary test results during the test process;
[0010] And the result analysis module is used to process the test results after the test is completed and generate a test report.
[0011] Furthermore, the test platform supports multiple electric energy meter protocol families, including IEC 62056, DL / T645, DL / T698, DLMS / COSEM and ANSI.
[0012] Furthermore, for the DL / T 645 and DL / T 698 protocols, the test platform integrates the encryption machine access interfaces of DL / T 645 and DL / T 698.
[0013] A test method for an automated test platform supporting multiple protocol families of electric energy meters based on Lua, comprising:
[0014] S1. Use Lua scripting language to write test scripts;
[0015] S2. Obtain the protocol interface through Lua virtual machine analysis, use the protocol driver interface to call the corresponding protocol interface and execute the test script to drive the communication interface module of the test platform to communicate with the electric energy meter;
[0016] S3, using the communication interface module to send a test signal to the electric energy meter according to the instructions in the test script, and receiving response data returned by the electric energy meter;
[0017] S4, recording the test instructions, the electric energy meter response data and the preliminary test results in the test process to the data storage module;
[0018] S5. After the test is completed, the test results are processed using the result analysis module and a test report is generated.
[0019] Furthermore, the test script includes test parameter acquisition, test instruction generation, test flow control and test result processing.
[0020] Furthermore, in S3, when performing the DL / T645 or DL / T698 protocol test, the communication interface module first communicates with the encryption machine according to the instructions in the test script, and then sends the ciphertext returned by the encryption machine to the electric energy meter.
[0021] Furthermore, in S5, the test report records various data during the test process, including test time, test environment, test steps, test results and abnormal information.
[0022] Beneficial effects of the present invention:
[0023] The present invention supports multi-protocol family testing of electric energy meters, reducing the complexity of writing test programs for different protocol families; by using the Lua scripting language to write test scripts, the content and structure of the test scripts can be adjusted according to test requirements, thereby improving the flexibility and maintainability of the test scripts.
[0024] The invention improves the test efficiency and accuracy and reduces the test cost through automated testing; and realizes the encrypted transmission and decryption verification of communication data by integrating DL / T698 and DL / T645 encryption machines, thereby ensuring the security of the test process.
[0025] Other features and advantages of the present invention will be described in detail in the following detailed description. DETAILED DESCRIPTION
[0026] The preferred embodiments of the present invention will be described in more detail below. Although the following content shows the preferred embodiments of the present invention, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0027] Example 1
[0028] This embodiment provides an automatic test system for supporting multiple protocol families of electric energy meters based on Lua, including:
[0029] The test control module includes a protocol interface, a protocol driver interface and a Lua virtual machine. The Lua virtual machine is used to parse the interface and execute the test script by calling the corresponding protocol interface obtained through the parsing through the protocol driver interface;
[0030] The communication interface module is used to communicate with the electric energy meter, send test signals to the electric energy meter according to the instructions in the test script, and receive response data returned by the electric energy meter;
[0031] Data storage module, recording test instructions, electric energy meter response data and preliminary test results during the test process;
[0032] And the result analysis module is used to process the test results after the test is completed and generate a test report.
[0033] The test platform supports multiple electric energy meter protocol families, including IEC 62056, DL / T 645, DL / T698, DLMS / COSEM and ANSI; for the two protocols DL / T 645 and DL / T 698, the test platform integrates the encryption machine access interface of DL / T 645 and DL / T 698.
[0034] Example 2
[0035] This embodiment provides a test method for an automated test platform supporting multiple protocol families of electric energy meters based on Lua, including:
[0036] The test script is written in Lua scripting language. The test script is the core of automated testing, which includes test process control, test instruction generation, and test result processing logic. In this embodiment, the test script can be flexibly customized according to different protocol families of the electric energy meter to meet the test requirements of different electric energy meters.
[0037] After writing the test script, import it into the test platform and call the test script through the test control module for testing. The test control module drives the communication interface module to communicate with the electric energy meter according to the instructions in the test script. The communication interface module sends test instructions to the electric energy meter according to the test script and receives the response data returned by the electric energy meter.
[0038] During the test, the data storage module records the test instructions, the meter response data and the preliminary test results in real time. These data provide an important basis for subsequent analysis and report generation.
[0039] After the test is completed, the result analysis module processes the received meter response data. The processing process includes parsing, comparing and analyzing the response data to determine whether the meter responds to the test instructions as expected. Based on the processing results, the result analysis module generates a final test report.
[0040] The test report contains detailed information such as test time, tester, test environment, test steps, test results and conclusions. This information helps users fully understand the test process and results so as to evaluate and optimize the performance of the energy meter.
[0041] It should be noted that this embodiment is only an exemplary description, and can be appropriately adjusted and optimized according to actual conditions during specific implementation. At the same time, in order to ensure the accuracy and reliability of the test results, the test platform and test scripts are fully verified and debugged before testing.
[0042] In practical applications, the test method can also be expanded and optimized according to specific needs, such as adding more test functions, optimizing the test process, and improving the test coverage. These expansions and optimizations can make the test method more flexible, efficient, and reliable, thereby better meeting the needs of electric energy meter testing.
[0043] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. An automated test platform based on Lua that supports multiple protocols for electric energy meters, characterized in that include: The test control module includes a protocol interface, a protocol driver interface and a Lua virtual machine. The Lua virtual machine is used to parse the interface and execute the test script by calling the corresponding protocol interface obtained through the parsing through the protocol driver interface; The communication interface module is used to communicate with the electric energy meter, send test signals to the electric energy meter according to the instructions in the test script, and receive response data returned by the electric energy meter; Data storage module, recording test instructions, electric energy meter response data and preliminary test results during the test process; And the result analysis module is used to process the test results after the test is completed and generate a test report.
2. The automated testing platform according to claim 1, characterized in that: The test platform supports multiple electric energy meter protocol families, including IEC 62056, DL / T 645, DL / T 698, DLMS / COSEM and ANSI.
3. The automated testing platform according to claim 1, characterized in that: For the DL / T 645 and DL / T 698 protocols, the test platform integrates the encryption machine access interface of DL / T 645 and DL / T 698.
4. A test method for an automated test platform supporting multiple protocol families of electric energy meters based on Lua as claimed in any one of claims 1 to 3, characterized in that include: S1. Use Lua scripting language to write test scripts; S2. Obtain the protocol interface through Lua virtual machine analysis, use the protocol driver interface to call the corresponding protocol interface and execute the test script to drive the communication interface module of the test platform to communicate with the electric energy meter; S3, using the communication interface module to send a test signal to the electric energy meter according to the instructions in the test script, and receiving response data returned by the electric energy meter; S4, recording the test instructions, the electric energy meter response data and the preliminary test results in the test process to the data storage module; S5. After the test is completed, the test results are processed using the result analysis module and a test report is generated.
5. The automated testing method according to claim 4, characterized in that: The test script includes test parameter acquisition, test instruction generation, test flow control and test result processing.
6. The automated testing method according to claim 4, characterized in that In S3, when performing the DL / T645 or DL / T698 protocol test, the communication interface module first communicates with the encryption machine according to the instructions in the test script, and then sends the ciphertext returned by the encryption machine to the electric energy meter.
7. The automated testing method according to claim 4, characterized in that In S5, the test report records various data during the test process, including test time, test environment, test steps, test results and abnormal information.
