Program verification method and device, electronic equipment and storage medium

By automatically comparing the data segments of the power meter program, the problems of traditional manual verification are solved, and the accuracy and efficiency of power meter program verification are improved.

CN119127678APending Publication Date: 2024-12-13DELIXI GROUP INSTRUMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411130063.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Traditional power meter program verification methods rely on manual sentence-by-sentence verification, which is time-consuming and labor-intensive, easy to miss and inaccurate.

Method used

Provide a program verification method, which automatically verifies the reliability of the power meter program through the comparison of the data segments of the sample program and the program to be verified, and simplifies the verification process.

Benefits of technology

Automatic program verification is implemented, reducing the time and errors of manual verification, and improving the accuracy and efficiency of verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127678A_ABST
    Figure CN119127678A_ABST
Patent Text Reader

Abstract

The invention provides a program verification method and device, electronic equipment and a storage medium. The method comprises the steps that a first data segment and sample address information are determined according to a sample program, the sample program is a program which is verified and put into use, the sample program comprises a first function program and a first parameter program, and the first function program and the first parameter program are separately stored in a sample electric energy meter chip; according to the sample address information, a second data segment is obtained from a to-be-verified program, the to-be-verified program comprises a second function program and a second parameter program, the second function program and the second parameter program are separately stored in the to-be-verified electric energy meter chip, and the model of the sample electric energy meter chip is consistent with that of the to-be-verified electric energy meter chip; and determining the reliability of the to-be-verified program according to the first data segment and the second data segment. Therefore, automatic verification of the electric energy meter program is realized, and the verification process is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electric energy meters, and in particular to a program verification method, device, electronic device and storage medium. Background Art

[0002] With the widespread application of electric energy meters in the power field, there are more and more types of electric energy meters, and their functions are becoming more and more complex. Correspondingly, the programs applied to electric energy meters are also becoming more and more complex. Before the electric energy meter is officially put into use, in order to ensure the stability of the electric energy meter function, it is necessary to verify the reliability of the electric energy meter program.

[0003] In the related art, the traditional verification method of the program of the electric energy meter needs to rely on manual verification of the program sentence by sentence, which is time-consuming and labor-intensive, and manual verification is prone to omissions and inaccurate verification results. Summary of the invention

[0004] The present application provides a program verification method, device, electronic device and storage medium to solve the problem that manual verification of the program of the electric energy meter is time-consuming and labor-intensive, prone to omissions and inaccurate verification results, realizes automated verification of the program, and simplifies the verification process.

[0005] In a first aspect, the present application provides a program verification method, comprising:

[0006] Determine a first data segment and sample address information according to a sample program, wherein the sample program is a verified and put into use program, and the sample program includes a first function program and a first parameter program, wherein the first function program and the first parameter program are separately stored in a sample electric energy meter chip, wherein the first function program is used to implement the function of the electric energy meter, and the first parameter program is used to adjust the parameters of the first function program, wherein the first data segment is used to indicate part or all of the data in the first function program, and the sample address information is used to indicate a storage address corresponding to the first data segment;

[0007] According to the sample address information, a second data segment is obtained from the program to be verified, the program to be verified includes a second function program and a second parameter program, the second function program and the second parameter program are separately stored in the electric energy meter chip to be verified, the model of the sample electric energy meter chip and the electric energy meter chip to be verified are consistent, the second function program is used to realize the function of the electric energy meter, and the second parameter program is used to adjust the parameters of the second function program;

[0008] The reliability of the program to be verified is determined according to the first data segment and the second data segment.

[0009] In one possible design, the second function program is stored in the first storage area of ​​the electric energy meter chip to be verified, and the second parameter program is stored in the second storage area of ​​the electric energy meter chip to be verified. The end address of the first storage area is less than the start address of the second storage area, and the end address of the second storage area is less than or equal to the end address of the electric energy meter chip.

[0010] In a possible design, the first functional program includes a plurality of subprograms, and the plurality of subprograms are used to implement a plurality of different functions of the electric energy meter. The determining of the first data segment and the sample address information according to the sample program includes:

[0011] Traversing and reading the sample program to obtain address information of a storage area corresponding to the first functional program;

