An electric energy meter protocol data full traversal automatic testing method and electric energy meter

By modeling the electricity meter protocol and generating test messages, a full-traversal automatic test of the electricity meter protocol data was achieved, solving the problems of high testing cost and incomplete coverage in the existing technology, and realizing fast and accurate electricity meter protocol testing.

CN122395103BActive Publication Date: 2026-08-25WASION GROUP HLDG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610866253.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-08-25
Estimated Expiration
2046-06-16

AI Technical Summary

Technical Problem

Existing electricity meter protocol testing methods suffer from high manual testing costs, incomplete coverage, expensive equipment, and difficulty in achieving comprehensive testing of every electricity meter.

Method used

By modeling the protocols supported by the electricity meter, defining data format types, generating normal and abnormal test messages, and processing the protocols in a virtual environment, the full traversal test can be completed automatically.

Benefits of technology

It enables rapid and accurate full-traversal testing of electricity meter protocol data, improving testing efficiency, reducing testing costs, and meeting the comprehensive testing needs of each electricity meter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122395103B_ABST
    Figure CN122395103B_ABST
Patent Text Reader

Abstract

The application discloses a kind of electric energy meter protocol data full traversal automatic test method and electric energy meter, comprising the following steps: the protocol supported by electric energy meter is modeled, and the electric energy meter data format type in protocol is defined;Establish the protocol information table of electric energy meter to be tested, and the electric energy meter protocol message is generated for each protocol in protocol information table to be tested according to electric energy meter protocol specification by master station request message generation module;According to the format corresponding to the protocol in protocol information table to be tested, generate normal test message and abnormal test message, and respectively expect normal response and abnormal response;Virtual message receiving module is generated by protocol request message generation module of master station request message generation module, and protocol request message is placed in electric energy meter communication port drive cache, and electric energy meter executes protocol processing according to protocol request message;Statistical electric energy meter protocol running result, complete all protocols of protocol information table to be tested Full traversal automatic test.The application solves the technical problem of how to accurately and quickly perform electric energy meter protocol data full traversal automatic test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electricity meter technology, and in particular to an automatic testing method for full traversal of electricity meter protocol data and an electricity meter. Background Technology

[0002] Currently, electricity meter protocols are often tested manually, line by line, to identify potential quality issues during development. Alternatively, the electricity meter is connected to a test bench, and a test program is written on a PC to communicate with the meter, read or set data or parameters, thus achieving the testing purpose. Clearly, manual testing is costly and may not uncover all protocol issues. Sometimes, test cases are poorly designed, leading to missed tests, or only normal tests are performed while anomaly tests are neglected, or anomaly tests are not comprehensively considered, resulting in quality problems. On the other hand, connecting the electricity meter to the test bench and writing test software on a PC to control the test bench requires purchasing expensive equipment, setting up a complex environment, and writing specialized test software. Testing requires running the test bench and connecting the electricity meter to the environment. Furthermore, due to the high cost of the equipment, it is difficult to allocate one test bench to each tester for testing and verification. Moreover, these methods can only perform random checks on produced electricity meters, failing to achieve comprehensive testing of every single meter. Therefore, there is an urgent need to propose an automatic testing method for the full traversal of electricity meter protocol data and an electricity meter to solve the technical problem of how to accurately and quickly perform automatic testing of the full traversal of electricity meter protocol data. Summary of the Invention

[0003] The main objective of this invention is to propose an automatic testing method for the full traversal of electricity meter protocol data and an electricity meter, aiming to solve the technical problem of how to accurately and quickly perform automatic testing of the full traversal of electricity meter protocol data.

[0004] To achieve the above objectives, the present invention provides an automatic testing method for the full traversal of electricity meter protocol data, wherein the automatic testing method for the full traversal of electricity meter protocol data includes the following steps:

[0005] S1. Model the protocols supported by the electricity meter and define the data format type of the electricity meter in the protocol;

[0006] S2. Establish a table of protocols to be tested for electricity meters. The main station request message generation module generates formal electricity meter protocol messages for each protocol in the table of protocols to be tested according to the electricity meter protocol specifications.

[0007] S3. Based on the format corresponding to the protocol in the protocol information table, generate normal test messages and abnormal test messages respectively, and expect normal responses and abnormal responses respectively;

[0008] S4. The virtual message receiving module places the protocol request message generated by the master station request message generation module into the communication port driver buffer of the energy meter. The energy meter executes the protocol processing flow according to the protocol request message in the communication port driver buffer.

[0009] S5. Statistically analyze the operation results of the electricity meter protocol. Repeat steps S2-S4 to complete the full traversal automatic test of all protocols in the protocol information table under test.

