Automatic water quality optimizing device for hardness detection and water 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 detection and dynamic optimization of water quality hardness is achieved, and the problem of insufficient linkage control capability for incoming and outgoing water hardness in the existing technology is solved, and water quality stability and resource utilization efficiency are improved.

CN119985357AActive Publication Date: 2025-05-13XIAN MINLI WATER TREATMENT CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510474086.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-05-13
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

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.

Method used

An automatic water quality optimization device for hardness detection is designed. By configuring the initial water quality inspection component in the import part and the secondary water quality inspection component in the outlet part, combining signal decoupling algorithm and sparse coding technology, real-time detection and verification of the incoming and outlet hardness is achieved, and the working parameters of the optimization components are dynamically adjusted through the upper machine to form a closed-loop control mechanism.

Benefits of technology

The device's adaptability to dynamic water quality conditions is improved, the stability of water quality and the effective utilization of resources is ensured, and the compliance rate of effluent water quality is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119985357A_ABST
    Figure CN119985357A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of water quality detection, in particular to an automatic water quality optimization device for hardness detection and a water quality hardness detection method, and provides the following scheme: a water quality initial detection assembly is arranged at an inlet part of the automatic water quality optimization device and is used for detecting the hardness of entering water, and required working parameters are calculated through an upper computer and a control instruction is generated; the outlet part is provided with a water quality secondary detection assembly which is used for checking the effluent hardness and feeding back the effluent hardness to the upper computer; when the hardness change of the inlet water is small, the upper computer dynamically adjusts working parameters according to the hardness of the outlet water to ensure stable water quality; through a closed-loop control mechanism, water inlet hardness detection, water outlet hardness verification and working parameter adjustment are linked, the adaptability to dynamic water quality conditions is improved, and resource waste is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of water quality detection, and in particular to an automatic water quality optimization device for hardness detection and a water 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 the hardness detection module to monitor the water quality, and adjusts the operating parameters of the optimization component through the host computer to achieve hardness adjustment. However, in actual applications, the hardness of water often changes dynamically, such as hardness fluctuations caused by different seasons, usage environments or water 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 hardness detection probe, a sensor, a detection method and a water softener. The sensor includes a control component, which includes a processing module and a potential detection module; the detection probe includes a first probe and a second probe, and when the first probe and the second probe are both in raw water, the potential difference between the first probe and the second probe is a 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 a 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 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 hardness of the water softener in real time and eliminate the test errors caused by manufacturing and drift of the detection probe.

[0004] The above patents have the problem raised by this background technology: lack of linkage control and dynamic optimization capabilities for the hardness of incoming and outgoing 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 address the deficiencies of the prior art and provide an automatic water quality optimization device for hardness detection and a water hardness detection method. The automatic water quality optimization device is equipped with a water quality primary inspection component at the inlet to detect the incoming water hardness, and generates control instructions through the host computer to calculate the required working frequency; the outlet is equipped with a water quality secondary inspection component to verify the outlet water hardness and feed back to the host computer. When the incoming water hardness changes slightly, the host computer dynamically adjusts the working parameters according to the outlet water hardness to ensure stable water quality. The present invention links the incoming water hardness detection, outlet water hardness verification and working parameter adjustment through a closed-loop control mechanism, thereby improving the device's adaptability to dynamic water quality conditions and reducing 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 main part of the device includes a channel for introducing water to be tested;

[0009] The 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;

[0010] The separation of the response matrix of calcium and magnesium ions by combining the signal decoupling algorithm includes converting the spectral information into a spectral feature matrix, reducing the dimension of the spectral feature matrix, calculating the calcium ion response matrix and the magnesium ion response matrix, and the dimensionality reduction is used to replace the remaining data after sparse coding the intensity data;

[0011] 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;

[0012] 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;

[0013] The optimization component is arranged in the water introduction channel to be tested and adjusts the working parameters in response to the control instruction.

[0014] Water quality initial inspection components, including:

[0015] A light source assembly, used for emitting 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;

[0016] A 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;

[0017] A 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;

[0018] The first import component is used to import the water hardness into the host computer.

[0019] The spectrum detection component is configured with spectrum acquisition logic, which includes:

[0020] Extracting multiple segments of spectral information from a receiving path of the light source assembly, and calibrating the multiple segments of spectral information;

[0021] 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;

[0022] According to the principal component analysis, the main distribution bands of calcium ions and magnesium ions are taken 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, and the calcium ion response matrix and the magnesium ion response matrix are calculated, wherein the dimensionality reduction is used to sparsely encode 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] The spectral characteristics are calculated based on the peak intensity, band area and half-peak width of the calcium ion response matrix and the magnesium ion response matrix, and based on the band coupling relationship between the calcium ions and the magnesium ions.

