CN115993940B - Electric quantity loss prevention method and device, electric energy meter equipment and storage medium - Google Patents

Electric quantity loss prevention method and device, electric energy meter equipment and storage medium Download PDF

Info

Publication number
CN115993940B
CN115993940B CN202310286690.0A CN202310286690A CN115993940B CN 115993940 B CN115993940 B CN 115993940B CN 202310286690 A CN202310286690 A CN 202310286690A CN 115993940 B CN115993940 B CN 115993940B
Authority
CN
China
Prior art keywords
atomic
record
electric quantity
head
written
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
CN202310286690.0A
Other languages
Chinese (zh)
Other versions
CN115993940A (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.)
Qingdao Topscomm Communication Co Ltd
Original Assignee
Qingdao Topscomm Communication Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Qingdao Topscomm Communication Co Ltd filed Critical Qingdao Topscomm Communication Co Ltd
Priority to CN202310286690.0A priority Critical patent/CN115993940B/en
Publication of CN115993940A publication Critical patent/CN115993940A/en
Application granted granted Critical
Publication of CN115993940B publication Critical patent/CN115993940B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
    • Y02E60/10Energy storage using batteries

Abstract

The invention discloses an electric quantity loss prevention method, an electric quantity loss prevention device, electric energy meter equipment and a storage medium, and relates to the technical field of electronics, wherein the method comprises the following steps: receiving an electric quantity second record, and writing the electric quantity second record into an atomic second record; writing the atomic second record into an atomic record according to the atomic second record; converting the atomic records into atomic states and storing the atomic states into an atomic storage area; updating the electric quantity according to the atomic state in the atomic storage area; according to the method, after the electric quantity data are accumulated, the accumulated electric quantity data are not directly stored and updated, but an atomic storage area is added, the accumulated electric quantity data are converted into an atomic state, the atomic state is written into the atomic storage area, and the electric quantity is stored and updated according to the atomic state in the atomic storage area.

Description

