Power-off storage method, device, computer equipment and storage medium for electric energy meter

By sending a power-down broadcast frame to the slave electric energy meter in a multi-user electric energy meter, data is saved in advance, which solves the problem of unreliable data storage caused by the short power-down detection time of the slave electric energy meter, and realizes fast and reliable electric energy data. Save to ensure the normal operation of the energy meter.

CN118244998BActive Publication Date: 2024-09-24ZHEJIANG CHINT INSTR & METER
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410677107.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-24
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

When the multi-user electric energy meter loses power, due to the short power-down detection time of the slave electric energy meter, the electric energy data cannot be saved reliably, which may result in data loss.

Method used

When the input voltage is detected in real time by the host electric energy meter and is lower than the first preset voltage, a power-down broadcast frame is sent to all slave electric energy meters to save electric energy data in advance, ensuring that the slave electric energy meters can save data in advance to achieve fast and Reliable power-off preservation.

Benefits of technology

It ensures the integrity of electric energy data and the normal operation of multi-user electric energy meters, and improves the reliability and speed of power-off storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118244998B
    Figure CN118244998B
Patent Text Reader

Abstract

The present invention relates to the field of data security technology, and discloses a method, device, computer equipment and storage medium for power-off preservation of an electric energy meter. The method comprises: obtaining the input voltage of the power supply of a host electric energy meter of a multi-user electric energy meter and the output voltage of the power supply of each slave electric energy meter of the multi-user electric energy meter; when the input voltage is lower than a first preset voltage, controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters, and controlling the host electric energy meter to save electric energy data; when any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage, controlling the slave electric energy meter to save electric energy data. The present invention solves the problem that the host electric energy meter and the slave electric energy meter of the multi-user electric energy meter are separately power-off preserved, but the slave electric energy meter cannot be reliably power-off preserved, so that the slave electric energy meter is powered off and preserved in advance, and a fast and reliable power-off preservation is achieved, thereby ensuring the integrity of the electric energy data and the normal operation of the electric energy meter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data security, and in particular to a method and device for saving data when an electric energy meter is powered off, a computer device and a storage medium. Background Art

[0002] The multi-user energy meter is composed of a host energy meter and several slave energy meters. It is widely used in residential areas, apartments, schools, hotels and other places due to its advantages of high accuracy, centralized installation, small space and centralized management. The energy data of the multi-user energy meter during operation must be complete and cannot be lost. Therefore, when the multi-user energy meter loses power, how to save the energy data in time is a problem that needs to be solved.

[0003] At present, usually the master energy meter and the slave energy meter each perform power failure detection, and save the energy data to EEPROM (Electrically Erasable Programmable read only memory) after power failure is detected. For example, when the slave energy meter power supply is reduced from 12V to 9V, it is considered that power failure has occurred, and the energy data is saved in EEPROM.

[0004] The problem with the above technical method is that the slave energy meter saves the energy data only when the power supply is reduced from 12V to 9V. When the power supply drops below 6V, the slave energy meter cannot work normally. Therefore, the energy data may not be reliably saved due to the short time for the power supply to drop from 9V to 6V. Summary of the invention

[0005] In view of this, the present invention provides a method, device, computer equipment and storage medium for power-off preservation of an electric energy meter, so as to solve the problem that when a master electric energy meter and a slave electric energy meter of a multi-user electric energy meter perform their own power-off preservation respectively, the electric energy data of the slave electric energy meter cannot be reliably preserved due to the short power-off detection time.

[0006] In a first aspect, the present invention provides a method for preserving an electric energy meter after power failure, the method comprising:

[0007] Acquire the input voltage of the power supply of the master power meter of the multi-user power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter;

[0008] When the input voltage is lower than the first preset voltage, the host electric energy meter is controlled to send a power-off broadcast frame to all slave electric energy meters, and the host electric energy meter is controlled to save electric energy data;

[0009] When any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage, the slave electric energy meter is controlled to save electric energy data.

[0010] The power-off preservation method for electric energy meters provided in an embodiment of the present invention, based on the host electric energy meter and the slave electric energy meter performing their own power-off detection respectively, when the input voltage detected in real time by the host electric energy meter is lower than the first preset voltage, sends a power-off broadcast frame to all slave electric energy meters for advance prediction, so that all slave electric energy meters can perform power-off preservation of electric energy data in advance, realize fast and reliable power-off preservation, and ensure the integrity of electric energy data and the normal operation of multi-user electric energy meters.

[0011] In an optional implementation manner, controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters includes:

[0012] Get the 485 bus status flag, which is used to identify whether the 485 bus that sends the power-off broadcast frame is in an idle state or in use state;

[0013] When the 485 bus status flag is in the idle state, the host electric energy meter is controlled to send a power-off broadcast frame to all slave electric energy meters.

[0014] The power-off saving method of the electric energy meter provided by the embodiment of the present invention introduces a 485 bus status flag to identify whether the 485 bus is being used, so that the power-off broadcast frame can be sent in time when the 485 bus is in an idle state, thereby improving the speed of power-off saving.

[0015] In an optional implementation manner, controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters further includes:

[0016] When the 485 bus status flag is in the use state, the broadcast flag is set to the waiting state, and the waiting state indicates that the power-off broadcast frame is waiting to be sent;

[0017] Continuously obtain the 485 bus status flag, and when the 485 bus status flag is in the idle state and the broadcast flag is in the waiting state, control the host power meter to send a power-off broadcast frame to all slave power meters;

[0018] In case the power-down broadcast frame has been sent, the broadcast flag is set to the idle state.

