A water quality detection method and device based on detection light

CN122468643BActive Publication Date: 2026-10-23四川省遂宁生态环境监测中心站 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610953906.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-10-23
Estimated Expiration
2046-06-30

AI Technical Summary

Technical Problem

然而,静态浊度算法将水体中固有的固体悬浮物等同于微气泡,忽略了微气泡的瞬态高频特征,导致补偿误差极大;以及常规的平滑滤波算法采取的是一刀切的数据抹平处理,在强行压制微气泡产生的高频突变毛刺时,会不可避免地将水体本身真实发生的高频水质浓度突变信号一并滤除,极易造成严重的水污染漏报现象

Benefits of technology

[0009]本发明可克服传统物理脱气方案设备体积大、成本高、维护难及水样滞后严重的缺陷,能够满足水质突发性变化的实时预警需求;同时,与常规平滑滤波或静态浊度补偿算法相比,本发明不仅能够有效区分微气泡产生的高频脉冲扰动与水体真实的高频水质浓度突变,避免了因盲目抹平数据而导致的水污染漏报,还能利用波长依赖规律剔除电气噪声等非气泡干扰,从而在完整保留原始光谱中水质特征吸收信息的前提下,显著提升紫外-可见光光谱在线监测的准确性与可靠性,为地表水、工业废水及市政管网等场景下的水质快速预警提供了一种低硬件成本、无滞后、高保真的纯软件解决方案。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122468643B_ABST
    Figure CN122468643B_ABST
Patent Text Reader

Abstract

The application discloses a water quality detection method and device based on detection light, and is used for solving the problem of micro-bubble transient light intensity attenuation artifact interference detection accuracy in a flow cell. The method comprises the following steps: high-frequency acquisition of a detection light spectrum passing through a water body to be detected to obtain an original spectrum time sequence matrix; continuous wavelet transform is performed on the matrix to extract a high-frequency pulse disturbance component caused by micro-bubbles and subjected to Mie scattering law; the component is input into a transient scattering physical attenuation model to calculate an instantaneous absorbance increment and aggregate to generate a dynamic scattering compensation matrix; finally, the original matrix is subjected to inverse convolution decoupling through the compensation matrix, and the artifact is removed to obtain pure spectrum data, and the pure spectrum data are input into a water quality model to obtain a detection result. The present application realizes virtual degassing through a frequency domain decoupling pure algorithm, and can significantly improve the accuracy of water quality detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water quality testing technology, specifically a water quality testing method and device based on detection light. Background Technology

[0002] Spectroscopic analysis technology based on the ultraviolet to visible light band has been widely used in online water quality monitoring of surface water, industrial wastewater, and municipal pipe networks (such as concentration inversion of indicators like COD, TOC, and nitrate) due to its advantages of requiring no chemical reagents, fast detection speed, and no secondary pollution. In actual online monitoring scenarios, a water pump is typically used to continuously pump the water body to be tested into a flow-through tank, and the absorption spectrum data of the water body is obtained through the optical window of the flow-through tank by a spectrometer.

[0003] However, during fluid pumping and pipeline transportation, a large number of microbubbles inevitably form in the flowing water within the flow tank due to physical factors such as fluid shear force, sudden changes in pipeline pressure, and the release of dissolved gases. When these microbubbles pass through the detection optical path with the water flow, they cause strong Mie scattering of the detection light. Since the generation, collapse, and ionization of microbubbles is a rapid transient process, this light scattering manifests as a high-frequency, nonlinear, and drastic attenuation of light intensity in the original absorption spectrum data.

[0004] To address optical interference in water bodies, existing technologies typically add physical degassing devices (such as ultrasonic defoamers, defoaming settling tanks, or negative pressure degassing valves) to the front end of the flow tank. However, these solutions not only significantly increase the size, manufacturing cost, and maintenance difficulty of water quality testing equipment, but also cause severe water sample lag due to physical settling defoaming, failing to meet the real-time early warning requirements for sudden changes in water quality.

[0005] Meanwhile, existing technologies employ static turbidity compensation algorithms (such as single-wavelength / dual-wavelength baseline subtraction) or conventional smoothing filtering algorithms (such as moving average and low-pass filtering). However, static turbidity algorithms equate inherent suspended solids in water to microbubbles, ignoring the transient high-frequency characteristics of microbubbles, resulting in extremely large compensation errors. Furthermore, conventional smoothing filtering algorithms employ a one-size-fits-all data smoothing process. When forcibly suppressing high-frequency abrupt changes generated by microbubbles, they inevitably filter out the high-frequency water quality concentration abrupt changes that actually occur in the water body, easily leading to serious underreporting of water pollution. Summary of the Invention

[0006] To address the problems mentioned in the background art, the purpose of this application is to provide a water quality detection method and device based on detection light.

[0007] This invention provides a water quality detection method based on detection light, comprising the following steps: The control spectral detector continuously acquires the detection light spectrum of the water body to be tested passing through the flow cell at a preset sampling rate to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension; A continuous wavelet transform is performed on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering; The high-frequency pulse disturbance component is input into a preset transient scattering physical attenuation model to calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and the instantaneous absorbance increment is aggregated in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The original spectral time series matrix is ​​deconvolved and decoupled using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles, thereby obtaining pure spectral data. The pure spectral data is then input into a preset water quality model for inversion to obtain water quality detection results.

