Water treatment intelligent control method and system based on dynamic prediction and real-time optimization

By using a smart water treatment control method that combines dynamic prediction and real-time optimization with multiple models and technologies, precise chemical dosing control commands are generated, solving the problems of lag and insufficient adaptability of the dosing device, and achieving improved effluent water quality stability and reduced costs.

CN121763979APending Publication Date: 2026-03-31NANJING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing dosing devices rely on human experience and fixed logic control, which cannot achieve intelligent adjustment under changes in water quality and process conditions without pre-setting, resulting in response lag and insufficient adaptability, and failing to achieve timely response with low time delay.

Method used

A smart water treatment control method based on dynamic prediction and real-time optimization is adopted. Through time-series prediction, anomaly monitoring and command generation, command execution and closed-loop learning, combined with ARIMA and Prophet fusion models, isolated forest anomaly detection, LSTM hybrid models and soft measurement technology, precise chemical dosing control commands are generated and real-time optimization is achieved through an embedded smart hardware platform.

Benefits of technology

This has enabled a shift from passive response to proactive prediction in chemical dosing, improving the stability of effluent water quality, significantly reducing chemical consumption and operating costs, enhancing the reliability and anti-interference capabilities of the system, and supporting the refined and intelligent operation of water treatment processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121763979A_ABST
    Figure CN121763979A_ABST
Patent Text Reader

Abstract

The invention discloses a water treatment intelligent control method and system based on dynamic prediction and real-time optimization, and the method comprises the steps: time sequence prediction: predicting the influent pollutant concentration in a future time period, and generating an agent adding control pre-instruction; abnormity monitoring and instruction generation: carrying out abnormity detection on the sensor data; a dosing amount instruction is generated and output; instruction execution and closed-loop learning: executing a dosing amount instruction to perform dosing, and performing online training and optimization on the model; according to the method disclosed by the invention, the change of dosing from passive response to active prediction is realized, the chemical consumption and the operation cost are remarkably reduced while the stability of the effluent quality is improved, and the reliability, the anti-interference performance and the long-term applicability of the system are also greatly enhanced by the enhanced exception handling capacity and the self-adaptive learning mechanism; and an efficient solution is provided for refined and intelligent operation of a water treatment process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water treatment technology, specifically to a smart control method and system for water treatment based on dynamic prediction and real-time optimization. Background Technology

[0002] In modern wastewater treatment systems, chemical dosing equipment plays a crucial role. As a highly efficient and precise chemical dosing device, dosing equipment provides essential chemical support for various wastewater treatment processes through scientific formulation and automatic control. Traditional dosing equipment relies on manual experience. Currently widely used dosing equipment based solely on programmable logic controllers (PLCs) achieves automation based on fixed logic, meaning it must respond based on known or preset conditions. It cannot intelligently adjust dosing strategies under unpredictable changes in water quality and process conditions. In other words, existing PLC-controlled dosing equipment suffers from lag in water quality sensor data acquisition and analysis, failing to provide timely responses with low latency. This results in significant changes in reactor conditions after the calculated dosing adjustment plan, leading to insufficient predictability and adaptability. Therefore, promoting intelligent, integrated, and terminal-based intelligent dosing systems is essential to supporting the intelligent transformation of the water treatment industry and achieving "dual-carbon" goals. Summary of the Invention

[0003] To address the aforementioned problems, this invention provides a smart water treatment control method and system based on dynamic prediction and real-time optimization.

[0004] The intelligent water treatment control method based on dynamic prediction and real-time optimization includes the following steps: S101, Time Series Prediction: In a water treatment system, sensor data from historical periods is collected and input into a time series prediction model to predict the influent water quality for future periods and generate pre-instructions for chemical dosing control; the sensor data includes water quality parameter data and process variable data; S102. Anomaly Monitoring and Command Generation: Real-time acquisition of sensor data and anomaly detection of sensor data; If an anomaly is detected in the sensor data, the water quality parameters are predicted using a soft measurement model, and the first dosage instruction is generated based on the water quality parameters. If there are no abnormalities in the sensor data, the second dosage instruction is generated and output using the sensor data and the drug dosing control pre-instruction as input, and the hybrid prediction model is used; the hybrid prediction model is a hybrid model of long short-term memory network and attention mechanism. S103, Instruction Execution and Closed-Loop Learning: The system controls the dosing equipment to execute the first or second dosing command, and performs online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected by the water treatment system. The sources of the feedback data collected by the water treatment system include the reaction process, online instruments, dosing equipment, and operating environment.

[0005] Explanation: The above method first predicts changes in influent water quality using a time-series model to generate pre-dosing instructions. Then, it utilizes anomaly detection and soft sensing technologies to ensure data reliability, and employs a hybrid LSTM model with an attention mechanism to dynamically generate precise dosing instructions. Finally, execution feedback enables online learning and continuous optimization of the model. This method transforms dosing from a passive response to an active prediction approach, significantly reducing chemical consumption and operating costs while improving effluent water quality stability. Its enhanced anomaly handling capabilities and adaptive learning mechanism also greatly improve the system's reliability, anti-interference ability, and long-term applicability, providing an efficient solution for the refined and intelligent operation of water treatment processes.

[0006] Furthermore, the time series prediction model adopts a fusion model of ARIMA and Prophet; the water quality parameter data includes total phosphorus concentration, chemical oxygen demand concentration, ammonia nitrogen concentration and dissolved oxygen concentration, and the process variable data includes influent flow rate data and influent temperature and pH.