[0012] Determining the sample address information according to the address information of the storage area corresponding to the first functional program and the preset program information, wherein the preset program information is used to indicate one or more subprograms that need to be verified;

[0013] The data stored in the storage address indicated by the sample address information is determined as the first data segment.

[0014] In one possible design, the sample address information includes a first address and a second address, and the second address is greater than the first address.

[0015] In a possible design, obtaining a second data segment from the program to be verified according to the sample address information includes:

[0016] Starting from the first address, data between the first address and the second address are read in the electric energy meter chip to be verified to obtain the second data segment.

[0017] In a possible design, the sample address information includes a first address and a preset data length, and the preset data length is less than or equal to a data length of the first function program.

[0018] In a possible design, obtaining a second data segment from the program to be verified according to the sample address information includes:

[0019] Starting from the first address, the data of the preset data length bits are read in the electric energy meter chip to be verified to obtain the second data segment.

[0020] In a possible design, determining the reliability of the program to be verified according to the first data segment and the second data segment includes:

[0021] When the first data segment and the second data segment are consistent, determining that the program to be verified is reliable;

[0022] When the first data segment and the second data segment are inconsistent, it is determined that the reliability of the program to be verified needs further confirmation.

[0023] Through the method provided in the first aspect, according to the sample program, the first data segment and the sample address information are determined. The sample program is a verified and put into use program. The sample program includes a first function program and a first parameter program. The first function program and the first parameter program are stored separately in the sample electric energy meter chip, so that the sample program can be obtained from the sample electric energy meter chip, and the first data segment that can be used to verify the program to be verified and the storage address corresponding to the first data segment are obtained from the sample program. According to the sample address information, the second data segment is obtained from the program to be verified. The program to be verified includes a second function program and a second parameter program. The second function program and the second parameter program are stored separately in the electric energy meter chip to be verified. The model of the sample electric energy meter chip and the electric energy meter chip to be verified are consistent, so that the part to be verified in the program to be verified can be obtained, and there is no need to verify the parameter program that has changed. The first data segment is used as a reference, and the first data segment and the second data segment are compared to obtain the difference between the first data segment and the second data segment. When the first data segment and the second data segment are consistent, it is determined that the reliability of the program to be verified is high and can be put into use. When the first data segment and the second data segment are inconsistent, it is determined that the reliability of the program to be verified is low and needs to be verified again, thereby realizing automated program verification and simplifying the verification process. There is no need to rely on manual verification of the program sentence by sentence, which saves time and effort, avoids omissions, and improves the accuracy of verification.

[0024] In a second aspect, the present application provides a program verification device, including: a module for executing the method in the first aspect and any possible involvement of the first aspect.

[0025] In a third aspect, the present application provides an electronic device, including: a processor;

[0026] The processor is used to execute the computer executable program or instructions in the memory, so that the electronic device executes the method in the first aspect and any possible design of the first aspect.

[0027] In a fourth aspect, the present application provides an electronic device comprising: a memory and a processor; the memory is used to store program instructions; the processor is used to call the program instructions in the memory so that the electronic device executes the method in the first aspect and any possible design of the first aspect.

[0028] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor in an electronic device, the computer program implements the method in the first aspect and any possible design of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A flowchart of a program verification method provided in one embodiment of the present application.

[0030] Figure 2 A flow chart of a method for determining a first data segment and sample address information provided in one embodiment of the present application.

[0031] Figure 3 A flowchart of a program verification method provided in one embodiment of the present application.

[0032] Figure 4 A schematic diagram of the structure of a program verification device provided in one embodiment of the present application.

[0033] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0034] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0035] In this application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c alone can represent: a, b, c, a and b, a and c, or a, b, and c, where a, b, and c can be single or multiple. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0036] The directions or positional relationships indicated by terms such as "center", "longitudinal", "lateral", "up", "down", "left", "right", "front", and "back" are based on the directions or positional relationships shown in the accompanying drawings and are only for the convenience of describing the present application and simplifying the description. They do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as a limitation on the present application.

