Automatic water quality optimization device for hardness detection and water quality hardness detection method
By configuring the water quality preliminary and secondary detection components in the water quality optimization device, combining signal decoupling algorithm and sparse coding technology, real-time monitoring and dynamic adjustment of water quality hardness is achieved, and the existing devices are insufficient to adapt to dynamic changes in water quality hardness, and the water quality stability and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202510474086.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2045-04-16
AI Technical Summary
Existing water quality optimization devices lack the ability to control and dynamic optimization of the hardness of inlet and outlet water, and it is difficult to effectively deal with the dynamic changes in water quality hardness.
An automatic water quality optimization device is designed. By configuring the initial and secondary water quality inspection components in the import and export parts, combining signal decoupling algorithms and sparse coding technology, the hardness of incoming and outlets is detected in real time, and dynamically adjusting the working parameters of the optimization components through the upper machine to form a closed-loop control mechanism.
Real-time monitoring and precise adjustment of water quality hardness is achieved, the ability to adapt to dynamic water quality conditions is improved, resource waste is reduced, and the stability and compliance rate of effluent water quality are significantly improved.
Smart Images

Figure CN119985357B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of water quality detection, and particularly to an automatic water quality optimization device for hardness detection and a water quality hardness detection method. Background Art
[0002] As an important device in the field of water treatment, the main function of the water quality optimization device is to improve water quality by removing hardness ions (such as calcium ions and magnesium ions) in water. In the prior art, the water quality optimization device usually relies on a hardness detection module to monitor the water quality, and adjusts the operating parameters of the optimization component through a host computer to achieve hardness adjustment. However, in practical applications, the water quality hardness often shows dynamic changes, such as hardness fluctuations caused by different seasons, usage environments or water inlet sources, which brings certain challenges to the operation of the water quality optimization device.
[0003] For example, the Chinese patent with the authorization announcement number CN111855754B discloses a water quality hardness detection probe, a sensor, a detection method and a water softener. The sensor includes a control component, and the control component includes a processing module and a potential detection module; the detection probe includes a first probe and a second probe. When both the first probe and the second probe are in raw water, the potential difference between the first probe and the second probe is the first potential difference; when the first probe is in raw water and the second probe is in optimized water, the potential difference between the first probe and the second probe is the second potential difference; the potential detection module determines the potential difference between the first probe and the second probe; the processing module determines the water quality hardness of the optimized water according to the difference between the first potential difference and the second potential difference. The sensor of this invention can detect the water quality hardness of the water softener in real time and eliminate the test errors caused by manufacturing and the drift of the detection probe.
[0004] The above patent has the problems proposed in this background art: lack of linkage control and dynamic optimization ability for the hardness of inlet and outlet water. To solve the above problems, this application designs an automatic water quality optimization device for hardness detection and a water quality hardness detection method. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide an automatic water quality optimization device for hardness detection and a water quality hardness detection method in view of the deficiencies of the prior art. The automatic water quality optimization device is configured with a primary water quality detection component at the inlet part for detecting the hardness of the inlet water, and generates a control instruction by calculating the required working frequency through a host computer; a secondary water quality detection component is configured at the outlet part for verifying the hardness of the outlet water and feeding it back to the host computer. When the change in the hardness of the inlet water is small, the host computer dynamically adjusts the working parameters according to the hardness of the outlet water to ensure the stability of the water quality. Through a closed-loop control mechanism, the present invention links the detection of the hardness of the inlet water, the verification of the hardness of the outlet water and the adjustment of the working parameters, improves the adaptability of the device to dynamic water quality conditions, and reduces resource waste.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] An automatic water quality optimization device for hardness detection, the automatic water quality optimization device comprising:
[0008] The device main body, including an imported water channel to be measured;
[0009] A primary water quality detection component, arranged at the inlet of the imported water channel to be measured, separating the response matrix of calcium and magnesium ions by combining a signal decoupling algorithm, calculating the concentrations of calcium ions and magnesium ions in the water body according to the response matrix, and calculating the incoming water hardness according to the concentrations;
[0010] Wherein the separation of the response matrix of calcium and magnesium ions by combining the signal decoupling algorithm includes converting spectral information into a spectral feature matrix, performing dimensionality reduction on the spectral feature matrix, calculating a calcium ion response matrix and a magnesium ion response matrix, and the dimensionality reduction is used to perform sparse coding on the intensity data and then replace the remaining data;
[0011] A secondary water quality detection component, arranged at the outlet of the imported water channel to be measured, for detecting the outgoing water hardness at the outlet;
[0012] A host computer, outputting a control instruction in response to the incoming water hardness and the outgoing water hardness detected by the primary water quality detection component and the secondary water quality detection component;
[0013] An optimization component, configured in the imported water channel to be measured, adjusting the working parameters in response to the control instruction.
[0014] The primary water quality detection component includes:
[0015] A light source component, for emitting laser light with a specific wavelength to the water body at the inlet multiple times, wherein the laser light represents detection light with different wavelengths;
[0016] A spectral detection component, arranged on the receiving path of the light source component, for collecting the spectral characteristics of calcium ions and magnesium ions in the water body;
[0017] A calculation component, connected to the spectral detection component, calculating the concentrations of calcium ions and magnesium ions in the water body according to the spectral characteristics, and calculating the incoming water hardness according to the concentrations;
[0018] A first import component, for importing the incoming water hardness to the host computer.
[0019] The spectral detection component is configured with a spectral acquisition logic, and the spectral acquisition logic includes:
[0020] Extracting multiple segments of spectral information from the receiving path of the light source component and calibrating the multiple segments of spectral information;
[0021] According to the calibrated multi-segment spectral information, using the Raman band and Raman intensity of the light source assembly as the two-dimensional transformation reference, transform the multi-segment spectral information into a spectral feature matrix;
[0022] According to principal component analysis, using the main distribution bands of calcium ions and magnesium ions as the first spectral peak and the second spectral peak of the principal component analysis, perform dimensionality reduction on the spectral feature matrix according to the first spectral peak and the second spectral peak, and calculate the calcium ion response matrix and the magnesium ion response matrix, where the dimensionality reduction is used to perform sparse coding on the intensity data in the first spectral peak and the second spectral peak respectively and then replace the remaining data of the spectral feature matrix.
[0023] Calculate spectral features according to the peak intensities, band areas, and full-width at half-maximum of the calcium ion response matrix and the magnesium ion response matrix, and according to the band coupling relationship between calcium ions and magnesium ions.
[0024] Performing dimensionality reduction on the spectral feature matrix according to the first spectral peak and the second spectral peak, and calculating the calcium ion response matrix and the magnesium ion response matrix, includes:
[0025] Respectively remove the first spectral peak and the second spectral peak from the spectral feature matrix to obtain the calcium ion initial response matrix and the magnesium ion initial response matrix;
[0026] Perform sparse coding processing on the calcium ion initial response matrix and the magnesium ion initial response matrix, where the dictionary elements of the sparse coding are defined by the corresponding spectral feature peaks, and represent the data of the calcium ion initial response matrix and the magnesium ion initial response matrix as a linear combination of the dictionary elements through sparse coding;
[0027] Screen the coding results and retain the band data with coding coefficients greater than or equal to a preset coding threshold;
[0028] Perform impurity removal on the retained linear combination through gradient optimization to obtain the calcium ion optimized response matrix and the magnesium ion optimized response matrix;
[0029] Add the first spectral peak and the second spectral peak to the calcium ion optimized response matrix and the magnesium ion optimized response matrix respectively to generate the calcium ion response matrix and the magnesium ion response matrix.
[0030] A preset spectral model is configured in the calculation component. By inputting the spectral features and the corresponding response matrix into the spectral model, the concentrations of calcium ions and magnesium ions are output by the spectral model. The spectral model includes:
[0031] An input layer, which is used to perform deconstruction processing on input parameters to generate a global feature vector and a local signal change trend. Among them, the input layer includes a spectral feature processing branch and a response matrix processing branch;
[0032] A concentration evaluation layer that constructs a comprehensive feature space through a feature selection mechanism and calculates the concentration values of calcium ions and magnesium ions based on the comprehensive feature space;
[0033] An output layer that corrects the output of the concentration evaluation layer according to a preset concentration standard.
[0034] The concentration evaluation layer includes:
[0035] Generate preliminary concentration values of calcium ions and magnesium ions through global features;
[0036] Refine the preliminary concentration values according to the local signal change trend.
[0037] The water quality secondary detection component includes:
[0038] A concentration detection component is provided at the outlet of the water to be tested import channel, measures the effluent water through spectral analysis, and obtains the water hardness of the effluent;
[0039] A second import component for importing the water hardness of the effluent into the host computer.
[0040] The host computer includes:
[0041] A collection component is connected to the first import component and the second import component, and receives the incoming water hardness and the effluent water hardness;
[0042] A regeneration component is connected to the collection component, and calculates the working parameters of the optimization component according to the received incoming water hardness and effluent water hardness;
[0043] A control component is connected to the regeneration component, and generates a control instruction according to the output of the regeneration component.
[0044] The host computer further includes:
[0045] An effluent water hardness analysis component is used to compare the effluent water hardness with a hardness set value. If it is less than or equal to the hardness set value, no operation is performed. If it is greater than the hardness set value, the effluent water hardness is imported into the regeneration component.
[0046] An abnormality analysis component analyzes the cause of the abnormality and generates an optimization plan when the effluent water hardness is greater than the hardness set value.
[0047] A method for detecting water hardness, the method includes:
[0048] Detect the incoming water hardness at the inlet and import the incoming water hardness into the host computer;
[0049] The host computer calculates the initial operating frequency of the optimization component based on the incoming water hardness, generates a control instruction and imports it into the optimization component;
[0050] Detect the hardness of the outgoing water at the outlet and transmit the hardness of the outgoing water back to the host computer;
[0051] The host computer determines whether the hardness of the outgoing water is less than or equal to the set hardness value. If it is less than or equal to the set hardness value, the current operating parameters are maintained;
[0052] If it is greater than the set hardness value, a new control instruction is generated and imported into the optimization component;
[0053] During the processing of the automatic water quality optimization device, continuously detect the real-time incoming water hardness and adjust the operating frequency according to the real-time incoming water hardness.
[0054] Compared with the prior art, the beneficial effects of the present invention are:
[0055] 1. By converting the light scattering information into a spectral matrix and combining the signal decoupling algorithm for dimensionality reduction and sparse coding, the present invention can accurately calculate the concentration of calcium and magnesium ions in water and reduce the calculation complexity, thereby efficiently detecting the water quality hardness;
[0056] 2. The present invention uses the water quality secondary detection component to verify the hardness of the outgoing water in real time. When the hardness of the outgoing water does not meet the standard, the host computer feeds back and adjusts the operating parameters of the optimization component to quickly correct the abnormal water quality, significantly improving the stability and compliance rate of the outgoing water quality, and realizing the linkage control of the hardness of the incoming and outgoing water. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, objects and advantages of the present invention will become more apparent:
[0058] Figure 1 It is a schematic structural diagram of the automatic water quality optimization device for hardness detection in Embodiment 1 of the present invention;
[0059] Figure 2 It is a schematic diagram of matrix conversion in Embodiment 1 of the present invention;
[0060] Figure 3 It is a schematic diagram of the first principle of matrix dimensionality reduction in Embodiment 1 of the present invention;
[0061] Figure 4 It is a schematic diagram of the second principle of matrix dimensionality reduction in Embodiment 1 of the present invention;
[0062] Figure 5 It is a schematic diagram of the third principle of matrix dimensionality reduction in Embodiment 1 of the present invention;
[0063] Figure 6This is a flowchart of a water quality hardness detection method according to Embodiment 2 of the present invention. Detailed implementation manners
[0064] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0065] Embodiment 1
[0066] Please refer to Figure 1 , an embodiment provided by the present invention: an automatic water quality optimization device for hardness detection, where the dotted line indicates the data flow direction. The automatic water quality optimization device aims to solve the problems of unstable optimization efficiency, inaccurate water quality hardness detection, and adjustment hysteresis in the prior art. Through the introduction of inlet and outlet water hardness detection, the dynamic control logic of the upper computer, and the design of efficient optimization components, this embodiment realizes the real-time monitoring and precise adjustment of water quality hardness, ensuring the stability of the optimized water quality and the system operation efficiency. The automatic water quality optimization device includes:
[0067] The device main body, including a to-be-detected water introduction channel, the inlet part of the to-be-detected water introduction channel forms the inlet of the device main body, and the outlet part of the to-be-detected water introduction channel forms the outlet of the device main body;
[0068] In this embodiment, the layout and material design of the to-be-detected water introduction channel are optimized to ensure smooth water flow and that the hardness detection result is not interfered by the deposits on the inner wall of the pipeline. In addition, the structural design of the inlet and outlet considers the standardized interface form, which is convenient for integration with different water source systems.
[0069] The primary water quality detection component, which is arranged at the inlet part of the to-be-detected water introduction channel, is used to detect the water quality hardness of the water entering at the inlet;
[0070] In this embodiment, the primary water quality detection component adopts spectral analysis technology. By combining the light source component and the spectral detection component, it accurately identifies the concentration of calcium and magnesium ions in the water and generates the inlet water hardness value according to the spectral characteristics. This detection method not only has high sensitivity but also can adapt to the dynamic changes of water quality, providing accurate input for the frequency modulation of the upper computer.
[0071] The secondary water quality detection component, which is arranged at the outlet part of the to-be-detected water introduction channel, is used to detect the water quality hardness of the water flowing out at the outlet;
[0072] In this embodiment, the water quality secondary detection component adopts a combination of a conductivity sensing component and a concentration detection component. By monitoring the change in conductivity, the concentration of total dissolved solids is calculated, and then the water hardness value is estimated by combining a specific algorithm. During the water outlet stage, the treatment effect of the optimization component is quickly verified, enabling the timely detection of water hardness deviation and the adjustment of the operating state, thereby improving the water quality compliance rate.
[0073] Specifically, the water quality secondary detection component is located at the outlet. The water hardness has been significantly reduced and the fluctuation range is small, so complex spectroscopic analysis techniques are not required. Compared with the inlet detection, the core of the outlet detection lies in quickly verifying the treatment effect. Selecting the combination of the conductivity sensing component and the concentration detection component can meet the accuracy requirements and has a higher response speed.
[0074] The host computer outputs a control instruction in response to the water quality hardness detected by the water quality initial inspection component and the water quality secondary detection component;
[0075] The optimization component is configured in the water to be tested introduction channel and adjusts the working parameters in response to the control instruction.
[0076] The optimization component uses high-efficiency ion exchange resin, which can remove calcium and magnesium ions in water in a short time and optimize the treatment efficiency by adjusting the working parameters. The response speed of the optimization component has been optimized to quickly adapt to the dynamic adjustment instructions of the host computer, thereby ensuring that even when the inlet water hardness fluctuates greatly, the outlet water hardness remains stable within the target range.
[0077] Specifically, in this embodiment, by configuring the water quality initial inspection component at the inlet of the device main body and the water quality secondary detection component at the outlet, the real-time detection and verification of the inlet water hardness and the outlet water hardness are realized. At the same time, combined with the dynamic working parameter adjustment logic of the host computer, a closed-loop control mechanism is formed. At present, there are relatively complete double detection modules for the inlet and outlet water hardness in the existing technologies, but these solutions are usually just simple detection behaviors and do not form a complete dynamic adjustment and feedback closed-loop mechanism, resulting in the change of the inlet water hardness not being directly and timely reflected in the adjustment of the operating parameters of the optimization component, lacking flexibility; in addition, the verification result of the outlet water hardness is usually only recorded and not linked with the host computer logic, and the operating parameters of the optimization component cannot be effectively optimized when the outlet water hardness does not meet the standard.
[0078] Exemplarily, in practical applications, when the incoming water hardness increases from 90 ppm to 180 ppm, existing products usually have a high outgoing water hardness due to the lag in adjusting working parameters, and since there is no feedback closed-loop, even if the outgoing water hardness exceeds the standard, the operating state cannot be further optimized. In this embodiment, the water quality initial inspection component senses the change in incoming water hardness in real time, and the host computer adjusts and optimizes the working parameters of the component to adapt to the new hardness level, so that the outgoing water hardness is controlled within the target range. If the adjusted outgoing water hardness still does not meet the standard, the water quality secondary detection component feeds back the detection result to the host computer, and the host computer can further optimize the operating parameters, such as increasing the working parameter output or starting the regeneration mode, ultimately ensuring that the outgoing water quality meets the set standard.
[0079] Specifically, the method of the water quality initial inspection component of the automatic water quality optimization device in this embodiment for emitting laser multiple times is applicable to the detection of real-time flowing water bodies. Since the concentration of calcium and magnesium ions in the water flow may change within a period of time, a single measurement cannot fully reflect the dynamic concentration in the water body. Therefore, by emitting laser multiple times and continuously collecting spectral information, the change in the concentration of calcium and magnesium ions in the water body can be monitored in real time, ensuring that the water quality optimization process can be adjusted according to the changing concentration data.
[0080] The water quality initial inspection component includes:
[0081] A light source component for emitting laser with a specific wavelength multiple times to the water body at the inlet, where the laser represents detection light of different wavelengths;
[0082] In this embodiment, the light source component uses laser for water quality hardness detection. Currently, fluorescence spectroscopy technology is usually used in water quality hardness detection schemes based on spectral analysis. Although fluorescence spectroscopy technology has high sensitivity and detection efficiency in industrial detection scenarios, since the fluorescence light source may pose potential safety hazards to the human eye or skin, it is not applicable in the design of devices for household or small commercial scenarios. Therefore, this embodiment has made improvements in the light source selection. The laser light source adopted has strict working parameter limitations and safety designs, meeting the international laser product safety standards, ensuring that the water quality optimization device will not cause safety hazards even if directly exposed to the human eye or skin during daily use. At the same time, the emission wavelength and working parameters of the laser light source have been designed and optimized to provide stable and reliable spectral signals without sacrificing detection accuracy.
[0083] Specifically, it is preferred to use a highly stable laser with a wavelength of 532 nm or 785 nm to emit a specific wavelength, so as to excite the Raman scattering signals of calcium ions and magnesium ions in the water body. The laser light source with a specific wavelength can accurately excite the molecular vibration modes of the target ions, thereby extracting the corresponding Raman scattering characteristic signals. In addition, since the intensity of the Raman scattering signal is directly related to the choice of the laser wavelength, for the characteristic Raman peaks of calcium ions and magnesium ions, choosing a wavelength of 532 nm or 785 nm can obtain the best signal intensity and resolution. During the detection process, the high stability and narrow bandwidth of the light source ensure the integrity of the target Raman signal, while reducing instrument noise and external interference.
[0084] A spectral detection component, arranged on the receiving path of the light source component, for collecting the spectral characteristics of calcium ions and magnesium ions in the water body;
[0085] A calculation component, connected to the spectral detection component, calculating the concentrations of calcium ions and magnesium ions in the water body according to the spectral characteristics, and calculating the incoming water hardness according to the concentrations;
[0086] A first import component, for importing the incoming water hardness into the host computer.
[0087] In this embodiment, the first import component adopts a high-speed digital import interface, combined with real-time data verification technology, to ensure that the hardness data can be stably imported in a complex environment. The first import component also has a data caching function. When the signal import is interfered by the outside world, it can save the latest set of data for the automatic water quality optimization device to continue running after recovery.
[0088] The spectral detection component is configured with spectral acquisition logic, and the spectral acquisition logic includes:
[0089] Extracting multiple segments of spectral information from the receiving path of the light source component and calibrating the multiple segments of spectral information;
[0090] Specifically, the calibration process eliminates the errors introduced by ambient light, device noise or measurement angle changes by adjusting the wavelength and intensity parameters of the light source emission, ensuring that the collected spectral data can truly reflect the characteristic signals of the ions in the water body. The specific calibration method can be compared with a multi-point light source reference sample to dynamically adjust the spectral intensity curve to form a consistent and standardized data baseline.
[0091] According to the calibrated spectral information, taking the Raman band and Raman intensity of the light source component as the two-dimensional transformation reference, converting the spectral information into a spectral characteristic matrix;
[0092] In this embodiment, the spectral information comes from the Raman scattered light generated by the interaction between the laser emitted by the light source component and calcium ions and magnesium ions in the water body, and already contains the wavelength and the corresponding intensity value;
[0093] Specifically, the Raman band refers to the spectral characteristics in a specific wavelength range formed through the Raman scattering effect during spectral detection, which reflects the changes in the vibrational and rotational energy levels of solute molecules in water. This change has a high degree of molecular selectivity and can accurately identify the unique spectral peaks of solute molecules (such as calcium ions and magnesium ions). The characteristics of the Raman band enable reliable detection of the presence state of specific molecules or ions even under complex background light signals.
[0094] The Raman intensity refers to the intensity of the scattered light observed in the Raman band, which is directly related to the concentrations of calcium ions and magnesium ions in the water body. The higher the intensity of the scattered light, the higher the concentration of the target molecules usually indicates. Therefore, as an important parameter for quantifying the concentration of the target substance, the Raman intensity is widely used in the hardness detection process to establish the corresponding relationship between the concentration and the band response. By extracting the changes in the Raman intensity, the specific concentrations of calcium ions and magnesium ions in the water body can be effectively estimated, thus providing accurate data support for hardness calculation.
[0095] In this embodiment, the specific implementation method of the two-dimensional transformation reference is to use a specific wavelength range in the water body (i.e., the Raman band) as the abscissa of the matrix, and the light intensity signal corresponding to the band (i.e., the Raman intensity) as the ordinate of the matrix to form a two-dimensional matrix structure. Through this transformation, each matrix component (i.e., a point in the two-dimensional space) corresponds to a specific wavelength range and intensity value. The role of this two-dimensional transformation is to expand the spectral data from a one-dimensional wavelength sequence into a two-dimensional data structure containing more information, thereby more intuitively revealing the spectral characteristics and concentration distribution of calcium and magnesium ions in multiple measurements.
[0096] During the conversion process, the time series and wavelength signals of the spectral data are mapped into the two-dimensional matrix space, and each matrix component corresponds to a specific wavelength range and intensity level. This conversion method based on the Raman signal can perform partition processing on the ion response characteristics of specific wavelengths, improve the recognition ability of calcium and magnesium ion signals, and reduce the coupling interference with the background light signal. It can effectively cope with the interference of various complex solutes in the water body and ensure that the spectral feature matrix can highlight the response characteristics of calcium and magnesium ions.
[0097] Please refer to Figure 2 , the schematic diagram of matrix conversion in the embodiment of the present invention, which converts the one-dimensional sequence into a 1 N feature matrix, where X1, X2, and XN represent the Raman intensities corresponding to multiple Raman bands, and continue to convert according to the remaining measured one-dimensional sequence, and finally obtain an M N spectral feature matrix, where M represents the number of measurements, and N represents the total number of bands;
[0098] Please refer to Figure 3 , Figure 4 andFigure 5 , when the matrix dimensionality reduction is performed in the embodiments of the present invention, the response matrices of calcium ions and magnesium ions are extracted by processing Raman spectral data, sparse coding, and optimizing spectral features. The generation process of the calcium ion response matrix is mainly shown in the figure. First, Figure 3 the main distribution bands of calcium ions and magnesium ions (i.e., the first spectral peak and the second spectral peak) are obtained, and they are combined with other band data to form a spectral feature matrix. Second, Figure 4 the spectral data is processed and optimized by sparse coding to obtain a sparse coefficient matrix. In this stage, the spectral data is processed by sparse coding, and the dictionary elements of the sparse coding are defined by the first spectral peak and the second spectral peak. Finally, Figure 5 the optimization steps of gradient optimization and retaining linear combination are shown. Through gradient optimization, further impurity removal is performed on the retained linear combination (i.e., the result after sparse coding). Both band data X and band data Y represent the band data after gradient optimization.
[0099] Specifically, by using the characteristic peaks of calcium ions and magnesium ions as the dictionary elements of sparse coding, the response signals of the two ions are separated from the complex spectral data. By comparing and optimizing the gradient change of the spectral peak with the gradient in the response matrix through gradient optimization, it is ensured that the optimized matrix accurately reflects the ion concentration change.
[0100] According to principal component analysis, taking the main distribution bands of calcium ions and magnesium ions as the first spectral peak and the second spectral peak of the principal component analysis, the spectral feature matrix is dimensionally reduced according to the first spectral peak and the second spectral peak, and the calcium ion response matrix and the magnesium ion response matrix are calculated, where the dimensionality reduction is used to respectively perform sparse coding on the intensity data in the first spectral peak and the second spectral peak and then replace the remaining data of the spectral feature matrix, so as to obtain a matrix with higher response degrees of calcium ions and magnesium ions;
[0101] In this embodiment, regarding how to perform dimensionality reduction of the spectral feature matrix through the first spectral peak and the second spectral peak and replace the inferior data therein by sparse coding, it is first necessary to clarify that the first spectral peak and the second spectral peak represent the main response bands of calcium ions and magnesium ions. These two bands are the most sensitive to the change of ion concentration and contain the most significant characteristic information. However, in actual spectral data, other bands in the spectral matrix may also contain the response signals of calcium ions and magnesium ions, but usually these signals are weak and are easily interfered by impurities. If the band data is directly removed, there will still be calcium and magnesium ions remaining, and if the remaining band data is not processed, resource overflow will occur.
[0102] Specifically, when processing spectral data, it is necessary to extract the bands most relevant to the concentrations of calcium ions and magnesium ions from the original spectral feature matrix through principal component analysis, thereby obtaining two initial response matrices (corresponding to calcium ions and magnesium ions, respectively). It should be noted that since the spectral matrix contains not only the response bands of calcium ions and magnesium ions, but also other impurities or interfering bands, simply removing the bands that are not relevant to the first and second spectral peaks does not mean that the data is completely free of deviation. Even if some bands are eliminated, calcium and magnesium ion signals may still exist in other bands, especially when the signal intensity is weak, which will still affect the final response matrix.
[0103] Furthermore, the first spectral peak and the second spectral peak are used as primitives for sparse coding, that is, the characteristic band intensity data is used as the most reliable primitive for encoding processing, and information related to calcium ions is extracted from the responses of other bands, while those irrelevant impurity signals are effectively removed.
[0104] Furthermore, for the primitives and the sparsely encoded matrices, the set threshold is used for screening to retain those bands with significant responses, while the band data with weak signal strength and irrelevant are eliminated.
[0105] The spectral feature matrix is reduced in dimension according to the first spectral peak and the second spectral peak, and a calcium ion response matrix and a magnesium ion response matrix are calculated, including:
[0106] Eliminate the first spectral peak and the second spectral peak from the spectral feature matrix respectively to obtain a calcium ion initial response matrix and a magnesium ion initial response matrix;
[0107] In this embodiment, the first spectral peak represents the strongest response band of calcium ions in the spectrum, and the second spectral peak is the most representative band corresponding to magnesium ions. These two peaks usually contain the most obvious calcium and magnesium ion concentration information, and the band data corresponding to these two spectral peaks are removed from the spectral feature matrix. Thereby, the remaining band data are processed intensively, and the signal in the spectral matrix is adjusted to be more focused on the response data of calcium and magnesium ions. The initial response matrix still contains interference signals from other ions and impurities in the water sample, but they remove the bands that overlap with the characteristic peaks of calcium and magnesium ions, and can focus on the data of other related bands in the subsequent processing process.
[0108] Performing sparse coding processing on the calcium ion initial response matrix and the magnesium ion initial response matrix, wherein the dictionary elements of the sparse coding are defined by corresponding spectral characteristic peaks, and representing the data of the initial response matrix as a linear combination of the dictionary elements through sparse coding;
[0109] In this embodiment, the basic idea of sparse coding is to represent each signal data point as a linear combination of fewer basis elements. Here, the basis elements are the characteristic peaks of calcium ions and magnesium ions, which are defined by the first spectral peak and the second spectral peak respectively. During the sparse coding process, signals in other bands in the matrix, especially noise components, will be compressed into small coefficients in the sparse matrix. In this way, the signal representation will become more concise, and at the same time, interference from other solutes and impurities can be effectively reduced.
[0110] Specifically, since each response matrix is a two-dimensional matrix, where each row represents the response signal of a different band at different time points, sparse coding is performed on each row (i.e., the spectral response signal of each band) separately. The dictionary elements of sparse coding are defined by the characteristics of the first spectral peak and the second spectral peak. Because these two spectral peaks contain the strongest response signals of calcium ions and magnesium ions, their intensities and morphologies can represent the basis elements of the signal as dictionary elements.
[0111] Furthermore, sparse coding calculates the similarity between each basis element in the dictionary and the data in that row, and assigns a coefficient (usually non-negative) to each basis element, so that the weighted sum of these basis elements can reconstruct the corresponding dictionary element of that row as accurately as possible.
[0112] Preferably, during the sparse coding process, a sparsity constraint can be adopted, that is, the coefficients of the dictionary elements are restricted, so that in the representation of each row, only the coefficients of a few dictionary elements are non-zero. Only the most representative basis elements will be retained in the final coding.
[0113] Finally, sparse coding will output a set of sparse coefficient matrices. Each row corresponds to the data of a band in the calcium ion and magnesium ion response matrices, and each column corresponds to the coefficient of a basis element in the dictionary. In this way, the complex data in the original response matrix is converted into a weighted linear combination of dictionary elements, where most of the coefficients are zero or close to zero, and only the bands that can best represent the target ion signals are retained.
[0114] Screen the coding results and retain the band data whose coding coefficients are greater than or equal to a preset coding threshold;
[0115] In this embodiment, after sparse coding processing, each band in the response matrix will be assigned a coding coefficient. The magnitude of the coding coefficient represents the correlation between that band and the dictionary basis elements (i.e., the first spectral peak or the second spectral peak). The purpose of the screening operation is to remove those bands with low correlation with the target signals (calcium ions and magnesium ions).
[0116] Specifically, according to the sparse coefficient matrix, if the sparse coefficient of a certain band is lower than the preset coding threshold, it is considered that this band makes a small contribution to the final response matrix, so it can be removed.
[0117] Impurity elimination is performed on the retained linear combination through gradient optimization to obtain a calcium ion optimized response matrix and a magnesium ion optimized response matrix;
[0118] In this embodiment, gradient optimization does not simply operate on the entire matrix, but optimizes the bands related to the first spectral peak and the second spectral peak (i.e., the columns of these characteristic bands). Ensure that the gradient change of each band in the response matrix is consistent with the concentration change of the target ions (calcium ions and magnesium ions).
[0119] Specifically, for the retained band data in the calcium ion and magnesium ion response matrices, the gradient change of each band is calculated, and the gradient is compared with the column gradient of the first spectral peak (the gradient of the calcium ion characteristic band) and the column gradient of the second spectral peak (the gradient of the magnesium ion characteristic band). The gradient represents the sensitivity of each band to the concentration change, that is, the rate at which the intensity of the band changes at different concentration values. In an ideal situation, the spectral characteristic bands of calcium ions and magnesium ions should be highly positively correlated with the gradient of the concentration change.
[0120] Furthermore, the gradient optimization algorithm adjusts the weights of the retained bands in the response matrix according to the correlation between the gradients. Specifically, the optimization process strengthens the gradients of the bands related to the first spectral peak and the second spectral peak, and reduces the gradient influence of the impurity bands whose gradient changes do not meet the expectations. For example, if the gradient change of a certain band is negatively correlated or uncorrelated with the gradient change of the first spectral peak, it indicates that this band may contain impurity components, and the influence of this band will be reduced during the optimization process to gradually remove the impurities.
[0121] Add the first spectral peak and the second spectral peak to the calcium ion optimized response matrix and the magnesium ion optimized response matrix respectively to generate a calcium ion response matrix and a magnesium ion response matrix.
[0122] Calculate the spectral characteristics according to the peak intensity, band area, and full width at half maximum of the response matrix, and according to the band coupling relationship between calcium ions and magnesium ions;
[0123] Specifically, according to the peak intensity, band area, and full width at half maximum of the calcium and magnesium ion bands in the spectral matrix, comprehensively evaluate the integrity and amplitude size of the characteristic signal. Further, the coupling relationship between the calcium and magnesium ion bands is used to correct the result to eliminate possible signal superposition or cross-interference. For example, in the overlapping region of the spectral peaks of calcium ions and magnesium ions, by combining the response intensity ratio and wavelength difference of the two, ensure that the calculated band signal can truly reflect the actual contribution value of each ion.
[0124] Precise calculation of calcium and magnesium ion concentrations is achieved through the branch processing, feature fusion, concentration evaluation, and output correction of spectral features and response matrices. A preset spectral model is configured within the calculation component. By inputting the spectral features and the corresponding response matrices into the spectral model, the concentrations of calcium ions and magnesium ions are output by the spectral model. The spectral model includes:
[0125] An input layer for deconstructing input parameters to generate a global feature vector and a local signal change trend. Among them, the input layer includes a spectral feature processing branch and a response matrix processing branch;
[0126] Specifically, the spectral feature processing branch processes spectral features through a one-dimensional convolutional kernel to extract global features in spectral data. The one-dimensional convolutional kernel can capture key features of spectral signals, such as peak intensity, peak width, band area, etc. These features are the basis for calculating calcium and magnesium ion concentrations in hardness detection. Through the way of layer-by-layer convolution, starting from low-level features, higher-level global feature representations can be gradually constructed. Each layer of convolution operation filters the spectral signal, extracts the main information within a specific frequency range, and reduces the interference of noise at the same time, enabling the model to focus on the key spectral features related to calcium and magnesium ions.
[0127] Furthermore, the one-dimensional convolutional kernel includes multiple layers of convolutional kernels. The first layer of convolutional kernel is mainly used to capture the local change trend of spectral signals, such as the peak position and the initial intensity distribution; the second layer of convolutional kernel extracts frequency patterns based on the output of the previous layer to identify weak signal coupling or the influence of stray light; the third layer and subsequent convolutional kernels further integrate low-level features to form a global representation of the entire spectral signal. After each layer of convolution operation, a non-linear activation function is combined to enhance the expression ability of the model. At the same time, the data dimension is reduced through pooling operations, reducing the computational complexity and improving the robustness of features.
[0128] Specifically, the response matrix processing branch is used to handle local signal coupling problems, and extracts local dynamic characteristics through band-by-band analysis, including the interference characteristics and coupling characteristics of calcium ions and magnesium ions in specific bands. Through the individual analysis of each band, the change of intensity distribution and its characteristic pattern within different wavelength ranges can be captured, so as to distinguish the overlapping signals between calcium ions and magnesium ions and accurately identify the characteristic bands of each ion.
[0129] In this embodiment, first, the response matrix is divided according to a preset wavelength range. Each sub-band region represents a specific spectral characteristic region, such as the absorption peak ranges of calcium ions and magnesium ions. For each sub-band region, local features are initially extracted by calculating the intensity change trend, peak distribution, and signal concentration within the region. Subsequently, to further address signal interference and coupling issues, a weight matrix is established between the sub-band regions. This weight matrix is dynamically adjusted according to the signal correlation between the bands, ensuring that higher weights are assigned to key bands in high-coupling regions, while weakening the influence of interference signals in low-correlation regions. Further, to solve the problem of dynamic changes in local signals, the response matrix processing branch also incorporates a sliding window technique. By performing statistical analysis on consecutive band regions using a moving window, the change trend of local signals and the subtle movement of peak positions are captured. For example, when the calcium and magnesium ion signals overlap in a high-hardness environment, the sliding window technique can effectively identify specific regions of interference and dynamically adjust the weights of key features based on the intensity change rate within the region, ensuring that the output local features have high precision and robustness.
[0130] A concentration evaluation layer constructs a comprehensive feature space through a feature selection mechanism and calculates the concentration values of calcium ions and magnesium ions based on the comprehensive feature space;
[0131] Specifically, the construction of the comprehensive feature space is a link for efficiently integrating input features, aiming to extract the most important information for concentration calculation from the input data while eliminating redundant features and noise interference. All input features are scored through a feature evaluation algorithm to evaluate their contribution to concentration evaluation. Features with higher contribution degrees will be assigned higher weights. For example, the peak intensity in spectral features is more important for calcium ion concentration evaluation, while the signal interference characteristics in the response matrix may be more sensitive to magnesium ion concentration. After evaluating the weights, dimensionality reduction processing is performed on the input features to eliminate low-correlation features or redundant information that duplicates other features. This reduces the computational complexity and avoids the influence of noise interference on concentration calculation.
[0132] Furthermore, the feature evaluation algorithm determines the importance of each feature by calculating the correlation between the feature and the calcium and magnesium ion concentrations. Specifically, a correlation coefficient-based evaluation method is adopted to calculate the linear or non-linear correlation between each feature and the target concentration. For example, the correlation between peak intensity and calcium ion concentration is relatively high, while the width of the band intensity is more sensitive to magnesium ion concentration. The features are initially sorted according to the magnitude of the correlation coefficient, and the high-correlation features are marked as priority features.
[0133] The concentration evaluation layer includes:
[0134] Generate preliminary concentration values of calcium ions and magnesium ions through global features;
[0135] The calculation formula for the preliminary concentration value is as follows:
[0136] ;
[0137] wherein, represents the preliminary concentration value, represents a single linear relationship feature in the global feature, represents the total number of linear relationship features, represents the linear mapping function in the regression model, represents the i-th linear relationship feature, represents the linear parameter corresponding to the i-th linear relationship feature, represents the non-linear function in the regression model, j represents a single non-linear relationship feature in the global feature, and M represents the total number of non-linear relationship features, represents the j-th non-linear relationship feature, represents the non-linear parameter corresponding to the j-th non-linear relationship feature.
[0138] The generation of the preliminary concentration value is realized based on the regression model of the calibration curve. This model takes the global features in the comprehensive feature space as input and outputs the preliminary calcium ion and magnesium ion concentration values according to the known relationship between the spectral features and the concentration (such as the linear or non-linear mapping relationship calibrated by experiments).
[0139] Exemplarily, the linear relationship between the peak intensity and the ion concentration , wherein, represents the ion concentration, and represent the linear parameters determined by experiments in the calibration curve, represents the peak intensity, the non-linear relationship between the band area and the ion concentration (mainly showing an exponential relationship), , wherein, and represent the non-linear coefficients calibrated by experiments, represents the band area, exponential function, the data adopted by the regression model can be from the experimental calibration data set, which can be obtained by those skilled in the art through a large number of experiments to ensure the accuracy of the mapping relationship.
[0140] Refine the preliminary concentration value according to the local signal change trend.
[0141] Analyze the rate of change of intensity within a specific wavelength band, and extract the signal gradient of the peak and its adjacent region. For example, the signal intensity gradient of the calcium and magnesium ion absorption peaks can reveal whether the spectral signal is interfered with or overlapped. Compare the peak positions in the calibration data with the actual peak positions of the real-time spectral signal to detect whether there is a displacement phenomenon. If the peak position shifts, it may indicate that the characteristic wavelength band of calcium and magnesium ions is interfered with. Calculate the signal correlation between adjacent wavelength bands to identify coupled or cross-interference regions. For example, when the calcium ion signal has a high intensity in a specific wavelength band, the magnesium ion signal may be affected by overlap.
[0142] After capturing the local intensity gradient, peak position drift, and wavelength band signal differences, compare and analyze them with the preliminary concentration value, and gradually optimize the accuracy of the preliminary concentration value through a dynamic matching and adjustment mechanism.
[0143] Specifically, for the local signals marked with high weights in the comprehensive feature space (such as the calcium ion absorption peak wavelength band), preferentially perform matching analysis with the preliminary concentration value and adjust the contribution ratio of the signal in a specific wavelength band. Calculate the deviation between the local feature and the preliminary concentration value, such as the intensity distribution difference, the proportional error of the peak intensity, etc., and correct the concentration value according to the magnitude of the deviation. Adjust the weights of each wavelength band in the final concentration calculation according to the dynamic change trend of the local signal. If a large fluctuation is detected in the signal near the magnesium ion absorption peak, increase the contribution degree of the relevant wavelength bands in the regression model.
[0144] Furthermore, although the preliminary concentration value already reflects the overall trend of the concentration, due to the fact that the spectral signal may be locally interfered with (such as signal overlap or noise influence), the local signal change trend reflects the microscopic characteristics of the spectral signal within a specific wavelength band, such as intensity distribution, peak position change, the mutual influence of adjacent wavelength bands, etc. These characteristics may not be fully utilized in the preliminary concentration evaluation, but they are crucial for correcting the deviation caused by interference. It is necessary to refine the preliminary concentration value by combining the local dynamic characteristics in the comprehensive feature space to further improve the accuracy of concentration calculation.
[0145] Exemplarily, use the local characteristics in the comprehensive feature space (such as the rate of change of signal intensity within a wavelength band, the displacement amount of the peak position, the comparison of local peaks, etc.) to dynamically adjust the preliminary concentration value. For example, when the signal intensity suddenly changes within a local wavelength band, it may indicate the overlap of calcium and magnesium ion characteristic signals, and a coupling correction term needs to be added to the regression model.
[0146] The output layer corrects the output of the concentration evaluation layer according to a preset concentration standard.
[0147] Specifically, the output layer compares the predicted concentration with the preset concentration standard through a dynamic correction mechanism, and compensates for the deviation of the predicted value in combination with environmental parameters (such as temperature, flow rate, etc.). For example, when there is a slight shift in the spectral characteristics due to external light interference, the correction logic of the output layer can correct the result in a timely manner according to the change trend of the detection data, avoiding unstable concentration output caused by accidental interference.
[0148] The water quality secondary detection component includes:
[0149] A concentration detection component, provided at the outlet of the water to be tested import channel, measures the effluent through spectral analysis to obtain the effluent hardness;
[0150] A second import component for importing the effluent hardness into the host computer.
[0151] The host computer includes:
[0152] A collection component, connected to the first import component and the second import component, and receives the influent hardness and the effluent hardness;
[0153] Specifically, the collection component can communicate with the water quality secondary detection component and the water quality initial detection component through a digital interface, and convert the hardness data into a digital signal format that can be processed by the host computer. During the collection process, the component performs real-time verification and preprocessing on the received signals. For example, it filters out the interference in the sensor signals through a denoising algorithm to ensure the accuracy and reliability of the data imported into the host computer.
[0154] A regeneration component, connected to the collection component, calculates the operating frequency of the optimization component according to the received influent hardness and effluent hardness;
[0155] A control component, connected to the regeneration component, generates a control instruction according to the output of the regeneration component;
[0156] In this embodiment, the control component not only generates a working parameter control signal, but also can decide whether to trigger the regeneration mode according to the information output by the regeneration component. For example, when the control component detects that the effluent hardness continuously exceeds the standard and the adjustment of the working parameters fails to effectively solve the problem, the control component will give priority to issuing a regeneration start instruction to ensure that the ion exchange capacity of the optimized resin can be restored in a timely manner. At the same time, the control component also has a running state monitoring function, and verifies the response accuracy of the optimization component by comparing the execution result of the optimization component with the control instruction in real time.
[0157] The effluent hardness analysis component is used to compare the effluent hardness with the hardness set value. If it is less than or equal to the hardness set value, the effluent hardness analysis component will not perform further operations, thus avoiding unnecessary adjustment of working parameters and regeneration operations. If it is greater than the hardness set value, the effluent hardness will be imported into the regeneration component for re-optimizing the operating parameters.
[0158] In this embodiment, the effluent hardness analysis component further includes ensuring the accuracy of the detection results through a multi-layer data verification mechanism. For example, combining the output parameters of the current working parameters and the hardness change trend to exclude abnormal detection values caused by short-term fluctuations.
[0159] The abnormality analysis component analyzes the cause of the abnormality and generates an optimization plan when the effluent hardness is greater than the hardness set value;
[0160] In this embodiment, when the effluent hardness analysis component detects that the effluent hardness exceeds the hardness set value (in this embodiment, the hardness set value is 0.03 or 0.06), the abnormality analysis component first receives the exceeded hardness data from the effluent hardness analysis component and the relevant operating parameters, including the current influent hardness, the working parameter output of the optimization component, the regeneration status of the optimization component, and the historical operating data, etc.
[0161] By integrating and analyzing these data, the abnormality analysis component preliminarily judges the potential causes of the abnormality. The potential causes specifically include:
[0162] The situation where the influent hardness suddenly increases due to the change of the input water quality and exceeds the design capacity of the optimization component;
[0163] The situation where the working parameters of the optimization component have reached the upper limit but the effluent hardness still fails to meet the standard due to the decline of resin performance or too high flow rate;
[0164] The situation where the response of parameter adjustment lags behind the change of influent hardness due to the delay of the upper computer adjustment or the slow response of the system.
[0165] According to the analysis results, the abnormality analysis component classifies the problems and generates an optimization plan in combination with the operation logic of the automatic water quality optimization device;
[0166] Exemplarily, the optimization plan can include improving the working parameters of the optimization component, triggering the regeneration mode, adjusting the water flow rate, and reporting a fault code.
[0167] The abnormality analysis component imports the optimization plan into the control component and then into the optimization component and related modules through the control component.
[0168] In this embodiment, the optimization component is the core component of the automatic water quality optimization device. Its operation is mainly determined by the control instructions generated by the host computer, and the core of the control instructions lies in the dynamic regulation of the ion exchange resin regeneration. The working parameters of the optimization component directly affect the water quality optimization effect, speed, and resource utilization efficiency. Through precise adjustment of the working parameters, the optimization component can be flexibly adapted under different water quality conditions to effectively remove hardness ions. During the specific operation process, the working parameters of the optimization component are used to drive the ion exchange reaction between the ion exchange resin and the hardness ions (such as calcium ions and magnesium ions) in the water, and the magnitude of the working parameters determines the processing capacity of the optimization component for the incoming water hardness. For example, when the host computer detects that the incoming water hardness is relatively low (e.g., less than 80 ppm), the optimization component operates by reducing the working parameters to save resources and avoid over-optimization; while when the incoming water hardness is relatively high (e.g., greater than 150 ppm) or the water flow rate increases, the optimization component increases the working parameters to enhance the intensity and speed of the ion exchange reaction, thereby meeting the target requirements for the outgoing water hardness.
[0169] Through precise control of the working parameters, the optimization component can achieve efficient optimization effects under dynamic water quality conditions while minimizing resource waste. For example, during normal operation, the working parameters of the optimization component are matched with the total amount of hardness removal, which not only avoids the increase in energy consumption caused by over-operation but also ensures that the outgoing water hardness always remains within the target range. This working parameter adjustment mechanism enables the optimization component to be applicable not only to stable water quality environments but also to quickly respond and adjust the operating state in the case of large fluctuations in the incoming water hardness or abnormal outgoing water hardness, thereby ensuring water quality stability and long-term reliability.
[0170] Embodiment 2
[0171] The present invention provides an embodiment: a method for detecting water quality hardness, referring to Figure 6 , the method includes:
[0172] S1: Detect the incoming water hardness at the inlet section and import the incoming water hardness into the host computer;
[0173] S2: The host computer calculates the initial working frequency of the optimization component based on the incoming water hardness, generates a control instruction, and imports it into the optimization component;
[0174] S3: Detect the outgoing water hardness at the outlet section and transmit the outgoing water hardness back to the host computer;
[0175] S4: The host computer determines whether the outgoing water hardness is less than or equal to the hardness set value. If it is less than or equal to the hardness set value, maintain the current operating parameters;
[0176] S5: If it is greater than the hardness set value, generate a new control instruction and import it into the optimization component;
[0177] S6: Continuously detect the real-time incoming water hardness during the treatment process of the water quality optimization device, and adjust the working frequency according to the real-time incoming water hardness.
Claims
1. Automatic water quality optimization device for hardness detection, characterized in that: The automatic water quality optimization device comprises: The main part of the device includes a channel for introducing water to be tested; A water quality initial inspection component is arranged at the inlet of the water introduction channel to be tested, and the response matrix of calcium and magnesium ions is separated by a signal decoupling algorithm, and the concentration of calcium ions and magnesium ions in the water body is calculated according to the response matrix, and the water hardness is calculated according to the concentration, wherein the water quality initial inspection component includes a light source component, a spectrum detection component, a calculation component and a first introduction component; The spectrum detection component is provided with spectrum acquisition logic, and the spectrum acquisition logic includes: Extracting multiple segments of spectral information from a receiving path of the light source assembly, and calibrating the multiple segments of spectral information; According to the calibrated multiple-segment spectral information, the multiple-segment spectral information is converted into a spectral feature matrix using the Raman band and Raman intensity of the light source component as a two-dimensional transformation reference; According to the principal component analysis, the main distribution bands of calcium ions and magnesium ions are used as the first spectral peak and the second spectral peak of the principal component analysis, and the spectral feature matrix is reduced in dimension according to the first spectral peak and the second spectral peak to calculate the calcium ion response matrix and the magnesium ion response matrix, wherein the dimensionality reduction is used to replace the remaining data of the spectral feature matrix after sparse encoding the intensity data in the first spectral peak and the second spectral peak respectively; Calculating spectral characteristics according to the peak intensity, band area and half-peak width of the calcium ion response matrix and the magnesium ion response matrix, and according to the band coupling relationship between the calcium ions and the magnesium ions; The spectral feature matrix is reduced in dimension according to the first spectral peak and the second spectral peak, and a calcium ion response matrix and a magnesium ion response matrix are calculated, including: Eliminate the first spectral peak and the second spectral peak from the spectral feature matrix respectively to obtain a calcium ion initial response matrix and a magnesium ion initial response matrix; Performing sparse coding processing on the calcium ion initial response matrix and the magnesium ion initial response matrix, wherein the dictionary elements of the sparse coding are defined by corresponding spectral characteristic peaks, and representing the data of the calcium ion initial response matrix and the magnesium ion initial response matrix as a linear combination of the dictionary elements through sparse coding; Screening the encoding results, retaining the band data whose encoding coefficient is greater than or equal to a preset encoding threshold; Impurities are removed from the retained linear combinations through gradient optimization to obtain a calcium ion optimized response matrix and a magnesium ion optimized response matrix; Adding the first spectral peak and the second spectral peak to the calcium ion optimized response matrix and the magnesium ion optimized response matrix, respectively, to generate a calcium ion response matrix and a magnesium ion response matrix; A water quality secondary detection component, arranged at the outlet of the water introduction channel to be tested, and used to detect the hardness of the water discharged from the outlet; The host computer outputs a control instruction in response to the inlet water hardness and outlet water hardness detected by the water quality primary detection component and the water quality secondary detection component; The optimization component is arranged in the water introduction channel to be tested and adjusts the working parameters in response to the control instruction.
2. The automatic water quality optimization device for hardness detection according to claim 1, characterized in that: The water quality initial inspection component includes a light source component, a spectrum detection component, a calculation component and a first introduction component, wherein: The light source assembly is used to emit laser light of a specific wavelength multiple times toward the water body of the inlet portion, wherein the laser light represents detection light of different wavelengths; The spectrum detection component is arranged on the receiving path of the light source component and is used to collect the spectrum characteristics of calcium ions and magnesium ions in the water body; The calculation component is connected to the spectrum detection component, and calculates the concentration of calcium ions and magnesium ions in the water body according to the spectrum characteristics, and calculates the water hardness according to the concentration; The first import component is used to import the water entry hardness into the host computer.
3. The automatic water quality optimization device for hardness detection according to claim 2 is characterized in that: The calculation component is configured with a preset spectral model. By inputting the spectral features and the corresponding response matrix into the spectral model, the concentrations of calcium ions and magnesium ions are output through the spectral model. The spectral model includes: An input layer, used for deconstructing input parameters to generate global feature vectors and local signal change trends, wherein the input layer includes a spectral feature processing branch and a response matrix processing branch; The concentration assessment layer constructs a comprehensive feature space through a feature selection mechanism, and calculates the concentration values of calcium ions and magnesium ions according to the comprehensive feature space; The output layer amends the output of the concentration evaluation layer according to a preset concentration standard.
4. The automatic water quality optimization device for hardness detection according to claim 3 is characterized in that: The concentration assessment layer comprises: Generate preliminary concentration values of calcium and magnesium ions through global features; The preliminary concentration value is refined according to the local signal change trend.
5. The automatic water quality optimization device for hardness detection according to claim 2 is characterized in that: The water quality secondary detection component comprises: A concentration detection component is arranged at the outlet of the water introduction channel to be tested, and measures the outlet water through spectral analysis to obtain the outlet water hardness; The second importing component is used to import the outlet water hardness into the host computer.
6. The automatic water quality optimization device for hardness detection according to claim 5, characterized in that: The host computer comprises: A collection component connected to the first introduction component and the second introduction component, receiving the inlet water hardness and the outlet water hardness; A regeneration component is connected to the collection component and calculates the working parameters of the optimization component according to the received inlet water hardness and outlet water hardness; The control component is connected to the regeneration component and generates a control instruction according to the output of the regeneration component.
7. The automatic water quality optimization device for hardness detection according to claim 6, characterized in that: The host computer further includes: An outlet water hardness analysis component is used to compare the outlet water hardness with a hardness setting value. If the outlet water hardness is less than or equal to the hardness setting value, no operation is performed. If the outlet water hardness is greater than the hardness setting value, the outlet water hardness is introduced into the regeneration component. The abnormality analysis component analyzes the cause of the abnormality and generates an optimization plan when the outlet water hardness is greater than the hardness setting value.
8. A method for detecting water hardness, implemented based on the automatic water quality optimization device for hardness detection according to any one of claims 1 to 7, characterized in that: The method comprises: Detecting the water hardness at the inlet and importing the water hardness into the host computer; The host computer calculates the initial operating frequency of the optimization component according to the water entry hardness, generates a control instruction and imports it into the optimization component; Detect the water hardness at the outlet and transmit the water hardness back to the host computer; The upper computer determines whether the water hardness is less than or equal to the hardness setting value. If it is less than or equal to the hardness setting value, the current operating parameters are maintained; If it is greater than the hardness setting value, a new control instruction is generated and imported into the optimization component; During the processing of the automatic water quality optimization device, the real-time water hardness is continuously detected, and the working frequency is adjusted according to the real-time water hardness.
Citation Information
Patent Citations
Water hardness testing probes, sensors, testing methods, and water softeners
CN111855754B
Water softener, water quality hardness detection device and method for water softener
CN109752426A
Intelligent medicine adding control method, device and system for softening and hardness removal
CN117843155A