[0008] The present invention also provides a water quality detection device based on detection light, the device comprising: The acquisition module is used to control the spectral detector to continuously acquire the detection light spectrum of the water body to be tested passing through the flow cell at a preset sampling rate, so as to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension. The extraction module is used to perform continuous wavelet transform on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering. The generation module is used to input the high-frequency pulse disturbance component into a preset transient scattering physical attenuation model, calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and aggregate the instantaneous absorbance increment in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The decoupling module is used to perform inverse mapping decoupling on the original spectral time series matrix by deconvolution using the dynamic scattering compensation matrix, so as to remove the artifacts of transient light intensity attenuation of microbubbles, obtain pure spectral data, and input the pure spectral data into a preset water quality model for inversion to obtain water quality detection results.

[0009] This invention overcomes the shortcomings of traditional physical degassing solutions, such as large equipment size, high cost, difficult maintenance, and severe water sample lag. It can meet the real-time early warning needs for sudden changes in water quality. At the same time, compared with conventional smoothing filtering or static turbidity compensation algorithms, this invention can not only effectively distinguish between high-frequency pulse disturbances generated by microbubbles and the actual high-frequency water quality concentration changes in the water body, avoiding water pollution underreporting caused by blindly smoothing data, but also use wavelength-dependent laws to eliminate non-bubble interference such as electrical noise. Thus, while completely preserving the water quality characteristic absorption information in the original spectrum, it significantly improves the accuracy and reliability of online ultraviolet-visible spectral monitoring. It provides a low-hardware-cost, lag-free, and high-fidelity pure software solution for rapid water quality early warning in scenarios such as surface water, industrial wastewater, and municipal pipe networks. Attached Figure Description

[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0011] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A schematic flowchart of a water quality detection method based on detection light provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a water quality detection device based on detection light, provided in an embodiment of this application. Figure 3 This is a schematic diagram of the structure of the extraction module 20 provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of the generation module 30 provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of the decoupling module 40 provided in an embodiment of this application. Detailed Implementation

[0012] The present invention will now be clearly and completely described in conjunction with the technical solutions in this embodiment.

[0013] This embodiment provides a water quality detection method based on detection light, preferably applied in online water quality monitoring equipment equipped with a flow cell and a spectral detector. This method achieves virtual degassing of microbubbles in flowing water through pure algorithmic decoupling in the frequency domain. It eliminates the need for additional physical degassing devices and does not rely on traditional smoothing filters or static turbidity compensation. Thus, while preserving the true high-frequency abrupt changes in water quality signals, it effectively eliminates transient light intensity attenuation artifacts caused by microbubbles.

[0014] Please see Figure 1 As shown, the method provided in this embodiment includes the following steps: S1, control the spectral detector to continuously collect the detection light spectrum passing through the water body to be tested in the flow cell at a preset sampling rate, so as to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension; The water to be tested is continuously pumped into the flow cell by a water pump. When it flows through the detection optical path, the dissolved chemical substances in the water (such as organic matter, nitrates, etc.) will produce characteristic absorption of the detection light in the ultraviolet to visible band. The spectrometer collects the transmission spectrum in real time through the optical windows on both sides of the flow cell, thereby obtaining the raw absorbance data.

[0015] However, during fluid pumping and pipeline transportation, physical factors such as fluid shear force, sudden changes in pipeline pressure, and the release of dissolved gases can generate a large number of microbubbles with diameters ranging from tens to hundreds of micrometers within the flowing water. When these microbubbles travel at high speed through the detection optical path with the water flow, they cause strong Mie scattering of the detection light, which manifests as a high-frequency, nonlinear, and drastic attenuation of light intensity in the spectral data. Since the generation, collapse, and ionization of microbubbles is a rapid transient process, typically lasting from several milliseconds to tens of milliseconds, it appears as a narrow pulse on the time axis.

[0016] To effectively identify and eliminate the aforementioned pulse disturbances, it is necessary to ensure that the sampling density of the original spectral data in the time dimension is sufficient to completely capture the morphological envelope of each microbubble event. If the sampling rate is too low, the light intensity attenuation caused by microbubbles will result in undersampling on the time axis. This can lead to an underestimation of the pulse peak value, or even complete loss of the pulse or aliasing into low-frequency pseudo-signals. Consequently, subsequent continuous wavelet transforms will be unable to accurately separate the bubble disturbances from the actual changes in water quality.

[0017] Furthermore, the present invention sets the preset sampling rate to be greater than twice the ratio of the flow velocity of the water to be tested in the flow pool to the detection aperture of the optical window in the flow pool.

[0018] Specifically, let the flow velocity of the water to be measured in the flow-through pool be... (Unit: m / s), the detection aperture of the optical window along the water flow direction is... (Unit: meters), then the shortest time required for a microbubble to pass through the detection optical path is approximately According to the Nyquist sampling theorem, to capture the waveform of this transient event without distortion, the sampling interval of the spectrometer should not exceed half of the crossover time, i.e., the sampling frequency. Must meet In this embodiment, considering the non-ideal nature of the actual microbubble size distribution and scattered light intensity variations, the sampling rate is further preset to a value greater than [value missing] to ensure sufficient redundancy in the algorithm. ,Right now: , It should be understood that in practical applications, the value can be adjusted upwards appropriately based on the intensity of bubble generation in the water, but it should not be too high to avoid data redundancy. By satisfying the above relationship, it can be ensured that each microbubble passing through the optical path is continuously acquired with at least two frames of spectral slices, providing sufficient temporal resolution for subsequent wavelet transform, so that the high-frequency pulse components caused by microbubbles can be clearly located and separated in the wavelet coefficient matrix.