[0037] The terms "connected" and "connected" should be understood in a broad sense. For example, the "connected" or "connected" of a circuit structure can refer to not only physical connection, but also electrical connection or signal connection. For example, it can be directly connected, that is, physically connected, or indirectly connected through at least one intermediate element, as long as the circuit is connected, or it can be the internal connection of two elements; signal connection can refer to signal connection through a circuit or through a media medium, such as radio waves. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0039] Exemplarily, the present application provides a program verification method, device, electronic device, computer-readable storage medium and computer program product, which determines the storage address of the program to be verified and the data corresponding to the sample program by reading the first function program separately stored in the sample electric energy meter chip, so that the program to be verified can be read according to the storage address of the program to be verified in the electric energy meter chip to be verified. By comparing the similarities and differences between the data of the program to be verified and the sample program, the sample program can be used as a reference to determine the reliability of the program to be verified, thereby realizing automated program verification.

[0040] Among them, the program verification method provided in the present application can be performed by an electronic device, or by a program verification device in an electronic device. The program verification device can be implemented by a combination of software and / or hardware. For example, the program verification device can be an application (application, APP), a web page or a public account, etc. In order to simplify the description, the embodiment of the present application is described by taking the program verification device as an example.

[0041] The electronic device may be a server, a desktop computer, a mobile phone, a tablet computer, a laptop computer, a wearable device, a vehicle-mounted device, or an augmented reality (AR) / virtual reality (VR) device or the like.

[0042] Next, combine Figure 1, the program verification method provided in the embodiment of the present application is described.

[0043] See also Figure 1 , Figure 1 A flowchart of a program verification method provided in one embodiment of the present application. Figure 1 As shown, the method includes:

[0044] S101. Determine a first data segment and sample address information according to a sample program.

[0045] Because technicians will verify the program before it is officially put into use, and it will only be put into use after the program has a high degree of reliability, thus ensuring the stability, fault tolerance and maintainability of the program during operation.

[0046] Based on this, a chip with the same model as the one to be verified corresponding to the program to be verified can be selected from the electricity meter chips that have been put into use as a sample electricity meter chip, and the program in the sample electricity meter chip is a program with verified reliability. Therefore, the program in the sample electricity meter chip can be used as a sample program to determine the reliability of the program to be verified.

[0047] The sample electric energy meter chip is selected according to the program to be verified, and the sample electric energy meter chip is a chip of the same model as the electric energy meter chip to be verified corresponding to the program to be verified. The sample electric energy meter chip is a chip that has been put into use.

[0048] Thus, the program verification device can use the sample electric energy meter chip as a reference to determine the reliability of the program to be verified.

[0049] The sample program is stored in a sample electric energy meter chip.

[0050] Among them, the sample program is a program that has been verified and put into use.

[0051] Among them, the electric energy meter functions that can be realized by the sample program are the same as those of the program to be verified.

[0052] The sample program includes a first functional program and a first parameter program.

[0053] The first functional program is used to realize the function of the electric energy meter.

[0054] The first parameter program is used to adjust the parameters of the first function program.

[0055] Among them, the functions of the electricity meter may include electricity recording, rate monitoring, cover opening detection, power failure detection, electricity storage, time zone switching, etc.

[0056] The parameters may include time zone, time period, display parameters, freeze parameters, table number, address, etc.

[0057] Among them, the function program realizes different functions by referencing the parameter program. In the actual operation process, the parameters in the parameter program are defined in the header file, and the function program refers to the header file, so that the function program references the parameter program.

[0058] Taking the rate monitoring function as an example, for different rate monitoring scenarios, parameters corresponding to different rates are stored in the parameter program. The function program can reference the parameters corresponding to different rates in the parameter program to achieve monitoring of different rates.

[0059] Then, for monitoring scenarios with different rates, the functional program can remain unchanged, and monitoring with different rates can be achieved by simply changing the referenced parameters.

[0060] The first function program and the first parameter program are stored separately in the sample electric energy meter chip.

[0061] When storing the sample program in the sample electric energy meter chip, the first function program and the first parameter program need to be stored separately in different storage areas of the sample electric energy meter chip.

[0062] Therefore, when verifying the program to be verified based on the sample program, only the functional program part can be read and verified without verifying the parameter program part.

[0063] Among them, programs have multiple storage methods.