[0019] The power-off saving method of the electric energy meter provided by the embodiment of the present invention introduces a broadcast flag to identify whether there is a power-off broadcast frame waiting to be sent when the 485 bus is in use, so that the power-off broadcast frame can be sent in time when the 485 bus is in an idle state and the broadcast flag is in a waiting state, thereby improving the speed of power-off saving.

[0020] In an optional implementation, before controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters, the method further includes:

[0021] Pause the main loop task being executed by the host electric energy meter;

[0022] Control the host electric energy meter to jump to power-off interruption;

[0023] Before controlling the slave electric energy meter to save electric energy data, the method further includes:

[0024] Pause the main cycle task being executed by the slave electric energy meter;

[0025] Control jumps from the electromechanical energy meter to the 485 bus interrupt or power-off interrupt.

[0026] The power-off saving method for an electric energy meter provided in an embodiment of the present invention controls the host electric energy meter to jump from the main loop to the power-off interruption and then send the power-off broadcast frame, and controls the slave electric energy meter to jump from the main loop to the 485 bus interruption or the power-off interruption and then perform the power-off saving, thereby ensuring the reliability of the power-off saving and the normal operation of the multi-user electric energy meter.

[0027] In an optional implementation, controlling the host electric energy meter to save electric energy data or controlling the slave electric energy meter to save electric energy data includes:

[0028] Obtaining a read-write lock state, where the read-write lock state is used to indicate whether the storage device storing the electric energy data is in an idle state or in a used state;

[0029] When the read-write lock is in an idle state, the host power meter is controlled to save power data or the slave power meter is controlled to save power data.

[0030] The power-off saving method for an electric energy meter provided in an embodiment of the present invention introduces a read-write lock state to identify whether a memory for saving electric energy data is being used, so that the electric energy data can be saved in time when the read-write lock is in an idle state, thereby improving the speed of power-off saving.

[0031] In an optional implementation, controlling the host electric energy meter to save electric energy data or controlling the slave electric energy meter to save electric energy data further includes:

[0032] When the read-write lock is in the use state, the contention flag is set to the existence state, and the existence state indicates that the main loop and the power-off interrupt are competing for the use of the memory or the main loop and the 485 bus interrupt are competing for the use of the memory;

[0033] Control the host electric energy meter to exit the power-off interruption, jump back to the main loop, and continue to execute the main loop task of the host electric energy meter, or control the slave electric energy meter to exit the 485 bus interruption or power-off interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter;

[0034] Continuously obtain the read-write lock state, and when the read-write lock state is in an idle state and the competition flag is in an existent state, control the host power meter to save power data or control the slave power meter to save power data;

[0035] After the power data of the master power meter is saved or the power data of the slave power meter is saved, the contention flag is set to a non-existent state.

[0036] The power-off saving method of the electric energy meter provided by the embodiment of the present invention introduces a competition flag to identify whether there is a main loop and a power-off interrupt or a main loop and a 485 bus interrupt competing for the use of a memory when the read-write lock is in an idle state and the competition flag is in an existing state, thereby saving electric energy data in time and improving the speed of power-off saving.

[0037] In an optional embodiment, the method further includes:

[0038] After the power data of the host power meter is saved, the host power meter is controlled to jump back to the main loop and continue to execute the main loop task of the host power meter;

[0039] After the electric energy data of the slave electric energy meter is saved, the slave electric energy meter is controlled to jump back to the main loop and continue to execute the main loop task of the slave electric energy meter.

[0040] The power-off saving method for electric energy meters provided in the embodiment of the present invention controls the host electric energy meter and the slave electric energy meter to jump back to the main loop and continue to execute the main loop tasks after saving their respective electric energy data, thereby ensuring the normal operation of multi-user electric energy meters.

[0041] In a second aspect, the present invention provides a power-off storage device for an electric energy meter, the device comprising:

[0042] An acquisition module, used for acquiring an input voltage of a power supply of a host power meter of a multi-user power meter and an output voltage of a power supply of each slave power meter of the multi-user power meter;

[0043] A sending module, used for controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters when the input voltage is lower than a first preset voltage, and controlling the host electric energy meter to save electric energy data;

[0044] The saving module is used to control the slave electric energy meter to save electric energy data when any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage.

[0045] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the power-off preservation method of the electric energy meter of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0046] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the power-off preservation method for an electric energy meter according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 is a flow chart of a power-off preservation method for an electric energy meter according to an embodiment of the present invention;

[0049] Figure 2 is a hardware schematic diagram of a multi-user electric energy meter according to an embodiment of the present invention;

[0050] Figure 3 is a flow chart of another power-off preservation method for an electric energy meter according to an embodiment of the present invention;

[0051] Figure 4 is an interface flow chart of a read-write memory according to an embodiment of the present invention;

[0052] Figure 5 is a flowchart of power-off saving based on the read-write lock state and the contention flag according to an embodiment of the present invention;

[0053] Figure 6 is a flow chart of power-off saving of a host electric energy meter according to an embodiment of the present invention;

[0054] Figure 7 is a flow chart of another power-off preservation method for an electric energy meter according to an embodiment of the present invention;

[0055] Figure 8 is a flow chart of power-off saving of a slave electric energy meter according to an embodiment of the present invention;

[0056] Fig. 9 is a structural block diagram of a power-off storage device for an electric energy meter according to an embodiment of the present invention;