[0007] Note: The above method uses a time series prediction model that combines ARIMA and Prophet, which can fully combine the advantages of the two models. It can make more accurate and robust short- to medium-term predictions of influent water quality (pollutant concentration) for complex and variable influent time series data, focusing on core time series data such as total phosphorus concentration, chemical oxygen demand concentration and influent flow rate.

[0008] Furthermore, the ARIMA and Prophet fusion model is constructed by a weighted fusion of the ARIMA model and the Prophet model; the construction method includes: The inflow time series data is used as input, and the ARIMA model and the Prophet model are run in parallel to obtain the prediction errors of the ARIMA model and the Prophet model, respectively. Based on the prediction error, the weights of the ARIMA model and the Prophet model are dynamically assigned; the model with the smaller prediction error is assigned a higher weight. The predictions from the ARIMA model and the Prophet model are weighted and summed to output the predicted influent water quality (pollutant concentration) for the future period.

[0009] Explanation: The above method runs the ARIMA and Prophet models in parallel and compares their prediction errors in real time. Based on this, the weights are dynamically allocated, enabling the model to adaptively and intelligently select more reliable prediction sources at different stages of water quality data change, thereby significantly improving the overall prediction accuracy, stability and robustness.

[0010] Furthermore, the generated agent dosing control pre-instruction includes: Calculate the predicted pollutant load for the future period based on the influent water quality (pollutant concentration) for the future period; Based on the predicted pollutant load and the reagent dosage coefficient, the predicted reagent dosage and the confidence interval of the predicted reagent dosage are calculated, and the reagent dosage control pre-instruction is generated.

[0011] Explanation: The above method scientifically converts the predicted future influent pollutant concentration into a predicted pollutant load, and then combines this with the chemical dosing coefficient to calculate a predicted chemical dosage that more closely reflects actual treatment needs. By providing a confidence interval for the predicted values, a flexible guidance range is provided that balances expected effects with uncertainties. This allows for fine-tuning during implementation based on risk tolerance, thereby significantly improving the scientific rigor, foresight, and risk resistance of chemical dosing decisions while ensuring water quality meets standards.

[0012] Furthermore, an isolated forest anomaly detection model is used for anomaly detection.

[0013] Note: The isolated forest anomaly detection model is used for real-time monitoring, which can efficiently identify anomalies in multi-dimensional sensor data without the need for preset thresholds.

[0014] Furthermore, the step of using a soft sensor model to predict water quality parameters and generating a first dosage instruction based on these parameters includes: The sensor data is input into the soft sensing model; the soft sensing model is a regression model built on a long short-term memory network, and the output of the soft sensing model is the predicted value of the water quality parameters at the current moment, including total phosphorus concentration and chemical oxygen demand concentration; The predicted water quality parameter values ​​are matched with a preset dosage library; based on the matching result, a first dosage instruction is generated; the preset dosage library stores the mapping relationship between various combinations of water quality parameter values ​​and dosage.

[0015] Note: The above method can analyze other relevant process variable data using a soft sensor model when sensor data is abnormal, and accurately and in real time predict the water quality parameters at the current moment, and generate a reliable first dosage instruction; it ensures that the dosing control decision will not be interrupted or out of control at critical moments of instrument failure or data abnormality, but will smoothly switch to the model-based intelligent standby mode.

[0016] Furthermore, the generation of the second dosage instruction using a hybrid prediction model includes: The sensor data is fused with the drug dosing control pre-instruction to construct a multi-dimensional time-series feature vector; The time-series feature vector is input into the hybrid prediction model; wherein, the long short-term memory network in the hybrid prediction model is used to capture the long-term dynamic dependence between water quality and the dosing process, and the attention mechanism in the hybrid prediction model is used to weight and focus on key mutation information in the input features; the second dosing command is output.

[0017] Explanation: The above method can deeply integrate real-time sensor data with forward-looking pre-instructions for chemical dosing control to construct a comprehensive multi-dimensional temporal feature vector, which is then used by an LSTM hybrid model with an integrated attention mechanism for decision-making. This enables the generated second dosing instruction to not only inherit the predictability based on historical patterns but also to respond agilely and accurately to real-time process changes. In this way, the predictability and adaptability are unified in the dynamic and complex water treatment process, significantly improving the timeliness and accuracy of chemical dosing control, and ultimately optimizing chemical consumption while stabilizing effluent quality.

[0018] Furthermore, the online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected from the water treatment system includes: Based on the feedback data collected by the water treatment system, the anomaly detection model and the hybrid prediction model are incrementally trained. Verify the anomaly detection model and the hybrid prediction model after incremental training. When the performance improvement is confirmed, retain the anomaly detection model and the hybrid prediction model after incremental training.

[0019] Note: The above method incrementally trains and verifies the anomaly detection model and the hybrid prediction model based on real-time feedback data. The entire intelligent dosing system can continuously absorb the latest process operation experience and dynamically adapt to changes in water quality characteristics, equipment status and environmental conditions, thereby effectively avoiding model aging problems.