[0064] In some examples, the functional program may be stored first, and then the parameter program.

[0065] As shown in Table 1 below, taking the chip storage address from 00000H to 3FFFFH as an example, the function program is stored from 00000H to 3F3CBH, and the parameter program is stored from 3F800H to 3FE2BH.

[0066] Table 1

[0067]

[0068] In other examples, the parameter program may be stored first, and then the functional program.

[0069] As shown in Table 2 below, take the chip storage address from 00000H to 3FFFFH as an example. The parameter program is stored from 00000H to 3F3CBH. The function program is stored from 3F800H to 3FE2BH.

[0070] Table 2

[0071]

[0072] Therefore, when the chip where the program to be verified is located is a chip that stores the functional program first and then the parameter program, when selecting a sample program, it is necessary to select a chip that stores the functional program first and then the parameter program.

[0073] When the chip where the program to be verified is located is a chip that stores parameter programs first and then functional programs, when selecting a sample program, it is necessary to select a chip that stores parameter programs first and then functional programs to ensure that the program verification device can obtain a sample program that can verify the program to be verified from the sample electric energy meter chip.

[0074] Based on this, the program verification apparatus may obtain the first data segment from the sample program.

[0075] Among them, according to different needs of technicians, the first data segment has multiple forms.

[0076] In some examples, the first data segment is used to indicate all data in the first function program.

[0077] When it is necessary to verify all functional programs in the program to be verified, the program verification device can read all data from the first functional program.

[0078] For example, if the storage address of the chip is from 00000H to 3FFFFH, and the function program is stored from 00000H to 3F3CBH, then the first data segment is all the data between the storage address 00000H and the storage address 3F3CBH.

[0079] In other examples, the first data segment is used to indicate part of the data in the first function program.

[0080] When it is necessary to verify part of the functional programs in the program to be verified, the program verification device may read part of the data from the first functional program.

[0081] For example, in some cases, if only part of the programs to be verified need to be put into use, such as programs for implementing a rate monitoring function, then only the programs corresponding to the rate monitoring function may be verified.

[0082] The program verification device can read the program corresponding to the rate monitoring function from the sample program and determine the first data segment, thereby satisfying the scenario of verifying part of the program.

[0083] For example, the chip has a storage address of 00000H to 3FFFFH, the function program is stored from 00000H to 3F3CBH, and the storage address of the part of the program for implementing rate monitoring is 00000H to 10000H. Then the first data segment is the data between the storage address 00000H and the storage address 10000H.

[0084] After obtaining the first data segment, the part of the program to be verified that needs to be verified needs to be read from the energy meter chip to be verified. Then the program verification device also needs to know the storage address of the program to be verified. Since the model of the sample energy meter chip and the energy meter chip to be verified are the same, the storage address is also the same. The program verification device can know the storage address of the program to be verified through the storage address of the sample program.

[0085] Based on this, when reading the first data segment, the program verification device also needs to read the storage address corresponding to the first data segment, so as to obtain sample address information, so as to read the program to be verified from the energy meter chip to be verified according to the sample address information.

[0086] Among them, the program verification device can first obtain the first data segment, and then obtain the storage address corresponding to the first data segment. The program verification device can also first obtain the storage address corresponding to the first data segment, and then obtain the first data segment. Of course, the program verification device can also obtain the storage address corresponding to the first data segment and the first data segment at the same time, and this application does not limit this.

[0087] The sample address information is used to indicate the storage address corresponding to the first data segment.

[0088] The program verification device may obtain the sample address information in a variety of ways.

[0089] As a feasible implementation, the sample address information includes a first address and a second address, the second address being greater than the first address. The program verification apparatus may determine the start address of the first data segment as the first address and the end address of the first data segment as the second address.

[0090] For example, when the start address of the first data segment is 00000H and the end address of the second data segment is 3F3CBH, the sample address information includes the first address 00000H and the second address 3F3CBH.

[0091] As another feasible implementation, the sample address information includes a first address and a preset data length, and the preset data length is less than or equal to the data length of the first functional program. The program verification device may determine the starting address of the first data segment as the first address, and determine the data length of the first data as the preset data length.