[0010] In one preferred embodiment, any protocol of the electricity meter includes a control code, a data identifier, and additional data.

[0011] In one preferred embodiment, the format of the additional data includes the length of the additional data, a normal padding interface, and an abnormal padding interface.

[0012] In one preferred embodiment, the data format type of the electricity meter includes a data format ID, and the length of the corresponding additional data, the normal filling interface, and the abnormal filling interface can be obtained based on the data format ID.

[0013] One preferred embodiment is that the electricity meter's test protocol information table includes the control code, data identifier, and data format ID for each protocol.

[0014] In one preferred embodiment, step S3 generates normal test messages and abnormal test messages according to the format corresponding to the protocol in the protocol information table under test, specifically as follows:

[0015] Based on the return values ​​of the normal and abnormal filling interfaces corresponding to the protocol in the protocol information table, determine whether there are any remaining normal or abnormal cases that need further testing.

[0016] If the return value of the normal or abnormal fill interface is TRUE, it means that there are other normal or abnormal cases that need to be tested. If the return value of the normal or abnormal fill interface is FALSE, it means that the protocol has completed all normal or abnormal tests.

[0017] One preferred embodiment, step S4, specifically includes:

[0018] The virtual message receiving module places the protocol request message from the master station request message generation module into the communication port driver buffer of the energy meter, simulating the energy meter receiving the protocol request message from the master station. The energy meter parses the protocol request message received in the communication port driver buffer and executes the protocol processing flow according to the parsed protocol request message. The processing flow obtains the data required by the protocol, sets the protocol data, or performs corresponding control on the energy meter according to the protocol type.

[0019] One preferred embodiment, step S5, specifically includes:

[0020] The statistical results of the electricity meter protocol operation include:

[0021] According to the normal test message of the normal filling interface, if the energy meter returns a normal response, the test is successful; if the energy meter returns an abnormal response, the test fails, and test failure statistics are performed.

[0022] Based on the abnormal test message of the abnormal filling interface, if the energy meter returns an abnormal response, the test is successful; if the energy meter returns a normal response, the test fails, and test failure statistics are performed.

[0023] The electricity meter checks the information table of protocols under test. If there are still protocols under test, repeat steps S2-S4 to complete the automatic test of all protocols in the information table of protocols under test.

[0024] In one preferred embodiment, after step S5, the method further includes:

[0025] Create an interface to clear the protocol information table and remove the protocol information table.

[0026] An electricity meter includes a memory and a processor; the memory stores a computer program that can run on the processor, and the processor, when executing the computer program, implements the automatic test method for full traversal of electricity meter protocol data.

[0027] The above-described technical solution of the present invention includes the following steps for the automatic full-traversal testing method of electricity meter protocol data: modeling the protocols supported by the electricity meter and defining the electricity meter data format types in the protocols; establishing a table of electricity meter protocols under test, and generating formal electricity meter protocol messages for each protocol in the table of protocols under test through the master station request message generation module according to the electricity meter protocol specifications; generating normal test messages and abnormal test messages according to the formats corresponding to the protocols in the table of protocols under test, and expecting normal and abnormal responses respectively; placing the protocol request messages generated by the master station request message generation module in the electricity meter communication port driver buffer, and executing the protocol processing flow according to the protocol request messages in the communication port driver buffer; statistically analyzing the electricity meter protocol operation results, and completing the automatic full-traversal testing of all protocols in the table of protocols under test. This invention significantly shortens the testing time, improves the testing effect, and solves the technical problem of how to accurately and quickly perform automatic full-traversal testing of electricity meter protocol data.

[0028] In this invention, multiple normal test messages and multiple abnormal test messages can be automatically constructed for the same protocol, and multiple normal condition tests and multiple abnormal condition tests can be performed on each protocol. It can automatically complete comprehensive normal and abnormal tests for all protocols under various conditions.

[0029] In this invention, the protocol information table under test can be configured, meaning it can be tailored for different application scenarios to meet specific needs. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0031] Figure 1 This is a first schematic diagram of an automatic testing method for full traversal of electricity meter protocol data according to an embodiment of the present invention;

[0032] Figure 2 This is a schematic diagram of the protocol information table under test in an embodiment of the present invention;

[0033] Figure 3 This is a schematic diagram of the data format ID in an embodiment of the present invention;

[0034] Figure 4 This is a second schematic diagram of an automatic testing method for full traversal of electricity meter protocol data according to an embodiment of the present invention.