[0024] 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:

[0025] 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;

[0026] 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;

[0027] Screening the encoding results, retaining the band data whose encoding coefficient is greater than or equal to a preset encoding threshold;

[0028] 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;

[0029] The first spectral peak and the second spectral peak are added 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.

[0030] 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:

[0031] 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;

[0032] 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;

[0033] The output layer amends the output of the concentration evaluation layer according to a preset concentration standard.

[0034] The concentration assessment layer comprises:

[0035] Generate preliminary concentration values ​​of calcium and magnesium ions through global features;

[0036] The preliminary concentration value is refined according to the local signal change trend.

[0037] The water quality secondary detection component comprises:

[0038] 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;

[0039] The second importing component is used to import the outlet water hardness into the host computer.

[0040] The host computer comprises:

[0041] A collection component connected to the first introduction component and the second introduction component, receiving the inlet water hardness and the outlet 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 inlet water hardness and outlet water hardness;

[0043] The 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] The outlet water hardness analysis component is used to compare the outlet water hardness with the hardness setting value. If it is less than or equal to the hardness setting value, no operation is performed. If it is greater than the hardness setting value, the outlet water hardness is introduced into the regeneration component.

[0046] 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.

[0047] A method for detecting water hardness, the method comprising:

[0048] Detecting the water hardness at the inlet and importing the water hardness into the host computer;

[0049] 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;

[0050] Detect the water hardness at the outlet and transmit the water hardness back to the host computer;

[0051] 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;

[0052] If it is greater than the hardness setting value, a new control instruction is generated and imported into the optimization component;

[0053] 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.

[0054] Compared with the prior art, the present invention has the following beneficial effects:

[0055] 1. The present invention converts light scattering information into a spectral matrix and combines it with a signal decoupling algorithm for dimensionality reduction and sparse coding, which can accurately calculate the concentration of calcium and magnesium ions in water and reduce the computational complexity, thereby efficiently detecting water hardness;

[0056] 2. The present invention verifies the outlet water hardness in real time through the water quality secondary detection component. When the outlet water hardness does not meet the standard, the upper computer feedback adjusts and optimizes the component operating parameters to achieve rapid correction of abnormal water quality, significantly improves the stability and compliance rate of outlet water quality, and realizes the linkage control of inlet and outlet water hardness. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0058] Figure 1 This is a schematic diagram of the structure of an automatic water quality optimization device for hardness detection according to Example 1 of the present invention;

[0059] Figure 2 This is a schematic diagram of matrix conversion in Example 1 of the present invention;

[0060] Figure 3 This is a schematic diagram of the first principle of matrix dimensionality reduction in Example 1 of the present invention;

[0061] Figure 4 This is a schematic diagram of the second principle of matrix dimensionality reduction in Example 1 of the present invention;

[0062] Figure 5 This is a schematic diagram of the third principle of matrix dimensionality reduction in embodiment 1 of the present invention;

[0063] Figure 6This is a flow chart of a water hardness detection method according to Example 2 of the present invention. DETAILED DESCRIPTION

[0064] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0065] Example 1

[0066] See also Figure 1 , the present invention provides an embodiment: an automatic water quality optimization device for hardness detection, wherein the dotted line indicates the direction of data flow, and the automatic water quality optimization device is intended to solve the problems of unstable optimization efficiency, inaccurate water hardness detection and hysteresis in the prior art. This embodiment realizes real-time monitoring and precise adjustment of water hardness by introducing inlet and outlet water hardness detection, upper computer dynamic control logic and efficient optimization component design, ensuring the stability of optimized water quality and system operation efficiency. The automatic water quality optimization device includes:

[0067] The device body comprises a water introduction channel for testing, wherein the inlet portion of the water introduction channel for testing forms the inlet of the device body, and the outlet portion of the water introduction channel for testing forms the outlet of the device body;

[0068] In this embodiment, the layout and material design of the water inlet channel to be tested are optimized to ensure smooth water flow and the hardness test results are not affected by the sediment on the inner wall of the pipe. In addition, the structural design of the inlet and outlet takes into account the standardized interface form, which is convenient for integration with different water source systems.

[0069] A water quality initial inspection component is provided at the inlet of the water introduction channel to be tested, and is used to detect the water hardness of the water entering the inlet;

[0070] In this embodiment, the water quality initial inspection component uses spectral analysis technology to accurately identify the concentration of calcium and magnesium ions in water by combining the light source component and the spectral detection component, and generates the water hardness value according to the spectral characteristics. This detection method is not only highly sensitive, but also can adapt to the dynamic changes of water quality and provide accurate input for the frequency modulation of the host computer.

