Method and system for monitoring Flash read-write condition of electric energy meter

By monitoring the read and write operation frequency between the controller of the power meter and the Flash, the life reduction problem caused by frequent Flash operation is solved, and the stable operation and reliability of the power meter are achieved.

CN120334836APending Publication Date: 2025-07-18HENAN XJ INSTR
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510394511.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, due to frequent read and write operations, the service life of the Flash memory of the power meter is reduced and cannot meet the usage requirements of more than 16 years, resulting in data loss and the power meter cannot operate normally.

Method used

By monitoring the read and write channel between the controller of the power meter and the Flash, calculate the read and write operation frequency, and issue an alarm signal when the frequency exceeds the set threshold, monitor the Flash read and write status of the power meter to prevent frequent operations.

Benefits of technology

Effectively monitor the Flash read and write frequency of the electric energy meter, improve the service life of the Flash, and ensure the operating stability and reliability of the electric energy meter.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120334836A_ABST
    Figure CN120334836A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a system for monitoring Flash read-write conditions of an electric energy meter, and belongs to the field of Flash monitoring of the electric energy meter. According to the method, a read-write channel between a controller of the electric energy meter and the Flash is monitored to obtain read operation or write operation performed at the moment, then the corresponding read and write operation frequency is calculated according to the read and write operation, and when the read and write operation frequency is larger than a corresponding set threshold value, it is judged that reading or abnormal at the moment occurs. According to the method, the alarm signal is sent out when the read-write frequency exceeds the set value, whether the electric energy meter carries out frequent read-write operation on the Flash or not can be effectively monitored, the service life of the Flash is prolonged, and therefore the running stability and reliability of the electric energy meter are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and system for monitoring the Flash reading and writing status of an electric energy meter, belonging to the field of Flash monitoring of an electric energy meter. Background Art

[0002] According to the "General Technical Specification for Smart Electric Energy Meters (2020 Edition)" and the "General Technical Specification for Smart Internet-of-Things Electric Energy Meters", the new standard smart electric energy meters are required that "the design of the product and the selection of components should ensure that the service life of the whole meter is greater than or equal to 16 years". As the Flash of the electric energy meter memory, its service life should also be greater than or equal to 16 years. However, if the Flash is frequently read and written, its service life will be reduced, making the availability of the Flash worse and worse, and finally resulting in the Flash being unable to read and write data anymore.

[0003] If it is not timely discovered that the Flash is unable to read and write data, it will cause the loss of key data and the electric energy meter will no longer operate normally. Summary of the Invention

[0004] The purpose of the present invention is to provide a method and system for monitoring the Flash reading and writing status of an electric energy meter to solve the problem of how to monitor the Flash reading and writing status of an electric energy meter.

[0005] To achieve the above purpose, the solution of the present invention includes: A method for monitoring the Flash reading and writing status of an electric energy meter according to the present invention includes the following steps: 1) Monitor the read and write data channels between the controller of the electric energy meter and the Flash; 2) When a write operation occurs, record the target sector of the write operation, and obtain a first time difference with the start time of the first write operation of the target sector as the start time and the current time as the end time; When a read operation occurs, record the target sector of the read operation, and obtain a second time difference with the start time of the first read operation of the target sector as the start time and the current time as the end time; 3) Obtain the write operation frequency according to the total number of writes of the target sector of the write operation and the first time difference; obtain the read operation frequency according to the total number of reads of the target sector of the read operation and the second time difference; 4) When the read or write operation frequency is greater than the corresponding set threshold, send an alarm signal.

[0006] Further, judge the target sector of the write operation to which the write operation address belongs according to the write operation address of the write operation; judge the target sector of the write operation to which the read operation address belongs according to the read operation address of the read operation.

[0007] Further, the controller connects the selection pins of multiple Flash memories through its own selection pins to form multiple selection channels; monitors the multiple selection channels between the controller of the electricity meter and the Flash memories, and when it detects a change in the level of a certain selection channel, determines that a read or write operation has occurred on the Flash memory corresponding to that selection channel.

[0008] Further, it also monitors the clock synchronization channel between the controller of the electricity meter and the Flash memories; within one clock cycle, calculates the duration of the high level and the low level, and obtains the total duration based on the duration of the high level and the low level; determines whether the duration of the high level, the duration of the low level, and the total duration are equal to the corresponding set duration. If more than one of them is not equal, it determines that there is an abnormal communication between the microcontroller of the electricity meter and the Flash memories.