[0057] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0059] The embodiment of the present invention provides a method for power-off preservation of electric energy meters, which solves the problem in the related art that when a master electric energy meter and a slave electric energy meter of a multi-user electric energy meter perform their own power-off preservation respectively, the electric energy data of the slave electric energy meter cannot be reliably preserved due to the short power-off detection time. A power-off broadcast frame is added based on the input voltage of the master electric energy meter for advance prediction, so that all slave electric energy meters can perform power-off preservation of electric energy data in advance, thereby realizing fast and reliable power-off preservation, and ensuring the integrity of the electric energy data and the normal operation of the multi-user electric energy meters.

[0060] According to an embodiment of the present invention, an embodiment of a method for preserving power on an electric energy meter during power failure is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0061] In this embodiment, a method for preserving power on an electric energy meter after power failure is provided, which can be used for a multi-user electric energy meter. The multi-user electric energy meter includes a master electric energy meter and a plurality of slave electric energy meters. Figure 1 is a flow chart of a power-off storage method for an electric energy meter according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0062] Step S101, obtaining the input voltage of the power supply of the host power meter of the multi-user power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter. Specifically, the host power meter includes an AC-DC power supply module, wherein the AC end is the input end and the DC end is the output end. The AC end is powered by a 220V AC power supply input, and the 220V AC power supply is converted into a 12V DC power supply through the AC-DC module, which is used to power the slave power meter. Among them, the input voltage of the power supply of the host power meter is the AC end voltage, and the output voltage of the power supply of the slave power meter is the DC end voltage. By obtaining the AC end voltage of the host power meter and the DC end voltage of the slave power meter, power failure detection can be performed according to the voltage, and then the power data can be saved when the power is off.

[0063] In some optional embodiments, Figure 2 is a hardware schematic diagram of a multi-user electric energy meter according to an embodiment of the present invention, such as Figure 2 As shown, the host power meter and the slave power meter of the multi-user power meter are installed in one or more rows and connected by a cable. The cable consists of 4 wires, namely a 12V power line, a ground line, a 485 bus A, and a 485 bus B. It can realize 12 three-phase or 36 single-phase direct access measurement or 12 three-phase mutual inductor access measurement. The 485 bus A and the 485 bus B are connected inside the host power meter and each slave power meter, and the 485 bus A and the 485 bus B of the host power meter and the slave power meter are connected together respectively. Among them, the host power meter is powered by an AC power supply 220V input, and includes an AC-DC power supply module inside, which is used to convert the 220V AC power supply into a 12V DC power supply. The slave power meter is powered by a 12V DC power supply, and the 12V DC power supply is obtained from the host power meter through the cable. The host power meter communicates with all the slave power meters via the 485 bus in the wiring. The communication between the user and the multi-user power meter and the communication between the host power meter and the slave power meters in the multi-user power meter all adopt the DL / T645-2007 communication protocol of the power industry. The host power meter has a liquid crystal, and the slave power meter and the host power meter share a liquid crystal display. The host power meter has a Bluetooth module, and the user can use the terminal's Bluetooth application or Bluetooth gateway to pay the multi-user power meter online, and can also read and write data to the multi-user power meter. The present invention adopts such Figure 2 The hardware connection method of the multi-user electric energy meter shown makes the slave electric energy meter smaller in size and lower in cost compared with the traditional single electric energy meter, and is convenient for plugging and replacing.

[0064] Step S102, when the input voltage is lower than the first preset voltage, the host power meter is controlled to send a power-off broadcast frame to all slave power meters, and the host power meter is controlled to save power data. Specifically, the host power meter generally starts to save power when the AC terminal voltage is lower than 170V, and the host power meter stops working when the voltage drops to 80V. The slave power meter generally starts to save power when the DC terminal voltage is lower than 9V, and the slave power meter stops working when the voltage drops to 6V. Since the time for the AC terminal voltage of the host power meter to drop from 170V to 80V is much longer than the time for the DC terminal voltage to drop from 9V to 6V. Therefore, in order to ensure that the slave power meter can reliably save power data, when the AC terminal voltage of the host power meter is lower than the first preset voltage, the host power meter is controlled to send a power-off broadcast frame to all slave power meters, so that all slave power meters can save power in advance under normal operation, thereby ensuring the integrity of the power data. Among them, the first preset voltage can be 170V, which can be adjusted according to actual needs, and the embodiment of the present invention does not limit this. The following Table 1 is an example of a power-off broadcast frame, which includes 12 bytes and adopts the DL / T-645 protocol. Among them, the first byte 68H represents the frame start character specified in the DL / T-645 protocol; the second byte to the seventh byte represent the communication address. If the communication address is consistent with the address of the electric energy meter itself, it means that it is sent to the electric energy meter. When the communication address is all 99H, it indicates a broadcast frame; the eighth byte 68H represents the frame start character specified in the DL / T-645 protocol; the ninth byte represents the control code in the DL / T-645 protocol, and 22H is used here to represent the power-off control code; the tenth byte represents the data field length in the DL / T-645 protocol. Since the power-off broadcast frame does not need to transmit data, it can be 00H; the eleventh byte CS represents the check code specified in the DL / T-645 protocol; the twelfth byte 16H represents the end character specified in the DL / T-645 protocol.

[0065] Table 1

[0066]

[0067] Step S103, when any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than the second preset voltage, the slave electric energy meter is controlled to save the electric energy data. Specifically, the second preset voltage can be 9V, which can be adjusted according to actual needs, and the embodiment of the present invention does not limit this. For any slave electric energy meter, on the basis of the real-time detection of the DC terminal voltage by the slave electric energy meter according to the traditional method, the reception of the power-off broadcast frame is added, so that whether it triggers the power-off saving condition of the slave electric energy meter itself or performs power-off saving in advance based on the power-off broadcast frame, fast and reliable power-off saving is achieved, thereby ensuring the integrity of the electric energy data and the normal operation of the multi-user electric energy meter.