[0020] The present invention also provides a smart water treatment dosing system based on dynamic prediction and real-time optimization, for realizing a smart water treatment dosing method, including: a data acquisition module, a prediction and pre-control module, an anomaly monitoring and decision-making module, an instruction execution module, and a closed-loop learning module; The data acquisition module is used to collect historical influent time-series data, real-time sensor data, and system feedback data in the water treatment system; the sensor data includes water quality parameter data and process variable data. The prediction and pre-control module is used to predict the influent water quality (pollutant concentration) in future periods based on a time series prediction model and generate pre-instructions for reagent dosing control. The anomaly monitoring and decision-making module is used to detect anomalies in the real-time sensor data and make decisions. The anomaly monitoring and decision-making module is connected to both the data acquisition module and the prediction and pre-control module. When the anomaly detection unit detects data anomalies, the anomaly monitoring and decision-making module uses a soft sensing model to predict water quality parameters and generates a first dosage instruction based on these parameters. When the anomaly detection unit does not detect data anomalies, the anomaly monitoring and decision-making module uses the water quality data from the real-time sensor data and the pre-instruction for drug dosing control as inputs to generate a second dosage instruction using a hybrid prediction model. The hybrid prediction model employs a hybrid model combining a long short-term memory network and an attention mechanism. The instruction execution module is connected to the anomaly monitoring and decision-making module, and is used to receive and execute the first dosage instruction or the second dosage instruction to control the action of the dosing device. The closed-loop learning module is connected to the data acquisition module, the prediction and pre-control module, and the anomaly monitoring and decision-making module, respectively, and is used to perform online training and optimization of the time series prediction model and the hybrid prediction model based on the feedback data collected by the water treatment system.

[0021] Note: The above system integrates several advanced technologies, including dynamic weighted fusion prediction, anomaly detection based on isolated forest, LSTM soft measurement prediction, attention mechanism-enhanced hybrid prediction model, and incremental online learning, into a collaborative architecture. This enables the system to not only achieve a paradigm shift from "passive response" to "active prediction and real-time optimization," but also possesses strong anti-interference and adaptive evolution capabilities. Ultimately, while ensuring stable effluent quality compliance, it significantly reduces chemical consumption and operation and maintenance costs, and greatly improves the intelligence level, operational reliability, and long-term economic efficiency of the water treatment process.

[0022] Furthermore, the data acquisition module, the anomaly monitoring and decision-making module, and the instruction execution module are integrated into an embedded intelligent hardware platform with an STM32H7 series dual-core microcontroller as its core; the system also includes a visualization platform that is communicatively connected to the embedded intelligent hardware platform and is used to provide a human-computer interaction interface.

[0023] Description: The embedded hardware integration centered on the STM32H7 dual-core microcontroller achieves high coordination and extremely low latency in key control loops, ensuring the system's real-time and rapid response to water quality changes and operational reliability. Simultaneously, edge-side embedded deployment reduces the system's dependence on the upper-level central processing unit, enhancing its independence and robustness. The equipped visualization platform provides an intuitive and user-friendly interface, making the process status transparent and greatly facilitating monitoring, intervention, and data analysis by operators. This enables the realization of stable, reliable, easy-to-deploy, and easy-to-operate industrial applications, transforming intelligent algorithms into practical solutions.

[0024] The beneficial effects of this invention are: This invention's method predicts influent water quality changes using a time-series model, generating pre-dosing instructions. It then utilizes anomaly detection and soft sensing technologies to ensure data reliability, and employs an LSTM hybrid model with an attention mechanism to dynamically generate precise dosing instructions. Finally, execution feedback enables online learning and continuous optimization of the model. This method transforms dosing from a passive response to proactive prediction, significantly reducing chemical consumption and operating costs while improving effluent water quality stability. Its enhanced anomaly handling capabilities and adaptive learning mechanism also greatly improve the system's reliability, anti-interference ability, and long-term applicability, providing an efficient solution for the refined and intelligent operation of water treatment processes. Attached Figure Description

[0025] Figure 1 This is a schematic diagram of a water treatment system according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the control system flow according to an embodiment of the present invention; Figure 3 This is an illustration of the drug dosing visualization platform according to an embodiment of the present invention. Detailed Implementation

[0026] To further illustrate the methods and effects of this invention, the technical solution of this invention will be clearly and completely described below in conjunction with experiments.

[0027] As can be seen from the background technology, although existing intelligent dosing systems have made significant progress in sewage treatment, industrial wastewater treatment and other fields, the following core problems remain unresolved: (1) Dosing devices rely on manual or PLC program calculations, depending on fixed formulas and empirical values, resulting in insufficient programming flexibility and lack of support for direct integration of artificial intelligence algorithms (such as neural networks and fuzzy control), making it difficult to achieve adaptive control; (2) Slow instrument signal feedback prevents the equipment from achieving a completely real-time response. The intelligent dosing system of this invention obtains real-time data through a rapid detection device, predicts data in advance based on a water quality prediction algorithm, and predicts the optimal dosing strategy based on an edge-integrated machine learning model to achieve precise dosing of the dosing device, thereby achieving cost reduction, energy saving, and water quality stabilization.

[0028] This research suggests that developing a smart dosing system that combines AI algorithms to dynamically adjust the dosage, and using IoT technology to enable remote monitoring, fault warning, parameter adjustment, and remote maintenance of the dosing equipment; the AI ​​algorithm platform integrates historical water quality and operational data, and uses machine learning to predict water quality change trends, which can provide a scientific basis for process optimization, reduce dosing amount, equipment cost, and labor cost, and improve equipment compatibility.