[0035] The realization of the objective, functional characteristics and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0037] It should be noted that all directional indicators (such as up, down, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly.

[0038] Furthermore, in this invention, descriptions involving "first," "second," etc., are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0039] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0040] See Figures 1-4 According to one aspect of the present invention, the present invention provides an automatic testing method for the full traversal of electricity meter protocol data, wherein the automatic testing method for the full traversal of electricity meter protocol data includes the following steps:

[0041] S1. Model the protocols supported by the electricity meter and define the data format type of the electricity meter in the protocol;

[0042] S2. Establish a table of protocols to be tested for electricity meters. The main station request message generation module generates formal electricity meter protocol messages for each protocol in the table of protocols to be tested according to the electricity meter protocol specifications.

[0043] S3. Based on the format corresponding to the protocol in the protocol information table, generate normal test messages and abnormal test messages respectively, and expect normal responses and abnormal responses respectively;

[0044] S4. The virtual message receiving module places the protocol request message generated by the master station request message generation module into the communication port driver buffer of the energy meter. The energy meter executes the protocol processing flow according to the protocol request message in the communication port driver buffer.

[0045] S5. Statistically analyze the operation results of the electricity meter protocol. Repeat steps S2-S4 to complete the full traversal automatic test of all protocols in the protocol information table under test.

[0046] Specifically, in this embodiment, the operation of the electricity meter by the protocol includes reading, setting, and operation. Each step has a corresponding format. Taking the 645 format as an example, the three types have their own control codes. Different data contents are distinguished by data identifiers. In addition to the data identifier, there is also data of a certain length, and the data length depends on the data format. The automatic test method for full traversal of electricity meter protocol data described in this invention is based on the understanding and mining of electricity meter protocol data. All protocols that the electricity meter can process are messages with a pre-defined format that the electricity meter can parse.

[0047] Specifically, in this embodiment, the protocols supported by the electricity meter are modeled. Each protocol of the electricity meter includes a control code, a data identifier, and additional data. All additional data has a certain format, defined as an additional data format. The format of the additional data includes the length of the additional data, a normal filling interface, and an abnormal filling interface. The length of the additional data can be obtained according to the type of the additional data format. At the same time, this invention implements a normal filling interface and an abnormal filling interface for each type of additional data format according to the format of the additional data. When the corresponding interface is NULL, it indicates that the corresponding filling interface does not exist. Abnormal filling is performed by filling illegal values ​​of the data format according to the type of additional data format to perform anomaly testing.

[0048] Specifically, in this embodiment, the data format type of the electricity meter includes a data format ID, and the length of the corresponding additional data, the normal filling interface, and the abnormal filling interface can be obtained according to the data format ID.

[0049] Specifically, in this embodiment, the energy meter test protocol information table includes the control code, data identifier, and data format ID for each protocol; the test protocol information table supports editing and generation by a host computer, and the test protocol information table is saved in the energy meter's non-volatile storage in the form of a file.

[0050] Specifically, in this embodiment, step S3 generates normal test messages and abnormal test messages according to the format corresponding to the protocol in the protocol information table under test, as follows:

[0051] Based on the return values ​​of the normal and abnormal filling interfaces corresponding to the protocol in the protocol information table, determine whether there are any remaining normal or abnormal cases that need further testing.

[0052] If the return value of the normal or abnormal fill interface is TRUE, it means that there are other normal or abnormal cases that need to be tested. If the return value of the normal or abnormal fill interface is FALSE, it means that the protocol has completed all normal or abnormal tests, thus achieving comprehensive coverage testing of all cases for each protocol.

[0053] Based on the protocol format in the protocol information table, normal test messages and abnormal test messages are generated according to their normal and abnormal filling interfaces, respectively, to test the protocol under normal and abnormal conditions. Each type of normal and abnormal filling interface can output different filling data each time it is called, according to its internal scheduling state machine, to perform various routine tests, special boundary condition tests, or abnormal tests. Multiple normal test messages and multiple abnormal test messages can be automatically constructed for the same protocol, and multiple normal and abnormal condition tests can be performed on each protocol, which can automatically complete comprehensive normal and abnormal tests for all protocols under various conditions.

[0054] Specifically, in this embodiment, step S4 is as follows: the virtual message receiving module places the protocol request message from the master station request message generation module into the energy meter communication port driver buffer, simulates the energy meter receiving the master station's protocol request message, the energy meter parses the protocol request message received in the communication port driver buffer, and executes the protocol processing flow according to the parsed protocol request message. The processing flow obtains the data required by the protocol, sets the protocol data, or performs corresponding control on the energy meter according to the protocol type.

[0055] Specifically, in this embodiment, step S5 is as follows:

[0056] The statistical results of the electricity meter protocol operation include:

[0057] According to the normal test message of the normal filling interface, if the energy meter returns a normal response, the test is successful; if the energy meter returns an abnormal response, the test fails, and test failure statistics are performed.