[0068] The power-off preservation method for electric energy meters provided in an embodiment of the present invention, based on the host electric energy meter and the slave electric energy meter performing their own power-off detection respectively, when the input voltage detected in real time by the host electric energy meter is lower than the first preset voltage, sends a power-off broadcast frame to all slave electric energy meters for advance prediction, so that all slave electric energy meters can perform power-off preservation of electric energy data in advance, realize fast and reliable power-off preservation, and ensure the integrity of electric energy data and the normal operation of multi-user electric energy meters.

[0069] In this embodiment, a method for saving power failure of an electric energy meter is provided, which can be used for the above-mentioned multi-user electric energy meter. Figure 3 FIG. 4 is a flow chart of another method for preserving power-off of an electric energy meter according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0070] Step S301, obtaining the input voltage of the power supply of the master power meter of the multi-user power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0071] Step S302, when the input voltage is lower than the first preset voltage, the host power meter is controlled to send a power-off broadcast frame to all slave power meters, and the host power meter is controlled to save power data.

[0072] In some optional implementations, before the above step S302 controls the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters, the method further includes:

[0073] Step a1, suspending the main cycle task being executed by the host electric energy meter. Specifically, the host electric energy meter executes tasks in the main cycle, and when the AC terminal voltage of the host electric energy meter is lower than the first preset voltage, the host electric energy meter loses power, and the main cycle task being executed by the host electric energy meter is suspended.

[0074] Step a2, controlling the host electric energy meter to jump to the power-off interruption. Specifically, the host electric energy meter sends a power-off broadcast frame and performs power-off saving in the power-off interruption.

[0075] Specifically, the above step S302 controls the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters, including:

[0076] Step S3021, obtain the 485 bus status flag, which is used to identify whether the 485 bus that sends the power-off broadcast frame is in an idle state or in use. Specifically, the 485 bus status flag can be represented by CommFlag. If CommFlag is 0, it means that the 485 bus is in an idle state and can be sent. If CommFlag is 1, it means that the 485 bus is in use and cannot be inserted for sending.

[0077] Step S3022, when the 485 bus status flag is in the idle state, the host power meter is controlled to send a power-off broadcast frame to all slave power meters. Specifically, when CommFlag is obtained to be 0, it means that the 485 bus status flag is in the idle state, and the host power meter is controlled to send a power-off broadcast frame to all slave power meters. By introducing the 485 bus status flag to identify whether the 485 bus is being used, the power-off broadcast frame can be sent in time when the 485 bus is in the idle state, thereby improving the speed of power-off saving.

[0078] Step S3023, when the 485 bus status flag is in the use state, the broadcast flag is set to the waiting state, and the waiting state indicates that the power-off broadcast frame is waiting to be sent. Specifically, the broadcast flag can be represented by BCFlag. If BCFlag is 0, it means that there is no power-off broadcast frame waiting to be sent. If BCFlag is 1, it means that there is a power-off broadcast frame waiting to be sent. When CommFlag is obtained as 1, it means that the 485 bus is being used and the power-off broadcast frame cannot be inserted and sent. At this time, BCFlag is set to 1, indicating that the power-off broadcast frame is waiting to be sent.

[0079] Step S3024, continuously obtain the 485 bus status flag, and when the 485 bus status flag is in the idle state and the broadcast flag is in the waiting state, control the host power meter to send a power-off broadcast frame to all slave power meters. Specifically, continuously obtain the 485 bus status flag, and when the CommFlag is obtained to be 0, it means that the 485 bus is in the idle state. If BCFlag is 1 at this time, it means that the power-off broadcast frame is waiting to be sent. At this time, the host power meter is controlled to send a power-off broadcast frame to all slave power meters. By introducing a broadcast flag to identify whether there is a power-off broadcast frame waiting to be sent when the 485 bus is in use, the power-off broadcast frame can be sent in time when the 485 bus is in the idle state and the broadcast flag is in the waiting state, thereby improving the speed of power-off saving.

[0080] Step S3025, when the power-off broadcast frame has been sent, the broadcast flag is set to an idle state. Specifically, when the power-off broadcast frame has been sent, there is no need to wait for the broadcast, and the broadcast flag is set to an idle state, that is, BCFlag is set to 0. By timely modifying the broadcast flag when the power-off broadcast frame has been sent, the efficiency of power-off preservation is improved.

[0081] Specifically, the above step S302 controls the host power meter to save power data, including:

[0082] Step S3026, obtain the read-write lock state, the read-write lock state is used to identify that the memory storing the electric energy data is in an idle state or in use state. Specifically, the host electric energy meter and the slave electric energy meter will read and write the memory when executing tasks in the main loop. The embodiment of the present invention is described by taking the memory as EEPROM as an example. The conventional interface process of reading and writing EEPROM has the problem that when any electric energy meter loses power when operating EEPROM in the main loop, jumps to the power-off interrupt or 485 bus interrupt to save the power-off, and operates EEPROM again, a competition relationship will be formed, thereby causing the operation of EEPROM to fail and the electric energy data cannot be reliably saved. The embodiment of the present invention improves the above-mentioned conventional interface process of reading and writing EEPROM by adding a read-write lock. The read-write lock can be represented by ReadWrLock. If ReadWrLock is 1, it means that EEPROM is locked and EEPROM cannot be operated elsewhere. If ReadWrLock is 0, it means that EEPROM is unlocked and can be operated. Figure 4 is an interface flow chart of a read-write memory according to an embodiment of the present invention, such as Figure 4 As shown, first, the read-write lock ReadWrLock is set to 1 to lock the EEPROM, then a start signal is sent to indicate the start of the read-write operation, then an address signal is sent to indicate the read-write address, then the read-write operation is performed, then an end signal is sent to indicate the end of the read-write operation, and finally the read-write lock ReadWrLock is cleared to unlock the EEPROM.