[0029] To address this issue, this invention proposes a smart dosing system for water treatment based on dynamic prediction and real-time optimization closed-loop. The model analyzes multi-dimensional time-series data to predict water quality change trends, integrates the prediction results with a reinforcement learning decision-making algorithm, dynamically generates the optimal dosing strategy, and ultimately achieves precise control through an actuator. This invention reconstructs the interaction logic between machine learning and the control system from multiple dimensions, including prediction reliability modeling, control timing determination, and execution risk avoidance, realizing a paradigm shift from passive response to proactive pre-control. Field tests show that the system can autonomously optimize the dosing strategy based on changes in influent water quality without human intervention, reducing overall chemical consumption by 22% and increasing the effluent compliance rate to 99.6%. Specific details of this invention are illustrated in the following embodiments; Example 1: A smart water treatment control method based on dynamic prediction and real-time optimization, comprising the following steps: S101, Time Series Prediction: In a water treatment system, sensor data from historical periods is collected and input into a time series prediction model to predict the influent water quality for future periods and generate pre-instructions for chemical dosing control; the sensor data includes water quality parameter data and process variable data; In this embodiment, the influent water quality specifically includes the total phosphorus concentration and chemical oxygen demand concentration of the influent; in other embodiments, it also includes the ammonia nitrogen concentration and dissolved oxygen concentration. The time series prediction model adopts a fusion model of ARIMA and Prophet; the water quality parameter data includes total phosphorus concentration, chemical oxygen demand concentration, ammonia nitrogen concentration and dissolved oxygen concentration, and the process variable data includes influent flow rate data, influent temperature and pH; The ARIMA and Prophet fusion model is constructed by a weighted fusion of the ARIMA model and the Prophet model; the construction method includes: 1) Obtain the inflow time series data as input, run the ARIMA model and the Prophet model in parallel, and obtain the prediction errors of the ARIMA model and the Prophet model respectively; 2) Based on the prediction error, dynamically assign weights to the ARIMA model and the Prophet model; wherein, the model with the smaller prediction error is assigned a higher weight; 3) The predicted values ​​of the ARIMA model and the Prophet model are weighted and summed to output the predicted influent water quality (pollutant concentration) for the future period.

[0030] Specifically, the ARIMA model processes the influent time-series data through its differential integrated moving average module to eliminate seasonal fluctuations; the Prophet model analyzes the flow abrupt change points in the historical data; based on the prediction errors of the ARIMA model and the Prophet model within the most recent sliding time window, the weights of each model are dynamically calculated and allocated, so that the model with the lower prediction error occupies a higher weight in the final fusion output (e.g., 0.8), to ensure that the ARIMA model dominates the prediction during periods of stable water quality changes, and the Prophet model dominates the prediction when abrupt changes occur; the outputs of the ARIMA model and the Prophet model are weighted and fused to generate a predicted value (confidence interval ± 5%) and its confidence interval for the influent pollutant concentration in the next 2 hours; The generated agent dosing control pre-instruction includes: Ⅰ. Calculate the predicted pollutant load for the future period based on the influent water quality in the future period; II. Based on the predicted pollutant load and the reagent dosage coefficient, calculate the predicted reagent dosage and the confidence interval of the predicted reagent dosage, and generate the reagent dosage control pre-instruction; Specifically, the predicted pollutant load is calculated based on the output influent water quality for the future period (i.e., the total phosphorus concentration and chemical oxygen demand concentration of the influent) and the predicted influent flow rate for the corresponding period (i.e., multiplication). Next, the basic predicted reagent dosage is calculated based on this predicted load and a preset or self-learned reagent dosage coefficient (characterizing the dosage required to remove a unit of pollutant). Then, a safety feedforward compensation amount is dynamically determined by combining the confidence interval (e.g., ±5%) attached to the predicted value (e.g., the wider the confidence interval or the higher the predicted value, the larger the compensation coefficient), and this is superimposed on the basic predicted dosage. This generates a pre-command for reagent dosing control that includes an active safety margin and is used to proactively drive the dosing pump.

[0031] S102. Anomaly Monitoring and Command Generation: The system acquires sensor data in real time and performs anomaly detection on the sensor data; the sensor data includes water quality parameter data and process variable data; an isolated forest anomaly detection model is used for anomaly detection. For example, the Isolation Forest anomaly detection model constructs 1000 randomly divided binary trees. When the Mahalanobis distance between the sensor data and the historical distribution baseline exceeds 3σ, it is identified as an anomaly and triggers a three-level response mechanism. The primary response initiates a sliding window mean filter (window width 30 seconds) to eliminate transient interference. The intermediate response activates a soft measurement regression model based on historical process data (input variables include pH, temperature, and flow time series characteristics), and uses an Extreme Learning Machine (ELM) network to predict key indicators such as total phosphorus / COD in real time (prediction error <8%). The advanced response switches to the safety control strategy library and calls a preset reagent dosing curve to maintain system operation. ①If anomalies are detected in the sensor data, the water quality parameters are predicted using a soft sensing model, and the first dosage instruction is generated based on the water quality parameters; Specifically, the step of using a soft sensor model to predict water quality parameters and generating a first dosage instruction based on these parameters includes: The sensor data is input into a soft sensing model; the soft sensing model is a regression model built on a long short-term memory network, and the output of the soft sensing model is a predicted value of the water quality parameters at the current moment, including total phosphorus concentration and chemical oxygen demand concentration; in some embodiments, the water quality parameters also include ammonia nitrogen concentration and dissolved oxygen concentration. The predicted water quality parameter values ​​are matched with a preset dosage library; based on the matching result, a first dosage instruction is generated; the preset dosage library stores the mapping relationship between various combinations of water quality parameter values ​​and dosage.