Electric quantity loss prevention method and device, electric energy meter equipment and storage medium
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method and apparatus for preventing electric quantity loss, an electric energy meter device, and a storage medium.
Background
The electric energy meter needs to store the accumulated electric quantity in the normal operation process, the electric quantity is required to meet the 16-year storage life required by the technical specification, when the electric energy meter accumulates the electric quantity, the electric energy meter generally writes and stores according to the minimum identified time unit of the electric energy meter, such as seconds, but an interruption in the program operation or a task with higher priority or even an abnormal reset can occur in one second, and at this time, if the electric energy meter is executing the important operation for storing the electric quantity, the electric quantity mutation can be caused.
The prior art scheme is that electric quantity data inside an electric energy meter is divided into a head record part and a block record part, the head record part is a part before three decimal places, the block record part is a part after three decimal places, when electric quantity is accumulated to be stored, the electric quantity before three decimal places is updated preferentially, the electric quantity after three decimal places is updated finally, because the electric quantity is stored in two parts, after the electric quantity recorded by the head is stored, if the electric energy meter is reset, the electric quantity can be suddenly changed after the electric energy meter is electrified again, the electric quantity storage is disordered, so that the electric energy meter technical specification is seriously not met, and user disputes can be brought.
Disclosure of Invention
The invention aims to provide an electric quantity loss prevention method, an electric quantity loss prevention device, an electric energy meter device and a storage medium.
According to one aspect of the present invention, there is provided a method for preventing loss of electric power, including:
receiving an electric quantity second record, and writing the electric quantity second record into an atomic second record;
writing the atomic second record into an atomic record according to the atomic second record;
converting the atomic records into atomic states and storing the atomic states into an atomic storage area;
and updating the electric quantity according to the atomic state in the atomic storage area.
Optionally, the writing the atomic second record to the atomic record according to the atomic second record includes:
judging whether the atomic head recording is needed to be written according to the atomic second recording;
if the atomic head record needs to be written, writing the atomic second record into the atomic head record;
if the atomic head record does not need to be written, judging whether the atomic block record needs to be written or not;
and if the atomic block record needs to be written, writing the atomic second record into the atomic block record.
Optionally, the method for preventing electric quantity from losing further comprises the following steps:
writing the atomic seconds record into an atomic block record according to the atomic seconds record, and judging whether the accumulated atomic seconds record in the atomic block record reaches a preset value required to be written into the atomic head record or not;
and if the preset value is reached, writing the atomic block record into the atomic head record, and emptying the atomic block record.
Optionally, the converting the atomic records into atomic states and storing the atomic states in an atomic storage area includes:
and respectively storing the electric quantity corresponding to the atomic state into the specific atomic storage area according to the head record atomization mark in the atomic head record and the block record atomization mark in the atomic block record.
Optionally, before the receiving the electric quantity second record and writing the electric quantity second record into the atomic second record, the method further includes:
judging whether the electric quantity second record is enabled or not;
if the electric quantity second record is enabled, receiving the electric quantity second record;
and if the electric quantity second record is not enabled, calculating the atomic state.
Optionally, after the calculating the atomic state, the method further includes:
judging whether the atomic head record needs to be written according to the atomic state;
and if the atomic head record needs to be written, rewriting the atomic head record.
The invention provides an electric quantity loss prevention device, which comprises:
the receiving module is used for receiving the electric quantity second record and writing the electric quantity second record into the atomic second record;
the storage module is used for writing the atomic second record into the atomic record according to the atomic second record;
the electric quantity atomization module is used for converting the atomic records into atomic states and storing the atomic states into an atomic storage area;
and the updating module is used for updating the electric quantity according to the atomic state in the atomic storage area.
Optionally, the electric quantity loss prevention device further includes:
the abnormal protection module is used for judging whether the atomic head record needs to be written according to the atomic state; and if the atomic head record needs to be written, rewriting the atomic head record.
The present invention provides an electric energy meter device comprising:
a memory for storing a computer program;
and the processor is used for realizing the electric quantity loss prevention method when executing the computer program.
The invention provides a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and when the computer executable instructions are loaded and executed by a processor, the method for preventing electric quantity from losing is realized.
Therefore, after accumulating the electric quantity data, the method does not directly store and update the electric quantity, but adds an atomic storage area, converts the accumulated electric quantity data into an atomic state, writes the atomic state into the atomic storage area, and stores and updates the electric quantity according to the atomic state in the atomic storage area. The application also provides an electric quantity loss prevention device, electric energy meter equipment and a computer readable storage medium, and the electric quantity loss prevention device has the beneficial effects.
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 required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of an electric quantity loss prevention method according to an embodiment of the present invention;
fig. 2 is a block diagram of an electric quantity loss prevention device according to an embodiment of the present invention;
fig. 3 is a block diagram of an electric energy meter device according to an embodiment of the present invention.
Description of the embodiments
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. 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 electric energy meter needs to store the accumulated electric quantity in the normal operation process, the electric quantity is required to meet the 16-year storage life required by the technical specification, when the electric energy meter accumulates the electric quantity, the electric energy meter generally writes and stores according to the minimum identified time unit of the electric energy meter, such as seconds, but an interruption in the program operation or a task with higher priority or even an abnormal reset can occur in one second, and at this time, if the electric energy meter is executing the important operation for storing the electric quantity, the electric quantity mutation can be caused.
The prior art scheme is that electric energy data in an electric energy meter are divided into a head record and a block record, the head record is a part before three decimal places, the block record is a part after three decimal places, when electric energy is accumulated to be stored, the electric energy before three decimal places is updated preferentially, the electric energy after three decimal places is updated finally, because the electric energy is stored in two parts, the electric energy meter is divided into a plurality of tasks and is interrupted in a complex manner, the electric energy meter can be interrupted by a plurality of tasks in the process of accumulating the electric energy to store the electric energy, the electric energy is easy to appear after the electric energy recorded by the head record is stored, the electric energy is reset between the storage head record and the block record due to the abnormality of the external environment, so that the electric energy storage is disordered, the fighting with users is increased, and the electric energy is lost. In view of this, the invention provides a method for preventing electric quantity loss, which does not directly store and update electric quantity data of accumulated electric quantity after accumulating the electric quantity data, but adds an atomic storage area, converts the accumulated electric quantity data into an atomic state, writes the atomic state into the atomic storage area, stores and updates the electric quantity according to the atomic state in the atomic storage area, and avoids the situation of electric quantity data loss caused by external environment abnormality in the process of accumulating the electric quantity data to storage.
Referring to fig. 1, fig. 1 is a flowchart of an electric quantity loss prevention method according to an embodiment of the present invention, where the electric quantity loss prevention method may include:
step S101: and receiving the electric quantity second record, and writing the electric quantity second record into the atomic second record.
In the embodiment of the present invention, the atomic second record is a storage area for storing the electrical quantity data to be refreshed, and the electrical quantity second record can be stored in the atomic second record, for example, the electrical quantity second record is 50 pulses, and then 50 pulses are required to be stored in the atomic second record.
In the embodiment of the invention, the electric quantity second record is the new electric quantity data to be stored, and the new electric quantity data to be stored can be generated within one second, for example, 50 pulses are generated within 1 second, and the 50 pulses are the new electric quantity data to be stored. The new electricity consumption data to be stored generated in other time units can also be used, and the embodiment of the invention is not limited to this.
In the embodiment of the invention, before the electric quantity second record is received, whether the electric quantity second record is enabled or not, namely whether new electricity consumption data are generated or not can be judged, when the electric quantity second record is enabled, the electric quantity second record is received, and when the electric quantity second record is not enabled, the atomic state needs to be calculated. In the embodiment of the present invention, the calculated atomic state is whether an error occurs in the calculated atomic state, and it should be noted that, whether an error occurs may be determined as whether the electric energy meter is reset due to an external environment, or whether an abnormal setting occurs in the electric energy meter.
It should be noted that, in the embodiment of the present invention, if no error occurs in the atomic state of the calculation, the operation is exited; if the calculated atomic state is wrong, whether the atomic head recording state is the write atomic head recording state or not needs to be judged, if the atomic head recording state is the write atomic head recording state, the atomic head recording needs to be rewritten, and if the atomic head recording state is not the write atomic head recording state, the operation is exited.
According to the embodiment of the invention, whether the electric quantity second record is enabled is judged, if the electric quantity second record is enabled, the electric quantity second record is received, the electric quantity second record is written into the atomic second record, and if the electric quantity second record is not enabled, the abnormal protection method is carried out, so that the situation that the electric quantity data is lost due to abnormal setting of the electric energy meter is avoided.
Step S102: the atomic second record is written to the atomic record based on the atomic second record.
In the embodiment of the invention, atomic records are atomic head records and atomic block records, wherein the atomic head records are the part before three decimal places in the electric quantity data, the atomic block records are the part after three decimal places in the electric quantity data, for example, the electric quantity data is 1.345627,1.345 the part before three decimal places, and 627 the part after three decimal places.
According to the embodiment of the invention, the atomic second record can be written into the atomic block record according to the atomic second record, whether the accumulated atomic second record in the atomic block record reaches the preset value required to be written into the atomic head record is judged, if the accumulated atomic second record reaches the preset value, the atomic block record is written into the atomic head record, and the atomic block record is emptied, wherein the preset value can be set by a designer according to the requirement, and can also be set according to the specific actual use situation. For example, the preset value of the atomic block record is set to be 3 ten thousand pulses, at this time, 2 ten thousand pulses exist in the atomic block record, 1 ten thousand pulses exist in the atomic second record, 1 ten thousand pulses recorded in the atomic second record are written into the atomic block record, at this time, 3 ten thousand pulses reach the preset value in the atomic block record, and then 3 ten thousand pulses are written into the atomic head record, and the atomic block record is emptied.
According to the embodiment of the invention, whether the atomic head record needs to be written or not can be judged according to the atomic second record, if the atomic head record needs to be written, the atomic second record is written into the atomic head record, if the atomic head record does not need to be written, whether the atomic block record needs to be written is judged, if the atomic block record needs to be written, the atomic second record is written into the atomic block record, for example, the atomic block record is empty at the moment and the preset numerical value of the atomic block record is set to be 3 ten thousand pulses, and when the atomic second record is 5 ten thousand pulses, the atomic block record needs to be written into the atomic head record at the moment firstly and then written into the atomic block record for 2 ten thousand pulses; when the atomic second recording is 1 ten thousand pulses, judging whether the atomic head recording is needed, and if the atomic head recording is not needed, writing 1 ten thousand pulses into the atomic block recording.
According to the embodiment of the invention, the method for writing the atomic second record into the atomic record avoids the loss of electric quantity data and the disorder of electric quantity storage.
Step S103: and converting the atomic records into atomic states and storing the atomic states in an atomic storage area.
In the embodiment of the invention, the atomic head record can be converted into the atomic state, the atomic block record can be converted into the atomic state, and the atomic head record and the atomic block record can be converted into the atomic state, for example, when only the operation of writing the atomic head record is performed, the atomic head record is converted into the atomic state, and the embodiment of the invention is determined according to a specific practical operation flow, but is not limited to the above.
In the embodiment of the invention, the atomic head record comprises a head record atomization mark and recorded electric quantity data, the atomic block record comprises a block record atomization mark and recorded electric quantity data, and the corresponding electric quantity data can be stored into an atomic storage area according to the head record atomization mark and the block record atomization mark, wherein the atomic storage area is used for storing the electric quantity data corresponding to an atomic state.
According to the embodiment of the invention, the method for converting the atomic records into the atomic states and storing the atomic states in the atomic storage area is used for avoiding the situation that the electric quantity data is lost due to the abnormality of the external environment in the process of accumulating the electric quantity data to be stored.
Step S104: the charge is updated based on the atomic states in the atomic storage area.
According to the embodiment of the invention, the previously stored electric quantity data can be updated according to the electric quantity data of the atomic state in the atomic storage area, and the electric quantity data is prevented from being lost according to the electric quantity updating mode of the atomic state.
Based on the above embodiments, the embodiments of the present invention provide an electric quantity loss prevention method, which receives an electric quantity second record and writes the electric quantity second record into an atomic second record; writing the atomic second record into an atomic record according to the atomic second record; converting the atomic records into atomic states and storing the atomic states into an atomic storage area; and updating the electric quantity according to the atomic state in the atomic storage area. According to the invention, after accumulating the electric quantity data, the accumulated electric quantity data is not directly stored and updated, but an atomic storage area is added, the accumulated electric quantity data is converted into an atomic state, the atomic state is written into the atomic storage area, and the electric quantity is stored and updated according to the atomic state in the atomic storage area, so that the situation that the electric quantity data is lost due to the abnormality of the external environment in the process of accumulating the electric quantity data to be stored is avoided.
The above-described process is described below by way of specific examples, and the process is specifically as follows:
1. and judging whether the electric energy second record is enabled in the electric energy meter.
2. And when the electric quantity second record is enabled, receiving the electric quantity second record, and writing the electric quantity second record into the atomic second record.
3. Judging whether the write head record is set or not according to the atomic second record, and if the write head record is set, writing electric quantity into the atomic head record; if the write head record is not set, it is determined whether the write block record is set.
4. If the writing block record is set, writing electric quantity into the atomic block record; if the write block record is not set, the atomic block record is not written.
5. And converting the atomic head record and the atomic block record into atomic states, and storing electric quantity corresponding to the atomic states into an atomic storage area according to the head record atomization mark and the block record atomization mark.
6. And synchronously updating the electric quantity data according to the atomic states in the atomic storage area.
7. And when the electric quantity second recording is not enabled, namely abnormal setting of the electric energy meter occurs, calculating an atomic state, and judging whether the atomic state is a write head recording state or not.
8. If the write head is in a recording state, rewriting the atomic head recording, rewriting the atomic block recording, and converting the atomic block recording into an atomic state; if it is not the write head recording state, the operation is exited.
According to the embodiment of the invention, the atomic storage area is increased, the accumulated electric quantity data is converted into the atomic state, the atomic state is written into the atomic storage area, and the electric quantity is stored and updated according to the atomic state in the atomic storage area, so that the situation that the electric quantity data is lost due to the abnormal external environment in the process of accumulating the electric quantity data into the storage is avoided.
The embodiment of the invention provides an electric quantity loss prevention device and an electric energy meter device, and the electric quantity loss prevention device and the electric energy meter device described below and the electric quantity loss prevention method described above can be correspondingly referred to each other.
Referring to fig. 2, fig. 2 is a block diagram of an electric quantity loss prevention device according to an embodiment of the present invention, where the device may include:
the receiving module 201 is configured to receive an electric quantity second record, and write the electric quantity second record into an atomic second record;
a storage module 202, configured to write the atomic second record into an atomic record according to the atomic second record;
the electric quantity atomization module 203 is configured to convert the atomic records into atomic states and store the atomic states in an atomic storage area;
in this embodiment, the electric quantity atomization module 203 is specifically configured to store electric quantities corresponding to the atomic states into the specific atomic storage areas according to the head record atomization flag in the atomic head record and the block record atomization flag in the atomic block record.
And the updating module 204 is configured to update the electric quantity according to the atomic state in the atomic storage area.
Based on the above embodiment, the electric quantity loss prevention device may further include:
the judging module is used for judging whether the electric quantity second record is enabled or not, and if the electric quantity second record is enabled, the electric quantity second record is received; if the electric quantity second record is not enabled, calculating the atomic state;
the abnormal protection module is used for judging whether the atomic head record needs to be written according to the atomic state; and if the atomic head record needs to be written, rewriting the atomic head record.
Based on any of the above embodiments, the storage module 202 includes:
the first judging unit is used for judging whether the atomic head record needs to be written according to the atomic second record, and if the atomic head record needs to be written, the atomic second record is written into the atomic head record;
the second judging unit is used for judging whether the atomic block record needs to be written or not if the atomic head record does not need to be written; and if the atomic block record needs to be written, writing the atomic second record into the atomic block record.
Based on any of the foregoing embodiments, the first determining unit further includes:
writing the atomic seconds record into an atomic block record according to the atomic seconds record, and judging whether the accumulated atomic seconds record in the atomic block record reaches a preset value required to be written into the atomic head record or not; and if the preset value is reached, writing the atomic block record into the atomic head record, and emptying the atomic block record.
In the embodiment of the present invention, the storage module 202 is configured to write the atomic second record into the atomic record according to the atomic second record; the electric quantity atomization module 203 is configured to convert the atomic records into atomic states and store the atomic states in an atomic storage area; the updating module 204 is configured to update the electric quantity according to the atomic state in the atomic storage area, not directly store and update the accumulated electric quantity data, but add the atomic storage area, convert the accumulated electric quantity data into the atomic state, write the atomic state into the atomic storage area, store and update the electric quantity according to the atomic state in the atomic storage area, and avoid the situation that the electric quantity data is lost due to an external environment abnormality in the process of accumulating the electric quantity data into the storage.
Referring to fig. 3, fig. 3 is a block diagram of an electric energy meter device according to an embodiment of the present invention, where the electric energy meter device includes:
a memory 10 for storing a computer program;
and the processor 20 is configured to execute the computer program to implement the above-mentioned power loss prevention method.
As shown in fig. 3, which is a schematic structural diagram of the electric energy meter device, may include: memory 10, processor 20, communication interface 31, input-output interface 32, and communication bus 33.
In the embodiment of the present invention, the memory 10 is used to store one or more programs, and the programs may include program codes, where the program codes include computer operation instructions, and in the embodiment of the present application, the memory 10 may store programs for implementing the following functions:
receiving an electric quantity second record, and writing the electric quantity second record into an atomic second record;
writing the atomic second record into an atomic record according to the atomic second record;
converting the atomic records into atomic states and storing the atomic states into an atomic storage area;
and updating the electric quantity according to the atomic state in the atomic storage area.
In one possible implementation, the memory 10 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, and at least one application program required for functions, etc.; the storage data area may store data created during use.
In addition, memory 10 may include read only memory and random access memory and provide instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operating instructions may include various operating instructions for performing various operations. The operating system may include various system programs for implementing various basic tasks as well as handling hardware-based tasks.
The processor 20 may be a central processing unit (Central Processing Unit, CPU), an asic, a dsp, a fpga or other programmable logic device, and the processor 20 may be a microprocessor or any conventional processor. The processor 20 may call a program stored in the memory 10.
The communication interface 31 may be an interface for connecting with other devices or systems.
The input-output interface 32 may be an interface for acquiring external input data or outputting data to the outside.
Of course, it should be noted that the structure shown in fig. 3 is not limited to the electric energy meter device in the embodiment of the present application, and the electric energy meter device may include more or less components than those shown in fig. 3, or may be combined with some components in practical applications.
According to the embodiment of the invention, the accumulated electric quantity data is converted into the atomic state by adding the atomic storage area, the atomic state is written into the atomic storage area, and the electric quantity is stored and updated according to the atomic state in the atomic storage area, so that the situation that the electric quantity data is lost due to the abnormality of the external environment in the process of accumulating the electric quantity data into the storage is avoided.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by a processor, the computer executable instructions realize receiving the electric quantity second record and writing the electric quantity second record into the atomic second record; writing the atomic second record into an atomic record according to the atomic second record; converting the atomic records into atomic states and storing the atomic states into an atomic storage area; and updating the electric quantity according to the atomic state in the atomic storage area. According to the embodiment of the invention, the accumulated electric quantity data is converted into the atomic state by adding the atomic storage area, the atomic state is written into the atomic storage area, and the electric quantity is stored and updated according to the atomic state in the atomic storage area, so that the situation that the electric quantity data is lost due to the abnormality of the external environment in the process of accumulating the electric quantity data into the storage is avoided.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method, the device, the electric energy meter equipment and the storage medium for preventing electric quantity from losing are described in detail. The principles and embodiments of the present invention have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.