[0083] Step S3027, when the read-write lock state is in the idle state, the host power meter is controlled to save the power data. Specifically, if ReadWrLock is obtained to be 0, it means that the read-write lock is in the idle state, that is, the EEPROM can be operated. At this time, the host power meter is controlled to save the power data to the EEPROM. By introducing the read-write lock state to identify whether the memory used to save power data is being used, the power data can be saved in time when the read-write lock is in the idle state, which improves the speed of power-off saving.

[0084] Step S3028, when the read-write lock state is in use, the contention flag is set to exist state, which indicates that the main loop and the power-off interrupt are competing for the use of the memory. Specifically, the contention flag can be represented by FightFlag. If FightFlag is 0, it means that the main loop and the power-off interrupt are not competing for the use of EEPROM. If FightFlag is 1, it means that the main loop and the power-off interrupt are competing for the use of EEPROM. When ReadWrLock is obtained as 1, it means that the EEPROM is being locked and cannot be saved after power failure. At this time, FightFlag is set to 1, indicating that the main loop and the power-off interrupt are competing for the use of EEPROM.

[0085] Step S3029, control the host power meter to exit the power-off interruption, jump back to the main loop, and continue to execute the main loop task of the host power meter. Specifically, when the host power meter is waiting for power-off saving, control the host power meter to jump back to the main loop from the power-off interruption, and continue to execute the main loop task.

[0086] Step S30210, continuously obtain the read-write lock status, and when the read-write lock status is idle and the competition flag is in the presence state, control the host power meter to save the power data. Specifically, continuously obtain the read-write lock status, and when ReadWrLock is obtained to be 0, it means that the EEPROM can be operated. If FightFlag is 1 at this time, it means that the main loop and the power-off interrupt are competing for the use of the EEPROM. At this time, the host power meter is controlled to save the power data. By introducing a competition flag to identify whether the main loop and the power-off interrupt are currently competing for the use of the EEPROM when the read-write lock status is in use, the power data can be saved in time when the read-write lock is idle and the competition flag is in the presence state, thereby improving the speed of power-off saving.

[0087] Step S30211, after the power data of the host power meter is saved, the competition flag is set to a non-existent state. Specifically, when the power data of the host power meter has been saved and there is no need to compete for the use of the memory, the competition flag is set to a non-existent state, that is, FightFlag is set to 0. By timely modifying the competition flag when the power data of the host power meter has been saved, the efficiency of power-off saving is improved.

[0088] In some optional embodiments, Figure 5 is a flow chart of power-off saving based on the read-write lock state and the competition flag according to an embodiment of the present invention, such as Figure 5 As shown, in order to save the power off immediately, in each task of the main loop, each time the above Figure 4After the read / write memory interface shown in the figure is used, it is necessary to determine whether a power-off save operation can be performed. First, determine whether an EEPROM read / write competition has occurred. If a read / write competition has occurred, that is, the competition flag is in the existent state, then the improved read / write EEPROM interface is used for power-off save, and then the competition flag is set to the non-existent state.

[0089] In some optional embodiments, the method further comprises:

[0090] Step a3, after the power data of the host power meter is saved, the host power meter is controlled to jump back to the main loop and continue to execute the main loop task of the host power meter. Specifically, after the host power meter saves the power data through the above step S3027, the host power meter is controlled to jump back to the main loop and continue to execute the main loop task of the host power meter; after the host power meter saves the power data through the above steps S3028 to S30211, it is already in the main loop and continues to execute the main loop task of the host power meter, thereby ensuring the normal operation of the multi-user power meter.

[0091] In some optional embodiments, Figure 6 1 is a flowchart of power-off storage of a host electric energy meter according to an embodiment of the present invention. Figure 6As shown, first, the competition flag, broadcast flag and 485 bus status flag are initialized, that is, the competition flag is set to the non-existent state, the broadcast flag is set to the idle state and the 485 bus status flag is set to the idle state. Then, when the host electric energy meter executes each task in the main loop, the AC terminal voltage is detected in real time. When the AC terminal voltage is lower than the first preset voltage, the current main loop task is suspended, and the host electric energy meter is controlled to jump to the power-off interrupt. In the power-off interrupt, in order to reliably save the power-off, the improved read-write EEPROM interface is called for power-off saving. When the 485 bus status flag is in the idle state, the host electric energy meter is controlled to send a power-off broadcast frame. When the 485 bus status flag is not in the idle state, that is, in the use state, the broadcast flag is set to the waiting state. Specifically, the process of sending a power-off broadcast frame: continuously judge the 485 bus status flag, when the 485 bus status flag is in the use state, it cannot be sent, when the 485 bus status flag is in the idle state, it is judged whether the broadcast flag is 1, that is, whether the broadcast flag is in the waiting state. When the broadcast flag is 1, send a power-off broadcast frame and clear the broadcast flag. Then, determine the read-write lock status. When the read-write lock status is idle, call the improved read-write EEPROM interface for power-off saving. At this time, determine whether read-write competition has occurred, that is, determine the competition flag. When the competition flag is in the existing state, call the improved read-write EEPROM interface for power-off saving, and then control the host power meter to jump back to the task just executed to continue execution. In addition, during the execution of each main loop task, other read and write operations except saving power data can be performed through the improved read-write EEPROM interface.

