Electricity meter troubleshooting methods
The method addresses incomplete power-off data storage in electric energy meters by detecting faults, adjusting storage strategies, and implementing priority-based data handling to ensure accurate billing and reduce replacement costs.
Patent Information
- Application Number
- CN202411380005.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-30
AI Technical Summary
Existing electric energy meters face issues with incomplete power-off data storage due to capacitor aging, leading to inaccurate measurements and increased costs and disputes from delayed replacement.
An electric energy meter fault handling method that detects power failure events, assesses power supply duration, and adjusts the power-off data storage strategy to ensure complete data transfer to non-volatile memory, incorporating priority-based data storage and fault tolerance mechanisms.
Ensures complete power-off data storage, preventing inaccurate billing and reducing replacement costs by automatically adjusting data storage strategies to accommodate capacitor degradation.
Smart Images

Figure CN118897656B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of electric energy meters, and in particular to a method for handling faults of electric energy meters. Background Art
[0002] According to the definition of the smart electricity meter functional specification, power outage refers to the condition where the power supply voltage of the electricity meter is lower than the critical voltage of the electricity meter, and the specification requires that when the electricity meter meets the power-off condition, the power outage shall be recorded regardless of whether the electricity meter is working or not; if the electricity meter can still work at this time, and the voltage continues to decrease until the electricity meter cannot work, the end of the power outage will not be recorded. Wait until the voltage recovers to the level where the electricity meter starts working, and then the judgment of the power-off event will be recorded.
[0003] Generally, when the electric energy meter switches to the power-off condition, the supercapacitor in the electric energy meter is used for power supply. From the time when the electric energy meter switches to the power-off condition to the time when the voltage continues to decrease until the electric energy meter cannot work, the electric energy meter writes the power-off data from the running memory (i.e., random access memory) to the non-volatile memory. This is the power-off data storage function of the electric energy meter, where the power-off data refers to the data that needs to be properly saved when a power-off event occurs in the electric energy meter.
[0004] There have been corresponding studies in the prior art regarding the power-off data storage function of the electric energy meter. For example, Patent Document 1 discloses the reasons for the power supply duration and whether the power-off data can be completely written into the non-volatile memory. Specifically, when the voltage of the supercapacitor of the electric energy meter drops to a certain voltage threshold, the electric energy meter will not be able to work normally. At this time, the electric energy meter cannot reliably write the power-off data into the non-volatile memory. The duration for the voltage of the supercapacitor to drop to the voltage threshold after the power-off event occurs is defined as the power supply duration. It can be seen that the power supply duration will determine the amount of power-off data that can be written into the non-volatile memory after the power-off event occurs. The longer the power supply duration, the more the integrity of the power-off data written into the non-volatile memory can be guaranteed. Generally, during the design and production process of the electric energy meter, tests will be carried out to ensure that the power supply duration of the supercapacitor after the power-off event of the electric energy meter can meet the requirements of writing the power-off data completely into the non-volatile memory. For example, Patent Document 2 discloses how to measure the relationship between the capacity of a supercapacitor and whether power-off data can be completely stored when designing and producing an electric energy meter. Based on this relationship, the capacity of the supercapacitor can be configured when the electric energy meter is designed and produced, so that when the electric energy meter loses power, the power supply time of the supercapacitor can meet the requirement that the power-off data can be completely written into the non-volatile memory.
[0005] The solution in the prior art allows a newly manufactured electric energy meter to completely store power-off data when a power outage occurs. However, after the electric energy meter designed using the above solution has been used for a long time, the supercapacitor in the electric energy meter may have a shortened power supply time due to aging or the use environment, so that its power-off data storage function may fail, that is, the power-off data may not be completely stored after a power outage occurs in the electric energy meter, which may cause deviations in the measurement results of the electric energy meter. Therefore, it is necessary to solve this failure.
[0006] Patent document 1, patent name, power-off preservation method, device, computer equipment and storage medium for electric energy meter; publication number, CN118244998A; publication date, 2024-06-25.
[0007] Patent document 2, patent name, simulation method and system based on power-off data storage of electric energy meter; publication number, CN107861851A; publication date, 2018-03-30. Summary of the invention
[0008] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art and to provide an electric energy meter fault handling method, which can enable the electric energy meter to identify whether the power-off data storage function of the electric energy meter has a fault after power-on and automatically adjust the power-off data storage strategy of the power-off data storage function of the electric energy meter in the event of a fault, so that the electric energy meter can completely store the power-off data when a power-off event occurs next time, thereby ensuring the accuracy of the metering results of the electric energy meter.
[0009] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0010] A method for handling an electric energy meter fault, the method comprising:
[0011] After the electric energy meter is powered on, it detects whether a power failure event occurs;
[0012] If a power failure event occurs and the power failure event has not ended, the electric energy meter determines whether a power failure data storage failure has occurred; wherein the power failure data storage failure is that the power failure data stored in the non-volatile memory is incomplete;
[0013] If a power-off data storage failure occurs, the electric energy meter obtains the actual power supply duration of the supercapacitor when the power-off event occurs; wherein the actual power supply duration is the time from the detection of the power-off event to the voltage of the supercapacitor dropping to a preset voltage threshold; the preset voltage threshold is the voltage value when the voltage of the supercapacitor drops to a level that the non-volatile memory of the electric energy meter cannot write data normally after the electric energy meter loses power;
[0014] The electric energy meter adjusts the power-off data storage strategy based on the actual power supply duration so that the first data amount is smaller than the second data amount; wherein the power-off data is data that needs to be written from the running memory to the non-volatile memory when a power-off event occurs in the electric energy meter; the first data amount is the maximum amount of power-off data allowed to be temporarily stored in the running memory of the electric energy meter, and the second data amount is the amount of data that the electric energy meter can write from the running memory to the non-volatile memory within the time corresponding to the actual power supply duration, and the power-off data storage strategy limits the value of the first data amount.
[0015] Beneficial effect: Since the power-off data storage strategy can be adjusted in time after determining that the last power-off data storage function has failed, the maximum amount of power-off data allowed to be temporarily stored in the running memory of the electric energy meter is less than the amount of data that can be written from the running memory to the non-volatile memory within the time corresponding to the actual power supply duration of the electric energy meter. Therefore, the electric energy meter can completely store the power-off data when a power-off event occurs next time.
[0016] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention is further described below in conjunction with the accompanying drawings and embodiments;
[0018] Figure 1 A schematic diagram of a flow chart of a method for handling an electric energy meter fault in an embodiment;
[0019] Figure 2 A schematic diagram of a flow chart of a method for handling an electric energy meter fault in an embodiment;
[0020] Figure 3 A schematic diagram of a flow chart of a method for handling an electric energy meter fault in an embodiment;
[0021] Figure 4 A schematic diagram of a flow chart of a method for handling an electric energy meter fault in an embodiment;
[0022] Figure 5 A schematic diagram of a flow chart of a method for handling an electric energy meter fault in an embodiment;
[0023] Figure 6 1 is a circuit schematic diagram of a voltage detection and trigger circuit and an auxiliary clock circuit in one embodiment. DETAILED DESCRIPTION
[0024] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0025] Patent document 1 discloses that after the power meter loses power, when the voltage of the supercapacitor drops to a certain voltage threshold, the power meter will not work properly, and the power meter cannot reliably write the power-off data into the non-volatile memory. Therefore, Patent document 2 discloses how to measure the relationship between the capacity of the supercapacitor and whether the power-off data can be completely stored when designing and producing the power meter. Based on this relationship, the capacity of the supercapacitor can be configured when the power meter is designed and produced, so that when the power meter loses power, the power supply time of the supercapacitor can meet the requirement that the power-off data can be completely written into the non-volatile memory.
[0026] However, after the energy meter has been used for a long time, the capacitance will decrease due to problems such as capacitor aging. The energy meter does not allow private disassembly and replacement of components. The operator of the power company can only replace the entire meter after the main station receives a fault alarm. On the one hand, this increases the cost. On the other hand, the inaccurate measurement caused by the fault between the fault alarm and the replacement of the entire meter may also cause disputes. Therefore, it is necessary to provide the energy meter with a solution that can automatically repair the fault when the supercapacitor fails or the power-off data storage function fails, so as to reduce the cost of replacing the entire meter and eliminate the fault in time to avoid disputes.
[0027] In this regard, a method for handling electric energy meter faults provided by the present application is described in detail below in conjunction with the accompanying drawings and embodiments.
[0028] like Figure 1 As shown, in one embodiment, a method for handling an electric energy meter fault is provided, the method comprising:
[0029] Step S202: After being powered on, the electric energy meter detects whether a power failure event occurs.
[0030] Step S204: If a power failure event occurs and the power failure event has not ended, the electric energy meter determines whether a power failure data storage fault occurs.
[0031] Step S206: If a power failure data storage failure occurs, the electric energy meter obtains the actual power supply duration of the supercapacitor when the power failure occurs.
[0032] Step S208: The electric energy meter adjusts the power-off data storage strategy based on the actual power supply duration so that the first data amount is smaller than the second data amount.
[0033] Specifically, the power-off data storage failure is that the power-off data stored in the non-volatile memory is incomplete. Among them, the actual power supply duration is the time from the detection of the power-off event to the voltage of the supercapacitor dropping to the preset voltage threshold. The preset voltage threshold is the voltage value when the voltage of the supercapacitor drops to the non-volatile memory of the electric energy meter after the power is lost. Among them, the power-off data is the data that needs to be written from the running memory to the non-volatile memory when a power-off event occurs in the electric energy meter; the first data amount is the maximum amount of power-off data allowed to be temporarily stored in the running memory of the electric energy meter, and the second data amount is the amount of data that the electric energy meter can write from the running memory to the non-volatile memory within the time corresponding to the actual power supply duration, and the power-off data storage strategy limits the value of the first data amount.
[0034] Specifically, by counting the speed at which the energy meter recently writes data from the running memory to the non-volatile memory, for example, it takes 220ms to erase 1MB of data, and the actual power supply time is 1100ms, then the second data volume is 5MB. It can be seen that as long as the first data volume is less than 5MB, it can be guaranteed that the data is completely written to the non-volatile memory when the power is off. To be on the safe side and provide a certain fault tolerance space, the first data volume can be set to 1 / 2 or 3 / 4 of the second data volume, etc.
[0035] Specifically, every time a power failure event occurs in the electric energy meter, a log record will be made of the power failure event and the timestamp of the power failure event. After power-on, the log will be opened from a fixed path in the file system and analyzed from the last log event entry forward. If the first power failure event encountered is a power failure start event, it means that a power failure event has occurred and the power failure event has not ended; if the first power failure event encountered is a power failure end event, it means that no power failure event has occurred. Specifically, a flag bit is set at the beginning of each log event entry to distinguish the event category. For example, the flag bit of a power failure event is 1100, including a power failure start event and a power failure end event, and the flag bit of a power-on event is 1101. By identifying the flag bit, the category of the event recorded in the log can be quickly identified after power-on.
[0036] In some embodiments, before writing the power-off data to the non-volatile memory, the data volume of the power-off data can be calculated first, and then the data volume can be written into the file header. After power-on, the data volume can be obtained by reading the file header and compared with the actual data volume of the power-off data file in the non-volatile memory to determine whether the power-off data file is complete. Alternatively, it can be agreed that when the power-off data is completely written to the non-volatile memory, an identifier of a certain length is appended to the end of the file, for example, the identifier is agreed to be 0x5555, and after power-on, the integrity of the power-off data can be determined by only reading the file end corresponding to each power-off data file and detecting whether the identifier exists.
[0037] It should be noted that in this embodiment, during operation, the electric energy meter uses a data management and identification mechanism to identify and calculate the total amount of data in the current memory that needs to be saved in the non-volatile memory when power is off. The specific process is as follows:
[0038] First, data structured management divides the data to be managed into multiple data items, each of which contains the following information: Data identifier: uniquely identifies the data item. Data size: the memory size occupied by the data item (in bytes). Need to save flag: indicates whether the data item needs to be saved when power is off. Data item list: establish a data item list or data table to record all data items that need to be managed and their information.
[0039] Then, data changes are monitored and the need-to-save flag is set: when the content of a data item changes, the system sets its corresponding need-to-save flag to "need to save". This change can be detected through data modification functions, callback mechanisms, or regular scanning.
[0040] Secondly, the total amount of data that needs to be saved is updated in real time. The system maintains a variable to record the total size of data that needs to be saved when power is off. When the need-to-save flag of a data item changes from "not needed" to "needed", the size of the data item is added to the total amount of data. When the need-to-save flag of a data item changes from "needed" to "not needed", the size of the data item is subtracted from the total amount of data.
[0041] Finally, the total amount of data that needs to be saved is calculated to obtain the amount of power-off data in the memory. By maintaining the total amount of data variable, the system can obtain the total size of the data that needs to be saved when power is off at any time.
[0042] It can be understood that the first data amount is the maximum amount of power-off data allowed to be temporarily stored in the running memory of the electricity meter. Therefore, the amount of power-off data in the memory should be less than the first data amount. In an example, once it is identified that the amount of power-off data in the memory reaches 80% of the first data amount, part of the power-off data is immediately written to the non-volatile memory. In this way, it is ensured that all power-off data in the memory can be completely stored in the non-volatile memory when the power is off.
[0043] Because in this embodiment, after determining that the power-off data storage function of the last time has failed, the power-off data storage strategy can be adjusted in time, so that the maximum amount of power-off data allowed to be temporarily stored in the running memory of the electric energy meter is less than the amount of data that can be written from the running memory to the non-volatile memory within the time corresponding to the actual power supply duration of the electric energy meter. Therefore, the electric energy meter can completely store the power-off data when a power-off event occurs next time.
[0044] like Figure 2 As shown, in one embodiment, the method further includes:
[0045] Step S302, dividing the power-off data into different priorities.
[0046] Step S304: when a power failure occurs, the power failure data with a high priority is stored first.
[0047] Step S306, when detecting whether the power-off data stored in the non-volatile memory is complete, the integrity of the power-off data with the lowest priority is detected first.
[0048] Step S308: Once it is detected that the power-off data with a lower priority is incomplete, it is directly determined that a power-off data storage failure has occurred.
[0049] In this embodiment, due to the priority storage, the most important data that will affect billing is given the highest priority. Even if the capacitor capacity decreases and the low-priority power-off data cannot be completely stored, it will not affect the billing. Therefore, fault tolerance is provided, and the failure will not affect normal billing before the strategy is adjusted.
[0050] Furthermore, when determining whether a power-off data storage failure has occurred, the lowest priority data is detected first, so that the failure can be determined more quickly in the event of a failure, because incomplete data appears first in data with a lower priority.
[0051] Secondly, by saving power-off data in priority, fault tolerance is provided, so it is allowed to make adjustments after a fault occurs. Conversely, if the priorities are not divided, it may lead to incomplete data that affects billing. In this case, if a fault occurs first and then an adjustment is made, even if the next fault is eliminated through adjustment, the previous fault will still affect billing. After the application divides the priorities, a fault will not affect billing as long as it is corrected next time.
[0052] like Figure 3 As shown, in one embodiment, the method further includes:
[0053] Step S402, if a power failure data storage failure occurs, the electric energy meter counts the target data volume of the target power failure data stored in the non-volatile memory when the last power failure event occurred; the target power failure data includes complete power failure data and incomplete power failure data.
[0054] Step S404: taking the target data volume as the second data volume.
[0055] In this embodiment, the amount of power-off data written into the non-volatile memory when the power-off event last occurred can reflect the actual power supply duration of the supercapacitor after the power meter was powered off. Therefore, when the capacity of the supercapacitor decreases, the amount of power-off data written into the non-volatile memory when the power-off event last occurred can be used as the second amount of data. After the second amount of data is re-determined, since the maximum amount of power-off data allowed to be temporarily stored in the running memory of the power meter is less than the second amount of data, when the power is off again, it can be ensured that the power-off data is completely written into the non-volatile memory.
[0056] For example, after power-on, the files corresponding to the power-off data in the path specially used to save power-off data in the file system are selected, and the total data volume of these files is counted. Although some files are incomplete, they can still reflect the actual amount of data saved after the last power off, which has a certain reference value.
[0057] like Figure 4 As shown, in some embodiments, the actual power supply duration is determined by the following steps:
[0058] Step S502: The time point at which the electric energy meter detects power failure is taken as the first time point.
[0059] Step S504: taking the time point when the voltage of the supercapacitor of the electric energy meter drops to a preset threshold voltage as the second time point.
[0060] Step S506: determining the actual power supply duration based on the difference between the second time point and the first time point.
[0061] In the above embodiment, the amount of power-off data written into the non-volatile memory when the power-off event occurred last time is used as the second amount of data, and due to interference from other electronic components in the electric energy meter circuit, part of the power-off data written into the non-volatile memory when the power-off event occurred last time is written into the non-volatile memory when the voltage of the supercapacitor drops below the preset threshold voltage. For example, due to the specific state of other energy storage components in the electric energy meter, during the last power-off process of the electric energy meter, after the voltage of the supercapacitor drops below the preset threshold voltage, part of the power-off data is still written into the non-volatile memory. However, at the next power failure, the state of other energy storage elements in the electric energy meter may be different from the state at the last power failure (for example, before the last power failure, a functional circuit with an energy storage element was enabled, but before the next power failure, the functional circuit was not enabled, so the corresponding energy storage device failed to play the role of power supply after power failure), resulting in the actual power supply duration at the next power failure may be different from the actual power supply duration of the previous power failure, which may cause the second data amount determined in the above embodiment to be inapplicable to the next power failure. Therefore, in order to more accurately determine the second data amount applicable to various situations, in this embodiment, the time from the first time point when the power failure event occurs to the second time point when the voltage of the supercapacitor drops to the preset threshold voltage is used as the actual power supply duration, which will not be affected by the other circuit conditions of the electric energy meter, and is more accurate and applicable to various situations.
[0062] like Figure 5 and Figure 6 As shown, in some embodiments, the second time point is determined by the following steps:
[0063] Step S602 , the voltage of the supercapacitor is detected by the voltage detection and trigger circuit 11 , and when the voltage drops to a preset threshold voltage, the auxiliary clock chip of the auxiliary clock circuit 12 is triggered to start running.
[0064] Step S604, after the electric energy meter is powered on, if a power-off data storage failure occurs, the current real-time time is obtained from the main clock chip and the current operating time is obtained from the auxiliary clock chip.
[0065] Step S606: determine the second time point based on the current real time and the current running time.
[0066] In this embodiment, the voltage detection and trigger circuit 11 provided can start the auxiliary clock chip when the voltage of the supercapacitor drops to a preset threshold voltage. The auxiliary clock chip and the main clock chip are powered by a battery and can operate normally even when the power is off. Therefore, after power-on, the second time point can be determined based on the real-time time obtained by the main clock chip minus the operating time of the auxiliary clock. It should be noted that each electric energy meter needs to be equipped with a main clock chip and a battery that powers the main clock chip after power failure.
[0067] Specifically, Figure 6 As shown, the first end of the supercapacitor C1 is connected to the positive electrode of the DC power supply, and the second end is grounded; the voltage detection and triggering circuit 11 includes a resistor R1, a resistor R2, a resistor R3, a resistor R4, a voltage regulator diode ZD1, a transistor Q2, and an optical coupler J1; wherein the optical coupler J1 has four ends, and when a current flows from the first end of the optical coupler to the second end, the third end and the fourth end of the optical coupler are turned on; the first end of the resistor R1 is connected to the first end of the supercapacitor C1, and the second end is respectively connected to the first end of the resistor R2 and the cathode of the voltage regulator diode ZD1; the second end of the resistor R2, the second end of the optical coupler J1 and the fourth end are all grounded; the first end of the optical coupler J1 is connected to the cathode of the voltage regulator diode ZD1, and the third end is connected to the emitter of the transistor Q2; the base of the transistor Q2 is connected to the first end of the resistor R4, the second end of the resistor R4 is connected to the first end of the resistor R3, and the second end of the resistor R3 is grounded.
[0068] The auxiliary clock circuit 12 includes an auxiliary clock chip, a resistor R5, and a MOS tube Q1; wherein the power pin of the auxiliary clock chip is respectively connected to the first end of the resistor R5 and the positive electrode of the battery, and the ground pin of the auxiliary clock chip is connected to the drain of the MOS tube Q1; the source of the MOS tube Q1 is grounded, and the gate is connected to the second end of the resistor R5. Figure 6 The load in refers to the circuit module of the electric energy meter, which will not be described here.
[0069] The collector of the transistor Q2 in the voltage detection and trigger circuit 11 is connected to the gate of the MOS transistor Q1 in the auxiliary clock circuit 12, and the second end of the resistor R4 in the voltage detection and trigger circuit 11 is connected to the I / O pin P1 of the microcontroller of the energy meter.
[0070] The working principle of the circuit is briefly described as follows: the DC power supply voltage of the energy meter in this embodiment is VCC=12V during normal power supply. Before power failure, the voltage of the supercapacitor C1 is also charged to 12V. Through experiments, it is measured that after power failure, when the voltage of the supercapacitor C1 drops below 6V, the energy meter cannot reliably write data into the non-volatile memory. When the voltage of the supercapacitor C1 drops below 6V, the energy meter cannot work normally, so the time at this time cannot be recorded into the non-volatile memory. In this regard, in this embodiment, a voltage detection and trigger circuit is used to monitor the voltage of the supercapacitor C1. When the voltage is greater than 6V, the Zener diode ZD1 is reversed, and the light-emitting diode in series with the Zener diode ZD1 in the optocoupler J1 is energized and clamped to 1.2V at both ends. The cathode voltage of the Zener diode ZD1 at 4.8V is clamped to 6V. At this time, the third and fourth ends of the optocoupler are turned on. If the I / O pin P1 outputs a high level, the collector and emitter of the transistor Q2 are also turned on, so that the MOS tube Q1 is turned off, and the auxiliary clock chip U2 cannot be powered by the battery VBAT, so the auxiliary clock chip U2 does not operate. Once the voltage of supercapacitor C1 is less than 6V, the 4.8V voltage regulator diode ZD1 cannot conduct in the reverse direction, resulting in no current flowing through the light-emitting diode of the optocoupler J1. At this time, the third and fourth terminals of the optocoupler J1 are cut off, so that the MOS tube Q1 is turned on, and the auxiliary clock chip U2 can be powered by the battery VBAT. Therefore, the auxiliary clock chip U2 starts running and starts timing. When powered on later, the real-time time of the main clock chip minus the operating time of the auxiliary clock chip is the exact time when the voltage drops to 6V. It should be noted that after power failure, the output of I / O pin P1 must be 0V, that is, low level, and after power on, the I / O pin P1 outputs a low level by default. Therefore, after power on, the auxiliary clock chip will continue to run until the I / O pin P1 outputs a high level signal.
[0071] It should be noted that although the voltage of the super capacitor C1 drops below 6V after power failure, the electric energy meter cannot reliably write data into the non-volatile memory. However, in order to provide a fault tolerance margin, in actual design, the third and fourth terminals of the optocoupler can be cut off when the voltage of the super capacitor C1 drops to above 6V (for example, to 6.2V or 6.1V), instead of just cutting off at 6V. The adjustment method is to select a Zener diode ZD1 with a different reverse breakdown voltage (i.e., stable voltage) so that the sum of the stable voltage of the Zener diode ZD1 and the forward conduction voltage of the light-emitting diode in J1 of the optocoupler is greater than or equal to the set voltage value (for example, the set voltage value is 6.1V, and the sum of the stable voltage of the Zener diode ZD1 and the forward conduction voltage of the light-emitting diode in J1 of the optocoupler is 6.2V, and the fault tolerance margin is 0.1V). For example, if the required set voltage value is 6.1V, a Zener diode with a stable voltage of 5V and an optocoupler with a forward conduction voltage of 1.2V are selected, so that the two ends of the light emitting diode in series with the Zener diode in the optocoupler are clamped to 1.2V after power is turned on, and the cathode voltage of the 5V Zener diode is clamped to 6.2V. Once the voltage of the supercapacitor C1 is less than 6.2V, the 5V Zener diode cannot be reverse-conducted, resulting in no current flowing through the light emitting diode of the optocoupler, and the third and fourth ends of the optocoupler are cut off.
[0072] Specifically, in one example, the method further includes:
[0073] After the electric energy meter is powered on, until the current operating time is obtained from the auxiliary clock chip, the I / O pin P1 is controlled to output a low level;
[0074] After obtaining the current operating time from the auxiliary clock chip, the electric energy meter controls the I / O pin P1 to output a high level.
[0075] Through the circuit provided in this embodiment, the specific time point when the voltage of the supercapacitor C1 drops to the point where the electric energy meter cannot work normally can be recorded, so as to obtain the actual power supply duration of the supercapacitor that has aged or failed. After obtaining the current operating duration from the auxiliary clock chip, the electric energy meter controls the I / O pin P1 to output a high-level signal to stop the operation of the battery-assisted clock chip.
[0076] Furthermore, after the electric energy meter obtains the current operating time from the auxiliary clock chip and before controlling the I / O pin P1 to output a high level, the method further includes:
[0077] The auxiliary clock chip is reset so that timing can be started directly from the preset start time when power is lost next time.
[0078] Specifically, after the auxiliary clock chip is reset, the timing will start from the preset start time when it is powered on next time. The preset start time may be different according to the settings of different clock chip manufacturers, for example, it may be 00:00:00 on January 1, 2000.
[0079] In some embodiments, the first time point is determined by the following steps:
[0080] Step 11, at the first moment when the power-off signal is detected, obtain the real-time time at the second level at the first moment from the main clock chip as the first reference time, and at the same time obtain the pulse signal of the target frequency from the main clock chip at the first moment and count the pulse signal.
[0081] Step 12: When it is detected that the real-time time obtained from the main clock chip jumps to the next second of the first reference time, counting the first number of received pulse signals.
[0082] Specifically, the microcontroller of the electric energy meter can access the register of the main clock chip at a preset frequency to obtain the real-time time, and compare the time with the first reference time, so as to detect that the real-time time jumps to the next second.
[0083] Step 13: Calculate the real time at the millisecond level at the first moment based on the following formula 1 And the real time at the millisecond level of the first moment As the first point in time.
[0084] Formula 1 ,in, is the first reference time, is the first quantity, and f is the target frequency.
[0085] The time obtained by using a general clock chip is at the second level, while the method of this embodiment can obtain real-time time at the millisecond level, which can more accurately record the first time point when the power-off signal is detected. For example, a certain electric energy meter is powered by a 12V power supply and is equipped with a 15000μF supercapacitor. In the pre-factory test, after the electric energy meter loses power, if the supercapacitor voltage drops below 6V, the power-off data in the running memory cannot be written to the non-volatile memory normally. The 15000μF supercapacitor can drop to 6V after 1.2 seconds after the power failure, that is, the power supply time of the supercapacitor is 1.2 seconds. It can be seen that in order to more accurately record the changes in the actual power supply time of the supercapacitor, it is necessary to adopt the millisecond-level time recording method provided in this embodiment.
[0086] For example, the first reference time is 12:29:38, the target frequency is 1024 Hz, and the first number is 512. According to Formula 1, the real-time time at the millisecond level at the first time point can be calculated. It is 12:29:38.500.
[0087] Further, the obtaining of the current real-time time from the master clock chip specifically includes:
[0088] Step 21, obtaining the real-time time at the second level corresponding to the current second moment from the main clock chip as the second reference time, and at the same time obtaining the pulse signal of the target frequency from the main clock chip at the current corresponding second moment and counting the pulse signal.
[0089] Step 22: When it is detected that the real-time time obtained from the main clock chip jumps to the next second of the second reference time, count the second number of received pulse signals.
[0090] Step 23: Calculate the millisecond real time of the second moment based on the following formula 2 As the current real time.
[0091] Formula 2 ,in, is the second reference time, is the second quantity, and f is the target frequency.
[0092] For example, the power is turned on again after more than one hour of power failure. The second reference time is 13:39:38, the target frequency is 1024Hz, and the second number is 128. According to formula 2, the current real time can be calculated. It is 13:39:40.875.
[0093] Further, the obtaining of the current operating time from the auxiliary clock chip specifically includes:
[0094] Step 31, obtaining the real-time time at the second level corresponding to the current second moment from the auxiliary clock chip as the third reference time, and at the same time obtaining the pulse signal of the target frequency from the auxiliary clock chip at the current corresponding second moment and counting the pulse signal.
[0095] Step 32: When it is detected that the real-time time obtained from the auxiliary clock chip jumps to the next second of the third reference time, counting a third number of received pulse signals.
[0096] Specifically, the microcontroller of the electric energy meter can access the register of the auxiliary clock chip at a preset frequency to obtain the real-time time, and compare the time with the third reference time, so as to detect that the real-time time jumps to the next second.
[0097] Step 33: Calculate the millisecond-level running time at the second moment based on the following formula 3 As stated in the current runtime.
[0098] Formula 3 ,in, is the third reference time, is the third quantity, f is the target frequency, The preset start time when the auxiliary clock chip starts running.
[0099] For example, the power is turned on again after more than one hour of power failure. The preset start time is 00:00:00, the third reference time is 01:10:01, the target frequency is 1024Hz, and the third number is 768. According to formula 3, the current running time can be calculated. It is 01:10:01.250.
[0100] Further, the determining the second time point based on the current real time and the current running time specifically includes:
[0101] The second time point is determined by the following formula 4 ;
[0102] Formula 4 .
[0103] Will 13:39:40.875 and Substituting 01:10:01.250 into formula 4, we get is 12:29:39.625, and we know It is 12:29:38.500.
[0104] According to step S506, the actual power supply duration is determined based on the difference between the second time point and the first time point. - =00:00:01.125, which is 1.125 seconds, or 1125ms.
[0105] Considering the errors in signal transmission and instruction execution, the following is an analysis of time accuracy and error: When the MCU (i.e. microcontroller) detects a power-off signal, there is a microsecond delay in the signal reaching the pin, the interrupt response time is about tens of nanoseconds to several microseconds, and it may take about 1 microsecond to start the counter. Therefore, the initial error is at the microsecond level, which is negligible compared to the 1024Hz (cycle about 977 microseconds) pulse signal; the accuracy of the clock chip output pulse is affected by the crystal oscillator, which is about ±20ppm. For a 1024Hz signal, the error is about ±0.2 milliseconds per second. The MCU hardware counter has high accuracy and the delay is negligible; in terms of the delay of time jump detection, the MCU actively reads the clock chip time through I²C / SPI communication with a delay of about tens of microseconds. When using the interrupt method, the MCU response delay is at the microsecond level, and the total delay is about tens of microseconds, which may cause errors of tens to hundreds of microseconds. Comprehensively estimated, the initial delay error: the delay of the MCU detecting the power-off signal and starting the counter is about 1 microsecond. Time jump detection delay error: the delay of the MCU detecting the clock chip time jump is about 50 microseconds. Clock chip frequency error: The crystal oscillator accuracy is about ±20ppm, corresponding to ±0.02%; for a 1024Hz signal, the error is about ±0.2 milliseconds per second. In summary, the total error is about ±0.1 milliseconds to ±0.5 milliseconds, so the total error is in the sub-millisecond to millisecond level, meeting the requirements of millisecond time accuracy.
[0106] In one embodiment, an electric energy meter fault processing device is also provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of the electric energy meter fault processing method when executing the program. The steps of the electric energy meter fault processing method here may be the steps in the above-mentioned embodiments.
[0107] In one embodiment, a computer-readable storage medium is further provided, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to enable a computer to execute the steps of the above-mentioned method for handling a fault of an electric energy meter. The steps of the method for handling a fault of an electric energy meter here may be the steps of the method for handling a fault of an electric energy meter in the above-mentioned embodiments.
[0108] In one embodiment, an electric energy meter is further provided. The electric energy meter includes a controller and an electric energy metering chip. The controller is used to execute the above-mentioned electric energy meter fault processing method.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRA), memory bus (Rambus) direct RAM (RDRA), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A method for handling electric energy meter faults, characterized in that: The method comprises: After the electric energy meter is powered on, it detects whether a power failure event occurs; If a power failure event occurs and the power failure event has not ended, the electric energy meter determines whether a power failure data storage failure has occurred; wherein the power failure data storage failure is that the power failure data stored in the non-volatile memory is incomplete; If a power-off data storage failure occurs, the electric energy meter obtains the actual power supply duration of the supercapacitor when the power-off event occurs; wherein the actual power supply duration is the time from the detection of the power-off event to the voltage of the supercapacitor dropping to a preset voltage threshold; the preset voltage threshold is the voltage value when the voltage of the supercapacitor drops to a level that the non-volatile memory of the electric energy meter cannot write data normally after the electric energy meter loses power; The electric energy meter adjusts the power-off data storage strategy based on the actual power supply duration so that the first data volume is smaller than the second data volume; wherein the power-off data is data that needs to be written from the running memory to the non-volatile memory when a power-off event occurs in the electric energy meter; the first data volume is the maximum data volume of the power-off data that is allowed to be temporarily stored in the running memory of the electric energy meter, and the second data volume is the data volume that the electric energy meter can write from the running memory to the non-volatile memory within the time corresponding to the actual power supply duration, and the power-off data storage strategy limits the value of the first data volume; The actual power supply duration is determined by the following steps: The time point when the electric energy meter detects power failure is taken as the first time point; The time point when the voltage of the supercapacitor of the electric energy meter drops to a preset threshold voltage is taken as the second time point; Determining the actual power supply duration based on the difference between the second time point and the first time point; The second time point is determined by the following steps: The voltage of the super capacitor is detected by the voltage detection and trigger circuit, and when the voltage drops to a preset threshold voltage, the auxiliary clock chip of the auxiliary clock circuit is triggered to start running; After the electric energy meter is powered on, if a power-off data storage failure occurs, the current real-time time is obtained from the main clock chip and the current operating time is obtained from the auxiliary clock chip; Determine the second time point based on the current real time and the current running time; Determine the first time point by following these steps: At the first moment when the power-off signal is detected, the real-time time at the second level at the first moment is obtained from the main clock chip as the first reference time, and at the same time, a pulse signal of a target frequency is obtained from the main clock chip at the first moment and the pulse signal is counted; When it is detected that the real-time time obtained from the main clock chip jumps to the next second of the first reference time, counting a first number of received pulse signals; Calculate the real-time time at the millisecond level at the first moment based on the following formula: And the real time at the millisecond level of the first moment As the first point in time; Formula 1 ,in, is the first reference time, is the first quantity, and f is the target frequency.
2. The method for handling electric energy meter faults according to claim 1, characterized in that: The method further comprises: Divide power-off data into different priorities; When power failure occurs, the power failure data with high priority is stored first; When detecting whether the power-off data stored in the non-volatile memory is complete, the integrity of the power-off data with the lowest priority is detected first; Once it is detected that the power failure data with a lower priority is incomplete, it is directly determined that a power failure data storage failure has occurred.
3. The method for handling electric energy meter faults according to claim 1, characterized in that: The method further comprises: If a power-off data storage failure occurs, the electric energy meter counts the target data volume of the target power-off data stored in the non-volatile memory when the last power-off event occurred; the target power-off data includes complete power-off data and incomplete power-off data; The target data amount is used as the second data amount.
4. The method for handling electric energy meter faults according to claim 1, characterized in that: The obtaining of the current real-time time from the main clock chip specifically includes: Acquire the real-time time at the second level corresponding to the current second moment from the main clock chip as the second reference time, and at the same time acquire the pulse signal of the target frequency from the main clock chip at the current corresponding second moment and count the pulse signal; When it is detected that the real-time time obtained from the main clock chip jumps to the next second of the second reference time, counting a second number of received pulse signals; Calculate the millisecond real-time time of the second moment based on the following formula 2 as the current real time; Formula 2 ,in, is the second reference time, is the second quantity, and f is the target frequency.
5. The method for handling electric energy meter faults according to claim 4, characterized in that: The obtaining of the current operating time from the auxiliary clock chip specifically includes: Acquire the real-time time at the second level corresponding to the current second moment from the auxiliary clock chip as the third reference time, and at the same time acquire the pulse signal of the target frequency from the auxiliary clock chip at the current corresponding second moment and count the pulse signal; When it is detected that the real-time time obtained from the auxiliary clock chip jumps to the next second of the third reference time, counting a third number of received pulse signals; The running time at the second moment in milliseconds is calculated based on the following formula 3 as said current runtime; Formula 3 ,in, is the third reference time, is the third quantity, f is the target frequency, The preset start time for the auxiliary clock chip to start running; The determining the second time point based on the current real time and the current running time specifically includes: The second time point is determined by the following formula 4 ; Formula 4 .
6. The method for handling electric energy meter faults according to claim 1, characterized in that: The first end of the supercapacitor C1 is connected to the positive electrode of the DC power supply, and the second end is grounded; the voltage detection and triggering circuit includes a resistor R1, a resistor R2, a resistor R3, a resistor R4, a voltage stabilizing diode ZD1, a transistor Q2, and an optical coupler J1; wherein the optical coupler J1 has four ends, and when a current flows from the first end of the optical coupler to the second end, the third end and the fourth end of the optical coupler are turned on; the first end of the resistor R1 is connected to the first end of the supercapacitor C1, and the second end is respectively connected to the first end of the resistor R2 and the negative electrode of the voltage stabilizing diode ZD1; the second end of the resistor R2, the second end of the optical coupler J1 and the fourth end are all grounded; the first end of the optical coupler J1 is connected to the negative electrode of the voltage stabilizing diode ZD1, and the third end is connected to the emitter of the transistor Q2; the base of the transistor Q2 is connected to the first end of the resistor R4, the second end of the resistor R4 is connected to the first end of the resistor R3, and the second end of the resistor R3 is grounded; The auxiliary clock circuit includes an auxiliary clock chip, a resistor R5, and a MOS tube Q1; wherein the power pin of the auxiliary clock chip is respectively connected to the first end of the resistor R5 and the positive electrode of the battery, and the ground pin of the auxiliary clock chip is connected to the drain of the MOS tube Q1; the source of the MOS tube Q1 is grounded, and the gate is connected to the second end of the resistor R5; The collector of the transistor Q2 in the voltage detection and trigger circuit is connected to the gate of the MOS tube Q1 in the auxiliary clock circuit, and the second end of the resistor R4 in the voltage detection and trigger circuit is connected to the I / O pin P1 of the microcontroller of the energy meter.
7. A method for handling electric energy meter faults according to claim 6, characterized in that: The method further comprises: After the electric energy meter is powered on, until the current operating time is obtained from the auxiliary clock chip, the I / O pin P1 is controlled to output a low level; After obtaining the current operating time from the auxiliary clock chip, the electric energy meter controls the I / O pin P1 to output a high level.
Citation Information
Patent Citations
Simulation method and system based on electric energy meter power-down data storage
CN107861851A
Electric energy meter power failure storage method and device, computer equipment and storage medium
CN118244998A
EEPROM (Electrically Erasable Programmable Read-Only Memory) loss balancing method for prolonging life of electric energy meter
CN102063941A
Automatic control circuit based on fast and slow charging and discharging of capacitor and power failure storage method
CN115765112A
Power-down / power-loss memory controller
US20190042156A1