Claims (9)

1. A method for preventing loss of power, comprising:
receiving an electric quantity second record, and writing the electric quantity second record into an atomic second record;
writing the atomic second record into an atomic record according to the atomic second record;
converting the atomic records into atomic states and storing the atomic states into an atomic storage area;
updating the electric quantity according to the atomic state in the atomic storage area;
correspondingly, the receiving the electric quantity second record, and before writing the electric quantity second record into the atomic second record, further comprises:
judging whether the electric quantity second record is enabled or not;
if the electric quantity second record is enabled, receiving the electric quantity second record;
and if the electric quantity second record is not enabled, calculating the atomic state.
2. The method of claim 1, wherein writing the atomic second record to the atomic record according to the atomic second record comprises:
judging whether the atomic head recording is needed to be written according to the atomic second recording;
if the atomic head record needs to be written, writing the atomic second record into the atomic head record;
if the atomic head record does not need to be written, judging whether the atomic block record needs to be written or not;
and if the atomic block record needs to be written, writing the atomic second record into the atomic block record.
3. The method of claim 2, further comprising:
writing the atomic seconds record into an atomic block record according to the atomic seconds record, and judging whether the accumulated atomic seconds record in the atomic block record reaches a preset value required to be written into the atomic head record or not;
and if the preset value is reached, writing the atomic block record into the atomic head record, and emptying the atomic block record.
4. The method of claim 2, wherein converting the atomic records into atomic states for storage in an atomic memory area comprises:
and respectively storing the electric quantity corresponding to the atomic state into the specific atomic storage area according to the head record atomization mark in the atomic head record and the block record atomization mark in the atomic block record.
5. The method of claim 1, wherein after calculating the atomic state, further comprising:
judging whether the atomic head record is required to be written according to the atomic state;
and if the atomic head record needs to be written, rewriting the atomic head record.
6. An electrical quantity loss prevention device, comprising:
the receiving module is used for receiving the electric quantity second record and writing the electric quantity second record into the atomic second record;
the storage module is used for writing the atomic second record into the atomic record according to the atomic second record;
the electric quantity atomization module is used for converting the atomic records into atomic states and storing the atomic states into an atomic storage area;
the updating module is used for updating the electric quantity according to the atomic state in the atomic storage area;
correspondingly, before the receiving module, the method further comprises:
the judging module is used for judging whether the electric quantity second record is enabled or not, and if the electric quantity second record is enabled, the electric quantity second record is received; and if the electric quantity second record is not enabled, calculating the atomic state.
7. The power loss prevention apparatus of claim 6, further comprising:
the abnormal protection module is used for judging whether the atomic head record is required to be written according to the atomic state; and if the atomic head record needs to be written, rewriting the atomic head record.
8. An electrical energy meter apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the method for preventing loss of power according to any one of claims 1 to 5 when executing the computer program.
9. A computer readable storage medium having stored therein computer executable instructions which when loaded and executed by a processor implement a method of preventing loss of power according to any of claims 1 to 5.
CN202310286690.0A 2023-03-23 2023-03-23 Electric quantity loss prevention method and device, electric energy meter equipment and storage medium Active CN115993940B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310286690.0A CN115993940B (en) 2023-03-23 2023-03-23 Electric quantity loss prevention method and device, electric energy meter equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310286690.0A CN115993940B (en) 2023-03-23 2023-03-23 Electric quantity loss prevention method and device, electric energy meter equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115993940A CN115993940A (en) 2023-04-21
CN115993940B true CN115993940B (en) 2023-07-25