[0092] Step S303: When any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than the second preset voltage, the slave electric energy meter is controlled to save electric energy data. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0093] The power-off preservation method for electric energy meters provided in an embodiment of the present invention, based on the host electric energy meter and the slave electric energy meter performing their own power-off detection respectively, when the input voltage detected in real time by the host electric energy meter is lower than the first preset voltage, sends a power-off broadcast frame to all slave electric energy meters for advance prediction, so that all slave electric energy meters can perform power-off preservation of electric energy data in advance, realize fast and reliable power-off preservation, and ensure the integrity of electric energy data and the normal operation of multi-user electric energy meters.

[0094] In this embodiment, a method for saving power failure of an electric energy meter is provided, which can be used for the above-mentioned multi-user electric energy meter. Figure 7 FIG. 4 is a flow chart of another method for preserving power-off of an electric energy meter according to an embodiment of the present invention. Figure 7 As shown, the process includes the following steps:

[0095] Step S701, obtaining the input voltage of the power supply of the master power meter of the multi-user power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0096] Step S702: When the input voltage is lower than the first preset voltage, the host electric energy meter is controlled to send a power-off broadcast frame to all slave electric energy meters, and the host electric energy meter is controlled to save electric energy data. Figure 3 Step S302 of the illustrated embodiment will not be described in detail here.

[0097] Step S703 : when any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage, control the slave electric energy meter to save electric energy data.

[0098] In some optional implementations, before controlling the slave electric energy meter to save electric energy data in step S703, the method further includes:

[0099] Step b1, suspending the main cycle task being executed by the slave electric energy meter. Specifically, the slave electric energy meter executes the task in the main cycle. When the DC terminal voltage of the slave electric energy meter is lower than the second preset voltage, the slave electric energy meter is powered off, and the main cycle task being executed by the slave electric energy meter is suspended. Alternatively, when the slave electric energy meter receives a power-off broadcast frame, the host electric energy meter is powered off, and the slave electric energy meter needs to perform power-off saving in advance, and the main cycle task being executed by the slave electric energy meter is suspended.

[0100] Step b2, control the slave electric energy meter to jump to 485 bus interruption or power-off interruption. Specifically, when the slave electric energy meter receives a power-off broadcast frame for power-off saving, the slave electric energy meter is controlled to jump to 485 bus interruption. When the slave electric energy meter performs power-off saving when the voltage at the DC terminal is lower than the second preset voltage, the slave electric energy meter is controlled to jump to power-off interruption.

[0101] Specifically, the above step S703 controls the slave electric energy meter to save electric energy data, including:

[0102] Step S7031, obtain the read-write lock status, which is used to identify whether the memory storing the power data is in an idle state or in use state. Figure 3 Step S3026 of the illustrated embodiment will not be described in detail here.

[0103] Step S7032: When the read-write lock is in the idle state, control the slave power meter to save the power data. Figure 3 In step S3027 of the illustrated embodiment, the method of controlling the host power meter to save power data controls the slave power meter to save power data, which will not be described in detail here.

[0104] Step S7033, when the read-write lock state is in use, the contention flag is set to exist state, which indicates that the main loop and the power-off interrupt are competing for the use of the memory or the main loop and the 485 bus interrupt are competing for the use of the memory. Figure 3 Step S3028 of the illustrated embodiment is not described in detail here. It should be noted that when the slave electric energy meter receives the power-off broadcast frame for power-off saving, the existence of the competition flag indicates that the main loop and the 485 bus interrupt are competing for the use of the memory. When the slave electric energy meter performs power-off saving when the voltage at the DC terminal is lower than the second preset voltage, the existence of the competition flag indicates that the main loop and the power-off interrupt are competing for the use of the memory.

[0105] Step S7034, control the slave electric energy meter to exit the 485 bus interruption or power-off interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter. Specifically, when the slave electric energy meter receives a power-off broadcast frame for power-off saving, the slave electric energy meter is controlled to exit the 485 bus interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter. When the slave electric energy meter performs power-off saving when the voltage at the DC terminal is lower than the second preset voltage, the slave electric energy meter is controlled to exit the power-off interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter, thereby ensuring the normal operation of the multi-user electric energy meter.

[0106] Step S7035, continuously obtain the read-write lock state, and when the read-write lock state is idle and the contention flag is present, control the slave power meter to save the power data. Figure 3 In step S30210 of the illustrated embodiment, the slave electric energy meter is controlled to save electric energy data according to the method of controlling the master electric energy meter to save electric energy data, which will not be described in detail here.

[0107] Step S7036: After the electric energy data of the slave electric energy meter is saved, the contention flag is set to a non-existent state. Figure 3 Step S30211 of the illustrated embodiment will not be described in detail here.

[0108] In some optional embodiments, the method further comprises:

[0109] Step b3, after the electric energy data of the slave electric energy meter is saved, the slave electric energy meter is controlled to jump back to the main loop and continue to execute the main loop task of the slave electric energy meter. Specifically, after the slave electric energy meter saves the electric energy data through the above step S7032, the slave electric energy meter is controlled to jump back to the main loop and continue to execute the main loop task of the slave electric energy meter; after the slave electric energy meter saves the electric energy data through the above steps S7033 to S7036, it is already in the main loop and continues to execute the main loop task of the slave electric energy meter, thereby ensuring the normal operation of the multi-user electric energy meter.

