An electric energy meter data storage method, device and computer equipment
By combining a linked list structure with temporary memory, the frozen data of electricity meters is dynamically managed, solving the problems of excessive memory usage and data inconsistency in the freezing process, and achieving unified storage and accuracy of frozen data.
Patent Information
- Application Number
- CN202411415964.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-20
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-04-20
AI Technical Summary
In existing technologies, electricity meters consume excessive memory space during the freezing process, and there is a risk of inconsistency between different types of frozen data sources, leading to inconsistent sampling results.
Nodes are dynamically added using a linked list structure. The final linked list is generated based on the number of associated objects of the frozen task, and the frozen data is stored in temporary memory to ensure data consistency.
It effectively solves the problem of excessive memory usage and ensures the uniformity of different types of frozen data sources, thus guaranteeing the accuracy and consistency of frozen data.
Smart Images

Figure CN119512450B_ABST
Abstract
Description
[0001] This application is a divisional application of Chinese invention patent application filed on April 20, 2022, with application number 2022104166585 and entitled "Data storage method, apparatus and computer equipment for freezing electricity meters". Technical Field
[0002] This application relates to the field of electricity meter technology, and in particular to an electricity meter data storage method, apparatus, computer equipment, storage medium and computer program product. Background Technology
[0003] Electricity meters are one of the fundamental devices for data acquisition in the power grid and the only component in the power system that measures electrical energy; their importance and reliability are self-evident. Freezing is a crucial data recording function of electricity meters. When a freeze occurs during operation, the meter records the frozen data. The specific data recorded depends on the types of associated objects configured by the user for that freeze, and the meter stores the specific values of these associated objects at the time of the freeze. In the event of a power outage, all frozen data related to billing must be retained for at least 16 years, and other data for at least 3 years. Furthermore, at the same freeze point in time, the same data items stored for all types of freezes should remain consistent.
[0004] In existing technologies, traditional microcontrollers allocate fixed memory spaces for each type of freeze task during the freezing process. This approach consumes excessive memory and carries the risk of inconsistencies between different types of freeze data sources at the same time. For example, hourly freezes may simultaneously occur at minute-by-minute intervals, both requiring the storage of forward and reverse active power data. Since the two traditional freeze tasks sample data separately, the sampling times are sequential, potentially leading to inconsistent sampling results. However, from the perspective of the freeze function requirements, these two data points should be simultaneous and consistent. Summary of the Invention
[0005] Therefore, it is necessary to provide a data storage method, device, computer equipment, computer-readable storage medium, and computer program product for freezing electricity meters that can solve the problem of excessive memory space occupation and ensure data source uniformity, in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides a method for storing electricity meter data. The method includes:
[0007] Obtain the task of freezing the electricity meter;
[0008] Generate corresponding flag values based on the frozen tasks, and add the flag values to the array;
[0009] The flag values in the array are checked in a loop until the flag value is not 0. Then, nodes are added to the initial linked list according to the number of associated objects of the frozen task corresponding to the flag value, and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0010] Allocate temporary memory based on the data length, store the frozen data of the corresponding associated objects into the temporary memory, and let the data pointer point to the address of the temporary memory;
[0011] The algorithm iterates through the array to check the flag values until a flag value is not zero. Then, it traverses the final linked list, determines all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieves the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointers of the associated objects and stores it into the storage device.
[0012] In one embodiment, after retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the method further includes:
[0013] Release temporary memory.
[0014] In one embodiment, the electricity meter freezing task includes at least one of instantaneous freezing, minute freezing, hourly freezing, daily freezing, settlement day freezing, monthly freezing, tiered settlement freezing, time zone meter switching freezing, daily time period meter switching freezing, rate electricity price switching freezing, and tiered switching freezing.
[0015] In one embodiment, the associated objects of the freezing task include forward active energy, reverse active energy, total forward active energy, total reverse active energy, combined reactive energy 1, combined reactive energy 2, total combined reactive energy 1, total combined reactive energy 2, reactive energy in the first quadrant, reactive energy in the second quadrant, reactive energy in the third quadrant, reactive energy in the fourth quadrant, total reactive energy in the first quadrant, total reactive energy in the second quadrant, total reactive energy in the third quadrant, and total reactive energy in the fourth quadrant. Total reactive power, forward active power of phase A, forward active power of phase B, forward active power of phase C, reverse active power of phase A, reverse active power of phase B, reverse active power of phase C, maximum forward active power demand and occurrence time, maximum reverse active power demand and occurrence time, phase A voltage qualification rate, phase B voltage qualification rate, phase C voltage qualification rate, monthly electricity consumption, active power, reactive power, active power demand, reactive power demand, voltage, current and power factor.
[0016] In one embodiment, the storage device includes at least one of EEPROM, Flash, and disk storage.
[0017] In one embodiment, when there are two or more frozen tasks at the same time, nodes are added to the initial linked list and a final linked list is generated based on the number of associated objects of the frozen tasks corresponding to the flag values, including:
[0018] S1, add the node of the associated object of the first frozen task to the initialization linked list according to the flag value, and update the initialization linked list to the first linked list;
[0019] S2, determine the i-th frozen task based on the flag value, where... and ;
[0020] S3, based on the OAD of the associated object of the i-th frozen task, traverse the (i-1)-th linked list and determine whether there is an associated object in the i-th frozen task that is different from the node in the (i-1)-th linked list.
[0021] S4. If it exists, add nodes of different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list is consistent with the (i-1)th linked list.
[0022] S5. Repeat steps S2-S4 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list. The nth linked list is the final linked list.
[0023] In one embodiment, when there are two or more frozen tasks at the same time point, the final linked list is traversed, all associated objects of the frozen task corresponding to the flag value are determined according to the OAD, and the frozen data of the associated objects of the frozen task are obtained from the corresponding temporary memory according to the data pointer of the associated object and stored in the storage device, including:
[0024] Traverse the final linked list and determine all associated objects of the frozen task corresponding to different flag values based on the OAD;
[0025] Based on the data pointer of the associated object, the frozen data of the associated object of the frozen task corresponding to different flag values is obtained from the corresponding temporary memory and stored in the storage device respectively.
[0026] Secondly, this application also provides an energy meter data storage device. The device includes:
[0027] The acquisition module is used to acquire electricity meter freezing tasks;
[0028] The flag value generation module is used to generate corresponding flag values based on the frozen tasks and add the flag values to an array;
[0029] The final linked list generation module is used to iteratively check the flag values in the array until the flag value is not 0. Then, based on the number of associated objects of the frozen task corresponding to the flag value, nodes are added to the initial linked list and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0030] The temporary storage module is used to request temporary memory based on the data length and store the frozen data of the corresponding associated objects into the temporary memory. The data pointer points to the address of the temporary memory.
[0031] The associated object determination module is used to iterate through the flag values in the array until the flag value is not 0. Then, it traverses the final linked list and determines all associated objects of the frozen task corresponding to the flag value based on the OAD.
[0032] The data storage module is used to retrieve the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and store it into the storage device.
[0033] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the data storage method described above for freezing an electricity meter.
[0034] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method for storing data in an energy meter.
[0035] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described method for storing electricity meter data.
[0036] The aforementioned method, apparatus, computer equipment, storage medium, and computer program product for storing electricity meter data solves the problem of excessive memory space usage and achieves the beneficial effect of ensuring data source uniformity by reorganizing the associated object attributes of multiple frozen tasks occurring at the same time, using a linked list, and dynamically adding nodes according to the number of associated objects. Attached Figure Description
[0037] Figure 1 This is a flowchart illustrating a method for storing electricity meter data in one embodiment.
[0038] Figure 2 This is a flowchart illustrating a method for storing electricity meter data in another embodiment;
[0039] Figure 3This is a structural block diagram of an energy meter data storage device in one embodiment;
[0040] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0042] In one embodiment, such as Figure 1 As shown, a method for storing electricity meter data is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0043] Step 102: Obtain the electricity meter freeze task.
[0044] Optionally, the freezing task includes at least one of the following: instantaneous freezing, minute freezing, hourly freezing, daily freezing, settlement day freezing, monthly freezing, tiered settlement freezing, time zone table switching freezing, daily time period table switching freezing, rate and electricity price switching freezing, and tiered switching freezing.
[0045] Step 104: Generate the corresponding flag value based on the frozen task and add the flag value to the array.
[0046] Step 106: Loop through the flag values in the array until the flag value is not 0. Then, add a node to the initial linked list based on the number of associated objects of the frozen task corresponding to the flag value and generate the final linked list. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0047] Optionally, the associated objects of the freeze task include forward active energy, reverse active energy, total forward active energy, total reverse active energy, combined reactive energy 1, combined reactive energy 2, total combined reactive energy 1, total combined reactive energy 2, reactive energy in the first quadrant, reactive energy in the second quadrant, reactive energy in the third quadrant, reactive energy in the fourth quadrant, total reactive energy in the first quadrant, total reactive energy in the second quadrant, total reactive energy in the third quadrant, and total reactive energy in the fourth quadrant. Electrical energy, A-phase forward active energy, B-phase forward active energy, C-phase forward active energy, A-phase reverse active energy, B-phase reverse active energy, C-phase reverse active energy, maximum forward active demand and occurrence time, maximum reverse active demand and occurrence time, A-phase voltage qualification rate, B-phase voltage qualification rate, C-phase voltage qualification rate, monthly electricity consumption, active power, reactive power, active demand, reactive demand, voltage, current, and power factor (at least one of these).
[0048] Step 108: Allocate temporary memory according to the data length, and store the frozen data of the corresponding associated objects into the temporary memory. The data pointer points to the address of the temporary memory.
[0049] Specifically, temporary memory is allocated according to the data length of each associated object, and the corresponding data pointer points to the address of the temporary memory. The frozen data of the corresponding associated object is then stored in the corresponding temporary memory.
[0050] Step 110: Loop through the flag values in the array until the flag value is not 0. Then, traverse the final linked list, determine all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieve the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and store it into the storage device.
[0051] Optionally, the storage device includes at least one of EEPROM, Flash, and disk storage.
[0052] Optionally, after retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the method further includes: step 112, releasing the temporary memory.
[0053] In another embodiment, such as Figure 2 As shown, a method for storing electricity meter data is provided, specifically including:
[0054] Step 202: Obtain the electricity meter freeze task.
[0055] Optionally, at least two of the following freeze tasks may be acquired at the same time: instantaneous freeze, minute freeze, hourly freeze, daily freeze, settlement day freeze, monthly freeze, tiered settlement freeze, time zone table switching freeze, daily time period table switching freeze, rate and electricity price switching freeze, and tiered switching freeze.
[0056] Specifically, in this embodiment, three freezing tasks are obtained: daily freeze, hourly freeze, and minute freeze, generated at 0:00 every day.
[0057] Step 204: Generate the corresponding flag value based on the frozen task and add the flag value to the array.
[0058] Specifically, the flag value for daily freeze tasks is 0x01, the flag value for hourly freeze tasks is 0x02, and the flag value for minute-by-minute freeze tasks is 0x03. These flag values are then added to the array array.
[0059] Step 206: Loop through the flag values in the array until a flag value is not 0. Then, based on the number of associated objects of the frozen task corresponding to the flag value, add a node to the initial linked list and generate the final linked list. The data structure of each node includes the OAD, data length, and data pointer of each associated object, specifically including:
[0060] Step 2061: Loop through the flag values in the array array until a flag value is not 0. Then, add the node of the first frozen task's associated object to the initialization linked list based on the flag value, and update the initialization linked list to the first linked list.
[0061] Specifically, based on the flag value 0x01, add the node of the associated object of the daily freeze task to the initialization linked list, and update the initialization linked list to the first linked list.
[0062] Step 2062: Determine the i-th frozen task based on the flag value, where, and .
[0063] Specifically, the second freeze task is determined to be a freeze at the hour based on the flag value 0x02.
[0064] Step 2063: Traverse the (i-1)th linked list based on the associated object OAD of the i-th frozen task, and determine whether there is an associated object in the i-th frozen task that is different from the associated object in the (i-1)th linked list.
[0065] Specifically, based on the associated object OAD of the second freeze task at the hour, the first linked list is traversed to determine whether there is an associated object in the hour freeze task that is different from the node in the first linked list.
[0066] Step 2064: If they exist, add nodes of different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list remains consistent with the (i-1)th linked list.
[0067] Specifically, if there are different associated objects in the nodes of the first linked list during the second freeze task's hourly freeze, then add the nodes of the different associated objects to the first linked list and update the first linked list to the second linked list; otherwise, the second linked list remains consistent with the first linked list.
[0068] Step 2065: Repeat steps 2062-2064 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list, which is the final linked list.
[0069] Specifically, in this embodiment, n=3, meaning the third freeze task is determined to be a minute freeze based on the flag value 0x03. The second linked list is traversed based on the associated object OAD of the minute freeze task. It is determined whether there are any associated objects in the minute freeze task that are different from those in the nodes of the second linked list. If so, nodes with different associated objects are added to the second linked list, updating it to the third linked list; otherwise, the third linked list remains consistent with the second linked list. At this point, the nodes for the associated objects of the three freeze tasks (daily freeze, hourly freeze, and minute freeze) are added, and the third linked list becomes the final linked list.
[0070] Optionally, the associated objects of the freeze task include forward active energy, reverse active energy, total forward active energy, total reverse active energy, combined reactive energy 1, combined reactive energy 2, total combined reactive energy 1, total combined reactive energy 2, reactive energy in the first quadrant, reactive energy in the second quadrant, reactive energy in the third quadrant, reactive energy in the fourth quadrant, total reactive energy in the first quadrant, total reactive energy in the second quadrant, total reactive energy in the third quadrant, and total reactive energy in the fourth quadrant. Electrical energy, A-phase forward active energy, B-phase forward active energy, C-phase forward active energy, A-phase reverse active energy, B-phase reverse active energy, C-phase reverse active energy, maximum forward active demand and occurrence time, maximum reverse active demand and occurrence time, A-phase voltage qualification rate, B-phase voltage qualification rate, C-phase voltage qualification rate, monthly electricity consumption, active power, reactive power, active demand, reactive demand, voltage, current, and power factor (at least one of these).
[0071] Step 208: Allocate temporary memory according to the data length, and store the frozen data of the corresponding associated objects into the temporary memory. The data pointer points to the address of the temporary memory.
[0072] Specifically, the final linked list includes nodes of the associated objects for the three freezing tasks: daily freeze, hourly freeze, and minute freeze. Temporary memory is allocated according to the data length of each associated object, and the corresponding data pointer points to the address of the temporary memory. The frozen data of the corresponding associated object is then stored in the corresponding temporary memory.
[0073] Step 210: Loop through the flag values in the array until the flag value is not 0. Then, traverse the final linked list, determine all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieve the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and store it into the storage device.
[0074] Specifically, the flag values in the array are checked in a loop until a flag value is not 0. Then, the final linked list is traversed, and the associated objects of the daily freeze task corresponding to flag value 0x01, the hourly freeze task corresponding to flag value 0x02, and the minute freeze task corresponding to flag value 0x03 are determined according to the OAD. The frozen data of the associated objects of the daily freeze task, the hourly freeze task, and the minute freeze task are obtained from the corresponding temporary memory according to the data pointer of the associated object, and the frozen data of the associated objects of the minute freeze task are stored in the storage device respectively.
[0075] Optionally, the storage device includes at least one of EEPROM, Flash, and disk storage.
[0076] Optionally, after retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the method further includes: step 212, releasing the temporary memory.
[0077] The above embodiments solve the problem of excessive memory usage by using linked lists to dynamically add nodes based on the number of associated objects, and achieve the beneficial effect of ensuring data source consistency.
[0078] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0079] Based on the same inventive concept, this application also provides an energy meter data storage device for implementing the above-described energy meter data storage method. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more energy meter data storage device embodiments provided below can be found in the above-described limitations of the energy meter data storage method, and will not be repeated here.
[0080] In one embodiment, such as Figure 3 As shown, an energy meter data storage device is provided, comprising:
[0081] The acquisition module is used to acquire electricity meter freezing tasks;
[0082] The flag value generation module is used to generate corresponding flag values based on the frozen tasks and add the flag values to an array;
[0083] The final linked list generation module is used to iteratively check the flag values in the array until the flag value is not 0. Then, based on the number of associated objects of the frozen task corresponding to the flag value, nodes are added to the initial linked list and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0084] The temporary storage module is used to request temporary memory based on the data length and store the frozen data of the corresponding associated objects into the temporary memory. The data pointer points to the address of the temporary memory.
[0085] The associated object determination module is used to iterate through the flag values in the array until the flag value is not 0. Then, it traverses the final linked list and determines all associated objects of the frozen task corresponding to the flag value based on the OAD.
[0086] The data storage module is used to retrieve the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and store it into the storage device.
[0087] Each module in the aforementioned electricity meter data storage device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0088] In one embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows: Figure 4As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores the acquired frozen data from the electricity meter. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for storing electricity meter data.
[0089] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0090] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0091] Obtain the task of freezing the electricity meter;
[0092] Generate corresponding flag values based on the frozen tasks, and add the flag values to the array;
[0093] The flag values in the array are checked in a loop until the flag value is not 0. Then, nodes are added to the initial linked list according to the number of associated objects of the frozen task corresponding to the flag value, and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0094] Allocate temporary memory based on the data length, store the frozen data of the corresponding associated objects into the temporary memory, and let the data pointer point to the address of the temporary memory;
[0095] The algorithm iterates through the array to check the flag values until a flag value is not zero. Then, it traverses the final linked list, determines all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieves the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointers of the associated objects and stores it into the storage device.
[0096] In one embodiment, the processor, when executing a computer program, also implements:
[0097] After retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the temporary memory is released.
[0098] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0099] S1, add the node of the associated object of the first frozen task to the initialization linked list according to the flag value, and update the initialization linked list to the first linked list;
[0100] S2, determine the i-th frozen task based on the flag value, where... and ;
[0101] S3, based on the OAD of the associated object of the i-th frozen task, traverse the (i-1)-th linked list and determine whether there is an associated object in the i-th frozen task that is different from the node in the (i-1)-th linked list.
[0102] S4. If it exists, add nodes of different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list is consistent with the (i-1)th linked list.
[0103] S5. Repeat steps S2-S4 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list. The nth linked list is the final linked list.
[0104] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0105] Traverse the final linked list and determine all associated objects of the frozen task corresponding to different flag values based on the OAD;
[0106] Based on the data pointer of the associated object, the frozen data of the associated object of the frozen task corresponding to different flag values is obtained from the corresponding temporary memory and stored in the storage device respectively.
[0107] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0108] Obtain the task of freezing the electricity meter;
[0109] Generate corresponding flag values based on the frozen tasks, and add the flag values to the array;
[0110] The flag values in the array are checked in a loop until the flag value is not 0. Then, nodes are added to the initial linked list according to the number of associated objects of the frozen task corresponding to the flag value, and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0111] Allocate temporary memory based on the data length, store the frozen data of the corresponding associated objects into the temporary memory, and let the data pointer point to the address of the temporary memory;
[0112] The algorithm iterates through the array to check the flag values until a flag value is not zero. Then, it traverses the final linked list, determines all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieves the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointers of the associated objects and stores it into the storage device.
[0113] In one embodiment, the processor, when executing a computer program, also implements:
[0114] After retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the temporary memory is released.
[0115] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0116] S1, add the node of the associated object of the first frozen task to the initialization linked list according to the flag value, and update the initialization linked list to the first linked list;
[0117] S2, determine the i-th frozen task based on the flag value, where... and ;
[0118] S3, based on the OAD of the associated object of the i-th frozen task, traverse the (i-1)-th linked list and determine whether there is an associated object in the i-th frozen task that is different from the node in the (i-1)-th linked list.
[0119] S4. If it exists, add nodes of different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list is consistent with the (i-1)th linked list.
[0120] S5. Repeat steps S2-S4 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list. The nth linked list is the final linked list.
[0121] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0122] Traverse the final linked list and determine all associated objects of the frozen task corresponding to different flag values based on the OAD;
[0123] Based on the data pointer of the associated object, the frozen data of the associated object of the frozen task corresponding to different flag values is obtained from the corresponding temporary memory and stored in the storage device respectively.
[0124] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0125] Obtain the task of freezing the electricity meter;
[0126] Generate corresponding flag values based on the frozen tasks, and add the flag values to the array;
[0127] The flag values in the array are checked in a loop until the flag value is not 0. Then, nodes are added to the initial linked list according to the number of associated objects of the frozen task corresponding to the flag value, and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object.
[0128] Allocate temporary memory based on the data length, store the frozen data of the corresponding associated objects into the temporary memory, and let the data pointer point to the address of the temporary memory;
[0129] The algorithm iterates through the array to check the flag values until a flag value is not zero. Then, it traverses the final linked list, determines all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieves the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointers of the associated objects and stores it into the storage device.
[0130] In one embodiment, the processor, when executing a computer program, also implements:
[0131] After retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the temporary memory is released.
[0132] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0133] S1, add the node of the associated object of the first frozen task to the initialization linked list according to the flag value, and update the initialization linked list to the first linked list;
[0134] S2, determine the i-th frozen task based on the flag value, where... and ;
[0135] S3, based on the OAD of the associated object of the i-th frozen task, traverse the (i-1)-th linked list and determine whether there is an associated object in the i-th frozen task that is different from the node in the (i-1)-th linked list.
[0136] S4. If it exists, add nodes of different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list is consistent with the (i-1)th linked list.
[0137] S5. Repeat steps S2-S4 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list. The nth linked list is the final linked list.
[0138] In one embodiment, when there are two or more frozen tasks at the same time, the processor also implements the following when executing a computer program:
[0139] Traverse the final linked list and determine all associated objects of the frozen task corresponding to different flag values based on the OAD;
[0140] Based on the data pointer of the associated object, the frozen data of the associated object of the frozen task corresponding to different flag values is obtained from the corresponding temporary memory and stored in the storage device respectively.
[0141] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0142] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0143] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0144] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for storing electricity meter data, characterized in that, The method includes: Obtain the task of freezing the electricity meter; Generate a corresponding flag value based on the frozen task, and add the flag value to an array; The flag values in the array are checked in a loop until the flag value is not 0. Then, nodes are added to the initial linked list according to the number of associated objects of the frozen task corresponding to the flag value, and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object. Request temporary memory based on the data length, and store the frozen data of the corresponding associated objects into the temporary memory. The data pointer points to the address of the temporary memory. The flag values in the array are checked in a loop until the flag value is not 0. Then, the final linked list is traversed, and all associated objects of the frozen task corresponding to the flag value are determined according to the OAD. The frozen data of the associated objects of the frozen task is obtained from the corresponding temporary memory according to the data pointer of the associated object and stored in the storage device. After retrieving the frozen data of the associated object of the frozen task from the corresponding temporary memory based on the data pointer of the associated object and storing it in the storage device, the method further includes: releasing the temporary memory; The electricity meter freezing task includes at least one of the following: instantaneous freezing, minute freezing, hourly freezing, daily freezing, settlement day freezing, monthly freezing, tiered settlement freezing, time zone meter switching freezing, daily time period meter switching freezing, rate electricity price switching freezing, and tiered switching freezing.
2. The method according to claim 1, characterized in that, The associated objects of the freezing task include forward active energy, reverse active energy, total forward active energy, total reverse active energy, combined reactive energy 1, combined reactive energy 2, total combined reactive energy 1, total combined reactive energy 2, reactive energy in the first quadrant, reactive energy in the second quadrant, reactive energy in the third quadrant, reactive energy in the fourth quadrant, total reactive energy in the first quadrant, total reactive energy in the second quadrant, total reactive energy in the third quadrant, and total reactive energy in the fourth quadrant. The following are considered as energy, positive active energy of phase A, positive active energy of phase B, positive active energy of phase C, negative active energy of phase A, negative active energy of phase B, negative active energy of phase C, maximum positive active demand and occurrence time, maximum negative active demand and occurrence time, voltage qualification rate of phase A, voltage qualification rate of phase B, voltage qualification rate of phase C, monthly electricity consumption, active power, reactive power, active demand, reactive demand, voltage, current and power factor.
3. The method according to claim 1, characterized in that, The storage device includes at least one of EEPROM, Flash, and disk storage.
4. The method according to any one of claims 1-3, characterized in that, When there are two or more frozen tasks at the same time, the step of adding nodes to the initial linked list and generating the final linked list according to the number of associated objects of the frozen tasks corresponding to the flag value includes: S1, add the node of the associated object of the first frozen task to the initialization linked list according to the flag value, and update the initialization linked list to the first linked list; S2, determine the i-th frozen task based on the flag value, wherein... and ; S3, based on the OAD of the associated object of the i-th frozen task, traverse the (i-1)-th linked list to determine whether there is an associated object in the i-th frozen task that is different from the associated object in the node of the (i-1)-th linked list; S4, if they exist, add the nodes of the different associated objects to the (i-1)th linked list and update the (i-1)th linked list to the i-th linked list; otherwise, the i-th linked list remains consistent with the (i-1)th linked list. S5. Repeat steps S2-S4 until the node addition of the associated object of the nth frozen task is completed, and update to obtain the nth linked list, which is the final linked list.
5. The method according to any one of claims 1-3, characterized in that, When there are two or more frozen tasks at the same time, the process of traversing the final linked list, determining all associated objects of the frozen task corresponding to the flag value based on the OAD, and retrieving the frozen data of the associated objects of the frozen task from the corresponding temporary memory based on the data pointers of the associated objects and storing them in the storage device includes: Traverse the final linked list and determine all associated objects of the frozen task corresponding to different flag values based on the OAD; Based on the data pointer of the associated object, the frozen data of the associated object of the frozen task corresponding to the different flag values is obtained from the corresponding temporary memory and stored in the storage device respectively.
6. A data storage device for an electricity meter, characterized in that, The apparatus implements the steps of the method according to any one of claims 1 to 5, the apparatus comprising: The acquisition module is used to acquire electricity meter freezing tasks; The flag value generation module is used to generate a corresponding flag value based on the frozen task and add the flag value to an array; The final linked list generation module is used to iteratively judge the flag values in the array until the flag value is not 0. Then, according to the number of associated objects of the frozen task corresponding to the flag value, a node is added to the initial linked list and the final linked list is generated. The data structure of each node includes the OAD, data length and data pointer of each associated object. A temporary storage module is used to request temporary memory according to the data length and store the frozen data of the corresponding associated objects into the temporary memory, wherein the data pointer points to the address of the temporary memory; The associated object determination module is used to iteratively judge the flag values in the array until the flag value is not 0, then traverse the final linked list and determine all associated objects of the frozen task corresponding to the flag value according to the OAD. The data storage module is used to retrieve the frozen data of the associated object of the frozen task from the corresponding temporary memory according to the data pointer of the associated object and store it into the storage device.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Intelligent electric meter segmented freezing data storage method and device and intelligent electric meter segmented freezing data query method and device
CN109614447A
Object memory interfaces across shared links
US20170160963A1