Port rainwater magnetic flocculation feedforward dosing control method based on flow prediction
By embedding a rainfall-flow coupled dynamic weight layer into a long short-term memory network model, the input feature weights are dynamically adjusted, solving the problem of untimely matching of chemical dosage in port rainwater treatment. This achieves efficient flow prediction and chemical dosing control, and improves the response capability of the port rainwater treatment system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ACAD OF NATURAL SCI ENVIRONMENTAL TECH DEV (TIANJIN) CO LTD
- Filing Date
- 2026-05-27
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, the magnetic flocculation dosing control method for port rainwater relies on real-time monitoring data, which makes it impossible to match the peak concentration of pollutants with the dosage of the chemicals in a timely manner. Furthermore, the traditional long short-term memory network model cannot dynamically adjust the weights of the input features, resulting in increased prediction errors in critical scenarios such as heavy rain.
An improved long short-term memory network model is adopted. By embedding a rainfall-flow coupled dynamic weight layer before the input gating layer, the contribution weight of each input feature is dynamically adjusted. Flow prediction is performed by combining multi-source data, and a flow-dosage nonlinear correlation model is constructed to achieve feedforward dosing control.
It improved the sensitivity of flow forecasting and the timeliness of chemical dosing in critical scenarios such as heavy rain, reduced the risk of pollutant exceeding standards, and improved the response efficiency of the port's rainwater treatment system.
Smart Images