[0110] In some optional embodiments, Figure 8 1 is a flowchart of power-off saving of a slave electric energy meter according to an embodiment of the present invention. Figure 8 As shown, first, the competition flag, broadcast flag and 485 bus status flag are initialized, that is, the competition flag is set to the non-existent state, the broadcast flag is set to the idle state and the 485 bus status flag is set to the idle state. Then, when the slave electric energy meter executes each task in the main loop, the DC terminal voltage is detected in real time. When the DC terminal voltage is lower than the second preset voltage or a power-off broadcast frame is received, the execution of the current main loop task is suspended, and the slave electric energy meter is controlled to jump to the power-off interrupt or the 485 bus interrupt. In the power-off interrupt or the 485 bus interrupt, in order to reliably perform power-off preservation, the improved read-write EEPROM interface is called for power-off preservation. Specifically, the slave electric energy meter receives a byte of data, and after the one-byte data is received, it is determined whether the one-byte data is a power-off broadcast frame. In the case that the one-byte data is not a power-off broadcast frame, frame processing is performed. In the case that the one-byte data is a power-off broadcast frame, the read-write lock state is determined, and in the case that the read-write lock state is in the idle state, the improved read-write EEPROM interface is called for power-off preservation. At this time, it is determined whether there has been a read-write competition, that is, the competition flag is determined. If the competition flag is in the existing state, the improved read-write EEPROM interface is called to save the power-off state, and then the slave electric energy meter is controlled to jump back to the task just executed to continue execution. In addition, during the execution of each main loop task, other read and write operations can be performed through the improved read-write EEPROM interface in addition to saving electric energy data.

[0111] The power-off preservation method for electric energy meters provided in an embodiment of the present invention, based on the host electric energy meter and the slave electric energy meter performing their own power-off detection respectively, when the input voltage detected in real time by the host electric energy meter is lower than the first preset voltage, sends a power-off broadcast frame to all slave electric energy meters for advance prediction, so that all slave electric energy meters can perform power-off preservation of electric energy data in advance, realize fast and reliable power-off preservation, and ensure the integrity of electric energy data and the normal operation of multi-user electric energy meters.

[0112] In this embodiment, a power-off storage device for an electric energy meter is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0113] This embodiment provides a power-off storage device for an electric energy meter, such as Fig. 9 As shown, including:

[0114] The acquisition module 901 is used for acquiring the input voltage of the power supply of the master power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter.

[0115] The sending module 902 is used to control the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters when the input voltage is lower than the first preset voltage, and control the host electric energy meter to save electric energy data.

[0116] The saving module 903 is used to control the slave electric energy meter to save the electric energy data when any slave electric energy meter receives a power-off broadcast frame or the output voltage of the slave electric energy meter is lower than the second preset voltage.

[0117] In an optional implementation, the sending module 902 includes:

[0118] The first acquisition unit is used to acquire a 485 bus status flag, where the 485 bus status flag is used to identify whether the 485 bus that sends the power-off broadcast frame is in an idle state or in use state.

[0119] The first sending unit is used to control the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters when the 485 bus status mark is in an idle state.

[0120] In an optional implementation, the sending module 902 further includes:

[0121] The first setting unit is used to set the broadcast flag to a waiting state when the 485 bus state flag is in a use state, wherein the waiting state indicates that the power-off broadcast frame is waiting to be sent.

[0122] The second sending unit is used to continuously obtain the 485 bus status flag, and when the 485 bus status flag is in the idle state and the broadcast flag is in the waiting state, control the host power meter to send a power-off broadcast frame to all slave power meters.

[0123] The second setting unit is used to set the broadcast flag to an idle state when the power-off broadcast frame has been sent.

[0124] In an optional implementation manner, before sending module 902, the device further includes:

[0125] The first pause module is used to pause the main cycle task being executed by the host electric energy meter.

[0126] The first jump module is used to control the host electric energy meter to jump to the power-off interrupt.

[0127] Before the saving module 903, the device further includes:

[0128] The second pause module is used to pause the main cycle task being executed by the slave electric energy meter.

[0129] The second jump module is used to control the jump from the electromechanical energy meter to the 485 bus interruption or power-off interruption.

[0130] In an optional implementation, the sending module 902 or the saving module 903 includes:

[0131] The second acquisition unit is used to acquire a read-write lock state, where the read-write lock state is used to identify whether the memory storing the electric energy data is in an idle state or in use state.

[0132] The first saving unit is used to control the host electric energy meter to save the electric energy data or control the slave electric energy meter to save the electric energy data when the read-write lock state is an idle state.

[0133] In an optional implementation, the sending module 902 or the saving module 903 further includes:

[0134] The third setting unit is used to set the competition flag to the existence state when the read-write lock state is the use state, and the existence state indicates that the main loop and the power-off interrupt are competing for the use of the memory or the main loop and the 485 bus interrupt are competing for the use of the memory.

[0135] The execution unit is used to control the host electric energy meter to exit the power-off interruption, jump back to the main loop, and continue to execute the main loop task of the host electric energy meter, or control the slave electric energy meter to exit the 485 bus interruption or power-off interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter.

[0136] The second storage unit is used to continuously obtain the read-write lock state, and when the read-write lock state is an idle state and the competition flag is an existing state, control the host power meter to save the power data or control the slave power meter to save the power data.

[0137] The fourth setting unit is used to set the contention flag to a non-existent state after the electric energy data of the master electric energy meter is saved or the electric energy data of the slave electric energy meter is saved.

[0138] In an optional embodiment, the device further comprises:

[0139] The first execution module is used to control the host electric energy meter to jump back to the main loop and continue to execute the main loop task of the host electric energy meter after the electric energy data of the host electric energy meter is saved.