[0071] A water quality secondary detection component, arranged at the outlet of the water introduction channel to be tested, and used to detect the water hardness of the water discharged from the outlet;

[0072] In this embodiment, the secondary water quality detection component uses a combination of a conductivity sensor component and a concentration detection component to calculate the concentration of total dissolved solids by monitoring the conductivity change, and then estimates the water hardness value in combination with a specific algorithm. The treatment effect of the optimization component can be quickly verified at the water outlet stage, so that the water hardness deviation can be discovered in time and the operating status can be adjusted to improve the water quality compliance rate.

[0073] Specifically, the secondary water quality detection component is located at the outlet, and the outlet water hardness has been significantly reduced and the fluctuation range is small, so there is no need for complex spectral analysis technology. Compared with the water inlet detection, the core of the water outlet detection is to quickly verify the treatment effect. The combination of conductivity sensor components and concentration detection components can meet the accuracy requirements and have a higher response speed.

[0074] The host computer outputs a control instruction in response to the water hardness detected by the water quality primary detection component and the water quality secondary detection component;

[0075] The optimization component is arranged in the water introduction channel to be tested 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 processing efficiency through working parameter adjustment. The response speed of the optimization component has been optimized and can quickly adapt to the dynamic adjustment instructions of the host computer, thereby ensuring that the outlet water hardness remains stable within the target range even when the inlet water hardness fluctuates greatly.

[0077] Specifically, this embodiment realizes real-time detection and verification of inlet and outlet water hardness by configuring a water quality primary detection component at the inlet of the device and a water quality secondary detection component at the outlet, and at the same time forms a closed-loop control mechanism by combining the dynamic working parameter adjustment logic of the host computer. At present, there are relatively complete dual detection modules for inlet and outlet water hardness in the prior art, but these solutions are usually only simple detection behaviors and fail to form a complete dynamic adjustment and feedback closed-loop mechanism, resulting in changes in inlet water hardness that cannot be directly and timely reflected in the adjustment of the operating parameters of the optimization component, lacking flexibility; in addition, the verification results of the outlet water hardness are usually only recorded without forming a linkage 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] For example, in actual applications, when the inlet water hardness increases from 90 ppm to 180 ppm, existing products usually have high outlet water hardness due to the lag in the adjustment of working parameters, and because no feedback closed loop is formed, even if the outlet 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 the inlet 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 outlet water hardness is controlled within the target range. If the adjusted outlet water hardness still does not meet the standard, the water quality secondary inspection component will feed back the test results to the host computer, and the host computer can further optimize the operating parameters, such as increasing the output of working parameters or starting the regeneration mode, to ultimately ensure that the outlet water quality meets the set standards.

[0079] Specifically, the method of emitting lasers multiple times by the water quality initial inspection component of the automatic water quality optimization device of this embodiment is suitable for the detection of real-time flowing water bodies. Since the concentration of calcium and magnesium ions in the water flow may change over a period of time, a single measurement cannot fully reflect the dynamic concentration in the water body. Therefore, by emitting lasers multiple times and continuously collecting spectral information, the concentration changes of calcium and magnesium ions in the water body can be monitored in real time to ensure that the water quality optimization process can be adjusted according to the changing concentration data.

[0080] The water quality initial inspection component comprises:

[0081] a light source assembly, configured to emit laser light of a specific wavelength multiple times toward the water body at the inlet, wherein the laser light represents detection light of different wavelengths;

[0082] In this embodiment, the light source component uses laser to detect water hardness. Currently, fluorescence spectroscopy technology is usually used in water hardness detection solutions based on spectral analysis. Although fluorescence spectroscopy technology has high sensitivity and detection efficiency in industrial detection scenarios, it is not applicable in device design for home or small commercial scenarios because fluorescent light sources may cause potential safety hazards to human eyes or skin. Therefore, this embodiment has made improvements in light source selection. The laser light source used has undergone strict working parameter restrictions and safety design, and complies with international laser product safety standards to ensure that the water quality optimization device will not cause safety hazards even if it is directly exposed to human eyes 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 high-stability laser with a wavelength of 532nm or 785nm to emit a specific wavelength to excite the Raman scattering signals of calcium ions and magnesium ions in the water body. The laser light source of a specific wavelength can accurately excite the molecular vibration mode of the target ion, thereby extracting the corresponding Raman scattering characteristic signal. In addition, since the intensity of the Raman scattering signal is directly related to the selection of the laser wavelength, for the characteristic Raman peaks of calcium ions and magnesium ions, selecting a wavelength of 532nm or 785nm 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 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;

[0085] A 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;

[0086] The first import component is used to import the water hardness into the host computer.

