An electric energy meter self-calibration method based on OpenMv digital recognition algorithm
Patent Information
- Application Number
- CN202311396250.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-10-25
AI Technical Summary
[0004]上述方法存在3个问题,1、重复工作较多,耗时费力:每只电能表都对应两种参数,直流偶次谐波影响试验需要对待测电能表分别单独通正半波和负半波,每种参数背景下都需要对待测电能表设置至少8个电流测试点,校表台切换测试点需要30s,每个测试点又至少需要两次补偿,从向电能表输入补偿值到校表台显示误差稳定需要30s,那么单个电能表校表时间至少需要24min
[0017]该基于OpenMv数字识别算法的电能表自校准方法及系统,控制所述OpenMv获取一张显示当前所述电能表误差的所述校表台液晶屏幕图像,读取当前待测电能表通讯地址,提取图像中误差值,控制所述主控MCU定时器,根据电能表误差补偿后所述校表台刷新并稳定误差所需时间,设置所述电能表定时时间,控制所述OpenMv发送所述误差值至所述主控MCU,本发明将机器视觉与电能表误差校调技术相结合,实现了电能表计量误差校准自动化。
Smart Images

Figure CN117452313B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart meters, and in particular to a self-calibration method for electricity meters based on the OpenMV digital recognition algorithm. Background Technology
[0002] According to the national standard GB / T 17215.321-2008 Special Requirements for AC Measuring Equipment Part 21: Static Active Energy Meters (Class 1 and Class 2), the metering accuracy requirements for smart energy meters under DC and harmonic operating conditions must be compensated for under these operating conditions before the energy meters leave the factory.
[0003] Chinese patent document CN113589216A discloses an error compensation method for an energy meter based on DC and even harmonic operating conditions, including the following steps: setting the installation parameters of the energy meter under test and the current range for error compensation, setting multiple current test points within the current range, determining the functional relationship between current and error value based on the error data of the energy meter under test at each test point, and finally performing error compensation at each current test point based on the functional relationship.
[0004] The above method has three problems: 1. It involves a lot of repetitive work, which is time-consuming and labor-intensive: Each electricity meter corresponds to two parameters. The DC even harmonic influence test requires the electricity meter under test to be fed with both positive and negative half-waves separately. Under each parameter background, at least 8 current test points need to be set up on the electricity meter under test. Switching test points on the calibration station takes 30 seconds, and each test point requires at least two compensations. From inputting the compensation value to the meter to the calibration station displaying a stable error, it takes another 30 seconds. Therefore, the calibration time for a single electricity meter is at least 24 minutes. Moreover, the above steps mainly involve multiple waiting and repetitive actions by the staff, which is time-consuming and labor-intensive. 2. It is inefficient: During the 30-second waiting period for each compensation operation, the staff's attention is easily distracted, resulting in the compensation value not being input into the electricity meter in a timely manner, which leads to low efficiency. 3. Multiple reliance on tools: To write error compensation values into the electricity meter, it is necessary to use the electricity meter's communication protocol. Therefore, a PC and an RS485 to USB device must be added. The USB end of the serial port device is connected to the PC, and the A and B terminals of the RS485 are connected to the electricity meter's RS485 communication terminal. The error values are framed into data frames that conform to the electricity meter's communication protocol by the PC calibration software and then sent to the electricity meter under test via RS485 to complete a calibration operation. This results in multiple reliance on tools and cumbersome calibration steps. Summary of the Invention
[0005] The purpose of this invention is to provide a self-calibration method for electricity meters based on the OpenMV digital recognition algorithm, so as to solve the problems mentioned in the background art.
[0006] A self-calibration system and method for electricity meters based on the OpenMV digital recognition algorithm includes two parts: the OpenMV LCD digital recognition method and the meter calibration communication protocol system. These two parts are executed sequentially to automatically compensate for the error value of the electricity meter and ultimately achieve the calibration purpose.
[0007] The OpenMV is controlled to acquire an image of the calibration station's LCD screen displaying the current error of the electricity meter, read the communication address of the electricity meter under test, and extract the error value from the image.
[0008] The main control MCU timer is controlled to set the timer interval for the energy meter based on the time required for the calibration station to refresh and stabilize the error after energy meter error compensation.
[0009] The OpenMV controller sends the error value to the main control MCU.
[0010] The main control MCU combines object-oriented electricity information data exchange protocol frames and sends them to the energy meter to be calibrated.
[0011] Control the energy meter to clear the timer count value and turn on the timer.
[0012] When the timer expires, it checks whether the current error value falls below the maximum allowable error value.
[0013] If so, then control whether the current current test point is the same as the last current test point of the energy meter.
[0014] If so, control the current electricity meter calibration to end.
[0015] If not, control the OpenMV to capture the error image and perform the next error compensation.
[0016] Compared with the prior art, the technical effects and advantages of the present invention are as follows:
[0017] This invention relates to a self-calibration method and system for electricity meters based on the OpenMV digital recognition algorithm. The method involves controlling the OpenMV to acquire an image of the calibration station's LCD screen displaying the current error of the electricity meter, reading the communication address of the electricity meter under test, extracting the error value from the image, controlling the main control MCU timer, setting the timer for the electricity meter based on the time required for the calibration station to refresh and stabilize the error after compensation, and controlling the OpenMV to send the error value to the main control MCU. This invention combines machine vision with electricity meter error calibration technology, achieving automated calibration of electricity meter measurement errors. Attached Figure Description
[0018] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a flowchart of the system processing of the present invention;
[0020] Figure 2 This is a flowchart of the LCD digital recognition method for the calibration table of the present invention;
[0021] Figure 3 This is a diagram showing the effect of the image preprocessing process.
[0022] Figure 4 The result of segmenting the vertically projected image;
[0023] Figure 5 Image showing the digit recognition results of the Letnet model;
[0024] Figure 6 Evaluation graph of the LetNet model training process;
[0025] Figure 7 This is a graph evaluating the accuracy of Letnet model digit recognition. Detailed Implementation
[0026] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of the invention. However, it will be apparent to those skilled in the art that the invention can be practiced without one or more of these details. In other instances, certain technical features well-known in the art have not been described in order to avoid obscuring the invention.
[0027] Unless otherwise defined, the directions mentioned herein, such as up, down, left, right, front, back, inside, and outside, are based on the directions shown in the figures of this invention, and are explained here together.
[0028] This embodiment discloses, as follows: Figures 1 to 7 The above describes a self-calibration method for electricity meters based on the OpenMV digital recognition algorithm. The flowchart of the self-calibration system is shown below. Figure 1 The self-calibration system consists of a digital identification section and a meter calibration section for metering error compensation. The two sections work in coordination to achieve fully automatic compensation for the metering error.
[0029] The implementation steps of the energy meter self-calibration system based on the OpenMV digital recognition algorithm include the following steps S101 to S107:
[0030] S101. Preparatory work before meter calibration: Set the calibration parameters of the calibration platform according to the specifications of the energy meter under test, and set the current test points according to the accuracy requirements of the energy meter under test. After completing the above work, select the fully automatic mode to start the calibration platform and power on the energy meter self-calibration system. The calibration system first obtains the communication address of the energy meter under test through serial communication. After the current error value of the calibration platform stabilizes, press the reset button of the calibration system to enter the calibration mode.
[0031] S102, OpenMV captures an image of an LCD screen displaying error values. For example... Figure 2 The diagram shown is a flowchart of image processing and digit recognition. Figure 3 The image shown is a screenshot of the preprocessing process. The acquired image is first preprocessed using the following steps:
[0032] Step 1: To eliminate image noise caused by reflections on the LCD surface and the influence of camera quality, the following preprocessing steps are performed on the image:
[0033] S201 performs a grayscale transformation on the image, converting the image into a grayscale image.
[0034] S202, Canny algorithm detects the bezel of LCD screen.
[0035] Step 2: Due to the placement and shooting angle of the camera, the numbers in the image are tilted and distorted. Therefore, the following steps are used to perform final image processing.
[0036] S203: Using the erosion and dilation method, locate the liquid crystal digital area in the image, obtain the coordinates of the frame of the liquid crystal screen of the calibration table, and take the area inside the frame as the ROI (Region of Interest) for the next step.
[0037] S204: Use Hough transform to correct image tilt.
[0038] S205: The vertical projection algorithm is used to find the boundaries between digits and perform segmentation processing. The segmentation result is as follows: Figure 4 As shown.
[0039] S206: Using the Letnet digit recognition network model on the OpenMV board, based on the number of digits n (including the decimal point) of the error value displayed on the calibration table obtained in step S25, perform n digit recognitions. The recognition result is as follows: Figure 5 As shown, finally, these n numbers are converted into floating-point numbers and sent to the RS485 interface of the main control MCU via OpenMV serial port.
[0040] S103, the main control MCU receives data from RS485 and controls the LCD to display the current error value. The error value is then combined into a data exchange frame conforming to the object-oriented electricity information data exchange protocol according to the current meter's communication address. This data frame is sent to the RS485 channel of the electricity meter self-calibration system. Simultaneously, based on the time required for the meter calibration station to refresh and stabilize the error after error compensation, the system timer is started.
[0041] S104, when the timer expires, determine whether the adjustment of the current current test point is finished. If the current error is lower than the maximum allowable error value and the current current test point is the last one, then the calibration of the current test meter is finished. Otherwise, proceed to S2 to perform the next error compensation for the current current test point.
[0042] S105, if yes, then control whether the current current test point is the last current test point of the energy meter.
[0043] S106, if so, control the current energy meter calibration to end.
[0044] If not, then proceed to S101 to control the OpenMV to capture the error image and perform the next error compensation.
[0045] S107, if not, control the calibration station to jump to the next current test point.
[0046] The main control chip of the electricity meter obtains a calibration command and sends the calibration command to the metering chip of the electricity meter. The calibration command carries the actual electrical parameters and calibration items of the standard power supply. The metering chip of the electricity meter parses the calibration command and obtains the actual electrical parameters and calibration items.
[0047] The energy meter's chip acquires the sampled electrical parameters and stores them in its own register. The sampled electrical parameters are obtained by the sampling module sampling the standard power supply. The energy meter's metering chip determines the calibration parameters based on the actual electrical parameters, the sampled electrical parameters, and the calibration items, and stores the calibration parameters in its own register to complete the calibration.
[0048] The system includes a main control MCU, a button reset module, an LCD display error data module, an OpenMV programmable image acquisition and processing module, and an RS485 communication module. The button reset module is used to control the system to start a new round of calibration. The LCD display module displays the error results obtained by OpenMV recognition. The error values obtained by OpenMV recognition are framed using an object-oriented electricity information data exchange protocol. The RS485 communication interface is connected to the RS485 communication interface of the energy meter under test. The protocol frame described in claim 6 is sent to the energy meter for error compensation.
[0049] The voltage transformer VTz and the standard meter stand are connected together. The voltage waveform generator outputs the voltage waveform required for the test. The voltage waveform is connected to the voltage ports of the standard meter stand and the meter under test through the voltage transformer VTz. The voltage port of the standard meter stand is connected in parallel with the voltage port of the meter under test. The current waveform generator outputs the current waveform required for the test and is connected to the current ports of the standard meter stand and the meter under test. The current port of the stand is connected in series with the current port of the meter under test. The pulse terminal of the standard meter stand is connected to the pulse terminal of the meter under test.
[0050] The self-calibration system first sends a metering initialization command frame to the energy meter under calibration. The metering initialization command frame carries the initialization parameters and phase line values of the energy meter under calibration. After the energy meter under calibration is initialized, the calibration control console controls the output of the power source according to the calibration steps, reads the calibration parameters generated by the standard energy meter according to the output of the power source, and sends a calibration command frame to the energy meter under calibration. The calibration command frame carries the calibration parameters and calibration step identifiers. The calibration steps are, in sequence, power gain calibration, phase calibration, and voltage and current calibration.
[0051] The OpenMV programmable image acquisition and processing module is characterized by the following steps:
[0052] (1) Image grayscale conversion
[0053] (2) Performing Canny edge detection on an image refers to extracting the most luminous local parts of the image, which includes the following three steps:
[0054] Gaussian filtering edge detection refers to the process of using a 2k+1*2k+1 Gaussian template M(i,j) (where k is the center of the template) that conforms to a Gaussian distribution, convolving it with the top left corner of the image, and then replacing the pixel value of the corresponding center pixel of the template with the convolved value.
[0055]
[0056] Gradient calculation: The gradient is calculated using an operator, preserving the local maximum gradient direction. The gradient direction is perpendicular to the edge direction. The edge detection operator returns the horizontal magnitude G. x and the amplitude G in the vertical direction y The magnitude of the gradient, G, is the angle. They are respectively:
[0057]
[0058]
[0059] Dual-threshold boundary tracking: Employs a high threshold (maxVal) and a low threshold (minVal). Suppresses weak edges (smaller G) and preserves strong edges (larger G), thereby eliminating non-edge information caused by noise.
[0060] (3) Image contour extraction: This refers to using the erosion and dilation processing method to extract the coordinates of the LCD screen border of the calibration table body, and taking the area inside the border as the ROI (region of interest) for further processing.
[0061] Tilted Image Correction Based on Hough Transform: This method uses the Hough transform to detect the tilt angle of straight line bounding boxes in an image, and then performs rotation correction on the image. The principle of the Hough transform is: a straight line in an image is... This means that, taking k and b as variables and x and y as known quantities, each point on the equation of the straight line in the (x,y) coordinate system corresponds to a straight line in Hough space. The point where multiple straight lines in Hough space intersect is a straight line in the (x,y) coordinate system. To avoid the case where k=∞ in the original coordinate system (x,y), the original coordinates are converted to polar coordinates (ρ,θ). The equation in (ρ,θ) polar coordinates is:
[0062]
[0063] A point in the (x,y) coordinate system is represented as a curve in the polar coordinate system. Then, the parameters ρ and θ of the straight line equation are found based on the intersection of the curve set. Finally, the original image is rotated by an angle θ to obtain the corrected image. The vertical projection algorithm is used to find the boundaries between digital bits and perform segmentation processing.
[0064] The host computer outputs the rated voltage and rated current of the energy meter when it is working normally, and waits for the output of the platform to stabilize. The energy meter calculates the voltage, current and active power of the meter before calibration according to the default calibration coefficient of the program. The host computer accumulates the voltage, current and power of the standard meter of the platform.
[0065] After a certain period of time, the host computer will send the accumulated standard meter's voltage, current, and active power to the energy meter, which will then automatically complete the calibration process for condition 1.0.
[0066] The energy meter error verification device inputs a 100% Un voltage signal and a 1.0L100% Ib current signal to the smart energy meter. The control unit is then activated, and the main controller controls the metering section to obtain the measured actual power value Ps and the standard power value Pb. The main controller then calculates the relative error Y1 between the actual power value Ps and the standard power value Pb, and calculates the error offset value PRoffset based on Y1, storing this PRoffset value.
[0067] In this embodiment, to ensure that the metering accuracy of the smart energy meter is not affected during self-calibration, the voltage and current of the self-calibration system use high-frequency signals. The frequency of the high-frequency signal avoids the fundamental harmonics of the power line. The sensor circuit of the self-calibration system can integrate an online error self-monitoring circuit, which can solve problems such as current loop sampling failure, voltage loop sampling failure, inter-channel phase matching failure, crystal oscillator failure, metering chip reference voltage failure, small signal error failure, and key calibration parameter failure.
[0068] The invention controls the OpenMV to acquire an image of the calibration station's LCD screen displaying the current error of the electricity meter, reads the communication address of the electricity meter under test, extracts the error value from the image, controls the main control MCU timer, sets the electricity meter timing according to the time required for the calibration station to refresh and stabilize the error after electricity meter error compensation, and controls the OpenMV to send the error value to the main control MCU. This invention combines machine vision with electricity meter error calibration technology to realize the automation of electricity meter measurement error calibration.
[0069] It should be noted that, in this document, relational terms such as "one" and "two" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, the phrase "comprising an element defined as..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0070] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A self-calibration method for electricity meters based on the OpenMV digital recognition algorithm, characterized in that: The system includes a main control MCU, a button reset module, an LCD error data display module, an OpenMV programmable image acquisition and processing module, and an RS485 communication module; Step 1: Press the button to start the energy meter calibration process. First, control the main control MCU to read and store the current communication address of the energy meter under test. Then, control the OpenMV camera to acquire an image of the calibration table LCD screen that displays the current error value of the energy meter. Step 2: Control the OpenMV to preprocess the image; Step 3: Control the OpenMV to use machine vision to identify error values in the preprocessed image; Step 4: Control the LCD of the main control MCU to display the current error value to indicate the current identification result; Step 5: Control the main control MCU timer to set the timer of the energy meter according to the time required for the calibration station to refresh and stabilize the error after the energy meter error compensation; Step 6: Control the OpenMV to send the error value to the main control MCU; Step 7: The main control MCU combines object-oriented electricity consumption information data exchange protocol frames and sends them to the electricity meter to be checked; Step 8: Control the energy meter to clear the timer count value and turn on the timer; Step 9: When the timer expires, check whether the current error value is lower than the maximum allowable error value; Step 10: If yes, then control whether the current current test point is the last current test point of the energy meter; Step 11: If yes, control the current electricity meter calibration to end; Step 12: If not, control the OpenMV to capture the error image and perform the next error compensation.
2. The self-calibration method for an energy meter based on the OpenMV digital recognition algorithm according to claim 1, characterized in that... Includes the following steps: (1) Convert the image to grayscale; (2) Performing Canny edge detection on an image refers to extracting the most prominent local brightness in the image; (3) Image contour extraction: This refers to using the erosion and dilation processing method to extract the coordinates of the frame of the LCD screen of the calibration table, and taking the area inside the frame as the ROI (region of interest) for further processing.
3. The self-calibration method for an energy meter based on the OpenMV digital recognition algorithm according to claim 2, characterized in that, The Letnet digit recognition network model on the OpenMV board is used to identify individual digits.
4. The self-calibration method for electricity meters based on the OpenMV digital recognition algorithm according to claim 1, characterized in that, The button reset module is used to control the system to start a new round of calibration.
5. The self-calibration method for electricity meters based on the OpenMV digital recognition algorithm according to claim 1, characterized in that, The LCD display module displays the error results obtained by the OpenMV identification.
6. The self-calibration method for an energy meter based on the OpenMV digital recognition algorithm according to claim 1, characterized in that, The error values obtained by OpenMV are framed using an object-oriented electricity information data exchange protocol.
7. The self-calibration method for an energy meter based on the OpenMV digital recognition algorithm according to claim 1, characterized in that, Connect the RS485 communication interface to the RS485 communication interface of the energy meter under test, and send the protocol frame described in claim 6 to the energy meter for error compensation.
Citation Information
Patent Citations
Electric energy meter error compensation method, device and system based on direct current and even harmonic
CN113589216A
Multi-meter character recognition system and multi-meter character recognition method based on machine vision
CN106909941A
Digital meter reading recognition method based on computer vision and depth learning
CN109344820A