[0019] Based on this, the spectrometer continuously acquires the detection light spectrum of the water sample passing through the flow cell at the preset sampling rate. Each sampling yields a spectral curve covering the detection band (e.g., 200 nm to 800 nm). Stacking the spectral curves from multiple consecutive samplings in chronological order creates a two-dimensional data array, i.e., the original spectral time series matrix. The row indices of this matrix correspond to discrete time points, i.e., sampling times, and the column indices correspond to discrete wavelength nodes. Each element in the matrix represents the absorbance or transmitted light intensity value at a specific wavelength at a given moment.

[0020] S2, perform continuous wavelet transform on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering; After obtaining the original spectral time series matrix with high temporal resolution, this matrix simultaneously contains absorption signals generated by the water's own chemical composition, transient scattering artifacts caused by microbubbles, and potentially high-frequency noise from the electrical system. This step aims to accurately extract the high-frequency pulse perturbation component caused solely by microbubbles.

[0021] In some embodiments, the original spectral time series matrix is ​​subjected to continuous wavelet transform along the time axis to extract high-frequency pulse perturbation components caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering, including: S21, use a preset wavelet basis to perform continuous wavelet transform on the original spectral time series matrix along the time axis to obtain a wavelet coefficient matrix, and extract candidate pulse components whose frequency band is in a preset high frequency range from the wavelet coefficient matrix. It should be noted that changes in water concentration (such as rapid increases or decreases in COD or nitrate due to sudden pollution) typically exhibit a slow, gradual trend or low-frequency components with limited rates of change over time, with typical timescales ranging from seconds to minutes. In contrast, the event of microbubbles traversing the optical path is extremely brief, generally lasting from milliseconds to tens of milliseconds, thus appearing as narrow-band high-frequency pulses on the time axis of the original spectral time series matrix. However, high-pass filtering in the frequency domain alone cannot distinguish between microbubble disturbances and high-frequency noise from electrical systems, as the latter also possesses high-frequency characteristics but lacks a physically wavelength-dependent pattern. Therefore, this invention further designs a verification method based on the physical characteristics of Mie scattering, building upon time-frequency analysis.

[0022] This embodiment first utilizes a preset wavelet basis to perform a continuous wavelet transform on the original spectral time series matrix along the time axis. The advantage of wavelet transform over short-time Fourier transform lies in its multi-resolution analysis capability, specifically: it has high frequency resolution in the low-frequency band and high time resolution in the high-frequency band, which highly matches the high-frequency and extremely short-duration characteristics of microbubble transient pulses. It should be understood that the preset wavelet basis preferably uses wavelets with high morphological similarity to the pulse distortion waveform generated by the microbubble, such as Daubechies wavelets (e.g., db4, db6) or Symlets wavelets, whose compact support characteristics can effectively capture the energy accumulation locations of abrupt signal changes.

[0023] Specifically, a continuous wavelet transform is independently performed on each wavelength channel (i.e., each column, representing a time series at a fixed wavelength) in the original spectral time series matrix. The resulting wavelet coefficient matrix is ​​expanded on the time-scale (or time-pseudo-frequency) plane, where each coefficient reflects the similarity of the original signal at a specific time position and frequency band at that wavelength. Since microbubble disturbances are high-frequency narrowband events, their energy is mainly concentrated in the small-scale (corresponding to high-frequency) region on the scale axis. Based on the pre-calibrated typical pulse width corresponding to the microbubble diameter range and water flow velocity in the flow cell, a high-frequency range threshold can be determined.

[0024] The coefficient components whose frequency bands fall within the preset high-frequency range are extracted from the wavelet coefficient matrix; these are the candidate pulse components. It should be noted that these candidate pulse components represent all candidate events that exhibit high-frequency abrupt changes on the time axis, but they may originate from microbubbles, electrical ripples, or mechanical vibration coupled noise.

[0025] S22, obtain the attenuation amplitude of the candidate pulse component at multiple detection wavelengths, and fit and calculate the scattering index between the attenuation amplitude and the wavelength; if the scattering index falls within the preset microbubble Mie scattering characteristic range, then determine that the candidate pulse component obeys the Mie scattering wavelength dependence law, and confirm it as the high-frequency pulse disturbance component caused by the microbubble.

[0026] To distinguish genuine microbubble perturbations from candidate pulse components, this embodiment utilizes the wavelength dependence characteristic of microbubble Mie scattering for secondary physical verification. According to Mie scattering theory, when the bubble diameter and the detection light wavelength are on the same order of magnitude (tens of nanometers to several micrometers or more), the scattering intensity... With wavelength They satisfy a power-law relationship: , Among them, scattering index It is usually between 0.5 and 4.