[0009] A monitoring system for the read and write status of the Flash memory of an electricity meter, including a processor, and the processor executes a computer program to implement the steps of the following method: 1) Monitor the read and write data channels between the controller of the electricity meter and the Flash memories; 2) When a write operation occurs, record the target sector of the write operation, and obtain the first time difference with the start time of the first write operation of the target sector as the start time and the current time as the end time; When a read operation occurs, record the target sector of the read operation, and obtain the second time difference with the start time of the first read operation of the target sector as the start time and the current time as the end time; 3) Obtain the write operation frequency based on the total number of writes of the target sector of the write operation and the first time difference; obtain the read operation frequency based on the total number of reads of the target sector of the read operation and the second time difference; 4) When the read or write operation frequency is greater than the corresponding set threshold, send an alarm signal.

[0010] Further, determine the target sector of the write operation to which the write operation address belongs according to the write operation address of the write operation; determine the target sector of the write operation to which the read operation address belongs according to the read operation address of the read operation.

[0011] Further, the controller connects the selection pins of multiple Flash memories through its own selection pins to form multiple selection channels; monitors the multiple selection channels between the controller of the electricity meter and the Flash memories, and when it detects a change in the level of a certain selection channel, determines that a read or write operation has occurred on the Flash memory corresponding to that selection channel.

[0012] Further, the clock synchronization channel between the controller of the electricity meter and the Flash is also monitored; within one clock cycle, the durations of the high level and the low level are calculated, and the total duration is obtained based on the durations of the high level and the low level; it is determined whether the durations of the high level, the low level, and the total duration are equal to the corresponding set durations. If more than one of them is not equal, it is determined that the communication between the microcontroller of the electricity meter and the Flash is abnormal.

[0013] The beneficial effects of the present invention are as follows: The present invention is an exploratory invention. By monitoring the read and write channels between the controller of the electricity meter and the Flash, it is obtained whether a read operation or a write operation is being performed at this time, and then the corresponding read and write operation frequencies are calculated based on the read and write operations. When the read and write operation frequencies are greater than the corresponding set thresholds, it is determined that a read or write abnormality occurs at this time. By emitting an alarm signal when the read and write frequencies exceed the set values, the present invention can effectively monitor whether the electricity meter performs frequent read and write operations on the Flash, improve the service life of the Flash, and thus improve the operation stability and reliability of the electricity meter. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 is a schematic diagram of the overall architecture of the present invention; Figure 2 is a schematic diagram of the pin connection of the present invention; Figure 3 is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0015] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the drawings and embodiments.

[0016] The concept of the present invention is to calculate the read and write frequencies of the same sector of each Flash. When the read and write frequencies are greater than the corresponding set thresholds, it is determined that the read and write are abnormal.

[0017] Method Embodiment: This embodiment provides a method for monitoring the read and write status of the electricity meter Flash. The electricity meter communicates with the Flash through the SPI bus. As Figure 1 shown, the present invention uses a data monitoring module to monitor the communication channel between the microcontroller of the electricity meter and the Flash and send an alarm signal to the alarm device in case of an abnormal situation, and then send the corresponding data to the upper computer.

[0018] An ARM Cortex-M4 microcontroller is selected as the processor of the data monitoring module and is connected to the SPI bus through which the microcontroller of the electricity meter communicates with the Flash chip through the SPI interface. As Figure 2As shown in the figure, the MISO (Master Input, Slave Output) pin of the ARM microcontroller is connected to the DO-MOSI data channel of the electricity meter, the MOSI (Master Output, Slave Input) pin of the ARM microcontroller is connected to the DI-MISO data channel of the electricity meter, the SCLK (Clock) pin of the ARM microcontroller is connected to the SCLK-SCLK data channel of the electricity meter, and the interrupt pin of the ARM microcontroller is connected to the CS-CS (Select) data channel of the electricity meter. Among them, since the electricity meter contains multiple Flash memories, the microcontroller selection pin of the electricity meter is connected to the selection pins of multiple Flash memories, thereby forming multiple selection channels, and the interrupt pin of the ARM microcontroller is connected to these multiple selection channels.