Figure CN122334346A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology for port environmental protection, and in particular to a method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction. Background Technology
[0002] In the operation of large-scale terminals and ports primarily handling bulk cargo such as coal and ore, the initial rainwater contains high concentrations of suspended solids and needs to be treated by magnetic flocculation before recycling. Current magnetic flocculation dosing control methods are mainly feedback control, which dynamically adjusts the dosage of chemicals such as polyaluminum chloride (PAC) and polyacrylamide (PAM) by monitoring the real-time concentration or turbidity of high-concentration suspended solids in the wastewater online. While this method can achieve a certain degree of matching between chemicals and pollutants, it has significant drawbacks: feedback control relies on real-time monitoring data, and the dosing system requires an additional 3-5 minutes to respond. This results in the dosage of chemicals failing to match the pollutant concentration during peak periods, leading to excessive levels of high-concentration suspended solids in the initial effluent.
[0003] Existing technologies employ Long Short-Term Memory (LSTM) network models to predict rainwater flow in advance and thus control pesticide application. However, while traditional LTM models control the transmission of temporal information through input, forget, and output gates, their gating mechanism assigns fixed weights to all input features, meaning the contribution of each feature to flow prediction is statically fixed during training. However, port rainwater flow changes exhibit a significant rainfall-driven dominance. In the early stages of heavy rain, the dynamic correlation between rainfall intensity and flow is much stronger than other parameters; while in periods of light rain or no rain, historical flow trends have a more critical impact on prediction. Traditional LTM models cannot dynamically adjust the weights of each input feature based on real-time rainfall conditions, resulting in insufficient sensitivity to core features in critical scenarios such as sudden increases in heavy rain, leading to increased prediction errors. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction, which solves the problems existing in the prior art.
[0005] This invention provides a method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction. The method includes the following steps: S1: Collect multi-source data for rainwater flow forecasting; S2: Perform data preprocessing on the multi-source data to obtain preprocessed multi-source data; S3: Construct an improved long short-term memory network model for rainwater flow prediction; The architecture of the improved long short-term memory network model includes a first data input layer, a dynamic weight layer, an improved input gating layer, a standard LSTM core layer, and a first output layer. The input parameters of the dynamic weight layer are: the rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step. The network structure of the dynamic weight layer is a single-layer fully connected neural network with a second input layer of dimension 2, a hidden layer of 4 neurons, and a second output layer of dimension 5. The activation function is Softmax. The calculation logic for the dynamic weight layer is as follows: The rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step are concatenated into a 2D vector. ; For the 2D vector Through the weight matrix and bias vector Calculate hidden layer output ; The calculation formula is: ; Output to the hidden layer Applying the Softmax activation function yields a 5-dimensional dynamic weight vector. ; S4: Input the preprocessed multi-source data into the improved long short-term memory network model to obtain the traffic prediction results; S5: Control the amount of feedforward chemical dosing for magnetic flocculation of port rainwater based on the flow prediction results.
[0006] Preferably, the improved input gating layer preprocesses the original input features x before input gate calculation. t The dynamic weight vector generated by the dynamic weight layer Element-wise multiplication generates weighted input features, which are then input into a traditional input gate for computation. The improved input gating layer comprises two parts: feature weighting and input gate calculation. The expression for feature weighting is as follows: In the formula The input features are weighted. For dynamic weight vectors, The original 5-dimensional feature vector, This represents the element-wise multiplication of the dynamic weight vector and the original 5-dimensional feature vector; the expression for calculating the input gate is: In the formula, The result of the input gate calculation is given, where σ is the Sigmoid activation function. Here is the weight matrix of the input gate. Let be the bias vector of the input gate. This is the hidden state from the previous time step.
[0007] Preferably, the standard LSTM core layer includes the forget gate, cell state update, and output gate of a standard traditional LSTM, and its computational logic is completely consistent with that of a standard LSTM, used to process the weighted input features. and update cell state C t With hidden state h t .
[0008] Preferably, the first output layer is used to generate traffic prediction values, and the hidden state of the standard LSTM core layer... After passing through a fully connected layer and a linear activation function, the normalized traffic forecast for the next hour is output, and after inverse normalization, the actual traffic forecast for the next hour is obtained.
[0009] Preferably, S3 further includes the process of training the improved long short-term memory network model; using historical data from the past year, including multiple operating conditions such as heavy rain, light rain, and no rain, as the training set, and using the actual traffic flow in the next hour as the label, the model parameters are optimized through the backpropagation algorithm; the training objective function is the mean squared error, and the model is iteratively trained through the Adam optimizer until the validation set error is less than 5%.
[0010] Preferably, in step S5, a flow-dosage nonlinear correlation model is constructed, and the feedforward dosing amount for the future time period t+i is determined. The calculation formula is: ; In the formula, This is the traffic forecast for the next hour. Let t+i be the real-time rainfall intensity, k1 be the flow-dominated correction coefficient, and k2 be the rainfall intensity coupled correction coefficient.
[0011] Preferably, step S5 specifically involves: when the increase in the flow prediction result exceeds the increase threshold, calculating the feedforward dosage for the future time period t+i based on the flow-dosage nonlinear correlation model 20 minutes in advance. The frequency of the dosing pump is adjusted to match the required dosage. When the decrease in the predicted flow rate exceeds the threshold, the feedforward dosage for the future time period t+i is calculated 5 minutes in advance based on the nonlinear correlation model between flow rate and dosage. The frequency of the dosing pump will be reduced to the required dosage.
[0012] Preferably, in step S1, the collection of multi-source data for rainwater flow prediction specifically includes: Electromagnetic flow meters and tipping bucket rain gauges with timing modules are deployed at the inlet of the initial rainwater interception well and the inlet of the regulating pool to obtain rainwater flow data, rainfall intensity data, and rainfall duration; the port's rainfall forecast for the next hour is obtained through the meteorological API; and the port's rainwater flow data for the past 30 days is obtained through the database server.
[0013] Preferably, in step S2, the data preprocessing operation includes data cleaning, data normalization, and data temporal alignment and feature construction operations.
[0014] Preferably, the data cleaning specifically involves: for rainwater flow data, removing values that exceed the physical range, where rainwater flow Q < 0 m³ / h or Q > 1000 m³ / h; removing abrupt outliers, where if the difference between the current rainwater flow Q(t) and the previous minute's rainwater flow Q(t-1) exceeds a rainwater flow difference threshold, it is considered an abrupt change, and the previous minute's rainwater flow Q(t) is used to replace the current rainwater flow Q(t); for rainfall data, removing negative values or values exceeding 200 mm / h for rainfall intensity R(t). If a tipping bucket rain gauge malfunctions and causes the rainfall intensity R(t) to be 0 for 10 consecutive minutes, but the meteorological API shows actual rainfall, then the meteorological API data should be used to replace the tipping bucket rain gauge data. For missing values in historical data, completion processing is required. For short-term missing values, linear interpolation is used for completion. For long-term missing values, the data for the period with long-term missing data is marked as unavailable. Short-term missing values are defined as data missing for less than 5 minutes, and long-term missing values are defined as data missing for more than or equal to 5 minutes. The data normalization formula is: ; In the formula, X(t) represents the original data, X min With X max These represent the minimum and maximum values of the corresponding parameters in the historical 30-day data, X. norm (t) represents the normalized value; The data time-series alignment specifically involves: constructing a timeline in minutes as the base time for all data, and aligning the multi-source data to the minute-level timeline using sampling timestamps; The feature construction specifically involves constructing a 5-dimensional feature vector that reflects the driving factors of dynamic changes in flow based on the aligned multi-source data. The 5-dimensional feature vector includes the current flow, the average flow over the past 10 minutes, the current rainfall intensity, the current rainfall duration, and the rainfall forecast for the next hour.
[0015] The present invention has the following technical effects: This invention embeds a rainfall-flow coupled dynamic weight layer at the front end of the input gating layer of a traditional long short-term memory network model. By monitoring the coupling state between rainfall intensity and flow rate change in real time, it dynamically adjusts the contribution weight of each input feature to the gating mechanism of the long short-term memory network model, focusing on strengthening the weight allocation of key features such as rainfall intensity during heavy rain periods, thereby improving the model's predictive sensitivity to sudden changes in flow.
[0016] The architecture of the improved long short-term memory network model provided in this embodiment includes five major modules: a first data input layer, a dynamic weight layer, an improved input gating layer, a standard LSTM core layer, and a first output layer. These modules work together to achieve high-precision traffic flow prediction. The improved input gating layer adjusts the contribution of input features through dynamic weights, enabling the model to automatically enhance the sensitivity of key features such as rainfall intensity during heavy rain periods and focus on historical traffic flow trends during stable periods, thereby improving the ability to predict sudden changes in traffic flow. Attached Figure Description
[0017] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart of a port rainwater magnetic flocculation feedforward dosing control method based on flow prediction, provided in an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0020] Example 1 Figure 1 A flowchart of a port rainwater magnetic flocculation feedforward dosing control method based on flow prediction is shown, as follows: Figure 1 As shown, the method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction includes the following steps: S1: Collect multi-source data for rainwater flow forecasting; The flow of dusty rainwater in ports is affected by multiple factors, including rainfall intensity, duration, prior soil moisture, and catchment characteristics of the wharf yard / transfer area, and exhibits intermittent and sudden characteristics. Traditional single-parameter control cannot adapt to dynamic changes, and it is necessary to integrate multi-source data such as weather forecasts and historical flow time series, and improve the comprehensiveness of flow prediction through multi-dimensional correlation analysis.
[0021] Specifically, the collection of multi-source data for rainwater flow prediction includes: Electromagnetic flow meters and tipping bucket rain gauges with timing modules are deployed at locations such as the inlet of the initial rainwater interception well and the inlet of the regulating pool to acquire rainwater flow data, rainfall intensity data, and rainfall duration; the port's rainfall forecast for the next hour is obtained through the meteorological API; and the port's rainwater flow data for the past 30 days is obtained through the database server.
[0022] S2: Perform data preprocessing on the multi-source data to obtain preprocessed multi-source data; Raw sensor data may produce outliers due to electromagnetic interference, equipment failure, or extreme weather, such as a sudden change in flow rate from 50 m³ / h to 500 m³ / h, or a negative rainfall intensity. Therefore, data preprocessing is required.
[0023] The data preprocessing operations include data cleaning, data normalization, and data temporal alignment and feature construction operations.
[0024] Specifically, the data cleaning process involves: removing rainwater flow data by eliminating values that exceed the physical range (in this embodiment, exceeding the physical range means rainwater flow Q < 0 m³ / h or Q > 1000 m³ / h); removing abrupt outliers; and removing any value that exceeds the rainwater flow difference threshold if the difference between the current rainwater flow Q(t) and the previous minute's rainwater flow Q(t-1) exceeds the threshold value. In this case, the current rainwater flow Q(t) is replaced by the previous minute's rainwater flow Q(t). For rainfall data, removing negative values or values exceeding 200 mm / h for rainfall intensity R(t) is also included. If a tipping bucket rain gauge malfunctions and causes the rainfall intensity R(t) to be 0 for 10 consecutive minutes, but the meteorological API shows actual rainfall, the meteorological API data is used to replace the tipping bucket rain gauge data. For missing values in historical data, completion processing is required. For short-term missing values, linear interpolation is used for completion. For long-term missing values, the data for the period with long-term missing data is marked as unusable. In this embodiment, short-term missing data refers to data missing for less than 5 minutes, and long-term missing data refers to data missing for more than or equal to 5 minutes.
[0025] Because parameters such as flow rate (m³ / h), rainfall intensity (mm / h), and dosage (mg / L) have large differences in dimensions and numerical ranges, directly inputting them into the flow prediction model will cause the model to ignore the influence of parameters in a small range. Therefore, data normalization is required to normalize all data to the [0,1] interval; the data normalization formula is as follows: ; In the formula, X(t) represents the original data, X min With X max These represent the minimum and maximum values of the corresponding parameters in the historical 30-day data, X. norm (t) represents the normalized value.
[0026] To match the time-series dependency characteristics of the prediction model, the multi-source data needs to be aligned by minute-level timestamps, and an input feature vector containing historical information needs to be constructed.
[0027] The data time-series alignment specifically involves: constructing a timeline in minutes as the base time for all data, and aligning the multi-source data to the minute-level timeline using sampling timestamps.
[0028] The feature construction specifically involves constructing a 5-dimensional feature vector that reflects the driving factors of dynamic changes in flow based on the aligned multi-source data. The 5-dimensional feature vector includes the current flow, the average flow over the past 10 minutes, the current rainfall intensity, the current rainfall duration, and the rainfall forecast for the next hour.
[0029] S3: Construct an improved long short-term memory network model for rainwater flow prediction; Traditional Long Short-Term Memory (LSTM) network models control the transmission of temporal information through input, forget, and output gates. However, their gating mechanism assigns fixed weights to all input features, meaning the contribution of each feature to flow prediction is statically fixed during training. Yet, port rainwater flow changes exhibit a significant rainfall-driven dominance. In the early stages of heavy rain, the dynamic correlation between rainfall intensity and flow is much stronger than other parameters; while in periods of light rain or no rain, historical flow trends have a more critical impact on prediction. Traditional LTM network models cannot dynamically adjust the weights of each input feature based on real-time rainfall conditions, resulting in insufficient sensitivity to core features in critical scenarios such as sudden increases in heavy rain, leading to increased prediction errors.
[0030] Based on this, this embodiment embeds a rainfall-flow coupled dynamic weight layer at the front end of the input gating layer of the traditional long short-term memory network model. By monitoring the coupling state between rainfall intensity and flow rate change in real time, the contribution weight of each input feature to the gating mechanism of the long short-term memory network model is dynamically adjusted. The weight allocation of key features such as rainfall intensity during rainstorm periods is strengthened to improve the model's sensitivity to predicting sudden changes in flow.
[0031] Specifically, the architecture of the improved long short-term memory network model includes five major modules: a first data input layer, a dynamic weight layer, an improved input gating layer, a standard LSTM core layer, and a first output layer. These modules work together to achieve high-precision traffic prediction.
[0032] The first input layer is used for the standardized input of the 5-dimensional feature vector, providing the improved long short-term memory network model with multi-dimensional input including historical flow trends, short-term rainfall status and future weather forecasts, as the basic data for flow prediction; the 5-dimensional feature vector includes current flow, average flow over the past 10 minutes, current rainfall intensity, current rainfall duration and rainfall forecast for the next 1 hour.
[0033] The dynamic weighting layer dynamically generates a 5-dimensional weight vector by monitoring the coupling state between rainfall intensity and flow rate change in real time. The weights corresponding to the current flow rate, the average flow rate over the past 10 minutes, the current rainfall intensity, the current rainfall duration, and the rainfall forecast for the next hour are used to adjust the sensitivity of the input gate to the features.
[0034] The input parameters of the dynamic weight layer are: the rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step. The network structure of the dynamic weight layer is a single-layer fully connected neural network with a second input layer of dimension 2, a hidden layer of 4 neurons, and a second output layer of dimension 5, and the activation function is Softmax. The calculation logic of the dynamic weight layer is as follows: The rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step are concatenated into a 2D vector. ; For the 2D vector Through the weight matrix and bias vector Calculate hidden layer output ; The calculation formula is: ; Output to the hidden layer Applying the Softmax activation function yields a 5-dimensional dynamic weight vector. .
[0035] The input gate i of the traditional Long Short-Term Memory network model t During calculation, the input feature x t Directly with a fixed weight matrix W i Multiplication cannot adjust the contribution of each feature according to the real-time rainfall status. The improved input gating layer provided in this embodiment precalculates the original input feature x before input gate calculation. tThe dynamic weight vector generated by the dynamic weight layer Element-wise multiplication generates weighted input features, which are then input into a traditional input gate for computation.
[0036] The improved input gating layer comprises two parts: feature weighting and input gate calculation. The expression for feature weighting is as follows: In the formula The input features are weighted. For dynamic weight vectors, The original 5-dimensional feature vector, This represents the element-wise multiplication of the dynamic weight vector and the original 5-dimensional feature vector; the expression for calculating the input gate is: In the formula, The result of the input gate calculation is given, where σ is the Sigmoid activation function. Here is the weight matrix of the input gate. Let be the bias vector of the input gate. This is the hidden state from the previous time step.
[0037] The improved input gating layer adjusts the contribution of input features through dynamic weights, enabling the model to automatically enhance the sensitivity of key features such as rainfall intensity during heavy rain periods and focus on historical flow trends during stable periods, thereby improving the ability to predict sudden changes in flow.
[0038] The standard LSTM core layer includes the forget gate, cell state update, and output gate of a standard traditional LSTM. Its computational logic is completely consistent with that of a standard LSTM, and it is used to process the weighted input features. and update cell state C t With hidden state h t .
[0039] The first output layer is used to generate traffic prediction values, and the hidden state of the standard LSTM core layer. After passing through a fully connected layer and a linear activation function, the normalized traffic forecast for the next hour is output, and after inverse normalization, the actual traffic forecast for the next hour is obtained.
[0040] S3 further includes the process of training the improved long short-term memory network model; using historical data from the past year, including various working conditions such as heavy rain, light rain, and no rain, as the training set, and using the actual traffic flow in the next hour as the label, the model parameters are optimized through the backpropagation algorithm; the training objective function is the mean squared error (MSE), and the model is iteratively trained through the Adam optimizer until the validation set error is less than 5%.
[0041] S4: Input the preprocessed multi-source data into the improved long short-term memory network model to obtain the traffic prediction results; The traffic prediction result is the traffic prediction value for the next hour.
[0042] S5: Control the amount of magnetic flocculation feedforward dosing for port rainwater based on the aforementioned flow prediction results; Construct a nonlinear correlation model between flow rate and dosage, and determine the feedforward dosage for the future time period t+i. The calculation formula is: ; In the formula, This is the traffic forecast for the next hour. Let t+i be the real-time rainfall intensity, k1 be the flow-dominated correction coefficient, and k2 be the rainfall intensity coupled correction coefficient.
[0043] Specifically, S5 involves: when the increase in the flow prediction result exceeds the increase threshold, calculating the feedforward dosage for the future time period t+i based on the flow-dosage nonlinear correlation model 20 minutes in advance. The frequency of the dosing pump is adjusted to match the required dosage. When the decrease in the predicted flow rate exceeds the threshold, the feedforward dosage for the future time period t+i is calculated 5 minutes in advance based on the nonlinear correlation model between flow rate and dosage. The frequency of the dosing pump will be reduced to the required dosage.
[0044] Example 2 The present invention also provides an electronic device, including one or more processors and a memory.
[0045] A processor can be a central processing unit (CPU) or other form of processing unit with data processing and / or instruction execution capabilities, and can control other components in an electronic device to perform desired functions.
[0046] The memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and a processor may execute the program instructions to implement a port safety management method based on a large model as described above in any embodiment of this application, and / or other desired functions. Various contents such as initial extrinsic parameters and thresholds may also be stored in the computer-readable storage medium.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.
Claims
1. A method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction, characterized in that, The method includes the following steps: S1: Collect multi-source data for rainwater flow forecasting; S2: Perform data preprocessing on the multi-source data to obtain preprocessed multi-source data; S3: Construct an improved long short-term memory network model for rainwater flow prediction; The architecture of the improved long short-term memory network model includes a first data input layer, a dynamic weight layer, an improved input gating layer, a standard LSTM core layer, and a first output layer. The input parameters of the dynamic weight layer are: the rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step. The network structure of the dynamic weight layer is a single-layer fully connected neural network with a second input layer of dimension 2, a hidden layer of 4 neurons, and a second output layer of dimension 5. The activation function is Softmax. The calculation logic for the dynamic weight layer is as follows: The rainfall intensity R(t) at the current time step and the flow rate change ΔQ(t) at the current time step are concatenated into a 2D vector. ; For the 2D vector Through the weight matrix and bias vector Calculate hidden layer output ; Output to the hidden layer Applying the Softmax activation function yields a 5-dimensional dynamic weight vector. ; S4: Input the preprocessed multi-source data into the improved long short-term memory network model to obtain the traffic prediction results; S5: Control the amount of feedforward chemical dosing for magnetic flocculation of port rainwater based on the flow prediction results.
2. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, The improved input gating layer preprocesses the original input features x before input gate computation. t The dynamic weight vector generated by the dynamic weight layer Element-wise multiplication generates weighted input features, which are then input into a traditional input gate for computation. The improved input gating layer comprises two parts: feature weighting and input gate calculation. The expression for feature weighting is as follows: In the formula The input features are weighted. For dynamic weight vectors, The original 5-dimensional feature vector, This represents the element-wise multiplication of the dynamic weight vector and the original 5-dimensional feature vector; the expression for calculating the input gate is: In the formula, The result of the input gate calculation is given, where σ is the Sigmoid activation function. Here is the weight matrix of the input gate. This is the bias vector for the input gate. This is the hidden state of the previous time step.
3. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, The standard LSTM core layer includes the forget gate, cell state update, and output gate of a standard traditional LSTM. Its computational logic is completely consistent with that of a standard LSTM, and it is used to process the weighted input features. and update cell state C t With hidden state h t .
4. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, The first output layer is used to generate traffic prediction values, and the hidden state of the standard LSTM core layer. After passing through a fully connected layer and a linear activation function, the normalized traffic forecast for the next hour is output, and after inverse normalization, the actual traffic forecast for the next hour is obtained.
5. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, S3 also includes the process of training the improved long short-term memory network model; using historical data from the past year, including multiple working conditions such as heavy rain, light rain, and no rain, as the training set, and using the actual traffic flow in the next hour as the label, the model parameters are optimized through the backpropagation algorithm. The training objective function is the mean squared error, and the Adam optimizer is used for iterative training until the error on the validation set is less than 5%.
6. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, In S5, a nonlinear correlation model between flow rate and dosage is constructed, and the feedforward dosage for the future time period t+i is determined. The calculation formula is: ; In the formula, This is the traffic forecast for the next hour. Let t+i be the real-time rainfall intensity, k1 be the flow-dominated correction coefficient, and k2 be the rainfall intensity coupled correction coefficient.
7. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 6, characterized in that, Specifically, S5 involves: when the increase in the flow prediction result exceeds the increase threshold, calculating the feedforward dosage for the future time period t+i based on the flow-dosage nonlinear correlation model 20 minutes in advance. The frequency of the dosing pump is adjusted to match the required dosage. When the decrease in the predicted flow rate exceeds the threshold, the feedforward dosage for the future time period t+i is calculated 5 minutes in advance based on the nonlinear correlation model between flow rate and dosage. The frequency of the dosing pump will be reduced to the required dosage.
8. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, In step S1, the collection of multi-source data for rainwater flow prediction specifically includes: Electromagnetic flow meters and tipping bucket rain gauges with timing modules are deployed at the inlet of the initial rainwater interception well and the inlet of the regulating pool to obtain rainwater flow data, rainfall intensity data and rainfall duration. Obtain the port's rainfall forecast for the next hour through the meteorological API; obtain the port's rainfall and flow data for the past 30 days through the database server.
9. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 1, characterized in that, In step S2, the data preprocessing operation includes data cleaning, data normalization, and data temporal alignment and feature construction operations.
10. The method for controlling the dosage of magnetic flocculation feedforward for port rainwater based on flow prediction according to claim 9, characterized in that, The data cleaning process specifically involves: removing rainwater flow data by eliminating values exceeding the physical range (Q < 0 m³ / h or Q > 1000 m³ / h); removing abrupt outliers (if the difference between the current rainwater flow Q(t) and the previous minute's rainwater flow Q(t-1) exceeds a threshold, it is considered an abrupt change, and the previous minute's rainwater flow Q(t-1) is used to replace the current rainwater flow Q(t); removing negative values or values exceeding 200 mm / h from the rainfall intensity R(t); if a tipping bucket rain gauge malfunctions and causes the rainfall intensity R(t) to be 0 for 10 consecutive minutes but the meteorological API shows actual rainfall, the meteorological API data is used to replace the tipping bucket rain gauge data; and completing missing values in historical data. For short-term missing values, linear interpolation is used for completion, and for long-term missing values, the data for periods with long-term missing data is marked as unusable. Short-term missing values are defined as data missing for less than 5 minutes, and long-term missing values are defined as data missing for 5 minutes or more. The data normalization formula is: ; In the formula, X(t) represents the original data, X min With X max These represent the minimum and maximum values of the corresponding parameters in the historical 30-day data, X. norm (t) represents the normalized value; The data time-series alignment specifically involves: constructing a timeline in minutes as the base time for all data, and aligning the multi-source data to the minute-level timeline using sampling timestamps; The feature construction specifically involves constructing a 5-dimensional feature vector that reflects the driving factors of dynamic changes in flow based on the aligned multi-source data. The 5-dimensional feature vector includes the current flow, the average flow over the past 10 minutes, the current rainfall intensity, the current rainfall duration, and the rainfall forecast for the next hour.