[0027] For typical microbubbles in water (with diameters ranging from tens to hundreds of micrometers, much larger than the ultraviolet-visible wavelength), their scattering falls under the category of large-particle Mie scattering. The scattering efficiency exhibits a certain oscillating decay trend with wavelength, generally characterized by strong scattering in the short-wavelength band and weakened scattering in the long-wavelength band. Through extensive offline experimental calibration, this embodiment can pre-determine the microbubble Mie scattering characteristic range, such as the scattering index, for specific flow cell geometric parameters and bubble particle size distribution ranges. The turbidity is between 2.0 and 3.5. The turbidity caused by the inherent suspended solids in the water body shows a monotonically and gradually decreasing trend with wavelength (the exponent is usually close to 1 or lower), while the amplitude of high-frequency noise in electrical systems does not have a stable and consistent relationship across wavelengths.

[0028] Based on the above principles, this embodiment performs the following operations on each candidate pulse component: Obtain the attenuation amplitude (i.e., the amplitude of the wavelet coefficients or the reconstructed light intensity attenuation) of the candidate pulse component at multiple different detection wavelengths (e.g., selecting several representative wavelength nodes such as 254nm and 280nm in the ultraviolet band, and 400nm, 550nm, and 700nm in the visible band). Perform power-law fitting on these attenuation amplitudes and the corresponding wavelength values ​​to calculate the scattering index of the candidate pulse component. .

[0029] Next, the scattering index Compare with the preset microbubble Mie scattering characteristic range: If If the candidate pulse component falls within this characteristic range, it is determined that the candidate pulse component obeys the Mie scattering wavelength dependence law and is identified as a high-frequency pulse disturbance component caused by microbubbles; if If the value falls outside the characteristic range, it is classified as non-bubble interference (such as electrical noise, mechanical vibration, or sudden changes in turbidity of solid suspensions) and removed.

[0030] Through the aforementioned dual screening process, the final result is a pure high-frequency pulse disturbance component caused solely by microbubbles. This component not only contains the precise time and location of each bubble event but also retains its relative attenuation intensity information at each wavelength. Compared to traditional methods that simply smooth out high-frequency spikes or attribute them to turbidity interference, this step, by employing Mie scattering index verification, significantly improves the accuracy of bubble disturbance identification and avoids the erroneous rejection of high-frequency abrupt changes in actual water quality.

[0031] S3, input the high-frequency pulse disturbance component into the preset transient scattering physical attenuation model, calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and aggregate the instantaneous absorbance increment in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The aforementioned high-frequency pulse perturbation component is essentially a dimensionless sequence of relative amplitudes related to the wavelet transform scale and wavelet basis gain, not a change in absorbance. To quantitatively compensate the original spectrum, these relative amplitudes need to be converted into instantaneous absorbance increments (unit: AU) in real optical detection. Therefore, this step pre-establishes a transient scattering physical attenuation model and inputs the aforementioned high-frequency pulse perturbation component into this model to calculate the instantaneous absorbance increments caused by the microbubbles at each wavelength node. The transient scattering physical attenuation model is constructed based on Mie scattering theory, the optical geometry parameters of the flow cell, and a pre-calibrated microbubble particle size distribution function.

[0032] It should be noted that when the detection light passes through the water body containing microbubbles, the increase in absorbance caused by the bubbles mainly depends on the diameter distribution, number density, refractive index, and wavelength of the detection light.

[0033] Specifically, for a single diameter of Bubbles, which are at wavelength The scattering cross section below It can be calculated using Mie scattering theory. When the optical path length is... (i.e., the effective optical path between the two optical windows of the flow cell), and the number density of bubbles per unit volume is At that time, the increase in absorbance caused by the bubble cluster satisfy: , It should be noted that during actual online monitoring, the particle size distribution of microbubbles... The dynamic changes in operating conditions such as flow rate, pressure, and dissolved gas saturation make real-time measurement difficult. Therefore, the transient scattering physics attenuation model in this embodiment does not directly solve the above integral, but instead preferably adopts the following engineering approximation strategy, as follows: The amplitude of the extracted high-frequency pulse perturbation component is used as a proxy characteristic of the overall intensity of bubble scattering. Specifically, through offline calibration experiments, under the same flow cell geometry and hydraulic conditions, high-precision microscopic bubble images (or standard scattering media of known turbidity) and the high-frequency perturbation amplitude output by the spectrometer are recorded simultaneously to establish a mapping relationship between the perturbation amplitude and the absorbance increment at a specific wavelength. It should be understood that this mapping can be a linear relationship (when the bubble concentration is low and there is no multiple scattering) or a nonlinear relationship (fitted by polynomial or piecewise interpolation).

[0034] During operation, for each confirmed microbubble event, the relative amplitude sequence of its high-frequency pulse perturbation component at each wavelength is input into the aforementioned transient scattering physical attenuation model. Based on pre-calibrated mapping coefficients, this model outputs the instantaneous absorbance increment of the bubble event at each detection wavelength node. Since the duration of the microbubble traversing the optical path is extremely short (typically covering only one or a few sampling intervals), the calculated instantaneous absorbance increment characterizes the additional attenuation of the detected light intensity caused by the bubble within this extremely short time window.

[0035] After obtaining the instantaneous absorbance increment of each bubble event at each wavelength node, these sparse, discrete compensation values ​​are further organized into a matrix with the same dimensions as the original spectral time series matrix in order to perform point-by-point decoupling operations.