[0032] Specifically, real-time sensor data (such as influent flow rate, reaction tank pH, temperature, etc.) is input into a pre-trained soft sensing model. This model is constructed using a long short-term memory network and can output predicted values ​​of water quality parameters at the current moment based on these auxiliary variables. Then, the system matches these predicted values ​​with a preset dosage library, which stores the mapping relationship between various combinations of total phosphorus and chemical oxygen demand concentrations and their corresponding safe dosages. The matching process is achieved by finding the closest combination or by interpolation calculation. Finally, a conservative and safe first dosage instruction is generated based on the matching results to ensure that the system can maintain basic stable operation during sensor anomalies and avoid water quality exceeding standards or equipment damage. ② If there are no abnormalities in the sensor data, the second dosage instruction is generated and output using the sensor data and the drug dosing control pre-instruction as inputs, and the hybrid prediction model is used; the hybrid prediction model is a hybrid model of long short-term memory network and attention mechanism. The generation of the second dosage instruction using a hybrid prediction model includes: The sensor data is fused with the drug dosing control pre-instruction to construct a multi-dimensional time-series feature vector; The time-series feature vector is input into the hybrid prediction model; wherein, the long short-term memory network in the hybrid prediction model is used to capture the long-term dynamic dependence between water quality and the dosing process, and the attention mechanism in the hybrid prediction model is used to weight and focus on key mutation information in the input features; the second dosing command is output.

[0033] Specifically, fusing sensor data with pre-commands for drug dosing control refers to concatenating the time-series sequence of water quality parameters in the sensor data with the pre-command values ​​for drug dosing control to form the multi-dimensional time-series feature vector. The hybrid prediction model is an encoder structure, wherein the long short-term memory network constitutes the main body of the encoder and is used to encode the time-series feature vector. The attention mechanism is applied to the hidden states of all time steps output by the long short-term memory network to calculate the attention weights of each time step and generate a context vector. Based on the context vector, the hybrid prediction model outputs the second dosing command sequence for the next rolling time window.

[0034] For example, the LSTM-Transformer hybrid model captures the long-term dependence of water quality changes (memory gate decay coefficient 0.85), while the Transformer's self-attention mechanism (8 attention layers) focuses on key mutation features. Taking the influent pollutant concentration, water temperature, and dissolved oxygen in the reaction tank as inputs, it outputs the minimum effective dosage of reagents for the next 15 minutes. After dynamic optimization by the particle swarm optimization (PSO) algorithm, the dosing command is generated, which reduces the amount of reagents used by about 30% compared to traditional PID control.

[0035] S103, Instruction Execution and Closed-Loop Learning: The system controls the dosing equipment to execute the first or second dosing command, and performs online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected by the water treatment system. The sources of the feedback data collected by the water treatment system include the reaction process, online instruments, dosing equipment, and operating environment.

[0036] The online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected from the water treatment system includes: Based on the feedback data collected by the water treatment system, the anomaly detection model and the hybrid prediction model are incrementally trained. The anomaly detection model and the hybrid prediction model after incremental training are verified. If the verification confirms performance improvement, the anomaly detection model and the hybrid prediction model after incremental training are retained. If the verification does not confirm performance improvement, incremental training continues.

[0037] For example, combining the above content, the closed-loop learning ecosystem of the model iteration system in this invention is constructed as follows: The online model serves as the core of the system's initial operation, loading a pre-trained LSTM basic network (initial weights derived from tens of thousands of historical operating condition data). During the entire dosing reaction cycle (influent → mixing → sedimentation → effluent), four key datasets are collected in real time: process dataset (collecting specific indicator curves of the reaction tank every second), instrument dataset (parallel detection results of high-precision electrodes and microfluidic chips), equipment dataset (dosing pump start / stop count / power consumption curve), and environmental dataset (temperature / humidity fluctuations). Fourth-order optimization is performed through a dual-redundant host computer at the edge layer. Process: ① Data cleaning: Density-based clustering (DBSCAN, ε=0.5) is used to remove outliers, and linear interpolation is used to repair missing segments; ② Feature engineering: Lag features (mean of the first 60 seconds), differential features (turbidity change rate), and cross features (pH and temperature product term) are constructed to expand the input vector to 128 dimensions; ③ Incremental training: New data is added daily to trigger online model fine-tuning (learning rate 0.001, batch size 64); ④ Model validation: The new and old models are run in parallel in the shadow model. When the drug prediction error of the optimized model on the validation set (data from the most recent 72 hours) is lower than that of the online model by 1.5 percentage points, a hot switch is triggered. Soft measurement technology enables data resilience: A long short-term memory regression network (LSTM) is constructed, which takes measurable auxiliary variables (influent flow rate, reactor mixer current or dosing pipe pressure) as input and outputs virtual instrument values ​​(such as total phosphorus concentration). During the training phase, a generative adversarial network (GAN) is used to synthesize 5,000 sets of abnormal operating condition samples to enhance the generalization ability. During the deployment phase, the data is compared with physical instrument data every 5 minutes. When the deviation exceeds 12% for 3 consecutive times, the sensor calibration procedure is initiated.