[0087] In this embodiment, the first import component uses a high-speed digital import interface, combined with real-time data verification technology, to ensure that hardness data can be stably imported in complex environments. The first import component also has a data cache function. When the signal import is disturbed by external factors, the most recent set of data can be saved for the automatic water quality optimization device to continue to operate after recovery.

[0088] The spectrum detection component is provided with spectrum acquisition logic, and the spectrum acquisition logic includes:

[0089] Extracting multiple segments of spectral information from a receiving path of the light source assembly, and calibrating the multiple segments of spectral information;

[0090] Specifically, the calibration process adjusts the wavelength and intensity parameters of the light source to eliminate errors introduced by ambient light, device noise, or changes in measurement angles, ensuring that the collected spectral data can truly reflect the characteristic signals of ions in the water. The specific calibration method can be compared with multi-point light source reference samples and dynamically adjust the spectral intensity curve to form a consistent and standardized data baseline.

[0091] According to the calibrated spectral information, the spectral information is converted into a spectral feature matrix using the Raman band and Raman intensity of the light source assembly as a two-dimensional transformation reference;

[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 assembly and the calcium ions and magnesium ions in the water body, which already contains the wavelength and the corresponding intensity value;

[0093] Specifically, the Raman band refers to the spectral characteristics of a specific wavelength range formed by the Raman scattering effect during spectral detection, which reflects the changes in the vibration and rotation energy levels of solute molecules in water. This change has a high degree of molecular selectivity and can accurately identify the spectral peaks unique to solute molecules (such as calcium ions and magnesium ions). The characteristics of the Raman band enable it to reliably detect the presence of specific molecules or ions under complex background light signals.

[0094] Raman intensity refers to the intensity of scattered light observed in the Raman band, which is directly related to the concentration of calcium and magnesium ions in the water. The higher the intensity of scattered light, the higher the concentration of the target molecule. Therefore, as an important parameter for quantifying the concentration of the target substance, Raman intensity is widely used in the hardness detection process to establish the correspondence between concentration and band response. By extracting the changes in Raman intensity, the specific concentrations of calcium and magnesium ions in the water can be effectively estimated, thereby providing accurate data support for hardness calculation.

[0095] In this embodiment, the specific implementation method of the two-dimensional transformation benchmark is to use the specific wavelength range (i.e., Raman band) in the water body as the horizontal coordinate of the matrix, and the light intensity signal (i.e., Raman intensity) of the corresponding band as the vertical coordinate of the matrix to form a two-dimensional matrix structure. Through this conversion, each matrix component (i.e., a point in 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 to 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 to a two-dimensional matrix space, and each matrix component corresponds to a specific wavelength range and intensity level. This Raman signal-based conversion method can partition the ion response characteristics of a specific wavelength, improve the recognition ability of calcium and magnesium ion signals, and reduce the coupling interference with background light signals. It can effectively deal with the interference of various complex solutes in water bodies and ensure that the spectral feature matrix can highlight the response characteristics of calcium and magnesium ions.

[0097] See also Figure 2 , a schematic diagram of matrix conversion in an embodiment of the present invention, converting a 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 transform according to the remaining measured one-dimensional sequences to finally obtain M N spectral feature matrix, where M represents the number of measurements and N represents the total number of bands;

[0098] See also Figure 3 , Figure 4 and Figure 5 In the embodiment of the present invention, when reducing the matrix dimension, the response matrix of calcium ions and magnesium ions is extracted by processing Raman spectral data, sparse coding, and optimizing spectral features. The figure mainly shows the generation process of the calcium ion response matrix. First, Figure 3 The main distribution bands of calcium ions and magnesium ions (i.e., the first spectral peak and the second spectral peak) were obtained and combined with other band data to form a spectral feature matrix. 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 sparse coding are defined by the first spectral peak and the second spectral peak. Finally, Figure 5 The optimization steps of gradient optimization and retained linear combination are shown. Through gradient optimization, the retained linear combination (i.e. the result after sparse coding) is further impurity removed. Band data X and band data Y both represent the band data after gradient optimization.

[0099] Specifically, the characteristic peaks of calcium and magnesium ions are used as dictionary elements for sparse coding to separate the response signals of the two ions from the complex spectral data. The gradient changes of the spectral peaks are compared and optimized with the gradients in the response matrix through gradient optimization to ensure that the optimized matrix accurately reflects the changes in ion concentration.

[0100] 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, so as to obtain a matrix with higher calcium ion and magnesium ion responsiveness;

[0101] In this embodiment, how to reduce the dimension of the spectral feature matrix through the first spectral peak and the second spectral peak, and replace the inferior data therein by sparse coding, first of all, it is necessary to clarify that the first spectral peak and the second spectral peak represent the main response bands of calcium ions and magnesium ions, and these two bands are most sensitive to changes in ion concentration and contain the most significant characteristic information. However, in actual spectral data, other bands in the spectral matrix may also contain response signals of calcium ions and magnesium ions, but these signals are usually weak and easily interfered by impurities. If the band data is directly removed, there will be a situation where calcium and magnesium ions are still left, and if the remaining band data is not processed, there will be a situation where resources overflow.

[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 primitives. The primitives here are the characteristic peaks of calcium ions and magnesium ions, which are defined by the first spectral peak and the second spectral peak, respectively. In the sparse coding process, other band signals in the matrix, especially the noise component, will be compressed into small coefficients in the sparse matrix. In this way, the signal representation will become more streamlined, and the interference from other solutes and impurities can be effectively reduced.

[0110] Specifically, since each response matrix is ​​a two-dimensional matrix in which each row represents the response signal of a different band at a different time point, each row (i.e., the spectral response signal of each band) is sparsely encoded 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 intensity and morphology as dictionary elements can represent the primitives of the signal.

[0111] Furthermore, sparse coding calculates the similarity between each primitive in the dictionary and the row of data, and assigns a coefficient (usually non-negative) to each primitive, so that the weighted sum of these primitives can reconstruct the dictionary element corresponding to the row of data as much as possible.

[0112] Preferably, in the sparse coding process, a sparsity constraint may be used, that is, the coefficients of the dictionary elements are restricted so that in the representation of each row, only a few coefficients of the dictionary elements are non-zero. Only the most representative primitives will be retained in the final coding.

[0113] Ultimately, sparse coding outputs a set of sparse coefficient matrices, where each row corresponds to a band of data in the calcium and magnesium response matrices, and each column corresponds to the coefficient of a primitive 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 coefficients are zero or close to zero, retaining only the bands that best represent the target ion signal.

[0114] Screening the coding results, retaining the band data whose coding coefficient is greater than or equal to a preset coding threshold;

[0115] In this embodiment, after sparse coding, each band in the response matrix is ​​assigned a coding coefficient. The size of the coding coefficient represents the correlation between the band and the dictionary primitive (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 signal (calcium ions and magnesium ions).

[0116] Specifically, according to the sparse coefficient matrix, if the sparse coefficient of a certain band is lower than a preset coding threshold, it is considered that the band contributes less to the final response matrix and can be removed.

[0117] 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;

[0118] In this embodiment, the gradient optimization is not simply performed on the entire matrix, but on the bands associated with the first spectral peak and the second spectral peak (i.e., the columns of these characteristic bands), ensuring that the gradient changes of each band in the response matrix are consistent with the concentration changes of the target ions (calcium ions and magnesium ions).

[0119] Specifically, for the band data retained in the calcium and magnesium ion response matrices, the gradient change of each band is calculated and 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 concentration changes, that is, the rate at which the intensity of the band changes at different concentration values. Ideally, the spectral characteristic bands of calcium and magnesium ions should be highly positively correlated with the gradient of concentration changes.

[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 expectations. For example, if the gradient change of a certain band is negatively correlated or unrelated to the gradient change of the first spectral peak, it means that the band may contain impurity components. The optimization process will reduce the influence of the band and gradually remove the impurities.

[0121] The first spectral peak and the second spectral peak are added 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] Calculating spectral characteristics according to the peak intensity, band area and half-peak width of the response matrix and according to the band coupling relationship between calcium ions and magnesium ions;

[0123] Specifically, the integrity and amplitude of the characteristic signal are comprehensively evaluated based on the peak intensity, band area and half-peak width of the calcium and magnesium ion bands in the spectral matrix. Furthermore, the results are corrected using the coupling relationship between the calcium and magnesium ion bands to eliminate possible signal superposition or cross-interference. For example, in the overlapping area of ​​the spectral peaks of calcium ions and magnesium ions, by combining the response intensity ratio and wavelength difference between the two, it is ensured that the calculated band signal can truly reflect the actual contribution value of each ion.

[0124] The accurate calculation of calcium and magnesium ion concentrations is achieved through branch processing, feature fusion, concentration evaluation and output correction of spectral features and response matrices. The calculation component is configured with a preset spectral model. The spectral features and the corresponding response matrix are input into the spectral model, and the calcium ion and magnesium ion concentrations are output through the spectral model. The spectral model includes:

[0125] 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;

[0126] Specifically, the spectral feature processing branch processes the spectral features through a one-dimensional convolution kernel to extract global features from the spectral data. The one-dimensional convolution kernel can capture the key features of the spectral signal, such as peak intensity, peak width, band area, etc. These features are the basis for calculating the concentration of calcium and magnesium ions in hardness testing. Through layer-by-layer convolution, we can start from low-level features and gradually build higher-level global feature representations. Each layer of convolution operation filters the spectral signal, extracts the main information within a specific frequency range, and reduces noise interference, so that the model can focus on key spectral features related to calcium and magnesium ions.

[0127] Furthermore, the one-dimensional convolution kernel includes multiple layers of convolution kernels. The first layer of convolution kernels is mainly used to capture the local change trend of the spectral signal, such as the peak position and the preliminary intensity distribution; the second layer of convolution kernels extracts the frequency pattern based on the output of the previous layer to identify the weak signal coupling or stray light influence; the third and subsequent layers of convolution kernels further integrate low-level features to form a global representation of the entire spectral signal. After each layer of convolution operation, a nonlinear activation function will be combined to enhance the expressive power of the model. At the same time, the data dimension is reduced through pooling operations, which reduces the computational complexity and improves the robustness of the features.

[0128] Specifically, the response matrix processing branch is used to deal with 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. By analyzing each band separately, it is possible to capture the intensity distribution changes and their characteristic patterns in different wavelength ranges, thereby distinguishing the overlapping signals between calcium ions and magnesium ions, and accurately identifying the characteristic bands of each ion.

[0129] In the present embodiment, the response matrix is ​​first divided according to a preset wavelength range, and each sub-band region represents a specific spectral characteristic region, such as the absorption peak range of calcium ions and magnesium ions. For each sub-band region, by calculating the intensity change trend, peak distribution and signal concentration in the region, the local features are initially extracted. Subsequently, in order to further process the signal interference and coupling problems, a weight matrix is ​​established between each sub-band region, and the weight matrix is ​​dynamically adjusted according to the signal correlation between the bands, ensuring that a higher weight can be given to the key band in the high coupling region, and the influence of the interference signal is weakened in the low correlation region. Further, in order to solve the dynamic change problem of the local signal, the response matrix processing branch is also combined with the sliding window technology, by performing statistical analysis of the moving window on the continuous band region, the change trend of the local signal and the subtle movement of the peak position are captured. For example, when the calcium and magnesium ion signals overlap in a high hardness environment, the sliding window technology can effectively identify the specific area of ​​interference, and dynamically adjust the weight of the key feature by the intensity change rate in the region, ensuring that the output local features have high accuracy and robustness.

[0130] 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;

[0131] Specifically, the construction of the comprehensive feature space is a link for efficient integration of 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 by the feature evaluation algorithm to evaluate their contribution to concentration evaluation. Features with higher contributions will be given higher weights. For example, the peak intensity in the spectral feature 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, the input features are subjected to dimensionality reduction processing to eliminate low-correlation features or redundant information repeated with other features. Reduce computational complexity while avoiding the impact of noise interference on concentration calculation.

[0132] Furthermore, the feature evaluation algorithm determines the importance of each feature by calculating the correlation between it and the concentration of calcium and magnesium ions. Specifically, a correlation coefficient-based evaluation method is used to calculate the linear or nonlinear correlation between each feature and the target concentration. For example, the peak intensity has a high correlation with the calcium ion concentration, while the width of the band intensity is more sensitive to the magnesium ion concentration. The features are preliminarily sorted by the size of the correlation coefficient, and the high-correlation features are marked as priority features.

[0133] The concentration assessment layer comprises:

[0134] Generate preliminary concentration values ​​of calcium and magnesium ions through global features;

[0135] The calculation formula for the preliminary concentration value is:

[0136] ;

[0137] in, 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 nonlinear function in the regression model, j represents a single nonlinear relationship feature in the global feature, M represents the total number of nonlinear relationship features, represents the jth nonlinear relationship feature, Represents the nonlinear parameter corresponding to the j-th nonlinear relationship feature.

[0138] The generation of preliminary concentration values ​​is based on the regression model of the calibration curve. The model takes the global features in the comprehensive feature space as input and outputs preliminary calcium and magnesium ion concentration values ​​according to the known relationship between spectral features and concentration (such as linear or nonlinear mapping relationship calibrated by experiment).

[0139] For example, the linear relationship between peak intensity and ion concentration is ,in, represents the ion concentration, and represents the experimentally determined linear parameter in the calibration curve, Indicates the nonlinear relationship between peak intensity and band area and ion concentration (mainly expressed as an exponential relationship). ,in, and represents the nonlinear coefficient of experimental calibration, represents the band area, The data used by the exponential function and the regression model can be derived from an experimental calibration data set, which can be obtained by technicians in this field through a large number of experiments to ensure the accuracy of the mapping relationship.

[0140] The preliminary concentration value is refined according to the local signal change trend.

[0141] Analyze the intensity change rate within a specific band and extract the signal gradient of the peak and its adjacent area. For example, the signal intensity gradient of the calcium and magnesium ion absorption peak can reveal whether the spectral signal is interfered or overlapped. Compare the peak position in the calibration data with the actual peak position of the real-time spectral signal to detect whether there is a displacement phenomenon. If the peak position is shifted, it may indicate that the characteristic bands of calcium and magnesium ions are interfered. Calculate the signal correlation between adjacent bands to identify coupling or cross-interference areas. For example, when the calcium ion signal has a high intensity in a specific band, the magnesium ion signal may be affected by overlap.

[0142] After capturing the local intensity gradient, peak position drift and band signal difference, a comparative analysis is performed with the preliminary concentration value, and the accuracy of the preliminary concentration value is gradually optimized through a dynamic matching and adjustment mechanism.

[0143] Specifically, for local signals marked as high weights in the comprehensive feature space (such as the calcium ion absorption peak band), priority is given to matching analysis with the preliminary concentration value to adjust the contribution ratio of the specific band signal. 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 deviation. According to the dynamic change trend of the local signal, adjust the weight of each band in the final concentration calculation. If a large fluctuation in the signal near the magnesium ion absorption peak is detected, increase the contribution of the relevant band of the regression model.

[0144] Furthermore, although the preliminary concentration value has reflected the overall trend of the concentration, the spectral signal may be affected by local interference (such as signal overlap or noise), and the local signal change trend reflects the microscopic characteristics of the spectral signal in a specific band, such as intensity distribution, peak position change, and mutual influence of adjacent bands. These characteristics may not be fully utilized in the preliminary concentration assessment, but they are crucial to correcting the deviation caused by interference. The preliminary concentration value needs to be refined in combination with the local dynamic characteristics in the comprehensive feature space to further improve the accuracy of the concentration calculation.

[0145] Exemplarily, the preliminary concentration value is dynamically adjusted using local characteristics in the comprehensive feature space (such as the rate of change of signal intensity within the band, the displacement of the peak position, the contrast of the local peak value, etc.). For example, when the signal intensity within the local band changes suddenly, it may indicate that there is an overlap of characteristic signals of calcium and magnesium ions, and a coupling correction term needs to be added to the regression model.

[0146] The output layer amends the output of the concentration evaluation layer according to a preset concentration standard.

[0147] Specifically, the output layer uses a dynamic correction mechanism to compare the predicted concentration with the preset concentration standard, and compensates for the deviation of the predicted value in combination with environmental parameters (such as temperature, flow rate, etc.). For example, when the spectral characteristics are slightly offset due to external light interference, the correction logic of the output layer can correct the results in time according to the changing trend of the detection data to avoid unstable concentration output due to occasional interference.

[0148] The water quality secondary detection component comprises:

[0149] 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;

[0150] The second importing component is used to import the outlet water hardness into the host computer.

[0151] The host computer comprises:

[0152] A collection component connected to the first introduction component and the second introduction component, receiving the inlet water hardness and the outlet water hardness;

[0153] Specifically, the acquisition component can communicate with the water quality secondary detection component and the water quality primary detection component through a digital interface to convert the hardness data into a digital signal format that can be processed by the host computer. During the acquisition process, the component performs real-time verification and preprocessing of the received signal, for example, filtering out interference in the sensor signal through a denoising algorithm to ensure that the data imported into the host computer is accurate and reliable.

[0154] A regeneration component is connected to the collection component and calculates the working frequency of the optimization component according to the received inlet water hardness and outlet water hardness;

[0155] A control component connected to the regeneration component, generating a control instruction according to an output of the regeneration component;

[0156] In this embodiment, the control component not only generates the working parameter control signal, but also determines whether to trigger the regeneration mode according to the information output by the regeneration component. For example, when the control component detects that the outlet water hardness continues to exceed the standard and the working parameter adjustment 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 time. At the same time, the control component also has an operation status monitoring function, which verifies the response accuracy of the optimization component by comparing the execution results of the optimization component with the control instruction in real-time feedback.

[0157] The outlet water hardness analysis component is used to compare the outlet water hardness with the hardness setting value. If it is less than or equal to the hardness setting value, the outlet water hardness analysis component will not perform further operations, thereby avoiding unnecessary working parameter adjustments and regeneration operations. If it is greater than the hardness setting value, the outlet water hardness will be introduced into the regeneration component to re-optimize the operating parameters.

[0158] In this embodiment, the water hardness analysis component also includes ensuring the accuracy of the test results through a multi-layer data verification mechanism, such as combining the current working parameter output parameters and hardness change trends to eliminate abnormal detection values ​​caused by short-term fluctuations.

[0159] Abnormal analysis component: when the outlet water hardness is greater than the hardness setting value, the abnormal cause is analyzed and an optimization plan is generated;

[0160] In this embodiment, when the outlet water hardness analysis component detects that the outlet water hardness exceeds the hardness setting value (in this embodiment, the hardness setting value is 0.03 or 0.06), the abnormal analysis component first receives the excessive hardness data and related operating parameters from the outlet water hardness analysis component, including the current inlet water hardness, the working parameter output of the optimization component, the regeneration status of the optimization component and historical operating data.

[0161] By integrating and analyzing these data, the anomaly analysis component preliminarily determines the potential causes of the anomaly, which include:

[0162] Changes in input water quality cause a sudden increase in water hardness that exceeds the design capacity of the optimized components;

[0163] The operating parameters of the optimized components have reached the upper limit due to resin performance degradation or excessive flow, but the outlet water hardness still does not meet the standard;

[0164] The response of parameter adjustment caused by the delay in upper computer regulation or slow system response lags behind the change of water hardness.

[0165] Based on the analysis results, the abnormal 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 scheme may include improving the operating parameters of the optimization component, triggering the regeneration mode, adjusting the water flow, and reporting a fault code.

[0167] The abnormal analysis component imports the optimization plan into the control component, and then imports it 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, and 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 adjustment of the exchange resin regeneration. The working parameters of the optimization component directly affect the effect, speed and resource utilization efficiency of water quality optimization. Through the precise adjustment of the working parameters, the optimization component can be flexibly adapted under different water quality conditions to achieve effective removal of hardness ions. In the specific operation process, the working parameters of the optimization component are used to drive the exchange reaction between the ion exchange resin and the hardness ions (such as calcium ions and magnesium ions) in the water. The size of the working parameters determines the processing capacity of the optimization component for the hardness of the incoming water. For example, when the host computer detects that the incoming water hardness is low (such as less than 80ppm), the optimization component runs by reducing the working parameters to save resources and avoid over-optimization; when the incoming water hardness is high (such as greater than 150ppm) or the water flow increases, the optimization component increases the intensity and speed of the ion exchange reaction by improving the working parameters, thereby meeting the target requirements of the outlet water hardness.

[0169] Through precise control of operating parameters, the optimization component can achieve efficient optimization effects under dynamic water quality conditions while minimizing resource waste. For example, during normal operation, the operating parameters of the optimization component are matched to the total amount of hardness removal, which not only avoids increased energy consumption caused by excessive operation, but also ensures that the outlet water hardness is always maintained within the target range. This operating parameter adjustment mechanism makes the optimization component not only suitable for stable water quality environments, but also can quickly respond and adjust the operating status when the inlet water hardness fluctuates greatly or the outlet water hardness is abnormal, thereby ensuring water quality stability and long-term reliability.

[0170] Example 2

[0171] The present invention provides an embodiment: a method for detecting water hardness, referring to Figure 6 , the method comprising:

[0172] S1: Detecting the water hardness at the inlet and importing the water hardness into the host computer;

[0173] S2: 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;

[0174] S3: Detecting the water hardness at the outlet and transmitting the water hardness back to the host computer;

[0175] S4: The host 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;

[0176] S5: If it is greater than the hardness setting value, generate new control instructions and import them into the optimization component;

[0177] S6: During the treatment process of the 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.

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; The 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; The separation of the response matrix of calcium and magnesium ions by combining the signal decoupling algorithm includes converting the spectral information into a spectral feature matrix, reducing the dimension of the spectral feature matrix, calculating the calcium ion response matrix and the magnesium ion response matrix, and the dimensionality reduction is used to replace the remaining data after sparse coding the intensity data; 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 comprises: A light source assembly, used for emitting 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; A 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; A 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 hardness into the host computer.

3. The automatic water quality optimization device for hardness detection according to claim 2 is characterized in that: 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; The spectral characteristics are calculated based on the peak intensity, band area and half-peak width of the calcium ion response matrix and the magnesium ion response matrix, and based on the band coupling relationship between the calcium ions and the magnesium ions.

4. The automatic water quality optimization device for hardness detection according to claim 3 is characterized in that: 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; The first spectral peak and the second spectral peak are added 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.

5. The automatic water quality optimization device for hardness detection according to claim 3 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.

6. The automatic water quality optimization device for hardness detection according to claim 5, 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.

7. The automatic water quality optimization device for hardness detection according to claim 2, 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.

8. The automatic water quality optimization device for hardness detection according to claim 7, 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.

9. The automatic water quality optimization device for hardness detection according to claim 8, 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.

10. 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 9, 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

  • Method for detecting hardness of water by adopting surface enhanced Raman and application of method

    CN117849022A

  • Uniformity test method, device and equipment for light guide film

    CN119437663A