[0036] In some embodiments, the instantaneous absorbance increment is aggregated along the time and wavelength dimensions to generate a dynamic scattering compensation matrix, including: S31, Obtain the time coordinate sequence and wavelength coordinate sequence of the original spectral time series matrix, and construct an initial compensation matrix that matches the dimension of the original spectral time series matrix; Obtain the time coordinate sequence (i.e., the vector formed by each sampling time point) and wavelength coordinate sequence (i.e., the vector formed by each detection wavelength node) of the original spectral time series matrix. These two coordinate sequences respectively provide the index range of the original matrix in the time dimension and wavelength dimension. Based on the dimensions of these two sequences (e.g., the number of time points...),... The number of wavelength nodes is ), construct a space of the same size The initial compensation matrix. Each element in this matrix is ​​initially set to zero, indicating that, by default, there are no scattering artifacts to be compensated across the entire time and space range before any bubble information is written.

[0037] S32, based on the occurrence time of the high-frequency pulse disturbance component on the time coordinate sequence, write the calculated instantaneous absorbance increment at the corresponding time and wavelength node into the coordinate position corresponding to the initial compensation matrix; and set the element values ​​of the remaining coordinate positions in the initial compensation matrix that were not written with the instantaneous absorbance increment to zero, so as to generate and output the dynamic scattering compensation matrix that fully covers the entire time period and the entire wavelength band.

[0038] The instantaneous absorbance increments corresponding to each bubble event calculated above are filled into the corresponding coordinates of the initial compensation matrix according to their accurate time of occurrence and wavelength position. Specifically, for each confirmed microbubble event, its occurrence time corresponds to one or several consecutive time indices in the original spectral time series matrix (depending on the number of sampling points occupied by the microbubble traversing the optical path).

[0039] Meanwhile, this bubble event causes varying degrees of scattering attenuation at different detection wavelengths. Therefore, it is necessary to write the instantaneous absorbance increment at the corresponding wavelength to each wavelength node under the same time index. In other words, if a bubble event occurs at the... At the nth sampling time, the initial compensation matrix is ​​at the nth sampling time. In the rows and all wavelength columns, enter the instantaneous absorbance increment values ​​calculated for each wavelength node for the bubble event.

[0040] For the remaining coordinate positions in the initial compensation matrix that were not written to by any bubble events (i.e., time points where no microbubble disturbances occurred), their element values ​​remain zero. Setting the compensation values ​​to zero at these times means that during these safe periods, the original spectral data is considered pure and requires no compensation correction.

[0041] After the above filling process, the initial compensation matrix is ​​transformed into a dynamic scattering compensation matrix that fully covers the entire time period and wavelength band. This matrix has the exact same time-wavelength dimension as the original spectral time series matrix, and has non-zero compensation values ​​at locations with bubbles and zero values ​​at locations without bubbles. It should be understood that this setting ensures that subsequent purification processing only corrects for the spatiotemporal regions where bubbles actually appear, thereby preserving the integrity of the true absorption characteristics of the water body in the original spectrum to the greatest extent. Compared with traditional methods that use fixed-window moving averages or global turbidity subtraction, the dynamic scattering compensation matrix generated in this step is sparse, accurate, and time-adaptive, avoiding unnecessary tampering with undisturbed spectral data while accurately capturing the spatiotemporal range of each bubble event.

[0042] S4. The original spectral time series matrix is ​​deconvolved and decoupled using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles, thereby obtaining pure spectral data. The pure spectral data is then input into a preset water quality model for inversion to obtain water quality detection results.

[0043] Theoretically, by directly subtracting the aforementioned dynamic scattering compensation matrix from the original spectral time series matrix, pure spectral data after removing microbubble artifacts can be obtained. However, the process of microbubbles entering and exiting the detection optical path is abrupt, meaning that the bubbles enter and exit the optical path in an extremely short time, causing the dynamic scattering compensation matrix to form steep rising and falling edges on the time axis. If a direct subtraction operation is performed, new high-frequency oscillations or numerical spikes will be generated at these abrupt boundary due to the asynchronous matching error between the original signal and the compensation matrix, which will introduce secondary artifacts and thus affect the accuracy of subsequent water quality inversion.

[0044] To address this issue, the present invention further designs a deconvolution inverse mapping decoupling process based on adaptive smoothing constraints to solve the above-mentioned technical problems, as detailed below: In some embodiments, the original spectral time series matrix is ​​deconvolved and decoupled using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles and obtain clean spectral data, including: S41, calculate the rate of change of the dynamic scattering compensation matrix in the time dimension to locate the abrupt boundary generated when the microbubble enters or exits the detection optical path, and generate the corresponding adaptive smoothing weight matrix based on the degree of abrupt change of the abrupt boundary. First, the dynamic scattering compensation matrix is ​​analyzed in the time dimension. Since each column of the dynamic scattering compensation matrix corresponds to a fixed wavelength channel, and microbubble events affect all wavelengths simultaneously, the abrupt boundary is synchronous in different wavelength channels.