[0038] Data-driven closed-loop system enables continuous evolution: The system generates a model health report every 8 hours (including feature importance ranking, confusion matrix, and mean absolute error curve). When the influent load pattern changes abruptly (KL divergence > 0.25), a retraining request is automatically initiated. Cloud blade servers schedule GPU nodes to perform deep training, using transfer learning technology to retain the original feature extraction layer and reconstruct the fully connected layer to adapt to the new operating conditions. After the updated model is verified by A / B testing to improve the drug-saving rate, it is distributed to edge nodes through an encrypted channel. The entire process forms an autonomous optimization ecosystem of "real-time perception → edge computing → cloud evolution → strategy deployment", ensuring that the dosing system maintains optimal performance throughout its entire lifecycle.

[0039] This invention also provides a smart water treatment dosing system based on dynamic prediction and real-time optimization to implement the above method, including: a data acquisition module, a prediction and pre-control module, an anomaly monitoring and decision-making module, an instruction execution module, and a closed-loop learning module; The data acquisition module is used to collect sensor data and system feedback data in the water treatment system; the sensor data includes water quality parameter data and process variable data. The prediction and pre-control module is used to predict the influent water quality (pollutant concentration) in future periods based on a time series prediction model and generate pre-instructions for reagent dosing control. The anomaly monitoring and decision-making module is used to detect anomalies in the real-time sensor data and make decisions. The anomaly monitoring and decision-making module is connected to both the data acquisition module and the prediction and pre-control module. When the anomaly detection unit detects data anomalies, the anomaly monitoring and decision-making module uses a soft sensing model to predict water quality parameters and generates a first dosage instruction based on these parameters. When the anomaly detection unit does not detect data anomalies, the anomaly monitoring and decision-making module uses the water quality data from the real-time sensor data and the pre-instruction for drug dosing control as inputs to generate a second dosage instruction using a hybrid prediction model. The hybrid prediction model employs a hybrid model combining a long short-term memory network and an attention mechanism. The aforementioned algorithmic mechanisms are based on time series models such as (ARIMA, Prophet) to predict future influent loads and increase the dosage in advance to ensure removal rates; they also use models such as Isolation Forest to identify abnormal data and trigger backup strategies. When sensors malfunction, AI maintains the stable operation of the dosing system based on water quality index predictions to avoid pesticide waste; and they use models such as (LSTM, Transformer) to predict water quality changes and calculate the minimum effective dosage in advance to reduce pesticide usage, thereby improving dosing accuracy from multiple aspects.

[0040] The instruction execution module is connected to the anomaly monitoring and decision-making module, and is used to receive and execute the first dosage instruction or the second dosage instruction to control the action of the dosing device. The closed-loop learning module is connected to the data acquisition module, the prediction and pre-control module, and the anomaly monitoring and decision-making module, respectively, and is used to perform online training and optimization of the time series prediction model and the hybrid prediction model based on the feedback data collected by the water treatment system.

[0041] The data acquisition module, the anomaly monitoring and decision-making module, and the instruction execution module are integrated into an embedded intelligent hardware platform based on an STM32H7 series dual-core microcontroller; the embedded intelligent hardware platform includes the following (1) to (4): (1) A high-precision data acquisition unit, which is directly connected to the microfluidic chip and the high-precision electrode through a flexible circuit board with a wiring distance of less than 5 cm, and combined with a constant current drive and temperature compensation model, is used to acquire the sensor data; (2) Dual-core parallel processing unit, built on the M7 core and M4 core of the STM32H7 series microcontroller, wherein the M7 core is configured to run the hybrid prediction model and control algorithm, and the M4 core is configured to handle communication protocol parsing; the two cores exchange data through direct memory access and double-buffered static random access memory queue; (3) Multi-protocol fusion communication unit, which integrates RS485, CAN, Ethernet and LoRaWAN physical interfaces, and has a built-in dynamic protocol identification engine to realize communication with the visualization platform, cloud server and field heterogeneous devices; (4) Real-time control output unit, connected to the dosing pump, directly generates pulse width modulation wave through timer hardware or outputs analog quantity through digital-to-analog converter, used to execute the first or second dosing quantity command; self-developed intelligent hardware based on STM32 receives and processes detection data, improves the accuracy of data detection, adapts to the visual operation platform of intelligent hardware, issues real-time commands to the equipment, and improves the response speed; at the same time, it integrates a variety of communication interfaces to facilitate various types of communication.