[0019] Set the SCLK and CS pins of the ARM microcontroller to the external interrupt mode. The pins connected to the interrupt pin of the ARM microcontroller are set to trigger interrupts on the falling edge, and SCLK is configured to trigger interrupts on the rising edge. The trigger process of the interrupt is as follows: Step 1: The ARM microcontroller enables the interrupt of the interrupt pin; Step 2: After the interrupt of the interrupt pin is triggered, identify the Flash corresponding to the triggered selection channel and enable the interrupt of the SCLK pin; Step 3: When a rising edge signal is detected on the SCLK pin, enable the interrupt of the SCLK pin; Step 4: Sample DO-MOSI and DI-MISO in the SCLK interrupt program. When the microcontroller of the electricity meter performs a write operation on this Flash, monitor DO-MOSI; when the microcontroller of the electricity meter performs a read operation on this Flash, sample DI-MISO.

[0020] Data transfer process identification: In the external interrupt, according to the rising edge of SCLK, read the corresponding instructions of DO-MOSI and DI-MISO, and judge whether to perform data reading or writing operations in this clock cycle according to the corresponding instructions.

[0021] By maintaining a state machine to track whether it is currently reading or writing, specifically as follows: State 0: Idle state, waiting for CS to be pulled low; State 1: CS is pulled low, ready to start data transfer; State 2: Wait for the rising edge of SCLK, read MISO or prepare MOSI data; State 3: After the data transfer is completed, judge whether it is the end state (CS is pulled high) and return to the idle state.

[0022] Such as Figure 3As shown, when it is determined that the current operation is a write operation, analyze the write operation to obtain the write operation address corresponding to the write operation. According to the relationship between the write operation address and the sector of the Flash, obtain the target sector to which the write operation address belongs. Take the start time of the first write operation of the target sector as the start time and the current time as the end time to obtain the first time difference. Obtain the write operation frequency based on the total number of writes of the target sector and the first time difference. When the write operation frequency is greater than the corresponding set threshold, send an alarm signal to control the flashing of the write operation alarm light. Among them, a specific example is used to explain the total number of writes of the target sector. For example, before 9 o'clock today, the target sector has performed 9 write operations. It is determined that a write operation (1 time) occurs for the target sector at 9 o'clock, then the total number of writes is 10 times.

[0023] Store the target sector of the write operation, the start time of the first write operation, the total number of writes, and the write operation frequency as a write operation record.

[0024] When a new write operation occurs, first calculate the write operation frequency corresponding to the write operation, and then sort according to the write operation frequency. When the number of stored records is greater than the maximum number of stored records, replace the record with the minimum write operation frequency with the current new record.

[0025] When it is determined that the current operation is a read operation, analyze the read operation to obtain the read operation address corresponding to the read operation. According to the relationship between the read operation address and the sector of the Flash, obtain the target sector to which the read operation address belongs. Take the start time of the first read operation of the target sector as the start time and the current time as the end time to obtain the second time difference. Obtain the read operation frequency based on the total number of reads of the target sector and the second time difference. When the read operation frequency is greater than the corresponding set threshold, send an alarm signal to control the flashing of the read operation alarm light. Among them, a specific example is used to explain the total number of reads of the target sector. For example, before 9 o'clock today, the target sector has performed 9 read operations. It is determined that a read operation (1 time) occurs for the target sector at 9 o'clock, then the total number of reads is 10 times.

[0026] Store the target sector of the read operation, the start time of the first read operation, the total number of reads, and the read operation frequency as a read operation record.

[0027] When a new read operation occurs, first calculate the read operation frequency corresponding to the read operation, and then sort according to the read operation frequency. When the number of stored records is greater than the maximum number of stored records, replace the record with the minimum read operation frequency with the current new record.

[0028] This embodiment also provides a check for data validity. Add a time detection function to the external interrupt of the SCLK pin to monitor the high and low level durations of the SCLK signal: Step 1: Set a time counter and reset the counter at the rising edge and falling edge of each SCLK. Step 2: Record the duration. During each SCLK cycle, calculate the durations of the high level and low level, as well as the total duration calculated based on the durations of the high and low levels. Step 3: Judge the validity according to whether the durations of the high level, low level, and total duration are all equal to the corresponding set durations. Step 4: Control the LED alarm. If an abnormal timing is found, that is, one or more durations are not equal to the corresponding set durations, it is determined that there is an abnormal communication between the microcontroller of the electricity meter and the Flash, and the Flash communication fault light is controlled to flash.

[0029] As a specific implementation manner of the present invention: The calculation method of the corresponding threshold of the write operation frequency is as follows: The Flash has 1 million erase / write cycles, and the electricity meter needs to be used for at least 16 years. Then the maximum erase / write frequency of the Flash is 0.119 (times / min), and this maximum erase / write frequency is used as the threshold of the write operation frequency.