[0045] Specifically, the first-order rate of change (i.e., the difference between compensation values ​​at adjacent sampling times) or the second-order rate of change of the dynamic scattering compensation matrix in the time dimension is calculated. For most moments when no bubbles occur, the compensation value is zero, and the rate of change is also zero or extremely low. However, when a microbubble enters the optical path, the compensation value jumps from zero to a large instantaneous absorbance increment, and the rate of change exhibits a positive peak with a large absolute value. Similarly, when a bubble exits the optical path, the compensation value falls back to zero from a large value, and the rate of change exhibits a negative peak with a large absolute value. By setting a rate of change threshold, the entry and exit boundaries, i.e., abrupt change boundaries, of each microbubble event can be accurately located.

[0046] After locating the abrupt change boundary, this step further generates a corresponding adaptive smoothing weight matrix based on the degree of abrupt change at the boundary. The degree of abrupt change can be quantified by the absolute value of the rate of change: the larger the absolute value of the rate of change, the steeper the boundary, and the higher the risk of computational bias after subtraction; locations with a small or zero absolute value of the rate of change indicate that the signal changes smoothly or there is no abrupt change.

[0047] The adaptive smoothing weight matrix has the same dimension as the original spectral time series matrix (number of time points × number of wavelength nodes), where each element represents the smoothing intensity of the corresponding spatiotemporal location in the subsequent deconvolution solution. Specifically, smaller smoothing weights are assigned at abrupt boundary locations (i.e., smoothing is not strictly enforced to protect the integrity of the boundary), while larger smoothing weights are assigned to the transition regions on both sides of the boundary and non-boundary regions (to suppress oscillations and spikes that may be generated by decoupling operations).

[0048] The allocation of smoothing weights can be designed as a distribution function that is symmetrical about the center of the abrupt boundary and decays exponentially with distance. This limits the scope of the smoothing constraint to a controllable time window near the boundary, thus avoiding excessive smoothing from affecting the actual absorption changes of the water body itself.

[0049] For example: Let the time index corresponding to the mutation boundary center be... The absolute time offset from the center is (In units of sampling intervals). Then the smoothing weights... It can be defined as: , in, Set the minimum smoothing weight at the center of the boundary (for example, take a small value between 0.01 and 0.1 to protect the boundary from being over-smoothed). This is the maximum smoothing weight far from the boundary (usually set to 1, indicating that a complete smoothing constraint is applied in the region without abrupt changes). The scale parameter for controlling the decay rate (can be set according to the typical number of sampling points occupied by microbubbles traversing the optical path in the flow cell, for example...) (sampling intervals). This function is in When the exponent term is 0, the weight takes its minimum value. ;along with As the exponent increases, it rapidly approaches 1, and the weights shift towards... Saturation growth.

[0050] Because it employs Gaussian exponential decay, the weighting function transitions smoothly on both sides of the boundary and is symmetric about the center. This ensures both low smoothness constraints near the abrupt boundary to protect step features and high smoothness constraints in regions far from the boundary to suppress oscillations caused by decoupling operations.

[0051] S42, using the adaptive smoothing weight matrix as a smoothing constraint term, perform deconvolution inverse mapping on the original spectral time series matrix and the dynamic scattering compensation matrix to suppress the calculation bias caused by the abrupt boundary and obtain the pure spectral data.

[0052] After obtaining the adaptive smoothing weight matrix, this step uses it as a smoothing constraint term to solve for the original spectral time series matrix and the dynamic scattering compensation matrix through deconvolution. The conventional direct subtraction can be considered a very simple decoupling method: pure spectrum = original spectrum - compensation matrix. However, as mentioned earlier, this method introduces a quadratic bias at abrupt boundary conditions.

[0053] Therefore, this embodiment constructs the decoupling process as an optimization problem with smoothing regularization: finding an optimal pure spectral data matrix such that its sum with the dynamic scattering compensation matrix approximates the original spectral matrix, while ensuring that the smoothness of the pure spectral data in the time dimension satisfies the constraints of the adaptive smoothing weight matrix.

[0054] This solution can be achieved using iterative optimization algorithms (such as gradient descent or conjugate gradient methods) or equivalently in the frequency domain by designing a Wiener filter with an adaptive cutoff frequency. It should be understood that regardless of the numerical method used, the following conditions must be met: near the abrupt boundary of microbubble occurrence, due to the severe scattering artifacts in the original signal and the high rate of change of the compensation matrix, the solution algorithm, guided by the smoothing constraint term, prioritizes the compensation value provided by the compensation matrix while using a lower smoothing weight to protect against potential real water quality abrupt changes at the boundary; in bubble-free regions, the smoothing constraint term dominates, ensuring that the decoupling process does not introduce additional noise. After the above deconvolution inverse mapping solution, pure spectral data is finally obtained.

[0055] In this purified spectral data, transient light intensity attenuation artifacts caused by microbubbles have been effectively eliminated. Meanwhile, high-frequency abrupt changes in water concentration that may occur over time (such as a rapid increase in COD due to sudden pollution discharge) are fully preserved because their rate of change differs from that of bubbles (the rate of change of abrupt water quality changes is usually much smaller than that of bubble shear, and they exhibit cross-band absorption spectral characteristics rather than scattering spectral characteristics). Finally, the purified spectral data is input into a preset water quality model for concentration inversion.

[0056] The water quality model can employ conventional modeling methods such as partial least squares, support vector regression, or deep neural networks, and is pre-trained using the spectra of standard water samples free from bubble interference and their corresponding chemical reference values. The model output is a high-precision water quality detection result free from false positive fluctuations, such as COD concentration, TOC concentration, or nitrate nitrogen concentration.