[0042] Combination Figure 1 and Figure 2 As shown, the system further includes a visualization platform that communicates with the embedded intelligent hardware platform and provides a human-machine interface. A bidirectional lightweight data channel is constructed: downlink commands are encapsulated and parsed using JSON-MQTT, and uplink data is compressed using MsgPack and pushed via WebSocket. Low-level status is directly read using a register mapping table (e.g., 0x2000_0000 corresponds to the pump status word), and data is converted to Protobuf format based on the EmbeddedProto library, ensuring compatibility with mainstream configuration software. The front-end uses the LVGL framework to develop a low-memory UI (<50KB), with operation response latency controlled within 200 ms. The visualization platform is planned to use the Kunlun Tongtai series visualization panel framework, web-based, and use this as the basis for creating the visualization interface for the intelligent dosing device. It is also considered to incorporate it into the intelligent platform for water quality risk control equipment as a subsystem. The high-precision instrument is composed of a microfluidic chip and high-precision electrodes. Furthermore, the visualization interface adopts a "one core, three-tier" architecture: the core interaction layer is based on the Kunlun Tongtai MCGS Pro framework and is developed for cross-platform access through web-based transformation (HTML5 + WebGL); the data display layer integrates four major functional modules: real-time monitoring, historical analysis, device control, and alarm management, and adopts a responsive grid layout (12-column grid system) to adapt to desktop / mobile terminals; the backend service layer deploys an OPC UA server and an MQTT message broker to establish a bidirectional communication channel with STM32 hardware and edge computing nodes. Figure 3As shown, the specific module composition is as follows: The real-time monitoring view displays the process flow diagram in the center (SVG vector graphics dynamically render the dosing pipeline, reaction tank, and sensor nodes), and overlays real-time water quality parameter curves (line graph and instrument panel dual view linkage, supporting multiple indicators such as phosphate / COD / turbidity on the same screen); the equipment control panel is located on the left, including the dosing pump start / stop button, flow setting slider (0-100% stepless speed adjustment), intelligent / manual mode switch, and emergency stop red mushroom button; the historical analysis module has an embedded time range selector (yesterday / this week / custom) on the right, which can generate a chemical consumption bar chart and a water quality compliance rate trend line (ECharts driven); the alarm management area is displayed floating at the bottom, divided into three priority levels (critical-red / warning-yellow / hint-blue), and clicking on an item will pop up a fault location map (highlighting abnormal equipment nodes) and handling instructions; the system management menu is hidden in the top navigation bar, providing user permission allocation (operator / engineer / administrator three levels), data export (Excel / PDF), and diagnostic log download functions. All controls support touchscreen gestures (press and hold for 3 seconds to activate advanced settings), and the memory usage of interface elements is strictly controlled to within 50KB.

[0043] As a preferred method, the data acquisition utilizes microfluidic technology to construct a microfluidic reaction system to accelerate water quality detection and improve real-time data acquisition efficiency. This method abandons the traditional long-distance signal transmission architecture and adopts a direct connection scheme for microfluidic chips (FPC wiring <5 cm) combined with constant current drive, which can significantly reduce noise interference. On this basis, a multi-sensor fusion algorithm was independently developed, which dynamically loads the covariance matrix in Kalman filtering to the edge computing unit and introduces a temperature compensation model, so that the detection accuracy reaches ±0.05 mg / L (better than the national standard by 2 times) and the reagent dosing error is controlled within 3%.

[0044] For industrial scenarios with high real-time requirements, a dosage instruction mechanism and a dual-core task isolation architecture are proposed: the M7 core focuses on running filtering and control algorithms, while the M4 core independently handles protocol parsing, and the data is transferred with zero copying by DMA and dual-buffered SRAM queues; at the same time, the TIMER hardware directly outputs PWM waves and a 12-bit DAC quickly drives the metering pump, ensuring that the latency from sampling to execution is less than 100 ms, which meets the precise control requirements under complex working conditions.

[0045] At the communication level, this system breaks through the limitations of traditional single interfaces, integrating multiple protocols such as RS485 / Modbus RTU, CAN 2.0B / CANopen, Ethernet (Modbus TCP / MQTT) and LoRaWAN. It also independently developed a dynamic protocol recognition engine—based on the automatic matching and parsing mode of the first byte feature code, combined with a unified data encapsulation structure (including sensor ID, calibration parameters, and timestamps)—to achieve plug-and-play and seamless networking of heterogeneous devices.

[0046] Based on the above system design, this invention essentially provides a reactor intelligent control system for adaptive dosing based on artificial intelligence algorithms. It comprises four parts: a fast-response water quality sensor, STM32-based intelligent control hardware, a water quality prediction and early warning machine learning algorithm, and a visualization platform. By fusing data from multiple sources, including users, R&D personnel, and production personnel, sufficient water quality index data is provided to establish a complete database. The algorithm platform is iteratively trained to achieve early water quality prediction and early warning. The STM32-based intelligent hardware receives and processes the detection data and performs water quality prediction and early warning through the algorithm. Based on the water quality prediction results and treatment targets, the optimal dosing strategy is calculated. The system also features a visualization operation platform adapted to the intelligent hardware, issuing real-time commands to the equipment.

[0047] In summary, this invention achieves deep coupling and redefinition between high-precision signal chain design, hardware-accelerated control flow scheduling, and multi-protocol fusion communication, forming an embedded control system with an autonomous logical closed loop. The measured overall efficiency of reagent dosing is improved by 35%, verifying the practical value of system-level innovation.

Claims