[0030] Send the detected read / write operation records to the host computer through the serial port for further analysis, once every 10 seconds. The host computer displays the changes of the read / write operation records in real time through the UI interface.

[0031] System embodiment: This embodiment provides a monitoring system for the read / write status of the electricity meter Flash. The system includes a data monitoring module, which includes a processor. The computer program executed by the processor is designed by the method introduced in the method embodiment. The connection relationship between the data monitoring module and the electricity meter has been introduced in the method embodiment. Since the introduction of the method is clear enough, it will not be elaborated here.

[0032] Finally, it should be noted that: The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the specific implementation manners of the present invention or make equivalent replacements. Any modification or equivalent replacement that does not deviate from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.

Claims

1. A method for monitoring the Flash read / write status of an electric energy meter, characterized in that, It includes the following steps: 1) Monitor the read and write data channels between the controller of the electricity meter and the Flash; 2) When a write operation occurs, record the target sector of the write operation, and obtain a first time difference with the start time of the first write operation of the target sector as the start time and the current time as the end time; When a read operation occurs, record the target sector of the read operation, and obtain a second time difference with the start time of the first read operation of the target sector as the start time and the current time as the end time; 3) Obtain the write operation frequency according to the total number of writes of the target sector of the write operation and the first time difference; obtain the read operation frequency according to the total number of reads of the target sector of the read operation and the second time difference; 4) When the read or write operation frequency is greater than the corresponding set threshold, send an alarm signal.

2. The monitoring method for the Flash reading and writing status of an electric energy meter according to claim 1, characterized in that, Judge the target sector of the write operation to which the write operation address belongs according to the write operation address of the write operation; judge the target sector of the write operation to which the read operation address belongs according to the read operation address of the read operation.

3. The monitoring method for the Flash reading and writing status of an electric energy meter according to claim 1, characterized in that The controller is connected to the selection pins of multiple Flash through its own selection pins to form multiple selection channels; monitor the multiple selection channels between the controller of the electricity meter and the Flash, and when it is detected that the level of a certain selection channel changes, it is determined that a read or write operation occurs on the Flash corresponding to the selection channel.

4. The monitoring method for the Flash reading and writing status of the electric energy meter according to claim 1, characterized in that, Also monitor the clock synchronization channel between the controller of the electricity meter and the Flash; within one clock cycle, calculate the duration of the high level and the low level, and obtain the total duration according to the duration of the high level and the low level; Judge whether the duration of the high level, the duration of the low level and the total duration are equal to the corresponding set duration. If more than one is not equal, it is determined that the microcontroller of the electricity meter communicates abnormally with the Flash.

5. A monitoring system for the Flash reading and writing status of an electric energy meter, including a processor, characterized in that, The processor executes a computer program to implement the steps of the following method: 1) Monitor the read and write data channels between the controller of the electricity meter and the Flash; 2) When a write operation occurs, record the target sector of the write operation, and obtain a first time difference with the start time of the first write operation of the target sector as the start time and the current time as the end time; When a read operation occurs, record the target sector of the read operation, and obtain a second time difference with the start time of the first read operation of the target sector as the start time and the current time as the end time; 3) Obtain the write operation frequency according to the total number of writes of the target sector of the write operation and the first time difference; obtain the read operation frequency according to the total number of reads of the target sector of the read operation and the second time difference; 4) When the read or write operation frequency is greater than the corresponding set threshold, send an alarm signal.

6. The monitoring system for the Flash reading and writing status of the electric energy meter according to claim 5, wherein Judge the target sector of the write operation to which the write operation address belongs according to the write operation address of the write operation; judge the target sector of the write operation to which the read operation address belongs according to the read operation address of the read operation.

7. The monitoring system for the Flash reading and writing status of the electricity meter according to claim 5, characterized in that, The controller is connected to the select pins of multiple Flash memories through its own select pin to form multiple select channels; monitor the multiple select channels between the controller of the electricity meter and the Flash memory, and when it is detected that the level of a certain select channel changes, it is determined that a read or write operation occurs on the Flash memory corresponding to that select channel.

8. The monitoring system for the Flash reading and writing status of the electric energy meter according to claim 5, wherein, It also monitors the clock synchronization channel between the controller of the electricity meter and the Flash memory; within one clock cycle, calculate the duration of the high level and the low level, and obtain the total duration according to the duration of the high level and the low level; Judge whether the duration of the high level, the duration of the low level, and the total duration are equal to the corresponding set duration. If more than one is not equal, it is determined that the microcontroller of the electricity meter communicates abnormally with the Flash memory.