[0058] Based on the abnormal test message of the abnormal filling interface, if the energy meter returns an abnormal response, the test is successful; if the energy meter returns a normal response, the test fails, and test failure statistics are performed.

[0059] The electricity meter checks the information table of protocols under test. If there are still protocols under test, repeat steps S2-S4 to complete the automatic test of all protocols in the information table of protocols under test.

[0060] Specifically, in this embodiment, after step S5, the method further includes:

[0061] A protocol information table clearing interface is constructed to clear the protocol information table. Before the electricity meter leaves the factory, the clearing operation is performed to clear the protocol information table to be tested. In this way, the meter will not be tested for the above protocol when it leaves the factory, ensuring that the test is only carried out during the production and debugging process in the factory.

[0062] According to another aspect of the present invention, an electricity meter is provided, wherein the electricity meter includes: a memory and a processor; the memory stores a computer program that can run on the processor, and the processor, when executing the computer program, implements the automatic test method for full traversal of electricity meter protocol data.

[0063] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. All equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.

Claims

1. An automatic testing method for full traversal of electricity meter protocol data, characterized in that, Includes the following steps: S1. Model the protocols supported by the electricity meter and define the data format type of the electricity meter in the protocol; S2. Establish a test protocol information table for the electricity meter. The master station request message generation module generates a formal electricity meter protocol message for each protocol in the test protocol information table according to the electricity meter protocol specifications. Each protocol of the electricity meter includes a control code, a data identifier, and additional data. The format of the additional data includes the length of the additional data, a normal filling interface, and an abnormal filling interface. S3. Based on the format corresponding to the protocol in the protocol information table, generate normal test messages and abnormal test messages respectively, and expect normal responses and abnormal responses respectively; Specifically: Based on the return values ​​of the normal and abnormal filling interfaces corresponding to the protocol in the protocol information table, determine whether there are any remaining normal or abnormal cases that need further testing. If the return value of the normal or abnormal fill interface is TRUE, it means that there are other normal or abnormal cases that need to be tested. If the return value of the normal or abnormal fill interface is FALSE, it means that the protocol has completed all normal or abnormal tests. S4. The virtual message receiving module places the protocol request message generated by the master station request message generation module into the communication port driver buffer of the energy meter. The energy meter executes the protocol processing flow according to the protocol request message in the communication port driver buffer. Specifically: The virtual message receiving module places the protocol request message from the master station request message generation module into the communication port driver buffer of the energy meter, simulating the energy meter receiving the protocol request message from the master station. The energy meter parses the protocol request message received in the communication port driver buffer and executes the protocol processing flow according to the parsed protocol request message. The processing flow obtains the data required by the protocol, sets the protocol data, or performs corresponding control on the energy meter according to the protocol type. S5. Statistically analyze the operation results of the electricity meter protocol. Repeat steps S2-S4 to complete the full traversal automatic test of all protocols in the protocol information table under test.

2. The automatic testing method for full traversal of electricity meter protocol data according to claim 1, characterized in that, The data format type of the electricity meter includes a data format ID. Based on the data format ID, the length of the corresponding additional data, the normal filling interface, and the abnormal filling interface can be obtained.

3. The automatic testing method for full traversal of electricity meter protocol data according to claim 2, characterized in that, The electricity meter's test protocol information table includes the control code, data identifier, and data format ID for each protocol.

4. The automatic testing method for full traversal of electricity meter protocol data according to any one of claims 1-3, characterized in that, Step S5 specifically includes: The statistical results of the electricity meter protocol operation include: According to the normal test message of the normal filling interface, if the energy meter returns a normal response, the test is successful; if the energy meter returns an abnormal response, the test fails, and test failure statistics are performed. Based on the abnormal test message of the abnormal filling interface, if the energy meter returns an abnormal response, the test is successful; if the energy meter returns a normal response, the test fails, and test failure statistics are performed. The electricity meter checks the information table of protocols under test. If there are still protocols under test, repeat steps S2-S4 to complete the automatic test of all protocols in the information table of protocols under test.

5. The automatic testing method for full traversal of electricity meter protocol data according to any one of claims 1-3, characterized in that, After step S5, the method further includes: Create an interface to clear the protocol information table and remove the protocol information table.

6. An electricity meter, characterized in that, include: Memory and processor; The memory stores a computer program that can run on a processor, and when the processor executes the computer program, it implements the automatic test method for full traversal of electricity meter protocol data as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Electric energy meter-oriented virtualization test method and system

    CN110907882A

  • Electric energy meter function detection method based on multi-protocol identification and self-test

    CN115525535A