[0092] For example, when the starting address of the first data segment is 00000H and the ending address of the second data segment is 3F3CBH, the sample address information includes the first address 00000H and the preset data length 3F3CB.

[0093] Based on this, the program verification device obtains the first data segment and sample address information.

[0094] S102. Obtain a second data segment from the program to be verified according to the sample address information.

[0095] After the program verification device obtains the first data segment and the sample address information from the sample program, the program verification device may read the second data segment from the electric energy meter chip to be verified according to the sample address information.

[0096] The program to be verified includes a second functional program and a second parameter program.

[0097] The second functional program is used to realize the function of the electric energy meter.

[0098] The second parameter program is used to adjust the parameters of the second function program.

[0099] The second function program and the second parameter program are stored separately in the electric energy meter chip to be verified.

[0100] In this way, for the electric energy meter chip to be verified, the program verification device will not be disturbed by the second parameter program when reading the second function program.

[0101] The program verification device may obtain the second data segment from the program to be verified in a variety of ways.

[0102] In some examples, when the sample address information includes a first address and a second address, and the second address is greater than the first address, the program verification device starts from the first address and reads data between the first address and the second address in the energy meter chip to be verified to obtain a second data segment.

[0103] For example, the sample address information includes a first address 00000H and a second address 3F3CBH, and the program verification device can read data from the storage address 00000H to the storage address 3F3CBH of the electric energy meter chip to be verified, thereby obtaining the second data segment.

[0104] In some other examples, the sample address information includes a first address and a preset data length, and the preset data length is less than or equal to the data length of the first function program. The program verification device starts from the first address and reads the data of the preset data length bit in the electric energy meter chip to be verified to obtain the second data segment.

[0105] For example, the sample address information includes a first address of 00000H and a preset data length of 3F3CB. Then the program verification device may start reading from the storage address 00000H of the electric energy meter chip to be verified, read 3F3CB bits of data, and obtain the second data segment.

[0106] Based on this, the program verification device reads the second data segment from the electric energy meter chip to be verified.

[0107] S103: Determine the reliability of the program to be verified according to the first data segment and the second data segment.

[0108] The program verification device obtains a first data segment from the sample program and obtains a second data segment from the program to be verified. The program verification device can compare the data of the first data segment and the second data segment.

[0109] Among them, the program verification device can use Levenshtein distance algorithm or rank distance algorithm to compare the first data segment and the second data segment, so as to determine the reliability of the program to be verified based on the difference between the first data segment and the second data segment.

[0110] When the program verification device determines that the first data segment and the second data segment are consistent, it means that there is no difference between the second data segment and the first data segment, that is, the second data segment can realize all the functions that the first data segment can realize, then the program verification device can determine that the program to be verified is reliable.

[0111] When the first data segment and the second data segment of the program verification device are inconsistent, it means that there is a difference between the second data segment and the first data segment, and the program verification device determines that the reliability of the program to be verified needs further confirmation.

[0112] In the embodiment of the present application, the program verification device determines the first data segment and sample address information based on the sample program. The sample program is a program that has been verified and put into use. The sample program includes a first functional program and a first parameter program. The first functional program and the first parameter program are stored separately in the sample electric energy meter chip, so that the program verification device can obtain the sample program from the sample electric energy meter chip, and obtain the first data segment that can be used to verify the program to be verified, and the storage address corresponding to the first data segment from the sample program. The program verification device obtains the second data segment from the program to be verified based on the sample address information. The program to be verified includes a second functional program and a second parameter program. The second functional program and the second parameter program are stored separately in the electric energy meter chip to be verified. The model of the sample electric energy meter chip and the electric energy meter chip to be verified are the same, so that the part to be verified in the program to be verified can be obtained, and there is no need to verify the parameter program that has changed. The program verification device uses the first data segment as a reference, compares the first data segment with the second data segment, and obtains the difference between the first data segment and the second data segment. When the first data segment and the second data segment are consistent, it is determined that the reliability of the program to be verified is high and can be put into use. When the first data segment and the second data segment are inconsistent, it is determined that the reliability of the program to be verified is low and needs to be verified again, thereby realizing automated program verification and simplifying the verification process. There is no need to rely on manual verification of the program sentence by sentence, which saves time and effort, avoids omissions, and improves the accuracy of verification.