[0057] In summary, this step employs an adaptive smoothing weight matrix based on abrupt boundary localization, which serves as a constraint term in the deconvolution inverse mapping solution. This effectively suppresses the computational bias caused by direct subtraction at the bubble entry and exit boundaries, and avoids the indiscriminate erasure of real water quality abrupt changes by conventional smoothing filters. Compared to traditional physical degassing schemes, this embodiment requires no additional hardware and has no sampling lag. Compared to traditional algorithm schemes, this embodiment can accurately distinguish between transient bubble disturbances and real water quality abrupt changes, thereby effectively reducing the probability of missed water pollution detection.

[0058] like Figure 2 As shown, this embodiment of the invention also provides a water quality detection device 200 based on detection light, the device comprising: The acquisition module 10 is used to control the spectral detector to continuously acquire the detection light spectrum of the water body to be tested passing through the flow cell at a preset sampling rate, so as to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension. Extraction module 20 is used to perform continuous wavelet transform on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering; The generation module 30 is used to input the high-frequency pulse disturbance component into a preset transient scattering physical attenuation model, calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and aggregate the instantaneous absorbance increment in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The decoupling module 40 is used to perform inverse mapping decoupling on the original spectral time series matrix by deconvolution using the dynamic scattering compensation matrix, so as to remove the artifacts of transient light intensity attenuation of microbubbles, obtain pure spectral data, and input the pure spectral data into a preset water quality model for inversion to obtain water quality detection results.

[0059] In some embodiments, the preset sampling rate is greater than twice the ratio of the flow velocity of the water to be tested in the flow cell to the aperture of the optical window in the flow cell.

[0060] In some embodiments, such as Figure 3 As shown, the extraction module 20 includes: The candidate extraction submodule 201 is used to perform continuous wavelet transform on the original spectral time series matrix along the time axis using a preset wavelet basis to obtain a wavelet coefficient matrix, and extract candidate pulse components whose frequency band is in a preset high-frequency range from the wavelet coefficient matrix. The verification and confirmation submodule 202 is used to obtain the attenuation amplitude of the candidate pulse component under multiple detection wavelengths and to fit and calculate the scattering index between the attenuation amplitude and the wavelength; if the scattering index falls within the preset microbubble Mie scattering characteristic range, the candidate pulse component is determined to obey the Mie scattering wavelength dependence law and is confirmed as the high-frequency pulse disturbance component caused by the microbubble.

[0061] In some embodiments, such as Figure 4 As shown, the generation module 30 includes: The matrix initialization submodule 301 is used to obtain the time coordinate sequence and wavelength coordinate sequence of the original spectral time series matrix, and construct an initial compensation matrix that matches the dimension of the original spectral time series matrix. The aggregation assignment submodule 302 is used to write the instantaneous absorbance increment calculated at the corresponding time and wavelength node into the coordinate position corresponding to the initial compensation matrix according to the occurrence time of the high-frequency pulse disturbance component on the time coordinate sequence; and to set the element values ​​of the remaining coordinate positions in the initial compensation matrix that have not been written with the instantaneous absorbance increment to zero, so as to generate and output the dynamic scattering compensation matrix that fully covers the entire time period and the entire wavelength band.

[0062] In some embodiments, such as Figure 5 As shown, the decoupling module 40 includes: The boundary localization submodule 401 is used to calculate the rate of change of the dynamic scattering compensation matrix in the time dimension to locate the abrupt boundary generated when the microbubble enters or exits the detection optical path, and to generate a corresponding adaptive smoothing weight matrix based on the degree of abrupt change of the abrupt boundary. The constraint solving submodule 402 is used to use the adaptive smoothing weight matrix as a smoothing constraint term to perform deconvolution inverse mapping on the original spectral time series matrix and the dynamic scattering compensation matrix, so as to suppress the calculation bias caused by the abrupt boundary and obtain the pure spectral data.

[0063] The above description represents the preferred embodiments of the present invention. It should be noted that, for those skilled in the art, various improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A water quality detection method based on detection light, characterized in that, Includes the following steps: The control spectral detector continuously acquires the detection light spectrum of the water body to be tested passing through the flow cell at a preset sampling rate to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension; A continuous wavelet transform is performed on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering. The high-frequency pulse disturbance component is input into a preset transient scattering physical attenuation model to calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and the instantaneous absorbance increment is aggregated in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The original spectral time series matrix is ​​deconvolved and decoupled using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles, thereby obtaining pure spectral data. The pure spectral data is then input into a preset water quality model for inversion to obtain water quality detection results. Perform a continuous wavelet transform along the time axis on the original spectral time series matrix to extract high-frequency pulse perturbation components caused by microbubbles, whose attenuation amplitude follows the Mie scattering wavelength dependence law, including: The original spectral time series matrix is ​​subjected to continuous wavelet transform along the time axis using a preset wavelet basis to obtain a wavelet coefficient matrix, and candidate pulse components with frequency bands within a preset high-frequency range are extracted from the wavelet coefficient matrix. The attenuation amplitude of the candidate pulse component at multiple detection wavelengths is obtained, and the scattering index between the attenuation amplitude and the wavelength is calculated by fitting. If the scattering index falls within the preset microbubble Mie scattering characteristic range, the candidate pulse component is determined to obey the Mie scattering wavelength dependence law and is identified as the high-frequency pulse disturbance component caused by the microbubble. The instantaneous absorbance increment is aggregated along the time and wavelength dimensions to generate a dynamic scattering compensation matrix, including: Obtain the time coordinate sequence and wavelength coordinate sequence of the original spectral time series matrix, and construct an initial compensation matrix that matches the dimension of the original spectral time series matrix; Based on the occurrence time of the high-frequency pulse disturbance component on the time coordinate sequence, the instantaneous absorbance increment at the corresponding time and wavelength node is calculated and written into the coordinate position corresponding to the initial compensation matrix; and the element values ​​of the remaining coordinate positions in the initial compensation matrix that have not been written into the instantaneous absorbance increment are set to zero, so as to generate and output the dynamic scattering compensation matrix that fully covers the entire time period and the entire wavelength band.

