Intelligent dosing control method, device and equipment of magnetic coagulation system and storage medium
By collecting and processing real-time data from multiple sections of the magnetic coagulation process, and using a multi-scale attention-based temporal deep learning model to predict the dosage of chemicals, the lag problem of existing magnetic coagulation dosing control systems has been solved, achieving rapid response and precise control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
Existing magnetic coagulation dosing control systems suffer from problems such as delayed dosing adjustments, excessive effluent quality, or overdosing of chemicals when influent water quality fluctuates suddenly due to limited data acquisition dimensions, insufficient temporal feature extraction capabilities, and the inability of models to dynamically respond to changes in operating conditions.
Real-time process data from multiple sections of the magnetic coagulation process are collected. Standardized time-series data are generated through data cleaning and standardization. Feature selection and auxiliary feature construction are performed. A multi-scale attention-based temporal deep learning model is used to predict the dosage of chemicals. Based on the effluent water quality indicators, the operating condition level is determined and chemical dosing control instructions are generated.
It enables rapid response and accurate prediction of sudden changes in water quality, ensuring timely adjustment of dosing strategies under different operating conditions, avoiding excessive effluent quality and overdosing of chemicals, and reducing operating costs.
Smart Images

Figure CN121786728A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chemical dosing in magnetic coagulation systems, and particularly to an intelligent chemical dosing control method, apparatus, equipment, and storage medium for magnetic coagulation systems. Background Technology
[0002] Magnetic coagulation is a core technology for removing suspended solids and total phosphorus in the field of advanced wastewater treatment. Its treatment effect is highly dependent on the precise dosing of agents such as polyferric sulfate, polyacrylamide, and magnetic powder. In actual operation, wastewater treatment plants generally face a core challenge: when the influent water quality fluctuates suddenly due to factors such as industrial wastewater impact or heavy rain, existing dosing control systems cannot adjust the agent dosage in a timely and accurate manner, leading to effluent water quality exceeding standards or excessive agent dosing.
[0003] The root cause of this problem lies in the fact that existing control systems have systemic defects in three aspects: data perception, feature extraction, and predictive modeling. These three aspects restrict each other and form a vicious cycle.
[0004] At the data sensing level, existing systems only collect limited parameters such as influent suspended solids concentration and effluent turbidity, failing to cover key process nodes such as sedimentation zone sludge level, reagent reaction concentration, and hydraulic retention time. This one-sided data acquisition mode prevents the control system from obtaining complete state information of the magnetic coagulation reaction.
[0005] At the feature extraction level, existing systems use fixed time windows and moving averages to process water quality data. These methods are essentially simple statistics of historical data and cannot distinguish the differentiated impact of different times and parameters on current dosing decisions. When a spike occurs in the total phosphorus concentration of the influent, traditional methods treat the abrupt signal the same as normal fluctuations, smoothing out key early warning information and causing the system to lose its sensitivity to sudden operating conditions.
[0006] At the predictive modeling level, traditional machine learning models assign static weights to all input features, making it impossible to dynamically adjust the influence weights of each parameter based on real-time operating conditions. For example, under high mud levels, the amount of magnetic powder added should be strongly correlated with the mud depth, but traditional models cannot recognize this condition dependence and still calculate it with fixed weights, resulting in a disconnect between the amount of magnetic powder added and the actual demand.
[0007] The combined effect of these three levels of defects is that the control system's response to sudden changes in water quality is severely delayed. From data acquisition to completing chemical dosing adjustments, a considerable amount of time is often required, during which effluent indicators remain out of control. To avoid the risk of exceeding standards, wastewater treatment plants are forced to adopt conservative strategies, maintaining high chemical dosages throughout the process, resulting in chemical waste, increased sludge production, and persistently high operating costs.
[0008] In view of the above, this application is hereby submitted. Summary of the Invention
[0009] This invention discloses an intelligent dosing control method, device, equipment, and storage medium for a magnetic coagulation system. It aims to solve the problems of existing magnetic coagulation dosing control systems, which suffer from delayed dosing adjustments, excessive effluent quality, or overdosing of chemicals when influent water quality fluctuates suddenly due to the single data acquisition dimension, insufficient time-series feature extraction capability, and the inability of the model to dynamically respond to changes in operating conditions.
[0010] The first embodiment of the present invention provides an intelligent dosing control method for a magnetic coagulation system, comprising: Real-time process data from multiple sections during the operation of the magnetic coagulation process are collected, and the real-time process data is cleaned and standardized to generate standardized time-series data. Based on the standardized time-series data, feature selection and auxiliary feature construction are performed to generate the model input feature set; The input feature set of the model is input into a pre-trained dosing prediction model to obtain the predicted value of the dosage; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, which is trained based on historical process data, and realizes dynamic weighting of input features through attention mechanism, and captures temporal dependencies through bidirectional temporal network; The operating condition level is determined based on the effluent water quality indicators, and a dosing control command is generated and executed based on the operating condition level and the predicted dosage of the reagent.
[0011] Preferably, the plurality of cross-sections includes an influent cross-section, a reaction cross-section, a sedimentation cross-section, and an effluent cross-section; the real-time process data includes water quality parameters and water temperature at the influent cross-section, reagent concentration at the reaction cross-section, sludge level and hydraulic retention time at the sedimentation cross-section, and turbidity and water quality parameters at the effluent cross-section.
[0012] Preferably, the feature filtering specifically includes: Calculate the mutual information values between each data dimension X and the target dosage Y. Where H(X) is the marginal entropy of data dimension X, H(Y) is the marginal entropy of target drug dosage Y, and H(X,Y) is the joint entropy; data dimensions with mutual information values higher than a set threshold are retained as core features; The construction of the auxiliary features specifically includes: Seasonal periodic features generated using sine-cosine coding, intraday periodic features generated using unique thermal coding, and water quality abrupt change features generated based on the difference in water quality indicators between adjacent time steps; The core features are combined with the auxiliary features to form the model input feature set.
[0013] Preferably, the dosing prediction model includes an input layer, a multi-scale attention layer, a bidirectional temporal feature extraction layer, a fully connected layer, and an output layer connected in sequence. The multi-scale attention layer includes a temporal attention module, a feature attention module, and a hybrid attention module; the temporal attention module calculates the attention weights at each time step. The result is obtained by softmax normalization of the linear transformation results at each time step, which is used to characterize the influence of each time step on the dosing decision; the feature attention module calculates the attention weight of each feature dimension. This is used to characterize the importance of each feature; the hybrid attention module will... and Multiply to generate an attention matrix, and then output a weighted feature sequence after weighting the input feature set of the model. The bidirectional temporal feature extraction layer employs a multi-layer bidirectional long short-term memory network, including a forward network computed along the forward time direction and a backward network computed along the backward time direction; the forward network outputs a forward hidden state, and the backward network outputs a backward hidden state; the forward hidden state and the backward hidden state are concatenated to form a fused feature vector, which is then input into the fully connected layer.
[0014] Preferably, the bidirectional temporal feature extraction layer is configured with a cell state direct connection mechanism, which maintains the integrity of long-term temporal information transmission between layers by establishing a direct transmission path of cell state between adjacent layers.
[0015] Preferably, the training process of the dosing prediction model is as follows: Historical process data is collected and cleaned, standardized, and feature-engineered to generate a training sample set. The Adam optimizer is used to train the model, and the loss function is the root mean square error (RMSE), which is calculated by taking the square root of the mean of the squares of the differences between the predicted and actual values for all samples. Cross-validation is used, and training stops when the loss on the validation set decreases less than the convergence threshold for several consecutive rounds.
[0016] Preferably, the operating condition levels include normal operating condition, early warning operating condition, and emergency operating condition; under normal operating condition, the dosage is executed according to the predicted dosage value; under early warning operating condition, the predicted value is adjusted upwards before the dosage is executed and the model update cycle is shortened; under emergency operating condition, the dosage is executed according to the preset maximum dose and an alarm is activated.
[0017] The second embodiment of the present invention provides an intelligent dosing control device for a magnetic coagulation system, comprising: The data preprocessing unit is used to collect real-time process data from multiple sections during the operation of the magnetic coagulation process, and to perform data cleaning and standardization on the real-time process data to generate standardized time-series data. The input construction unit is used to perform feature filtering and auxiliary feature construction based on the standardized time-series data to generate the model input feature set; The prediction unit is used to input the model input feature set into a pre-trained dosing prediction model to obtain the predicted value of the dosing amount of the drug; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, which is trained based on historical process data, and realizes dynamic weighting of input features through an attention mechanism, and captures temporal dependencies through a bidirectional temporal network; The execution unit is used to determine the operating condition level based on the effluent water quality indicators, generate a dosing control command based on the operating condition level and the predicted dosage of the reagent, and execute it.
[0018] The third embodiment of the present invention provides an intelligent dosing control device for a magnetic coagulation system, including a memory and a processor. The memory stores a computer program, which can be executed by the processor to implement the intelligent dosing control method for a magnetic coagulation system as described in any of the above embodiments.
[0019] The fourth embodiment of the present invention provides a computer-readable storage medium, characterized in that it stores a computer program, which can be executed by the processor of the device where the computer-readable storage medium is located, so as to implement the intelligent dosing control method for a magnetic coagulation system as described in any of the above claims.
[0020] Based on the intelligent dosing control method, device, equipment, and storage medium of the magnetic coagulation system provided by this invention, real-time process data from multiple cross-sections of the magnetic coagulation process are collected. Standardized time-series data is generated by cleaning and standardizing the real-time process data, and feature selection and auxiliary feature construction are performed to enhance the expressive power of key time-series features. By inputting the model input feature set into a dosing prediction model based on a multi-scale attention mechanism and a bidirectional time-series network, the attention mechanism dynamically adjusts the weight contribution of different features at different times to the dosing decision, and the bidirectional time-series network simultaneously captures historical trends and future dependencies, achieving rapid response and accurate prediction of sudden changes in water quality. By determining the operating condition level based on effluent water quality indicators and generating control commands based on predicted values, a closed-loop control with graded responses is formed, ensuring timely adjustment of the dosing strategy under different operating conditions, thereby effectively solving the aforementioned technical problems. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating an intelligent dosing control method for a magnetic coagulation system provided in the first embodiment of the present invention; Figure 2 This is a schematic diagram of a module of an intelligent dosing control device for a magnetic coagulation system provided in the second embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0024] This invention discloses an intelligent dosing control method, device, equipment, and storage medium for a magnetic coagulation system. It aims to solve the problems of existing magnetic coagulation dosing control systems, which suffer from delayed dosing adjustments, excessive effluent quality, or overdosing of chemicals when influent water quality fluctuates suddenly due to the single data acquisition dimension, insufficient time-series feature extraction capability, and the inability of the model to dynamically respond to changes in operating conditions.
[0025] Please see Figure 1 The first embodiment of the present invention provides an intelligent dosing control method for a magnetic coagulation system, which can be executed by an intelligent dosing control device for the magnetic coagulation system (hereinafter referred to as the control device), specifically, by one or more processors within the control device, to at least implement the following steps: S101, Collect real-time process data from multiple sections during the operation of the magnetic coagulation process, perform data cleaning and standardization on the real-time process data, and generate standardized time-series data; In this embodiment, the control device can be a desktop computer, server, workstation or other terminal with data processing capabilities. The control device can be equipped with a corresponding operating system and application software, and the functions required in this embodiment can be realized through the combination of the operating system and application software. Specifically, an online water quality analyzer and a water temperature sensor are installed at the inlet section to collect water quality parameters such as suspended solids concentration, chemical oxygen demand (COD), total phosphorus concentration, and water temperature. A reagent concentration sensor is installed at the reaction section to collect the concentrations of polyferric sulfate and polyacrylamide. A sludge level gauge and a hydraulic retention time timer are installed at the sedimentation section to collect real-time sludge level height and hydraulic retention time. An online turbidity analyzer and an online water quality analyzer are installed at the effluent section to collect effluent turbidity and total phosphorus concentration. Data collected by the sensors at each section is transmitted to the data processing layer via a 4G or 5G network. The sampling frequency supports dynamic adjustment; a lower sampling frequency is maintained when the water quality is stable to reduce system load, and the sampling frequency is automatically increased when water quality fluctuates to ensure data timeliness.
[0026] The collected raw process data needs to undergo data cleaning to ensure data quality. In the outlier removal stage, the following methods are employed: The criteria involve screening each data dimension by calculating the mean μ and standard deviation for each data dimension. When the absolute value of the deviation of a data point x from the mean Greater than three standard deviations If the data point is found to be an outlier due to sensor malfunction or measurement error, it will be removed.
[0027] In the missing value imputation stage, for data loss caused by short-term sensor malfunctions, a bidirectional linear interpolation method is used for imputation, the expression of which is:
[0028] in, This represents the predicted or estimated value of the data at time r. It is time The actual data value at that location, It is time The actual data value at that location, The missing time points are used to identify the position of the data in the time series. r-1 and r+1 are adjacent valid time points. The missing time point is calculated according to the data values of the valid time point r-1 before the missing time point r and the valid time point r+1 after the missing time point r, and the missing time point is calculated according to the linear relationship to make the filled data transition smoothly. For continuous data loss caused by long-term sensor failure, a generative filling method based on historical similar working conditions is adopted. The historical time period data similar to the current working condition is retrieved from the historical database as the filling basis to ensure that the filled data conforms to the actual process rules.
[0029] After data cleaning, the data is standardized to eliminate dimensional differences and achieve temporal consistency. In the normalization process, the Min-Max method is used to map each data dimension to the [0,1] interval, with the specific mapping relationship as follows: ,in, This represents the normalized variable values. Normalization is the operation of mapping data to a specific interval, facilitating comparison, analysis, or use as model input for data with different units or ranges. c represents the original variable values to be normalized. , Variables in the original dataset The maximum and minimum values of the feature; This process eliminates the dimensional differences between different data dimensions, making the parameters comparable. In the time alignment process, considering the potential discrepancies in the sampling clocks of sensors at each cross-section, the timestamps of the effluent water quality index data are used as a benchmark, and the data from other cross-sections are synchronized according to a fixed time step. This ensures that data within the same time step corresponds to the same process state, eliminating the time misalignment problem caused by clock deviations.
[0030] When the rate of change of a certain indicator exceeds a set threshold, an anomaly warning is triggered. Simultaneously, a method combining historical operating data and locally weighted regression is used to correct outliers, ensuring the accuracy of the model input. The locally weighted regression formula is as follows: ; in, These are the weighting coefficients related to the input q. The input variables can be a single feature or a feature vector, etc., where m represents the number of similar working condition samples involved in the calculation. It is the first The actual output value corresponding to each sample is the drug dosage for that sample, ensuring that the model input distortion rate is kept at a low level.
[0031] After the above data cleaning and standardization processes, standardized time-series data that can be directly used for subsequent feature engineering and model prediction is generated and stored in the time-series database for the model to call in real time.
[0032] S102, Based on the standardized time-series data, perform feature filtering and auxiliary feature construction to generate a model input feature set; In this embodiment, it is necessary to screen out the core features that have a significant impact on dosing control from multi-dimensional data. This invention uses a mutual information algorithm to evaluate the correlation between each data dimension and the target dosing dose. Mutual information is an index that measures the amount of information shared between two random variables; a larger value indicates a stronger correlation between the two variables. Specifically, for any data dimension X and the target dosing dose Y, the mutual information value is calculated. Through formula The calculation yields H(X), where H(X) is the marginal entropy of data dimension X. Characteristics of random variables Marginal entropy , For random variables All possible values Summation, Represents random variables Values The probability (log is used to calculate the quantified value of uncertainty), used to measure the uncertainty of this data dimension itself, H(Y) is the marginal entropy of the target dosage Y, used to measure the uncertainty of the dosage, and H(X,Y) is the joint entropy of X and Y. The joint entropy of random variables X and Y , For random variables All possible values and random variables All possible values Perform double summation (i.e., iterate through X and X) All possible combinations ), This indicates that the random variable X takes the value of And random variables Values The joint probability (log is used to quantify joint uncertainty) is used to measure the common uncertainty of two variables. By calculating the mutual information values of each data dimension with the dosage of polyferric sulfate, polyacrylamide, and magnetic powder, weakly correlated features with mutual information values below a set threshold are eliminated. Finally, multi-dimensional core features with strong explanatory power for chemical dosing control are retained, covering key data dimensions such as influent water quality indicators, reagent reaction concentration, sedimentation zone process parameters, and effluent water quality indicators.
[0033] Based on the core feature selection, auxiliary features are further constructed to enhance the model's ability to capture temporal patterns. Seasonal periodic features are generated using a sine-cosine coding method to capture the periodic fluctuations in water quality with seasonal changes. The formula is:
[0034] Where t is the number of days. , The amplitude coefficients of the sine and cosine terms determine the magnitude of the signal. This represents the signal value at time t.
[0035] The sine and cosine terms are encoded based on the number of days *t*. A combination of sine and cosine functions is used to express the seasonal variation characteristics within the annual cycle, which are then normalized and used as part of the model input. Intra-day time-segment features divide the day into multiple time periods, using one-hot encoding to represent different periods. This adapts to the periodic variations in wastewater discharge and water quality components throughout the day. For example, industrial wastewater treatment plants exhibit significant differences in influent characteristics during working and non-working hours; intra-day time-segment features allow the model to identify these regular variations. Water quality abrupt change features are generated by calculating the difference in water quality indicators between adjacent time steps (the formula is...). ( for Time index value, for (Time index value), when When the difference exceeds a set threshold, it is marked as a "mutation feature"; otherwise, it is 0, enhancing the model's responsiveness to sudden conditions. When the difference of a certain water quality indicator between adjacent time steps exceeds a set threshold, that moment is marked as a mutation feature; otherwise, it is marked as non-mutation. The introduction of this feature enhances the model's responsiveness to sudden conditions such as industrial wastewater impact and torrential rain. The core features obtained through the mutual information algorithm are combined with the above three types of auxiliary features to form a complete model input feature set.
[0036] To improve the model's generalization ability and avoid overfitting, this embodiment also performs data augmentation on the feature data. On one hand, a feature sequence with a certain time offset is generated using a time-shifting method to simulate sensor sampling time errors or data transmission delays in actual operating scenarios, enabling the model to adapt to input data with slight time misalignments. On the other hand, wavelet transform is used to perform multi-scale decomposition on the standardized time-series data, decomposing the data into approximation coefficients and detail coefficients at different frequency levels. Small-amplitude Gaussian noise is added to the detail coefficients before signal reconstruction. The noise addition relationship is as follows: ,in, For the data after adding noise, The standard deviation of the original data. To conform to a certain distribution (usually a normal distribution, i.e.) The N(0,1) Gaussian random variable provides randomness to the noise, simulating sensor measurement error. A coefficient of 0.02 controls the relative amplitude of the noise, simulating data disturbances caused by sensor measurement errors without altering the overall data distribution. After data augmentation, the training dataset is effectively expanded, and the model exhibits stronger robustness against real-world data noise and sampling errors.
[0037] S103, the input feature set of the model is input into the pre-trained dosing prediction model to obtain the predicted value of the dosage; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, the model is trained based on historical process data, the input features are dynamically weighted through the attention mechanism, and the temporal dependencies are captured through a bidirectional temporal network; It should be noted that by inputting the feature set of the feature-engineered model into the pre-trained dosing prediction model, the predicted dosage values of various agents under the current operating conditions can be obtained. This dosing prediction model is a multi-scale attention temporal deep learning model. Its overall architecture adopts a hierarchical structure of "input layer - multi-scale attention layer - bidirectional temporal feature extraction layer - fully connected layer - output layer". The model is trained based on historical process data accumulated in wastewater treatment plants and can learn the complex coupling relationship between "agents - water quality - sludge level" in the magnetic coagulation process.
[0038] The model input feature set first enters the input layer. The input layer organizes the input sequence according to the set time step, arranging the core features and auxiliary features according to the time dimension to form a multi-dimensional time-series input matrix, ensuring that the model can use historical data within a recent period to predict drug dosage.
[0039] The input sequence then enters a multi-scale attention layer for dynamic weighting processing. This layer contains three sub-modules: a temporal attention module, a feature attention module, and a hybrid attention module. The temporal attention module calculates the influence weights of each time step on the current dosing decision. Specifically, after performing a linear transformation on the feature vectors of each time step in the input sequence, it is normalized using a softmax function to obtain the attention weights for each time step, expressed as: ; in, Let be the attention weight at time step t (range [0,1]). It is the weight matrix ( (for learnable weight matrices) It is the first Each input feature It is a bias term ( (This is the bias vector), the denominator is the sum of all terms from k = 1 to 10, which serves as a softmax normalization to ensure the weights at all time steps. The sum is 1. For example, when the influent SS rises in the 8th time step, the value of that time step is 1. The value was increased from 0.08 to 0.25, enhancing the model's ability to capture mutation information. The overall calculation is performed in a "10-class" scenario, comparing it to the [previous class / category]. The probability corresponding to each input-related category ,all ( A probability distribution is formed (corresponding to different categories). It should be noted that a larger weight indicates a more significant impact of that time step on the current dosing decision. For example, when the concentration of suspended solids in the influent suddenly increases at a certain time step, the attention weight of that time step will be increased accordingly, allowing the model to focus on this sudden change.
[0040] The feature attention module is used to calculate the importance of each feature dimension to the dosing decision. It weights each feature using learnable weight parameters, and the weight calculation formula is as follows: ;in, For the attention weight of the j-th feature, the molecule Learnable feature weight parameters (superscript) Indicates the relationship with the first Weights related to each category or feature). It is the first Each input feature The term is the bias term. The denominator is the sum of all terms. Summation and normalization are performed to enable the model to automatically identify key features based on the current working conditions. For example, under high mud level conditions, the attention weight of mud level features will be significantly higher than that of other features, ensuring a strong correlation between the amount of magnetic powder added and the mud level depth.
[0041] The hybrid attention module multiplies the temporal attention weights by the feature attention weights to generate a complete attention matrix. Weighting the input sequence Then, it is fed into the subsequent feature extraction layer. The matrix is used to weight the original input sequence and output a weighted feature sequence, so that the subsequent network layers can focus on the information of key moments and key features.
[0042] The weighted feature sequence enters a bidirectional temporal feature extraction layer for deep temporal dependency mining. This layer employs a multi-layer bidirectional long short-term memory (LSTM) network structure. The bidirectional LSM network contains information flows in two directions: a forward network that computes in the forward direction of time and a backward network that computes in the backward direction of time. The forward network processes data at each time step sequentially from the beginning of the sequence to the end. The computation at each time step involves the coordinated work of three gating units: a forget gate, an input gate, and an output gate. The forget gate determines which information from the cell state at the previous time step needs to be forgotten; the input gate determines which new information from the current time step needs to be written into the cell state; and the output gate determines which information from the cell state needs to be output to the hidden state. This gating mechanism enables selective memorization and forgetting of long-term temporal information. The forward network ultimately outputs a forward hidden state containing accumulated historical information. The computational logic of the backward network is symmetrical to that of the forward network, processing data at each time step sequentially from the end of the sequence to the beginning, and outputting a backward hidden state containing future information. By concatenating the forward and backward hidden states at the same time point, a fused feature vector is formed that integrates both forward and backward information of the sequence, enabling the model to make predictions using both historical trends and future dependencies. To prevent the attenuation of long-term information during transmission through multiple network layers, the bidirectional temporal feature extraction layer is also equipped with a direct cell state connection mechanism. By establishing direct transmission paths of cell states between adjacent network layers, the long-term dependency information extracted from the lower layers can be completely transmitted to the higher layers, maintaining the effectiveness of long-term features.
[0043] Taking a certain layer of bidirectional temporal unit as an example, its forward and backward cell state update formulas are as follows:
[0044]
[0045]
[0046]
[0047]
[0048] In the forward forgetting gate formula, Indicates the forward forgetting gate at time The output is a vector, where each element has a value between 0 and 1, used to control the cell state at the previous time step. The degree of forgetting of information in each part of the text. This represents the sigmoid activation function, and the formula is: Its function is to map the input to the (0,1) interval to represent the degree to which the "gate" is open (close to 1) or closed (close to 0). This indicates the hidden state in the previous moment within the forget gate. The corresponding weight matrix is used to... Perform a linear transformation. It represents the forward hidden state at time t-1, which contains the sequence information up to time t-1 and is the short-term information carrier that LSTM passes to subsequent times. This indicates the input at the current moment within the forget gate. The corresponding weight matrix is used for Perform a linear transformation. The input vector at time t represents the sequence elements at the current time. This represents the cell state at the previous moment in the forgetting gate. The corresponding weight matrix is used to... Perform a linear transformation. It represents the forward cell state at time t-1 and is the carrier of LSTM long-term memory, storing long-term information from the start of the sequence to time t-1. This represents the bias vector of the forget gate, used to adjust the result of the linear transformation and increase the expressive power of the model.
[0049] In the forward input gate formula, The output of the forward input gate at time t is a vector with elements ranging from 0 to 1, used to control the state of newly generated candidate cells at the current time. The degree of input of information in each part of the process. This indicates the hidden state in the input gate at the previous time step. The corresponding weight matrix. Indicating the current input in the input gate. The corresponding weight matrix. This indicates the cell state at the previous time step in the input gate. The corresponding weight matrix. This represents the bias vector of the input gate.
[0050] In the forward cell state formula, It represents the forward cell state at time t and is the updated long-term memory carrier. This represents element-wise multiplication (Hadamard product), which is the multiplication of corresponding elements of two vectors. This represents the hyperbolic tangent activation function, which maps the input to the (-1,1) interval to generate candidate cell states and assign new information, "amplitude". This indicates the hidden state from the previous time step during cell state updates. The corresponding weight matrix is used to... Perform a linear transformation to generate a subset of candidate cell states. This indicates that the cell state is being updated, and the current input is... The corresponding weight matrix is used to... Perform a linear transformation to generate a subset of candidate cell states. The bias vector represents the cell state update. Represents the candidate cell state at time t , is obtained by linearly transforming the current input and the hidden state of the previous time step, and then activating it with tanh, representing new information about the cell state that may be added at the current time step.
[0051] In the forward output gate formula, The output of the forward output gate at time t is a vector, with elements ranging from 0 to 1, used to control the cell state at the current time. How much information needs to be output to the hidden state? middle. This indicates the hidden state in the output gate at the previous moment. The corresponding weight matrix. Indicates the current input in the output gate. The corresponding weight matrix. This indicates the cell state at the current moment in the output gate. The corresponding weight matrix. This represents the bias vector of the output gate.
[0052] In the forward hidden state formula, The forward hidden state at time t represents the output of the LSTM at time t. It contains key information for the current time and also provides short-term information for the calculation of the next time step. This indicates that the cell state tanh is activated at the current moment, mapping the long-term information in the cell state to the (-1,1) interval so that it can be combined with the result of the output gate to generate the hidden state.
[0053] The backward computation logic is symmetrical to the forward logic, and the final output of this layer is the concatenation of the forward hidden state and the backward hidden state: ( Indicates a certain layer at time The final output is a concatenated vector that combines forward and backward information; The forward hidden state is calculated from the beginning of the sequence towards the end, and the time interval is... The hidden state contains the latter half of the sequence passed to time step 1. The signal; The backward hidden state is calculated from the end of the sequence towards the beginning, and the time interval is... The hidden state contains the latter half of the sequence passed to time step 1. Information, This indicates that the forward-hidden state will be displayed. and backward hidden state By concatenating the sequences sequentially to form a new vector, the model can utilize both forward and backward information, enhancing its understanding of the sequence. The "direct cell state connection" mechanism preserves cell states between layers. , A direct transmission path is established to avoid the attenuation of long-sequence information during inter-layer transmission.
[0054] The fused feature vectors are fed into a fully connected layer for high-level feature integration and non-linear mapping. The fully connected layer employs a multi-neuron configuration, with the first layer using the ReLU activation function. The second layer uses the LeakyReLU activation function. This combination of activation functions effectively avoids the vanishing gradient problem, ensuring the stability of model training. Finally, the output layer generates predicted drug dosage values based on the output of the fully connected layer. The output layer uses a linear activation function to adapt to the characteristic that the dosage is a continuous value. It outputs three prediction results for the dosage of polyferric sulfate, polyacrylamide, and magnetic powder, respectively. The output range is corrected by process constraints to ensure that the predicted values are within a reasonable process allowable range.
[0055] S104, determine the operating condition level based on the effluent water quality indicators, generate and execute a dosing control command based on the operating condition level and the predicted dosage of the reagent.
[0056] After obtaining the predicted dosage value of the chemical dosing model, the system needs to determine the operating condition level by combining the real-time status of the effluent water quality indicators, and generate corresponding chemical dosing control instructions based on the determination results. The operating condition level is divided based on two key water quality indicators, turbidity and total phosphorus concentration, at the effluent section. By comparing the real-time monitoring values with preset compliance thresholds, the current operating status is divided into three levels: normal operating condition, early warning operating condition, and emergency operating condition.
[0057] When the turbidity and total phosphorus concentration at the effluent section are both within the acceptable range, the system determines that it is currently in normal operating condition. Under normal operating conditions, the magnetic coagulation system operates smoothly, and the effluent quality meets the discharge standards. At this time, the system directly uses the predicted dosage values of the dosing model as the control target, converting the predicted dosages of polyferric sulfate, polyacrylamide, and magnetic powder into corresponding control commands, which are then driven by the PLC controller to stably add the chemicals according to the predicted values. Under normal operating conditions, the model update cycle remains relatively long, and the system operates at a lower calculation frequency, reducing the system load while ensuring control accuracy.
[0058] When the turbidity or total phosphorus concentration at the effluent section shows a slight exceedance—that is, the monitored value exceeds the compliance threshold but has not yet reached a severely excessive level—the system determines that it is currently in a warning state. This warning state indicates that the influent water quality has fluctuated to some extent, and the magnetic coagulation treatment effect has begun to decline, requiring preventative measures to prevent further deterioration of the effluent water quality. Under the warning state, the system adjusts the predicted dosage value output by the dosing prediction model upwards by a set ratio before administering the dosing. By appropriately increasing the dosage, the system enhances the pollutant removal capacity, ensuring that the effluent water quality returns to within the compliance range as quickly as possible. Simultaneously, the system automatically shortens the model update cycle and increases the frequency of data acquisition and model calculation, enabling the system to more promptly capture water quality change trends and quickly adjust the dosing strategy, avoiding continuous deterioration of the effluent water quality due to response lag.
[0059] When the turbidity or total phosphorus concentration at the effluent section significantly exceeds the standard (i.e., the monitored value greatly exceeds the compliance threshold), the system determines that it is in an emergency operating condition. Emergency conditions are typically triggered by extreme situations such as large-scale unauthorized discharge of industrial wastewater or a sudden increase in influent flow due to heavy rain. In such cases, conventional predictive control strategies are insufficient to effectively address the issue in a short time, necessitating the activation of an emergency response mechanism. Under emergency conditions, the system no longer relies on model predictions for chemical dosing control but directly administers chemicals according to the preset maximum dosage limit, ensuring maximum pollutant removal capacity of the magnetic coagulation process in the shortest possible time. Simultaneously, the system automatically activates a manual alarm mechanism, alerting maintenance personnel through audible and visual alarms and SMS notifications to intervene promptly, allowing for manual assessment of the situation and implementation of further measures. Under emergency conditions, the model update cycle is further shortened to the highest frequency, and the system continuously monitors the changing trends of effluent water quality indicators. Once the effluent water quality is detected to have fallen back to the threshold range of the warning or normal operating conditions, the system automatically deactivates the emergency state and restores the corresponding level of control strategy.
[0060] The control execution layer, linked with various dosing devices via a PLC controller, translates system-generated dosing control commands into specific equipment operations. The polyferric sulfate dosing pump employs frequency conversion control, enabling real-time adjustment of the reagent flow rate based on control commands, achieving continuous and smooth dosage adjustment. The magnetic powder dosing pump uses quantitative pump control, changing the dosing frequency by adjusting the pulse signal frequency to achieve precise metering and dosing of magnetic powder. The system also provides a visual monitoring interface, displaying real-time water quality index curves for each cross-section, trends in the dosage of various reagents, current operating status, and key operating parameters such as effluent compliance rate. Maintenance personnel can comprehensively monitor the operating status of the magnetic coagulation system through this interface. When necessary, maintenance personnel can manually intervene through the monitoring interface, overriding the system's automatic control commands and manually adjusting the dosing dosage, forming a closed-loop management model of "automatic control as the primary method and manual intervention as a supplementary method," ensuring stable and compliant operation of the magnetic coagulation system under various operating conditions and effectively controlling reagent consumption.
[0061] In one possible embodiment of the present invention, the training process of the drug dosing prediction model is as follows: Historical process data is collected and cleaned, standardized, and feature-engineered to generate a training sample set. The Adam optimizer is used to train the model, and the loss function is the root mean square error (RMSE), which is calculated by taking the square root of the mean of the squares of the differences between the predicted and actual values for all samples. Cross-validation is used, and training stops when the loss on the validation set decreases less than the convergence threshold for several consecutive rounds.
[0062] It should be noted that the Adam optimizer is used, and the loss function is the root mean square error (RMSE), as shown in the formula:
[0063] in, This represents the model's loss value, also known as the root mean square error. A larger value indicates a less accurate prediction, while a smaller value indicates a more accurate prediction. Indicates the first The true value for each sample is the actual observed result, which here represents the actual dosage of medication. This represents the model's prediction for the i-th sample, which is the result calculated by the model based on the input. Here, it is the model's predicted value, and N is the number of samples, i.e., how many data points are used to calculate the error. This means that the difference between the true value and the predicted value of each sample is calculated first, and then the difference is squared. This is done to eliminate the mutual cancellation of positive and negative errors and to amplify larger errors. This means summing the squared errors of all N samples to obtain the total squared error. This means that the total squared error is divided by the number of samples N to obtain the mean square error (MSE). The square root of the mean square error is taken to obtain the root mean square error (RMSE). This is done to ensure that the units of the error are consistent with the units of the original data, making it easier to understand the magnitude of the error. Cross-validation is used during training. Training stops when the RMSE decreases less than a set threshold over several consecutive rounds of validation, thus keeping the model's prediction error at a low level.
[0064] The second embodiment of the present invention provides an intelligent dosing control device for a magnetic coagulation system, comprising: The data preprocessing unit is used to collect real-time process data from multiple sections during the operation of the magnetic coagulation process, and to perform data cleaning and standardization on the real-time process data to generate standardized time-series data. The input construction unit is used to perform feature filtering and auxiliary feature construction based on the standardized time-series data to generate the model input feature set; The prediction unit is used to input the model input feature set into a pre-trained dosing prediction model to obtain the predicted value of the dosing amount of the drug; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, which is trained based on historical process data, and realizes dynamic weighting of input features through an attention mechanism, and captures temporal dependencies through a bidirectional temporal network; The execution unit is used to determine the operating condition level based on the effluent water quality indicators, generate a dosing control command based on the operating condition level and the predicted dosage of the reagent, and execute it.
[0065] The third embodiment of the present invention provides an intelligent dosing control device for a magnetic coagulation system, including a memory and a processor. The memory stores a computer program, which can be executed by the processor to implement the intelligent dosing control method for a magnetic coagulation system as described in any of the above embodiments.
[0066] The fourth embodiment of the present invention provides a computer-readable storage medium, characterized in that it stores a computer program, which can be executed by the processor of the device where the computer-readable storage medium is located, so as to implement the intelligent dosing control method for a magnetic coagulation system as described in any of the above claims.
[0067] Based on the intelligent dosing control method, device, equipment, and storage medium of the magnetic coagulation system provided by this invention, real-time process data from multiple cross-sections of the magnetic coagulation process are collected. Standardized time-series data is generated by cleaning and standardizing the real-time process data, and feature selection and auxiliary feature construction are performed to enhance the expressive power of key time-series features. By inputting the model input feature set into a dosing prediction model based on a multi-scale attention mechanism and a bidirectional time-series network, the attention mechanism dynamically adjusts the weight contribution of different features at different times to the dosing decision, and the bidirectional time-series network simultaneously captures historical trends and future dependencies, achieving rapid response and accurate prediction of sudden changes in water quality. By determining the operating condition level based on effluent water quality indicators and generating control commands based on predicted values, a closed-loop control with graded responses is formed, ensuring timely adjustment of the dosing strategy under different operating conditions, thereby effectively solving the aforementioned technical problems.
[0068] Exemplary examples show that the computer program described in the third and fourth embodiments of the present invention can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the intelligent dosing control device implementing a magnetic coagulation system. For example, the apparatus described in the second embodiment of the present invention.
[0069] The processor referred to can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the intelligent dosing control method for the magnetic coagulation system, connecting various parts of the intelligent dosing control method for the magnetic coagulation system through various interfaces and lines.
[0070] The memory can be used to store the computer program and / or modules. The processor, by running or executing the computer program and / or modules stored in the memory, and by calling the data stored in the memory, realizes various functions of an intelligent dosing control method for a magnetic coagulation system. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, text conversion function, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, text message data, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0071] If the implemented module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0072] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0073] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for intelligent dosing control of a magnetic coagulation system, characterized in that, include: Real-time process data from multiple sections during the operation of the magnetic coagulation process are collected, and the real-time process data is cleaned and standardized to generate standardized time-series data. Based on the standardized time-series data, feature selection and auxiliary feature construction are performed to generate the model input feature set; The input feature set of the model is input into a pre-trained dosing prediction model to obtain the predicted value of the dosage; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, which is trained based on historical process data, and realizes dynamic weighting of input features through attention mechanism, and captures temporal dependencies through bidirectional temporal network; The operating condition level is determined based on the effluent water quality indicators, and a dosing control command is generated and executed based on the operating condition level and the predicted dosage of the reagent.
2. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The multiple cross-sections include an influent cross-section, a reaction cross-section, a sedimentation cross-section, and an effluent cross-section; the real-time process data includes water quality parameters and water temperature at the influent cross-section, reagent concentration at the reaction cross-section, sludge level and hydraulic retention time at the sedimentation cross-section, and turbidity and water quality parameters at the effluent cross-section.
3. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The feature selection specifically includes: Calculate the mutual information values between each data dimension X and the target dosage Y. Where H(X) is the marginal entropy of data dimension X, H(Y) is the marginal entropy of target drug dosage Y, and H(X,Y) is the joint entropy; data dimensions with mutual information values higher than a set threshold are retained as core features; The construction of the auxiliary features specifically includes: Seasonal periodic features generated using sine-cosine coding, intraday periodic features generated using unique thermal coding, and water quality abrupt change features generated based on the difference in water quality indicators between adjacent time steps; The core features are combined with the auxiliary features to form the model input feature set.
4. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The drug dosing prediction model comprises an input layer, a multi-scale attention layer, a bidirectional temporal feature extraction layer, a fully connected layer, and an output layer connected in sequence. The multi-scale attention layer includes a temporal attention module, a feature attention module, and a hybrid attention module; the temporal attention module calculates the attention weights at each time step. The result is obtained by softmax normalization of the linear transformation results at each time step, which is used to characterize the influence of each time step on the dosing decision; the feature attention module calculates the attention weight of each feature dimension. This is used to characterize the importance of each feature; the hybrid attention module will... and Multiply to generate an attention matrix, and then output a weighted feature sequence after weighting the input feature set of the model. The bidirectional temporal feature extraction layer employs a multi-layer bidirectional long short-term memory network, including a forward network computed along the forward time direction and a backward network computed along the backward time direction; the forward network outputs a forward hidden state, and the backward network outputs a backward hidden state; the forward hidden state and the backward hidden state are concatenated to form a fused feature vector, which is then input into the fully connected layer.
5. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The bidirectional temporal feature extraction layer is equipped with a cell state direct connection mechanism, which maintains the integrity of long-term temporal information transmission between layers by establishing a direct transmission path of cell state between adjacent layers.
6. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The training process of the drug dosing prediction model is as follows: Historical process data is collected and cleaned, standardized, and feature-engineered to generate a training sample set. The Adam optimizer is used to train the model, and the loss function is the root mean square error (RMSE), which is calculated by taking the square root of the mean of the squares of the differences between the predicted and true values for all samples. Cross-validation is used, and training stops when the loss on the validation set decreases less than the convergence threshold for several consecutive rounds.
7. The intelligent dosing control method for a magnetic coagulation system according to claim 1, characterized in that, The operating conditions include normal operating conditions, early warning operating conditions, and emergency operating conditions. Under normal operating conditions, the dosage is executed according to the predicted dosage value. Under early warning operating conditions, the predicted value is adjusted upwards before the dosage is executed and the model update cycle is shortened. Under emergency operating conditions, the dosage is executed according to the preset maximum dose and an alarm is activated.
8. An intelligent dosing control device for a magnetic coagulation system, characterized in that, include: The data preprocessing unit is used to collect real-time process data from multiple sections during the operation of the magnetic coagulation process, and to perform data cleaning and standardization on the real-time process data to generate standardized time-series data. The input construction unit is used to perform feature filtering and auxiliary feature construction based on the standardized time-series data to generate the model input feature set; The prediction unit is used to input the model input feature set into a pre-trained dosing prediction model to obtain the predicted value of the dosing amount of the drug; wherein, the dosing prediction model is a multi-scale attention temporal deep learning model, which is trained based on historical process data, and realizes dynamic weighting of input features through an attention mechanism, and captures temporal dependencies through a bidirectional temporal network; The execution unit is used to determine the operating condition level based on the effluent water quality indicators, generate a dosing control command based on the operating condition level and the predicted dosage of the reagent, and execute it.
9. An intelligent dosing control device for a magnetic coagulation system, characterized in that, The system includes a memory and a processor. The memory stores a computer program that can be executed by the processor to implement an intelligent dosing control method for a magnetic coagulation system as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The device contains a computer program that can be executed by a processor of the device on which the computer-readable storage medium is located, to implement an intelligent dosing control method for a magnetic coagulation system as described in any one of claims 1 to 7.
Citation Information
Cited By
Wastewater treatment dosing control method and device based on latent state sequence deduction, equipment and medium
CN122194935A