[0140] The second execution module is used to control the slave electric energy meter to jump back to the main loop and continue to execute the main loop task of the slave electric energy meter after the electric energy data of the slave electric energy meter is saved.

[0141] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0142] The power-off preservation device of the electric energy meter in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0143] The embodiment of the present invention also provides a computer device having the above Fig. 9 The power-off storage device of the electric energy meter shown.

[0144] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.

[0145] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0146] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0147] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0148] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0149] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0150] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for preserving an electric energy meter after power failure, characterized in that: The method comprises: Acquire the input voltage of the power supply of the master power meter of the multi-user power meter and the output voltage of the power supply of each slave power meter of the multi-user power meter; When the input voltage is lower than a first preset voltage, the host electric energy meter is controlled to send a power-off broadcast frame to all slave electric energy meters, and the host electric energy meter is controlled to save electric energy data; When any slave electric energy meter receives the power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage, controlling the slave electric energy meter to save electric energy data; The controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters includes: Obtaining a 485 bus status flag, wherein the 485 bus status flag is used to identify whether the 485 bus that sends the power-off broadcast frame is in an idle state or in a used state; When the 485 bus status flag is in an idle state, controlling the host electric energy meter to send the power-off broadcast frame to all the slave electric energy meters; When the 485 bus status flag is in the use state, the broadcast flag is set to the waiting state, and the waiting state indicates that the power-off broadcast frame is waiting to be sent; Continuously acquiring the 485 bus status flag, and when the 485 bus status flag is in an idle state and the broadcast flag is in a waiting state, controlling the host electric energy meter to send the power-off broadcast frame to all the slave electric energy meters; In the case where the power-off broadcast frame has been sent, the broadcast flag is set to an idle state.

2. The method for preserving electric energy meter after power failure according to claim 1, characterized in that: Before controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters, the method further includes: Pause the main cycle task being executed by the host electric energy meter; Control the host electric energy meter to jump to power-off interruption; Before controlling the slave electric energy meter to save electric energy data, the method further includes: Pause the main cycle task being executed by the slave electric energy meter; Control the slave electric energy meter to jump to 485 bus interruption or power-off interruption.

3. The method for preserving electric energy meter after power failure according to claim 2, characterized in that: The controlling the host electric energy meter to store electric energy data or the controlling the slave electric energy meter to store electric energy data comprises: Acquire a read-write lock state, where the read-write lock state is used to identify whether the memory storing the electric energy data is in an idle state or in a used state; When the read-write lock state is an idle state, the host electric energy meter is controlled to save the electric energy data or the slave electric energy meter is controlled to save the electric energy data.

4. The method for preserving electric energy meter after power failure according to claim 3, characterized in that: The controlling the host electric energy meter to store electric energy data or the controlling the slave electric energy meter to store electric energy data further includes: When the read-write lock state is in the use state, the contention flag is set to the existence state, wherein the existence state indicates that the main loop and the power-off interruption are competing for the use of the memory or the main loop and the 485 bus interruption are competing for the use of the memory; Control the host electric energy meter to exit the power-off interruption, jump back to the main loop, and continue to execute the main loop task of the host electric energy meter, or control the slave electric energy meter to exit the 485 bus interruption or power-off interruption, jump back to the main loop, and continue to execute the main loop task of the slave electric energy meter; Continuously acquiring the read-write lock state, and when the read-write lock state is an idle state and the competition flag is in an existent state, controlling the host electric energy meter to save electric energy data or controlling the slave electric energy meter to save electric energy data; After the electric energy data of the host electric energy meter is saved or the electric energy data of the slave electric energy meter is saved, the competition flag is set to a non-existent state.

5. The power-off preservation method of the electric energy meter according to claim 2, characterized in that: The method further comprises: After the power data of the host power meter is saved, the host power meter is controlled to jump back to the main loop and continue to execute the main loop task of the host power meter; After the electric energy data of the slave electric energy meter is saved, the slave electric energy meter is controlled to jump back to the main loop and continue to execute the main loop task of the slave electric energy meter.

6. A power-off storage device for an electric energy meter, characterized in that: The device comprises: An acquisition module, used for acquiring an input voltage of a power supply of a master power meter of a multi-user power meter and an output voltage of a power supply of each slave power meter of the multi-user power meter; A sending module, used for controlling the host electric energy meter to send a power-off broadcast frame to all slave electric energy meters when the input voltage is lower than a first preset voltage, and controlling the host electric energy meter to save electric energy data; A saving module, used for controlling the slave electric energy meter to save electric energy data when any slave electric energy meter receives the power-off broadcast frame or the output voltage of the slave electric energy meter is lower than a second preset voltage; Wherein, the sending module is specifically used for: Obtaining a 485 bus status flag, wherein the 485 bus status flag is used to identify whether the 485 bus that sends the power-off broadcast frame is in an idle state or in a used state; When the 485 bus status flag is in an idle state, controlling the host electric energy meter to send the power-off broadcast frame to all the slave electric energy meters; When the 485 bus status flag is in the use state, the broadcast flag is set to the waiting state, and the waiting state indicates that the power-off broadcast frame is waiting to be sent; Continuously acquiring the 485 bus status flag, and when the 485 bus status flag is in an idle state and the broadcast flag is in a waiting state, controlling the host electric energy meter to send the power-off broadcast frame to all the slave electric energy meters; In the case where the power-off broadcast frame has been sent, the broadcast flag is set to an idle state.

7. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the power-off preservation method of the electric energy meter according to any one of claims 1 to 5 by executing the computer instructions.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the power-off preservation method for an electric energy meter according to any one of claims 1 to 5.