[0113] Based on the above exemplary description, when storing the program to be verified, the second function program can be stored in the first storage area of ​​the electric energy meter chip to be verified, and the second parameter program can be stored in the second storage area of ​​the electric energy meter chip to be verified. The end address of the first storage area is less than the start address of the second storage area, and the end address of the second storage area is less than or equal to the end address of the electric energy meter chip.

[0114] Based on this, the code in the second function program remains unchanged, so the first storage area is a stable area, and the second parameter program stored in the second storage area can cope with complex working conditions. The second function program calls the second parameter program to meet the needs of different functions.

[0115] The end address of the first storage area is smaller than the start address of the second storage area, so that when the program verification device reads the program to be verified, it can read the functional program first without reading the parameter program. In this way, when verifying the program to be verified, only the second functional program in the first storage area can be verified without reading the data in the second storage area, which saves computing resources and helps to improve the efficiency of verification.

[0116] Based on the above exemplary description, in S103, the program verification device can be as follows: Figure 2In the manner shown, the first data segment and sample address information are determined.

[0117] See also Figure 2 , Figure 2 A flow chart of a method for determining a first data segment and sample address information provided in an embodiment of the present application. Figure 2 As shown, the method includes:

[0118] S201, traverse and read sample programs to obtain address information of a storage area corresponding to a first function program.

[0119] The program verification device traverses the sample program in the sample electric energy meter chip, thereby obtaining data corresponding to the first function program and the storage address of the first function program in the sample electric energy meter chip.

[0120] For example, as shown in Table 1, the address information of the storage area corresponding to the first function program may be 00000H to 3F3CBH.

[0121] S202: Determine sample address information according to address information of a storage area corresponding to the first function program and preset program information.

[0122] The first functional program includes a plurality of subprograms, and the plurality of subprograms are used to realize a plurality of different functions of the electric energy meter.

[0123] For example, the first functional program may include a first subprogram, a second subprogram and a third subprogram, wherein the first subprogram is used to implement rate monitoring, the second subprogram is used to implement cover opening detection, and the third subprogram is used to implement power failure detection.

[0124] The technician can determine, based on the verification requirements, that the first function program or a subprogram in the first function program needs to be verified, thereby determining the preset program information and inputting it into the program verification device, so that the program verification device learns the program that needs to be verified from the sample program.

[0125] The preset program information is used to indicate one or more subprograms that need to be verified. The preset program information may be the program name of the subprogram.

[0126] The program verification device determines the storage address of the subprogram corresponding to the program name of the subprogram in the preset program information from the address information of the storage area corresponding to the first function program, thereby obtaining the sample address information.

[0127] Based on this, the program verification apparatus determines sample address information.

[0128] S203: Determine the data stored in the storage address indicated by the sample address information as the first data segment.

[0129] After obtaining the sample address information, the program verification apparatus reads the first data segment from the sample program according to the sample address information.

[0130] Based on this, when the program verification device needs to verify the program to be verified, the corresponding data can be read from the program to be verified according to the sample address information and compared with the first data segment, thereby verifying the reliability of the program to be verified.

[0131] Based on the above exemplary description, Figure 3 A flowchart of a program verification method provided in one embodiment of the present application. Figure 3 As shown, S103 can be implemented through the following S103a to S103c.

[0132] S103a. Determine whether the first data segment is consistent with the second data segment.

[0133] If they are consistent, the program verification device executes S103b; if they are inconsistent, the program verification device executes S103c.

[0134] S103b, determine whether the program to be verified is reliable.

[0135] When the program verification device determines that the first data segment and the second data segment are consistent, it means that there is no difference between the second data segment and the first data segment, that is, the second data segment can realize all the functions that the first data segment can realize, then the program verification device can determine that the program to be verified is reliable.

[0136] S103c, determining that the reliability of the program to be verified requires further confirmation.

[0137] When the first data segment and the second data segment of the program verification device are inconsistent, it means that there is a difference between the second data segment and the first data segment, and the program verification device determines that the reliability of the program to be verified needs further confirmation.

[0138] Among them, there may be multiple situations where the reliability of the program to be verified needs further confirmation.