1. A smart water treatment control method based on dynamic prediction and real-time optimization, characterized in that, Includes the following steps: S101, Time Series Prediction: In a water treatment system, sensor data from historical periods is collected and input into a time series prediction model to predict the influent water quality for future periods and generate pre-instructions for chemical dosing control; the sensor data includes water quality parameter data and process variable data; S102. Anomaly Monitoring and Command Generation: Real-time acquisition of sensor data and anomaly detection of sensor data; If an anomaly is detected in the sensor data, the sensor data is used as input to predict water quality parameters using a soft measurement model. Based on the water quality parameters, the first dosage instruction is generated. If there are no abnormalities in the sensor data, the second dosage instruction is generated and output using the sensor data and the drug dosing control pre-instruction as input, and the hybrid prediction model is used; the hybrid prediction model is a hybrid model of long short-term memory network and attention mechanism. S103, Instruction Execution and Closed-Loop Learning: The system controls the dosing equipment to execute the first or second dosing command, and performs online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected by the water treatment system. The sources of the feedback data collected by the water treatment system include the reaction process, online instruments, dosing equipment, and operating environment.

2. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The time series prediction model adopts a fusion model of ARIMA and Prophet; the water quality parameter data includes total phosphorus concentration, chemical oxygen demand concentration, ammonia nitrogen concentration and dissolved oxygen concentration, and the process variable data includes influent flow rate data, influent temperature and pH.

3. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The ARIMA and Prophet fusion model is constructed by a weighted fusion of the ARIMA model and the Prophet model; the construction method includes: Using historical sensor data as input, the ARIMA model and the Prophet model are run in parallel to obtain the prediction errors of the ARIMA model and the Prophet model, respectively. Based on the prediction error, the weights of the ARIMA model and the Prophet model are dynamically assigned; the model with the smaller prediction error is assigned a higher weight. The predicted values ​​from the ARIMA model and the Prophet model are weighted and summed to output the predicted influent water quality for the future period.

4. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The generated agent dosing control pre-instruction includes: Calculate the predicted pollutant load for the future period based on the influent water quality for the future period; Based on the predicted pollutant load and the reagent dosage coefficient, the predicted reagent dosage and the confidence interval of the predicted reagent dosage are calculated, and the reagent dosage control pre-instruction is generated.

5. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, An anomaly detection model using isolated forests is employed.

6. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The process of predicting water quality parameters using a soft sensor model and generating a first dosage instruction based on those parameters includes: The sensor data is input into the soft sensing model; the soft sensing model is a regression model built on a long short-term memory network, and the output of the soft sensing model is the predicted value of the water quality parameters at the current moment; The predicted water quality parameter values ​​are matched with a preset dosage library; based on the matching result, a first dosage instruction is generated; the preset dosage library stores the mapping relationship between various combinations of water quality parameter values ​​and dosage.

7. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The generation of the second dosage instruction using a hybrid prediction model includes: The sensor data is fused with the drug dosing control pre-instruction to construct a multi-dimensional time-series feature vector; The time-series feature vector is input into the hybrid prediction model; wherein, the long short-term memory network in the hybrid prediction model is used to capture the long-term dynamic dependence between water quality and the dosing process, and the attention mechanism in the hybrid prediction model is used to weight and focus on the key mutation information in the input, and then output the second dosing command.

8. The intelligent water treatment control method based on dynamic prediction and real-time optimization as described in claim 1, characterized in that, The online training and optimization of the time series prediction model and the hybrid prediction model based on feedback data collected from the water treatment system includes: Based on the feedback data collected by the water treatment system, the anomaly detection model and the hybrid prediction model are incrementally trained. The anomaly detection model and the hybrid prediction model after incremental training are verified. If the verification confirms performance improvement, the anomaly detection model and the hybrid prediction model after incremental training are retained. If the verification does not confirm performance improvement, incremental training continues.

9. A smart water treatment control system based on dynamic prediction and real-time optimization, used to implement the control method described in any one of claims 1 to 8, characterized in that, include: The module includes a data acquisition module, a prediction and pre-control module, an anomaly monitoring and decision-making module, an instruction execution module, and a closed-loop learning module. The data acquisition module is used to collect sensor data and system feedback data in the water treatment system; the sensor data includes water quality parameter data and process variable data. The prediction and pre-control module is used to predict the influent water quality in future periods based on a time series prediction model and generate pre-instructions for chemical dosing control. The anomaly monitoring and decision-making module is used to detect anomalies in the real-time sensor data and make decisions. The anomaly monitoring and decision-making module is connected to both the data acquisition module and the prediction and pre-control module. When the anomaly detection unit detects data anomalies, the anomaly monitoring and decision-making module uses a soft sensing model to predict water quality parameters and generates a first dosage instruction based on these parameters. When the anomaly detection unit does not detect data anomalies, the anomaly monitoring and decision-making module uses the water quality data from the real-time sensor data and the pre-instruction for drug dosing control as inputs to generate a second dosage instruction using a hybrid prediction model. The hybrid prediction model employs a hybrid model combining a long short-term memory network and an attention mechanism. The instruction execution module is connected to the anomaly monitoring and decision-making module and is used to receive and execute the first dosage instruction or the second dosage instruction to control the action of the dosing device. The closed-loop learning module is connected to the data acquisition module, the prediction and pre-control module, and the anomaly monitoring and decision-making module, respectively, and is used to perform online training and optimization of the time series prediction model and the hybrid prediction model based on the feedback data collected by the water treatment system.

10. The intelligent water treatment control system based on dynamic prediction and real-time optimization as described in claim 9, characterized in that, The data acquisition module, the anomaly monitoring and decision-making module, and the instruction execution module are integrated into an embedded intelligent hardware platform with an STM32H7 series dual-core microcontroller as its core; the system also includes a visualization platform that is communicatively connected to the embedded intelligent hardware platform and is used to provide a human-computer interaction interface.