CN116204684B - Storage method, device, equipment and medium of electric energy meter - Google Patents

Storage method, device, equipment and medium of electric energy meter Download PDF

Info

Publication number
CN116204684B
CN116204684B CN202310103649.5A CN202310103649A CN116204684B CN 116204684 B CN116204684 B CN 116204684B CN 202310103649 A CN202310103649 A CN 202310103649A CN 116204684 B CN116204684 B CN 116204684B
Authority
CN
China
Prior art keywords
node
unit time
period
timestamp
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310103649.5A
Other languages
Chinese (zh)
Other versions
CN116204684A (en
Inventor
丁文豪
郭永娟
顾志勇
蒋紫松
宫金超
王佳琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Chint Instrument and Meter Co Ltd
Original Assignee
Zhejiang Chint Instrument and Meter Co Ltd
Filing date
Publication date
Application filed by Zhejiang Chint Instrument and Meter Co Ltd filed Critical Zhejiang Chint Instrument and Meter Co Ltd
Priority to CN202310103649.5A priority Critical patent/CN116204684B/en
Publication of CN116204684A publication Critical patent/CN116204684A/en
Application granted granted Critical
Publication of CN116204684B publication Critical patent/CN116204684B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a storage method, a device, equipment and a medium of an electric energy meter, wherein the method comprises the following steps: when the electric energy data are acquired in the first unit time, the electric parameters are stored in a preset storage position; when the first unit time is determined to be the first unit time in the belonging period, a storage address corresponding to the electric parameter at a preset storage position is acquired; adding nodes in a pre-constructed linked list, and configuring state bits with the same number as the unit time in a period in the nodes; storing a first timestamp, a storage sequence number and a storage address in the node; updating initial state information of a state bit corresponding to the first unit time into preset state information; when the first unit time is determined to be not the first unit time in the period to which the first unit time belongs according to the first timestamp, searching a node corresponding to the period from the linked list based on the first timestamp; when the node exists, the initial state information of the state bit corresponding to the first time stamp in the node is updated to be preset state information.

Description

Storage method, device, equipment and medium of electric energy meter
Technical Field
The invention relates to the technical field of electric energy meters, in particular to a storage method, a storage device and a storage medium of an electric energy meter.
Background
The electric energy meter is used as important electric energy metering and bears important tasks of electric energy data acquisition, metering and transmission. Along with the development of electric energy meter technology, the electric energy meter has higher and higher requirements on data storage. If the power data takes 1 minute as the update period, 525600 pieces of power data will be available in 1 year, each piece of power data will occupy a plurality of bytes, and thus, the power data will occupy a huge storage space when accumulated.
Therefore, how to greatly reduce the space for data storage is a problem that needs to be solved at present.
Disclosure of Invention
Therefore, the technical problem to be solved by the invention is to overcome the defect of large occupied storage space of data in the prior art, thereby providing a storage method, a device, equipment and a medium of the electric energy meter.
In a first aspect, the present invention provides a storage method for an electric energy meter, comprising:
When electric energy data are acquired in a first unit time, storing the electric parameters in a preset storage position, wherein the electric energy data comprise acquisition parameters and electric parameters, and the acquisition parameters comprise first time stamps and storage serial numbers corresponding to the first unit time; when the first unit time is determined to be the first unit time in a period to which the first unit time belongs according to the first timestamp, a storage address corresponding to the electric parameter at a preset storage position is acquired, wherein the period comprises a plurality of unit times, and the first unit time is any one of the unit times; adding nodes in a pre-constructed linked list, and configuring state bits with the same number as the unit time in a period in the nodes; storing a first timestamp, a storage sequence number, and a storage address in the node; updating initial state information of a state bit corresponding to the first unit time into preset state information, and setting a storage address as a first address of a node; or when the first unit time is determined not to be the first unit time in the period to which the first unit time belongs according to the first time stamp, searching a node corresponding to the period from the linked list based on the first time stamp; when the node exists, the initial state information of the state bit corresponding to the first time stamp in the node is updated to be preset state information.
After acquiring one piece of electric energy data, the invention stores the data content in the electric energy data in two parts, stores the electric parameters in a preset storage position and stores the acquisition parameters in the nodes of the linked list. Because the acquisition parameters among the electric energy data are regularly and circularly available, the acquisition parameters and the storage positions corresponding to the electric energy data acquired in the residual unit time can be deduced according to the rules only by storing the acquisition parameters corresponding to the first unit time in one period and the storage addresses of the electric parameters in one node. For example, one piece of electric energy data occupies 15 bytes in total, wherein the time stamp occupies 7 bytes, the storage sequence number occupies 4 bytes, and the electric parameter occupies 4 bytes. If the existing storage mode is adopted, the storage of 8 pieces of electric energy data requires 120 bytes of space. If the storage method provided by the scheme is adopted, 8 pieces of electric energy data are stored in two parts, (1) the first part is that the electric parameter parts of the 8 pieces of electric energy data are stored in preset storage positions, 4 bytes are occupied by the electric parameter in each piece of electric energy data, and then 32 bytes are occupied by the 8 electric parameters corresponding to the 8 pieces of electric energy data in total. (2) The second part is to store the acquisition parameter part of the first electric energy data in the 8 electric energy data in the pre-constructed linked list nodes, wherein the acquisition parameter of the first electric energy data occupies 11 bytes. Meanwhile, the node also stores 8 state bits corresponding to the storage address of the first electric parameter at the preset storage position and 8 electric energy data, the storage address occupies 4 bytes, each state bit occupies 1 bit, and 8 state bits correspond to 8 bits, namely 1 byte. Therefore, by adopting the storage method provided by the scheme, the space for storing 8 pieces of electric energy data is as follows: 32+11+4+1=48 bytes. Compared with 120 bytes occupied by the existing storage mode, the storage method provided by the invention can greatly reduce the space occupied by data, and the effect is particularly obvious when the data volume is increased.
With reference to the first aspect, in a first embodiment of the first aspect, after adding a node to the pre-constructed linked list and configuring the same number of status bits as the number of unit times in the period in the node, the method further includes:
and establishing a mapping relation between the second time stamp of the first piece of data in the period and the node.
With reference to the first aspect, in a second embodiment of the first aspect, when it is determined according to the first timestamp that the first unit time is not the first unit time in the period to which the first unit time belongs, searching, based on the first timestamp, a node corresponding to the period from the linked list includes:
Judging the period of the first unit time corresponding to the first time stamp based on the first time stamp; determining a second timestamp of the first piece of data in the period; searching the node corresponding to the second timestamp from the linked list according to the mapping relation between the second timestamp and the node; when the node exists, the node is taken as the node corresponding to the period to which the first unit time belongs.
With reference to the first aspect, in a third embodiment of the first aspect, the method further includes:
When the node does not exist, a storage address corresponding to the electric parameter at a preset storage position is obtained; judging the period of the first unit time corresponding to the first time stamp based on the first time stamp; determining a second timestamp of the first piece of data in the period; adding a node in the linked list, and configuring a preset number of status bits in the node; storing the second time stamp and the storage address in the node, modifying the initial state information of the state bit corresponding to the first time stamp into preset state information, taking the second time stamp as the initial time stamp of the node, and taking the storage address as the head address of the node.
With reference to the first aspect, in a fourth embodiment of the first aspect, when the data search instruction is received, determining the presence state of the electrical parameter based on the data search instruction further includes:
reading a data searching instruction, and extracting a target time stamp from the data searching instruction; searching a target node corresponding to a target period from the linked list based on the target timestamp, wherein the target period is a storage period to which a target unit time corresponding to the target timestamp belongs; acquiring an initial time stamp of a target node; determining the offset of the target unit time in the period based on the target time stamp, the initial time stamp and the duration of the target unit time; starting with a first state bit in a target node and taking the offset as a moving distance, determining state information on the state bit corresponding to the target timestamp; and comparing the state information with preset state information, and determining the existence state of the electric parameter corresponding to the target timestamp based on the comparison result.
With reference to the first aspect, in a fifth embodiment of the first aspect, when the electrical parameter exists, acquiring the electrical parameter corresponding to the target timestamp, further includes:
acquiring state information on all state bits before the state bit corresponding to the target timestamp;
counting the number of state bits with state information on all the state bits being preset state information, and determining the number as effective data quantity;
Calculating a target storage address corresponding to the target electric energy data based on the head address and the effective data quantity; and acquiring an electric parameter corresponding to the target timestamp from a preset storage position based on the target storage address.
With reference to the first aspect, in a sixth embodiment of the first aspect, when the electric energy meter time is changed from the first time to the second time, the method further includes:
Searching a first node from the linked list based on the first moment, and searching a second node from the linked list based on the second moment, wherein the first node is a node corresponding to a period to which the first moment belongs, and the second node is a node corresponding to a period to which the second moment belongs; screening out the state bits corresponding to each unit time between the first time and the second time from all the state bits contained in the first node and the second node; and modifying the initial state information on all the screened state bits into initial state information.
In a second aspect, the present invention provides a storage device for an electric energy meter, comprising:
the first storage module is used for storing the electric parameters in a preset storage position when the electric energy data are acquired in the first unit time, wherein the electric energy data comprise acquisition parameters and electric parameters, and the acquisition parameters comprise first time stamps and storage serial numbers corresponding to the first unit time; the acquisition module is used for acquiring a storage address corresponding to the electric parameter at a preset storage position when the first unit time is determined to be the first unit time in a period to which the first unit time belongs according to the first time stamp, wherein the period comprises a plurality of unit times, and the first unit time is any one of the unit times; the configuration module is used for adding nodes in the pre-constructed linked list and configuring the status bits with the same number as the unit time in the period in the nodes; the second storage module is used for storing the first time stamp, the storage sequence number and the storage address in the node; the first updating module is used for updating the initial state information of the state bit corresponding to the first unit time into preset state information and setting the storage address as the head address of the node; the searching module is used for searching the node corresponding to the period from the linked list based on the first time stamp or when the first unit time is determined not to be the first unit time in the period to which the first unit time belongs according to the first time stamp; and the second updating module is used for updating the initial state information of the state bit corresponding to the first time stamp in the node into preset state information when the node exists.
In a third aspect, the present invention provides a computer device comprising: the memory is in communication with the processor, and is configured to store a computer program that, when executed by the processor, causes the processor to perform a method for storing an electric energy meter according to any of the preceding claims.
In a fourth aspect, the present invention provides a computer readable storage medium for storing computer instructions which, when executed by a processor, implement a storage method for an electric energy meter as in any of the summary of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a storage method for an electric energy meter according to an embodiment of the present invention;
FIG. 2 is a connection diagram of a storage device for an electric energy meter according to an embodiment of the present invention;
Fig. 3 is a connection diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention discloses a storage method for an electric energy meter, which is shown in fig. 1 and comprises the following steps:
S11: when the electric energy data are acquired in the first unit time, the electric parameters are stored in a preset storage position.
Specifically, the first unit time is a fixed duration, and the duration is determined by the data update period. The electric energy data comprises acquisition parameters and electric parameters, wherein the acquisition parameters comprise a first timestamp and a storage sequence number corresponding to a first unit time. The electric parameter is a common electric parameter.
For example, if the data update period of the power data is one minute, the first unit time is one minute; if the data update period of the power data is five minutes, the first unit time is 5 minutes.
Illustratively, taking a data update period as an example of one minute, after one piece of power data is acquired within one minute, the one piece of power data is read. The electric energy data comprises acquisition parameters and electric parameters, wherein the acquisition parameters comprise a time stamp (namely a first time stamp) and a storage sequence number, the time stamp is the acquisition time corresponding to the current electric energy data, and the storage sequence number is the current electric energy meter, and the electric energy meter updates the number of data from the beginning of being put into use. The electric parameters comprise data such as electric energy, electric power and the like corresponding to the first time stamp. When the electric energy data are acquired in the first unit time, the electric parameters are stored in a preset storage position, and the preset storage position is specially used for storing all the electric parameters updated in each unit time in a certain time period.
S12: when the first unit time is determined to be the first unit time in the period to which the first unit time belongs according to the first timestamp, a storage address corresponding to the electric parameter at a preset storage position is acquired.
Specifically, the period includes a plurality of unit times, and the first unit time is any one of the plurality of unit times. The period herein refers to a storage period of data.
Illustratively, in the present embodiment, the unit time is one minute and the period is one day, and 1440 units of time are included in one period, i.e., one day. When one piece of electric energy data is obtained, a time stamp (namely a first time stamp) corresponding to the piece of electric energy data is read. Assuming that the time stamp is 2022/12/13/0:00, when the unit time of the time stamp is the first unit time in the belonging period (2022/12/13 day), the storage address corresponding to the electric parameter corresponding to the time stamp in the preset storage position is acquired.
S13: nodes are added in the pre-constructed linked list, and the same number of state bits as the unit time in the period are configured in the nodes.
Specifically, when the unit time corresponding to the time stamp of the obtained electric energy data is the first unit time in the belonging period, a node is added in the pre-constructed linked list, and the newly added node is configured with the same number of state bits as the unit time contained in the one period, and the state information on the state bits is used for indicating whether the electric parameters exist in the unit time corresponding to the state bits.
For example, in the above embodiment, the time stamp of the obtained electric energy data is 2022/12/13/0:00, that is, the unit time corresponding to the time stamp is the first unit time in the period of the corresponding electric energy data can be determined, then a node is newly added in the constructed linked list, 1440 status bits are configured in the node, and the initial status information is configured on each status bit, and the initial status information can be configured to be 0. The state information on the state bit is used for indicating the existence state of the electric energy data in the unit time corresponding to the state bit, the initial state information indicates that the electric energy data does not exist in the unit time corresponding to the state bit, and when the electric energy data exists in the unit time corresponding to the state bit, the initial state information needs to be modified.
S14: a first timestamp, a storage sequence number, and a storage address are stored in the node.
Specifically, when the unit time corresponding to the obtained timestamp of the electric energy data is the first unit time in the period, the first timestamp, the storage sequence number and the storage address are stored in the node.
S15: the initial state information of the state bit corresponding to the first unit time is updated to be preset state information, and the storage address is set as the head address of the node.
Illustratively, after storing the first timestamp, the storage sequence number, and the storage address in the node, the initial state information 0 on the state bit corresponding to the first unit time needs to be updated to the preset state information 1. Wherein 0 indicates that no electrical parameter exists in unit time, and 1 indicates that an electrical parameter exists in unit time. The change of the state information of the state bit is convenient for the follow-up when searching the electric parameter corresponding to a certain moment, the existence state of the electric parameter can be determined according to the state information on the state bit corresponding to the moment, and then whether the corresponding data need to be searched further or not is judged according to the existence state of the electric parameter.
S16: or when the first unit time is determined not to be the first unit time in the period to which the first unit time belongs according to the first time stamp, searching the node corresponding to the period from the linked list based on the first time stamp.
For example, assuming that the time stamp in the electric energy data acquired in this embodiment is 2022/12/13/8:35, it may be determined based on the time stamp that the first unit time corresponding to the time stamp is not the first unit time in the period to which the unit time belongs, and at this time, it is necessary to first search, based on the time stamp, a node corresponding to the period to which the unit time belongs from the pre-constructed linked list.
S17: when the node exists, the initial state information of the state bit corresponding to the first time stamp in the node is updated to be preset state information.
Specifically, when the node exists in the linked list, a state bit corresponding to the unit time of the timestamp is found in the state bit of the node, and the initial state information on the state bit is updated to be the client case number
And presetting state information.
After acquiring one piece of electric energy data, the invention stores the data content in the electric energy data in two parts, stores the electric parameters in a preset storage position and stores the acquisition parameters in the nodes of the linked list. Because the acquisition parameters among the electric energy data are regularly and circularly available, the acquisition parameters and the storage positions corresponding to the electric energy data acquired in the residual unit time can be deduced according to the rules only by storing the acquisition parameters corresponding to the first unit time in one period and the storage addresses of the electric parameters in one node. For example, one piece of electric energy data occupies 15 bytes in total, wherein the time stamp occupies 7 bytes, the storage sequence number occupies 4 bytes, and the electric parameter occupies 4 bytes. If the existing storage mode is adopted, the storage of 8 pieces of electric energy data requires 120 bytes of space. If the storage method provided by the scheme is adopted, 8 pieces of electric energy data are stored in two parts, (1) the first part is that the electric parameter parts of the 8 pieces of electric energy data are stored in preset storage positions, 4 bytes are occupied by the electric parameter in each piece of electric energy data, and then 32 bytes are occupied by the 8 electric parameters corresponding to the 8 pieces of electric energy data in total. (2) The second part is to store the acquisition parameter part of the first electric energy data in the 8 electric energy data in the pre-constructed linked list nodes, wherein the acquisition parameter of the first electric energy data occupies 11 bytes. Meanwhile, the node also stores 8 state bits corresponding to the storage address of the first electric parameter at the preset storage position and 8 electric energy data, the storage address occupies 4 bytes, each state bit occupies 1 bit, and 8 state bits correspond to 8 bits, namely 1 byte. Therefore, by adopting the storage method provided by the scheme, the space for storing 8 pieces of electric energy data is as follows: 32+11+4+1=48 bytes. Compared with 120 bytes occupied by the existing storage mode, the storage method provided by the invention can greatly reduce the space occupied by data, and the effect is particularly obvious when the data volume is increased.
In an alternative embodiment, after adding nodes in the pre-constructed linked list and configuring the same number of status bits as the unit time in the period in the nodes, the method further includes:
and establishing a mapping relation between the second time stamp of the first piece of data in the period and the node.
Illustratively, the first data in a cycle refers to the power data acquired in the first unit of time in the cycle. After the same number of status bits as the number of unit times in the period are configured in the node, a second timestamp corresponding to the first piece of data may be used as an initial timestamp of the node.
In an alternative embodiment, when it is determined according to the first timestamp that the first unit time is not the first unit time in the period to which the first unit time belongs, searching for a node corresponding to the period from the linked list based on the first timestamp includes:
Judging the period of the first unit time corresponding to the first time stamp based on the first time stamp; determining a second timestamp of the first piece of data in the period; searching the node corresponding to the second timestamp from the linked list according to the mapping relation between the second timestamp and the node; when the node exists, the node is taken as the node corresponding to the period to which the first unit time belongs.
Illustratively, in the present embodiment, the unit time is one minute and the period is one day. When the first time stamp corresponding to the obtained piece of electric energy data is 2022/12/13/8:35, since the unit time corresponding to the first time stamp is not the first unit time in one day, at this time, the period to which the unit time corresponding to the first time stamp belongs may be determined according to the first time stamp 2022/12/13/8:35, that is, 2022/12/13. Then, according to the judged period, determining that the second timestamp of the first piece of data in the period is 2022/12/13/0:00. from the mapping relationship between the second timestamp and the node, it can be known that the second timestamp 2022/12/13/0:00 is the initial timestamp of the node. Finally, the second timestamp may be used as an index, and the initial timestamp is 2022/12/13/0 from the linked list: and a node of 00, when the node exists, the node is taken as the node corresponding to the period to which the first unit time belongs.
In an optional embodiment, when it is determined according to the first timestamp that the first unit time is not the first unit time in the period to which the first unit time belongs, and based on the first timestamp, the node corresponding to the period is not found in the linked list, the method further includes:
When the node does not exist, a storage address corresponding to the electric parameter at a preset storage position is obtained; judging the period of the first unit time corresponding to the first time stamp based on the first time stamp; determining a second timestamp of the first piece of data in the period; adding a node in the linked list, and configuring a preset number of status bits in the node; storing the second time stamp and the storage address in the node, modifying the initial state information of the state bit corresponding to the first time stamp into preset state information, taking the second time stamp as the initial time stamp of the node, and taking the storage address as the head address of the node.
Illustratively, in the present embodiment, the unit time is one minute and the period is one day. As in 2022/12/13, a power outage event occurs, with the power outage time ranging from zero in the morning to eight am. When a power is received at eight am, one piece of power data is updated, and the first timestamp corresponding to the piece of power data is 2022/12/13/8:01, because the piece of power data is not the power data acquired in the first unit time of the day, after the piece of power data is acquired, and the electric parameters in the piece of power data are stored in a preset storage position, the node corresponding to the day needs to be searched from the linked list. The power failure may be due to the fact that no power data is obtained in the first unit time of the day, and thus no node corresponding to the day exists in the linked list.
Therefore, when the first unit time is determined not to be the first unit time in the period to which the first unit time belongs according to the first timestamp, and the node corresponding to the period is not found from the linked list based on the first timestamp, the storage address corresponding to the electric parameter in the electric energy data at the preset storage position is acquired first. Next, the period to which the unit time corresponding to the first time stamp belongs, that is, 2022/12/13 is determined according to the first time stamp 2022/12/13/8:01 of the piece of electric energy data. And determining that the second timestamp of the first piece of data in the period is 2022/12/13/0 according to the judged period: 00. finally, a new node is added to the linked list, 1440 status bits are configured in the node, and a second timestamp 2022/12/13/0 is obtained: the storage address of the electrical parameter corresponding to 00 and the first timestamp in the preset storage position is stored in the newly added node, and meanwhile, the initial state information 0 on the state bit corresponding to the first timestamp 2022/12/13/8:01 is modified into preset state information 1. And second timestamp 2022/12/13/0:00 is used as an initial time stamp of the newly added node, and a storage address corresponding to the electric parameter is used as a head address of the newly added node.
In an alternative embodiment, after receiving the data search instruction, determining the existence state of the electrical parameter based on the data search instruction further includes:
S21: and reading the data searching instruction, and extracting the target time stamp from the data searching instruction.
Specifically, the target timestamp refers to a timestamp corresponding to the power data to be searched.
S22: and searching out the target node corresponding to the target period from the linked list based on the target timestamp.
Specifically, the target period is a storage period to which the target unit time corresponding to the target timestamp belongs.
Illustratively, if the target time stamp is 2022/12/15/17:32, the period of the unit time corresponding to the target time stamp, that is 2022/12/15, is determined based on the target time stamp. The second timestamp 2022/12/15/0:00 of the first piece of data in the period is determined, the second timestamp is taken as an index, the node with the initial timestamp 2022/12/15/0:00 is searched from the pre-constructed linked list, and when the node is searched, the node is determined to be a target node.
S23: an initial timestamp of the target node is obtained.
S24: the offset of the target unit time in the period is determined based on the target time stamp, the initial time stamp, and the duration of the target unit time.
For example, the target time stamp is 2022/12/15/17:32, the initial time stamp of the target node is 2022/12/15/0:00, the number of minutes between the two time stamps can be determined to be 1052 based on the target time stamp and the initial time stamp, and the duration of the target unit time is 1 minute, which is equivalent to the target unit time corresponding to the target time stamp being the 1052 nd unit time in the affiliated period, namely, the offset is 1052.
S25: the state information on the state bit corresponding to the target timestamp is determined starting with the first state bit in the target node and using the offset as the movement distance.
Illustratively, 1440 status bits are included in the target node, starting with (including) the first status bit, moving 1052 status bits, determining the 1052 th status bit as the status bit corresponding to the target timestamp 2022/12/15/17:32, and determining the status information on the status bit as the target status information.
S26: and comparing the state information with preset state information, and determining the existence state of the electric parameter corresponding to the target timestamp based on the comparison result.
Specifically, the preset state information is state information on a corresponding state bit when the electric parameter exists.
For example, in the present embodiment, the state information is 0 or 1,0 indicates that the electrical parameter is not present, and 1 indicates that the electrical parameter is present, and thus the preset state information is 1. Comparing the target state information with preset state information, when the target state information is 1, indicating that the electric parameter corresponding to the target time stamp exists, and when the target state information is not 1, indicating that the electric parameter corresponding to the target time stamp does not exist, and no query operation is needed.
In an alternative embodiment, when the electrical parameter exists, acquiring the electrical parameter corresponding to the target timestamp, and further including:
s31: and acquiring state information on all the state bits before the state bit corresponding to the target timestamp.
For example, still in the above embodiment, the state bit corresponding to the target timestamp is the 1052 th state bit, and when the electrical parameter corresponding to the target timestamp exists, the state information on each state bit before the 1052 nd state bit is acquired.
S32: and counting the number of the state bits, of which the state information on all the state bits is preset state information, and determining the number as the effective data quantity.
Illustratively, the number of state bits whose state information matches the preset state information on the previous 1051 state bits is counted, and the number of counted ends is the number of valid data existing in the present period, that is, the valid data amount, before the target state bit.
S33: and calculating a target storage address corresponding to the target electric energy data based on the head address and the effective data quantity.
Specifically, the target storage address=the head address+the effective data amount.
Illustratively, since the 1000 valid data amounts are counted before the 1052 nd state bit and the 1052 nd state bit is also valid, in this cycle, there are 1001 valid data pieces in total, which corresponds to 1001 electrical parameters stored in a preset storage location. Assuming that the storage address corresponding to the first electrical parameter is 0001, the storage address corresponding to the 1001 st electrical parameter is 0001+1000=1001, and 1001 is the target storage address.
S34: and acquiring an electric parameter corresponding to the target timestamp from a preset storage position based on the target storage address.
Specifically, after the target storage address is determined, the electric parameter corresponding to the target timestamp can be obtained from the preset storage position according to the target storage address.
In an alternative embodiment, when the electric energy meter time is changed from the first time to the second time, the method further comprises:
Searching a first node from the linked list based on the first moment, and searching a second node from the linked list based on the second moment; screening out the state bits corresponding to each unit time between the first time and the second time from all the state bits contained in the first node and the second node; and modifying the state information on all the screened state bits into initial state information.
Illustratively, when the first time is less than the second time, assuming the first time is 2022/12/15/2:00 and the second time is 2022/12/15/2:10, the updating of all data before the first time has been completed before the first time is changed to the second time, and the subsequent data updating is started from the second time after the first time is changed to the second time, then a "neutral period" without data updating is formed between the first time and the second time. Therefore, the state information on the state bit corresponding to each unit time contained in the "neutral period" can be directly modified to the initial state information. The initial state information is "0", that is, the state information corresponding to the 10 state bits is 0, which indicates that no electric energy data is obtained in 10 unit time corresponding to the 10 state bits respectively.
Illustratively, when the first time is greater than the second time, the first time is 2022/12/15/2:10, and the second time is 2022/12/15/2:00, and the data has completed updating at the first time, i.e., the status bits have been updated to the status bits corresponding to 2:10, before the first time is changed to the second time. After changing the first time to the second time, the subsequent data update starts from 2:00, which is equivalent to the data on the status bits between 2:00-2:10 needing to be updated again. Therefore, the state information on the state bits between 2:00-2:10 needs to be cleared, i.e. all state information is modified to be the initial state information 0, before the time change is made.
In a second aspect, the present invention provides a storage device for an electric energy meter, as shown in fig. 2, comprising the following modules:
the first storage module 21 is configured to store, when electrical energy data is acquired in a first unit time, an electrical parameter in a preset storage location, where the electrical energy data includes an acquisition parameter and an electrical parameter, and the acquisition parameter includes a first timestamp and a storage sequence number corresponding to the first unit time; the obtaining module 22 is configured to obtain a storage address corresponding to the electrical parameter at the preset storage location when the first unit time is determined to be the first unit time in the period to which the first unit time belongs according to the first timestamp, where the period includes a plurality of unit times, and the first unit time is any one of the plurality of unit times; a configuration module 23, configured to add nodes in the pre-constructed linked list, and configure status bits in the nodes, which are the same as the number of unit time in the period; a second storage module 24 for storing a first timestamp, a storage sequence number, and a storage address in the node; a first updating module 25, configured to update initial state information of a state bit corresponding to a first unit time to preset state information, and set a storage address as a first address of a node; a searching module 26, configured to, or when it is determined according to the first timestamp that the first unit time is not the first unit time in the period to which the first unit time belongs, search, based on the first timestamp, a node corresponding to the period from the linked list; the second updating module 27 is configured to update, when the node exists, initial state information of a state bit corresponding to the first timestamp in the node to preset state information.
The present embodiment provides a computer device, as shown in fig. 3, which may include at least one processor 31, at least one communication interface 32, at least one communication bus 33, and at least one memory 34, where the communication interface 32 may include a Display screen (Display), a Keyboard (Keyboard), and the optional communication interface 32 may further include a standard wired interface, and a wireless interface. The memory 34 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 34 may alternatively be at least one memory device located remotely from the aforementioned processor 31. Wherein the processor 31 may be in association with the apparatus described in fig. 3, the application program is stored in the memory 34, and the processor 31 invokes the program code stored in the memory 34 for performing the storage method for the electric energy meter of any of the method embodiments described above.
The communication bus 33 may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The communication bus 33 may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 3, but not only one bus or one type of bus.
Wherein the memory 34 may include a volatile memory (english) such as a random-access memory (RAM); the memory may also include a nonvolatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk (English: HARD DISK DRIVE, abbreviation: HDD) or a solid state disk (English: solid-STATE DRIVE, abbreviation: SSD); memory 34 may also include a combination of the types of memory described above.
The processor 31 may be a central processor (english: central processing unit, abbreviated: CPU), a network processor (english: network processor, abbreviated: NP) or a combination of CPU and NP.
The processor 31 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof (English: programmable logic device). The PLD may be a complex programmable logic device (English: complex programmable logic device, abbreviated: CPLD), a field-programmable gate array (English: field-programmable GATE ARRAY, abbreviated: FPGA), a general-purpose array logic (English: GENERIC ARRAY logic, abbreviated: GAL), or any combination thereof. Optionally, the memory 34 is also used for storing program instructions. The processor 31 may invoke program instructions to implement the storage method for the power meter in any of the embodiments of the present invention.
The present embodiment provides a computer-readable storage medium storing computer-executable instructions that can perform the storage method for an electric energy meter in any of the above-described method embodiments. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a hard disk (HARD DISK DRIVE, abbreviated as HDD), a Solid state disk (Solid-STATE DRIVE, SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
It is apparent that the above examples are given by way of illustration only and are not limiting of the embodiments. Other variations or modifications of the above teachings will be apparent to those of ordinary skill in the art. It is not necessary here nor is it exhaustive of all embodiments. While still being apparent from variations or modifications that may be made by those skilled in the art are within the scope of the invention.

Claims (9)

1. A storage method for an electric energy meter, comprising:
When electric energy data are acquired in a first unit time, the electric energy data comprise acquisition parameters and electric parameters, the electric parameters are stored in a preset storage position, and the acquisition parameters comprise a first timestamp and a storage sequence number corresponding to the first unit time;
When the first unit time is determined to be the first unit time in a period to which the first unit time belongs according to the first timestamp, a storage address corresponding to the electric parameter at the preset storage position is acquired, wherein the period comprises a plurality of unit times, and the first unit time is any one of the unit times;
adding nodes in a pre-constructed linked list, configuring status bits with the same number as the unit time in the period in the nodes, and establishing a mapping relation between a second timestamp of first data in the period and the nodes;
storing the first timestamp, a storage sequence number, and the storage address in the node;
Updating initial state information of a state bit corresponding to the first unit time to preset state information, and setting the storage address as a head address of the node;
When the first unit time is determined to be not the first unit time in the period to which the first unit time belongs according to the first timestamp, determining a second timestamp of first data in the period based on the first timestamp, and searching a node corresponding to the period from the linked list;
And when the node exists, updating the initial state information of the state bit corresponding to the first time stamp in the node to the preset state information.
2. The storage method for an electric energy meter according to claim 1, wherein when it is determined from the first timestamp that the first unit time is not a first unit time in a period to which the first unit time belongs, searching for a node corresponding to the period from the linked list based on the first timestamp includes:
Judging the period of the first unit time corresponding to the first timestamp based on the first timestamp;
Determining a second timestamp of the first piece of data in the period;
searching a node corresponding to the second timestamp from the linked list according to the mapping relation between the second timestamp and the node;
and when the node exists, the node is used as the node corresponding to the period to which the first unit time belongs.
3. The storage method for an electric energy meter according to claim 1, characterized in that the method further comprises:
when the node does not exist, a storage address corresponding to the electric parameter at the preset storage position is obtained;
Judging the period of the first unit time corresponding to the first timestamp based on the first timestamp;
Determining a second timestamp of the first piece of data in the period;
adding a node in the linked list, and configuring a preset number of status bits in the node;
Storing the second time stamp and the storage address in the node, modifying the initial state information of the state bit corresponding to the first time stamp into the preset state information, taking the second time stamp as the initial time stamp of the node, and taking the storage address as the first address of the node.
4. A storage method for an electric energy meter according to any one of claims 1 to 3, wherein, upon receiving a data search instruction, determining the presence state of an electric parameter based on the data search instruction, further comprising
Reading the data searching instruction and extracting a target time stamp from the data searching instruction;
Searching a target node corresponding to a target period from the linked list based on the target timestamp, wherein the target period is a storage period to which a target unit time corresponding to the target timestamp belongs;
acquiring an initial time stamp of the target node;
determining an offset of the target unit time in the period based on the target time stamp, the initial time stamp and the duration of the target unit time;
Starting with a first state bit in the target node, and determining state information on the state bit corresponding to the target timestamp by taking the offset as a moving distance;
and comparing the state information with preset state information, and determining the existence state of the electric parameter corresponding to the target timestamp based on a comparison result.
5. The method for storing an electric energy meter according to claim 4, wherein when the electric parameter exists, acquiring the electric parameter corresponding to the target timestamp, further comprising:
acquiring state information on all state bits before the state bit corresponding to the target timestamp;
counting the number of state bits, of which the state information on all the state bits is preset state information, and determining the number as an effective data quantity;
A target storage address corresponding to the target electric energy data is calculated based on the head address and the effective data volume; and acquiring the electric parameter corresponding to the target timestamp from the preset storage position based on the target storage address.
6. The method of storing for a power meter of claim 4, wherein when the power meter time is changed from a first time to a second time, the method further comprises:
Searching a first node from the linked list based on the first moment, and searching a second node from the linked list based on the second moment, wherein the first node is a node corresponding to a period to which the first moment belongs, and the second node is a node corresponding to a period to which the second moment belongs;
screening out state bits corresponding to each unit time between the first moment and the second moment from all the state bits contained in the first node and the second node;
And modifying the initial state information on all the screened state bits into initial state information.
7. A memory device for an electrical energy meter, comprising:
The first storage module is used for storing the electric parameters in a preset storage position when electric energy data are acquired in a first unit time, wherein the electric energy data comprise acquisition parameters and electric parameters, and the acquisition parameters comprise a first timestamp and a storage sequence number corresponding to the first unit time;
The acquisition module is used for acquiring a storage address corresponding to the electric parameter at the preset storage position when the first unit time is determined to be the first unit time in a period to which the first unit time belongs according to the first timestamp, wherein the period comprises a plurality of unit times, and the first unit time is any one of the unit times;
The configuration module is used for adding nodes in the pre-constructed linked list, configuring status bits with the same number as the unit time in the period in the nodes, and establishing a mapping relation between a second timestamp of the first piece of data in the period and the nodes;
A second storage module, configured to store the first timestamp, a storage sequence number, and the storage address in the node;
A first updating module, configured to update initial state information of a state bit corresponding to the first unit time to preset state information, and set the storage address as a first address of the node;
The searching module is used for determining a second time stamp of first data in a period based on the first time stamp when the first unit time is determined not to be the first unit time in the period to which the first unit time belongs according to the first time stamp, and searching a node corresponding to the period from the linked list;
And the second updating module is used for updating the initial state information of the state bit corresponding to the first time stamp in the node into the preset state information when the node exists.
8. A computer device, comprising: a memory and a processor in communication with each other, the memory being configured to store a computer program which, when executed by the processor, causes the processor to perform the storage method for an electric energy meter according to any one of claims 1 to 6.
9. A computer-readable storage medium for storing computer instructions which, when executed by a processor, implement a storage method for an electric energy meter according to any one of claims 1 to 6.
CN202310103649.5A 2023-02-01 Storage method, device, equipment and medium of electric energy meter Active CN116204684B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310103649.5A CN116204684B (en) 2023-02-01 Storage method, device, equipment and medium of electric energy meter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310103649.5A CN116204684B (en) 2023-02-01 Storage method, device, equipment and medium of electric energy meter

Publications (2)

Publication Number Publication Date
CN116204684A CN116204684A (en) 2023-06-02
CN116204684B true CN116204684B (en) 2024-06-04

Family

ID=

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2748595A (en) * 1994-06-23 1996-01-19 Landis & Gyr Energy Management (Uk) Limited Metering systems
CN101169628A (en) * 2007-11-14 2008-04-30 中控科技集团有限公司 Data storage method and device
CN102637203A (en) * 2012-03-15 2012-08-15 广西电网公司电力科学研究院 Method for processing electric quantity data and monitoring master station for automatic electric energy metering systems
CN104035956A (en) * 2014-04-11 2014-09-10 江苏瑞中数据股份有限公司 Time-series data storage method based on distributive column storage
CN104090987A (en) * 2014-07-28 2014-10-08 华中科技大学 Historical data storage and indexing method
CN106708440A (en) * 2016-12-26 2017-05-24 深圳市科陆电子科技股份有限公司 Electric energy meter and data storage method for load curve of electric energy meter
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN110660004A (en) * 2019-09-29 2020-01-07 威胜集团有限公司 Curve data reading method, electric energy meter and storage medium
CN112328556A (en) * 2020-10-16 2021-02-05 威胜集团有限公司 Electric energy curve data storage method, electric energy meter and computer readable storage medium
CN112698793A (en) * 2021-01-15 2021-04-23 江苏云从曦和人工智能有限公司 Data storage method and device, machine readable medium and equipment
WO2021249027A1 (en) * 2020-06-10 2021-12-16 深圳云天励飞技术股份有限公司 Data storage method and apparatus, terminal device, and storage medium
WO2022007169A1 (en) * 2020-07-07 2022-01-13 威胜集团有限公司 Intelligent electric meter data storage method and device
CN114817645A (en) * 2022-04-19 2022-07-29 北京奇艺世纪科技有限公司 Time sequence data storage and reading method, device, equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2748595A (en) * 1994-06-23 1996-01-19 Landis & Gyr Energy Management (Uk) Limited Metering systems
CN101169628A (en) * 2007-11-14 2008-04-30 中控科技集团有限公司 Data storage method and device
CN102637203A (en) * 2012-03-15 2012-08-15 广西电网公司电力科学研究院 Method for processing electric quantity data and monitoring master station for automatic electric energy metering systems
CN104035956A (en) * 2014-04-11 2014-09-10 江苏瑞中数据股份有限公司 Time-series data storage method based on distributive column storage
CN104090987A (en) * 2014-07-28 2014-10-08 华中科技大学 Historical data storage and indexing method
CN106708440A (en) * 2016-12-26 2017-05-24 深圳市科陆电子科技股份有限公司 Electric energy meter and data storage method for load curve of electric energy meter
CN108255981A (en) * 2017-12-28 2018-07-06 国网江苏省电力有限公司电力科学研究院 The storage and lookup method that section timestamp serial number index minute continuous time freezes
CN110660004A (en) * 2019-09-29 2020-01-07 威胜集团有限公司 Curve data reading method, electric energy meter and storage medium
WO2021249027A1 (en) * 2020-06-10 2021-12-16 深圳云天励飞技术股份有限公司 Data storage method and apparatus, terminal device, and storage medium
WO2022007169A1 (en) * 2020-07-07 2022-01-13 威胜集团有限公司 Intelligent electric meter data storage method and device
CN112328556A (en) * 2020-10-16 2021-02-05 威胜集团有限公司 Electric energy curve data storage method, electric energy meter and computer readable storage medium
CN112698793A (en) * 2021-01-15 2021-04-23 江苏云从曦和人工智能有限公司 Data storage method and device, machine readable medium and equipment
CN114817645A (en) * 2022-04-19 2022-07-29 北京奇艺世纪科技有限公司 Time sequence data storage and reading method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种多对象时间序列数据存储设计;张青;《计算机光盘软件与应用》;20130801;第16卷(第15期);61-62 *
基于时间戳的FTL实现的连续数据恢复方法;袁芳 等;《计算机工程与设计》;20150116;第36卷(第01期);150-155 *

Similar Documents

Publication Publication Date Title
CN104063254A (en) Online upgrading method for electric energy meter
CN111092865B (en) Security event analysis method and system
CN116204684B (en) Storage method, device, equipment and medium of electric energy meter
CN109377383A (en) Product data synchronous method, device, computer equipment and storage medium
CN110855812A (en) Positioning method, device and equipment based on IP address
CN116204684A (en) Storage method, device, equipment and medium of electric energy meter
CN110868458A (en) Communication method and device for stable control system
CN108038127B (en) Data synchronization method, device, terminal equipment and storage medium
CN109918343B (en) Method and system for automatically generating ralf file
CN111221823B (en) Data processing method and device based on link management table
CN115407942B (en) Data processing method suitable for single chip microcomputer chip
CN109101259B (en) Updating method and device of OSDMap cache container and terminal
CN114020525B (en) Fault isolation method, device, equipment and storage medium
CN115630100A (en) Mixed processing method and device for unit and multivariate time sequence data and computer equipment
CN113259389A (en) Protocol switching method and system for guide rail meter
CN112016025B (en) Data acquisition method and device and terminal equipment
KR102066178B1 (en) Web monitoring system and method for generating of response time distribution information using the same
CN112307025B (en) Distributed index construction method and device
CN114547144A (en) Time sequence data range query method, device and equipment
CN117558118A (en) Ammeter data acquisition method and device, storage medium and electronic equipment
CN111953384B (en) Communication address sending method and device, electric energy meter and storage medium
CN116955196A (en) Test method, device and equipment
KR20220091193A (en) Method for optimizing vcrm trasmission data optimization and apparatus therefor
CN116756174A (en) Data query method and device, storage device and electronic device
CN117519606A (en) Data storage method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Zhengtai Instrument Measurement Industrial Park, No.1 Liangce Road, Beibaixiang Town, Leqing City, Wenzhou City, Zhejiang Province, 325603

Applicant after: ZHEJIANG CHINT INSTRUMENT & METER Co.,Ltd.

Address before: 325603 Wenzhou Daqiao Industrial Park, Yueqing City, Wenzhou City, Zhejiang Province

Applicant before: ZHEJIANG CHINT INSTRUMENT & METER Co.,Ltd.

GR01 Patent grant