[0139] In some examples, the difference between the first data segment and the second data segment is less than a preset threshold.

[0140] The program verification device can determine that there are errors in the characters or sentences in the second data segment. In this case, the program verification device can prompt the technician that it is necessary to correct the characters or sentences in the second data segment of the program to be verified that are different from the first data segment, thereby improving the efficiency of the verification program and also improving the efficiency of the technician in correcting the program.

[0141] In other examples, the difference between the first data segment and the second data segment is greater than or equal to a preset threshold.

[0142] The program verification device can determine that there is an error in the storage address in the second data segment, that is, the storage address of the second data segment is inconsistent with the storage address of the first data segment. In this case, the program verification device can read the complete program to be verified and, based on the first data segment, query whether there is data in the program to be verified that is consistent with the first data segment.

[0143] If there is data consistent with the first data segment in the program to be verified, it means that the program to be verified can also realize the function that the first data segment can realize, which means that the reliability of the program to be verified is high.

[0144] If there is no data consistent with the first data segment in the program to be verified, the program verification device can prompt the technician that there is an abnormality in the program to be verified, so that the technician can perform further manual verification on the program to be verified to ensure that the program to be verified is completely and accurately verified.

[0145] The program verification device can determine the part of the second data segment that is different from the first data segment, and prompt the technician to correct the characters or sentences in the part, which can improve the efficiency of the technician in correcting the program.

[0146] Figure 4 This is a schematic diagram of the structure of a program verification device provided by an embodiment of the present application. Figure 4 As shown, the device includes: a determination module 101, an acquisition module 102 and a verification module 103.

[0147] The determination module 101 is used to determine the first data segment and the sample address information according to the sample program, the sample program is a verified and put into use program, the sample program includes a first function program and a first parameter program, the first function program and the first parameter program are stored separately in the sample electric energy meter chip, the first function program is used to realize the function of the electric energy meter, the first parameter program is used to adjust the parameters of the first function program, the first data segment is used to indicate part or all of the data in the first function program, and the sample address information is used to indicate the storage address corresponding to the first data segment;

[0148] The acquisition module 102 is used to acquire the second data segment from the program to be verified according to the sample address information, the program to be verified includes a second function program and a second parameter program, the second function program and the second parameter program are separately stored in the electric energy meter chip to be verified, the model of the sample electric energy meter chip and the electric energy meter chip to be verified are consistent, the second function program is used to realize the function of the electric energy meter, and the second parameter program is used to adjust the parameters of the second function program;

[0149] The verification module 103 is used to determine the reliability of the program to be verified based on the first data segment and the second data segment.

[0150] It should be noted that the program verification device of the embodiment of the present application can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0151] In some examples, the second function program is stored in the first storage area of ​​the electric energy meter chip to be verified, and the second parameter program is stored in the second storage area of ​​the electric energy meter chip to be verified. The end address of the first storage area is less than the start address of the second storage area, and the end address of the second storage area is less than or equal to the end address of the electric energy meter chip.

[0152] In some examples, the first functional program includes a plurality of subprograms, and the plurality of subprograms are used to implement a plurality of different functions of the electric energy meter. The determination module 101 is specifically used to traverse and read the sample program to obtain the address information of the storage area corresponding to the first functional program;

[0153] Determine the sample address information according to the address information of the storage area corresponding to the first function program and the preset program information, wherein the preset program information is used to indicate one or more subprograms that need to be verified;

[0154] The data stored in the storage address indicated by the sample address information is determined as the first data segment.

[0155] In some examples, the sample address information includes a first address and a second address, the second address being greater than the first address.

[0156] In some examples, the acquisition module 102 is specifically configured to read data between the first address and the second address in the electric energy meter chip to be verified starting from the first address to obtain the second data segment.

[0157] In some examples, the sample address information includes a first address and a preset data length, and the preset data length is less than or equal to a data length of the first function program.

[0158] In some examples, the acquisition module 102 is specifically configured to read data of a preset data length in the electric energy meter chip to be verified starting from the first address to obtain a second data segment.

[0159] In some examples, the verification module 103 is specifically configured to determine that the program to be verified is reliable when the first data segment and the second data segment are consistent;

