Rapid water quality detector and water quality detection method
Through the dynamic neural network temperature compensation algorithm and the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm, the problems of extensive temperature control and environmental impact of traditional water quality detection equipment are solved, and high-precision and rapid water quality detection are achieved.
Patent Information
- Application Number
- CN202510344364.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-08-15
AI Technical Summary
Traditional water quality testing equipment is extensive in temperature control and is susceptible to environmental influences, making it difficult to achieve fast and accurate inspection.
Dynamic neural network temperature compensation algorithm and temperature-sensitive adaptive multi-objective particle swarm optimization algorithm are adopted, combined with multi-sensor data processing and intelligent control, to achieve accurate temperature control and colorimetric detection value optimization of digestion tubes.
It realizes accurate control of digestion tube temperature under ambient temperature fluctuations, reduces detection errors, improves detection accuracy and equipment reuse rate, and adapts to wide temperature range working conditions.
Smart Images

Figure CN120489991A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of water quality detection technology and equipment, and in particular to a rapid water quality detection instrument and a water quality detection method. Background Art
[0002] Water quality testing is an integral part of environmental protection and industrial production. Traditional water quality testing methods typically require complex laboratory equipment and tedious procedures, making rapid and accurate testing difficult. With technological advancements, automated and intelligent water quality testing equipment has become a research hotspot.
[0003] The digestion device is a key component of a water quality tester, and the digestion tube is its core. Generally speaking, the digestion device needs to detect multiple parameters, requiring the digestion tube to heat and cool quickly and accurately control the temperature. This is usually achieved by installing a heater or cooler around the digestion tube. However, the temperature control of this device is relatively crude, making it difficult to maintain a constant temperature during the colorimetric detection process. Furthermore, it is significantly affected by the external ambient temperature, making it unsuitable for practical use in engineering projects. Summary of the Invention
[0004] In order to improve the detection accuracy and ease of operation of water quality detection equipment, the present invention provides a water quality rapid detection instrument and a water quality detection method.
[0005] The technical solution adopted by the present invention is as follows: a rapid water quality detector, comprising: a digestion tube; a quantitative liquid feeding unit, which quantitatively inputs liquid into the digestion tube; a heating unit and a cooling unit, which are respectively used to heat or cool the digestion tube; a temperature measuring unit, which is used to detect the temperature of the liquid in the digestion tube and the ambient temperature in real time; a colorimetric detection unit, which is used to detect the absorbance of the liquid in the digestion tube and obtain an initial measurement value; a control unit, which comprises a programmable controller, which is electrically connected to the digestion tube, the quantitative liquid feeding unit, the heating unit, the cooling unit, the temperature measuring unit and the colorimetric detection unit; the programmable controller is integrated with a dynamic neural network temperature compensation algorithm and a temperature-sensitive adaptive multi-objective particle swarm optimization algorithm, which are respectively used to achieve precise control of the heating unit and the cooling unit and to optimize the initial detection value of the colorimetric detection unit.
[0006] Preferably, the quantitative liquid delivery unit includes: a multi-way solenoid valve having multiple container ports and a common port, wherein the container ports are respectively connected to each liquid container and the digestion tube; a peristaltic pump capable of forward and reverse liquid delivery, driving the liquid flow; a quantitative loop tube, connected between the common port of the multi-way solenoid valve and the peristaltic pump; a liquid level sensor, connected between the quantitative loop tube and the peristaltic pump, for detecting the liquid level in the quantitative loop tube.
[0007] Preferably, the quantitative loop tubes are two or more connected in parallel.
[0008] Preferably, the heating unit includes a heating wire wound around the outer wall of the digestion tube and a heating controller for controlling the power of the heating wire.
[0009] Preferably, the cooling unit includes a heat sink and a fan.
[0010] Preferably, the temperature measuring unit includes a temperature sensor inserted into the digestion tube and an external temperature sensor for detecting the ambient temperature.
[0011] Preferably, the colorimetric detection unit includes a light source module for emitting light of a specific wavelength to illuminate the digestion tube, a photoelectric sensor for capturing the light passing through the digestion tube and converting it into an electrical signal, and a signal processing module for processing and analyzing the electrical signal output by the photoelectric sensor.
[0012] Preferably, the steps of the dynamic neural network temperature compensation algorithm are as follows: 1) Data collection: During the digestion process, a temperature sensor is used to collect temperature data in the digestion tube in real time. , including the temperature changes during the heating and cooling stages of digestion, while also collecting the ambient temperature ,humidity , air pressure As auxiliary input data, ensure the timestamp alignment of multi-sensor data and maintain a stable data acquisition frequency. The sampling interval is recorded as ; 2) Data preprocessing: Use Kalman filtering to smooth the temperature data and remove high-frequency noise. ,in, is the filtered temperature estimate, is the Kalman gain, is the observed value; Introducing the isolation forest algorithm based on machine learning to automatically identify and repair abnormal data; Extracting the temperature change rate of temperature data , peak temperature and heating time , as the basic characteristic of temperature, where is the indicator function, when 1 when it is, otherwise 0; Capture the complex pattern of temperature changes and extract high-order features through Fourier transform frequency domain features or wavelet transform features; Generate more training samples through data interpolation methods to improve the robustness of the model; Normalize the input data. ,in is the mean of the temperature data, The standard deviation ensures that the dimensions of different features are consistent, preventing certain features from having too much influence on the results during model training. 3) Model training: Use convolutional neural networks to process time series data, and introduce long short-term memory networks (LSTMs) to process time series data. ,in is the input of the current time step, is the hidden layer state; The mean square error is used as the loss function to measure the error between the predicted value and the actual value. ,in, is the predicted value, is the actual value, is the sample size; Adopting adaptive optimization algorithm to update weights, , , ,in, and are momentum and second-order momentum, is the learning rate, is the gradient; Introducing L2 regularization, ,in Regularization coefficient, is the weight; K-fold cross validation was used to evaluate the generalization ability of the model; Use historical temperature data to perform multiple iterations of training and adjust the weights and biases of the neural network to minimize the prediction error; 4) Temperature control strategy: During the digestion process, input the current temperature in real time , heating / cooling status and other environmental parameters into the trained BP neural network model, and use the neural network model to predict future temperature changes ; Based on the prediction results, the model predictive control algorithm is used to optimize the output of the heating unit or the heat dissipation unit, and dynamically adjust the heating and cooling power. ,in is the input to control the heating or cooling power, is the target temperature, is the control cost function; Combined with fuzzy logic control algorithm to deal with nonlinear and uncertainty problems; Compare the actual temperature with the predicted temperature and calculate the prediction error. ,If the prediction error is large, adjust the weights and biases of the neural network; 5) Real-time adjustment: In the real-time operation process, the incremental learning mechanism is used to dynamically update the model. ,in, is the new sample gradient, The weight changes for the old model; Forget old data. ,in, is the forgetting rate, is the sample collection time; 6) Model optimization: Introducing adversarial training, ,in is the discriminator, is the noise intensity; Introducing multi-task learning, ,in Predict losses for temperature, is the efficiency loss, is the multi-task consistency loss.
[0013] Preferably, the steps of the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm are as follows: 1) Initialization phase: Neural network initialization: determine the structure of the neural network, including the number of neuron nodes in the input layer, hidden layer, and output layer, and use random initialization or historical data-based initialization methods to initialize the weights and biases of the neural network; Initialize the particle swarm and determine the size of the particle swarm , the dimension of each particle , initialize the position vector of each particle and velocity vector , initialize the individual optimal position of each particle and the global optimal position ; Temperature prediction initialization: Use deep learning models to predict temperature data, obtain temperature change curves for future time periods, and initialize temperature sensitivity factors. , used to adjust the search range and step size of the particle swarm; 2) Fitness function calculation: Define the fitness function , using the mean square error of the neural network as the basic fitness function, ,in, is the true value, is the predicted value of the neural network, is the sample size; Introducing temperature sensitivity factor Modify the fitness function. ,in, is the difference between the current temperature and the reference temperature; Calculate the fitness value of each particle , and update the individual optimal position and the global optimal position ; 3) Particle update phase: According to the number of iterations Dynamically adjust inertia weight and learning factors 、 , , , ; Calculating mutation probability , and according to the random number Determine whether to mutate. ,if , choose Gaussian mutation or non-uniform mutation to mutate the particles, otherwise update the velocity according to the inertia weight; Update the particle's velocity and position, , ,in, 、 is a random number with a value range of ; Introducing temperature sensitivity factor Correct the speed. ; 4) Temperature compensation and neighborhood topology adjustment: According to the real-time collected temperature data, the weights and biases of the neural network are adjusted. , ,in, is the temperature compensation function; Using Temperature Sensitivity Factor Adjust the search range and step size of particles; Dynamically adjust the particle neighborhood topology according to the current temperature range, ,In different temperature ranges, the information sharing weights between particles are dynamically adjusted; 5) Multi-objective optimization: Define a multi-objective fitness function, comprehensively consider the detection accuracy, algorithm convergence speed and robustness, and use the multi-objective particle swarm optimization algorithm to generate a set of Pareto optimal solutions, allowing users to select the most appropriate solution based on actual needs; 6) Parallelization and distributed computing: The particle swarm is divided into multiple sub-swarms, each of which runs the particle swarm optimization algorithm independently and exchanges information regularly; a distributed computing framework is used to parallel process large-scale temperature data; 7) Iteration and convergence judgment: Determine whether the algorithm converges. The convergence condition is that the change in fitness value is less than the set threshold or the maximum number of iterations is reached ; If not converged, return to step 3; if converged, record the current global optimal solution ; 8) Prediction and output stage: Output individual extreme values and group extremes , use neural network to make predictions, combine the temperature compensated data to calculate the final detection value, and output the final detection result.
[0014] The second technical solution adopted by the present invention is as follows: a water quality detection method based on the rapid water quality detector according to any one of claims 1 to 9, characterized in that the steps are as follows: Step 1. Sampling phase: Select representative sampling points based on testing requirements, use clean, uncontaminated containers to collect water samples, add fixatives based on test indicators, and store in a refrigerator or away from light to avoid interference, adsorption, or reaction from contaminants. Step 2. Preprocessing stage: The water sample to be tested and the reaction reagent are sequentially fed into the digestion tube through the quantitative liquid feeding unit, the control unit first starts the heating unit, and accurately controls the heating temperature through the dynamic neural network temperature compensation algorithm. After heating for a predetermined time, the cooling unit is started, and accurately cools the temperature to the set colorimetric detection temperature through the dynamic neural network temperature compensation algorithm; Step 3. Detection and analysis: The absorbance of the digested test water sample is measured by the colorimetric detection unit to obtain an initial value. The control unit calls the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm to correct the initial value, compensate for the influence of temperature on absorbance, obtain the final value, and generate a report including the sampling time, location, detection indicators and conclusions.
[0015] The present invention has the following beneficial effects: 1. High-precision temperature control and resistance to environmental interference: Through the dynamic neural network temperature compensation algorithm, combined with Kalman filtering and isolated forest anomaly repair, the digestion tube temperature control accuracy reaches ±0.5°C, which is higher than the traditional PID control accuracy and maintains temperature stability even under ambient temperature fluctuations of ±10°C; 2. Improved detection accuracy: The temperature-sensitive adaptive multi-objective particle swarm optimization algorithm optimizes the colorimetric detection value correction, significantly reducing the detection error rate; 3. Guaranteed liquid delivery accuracy: The dual quantitative loop design in parallel with the liquid level sensor achieves a reagent addition volume error of ≤0.05mL, which is more accurate than a single-pipeline system and supports the detection of multiple water quality parameters. 4. Enhanced algorithm adaptability: Incremental learning mechanisms and adversarial training enable online updates of the neural network model, maintaining a prediction error of <0.5°C after 200 consecutive tests, significantly improving the long-term stability of the system. 5. Multi-working compatibility: The combination of a multi-way solenoid valve and a forward and reverse peristaltic pump supports automatic switching of multiple reagents, covering the detection of conventional water quality indicators such as COD, total phosphorus, and ammonia nitrogen, and improving the equipment reuse rate; 6. Environmental robustness optimization: The multi-parameter input model of the integrated ambient temperature sensor reduces the impact of external temperature on the detection results, meeting the requirements of a wide temperature range of 2°C to 50°C. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a system block diagram of an embodiment of the present invention.
[0017] Figure 2 Schematic diagram of the piping principle of an embodiment of the present invention.
[0018] Figure 3 4 is a flow chart of a dynamic neural network temperature compensation algorithm in an embodiment of the present invention.
[0019] Figure 4 4 is a flow chart of a temperature-sensitive adaptive multi-objective particle swarm optimization algorithm in an embodiment of the present invention.
[0020] Figure 5 4 is a flow chart of a water quality detection method according to an embodiment of the present invention.
[0021] Digestion tube 1; Quantitative liquid delivery unit 2, multi-way solenoid valve 201, peristaltic pump 202, quantitative loop tube 203, liquid level sensor 204; Heating unit 3; Cooling unit 4; Temperature measuring unit 5; Colorimetric detection unit 6; Control unit 7. DETAILED DESCRIPTION
[0022] The present invention will be further described below in conjunction with the embodiments and drawings.
[0023] In the embodiment, Figure 1 、 Figure 2The figure shows a rapid water quality detector, comprising: a digestion tube 1; a quantitative liquid feeding unit 2 for quantitatively feeding liquid into the digestion tube 1; a heating unit 3 and a cooling unit 4 for heating or cooling the digestion tube 1, respectively; a temperature measuring unit 5 for real-time detection of the temperature of the liquid in the digestion tube 1 and the ambient temperature; a colorimetric detection unit 6 for detecting the absorbance of the liquid in the digestion tube 1 and obtaining an initial measurement value; a control unit 7, comprising a programmable controller, electrically connected to the digestion tube 1, the quantitative liquid feeding unit 2, the heating unit 3, the cooling unit 4, the temperature measuring unit 5, and the colorimetric detection unit 6; the programmable controller integrates a dynamic neural network temperature compensation algorithm and a temperature-sensitive adaptive multi-objective particle swarm optimization algorithm, respectively for precise control of the heating unit 3 and the cooling unit 4 and for optimizing the initial detection value of the colorimetric detection unit 6. This embodiment achieves precise temperature control of ±0.5°C through the coordinated control of the dual algorithms, maintains detection stability under ambient temperature fluctuations of ±10°C, and greatly reduces the error rate compared to traditional methods.
[0024] In the embodiment, Figure 1 、 Figure 2 As shown, the quantitative liquid delivery unit 2 includes: a multi-way solenoid valve 201 with multiple container ports and a common port, the container ports respectively connecting the various drug solution containers and the digestion tube 1; a peristaltic pump 202 capable of forward and reverse liquid delivery, driving the liquid flow; a quantitative loop tube 203 connected between the common port of the multi-way solenoid valve 201 and the peristaltic pump 202; and a liquid level sensor 204 connected between the quantitative loop tube 203 and the peristaltic pump 202 for detecting the liquid level within the quantitative loop tube 203. The quantitative loop tube 203 ensures sample addition accuracy through real-time feedback from the liquid level sensor 204, keeping the reagent addition volume error ≤0.05mL, thereby improving detection accuracy.
[0025] In the embodiment, Figure 1 、 Figure 2 As shown, the quantitative loop tube 203 has two parallel ones. The dual quantitative loop tube 203 configuration can realize the switching of different reagents, and with the forward and reverse liquid feeding functions, it can realize automatic switching of multiple reagents and support the detection of multiple water quality parameters such as COD, ammonia nitrogen, total phosphorus, and total nitrogen.
[0026] In the embodiment, Figure 1 、 Figure 2 As shown, the heating unit 3 includes a heating wire wrapped around the outer wall of the digestion tube 1 and a heating controller that controls the power of the heating wire. The spiral winding structure improves heating efficiency, reaching the digestion temperature within 2 minutes, and the temperature uniformity error of the water sample to be tested is <±3°C.
[0027] In the embodiment, Figure 1 、 Figure 2As shown, the cooling unit 4 includes a heat sink and a fan. The heat sink can be an LED cooling plate. The combined heat dissipation design improves the cooling rate. Combined with the neural network predictive control, the digestion solution can be cooled from the digestion temperature to the detection temperature of 25°C within 5 minutes, ensuring the timeliness of colorimetric detection.
[0028] In the embodiment, Figure 1 、 Figure 2 As shown, the temperature measurement unit 5 includes a temperature sensor inserted into the digestion tube 1 and an external temperature sensor for detecting the ambient temperature. The dual-sensor configuration enables simultaneous monitoring of the digestion solution core temperature and the ambient temperature, providing multi-dimensional data input for the temperature compensation algorithm.
[0029] In the embodiment, Figure 1 、 Figure 2 As shown, the colorimetric detection unit 6 includes a light source module for emitting light of a specific wavelength to illuminate the digestion tube 1, a photosensor for capturing the light that passes through the digestion tube 1 and converting it into an electrical signal, and a signal processing module for processing and analyzing the electrical signal output by the photosensor. The multi-wavelength LED light source supports full spectrum detection from 380 to 650 nm, and combined with a high-precision photodiode, it achieves an absorbance detection resolution of 0.001 Abs.
[0030] In the embodiment, Figure 3 As shown in Figure 2, the specific steps of the dynamic neural network temperature compensation algorithm are as follows: 1) Data collection: During the digestion process, a temperature sensor is used to collect temperature data in the digestion tube in real time. , including the temperature changes during the heating and cooling stages of digestion, while also collecting the ambient temperature ,humidity , air pressure As auxiliary input data, ensure the timestamp alignment of multi-sensor data and maintain a stable data acquisition frequency. The sampling interval is recorded as .
[0031] 2) Data preprocessing: Use Kalman filtering to smooth the temperature data and remove high-frequency noise. ,in, is the filtered temperature estimate, is the Kalman gain, is the observed value; Introducing the isolation forest algorithm based on machine learning to automatically identify and repair abnormal data; Extracting the temperature change rate of temperature data , peak temperature and heating time , as the basic characteristic of temperature, where is the indicator function, when 1 when it is, otherwise 0; Capture the complex pattern of temperature changes and extract high-order features through Fourier transform frequency domain features or wavelet transform features; Generate more training samples through data interpolation methods to improve the robustness of the model; Normalize the input data. ,in is the mean of the temperature data, It is the standard deviation, which ensures that the dimensions of different features are consistent and avoids excessive influence of certain features on the results during model training.
[0032] 3) Model training: Use convolutional neural networks to process time series data, and introduce long short-term memory networks (LSTMs) to process time series data. ,in is the input of the current time step, is the hidden layer state; The mean square error is used as the loss function to measure the error between the predicted value and the actual value. ,in, is the predicted value, is the actual value, is the sample size; Adopting adaptive optimization algorithm to update weights, , , ,in, and are momentum and second-order momentum, is the learning rate, is the gradient; Introducing L2 regularization, ,in Regularization coefficient, is the weight; K-fold cross validation was used to evaluate the generalization ability of the model; The neural network is trained over multiple iterations using historical temperature data to adjust the weights and biases to minimize the prediction error.
[0033] 4) Temperature control strategy: During the digestion process, input the current temperature in real time , heating / cooling status and other environmental parameters into the trained BP neural network model, and use the neural network model to predict future temperature changes ; Based on the prediction results, the model predictive control algorithm is used to optimize the output of the heating unit or the heat dissipation unit, and dynamically adjust the heating and cooling power. ,in is the input to control the heating or cooling power, is the target temperature, is the control cost function; Combined with fuzzy logic control algorithm to deal with nonlinear and uncertainty problems; Compare the actual temperature with the predicted temperature and calculate the prediction error. ,If the prediction error is large, adjust the weights and bias of the neural network.
[0034] 5) Real-time adjustment: In the real-time operation process, the incremental learning mechanism is used to dynamically update the model. ,in, is the new sample gradient, The weight changes for the old model; Forget old data. ,in, is the forgetting rate, is the sample collection time; 6) Model optimization: Introducing adversarial training, ,in is the discriminator, is the noise intensity; Introducing multi-task learning, ,in Predict losses for temperature, is the efficiency loss, is the multi-task consistency loss.
[0035] This embodiment's dynamic neural network temperature compensation algorithm significantly improves the accuracy and adaptability of the temperature compensation system by incorporating dynamic sampling, adaptive optimization algorithms, multi-control strategy fusion, and robustness enhancement techniques. Key formulas cover the entire process, from data preprocessing to online optimization, demonstrating high feasibility.
[0036] In the embodiment, Figure 4 As shown in Figure 2, the steps of the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm are as follows: 1) Initialization phase: Neural network initialization: determine the structure of the neural network, including the number of neuron nodes in the input layer, hidden layer, and output layer, and use random initialization or historical data-based initialization methods to initialize the weights and biases of the neural network; Initialize the particle swarm and determine the size of the particle swarm , the dimension of each particle , initialize the position vector of each particle and velocity vector , initialize the individual optimal position of each particle and the global optimal position ; Temperature prediction initialization: Use deep learning models to predict temperature data, obtain temperature change curves for future time periods, and initialize temperature sensitivity factors. , used to adjust the search range and step size of the particle swarm.
[0037] 2) Fitness function calculation: Define the fitness function , using the mean square error of the neural network as the basic fitness function, ,in, is the true value, is the predicted value of the neural network, is the sample size; Introducing temperature sensitivity factor Modify the fitness function. ,in, is the difference between the current temperature and the reference temperature; Calculate the fitness value of each particle , and update the individual optimal position and the global optimal position .
[0038] 3) Particle update phase: According to the number of iterations Dynamically adjust inertia weight and learning factors 、 , , , ; Calculating mutation probability , and according to the random number Determine whether to mutate. ,if , choose Gaussian mutation or non-uniform mutation to mutate the particles, otherwise update the velocity according to the inertia weight; Update the particle's velocity and position, , ,in, 、 is a random number with a value range of ; Introducing temperature sensitivity factor Correct the speed. ; 4) Temperature compensation and neighborhood topology adjustment: According to the real-time collected temperature data, the weights and biases of the neural network are adjusted. , ,in, is the temperature compensation function; Using Temperature Sensitivity Factor Adjust the search range and step size of particles; Dynamically adjust the particle neighborhood topology according to the current temperature range, ,In different temperature ranges, the information sharing weights between particles are dynamically adjusted.
[0039] 5) Multi-objective optimization: A multi-objective fitness function is defined, which comprehensively considers the detection accuracy, convergence speed and robustness of the algorithm. A multi-objective particle swarm optimization algorithm is used to generate a set of Pareto optimal solutions, allowing users to select the most appropriate solution based on actual needs.
[0040] 6) Parallelization and distributed computing: The particle swarm is divided into multiple sub-groups. Each sub-group runs the particle swarm optimization algorithm independently and exchanges information regularly. A distributed computing framework is used to process large-scale temperature data in parallel.
[0041] 7) Iteration and convergence judgment: Determine whether the algorithm converges. The convergence condition is that the change in fitness value is less than the set threshold or the maximum number of iterations is reached ; If not converged, return to step 3; if converged, record the current global optimal solution .
[0042] 8) Prediction and output stage: Output individual extreme values and group extremes , use neural network to make predictions, combine the temperature compensated data to calculate the final detection value, and output the final detection result.
[0043] The temperature-sensitive adaptive multi-objective particle swarm optimization algorithm of this embodiment reduces the error rate of detection values by dynamically adjusting the particle search range and neighborhood topology structure, and correcting the weights in combination with the temperature compensation function, and improves the consistency of detection results within a wide temperature range of 2°C to 50°C.
[0044] In the embodiment, Figure 5 As shown, the steps of the water quality detection method based on the water quality rapid detector are as follows: Step 1. Sampling phase: Select representative sampling points according to the detection requirements, use clean, non-contaminated containers to collect water samples, add fixatives according to the detection indicators, and store in a refrigerator or away from light to avoid interference, adsorption or reaction from contamination sources.
[0045] Step 2. Preprocessing stage: The water sample to be tested and the reaction reagent are sequentially input into the digestion tube 1 through the quantitative liquid delivery unit 2. The control unit 7 first starts the heating unit 3, and accurately controls the heating temperature through the dynamic neural network temperature compensation algorithm. After heating to the predetermined time, the cooling unit 4 is started again, and the temperature is accurately lowered to the set colorimetric detection temperature through the dynamic neural network temperature compensation algorithm.
[0046] Step 3. Detection and analysis: The absorbance of the digested test water sample is measured by the colorimetric detection unit 6 to obtain an initial value. The control unit 7 calls the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm to correct the initial value, compensate for the influence of temperature on absorbance, obtain the final value, and generate a report including the sampling time, location, detection indicators and conclusions.
[0047] Obviously, the above embodiments of the present invention are merely examples for illustrating the present invention and are not intended to limit the implementation of the present invention. Other obvious changes or modifications derived from the essence of the present invention still fall within the scope of protection of the present invention.
Claims
1. A rapid water quality detector, characterized in that: include: Digestion tube (1); A quantitative liquid delivery unit (2) for quantitatively inputting liquid into the digestion tube (1); The heating unit (3) and the cooling unit (4) are used to heat or cool the digestion tube (1), respectively; A temperature measuring unit (5) is used to detect the temperature of the liquid in the digestion tube (1) and the ambient temperature in real time; A colorimetric detection unit (6) is used to detect the absorbance of the liquid in the digestion tube (1) and obtain an initial measurement value; A control unit (7), comprising a programmable controller, electrically connected to the digestion tube (1), the quantitative liquid delivery unit (2), the heating unit (3), the cooling unit (4), the temperature measurement unit (5), and the colorimetric detection unit (6); The programmable controller integrates a dynamic neural network temperature compensation algorithm and a temperature-sensitive adaptive multi-objective particle swarm optimization algorithm, which are respectively used to achieve precise control of the heating unit (3) and the cooling unit (4) and to optimize the initial detection value of the colorimetric detection unit (6).
2. The rapid water quality detector according to claim 1, characterized in that: The quantitative liquid delivery unit (2) comprises: A multi-way solenoid valve (201) having a plurality of container ports and a common port, wherein the container ports are respectively connected to each of the liquid medicine containers and the digestion tube (1); A peristaltic pump (202) capable of delivering liquid in both directions drives the liquid to flow; A quantitative loop tube (203) connected between the common port of the multi-way solenoid valve (201) and the peristaltic pump (202); A liquid level sensor (204) is connected between the quantitative loop tube (203) and the peristaltic pump (202) and is used to detect the liquid level in the quantitative loop tube (203).
3. The rapid water quality detector according to claim 2, characterized in that: The quantitative loop tube (203) has two or more connected in parallel.
4. The rapid water quality detector according to claim 1, characterized in that: The heating unit (3) comprises a heating wire wound around the outer wall of the digestion tube (1) and a heating controller for controlling the power of the heating wire.
5. The rapid water quality detector according to claim 1, characterized in that: The cooling unit (4) comprises a heat sink and a fan.
6. The rapid water quality detector according to claim 1, characterized in that: The temperature measuring unit (5) comprises a temperature sensor inserted into the digestion tube (1) and an external temperature sensor for detecting the ambient temperature.
7. The rapid water quality detector according to claim 1, characterized in that: The colorimetric detection unit (6) comprises a light source module for emitting light of a specific wavelength to illuminate the digestion tube (1), a photoelectric sensor for capturing the light passing through the digestion tube (1) and converting it into an electrical signal, and a signal processing module for processing and analyzing the electrical signal output by the photoelectric sensor.
8. The rapid water quality detector according to claim 1, characterized in that: The steps of the dynamic neural network temperature compensation algorithm are as follows: 1) Data collection: During the digestion process, a temperature sensor is used to collect temperature data in the digestion tube in real time. , including the temperature changes during the heating and cooling stages of digestion, while also collecting the ambient temperature ,humidity , air pressure As auxiliary input data, ensure the timestamp alignment of multi-sensor data and maintain a stable data acquisition frequency. The sampling interval is recorded as ; 2) Data preprocessing: Use Kalman filtering to smooth the temperature data and remove high-frequency noise. ,in, is the filtered temperature estimate, is the Kalman gain, is the observed value; Introducing the isolation forest algorithm based on machine learning to automatically identify and repair abnormal data; Extracting the temperature change rate of temperature data , peak temperature and heating time , as the basic characteristic of temperature, where is the indicator function, when 1 when it is, otherwise 0; Capture the complex pattern of temperature changes and extract high-order features through Fourier transform frequency domain features or wavelet transform features; Generate more training samples through data interpolation methods to improve the robustness of the model; Normalize the input data. ,in is the mean of the temperature data, The standard deviation ensures that the dimensions of different features are consistent, preventing certain features from having too much influence on the results during model training. 3) Model training: Use convolutional neural networks to process time series data, and introduce long short-term memory networks (LSTMs) to process time series data. ,in is the input of the current time step, is the hidden layer state; The mean square error is used as the loss function to measure the error between the predicted value and the actual value. ,in, is the predicted value, is the actual value, is the sample size; Adopting adaptive optimization algorithm to update weights, , , ,in, and are momentum and second-order momentum, is the learning rate, is the gradient; Introducing L2 regularization, ,in Regularization coefficient, is the weight; K-fold cross validation was used to evaluate the generalization ability of the model; Use historical temperature data to perform multiple iterations of training and adjust the weights and biases of the neural network to minimize the prediction error; 4) Temperature control strategy: During the digestion process, input the current temperature in real time , heating / cooling status and other environmental parameters into the trained BP neural network model, and use the neural network model to predict future temperature changes ; Based on the prediction results, the model predictive control algorithm is used to optimize the output of the heating unit or the heat dissipation unit, and dynamically adjust the heating and cooling power. ,in is the input to control heating or cooling power, is the target temperature, is the control cost function; Combined with fuzzy logic control algorithm to deal with nonlinear and uncertainty problems; Compare the actual temperature with the predicted temperature and calculate the prediction error. ,If the prediction error is large, adjust the weights and biases of the neural network; 5) Real-time adjustment: In the real-time operation process, the incremental learning mechanism is used to dynamically update the model. ,in, is the new sample gradient, The weight changes for the old model; Forget old data. ,in, is the forgetting rate, is the sample collection time; 6) Model optimization: Introducing adversarial training, ,in is the discriminator, is the noise intensity; Introducing multi-task learning, ,in Predict losses for temperature, is the efficiency loss, is the multi-task consistency loss.
9. The rapid water quality detector according to claim 1, characterized in that: The steps of the temperature-sensitive adaptive multi-objective particle swarm optimization algorithm are as follows: 1) Initialization phase: Neural network initialization: determine the structure of the neural network, including the number of neuron nodes in the input layer, hidden layer, and output layer, and use random initialization or historical data-based initialization methods to initialize the weights and biases of the neural network; Initialize the particle swarm and determine the size of the particle swarm , the dimension of each particle , initialize the position vector of each particle and velocity vector , initialize the individual optimal position of each particle and the global optimal position ; Temperature prediction initialization: Use deep learning models to predict temperature data, obtain temperature change curves for future time periods, and initialize temperature sensitivity factors. , used to adjust the search range and step size of the particle swarm; 2) Fitness function calculation: Define the fitness function , using the mean square error of the neural network as the basic fitness function, ,in, is the true value, is the predicted value of the neural network, is the sample size; Introducing temperature sensitivity factor Modify the fitness function. ,in, is the difference between the current temperature and the reference temperature; Calculate the fitness value of each particle , and update the individual optimal position and the global optimal position ; 3) Particle update phase: According to the number of iterations Dynamically adjust inertia weight and learning factors 、 , , , ; Calculating mutation probability , and according to the random number Determine whether to mutate. ,if , choose Gaussian mutation or non-uniform mutation to mutate the particles, otherwise update the velocity according to the inertia weight; Update the particle's velocity and position, , ,in, 、 is a random number with a value range of ; Introducing temperature sensitivity factor Correct the speed. ; 4) Temperature compensation and neighborhood topology adjustment: According to the real-time collected temperature data, the weights and biases of the neural network are adjusted. , ,in, is the temperature compensation function; Using Temperature Sensitivity Factor Adjust the search range and step size of particles; Dynamically adjust the neighborhood topology of the particle according to the current temperature range, ,In different temperature ranges, the information sharing weights between particles are dynamically adjusted; 5) Multi-objective optimization: Define a multi-objective fitness function, comprehensively consider the detection accuracy, algorithm convergence speed and robustness, and use the multi-objective particle swarm optimization algorithm to generate a set of Pareto optimal solutions, allowing users to select the most appropriate solution based on actual needs; 6) Parallelization and distributed computing: The particle swarm is divided into multiple sub-swarms, each of which runs the particle swarm optimization algorithm independently and exchanges information regularly; a distributed computing framework is used to parallel process large-scale temperature data; 7) Iteration and convergence judgment: Determine whether the algorithm converges. The convergence condition is that the change in fitness value is less than the set threshold or the maximum number of iterations is reached ; If not converged, return to step 3; if converged, record the current global optimal solution ; 8) Prediction and output stage: Output individual extreme values and group extremes , use neural network to make predictions, combine the temperature compensated data to calculate the final detection value, and output the final detection result.
10. A water quality detection method based on the rapid water quality detector according to any one of claims 1 to 9, characterized in that: Here are the steps: Step 1. Sampling phase: Select representative sampling points based on testing requirements, collect water samples in clean, uncontaminated containers, add fixatives based on test indicators, and store in a refrigerator or away from light to avoid interference, adsorption, or reaction from contaminants. Step 2. Preprocessing stage: The water sample to be tested and the reaction reagent are sequentially fed into the digestion tube (1) through the quantitative liquid feeding unit (2); the control unit (7) first starts the heating unit (3), and accurately controls the heating temperature through the dynamic neural network temperature compensation algorithm; after heating for a predetermined time, the cooling unit (4) is started, and accurately cools the temperature to the set colorimetric detection temperature through the dynamic neural network temperature compensation algorithm; Step 3. Detection and analysis: The absorbance of the digested test water sample is measured by the colorimetric detection unit (6) to obtain an initial value. The control unit (7) calls a temperature-sensitive adaptive multi-objective particle swarm optimization algorithm to correct the initial value, compensate for the effect of temperature on absorbance, obtain a final value, and generate a report including sampling time, location, detection indicators and conclusions.
Citation Information
Cited By
Intelligent monitoring system for water quality of water supply network
CN120668893A
Intelligent control method, device and equipment for steam crosslinking room and medium
CN121596724A