2. The water quality detection method based on detection light according to claim 1, characterized in that, The preset sampling rate is greater than twice the ratio of the flow velocity of the water to be tested in the flow cell to the detection aperture of the optical window in the flow cell.

3. The water quality detection method based on detection light according to claim 1, characterized in that, The original spectral time series matrix is ​​deconvolved and decoupled using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles and obtain clean spectral data, including: The rate of change of the dynamic scattering compensation matrix in the time dimension is calculated to locate the abrupt boundary generated when the microbubble enters or exits the detection optical path, and an adaptive smoothing weight matrix is ​​generated based on the degree of abrupt change of the abrupt boundary. The adaptive smoothing weight matrix is ​​used as a smoothing constraint term to perform deconvolution inverse mapping on the original spectral time series matrix and the dynamic scattering compensation matrix, so as to suppress the calculation bias caused by the abrupt boundary and obtain the pure spectral data.

4. A water quality testing device based on detection light, characterized in that, The device includes: The acquisition module is used to control the spectral detector to continuously acquire the detection light spectrum of the water body to be tested passing through the flow cell at a preset sampling rate, so as to obtain the original spectral time series matrix containing the time dimension and the wavelength dimension. The extraction module is used to perform continuous wavelet transform on the original spectral time series matrix along the time axis to extract the high-frequency pulse perturbation component caused by microbubbles and whose attenuation amplitude follows the wavelength dependence law of Mie scattering. The generation module is used to input the high-frequency pulse disturbance component into a preset transient scattering physical attenuation model, calculate the instantaneous absorbance increment caused by the microbubble at each wavelength node, and aggregate the instantaneous absorbance increment in the time and wavelength dimensions to generate a dynamic scattering compensation matrix. The decoupling module is used to deconvolve the original spectral time series matrix using the dynamic scattering compensation matrix to remove the transient light intensity attenuation artifacts of the microbubbles, obtain pure spectral data, and input the pure spectral data into a preset water quality model for inversion to obtain water quality detection results. The extraction module includes: The candidate extraction submodule is used to perform continuous wavelet transform on the original spectral time series matrix along the time axis using a preset wavelet basis to obtain a wavelet coefficient matrix, and extract candidate pulse components whose frequency band is in a preset high-frequency range from the wavelet coefficient matrix. The verification and confirmation submodule is used to obtain the attenuation amplitude of the candidate pulse component at multiple detection wavelengths and to fit and calculate the scattering index between the attenuation amplitude and the wavelength; if the scattering index falls within the preset microbubble Mie scattering characteristic range, the candidate pulse component is determined to obey the Mie scattering wavelength dependence law and is confirmed as the high-frequency pulse disturbance component caused by the microbubble. The generation module includes: The matrix initialization submodule is used to obtain the time coordinate sequence and wavelength coordinate sequence of the original spectral time series matrix, and construct an initial compensation matrix that matches the dimension of the original spectral time series matrix. The aggregation assignment submodule is used to write the instantaneous absorbance increment calculated at the corresponding time and wavelength node into the coordinate position corresponding to the initial compensation matrix according to the occurrence time of the high-frequency pulse disturbance component on the time coordinate sequence; and to set the element values ​​of the remaining coordinate positions in the initial compensation matrix that have not been written with the instantaneous absorbance increment to zero, so as to generate and output the dynamic scattering compensation matrix that fully covers the entire time period and the entire wavelength band.

5. A water quality detection device based on detection light according to claim 4, characterized in that, The preset sampling rate is greater than twice the ratio of the flow velocity of the water to be tested in the flow cell to the detection aperture of the optical window in the flow cell.

6. A water quality detection device based on detection light according to claim 4, characterized in that, The decoupling module includes: The boundary localization submodule is used to calculate the rate of change of the dynamic scattering compensation matrix in the time dimension to locate the abrupt boundary generated when the microbubble enters or exits the detection optical path, and to generate a corresponding adaptive smoothing weight matrix based on the degree of abrupt change of the abrupt boundary. The constraint solving submodule is used to solve the original spectral time series matrix and the dynamic scattering compensation matrix by using the adaptive smoothing weight matrix as a smoothing constraint term, so as to suppress the calculation bias caused by the abrupt boundary and obtain the pure spectral data.

Citation Information

Patent Citations

  • Turnover type steel supporting joint installation method

    CN118621798A

  • Full-spectrum water quality detection method with coupling compensation

    CN121830538A