[0160] When the first data segment and the second data segment are inconsistent, it is determined that the reliability of the program to be verified needs further confirmation.

[0161] Figure 5 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 5As shown, the electronic device may include: a processor 201 and a memory 202, wherein the memory 202 stores a computer program, and when the processor 201 executes the computer program, the embodiment of the present application is implemented. Figures 1 to 3 The program verification method shown.

[0162] Figure 6 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 6 As shown, the electronic device may include: a processor 301, and when the processor 301 executes a computer executable program or an instruction in a memory to execute a computer program, the embodiment of the present application is implemented. Figures 1 to 3 The program verification method shown.

[0163] Another embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the present application can be implemented. Figures 1 to 3 The program verification method shown.

[0164] Another embodiment of the present application further provides a computer program product, including: an execution instruction, the execution instruction is stored in a readable storage medium, at least one processor of the electronic device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the electronic device implements the embodiment of the present application Figures 1 to 3 The program verification method shown.

[0165] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0166] Those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.

[0167] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A program verification method, characterized in that: The method comprises: Determine a first data segment and sample address information according to a sample program, wherein the sample program is a verified and put into use program, and the sample program includes a first function program and a first parameter program, wherein the first function program and the first parameter program are separately stored in a sample electric energy meter chip, wherein the first function program is used to implement the function of the electric energy meter, and the first parameter program is used to adjust the parameters of the first function program, wherein the first data segment is used to indicate part or all of the data in the first function program, and the sample address information is used to indicate a storage address corresponding to the first data segment; According to the sample address information, a second data segment is obtained from the program to be verified, the program to be verified includes a second function program and a second parameter program, the second function program and the second parameter program are separately stored in the electric energy meter chip to be verified, the model of the sample electric energy meter chip and the electric energy meter chip to be verified are consistent, the second function program is used to realize the function of the electric energy meter, and the second parameter program is used to adjust the parameters of the second function program; The reliability of the program to be verified is determined according to the first data segment and the second data segment.

2. The method according to claim 1, characterized in that The second function program is stored in the first storage area of ​​the electric energy meter chip to be verified, and the second parameter program is stored in the second storage area of ​​the electric energy meter chip to be verified. The end address of the first storage area is less than the start address of the second storage area, and the end address of the second storage area is less than or equal to the end address of the electric energy meter chip.

3. The method according to claim 1 or 2, characterized in that: The first functional program includes a plurality of subprograms, and the plurality of subprograms are used to implement a plurality of different functions of the electric energy meter. The first data segment and the sample address information are determined according to the sample program, including: Traversing and reading the sample program to obtain address information of a storage area corresponding to the first functional program; Determining the sample address information according to the address information of the storage area corresponding to the first functional program and the preset program information, wherein the preset program information is used to indicate one or more subprograms that need to be verified; The data stored in the storage address indicated by the sample address information is determined as the first data segment.

4. The method according to claim 1 or 2, characterized in that: The sample address information includes a first address and a second address, and the second address is greater than the first address.

5. The method according to claim 4, characterized in that The step of obtaining a second data segment from the program to be verified according to the sample address information includes: Starting from the first address, data between the first address and the second address are read in the electric energy meter chip to be verified to obtain the second data segment.

6. The method according to claim 1 or 2, characterized in that: The sample address information includes a first address and a preset data length, and the preset data length is less than or equal to a data length of the first function program.

7. The method according to claim 6, characterized in that The step of obtaining a second data segment from the program to be verified according to the sample address information includes: Starting from the first address, the data of the preset data length bits are read in the electric energy meter chip to be verified to obtain the second data segment.

8. The method according to claim 1 or 2, characterized in that: Determining the reliability of the program to be verified according to the first data segment and the second data segment includes: When the first data segment and the second data segment are consistent, determining that the program to be verified is reliable; When the first data segment and the second data segment are inconsistent, it is determined that the reliability of the program to be verified needs further confirmation.

9. An electronic device, characterized in that: include: processor; The processor is used to execute a computer executable program or instruction in the memory, so that the electronic device executes the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer-executable program or instruction, and the computer-executable program or instruction is configured to execute the method according to any one of claims 1 to 8.