Family

ID=85995255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310286690.0A Active CN115993940B (en) 2023-03-23 2023-03-23 Electric quantity loss prevention method and device, electric energy meter equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115993940B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105842632A (en) * 2016-05-24 2016-08-10 北京小米移动软件有限公司 Data processing method and apparatus
CN110737716A (en) * 2018-07-02 2020-01-31 华为技术有限公司 data writing method and device

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4400783A (en) * 1980-09-05 1983-08-23 Westinghouse Electric Corp. Event-logging system
JP4440391B2 (en) * 1999-11-02 2010-03-24 日置電機株式会社 Recording device
JP4751131B2 (en) * 2005-08-18 2011-08-17 東芝ストレージデバイス株式会社 Data loss prevention method for medium storage device and medium storage device
CN106940625B (en) * 2017-03-15 2020-07-17 四川创能海博科技有限公司 Data storage method of intelligent electric meter
CN108874298B (en) * 2017-05-15 2021-08-03 深圳市奇辉电气有限公司 Data storage method and device
KR101966399B1 (en) * 2017-06-30 2019-04-08 단국대학교 산학협력단 Device and method on file system journaling using atomic operation
CN108710583A (en) * 2018-05-28 2018-10-26 深圳忆联信息系统有限公司 Management method, device, computer equipment and the medium in SSD write buffers area
CN113777398A (en) * 2021-08-09 2021-12-10 威胜集团有限公司 Electric energy meter electric quantity recording method, electric energy meter and readable storage medium
CN113608701A (en) * 2021-08-18 2021-11-05 合肥大唐存储科技有限公司 Data management method in storage system and solid state disk
CN114327769B (en) * 2021-12-29 2023-01-06 科东(广州)软件科技有限公司 Operating system event recording method and device and computer system
CN218547477U (en) * 2022-10-31 2023-02-28 中节能晶和科技有限公司 Automatic time-delay data storage device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105842632A (en) * 2016-05-24 2016-08-10 北京小米移动软件有限公司 Data processing method and apparatus
CN110737716A (en) * 2018-07-02 2020-01-31 华为技术有限公司 data writing method and device

