A water quality hardness closed-loop adjusting method based on machine vision
Patent Information
- Application Number
- CN202211020583.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-24
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2042-08-24
AI Technical Summary
[0040]本发明的方法,通过机器视觉修复了硬度指示图像中经常出现的气泡和杂质缺陷,建立图像和给水硬度的预测模型,并使用该模型精确预测锅炉给水的硬度;
Smart Images

Figure CN115677064B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of water treatment technology, specifically relating to a closed-loop adjustment method for water hardness based on machine vision. Background Technology
[0002] Water hardness is an important indicator of water quality. Dissolved calcium, magnesium, and bicarbonate ions in water decompose upon heating, releasing carbon dioxide and forming insoluble carbonates that deposit or scale on the boiler's heat exchange surfaces. These deposits or scale form a low thermal conductivity layer on the boiler's heat exchange surfaces, hindering heat exchange between the boiler and the working fluid in the boiler's heat circulation system. This obstruction of heat exchange leads to the continuous accumulation of heat inside the boiler, creating overheated zones that can cause boiler malfunctions in severe cases. Furthermore, this low thermal conductivity layer prevents the effective transfer of heat generated by the boiler to the working fluid, resulting in higher energy consumption. Boiler deposits can also partially or completely block the boiler tubes, leading to overheating and even tube rupture.
[0003] Therefore, when supplying water to a boiler, water with a reasonable hardness should be used to ensure that the hardness of the water used in the boiler meets the standard. This can prevent scaling and corrosion of the gas boiler, extend the service life of the boiler, and reduce energy consumption.
[0004] To ensure the hardness of boiler feedwater, its hardness value must be measured. Several methods for measuring boiler feedwater hardness already exist, such as the online measurement device and method for industrial circulating water hardness (publication number CN113671112A). This method uses an indicator to colorimetrically determine the water hardness, and then uses a color sensor to determine the color based on the proportions of red, green, and blue in the reflected light, thus judging the hardness. However, this method has the following drawbacks: the color sensor has low accuracy in sensing subtle color changes, and it cannot effectively identify and eliminate interference from bubbles and impurities that frequently occur during detection, resulting in poor anti-interference capabilities. Furthermore, this method only automatically detects water hardness; manual intervention is still required after the hardness measurement to reduce the boiler feedwater hardness. Summary of the Invention
[0005] Based on the aforementioned shortcomings and deficiencies in the prior art, one of the objectives of this invention is to at least solve one or more of the aforementioned problems in the prior art. In other words, one of the objectives of this invention is to provide a machine vision-based closed-loop adjustment method for water hardness that meets one or more of the aforementioned requirements.
[0006] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0007] A closed-loop method for water hardness adjustment based on machine vision includes the following steps:
[0008] S1. Extract boiler feedwater;
[0009] S2. Divide the hardness color reagent into several equal parts, and inject one part of the hardness color reagent into the boiler feedwater each time to obtain a hardness indicator mixture. The hardness color reagent makes the hardness indicator mixture indicate different colors according to the hardness of the water.
[0010] S3. Collect several images of the hardness indicator mixture and determine whether the hardness color developer has been injected for the preset number of color developments. If yes, execute S4; otherwise, execute S2.
[0011] S4. Repair the areas covered by bubbles and impurities in the aforementioned images;
[0012] S5. Use the repaired images to predict the hardness of the water supply.
[0013] S6. Control the inlet and outlet times of the backwashing of the softening water equipment according to the hardness of the feed water, so that the boiler feed water meets the hardness standard.
[0014] As a preferred embodiment, step S4 specifically includes the following steps:
[0015] S41. Extract feature contours from the image;
[0016] S42. Extract the area covered by bubbles or impurities in the image based on the feature contour;
[0017] S43. Replace the area covered by the bubbles or impurities with a nearby area that is not covered by bubbles or impurities.
[0018] As a further preferred embodiment, the step S41 includes the following step:
[0019] S40. Perform image preprocessing on the image.
[0020] As a preferred embodiment, step S5 specifically includes the following steps:
[0021] S51. Select several preset sampling points in the water hardness range of interest, and perform several samplings on each color reaction of each preset sampling point to obtain a hardness-color sample.
[0022] S52. Calculate the polynomial fitting values and weights of each channel of the hardness-color sample and the image of the corresponding color development number in each color space.
[0023] S53. Calculate the comprehensive fitting formula and comprehensive weight of each channel of each image and the corresponding color development sample in each color space.
[0024] S54. The water hardness is obtained by weighting the comprehensive fitting formula of each channel in each color space according to the comprehensive weight.
[0025] As a preferred embodiment, step S6 further includes:
[0026] The water hardness is determined based on whether it exceeds the standard. If it does, an alarm is triggered.
[0027] On the other hand, the present invention also provides a closed-loop water hardness adjustment device based on machine vision, specifically comprising:
[0028] The reaction tank is used to mix boiler feedwater and hardness colorimetric agent into a hardness indicator mixture.
[0029] A water supply valve is used to inject boiler feedwater into the reaction tank.
[0030] A dosing pump is used to inject a hardness colorimetric agent into the reaction tank;
[0031] A camera is used to acquire images of the hardness-indicating mixture;
[0032] Water softening equipment is used to soften boiler feedwater;
[0033] The inlet valve is used to control the water intake during backwashing of the softened water equipment;
[0034] A drain valve is used to control the drainage during backwashing of the softened water equipment.
[0035] The controller is connected to the reaction tank, water supply valve, dosing pump, camera, water softening equipment, inlet valve, and drain valve. It acquires an image of the hardness indicator mixture from the camera, repairs the areas covered by bubbles and impurities in the image, uses the repaired image to predict the hardness of the water supply, and controls the inlet valve and drain valve to backwash the water softening equipment according to the water supply hardness.
[0036] As a preferred embodiment, the device further includes an alarm connected to the controller for triggering an alarm when the water hardness exceeds the standard.
[0037] As a preferred embodiment, the device further includes a host computer, and the controller is communicatively connected to the host computer to output water hardness data to the host computer.
[0038] As a preferred embodiment, the device further includes a fill light connected to the controller for providing fill light to the camera.
[0039] Compared with the prior art, the beneficial effects of this invention are:
[0040] The method of the present invention repairs the defects of bubbles and impurities that often appear in hardness indicator images through machine vision, establishes a prediction model of image and feedwater hardness, and uses the model to accurately predict the hardness of boiler feedwater.
[0041] The method of this invention also adds a closed-loop feedback process on the basis of machine vision, which automatically controls the water inlet and outlet time of the softening water equipment during backwashing based on the detection results of the feed water hardness, so that the boiler water quality can automatically and always meet the hardness standard. Attached Figure Description
[0042] Figure 1 This is a flowchart of a closed-loop water hardness adjustment method based on machine vision according to an embodiment of the present invention;
[0043] Figure 2 This is a flowchart of step S4 in an embodiment of the present invention;
[0044] Figure 3 This is a flowchart of step S5 in an embodiment of the present invention;
[0045] Figure 4 This is a schematic diagram of a closed-loop water hardness adjustment device based on machine vision according to an embodiment of the present invention. Detailed Implementation
[0046] To more clearly illustrate the embodiments of the present invention, specific implementation methods will be described below with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings and other implementation methods can be obtained based on these drawings without any creative effort.
[0047] Example: This example provides a closed-loop adjustment method for water hardness based on machine vision, and its flowchart is as follows. Figure 1 As shown, the specific steps include the following:
[0048] S1. Extract boiler feedwater, open the boiler feedwater valve, and inject a portion of the boiler feedwater sample to be tested into the reaction vessel.
[0049] S2. Divide the hardness colorimetric agent into K equal parts. Each time step S2 is performed, only one part of the colorimetric agent is injected into the boiler feedwater. The hardness colorimetric agent can indicate different colors according to the hardness of the boiler feedwater, and the more hardness colorimetric agent injected, the stronger the color. Preferably, in this embodiment, a red-blue colorimetric agent is selected as the hardness colorimetric agent.
[0050] The hardness indicator and boiler feedwater are stirred and mixed to obtain a hardness indicator mixture with different colors depending on the hardness of the boiler feedwater.
[0051] Furthermore, before step S2, it is necessary to determine whether this is the first test after startup. If it is the first test, the hardness developer should be filled to fill the entire developer pipeline, and the boiler feed water valve should be opened. The boiler feed water should be used to continuously flush the reaction vessel for a period of time to clean the reaction vessel and avoid the residual impurities in the reaction vessel from affecting the test results.
[0052] S3. Acquire an image of the hardness indicator mixture and determine whether the developer has been injected K times. If yes, proceed to S4; otherwise, proceed to S2 to inject the developer again to make the color more intense. Then, take an image again through step S3 until the developer has been injected K times.
[0053] S4. Process the acquired K images. Addressing the common issue of air bubbles and impurities interfering with image detection in images of hardness indicator mixtures, specifically remove image areas containing air bubbles and impurities. The repaired images of the hardness indicator mixture now consist entirely of the normal mixture portion, thus avoiding interference from certain special areas in image detection.
[0054] Furthermore, the process of step S4 is as follows: Figure 2 As shown, it includes the following steps:
[0055] S41. Input the image of the hardness indicator mixture obtained in step S3 in RGB format, and use the contour extraction algorithm to extract the feature contour of the hardness indicator mixture image to obtain the boundary of the hardness indicator mixture area on the image, and the dividing line between the hardness indicator mixture and the area covered by bubbles and impurities.
[0056] S42. Based on the boundary line extracted from the feature contour, determine whether there are interference areas covered by bubbles and impurities in the image. If so, continue the process of step S42 to distinguish the areas covered by bubbles and impurities. Otherwise, jump directly to step S5.
[0057] S43. Select an area covered by bubbles or impurities, and replace it with a nearby area of the mixture where there are no bubbles or impurities. Select the next area covered by bubbles and impurities, and replace it in the same way, until all areas covered by bubbles or impurities obtained in step S42 have been replaced.
[0058] Furthermore, to facilitate feature contour extraction and repair in step S4, step S40, image preprocessing, is included before step S41. In this embodiment, image cropping, Gaussian filtering, and opening operations are preferably used for preprocessing.
[0059] S5. Use the repaired K images to predict the hardness of the water supply;
[0060] Specifically, step S5 is as follows: Figure 3The process shown includes the following steps:
[0061] S51, for (0,H) max Within the hardness range of (mmol / l), M equally spaced sampling points are divided, denoted as P. i (i∈(0,M]), for each sampling point, N samples are taken for each colorimetric reaction, denoted as P. imj (j∈(0,N]), where m represents the m-th injection of hardness developer. In the above hardness range, H... max This indicates the maximum water hardness value of interest, exceeding H. max The hardness is considered to be excessive.
[0062] S52. Using RGB and HSV color spaces, calculate the values of the R, G, B, H, S, and V channels in images with different color development times, and their weights, as well as the polynomial fit values of the hardness-color development samples with the same color development times.
[0063] The polynomial fitting relationship between the image of the m-th color development and the hardness-color development sample channel values of the m-th color development sample (H) Xm The calculation formula is:
[0064]
[0065] Where X represents each channel (R, G, B, H, S, V channels), Y represents the highest Y-order polynomial fit for each channel, and Y can be the minimum error order without overfitting. α n X represents the fitting coefficients of the nth-order polynomial. n This represents the nth order value of the X channel in the currently detected water quality image.
[0066] Calculate the weight of the m-th color development at the i-th sampling point in each channel. The weight w of the m-th color development response at the i-th sampling point in each channel. Xim The calculation formula is:
[0067]
[0068] Where X represents each channel (R, G, B, H, S, V channels), This represents the average of N samples taken from the X channel at the m-th colorimetric reaction point of the i-th sampling point. This represents the X channel value of the j-th sample at the i-th sampling point.
[0069] The weight w of each channel in the m-th colorimetric reaction Xm The calculation formula is:
[0070]
[0071] Among them, P (i-1)mP represents the hardness value at the (i-1)th sampling point. im P represents the hardness value at the i-th sampling point. Mm w represents the hardness value at the Mth sampling point. XMm This represents the weight of the Mth sampling point.
[0072] S53. Calculate the comprehensive fitting formula and comprehensive weight of the image and hardness-coloring sample for each color development number in the R channel, G channel, B channel, H channel, S channel, and V channel;
[0073] The comprehensive fitting formula H for each channel X for:
[0074]
[0075] Where K represents the total number of colorimetric reactions. The weight of the m-th colorimetric reaction in the normalized X channel is expressed by the following formula:
[0076]
[0077] Where K represents the total number of colorimetric reactions, w Xi The weight of the i-th colorimetric reaction in the X channel.
[0078] The overall weight w of each channel X The calculation formula is:
[0079]
[0080] Then, step S54 is executed: the comprehensive fitting formulas of the R, G, B, H, S, and V channels of each color-developed image are weighted according to their comprehensive weights in each channel, and the total water hardness value is obtained according to the mapping relationship.
[0081] H = w R ·H R +w G ·H G +w B ·H B +w H ·H H +w S ·H S +w V ·H V .
[0082] After calculating the predicted value of the feedwater hardness in step S5, closed-loop hardness control is performed based on the hardness value. Step S6 is executed to control the water inlet and drainage time of the softening water equipment during backwashing according to the feedwater hardness, so that after the softening water equipment is backwashed for a set time under the feedwater hardness, the hardness of the boiler feedwater meets the hardness standard.
[0083] Specifically, in step S6, the water hardness range is divided into several water hardness levels by three water hardness thresholds: H1, H2, and H3. Each level corresponds to a set water inlet and outlet time, which is used to backwash the softened water equipment.
[0084] Among them, the water inlet time T during backwashing of the softened water equipment 进 The correspondence between (S) and water hardness grade H is as follows:
[0085]
[0086] Drainage time T during backwashing of water softening equipment 排 The correspondence between (S) and water hardness grade H is as follows:
[0087]
[0088] In addition, if the water hardness exceeds the set hardness range or the test results are abnormal, the process should be repeated after backwashing the softened water equipment, returning to step S1 for a new round of testing until the water hardness returns to the set range or the maximum number of tests is reached.
[0089] After the test is completed, open the boiler feedwater valve to clean the reaction vessel.
[0090] This embodiment also provides a machine vision-based closed-loop water hardness adjustment device for performing the above method, and its structural schematic diagram is shown below. Figure 4 As shown, the details are as follows:
[0091] The device includes a controller, a reaction tank, a feedwater valve, a dosing pump, a camera, an inlet valve, and a drain valve. The reaction tank, serving as the reaction vessel in the above method, contains boiler feedwater and a hardness indicator, mixing them to form a hardness indicating mixture. The feedwater valve injects boiler feedwater into the reaction tank. The dosing pump injects the hardness indicator into the reaction tank. The camera captures images of the hardness indicating mixture. The inlet valve controls the water intake during backwashing of the softening water equipment. The drain valve controls the drainage during backwashing of the softening water equipment.
[0092] The controller uses a Raspberry Pi 4B, which is electrically connected to the camera via the CSI interface, and electrically connected to the dosing pump, water supply valve, water softening equipment, inlet valve, and drain valve via the GPIO interface.
[0093] The controller can control the switching of the dosing pump, water supply valve, dosing pump, inlet valve and drain valve, receive images captured by the camera, and perform the image repair and prediction of water hardness based on the images as described above, and perform backwashing of the water softening equipment for different durations according to the water hardness.
[0094] The device also includes a supplemental light, which is also connected to the controller, to provide supplemental lighting when the camera captures images of the hardness-indicating mixture.
[0095] Furthermore, to facilitate the acquisition of boiler feedwater hardness and control of the device, this system also includes a host computer. The controller communicates with the host computer via Modbus signals and a 4-20mA current signal output from the PWM signal. Through this communication, the controller sends the equipment operating status and water quality detection parameters to the host computer. Additionally, for more intuitive and timely reporting of water hardness information, the device includes indicator lights, an alarm, and red and blue lights, all electrically connected to the controller. When the device's water quality detection is working normally, the indicator light remains constantly lit. When the controller identifies the hardness indicator mixture as red, the red light illuminates; when it identifies it as blue, the blue light illuminates; and when the water quality exceeds the standard, the controller activates the alarm.
[0096] It should be noted that the above embodiments are merely detailed descriptions of preferred embodiments and principles of the present invention. For those skilled in the art, there may be changes in specific implementation methods based on the ideas provided by the present invention, and these changes should also be considered within the scope of protection of the present invention.
Claims
1. A closed-loop adjustment method for water hardness based on machine vision, characterized in that, The steps include the following: S1. Extract boiler feedwater; S2. Divide the hardness color reagent into several equal parts, and inject one part of the hardness color reagent into the boiler feedwater each time to obtain a hardness indicator mixture. The hardness color reagent makes the hardness indicator mixture indicate different colors according to the hardness of the water. S3. Collect several images of the hardness indicator mixture and determine whether the hardness color developer has been injected for the preset number of color developments. If yes, execute S4; otherwise, execute S2. S4. Repair the areas covered by bubbles and impurities in the aforementioned images; S5. Use the repaired images to predict the hardness of the water supply. S6. Control the inlet and outlet times of the backwashing of the softening water equipment according to the hardness of the feed water, so that the boiler feed water meets the hardness standard. Step S5 specifically includes the following steps: S51. Select several preset sampling points in the water hardness range of interest, and perform several samplings on each color reaction of each preset sampling point to obtain a hardness-color sample. S52. Calculate the polynomial fitting values and weights of each channel of the hardness-color sample and the image of the corresponding color development number in each color space. S53. Calculate the comprehensive fitting formula and comprehensive weight of each channel of each image and the corresponding color development sample in each color space. S54. The water hardness is obtained by weighting the comprehensive fitting formula of each channel in each color space according to the comprehensive weight.
2. The closed-loop water hardness adjustment method based on machine vision as described in claim 1, characterized in that, Step S4 specifically includes the following steps: S41. Extract feature contours from the image; S42. Extract the area covered by bubbles or impurities in the image based on the feature contour; S43. Replace the area covered by the bubbles or impurities with a nearby area that is not covered by bubbles or impurities.
3. The closed-loop water hardness adjustment method based on machine vision as described in claim 2, characterized in that, The step S41 is preceded by the following step: S40. Perform image preprocessing on the image.
4. The closed-loop water hardness adjustment method based on machine vision as described in claim 1, characterized in that, Step S6 further includes: The water hardness is determined based on whether it exceeds the standard. If it does, an alarm is triggered.
5. A machine vision-based closed-loop water hardness adjustment device, used to execute the machine vision-based closed-loop water hardness adjustment method as described in claim 1, characterized in that, Specifically, it includes: The reaction tank is used to mix boiler feedwater and hardness colorimetric agent into a hardness indicator mixture. A water supply valve is used to inject boiler feedwater into the reaction tank. A dosing pump is used to inject a hardness colorimetric agent into the reaction tank; A camera is used to acquire images of the hardness-indicating mixture; Water softening equipment is used to soften boiler feedwater; The inlet valve is used to control the water intake during backwashing of the softened water equipment; A drain valve is used to control the drainage during backwashing of the softened water equipment. The controller is connected to the reaction tank, water supply valve, dosing pump, camera, water softening equipment, inlet valve, and drain valve. It acquires an image of the hardness indicator mixture from the camera, repairs the areas covered by bubbles and impurities in the image, uses the repaired image to predict the hardness of the water supply, and controls the inlet valve and drain valve to backwash the water softening equipment according to the water supply hardness.
6. The water hardness closed-loop adjustment device based on machine vision as described in claim 5, characterized in that, The device also includes an alarm connected to the controller, used to sound an alarm when the hardness of the water supply exceeds the standard.
7. The water hardness closed-loop adjustment device based on machine vision as described in claim 5, characterized in that, The device also includes a host computer, and the controller is communicatively connected to the host computer to output water hardness data to the host computer.
8. The water hardness closed-loop adjustment device based on machine vision as described in claim 5, characterized in that, The device also includes a fill light, which is connected to the controller and is used to provide fill light for the camera.
Citation Information
Patent Citations
Industrial circulating water hardness on-line measuring device and method
CN113671112A
Image impurity removal method and device, equipment and storage medium
CN114418880A
Full-automatic hardness on-line monitoring demineralized water system
CN204550289U
Hardness measuring method and hardness measuring device
JP2022113472A