Also Published As

Publication number Publication date
CN115993940A (en) 2023-04-21

Similar Documents

Publication Publication Date Title
CN104808952B (en) data cache method and device
CN1755648A (en) Method, system, and apparatus for identifying unresponsive portions of a computer program
CN103514216B (en) Serial numbers based on Database Systems generate method
CN107180040B (en) Service data management method and device
CN103885753A (en) Management method and device for caching images and client side
CN115993940B (en) Electric quantity loss prevention method and device, electric energy meter equipment and storage medium
CN111553699A (en) Resource scheduling method and device
CN108563774B (en) GPS data processing method and device
CN113777398A (en) Electric energy meter electric quantity recording method, electric energy meter and readable storage medium
CN112506698B (en) Small file data reconstruction recovery method, system, terminal and storage medium
CN111966508A (en) Message batch sending method and device, computer equipment and storage medium
CN107368350A (en) Cluster management method, system, storage medium and the electronic equipment of virtual payment machine
CN111273181A (en) Battery backup unit monitoring method and device, server and readable storage medium
CN116486510A (en) Fault information processing method, device, computer equipment and storage medium
CN115756309A (en) Battery management equipment parameter storage method, battery management equipment and energy storage system
US20220392339A1 (en) Method and device for generating driving suggestion, and computer-readable storage medium
CN112340609B (en) Parameter information configuration method, electronic box, server and storage medium
CN111993953B (en) Battery control method, power automobile and readable storage medium
CN114925370A (en) Software security protection method and device, storage medium and electronic equipment
CN112306995B (en) Method and device for realizing database operation
CN114003172A (en) Storage capacity correction method, storage capacity correction device, computer equipment and storage medium
CN110009484A (en) Business data processing method, equipment, server and computer readable storage medium
CN113034254B (en) Data processing method and device and electronic equipment
CN109144538A (en) A kind of CAN node Bootloader design method and system based on UDS
CN112291158A (en) Flow control method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant