Sewage water quality prediction control method and system based on edge inference
Patent Information
- Application Number
- CN202611311732.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-30
AI Technical Summary
随着在线仪表和自动化控制系统在污水处理厂的逐步普及,部分设施开始采用基于实时监测数据的反馈控制策略,通过PLC或上位机组态软件将溶解氧、pH、浊度等在线仪表的读数与预设阈值进行比较,触发相应的设备动作,实现了数据采集和基础控制的自动化,本质上仍属于单点触发式的阈值控制,依据的数据维度较为单一,缺乏对多源监测信息的综合挖掘能力,也难以捕捉水质参数之间存在的非线性耦合关系与动态演变趋势
[0015]本发明中,对多源时序数据进行时间对齐和缺失值填充,结合滑动窗口和变化率特征,能够挖掘水质动态变化规律,消除数据噪声和缺失干扰,使归一化特征向量全面反映工况特征,为后续预测提供高质量输入,提升预测精度和鲁棒性,同时减少异常数据的干扰,将归一化特征向量输入边缘侧决策树集合进行分层判断与分裂运算,在靠近数据源位置完成水质预测和超标风险估计,避免数据远程传输的延迟和带宽占用,实现毫秒级响应,提升决策效率,综合预测结果与工况参数映射,提取关键影响参数,使风险识别更具针对性,便于及时调整,基于关键影响参数和安全边界约束触发预警,采用修正规则计算设备调节量并执行可行性校验,确保控制指令安全可靠,保障出水达标,按需调节设备运行状态,避免过度调节和无效操作,降低能耗与药剂消耗,同时及时响应超标风险,减小水质波动,延长设备使用寿命,监测控制指令执行结果并计算水质指标偏差,自适应修正判断阈值并更新修正规则,使控制策略随工况变化持续优化,增强系统对进水波动和设备老化的适应能力,长期运行保持稳定高效,减少人工干预和维护成本,实现精准控制与持续改进。
Smart Images

Figure CN123010559A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wastewater treatment technology, and in particular to a wastewater quality prediction and control method and system based on edge reasoning. Background Technology
[0002] For a long time, water quality prediction and control in the wastewater treatment industry has relied on traditional manual sampling and laboratory analysis. On-site maintenance personnel collect water samples at fixed time intervals, send them back to the laboratory to measure indicators such as chemical oxygen demand (COD), ammonia nitrogen, and total phosphorus, and then manually judge the water quality status and adjust process parameters such as aeration rate, reflux ratio, and reagent dosage based on the test results. With the gradual popularization of online instruments and automated control systems in wastewater treatment plants, some facilities have begun to adopt feedback control strategies based on real-time monitoring data. These strategies compare readings from online instruments such as dissolved oxygen, pH, and turbidity with preset thresholds using PLCs or host computer configuration software, triggering corresponding equipment actions. This automates data acquisition and basic control, but it is essentially still a single-point triggered threshold control system. It relies on a relatively singular data dimension, lacks the ability to comprehensively mine multi-source monitoring information, and struggles to capture the nonlinear coupling relationships and dynamic evolution trends between water quality parameters. In situations where influent water quality fluctuates drastically or operating conditions change frequently, relying solely on threshold judgments based on a single indicator without considering global data correlation can easily lead to lags and biases in control decisions.
[0003] In existing technologies, due to the time mismatch between water quality testing cycles and process adjustment cycles, there is a significant time lag between the water quality information relied upon by the control system and the actual environmental conditions. This results in control commands often targeting historical operating conditions that have already changed, making it difficult to effectively suppress continuous deviations in water quality indicators. Furthermore, fixed thresholds and empirical rules are difficult to adapt to complex and variable influent conditions. The patterns of water quality fluctuations differ significantly across seasons and time periods. Constant judgment criteria lack sufficient adaptability in dealing with sudden high-load shocks or long-term slow deterioration. In addition, the determination of equipment adjustment amounts relies on the experience-based estimations of on-site personnel, lacking systematic verification of safety boundaries and feasibility of implementation. This easily leads to over-adjustment or under-adjustment, thereby affecting the stable compliance of effluent water quality. Summary of the Invention
[0004] This invention provides a wastewater quality prediction and control method and system based on edge reasoning, which can at least solve some of the problems existing in the prior art.
[0005] A first aspect of this invention provides a wastewater quality prediction and control method based on edge reasoning, comprising: Multi-source time-series data of the wastewater treatment system are acquired and time-aligned and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data and the rate of change feature is calculated. The current operating condition parameters are acquired and concatenated with the rate of change feature and standardized to obtain a normalized feature vector. The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined. Based on the risk assessment value of exceeding the standard and the predicted value of water quality index, the comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, the state risk mapping relationship is constructed and key influencing parameters are extracted. Based on the key influencing parameters and preset safety boundary constraints, it is determined whether to trigger an early warning. If triggered, the equipment adjustment amount is calculated and a feasibility verification is performed according to the preset correction rules. If the verification is successful, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment. The execution results of the control command are monitored and the deviation of water quality indicators is calculated. Based on the deviation of water quality indicators, the judgment threshold in the correction rule is adaptively corrected and the correction rule is updated to obtain an optimized correction rule and output it.
[0006] In one alternative implementation, Multi-source time-series data of the wastewater treatment system are acquired, time-aligned, and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data, and the rate of change feature is calculated. Current operating parameters are obtained and concatenated with the rate of change feature, then standardized to obtain a normalized feature vector, including: The influent flow rate, reflux ratio, and chemical dosage time series data of the wastewater treatment system are obtained from the distributed acquisition interface and combined to obtain multi-source time series data. The timestamps of the multi-source time series data are extracted and a unified time axis is constructed for resampling to obtain an aligned time series dataset. The missing positions in the aligned time series dataset are identified, and the valid data points before and after the missing positions are extracted and the time distance weight is calculated. The complete time series data is obtained based on the time distance weight and the valid data points before and after the missing positions. Based on the complete time series data, a sliding window of fixed length is set and slides according to a preset step size. At each sliding window position, the numerical sequence within the window is extracted. The difference between the starting value and the ending value of the numerical sequence is calculated and combined with the window time length to obtain the first-order rate of change. The numerical sequence is then subjected to a second difference calculation and divided by the square of the window time length to obtain the second-order rate of change. The first-order rate of change and the second-order rate of change are combined to obtain the rate of change feature. The current operating condition parameters are obtained by acquiring the fan frequency parameters, dissolved oxygen concentration parameters, and sludge age parameters at the current moment. The current operating condition parameters are then concatenated with the rate of change feature to obtain a concatenated feature vector. The mean and standard deviation of each dimension of the concatenated feature vector are calculated and standardized to obtain a normalized feature vector.
[0007] In one alternative implementation, The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operations to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined, including: Read the root nodes of each decision tree in the decision tree set stored on the edge side, match the feature values of each dimension in the normalized feature vector with the split feature index of the root node, extract the feature values of the corresponding dimensions of the matched feature vector and compare them with the split threshold of the root node, determine the target child node based on the comparison result, enter the target child node and read the split feature index and split threshold of the target child node, repeat the feature value extraction and threshold comparison judgment on the normalized feature vector and continue node jumping until the leaf node is reached, and read the predicted value stored in the leaf node as the output value of the current decision tree; Traverse all decision trees in the decision tree set and obtain the output value of each decision tree. Then, perform a weighted summation of the output values to obtain the predicted water quality index value. The predicted value of the water quality index is compared with a preset prediction threshold. When the predicted value of the water quality index is greater than the prediction threshold, the difference between the predicted value of the water quality index and the prediction threshold is calculated, and the normalized exceedance range is calculated based on the difference. The normalized exceedance range is then subjected to a nonlinear mapping transformation to obtain an exceedance risk assessment value. When the predicted value of the water quality index is less than the prediction threshold, a preset safety benchmark value is obtained and used as the exceedance risk assessment value.
[0008] In one alternative implementation, Based on the risk assessment value of exceeding the standard and the predicted value of the water quality index, a comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, a state-risk mapping relationship is constructed and key influencing parameters are extracted, including: The risk feature vector is obtained by performing feature embedding transformation on the risk assessment value of the exceedance, and the prediction feature vector is obtained by performing feature embedding transformation on the predicted value of the water quality index. The risk feature vector and the prediction feature vector are concatenated to obtain a fused feature vector. The fused feature vector is then subjected to multi-level nonlinear mapping to obtain a comprehensive prediction result. Extract the blower frequency parameter, dissolved oxygen concentration parameter, and sludge age parameter from the current operating condition parameters and construct an operating condition vector. Calculate the deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary to obtain the deviation matrix. Perform gradient perturbation analysis on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, solve for the risk contribution tensor and perform dimensionality reduction projection to construct the state-risk mapping relationship. The risk contribution of each working condition parameter in the state-risk mapping relationship is sorted in descending order, and the working condition parameters with a risk contribution greater than a preset contribution threshold are extracted as key influencing parameters and output.
[0009] In one alternative implementation, The deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary is calculated to obtain the deviation matrix. Gradient perturbation analysis is performed on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, the risk contribution tensor is obtained and dimension reduction projection is performed to construct the state-risk mapping relationship, including: Extract the historical normal operating value range corresponding to each parameter in the operating condition vector from the preset historical operating database and determine the upper boundary value and lower boundary value. Calculate the minimum distance between the current value of each parameter in the operating condition vector and the upper boundary value and lower boundary value, and construct the deviation matrix according to the operating condition parameters. Apply positive and negative perturbations of preset magnitude to each operating parameter in the comprehensive prediction result, calculate the change in the comprehensive prediction result after applying the positive perturbation and the change in the comprehensive prediction result after applying the negative perturbation respectively, solve the gradient response curve based on the change in the comprehensive prediction result corresponding to the positive and negative perturbations, and extract the slope of the gradient response curve as the sensitivity coefficient of each operating parameter. The initial risk contribution tensor is obtained by performing a tensor outer product operation on the sensitivity coefficient and the deviation matrix. The initial risk contribution tensor is then subjected to singular value decomposition to extract the dominant singular vector. A dimension-reduced projection matrix is constructed based on the dominant singular vector. The initial risk contribution tensor is then transformed by the dimension-reduced projection matrix to obtain a dimension-reduced risk contribution matrix. A mapping relationship between the operating parameters and the risk contribution degree is constructed based on the dimension-reduced risk contribution matrix as a state-risk mapping relationship.
[0010] In one alternative implementation, Based on the key influencing parameters and preset safety boundary constraints, it is determined whether an early warning is triggered. If triggered, the equipment adjustment amount is calculated according to preset correction rules and a feasibility verification is performed. If the verification passes, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment, including: Extract the upper and lower limits of the allowed operation corresponding to the key impact parameters from the preset safety boundary constraint configuration file, and make an out-of-bounds judgment between the current value of the key impact parameters and the upper and lower limits of the allowed operation and determine the warning level. Read the equipment control strategy corresponding to the warning level in the preset correction rule, extract the adjustment step size parameter of each device in the equipment control strategy, calculate the preliminary adjustment amount based on the key influence parameter and the predicted value of the water quality index, apply the preset decreasing attenuation factor to the preliminary adjustment amount and combine it with the preset historical adjustment residual to obtain the equipment adjustment amount; Extract the physical adjustment range and adjustment rate limit of each field execution device from the equipment operation constraint library, determine whether the device adjustment amount meets the physical adjustment range and adjustment rate limit and complete the feasibility verification. When the feasibility verification is passed, encode and encapsulate the device adjustment amount according to the field execution device identifier to obtain the control command, and send the control command to the corresponding field execution device through the edge side communication interface.
[0011] In one alternative implementation, The execution results of the control commands are monitored and water quality index deviations are calculated. Based on the water quality index deviations, the judgment thresholds in the correction rules are adaptively corrected and the correction rules are updated to obtain optimized correction rules, which are then output as follows: The actual operating parameters of the field execution equipment after responding to the control command are obtained through the data acquisition interface. The measured values of the effluent water quality index are extracted from the actual operating parameters. The difference between the measured values of the effluent water quality index and the predicted values of the water quality index is calculated to obtain the prediction deviation. The prediction deviation is accumulated and statistically analyzed over time to obtain the deviation sequence. The root mean square deviation and the deviation trend coefficient are calculated and combined based on the deviation sequence to obtain the water quality index deviation. Extract the currently used judgment threshold and threshold adjustment boundary from the correction rule, compare the water quality index deviation with the preset deviation tolerance range, calculate the threshold correction increment when the water quality index deviation exceeds the deviation tolerance range, determine the threshold adjustment direction and adjustment range based on the threshold correction increment and the deviation trend coefficient, apply the adjustment range to the judgment threshold and constrain it within the threshold adjustment boundary to obtain the corrected judgment threshold; Replace the currently used judgment threshold in the correction rule with the corrected judgment threshold, synchronously update the device control strategy parameters associated with the currently used judgment threshold in the correction rule, and store the updated correction rule as an optimized correction rule in the edge-side rule base.
[0012] A second aspect of the present invention provides a wastewater quality prediction and control system based on edge inference, comprising: The data preparation unit is used to acquire multi-source time-series data of the sewage treatment system, perform time alignment and fill missing values to obtain complete time-series data, construct a sliding window based on the complete time-series data and calculate the rate of change feature, acquire the current operating condition parameters and concatenate and standardize them with the rate of change feature to obtain a normalized feature vector. The prediction and evaluation unit is used to input the normalized feature vector into the decision tree set stored on the edge side, perform layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index, determine the risk assessment value of exceeding the standard based on the predicted value of water quality index and the preset prediction threshold, solve for the comprehensive prediction result based on the risk assessment value of exceeding the standard and the predicted value of water quality index, construct the state risk mapping relationship based on the comprehensive prediction result and the current operating condition parameters, and extract key influencing parameters. The early warning control unit is used to determine whether to trigger an early warning based on the key influencing parameters and preset safety boundary constraints. If triggered, it calculates the equipment adjustment amount and performs a feasibility verification according to preset correction rules. If the verification is successful, it generates a control command based on the equipment adjustment amount and sends it to the field execution equipment. The rule correction unit is used to monitor the execution result of the control command and calculate the water quality index deviation, adaptively correct the judgment threshold in the correction rule based on the water quality index deviation, update the correction rule, obtain the optimized correction rule, and output it.
[0013] A third aspect of the present invention provides an electronic device, comprising: A processor and a memory for storing processor-executable instructions, wherein the processor is configured to invoke instructions stored in the memory to perform the aforementioned method.
[0014] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0015] In this invention, time alignment and missing value imputation are performed on multi-source time-series data. Combined with sliding window and rate-of-change features, this approach can uncover dynamic patterns in water quality, eliminate data noise and missing data interference, and ensure that the normalized feature vector comprehensively reflects the operating conditions. This provides high-quality input for subsequent predictions, improving prediction accuracy and robustness. Simultaneously, it reduces interference from outlier data. The normalized feature vector is input into an edge-side decision tree set for hierarchical judgment and splitting operations. Water quality prediction and exceedance risk estimation are completed near the data source, avoiding delays and bandwidth consumption during remote data transmission. This achieves millisecond-level response, improving decision-making efficiency. By mapping the prediction results with operating parameters, key influencing parameters are extracted, making risk identification more targeted. It facilitates timely adjustments, triggers early warnings based on key influencing parameters and safety boundary constraints, calculates equipment adjustment amounts using correction rules and performs feasibility verification to ensure the safety and reliability of control commands, guarantee effluent compliance, adjust equipment operating status as needed, avoid over-adjustment and ineffective operation, reduce energy and chemical consumption, respond promptly to risks of exceeding standards, reduce water quality fluctuations, extend equipment lifespan, monitors control command execution results and calculates water quality index deviations, adaptively corrects judgment thresholds and updates correction rules, enabling continuous optimization of control strategies with changing operating conditions, enhancing the system's adaptability to influent fluctuations and equipment aging, maintaining stable and efficient long-term operation, reducing manual intervention and maintenance costs, and achieving precise control and continuous improvement. Attached Figure Description
[0016] Figure 1 This is a schematic flowchart of the wastewater quality prediction and control method based on edge reasoning, according to an embodiment of the present invention. Figure 2 This is a statistical chart of the prediction results of the decision tree set of the wastewater quality prediction and control method based on edge reasoning in an embodiment of the present invention. Figure 3 This is a flowchart illustrating the equipment adjustment quantity solution and feasibility correction process for the wastewater quality prediction and control method based on edge reasoning, as described in an embodiment of the present invention. Figure 4 This is a monitoring curve of the control command execution effect of the wastewater quality prediction and control method based on edge inference in an embodiment of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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.
[0018] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0019] Figure 1 This is a flowchart illustrating the wastewater quality prediction and control method based on edge inference, as described in an embodiment of the present invention. Figure 1 As shown, the method includes: Multi-source time-series data of the wastewater treatment system are acquired and time-aligned and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data and the rate of change feature is calculated. The current operating condition parameters are acquired and concatenated with the rate of change feature and standardized to obtain a normalized feature vector. The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined. Based on the risk assessment value of exceeding the standard and the predicted value of water quality index, the comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, the state risk mapping relationship is constructed and key influencing parameters are extracted. Based on the key influencing parameters and preset safety boundary constraints, it is determined whether to trigger an early warning. If triggered, the equipment adjustment amount is calculated and a feasibility verification is performed according to the preset correction rules. If the verification is successful, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment. The execution results of the control command are monitored and the deviation of water quality indicators is calculated. Based on the deviation of water quality indicators, the judgment threshold in the correction rule is adaptively corrected and the correction rule is updated to obtain an optimized correction rule and output it.
[0020] In one alternative implementation, Multi-source time-series data of the wastewater treatment system are acquired, time-aligned, and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data, and the rate of change feature is calculated. Current operating parameters are obtained and concatenated with the rate of change feature, then standardized to obtain a normalized feature vector, including: The influent flow rate, reflux ratio, and chemical dosage time series data of the wastewater treatment system are obtained from the distributed acquisition interface and combined to obtain multi-source time series data. The timestamps of the multi-source time series data are extracted and a unified time axis is constructed for resampling to obtain an aligned time series dataset. The missing positions in the aligned time series dataset are identified, and the valid data points before and after the missing positions are extracted and the time distance weight is calculated. The complete time series data is obtained based on the time distance weight and the valid data points before and after the missing positions. Based on the complete time series data, a sliding window of fixed length is set and slides according to a preset step size. At each sliding window position, the numerical sequence within the window is extracted. The difference between the starting value and the ending value of the numerical sequence is calculated and combined with the window time length to obtain the first-order rate of change. The numerical sequence is then subjected to a second difference calculation and divided by the square of the window time length to obtain the second-order rate of change. The first-order rate of change and the second-order rate of change are combined to obtain the rate of change feature. The current operating condition parameters are obtained by acquiring the fan frequency parameters, dissolved oxygen concentration parameters, and sludge age parameters at the current moment. The current operating condition parameters are then concatenated with the rate of change feature to obtain a concatenated feature vector. The mean and standard deviation of each dimension of the concatenated feature vector are calculated and standardized to obtain a normalized feature vector.
[0021] Operational data of the wastewater treatment system is acquired through a distributed acquisition interface, with independent data acquisition channels established for sensor nodes of different physical locations and functional types. Influent flow rate time-series data is obtained from the electromagnetic flowmeter at the influent pumping station, continuously recording the change in water volume entering the treatment unit per unit time at a fixed sampling period. Return ratio time-series data is collected from flow sensors on the sludge return pipeline from the secondary sedimentation tank to the aeration tank, reflecting the real-time proportional relationship of activated sludge recycling. Chemical dosage time-series data is read from the metering control unit of the dosing pump, recording the dosing rates of flocculants, disinfectants, and other chemical agents. These three types of time-series data are labeled according to their acquisition source and combined to form a multi-source time-series data set containing multiple physical quantity dimensions. Each record is accompanied by a corresponding acquisition timestamp, providing a complete raw data foundation for subsequent processing.
[0022] Because different sensor devices have different sampling frequencies—the influent flow sensor might collect data once per minute, while the dosing pump control unit might record data once every 5 minutes—direct merging would lead to timeline misalignment. To address this, timestamp sequences from each channel in the multi-source time-series data are extracted. A unified timeline covering the entire data period is constructed based on the minimum sampling interval among all channels. The original time-series data for each channel is resampled on the unified timeline. Linear interpolation is used to extend the low-frequency channel data to the target time resolution, while high-frequency channels are downsampled to the target frequency using mean aggregation. This results in an aligned time-series dataset where all channels are aligned on the unified timeline, ensuring temporal consistency for subsequent multi-dimensional features.
[0023] The aligned time-series dataset may contain missing values due to sensor malfunctions, communication interruptions, or equipment maintenance. These missing locations need to be filled using a weighted interpolation method. After identifying the missing locations in each channel of the aligned time-series dataset, the nearest valid data points are found on both sides of the missing segment. The time interval between the missing location and the preceding valid data point is recorded as . The time interval between the data points and the subsequent valid data points is Interpolation weights are calculated based on time distance, including the weights of the preceding valid data points. and the weights of the subsequent valid data points They are respectively: , ,in This represents the time distance from the missing location to the preceding valid data point. Let be the time distance from the missing data point to the subsequent valid data point. Valid data points that are closer in distance have higher weights, consistent with the local continuity assumption of time series data. Let the value of the preceding valid data point be . The values of the valid data points on the back side are The fill value for the missing position is... for The above calculations are performed sequentially on all missing locations to obtain complete time-series data without any missing data, providing a continuous and complete numerical sequence for subsequent sliding window feature extraction.
[0024] Construct a sliding window on the complete time series data, setting a fixed length. A window of time steps, according to a preset step size. Slide the window progressively along the timeline. Each time the window slides to a new position, extract the area covered by that window. A sequence of numerical values at consecutive time steps is denoted as . ,in This is the earliest value within the window. This represents the value at the latest point within the window. The first rate of change reflects the overall linear trend of the data within the window time range, and is calculated by dividing the difference between the ending value and the starting value by the length of the window time. That is, the first rate of change ,in The total duration covered by the sliding window. The dimensions of the value are consistent with those of the original data. A positive value indicates that the data within the window is generally trending upward, while a negative value indicates a downward trend.
[0025] The second-order rate of change is used to capture the change in the rate of data change itself, i.e., acceleration characteristics. A second-order difference operation is performed on the numerical sequence within the window, first calculating the first-order difference sequence between adjacent time steps. Then, the difference is calculated on the first-order difference sequence to obtain the second-order difference sequence. Take the mean of the second-order difference sequence and divide it by the square of the window time. The second rate of change is obtained. . It can reflect whether the data is in a dynamic process of accelerating rise or decelerating decline, and has a strong early warning sensitivity for sudden water quality fluctuations in wastewater treatment. The first-order and second-order rates of change of each channel are concatenated to form the rate of change feature of that channel, and then the rate of change features of multiple channels are merged to obtain the rate of change feature vector.
[0026] The system acquires current operating parameters, including the current fan frequency of the aeration equipment, which directly determines the oxygenation rate in the aeration tank; the dissolved oxygen concentration, measured in real-time by an online dissolved oxygen sensor in the aeration tank, reflecting the actual environmental conditions for aerobic metabolism of microorganisms; and the sludge age, calculated by the sludge management system based on the current sludge volume and discharge rate, characterizing the average residence time of activated sludge in the system. These three operating parameters are closely related to the effectiveness of wastewater biochemical treatment and are key control variables affecting effluent quality.
[0027] The current operating parameters and the rate of change feature are concatenated into vectors. Following a fixed dimensional order, the fan frequency parameter, dissolved oxygen concentration parameter, and sludge age parameter are sequentially arranged after the rate of change feature vector, forming a higher-dimensional concatenated feature vector. The concatenation operation maintains the independence of the physical meaning of each parameter, without any weighting or transformation; it only expands the dimension in the vector space. Let the first term of the concatenated feature vector be... Dimensional value is Calculate the mean across all dimensions and standard deviation ,in Let be the total number of dimensions of the concatenated feature vectors. Perform a standardization transformation on each dimension to obtain the _th_ normalized feature vector. Dimensional components ,in To prevent extremely small positive numbers from being introduced into the denominator, after standardization, the numerical distribution of each dimension of the normalized feature vector is adjusted to a standard normal distribution range with a mean of 0 and a standard deviation of 1. This eliminates the interference of differences in the dimensions of different physical quantities on subsequent inference calculations and ensures that the feature dimensions of the decision tree set are comparable when making node splitting judgments.
[0028] In one alternative implementation, The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operations to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined, including: Read the root nodes of each decision tree in the decision tree set stored on the edge side, match the feature values of each dimension in the normalized feature vector with the split feature index of the root node, extract the feature values of the corresponding dimensions of the matched feature vector and compare them with the split threshold of the root node, determine the target child node based on the comparison result, enter the target child node and read the split feature index and split threshold of the target child node, repeat the feature value extraction and threshold comparison judgment on the normalized feature vector and continue node jumping until the leaf node is reached, and read the predicted value stored in the leaf node as the output value of the current decision tree; Traverse all decision trees in the decision tree set and obtain the output value of each decision tree. Then, perform a weighted summation of the output values to obtain the predicted water quality index value. The predicted value of the water quality index is compared with a preset prediction threshold. When the predicted value of the water quality index is greater than the prediction threshold, the difference between the predicted value of the water quality index and the prediction threshold is calculated, and the normalized exceedance range is calculated based on the difference. The normalized exceedance range is then subjected to a nonlinear mapping transformation to obtain an exceedance risk assessment value. When the predicted value of the water quality index is less than the prediction threshold, a preset safety benchmark value is obtained and used as the exceedance risk assessment value.
[0029] The decision tree set stored at the edge consists of multiple independently trained decision trees. Each decision tree organizes its nodes in a tree structure. Each internal node records a split feature index and a split threshold, while leaf nodes store the corresponding predicted values. During inference, the root node of the first decision tree in the decision tree set is read. The corresponding dimension's feature value is extracted from the normalized feature vector according to the split feature index recorded at the root node. This feature value is then compared with the split threshold stored at the root node. If the feature value is less than or equal to the split threshold, the left child node is selected as the target child node; if the feature value is greater than the split threshold, the right child node is selected as the target child node. Upon entering the target child node, the split feature index and split threshold of that node are read. The corresponding dimension's feature value is extracted again from the normalized feature vector, and the same threshold comparison is performed. Based on the comparison result, the process continues to jump to the next layer of child nodes. The process of feature extraction, threshold comparison, and node jumping is repeated at each layer of nodes until a leaf node is reached. Leaf nodes do not contain split feature indices or split thresholds; they only store a predicted value, which is the output value given by the current decision tree for the input normalized feature vector.
[0030] The node transition process in a decision tree is essentially a layer-by-layer partitioning of the feature space. Each comparison and judgment divides the current feature space into two sub-regions along a certain dimension. The normalized feature vector is progressively assigned to increasingly finer sub-regions based on its feature values in each dimension, eventually falling into the region corresponding to a leaf node. The mean of the target values of all training samples in this region is the predicted value stored in the leaf node. Due to limited computing resources on the edge side, the decision tree ensemble has undergone pruning before deployment to control the maximum depth of each tree, ensuring that the number of node transitions in a single tree does not exceed a preset limit, thereby guaranteeing that the inference latency meets the time requirements of real-time control.
[0031] Traverse all decision trees in the decision tree set, independently perform the above-described layer-by-layer node judgment and feature splitting operations on each tree, and obtain the output value of each tree. Assume the decision tree set contains a total of... The first decision tree, the The output value of each decision tree is denoted as The weight corresponding to each decision tree is denoted as . Then the predicted values of water quality indicators We obtain the result through weighted summation: ,in satisfy and Weight During model training, the weights of decision trees are determined based on their prediction errors on the validation set. Decision trees with smaller prediction errors receive larger weights, while those with larger errors receive smaller weights, resulting in more stable and accurate ensemble predictions compared to individual trees. When performing weighted summation at the edge, only one step needs to be completed. Multiplication and This addition operation requires very little computation, making it suitable for resource-constrained edge computing environments.
[0032] Obtain water quality index prediction values Then, it is compared with the preset prediction threshold. Perform numerical comparisons. Predict the threshold. Based on the wastewater treatment discharge standards and process control requirements, different prediction thresholds are pre-set for different water quality indicators (such as chemical oxygen demand, ammonia nitrogen, total phosphorus, etc.). If the predicted water quality indicators are within a safe range, the preset safety benchmark value can be directly obtained. And used as a risk assessment value for exceeding the standard, Typically, a positive number close to zero is chosen to indicate that the risk of exceeding the standard under the current operating conditions is extremely low, and there is no need to trigger an early warning or adjustment action.
[0033] when At that time, the difference between the predicted value and the predicted threshold of the water quality index is calculated. This difference reflects the absolute extent to which the predicted water quality index exceeds the threshold. To eliminate the influence of differences in the dimensions of different water quality indicators, the difference is normalized to obtain the normalized exceedance range. : Normalized excess range This represents the proportion of the overscalar quantity relative to the prediction threshold itself, and its value ranges from [value range missing]. When the excess amount is small Approaching zero, when the excess is large Significantly increased.
[0034] Excess normalization A nonlinear mapping transformation is performed to obtain the risk assessment value of exceeding the standard. The nonlinear mapping employs a saturation function, ensuring that the risk assessment value increases rapidly with the magnitude of the exceedance when the exceedance is small, and tends to saturate when the exceedance is large. This avoids the risk assessment value from increasing unbounded in extreme exceedance situations, thus preventing overreactions in control commands. The nonlinear mapping function is: ,in This represents the upper limit of the risk assessment value. The sensitivity coefficient is used to control the steepness of the mapping curve. is the base of the natural constant. When When approaching zero, Approaching zero, it smoothly connects with the risk assessment value under safe conditions; when When it approaches infinity, Approaching This ensures that the risk assessment value is bounded. The value is set based on the sensitivity of the wastewater treatment process to the response to exceeding the standard. For indicators such as ammonia nitrogen, which have a significant impact on the ecological environment, Take a larger value to improve the sensitivity of risk assessment; for indicators that fluctuate greatly but have relatively low short-term harm from exceeding the limit, Choose a smaller value to avoid triggering warnings frequently.
[0035] In actual wastewater treatment processes, slight exceedances of water quality indicators are often caused by sensor noise or transient fluctuations in operating conditions. Unnecessarily high-risk assessment values can lead to frequent control system actions and increased equipment wear. Saturated nonlinear mapping results in lower risk assessment values for slight exceedances, with the risk assessment value only significantly increasing when the exceedance reaches a certain level, thus achieving reasonable adjustment of control sensitivity. Furthermore, due to limited computing resources on the edge side, the calculation of the exponential function can be approximated using lookup tables or Taylor expansion, reducing computational overhead while maintaining accuracy.
[0036] After completing the calculation of the risk assessment value exceeding the standard, regardless of the baseline value under safe conditions... The mapping value under the condition of exceeding the standard All values are output as a unified format for assessing the risk of exceeding the standard, which is used for subsequent comprehensive prediction and for constructing state-risk mapping relationships. This unified output format ensures the consistency of subsequent processing flows, eliminating the need to design different processing logics for the two states of exceeding and not exceeding the standard.
[0037] Figure 2 This is a statistical chart of the prediction results of the decision tree set of the wastewater quality prediction and control method based on edge reasoning in an embodiment of the present invention, showing the feature splitting reasoning output value of each water quality indicator at the current time. Figure 2 The horizontal axis represents different water quality index categories, including five dimensions: chemical oxygen demand (COD), ammonia nitrogen (NH3-N), total phosphorus (TP), total nitrogen (TN), and suspended solids (SS). The vertical axis represents the predicted concentration value of each index, in milligrams per liter (mg / L). Figure 2 The height of each column in the table intuitively reflects the water quality index prediction results output by the decision tree set after layer-by-layer node judgment and feature splitting operation.
[0038] from Figure 2 It can be observed that the predicted value of Chemical Oxygen Demand (COD) is approximately 28.5 mg / L, which is at a low level, indicating that the concentration of organic pollutants is within a controllable range. The predicted value of Ammonia Nitrogen (NH3-N) is 31.5 mg / L, which is at a moderately high level, close to the process control threshold, requiring attention to the stability of biological nitrogen removal efficiency. The predicted value of Total Phosphorus (TP) is approximately 29.8 mg / L, indicating a high phosphorus load, which may be related to insufficient current chemical dosage or phosphorus removal process parameter settings. The predicted value of Total Nitrogen (TN) reaches 34.0 mg / L, the highest among the five indicators, reflecting insufficient nitrification and denitrification efficiency that may be caused by an imbalance in the carbon-nitrogen ratio or a low reflux ratio. The predicted value of Suspended Solids (SS) is approximately 30.5 mg / L, which is at a moderate level, indicating that the sedimentation and separation effect is basically normal. Overall, the distribution of predicted values for different water quality indicators by the decision tree ensemble shows differentiated characteristics. Among them, the predicted values of Total Nitrogen and Ammonia Nitrogen are relatively high, and further analysis of the corresponding risk contribution needs to be conducted in conjunction with the current operating parameters to provide a quantitative basis for subsequent risk assessment of exceedances and extraction of key impact parameters.
[0039] In one alternative implementation, Based on the risk assessment value of exceeding the standard and the predicted value of the water quality index, a comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, a state-risk mapping relationship is constructed and key influencing parameters are extracted, including: The risk feature vector is obtained by performing feature embedding transformation on the risk assessment value of the exceedance, and the prediction feature vector is obtained by performing feature embedding transformation on the predicted value of the water quality index. The risk feature vector and the prediction feature vector are concatenated to obtain a fused feature vector. The fused feature vector is then subjected to multi-level nonlinear mapping to obtain a comprehensive prediction result. Extract the blower frequency parameter, dissolved oxygen concentration parameter, and sludge age parameter from the current operating condition parameters and construct an operating condition vector. Calculate the deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary to obtain the deviation matrix. Perform gradient perturbation analysis on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, solve for the risk contribution tensor and perform dimensionality reduction projection to construct the state-risk mapping relationship. The risk contribution of each working condition parameter in the state-risk mapping relationship is sorted in descending order, and the working condition parameters with a risk contribution greater than a preset contribution threshold are extracted as key influencing parameters and output.
[0040] The risk assessment values and water quality indicator prediction values are essentially numerical values with different dimensions and semantic spaces. Direct concatenation would lead to semantic aliasing. Therefore, separate feature embedding transformations are needed to map them to a unified latent space dimension before fusion. For the risk assessment values, a set of learnable linear projection matrices is used to expand them from scalar form into high-dimensional risk feature vectors. This projection process can capture implicit semantics such as risk magnitude, risk change trends, and risk confidence levels in different dimensions. For the water quality indicator prediction values, similarly, independent linear projection matrices are used to map them into equal-dimensional prediction feature vectors. These vectors encode information such as the deviation of the predicted value from the historical mean, the reasonableness confidence of the predicted value under current conditions, and the sensitivity of the predicted value to different control actions in each dimension. After aligning the dimensions of the two sets of feature vectors, a concatenation operation is performed on the feature dimensions to obtain a fused feature vector, whose dimension is the sum of the dimensions of the two sub-vectors. This allows for the simultaneous preservation of structured information from both risk assessment and prediction in the same vector space.
[0041] The fused feature vectors are then processed through a multi-layer nonlinear mapping network for deep feature extraction. Each mapping layer consists of a concatenated affine transformation and activation function. The affine transformation handles cross-dimensional feature recombination and information compression, while the activation function introduces nonlinearity to capture the complex coupling relationship between risk and predicted values. In practical deployments, considering the limited computing power at the edge, the number of nonlinear mapping layers is typically set to 2 to 3. Piecewise linear approximation forms of the activation function are used to reduce floating-point operation overhead. Batch normalization operations are inserted between layers to stabilize the numerical range of intermediate features and prevent gradient vanishing or feature scaling out of control in deep networks. The final layer output is then processed by linear activation to output a comprehensive prediction result. This result numerically reflects the combined risk level of water quality exceeding standards at the current moment and the joint confidence level of the predicted value, providing a unified evaluation benchmark for subsequent operational parameter analysis.
[0042] The blower frequency, dissolved oxygen concentration, and sludge age parameters are extracted from the current operating parameters. These three parameters characterize the operational status of the wastewater treatment process from three dimensions: aeration and oxygen supply capacity, real-time dissolved oxygen level, and biological treatment efficiency, respectively. An operating condition vector is constructed by arranging these three parameters in a fixed order. ,in This indicates the frequency parameter of the fan. This represents the dissolved oxygen concentration parameter. This represents the mud age parameter. Historical operating range boundaries are obtained through offline statistics; the lower boundary of the historical normal operating range is recorded for each parameter. and upper boundary subscript The parameter indexes correspond to three dimensions: blower frequency, dissolved oxygen concentration, and sludge age. The deviation distance is calculated as follows: when the parameter value falls within the historical operating range, the deviation distance is zero; when the parameter value is below the lower boundary, the deviation distance is the difference between the lower boundary and the parameter value; when the parameter value is above the upper boundary, the deviation distance is the difference between the parameter value and the upper boundary. The deviation distances of the three parameters are then arranged to form a deviation matrix. This matrix intuitively reflects the degree to which the current operating conditions deviate from the normal operating range. The greater the deviation, the more abnormal the current state of the parameter is, and the more significant its potential contribution to water quality exceeding the standard is.
[0043] The sensitivity coefficient is obtained by performing gradient perturbation analysis on the comprehensive prediction results. A small perturbation is applied to each parameter in the working condition vector. The output difference of the comprehensive prediction result under positive and negative disturbances is calculated separately. The ratio of this difference to the disturbance amount is used to approximately represent the local gradient of the comprehensive prediction result for the operating condition parameter, i.e., the sensitivity coefficient. The calculation method satisfies: ,in This indicates the comprehensive prediction results regarding the first... Mapping function for each operating condition parameter For the first The amount of disturbance applied to each operating parameter. Sensitivity coefficient. The larger the absolute value, the more sensitive the comprehensive prediction results are to changes in this parameter, and the more directly the parameter affects the current water quality risk. In edge-side implementation, the disturbance amount... Take 1% to 5% of the historical standard deviation of each parameter to ensure that the perturbation is small enough to satisfy the premise of local linear approximation, while being large enough to avoid interference from floating-point precision errors.
[0044] The risk contribution tensor is solved by comprehensively utilizing information from both the sensitivity coefficient and the deviation matrix. For each operating condition parameter... Its risk contribution Defined as the product of the absolute value of the sensitivity coefficient and the corresponding deviation distance, i.e. ,in The first in the deviation matrix The deviation distance values corresponding to each parameter. This calculation logic reflects a joint assessment of two dimensions: parameters with high sensitivity but small deviations from the normal range have limited actual risk contribution; parameters with large deviations but insensitive to the overall prediction results also do not constitute a major source of risk; only parameters with both high sensitivity and large deviations will generate significant risk contribution. The risk contribution tensor is constructed by arranging the risk contribution of the three parameters. ,in , , The risk contribution is respectively related to fan frequency, dissolved oxygen concentration, and sludge age.
[0045] The state-risk mapping relationship is constructed by performing a dimensionality reduction projection on the risk contribution tensor. A mapping is established between the coordinate axes of each parameter in the operating condition parameter space and their corresponding risk contribution, forming a multidimensional mapping structure with the operating condition state as the independent variable and the risk contribution distribution as the dependent variable. The dimensionality reduction projection operation compresses the risk distribution in the high-dimensional operating condition parameter space into a two- or three-dimensional interpretable space. The projection direction is determined by the magnitude of the risk contribution of each parameter; parameters with larger contributions retain more variance after projection, thus clearly distinguishing the risk distribution patterns under different operating conditions in the low-dimensional space. The state-risk mapping relationship is ultimately stored in the form of parameter-risk contribution pairs for subsequent extraction of key impact parameters and control decisions.
[0046] Risk contribution of each operating condition parameter in the state-risk mapping relationship Sort the values in descending order to obtain an ordered sequence of contributions. Then compare the sorted contributions with a preset contribution threshold. Comparing them one by one, the risk contribution is greater than Operating parameters are marked as key influencing parameters and output to subsequent control decision-making processes. Preset contribution threshold. The value of the threshold is typically determined based on the statistical distribution of the risk contribution of each parameter in historical operating data. The 75th to 90th percentile of this distribution is used as the threshold to ensure that false alarms are not triggered under normal operating conditions, while effectively identifying the core parameters that truly affect water quality exceedances under abnormal operating conditions. Through this descending order sorting and threshold screening mechanism, the goal of automatically locating high-risk driving factors from multiple operating parameters is achieved, providing precise parameter guidance for subsequent calculation of correction rules and generation of equipment adjustment quantities.
[0047] In one alternative implementation, The deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary is calculated to obtain the deviation matrix. Gradient perturbation analysis is performed on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, the risk contribution tensor is obtained and dimension reduction projection is performed to construct the state-risk mapping relationship, including: Extract the historical normal operating value range corresponding to each parameter in the operating condition vector from the preset historical operating database and determine the upper boundary value and lower boundary value. Calculate the minimum distance between the current value of each parameter in the operating condition vector and the upper boundary value and lower boundary value, and construct the deviation matrix according to the operating condition parameters. Apply positive and negative perturbations of preset magnitude to each operating parameter in the comprehensive prediction result, calculate the change in the comprehensive prediction result after applying the positive perturbation and the change in the comprehensive prediction result after applying the negative perturbation respectively, solve the gradient response curve based on the change in the comprehensive prediction result corresponding to the positive and negative perturbations, and extract the slope of the gradient response curve as the sensitivity coefficient of each operating parameter. The initial risk contribution tensor is obtained by performing a tensor outer product operation on the sensitivity coefficient and the deviation matrix. The initial risk contribution tensor is then subjected to singular value decomposition to extract the dominant singular vector. A dimension-reduced projection matrix is constructed based on the dominant singular vector. The initial risk contribution tensor is then transformed by the dimension-reduced projection matrix to obtain a dimension-reduced risk contribution matrix. A mapping relationship between the operating parameters and the risk contribution degree is constructed based on the dimension-reduced risk contribution matrix as a state-risk mapping relationship.
[0048] When extracting the historical normal operating value ranges corresponding to each parameter of the operating condition vector from the preset historical operating database, for the wind turbine frequency parameter... Dissolved oxygen concentration parameters Mud age parameters The numerical distribution range of each parameter under historical normal operating conditions was retrieved independently. The historical operation database stores operating condition records collected by the wastewater treatment plant during its long-term stable operation. By grouping and statistically analyzing these records according to parameter categories, the upper boundary value of normal operation for each parameter can be determined. and lower boundary value ,in The index corresponds to three dimensions: fan frequency, dissolved oxygen concentration, and sludge age. The upper and lower boundary values are usually determined using the quantile statistical method of historical data to eliminate the interference of occasional abnormal records on the interval estimation and ensure that the obtained interval can truly reflect the parameter fluctuation range of the equipment under normal operating conditions.
[0049] After obtaining the upper and lower boundaries of the historical operating ranges of each parameter, the operating condition vector is calculated. The minimum distance between the current value of each parameter and its corresponding boundary is used to quantify the degree to which the current operating state deviates from the normal range. For the th... Each operating parameter, if the current value falls within the range Within, then the deviation distance Setting it to zero indicates that the parameter is within its historical normal operating range; if the current value is below the lower boundary value, then... Equal to the current value and The absolute value of the difference; if the current value is higher than the upper boundary value, then Equal to the current value and The absolute value of the difference. The deviation matrix is constructed by combining the deviation values of the three operating parameters in the order of parameter arrangement. This matrix intuitively describes the spatial deviation structure between the current operating conditions and the historical normal operating range. The greater the deviation, the more abnormal the current state of the parameter is, and the higher its potential contribution to the risk of water quality exceeding standards.
[0050] The core of gradient perturbation analysis lies in quantifying the sensitivity of the comprehensive prediction results to changes in individual parameters by applying small perturbations to the operating parameters. This involves considering the comprehensive prediction results... Each operating parameter in the data is subject to a positive disturbance of a preset amplitude. and negative disturbance Disturbance amplitude The selection of needs to be sufficiently small while ensuring numerical stability, in order to approximate the true local gradient. After applying a positive perturbation, keeping other operating parameters constant, the is selected separately. Replace each parameter with The mapping function of the comprehensive prediction results is called again to obtain the perturbed prediction output, and the difference between this and the original prediction output is used to obtain the change in the comprehensive prediction result corresponding to the positive perturbation. Similarly, the first... Replace each parameter with This yields the change in the comprehensive prediction result corresponding to the negative disturbance.
[0051] Based on the combined predicted changes corresponding to positive and negative perturbations, the gradient response curve is solved using the central difference method. The central difference method has higher accuracy than the one-sided difference method, and can more accurately approximate the local slope of the function under the same perturbation amplitude. The difference between the changes caused by the positive and negative perturbations is divided by twice the perturbation amplitude. The slope of the gradient response curve at the current operating point is obtained, and this slope is taken as the first... Sensitivity coefficient of each working condition parameter Sensitivity coefficient The larger the absolute value, the more sensitive the comprehensive prediction results are to changes in this operating condition parameter. Even small fluctuations in this parameter will cause significant changes in the prediction results, thus giving it a more important role in risk assessment. (Regarding wind turbine frequency parameters...) Dissolved oxygen concentration parameters Mud age parameters After completing the above perturbation analysis, the corresponding sensitivity coefficients are obtained. , , This provides the computational foundation for constructing the risk contribution tensor, thus offering a quantitative basis for the subsequent work.
[0052] Combine the sensitivity coefficient vector with the deviation matrix Tensor outer product operations are performed to obtain the initial risk contribution tensor. This operation expands the two low-dimensional structures into a high-dimensional tensor, where each element comprehensively reflects the joint risk contribution of the corresponding operating parameter in terms of both sensitivity and deviation. Operating parameters with high sensitivity coefficients and significant deviations from historical normal ranges will have significantly larger values in the initial risk contribution tensor, indicating that these parameters have the most prominent comprehensive contribution to the risk of water quality exceeding standards under the current operating conditions. The initial risk contribution tensor retains complete information on the cross-influences between various operating parameters, but its high-dimensional structure is not convenient for direct extraction and visualization analysis of key influencing parameters; therefore, dimensionality reduction processing is required.
[0053] Singular value decomposition (SVD) is performed on the initial risk contribution tensor to extract the dominant singular vector corresponding to the largest singular value. SVD decomposes the tensor into a series of products of singular values and singular vectors, where the direction of the singular vector corresponding to the largest singular value represents the dominant direction in which the tensor's information content is most concentrated in the high-dimensional space. The dominant singular vector captures the most representative pattern in the risk contribution structure, significantly compressing the data dimensionality while preserving the main risk information. A dimensionality-reduced projection matrix is constructed based on the extracted dominant singular vector. This projection matrix maps the high-dimensional initial risk contribution tensor to a low-dimensional subspace, ensuring that the dimensionality-reduced structure still retains the relative magnitudes and main distribution characteristics of the risk contributions of each operating condition parameter.
[0054] The initial risk contribution tensor is projected using a dimension-reduced projection matrix to obtain a dimension-reduced risk contribution matrix. The rows or columns of this matrix correspond to the dimensions of the operating parameters, and the values in the matrix reflect the combined contribution intensity of each operating parameter in the low-dimensional risk space. The dimension-reduced risk contribution matrix is then aggregated according to the operating parameter dimensions to extract the risk contribution degree corresponding to each operating parameter. ,in Risk contribution corresponding to wind turbine frequency parameters Risk contribution of the corresponding dissolved oxygen concentration parameter The risk contribution of the corresponding mud age parameter, along with the other two factors, together constitute the risk contribution tensor. .
[0055] Based on the dimensionality-reduced risk contribution matrix, a mapping relationship between operating condition parameters and risk contribution is established as the state-risk mapping relationship. This mapping relationship uses the current operating condition vector. Taking the comprehensive prediction results as input, the output is a risk contribution vector corresponding to each operating condition parameter, thereby decomposing the abstract predicted risk into quantitative indicators attributable to specific operating condition parameters. The construction of the state-risk mapping relationship provides a clear mathematical basis for the subsequent extraction of key influencing parameters: the risk contribution of each operating condition parameter... Compared with the preset contribution threshold In comparison, the risk contribution exceeds The operating parameters are marked as key influencing parameters and prioritized for inclusion in the early warning trigger judgment and equipment adjustment calculation process. This dimensionality reduction projection and mapping construction mechanism effectively avoids the computational complexity problem caused by direct processing of high-dimensional tensors, while ensuring the physical interpretability of risk attribution results. This allows operators to intuitively understand which operating parameters are mainly driving the current water quality exceedance risk, providing a reliable basis for subsequent precise control.
[0056] Figure 3 This is a flowchart illustrating the equipment adjustment quantity solution and feasibility correction process for the wastewater quality prediction and control method based on edge reasoning, as described in an embodiment of the present invention.
[0057] In one alternative implementation, Based on the key influencing parameters and preset safety boundary constraints, it is determined whether an early warning is triggered. If triggered, the equipment adjustment amount is calculated according to preset correction rules and a feasibility verification is performed. If the verification passes, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment, including: Extract the upper and lower limits of the allowed operation corresponding to the key impact parameters from the preset safety boundary constraint configuration file, and make an out-of-bounds judgment between the current value of the key impact parameters and the upper and lower limits of the allowed operation and determine the warning level. Read the equipment control strategy corresponding to the warning level in the preset correction rule, extract the adjustment step size parameter of each device in the equipment control strategy, calculate the preliminary adjustment amount based on the key influence parameter and the predicted value of the water quality index, apply the preset decreasing attenuation factor to the preliminary adjustment amount and combine it with the preset historical adjustment residual to obtain the equipment adjustment amount; Extract the physical adjustment range and adjustment rate limit of each field execution device from the equipment operation constraint library, determine whether the device adjustment amount meets the physical adjustment range and adjustment rate limit and complete the feasibility verification. When the feasibility verification is passed, encode and encapsulate the device adjustment amount according to the field execution device identifier to obtain the control command, and send the control command to the corresponding field execution device through the edge side communication interface.
[0058] The system extracts the upper and lower limits of permissible operation for key influencing parameters from a pre-defined safety boundary constraint configuration file. The configuration file is stored in a structured format on the edge-side local storage medium. For each operating condition dimension (including fan frequency, dissolved oxygen concentration, sludge age, etc.) that could potentially be a key influencing parameter, the system records the permissible normal operating range boundaries under the current wastewater treatment process conditions. Unlike historical operating ranges, safety boundary constraints are hard boundaries pre-set by process engineers based on emission standards, equipment rated parameters, and biochemical reaction conditions, and therefore have stronger binding force. The upper limit of permissible operation is extracted. and allowed lower limit value Next, the current values of the key influencing parameters will be... Compare with both to determine whether a boundary violation has occurred.
[0059] The result of the boundary violation judgment directly determines the classification of the warning level. When Falling When the parameter is within the range, it will not trigger a warning; when... When the deviation exceeds the upper limit or falls below the lower limit, the warning level is further differentiated based on the magnitude of the deviation. Specifically, the deviation range is defined. The relative deviation between the current value and the nearest boundary, i.e. The numerator takes a positive value to ensure that the effective amplitude is calculated only when the range is exceeded, and the denominator uses the interval width as the normalization benchmark. When the value falls within a preset slightly out-of-bounds range (e.g., between 0 and 0.1), a Level 1 warning is triggered; when... When the value falls within the moderate out-of-bounds range (e.g., between 0.1 and 0.3), a level two warning is triggered; when When the threshold for severe exceedance is exceeded (e.g., above 0.3), a Level 3 warning is triggered. If multiple key influencing parameters exceed the threshold simultaneously, the highest warning level among all parameters is taken as the current comprehensive warning level, ensuring that subsequent control procedures are initiated with the strictest standards.
[0060] After determining the warning level, the system reads the equipment control strategy corresponding to that warning level from the preset correction rules. The correction rules are organized in the form of a rule table, with each rule containing a trigger condition (warning level number), a list of target devices, and the corresponding adjustment step size parameters for each device. The adjustment step size parameter represents the baseline amplitude of a single adjustment action by the corresponding equipment under the current warning level. Its value increases as the warning level rises to achieve a faster response. After extracting the adjustment step size parameter, it is used based on the current values of key influencing parameters and the predicted values of water quality indicators. Calculate the initial adjustment amount The calculation process considers information from two dimensions, including the magnitude of parameter out-of-bounds errors. The degree to which the current operating conditions deviate from the safety boundary is reflected, and the closeness between the predicted water quality index and the predicted threshold reflects the urgency of water quality deterioration. By weighting and superimposing the two values and combining them with the adjustment step size parameter, a preliminary numerical estimate of the adjustment amount is obtained, so that the adjustment action not only responds to the out-of-bounds operating conditions but also takes into account the predicted water quality trend.
[0061] Initial adjustment amount After processing with a decreasing attenuation factor and then correcting for historical adjustment residuals, the final equipment adjustment is obtained. Introducing a decreasing decay factor The purpose of this preset constant (within the range of 0 to 1, e.g., 0.85) is to prevent excessive cumulative adjustment during multiple consecutive adjustments, thus avoiding mechanical wear or process oscillations caused by frequent and large-amplitude movements of the actuator. Historical adjustment residuals The difference between the actual and expected deviations of water quality indicators after the last control command was executed is recorded and included in the current adjustment calculation. This can compensate for under- or over-adjustment caused by lag or nonlinear characteristics of the executing equipment. The equipment adjustment amount is determined by the following formula: ,in The historical residual compensation coefficient is used to control the influence weight of historical information on the current adjustment. Its value is pre-calibrated during the commissioning phase based on the response characteristics of different devices.
[0062] Obtain equipment adjustment amount Next, the physical adjustment range and adjustment rate limits of each field actuator are extracted from the equipment operation constraint library for feasibility verification. The equipment operation constraint library, indexed by equipment identifier, stores the rated adjustment range (i.e., the minimum and maximum allowable absolute setpoints) and the maximum allowable adjustment rate per unit time for each device. The physical adjustment range verification checks the adjusted target setpoint. Whether it falls within the equipment's rated range; adjustment rate limit verification check. The absolute value of the adjustment exceeds the maximum allowable adjustment range of the equipment within a single control cycle. If both checks pass, the adjustment range of the equipment is considered feasible; if either fails, then... The control commands are truncated to limit them to feasible boundary values, ensuring that the generated commands do not cause the equipment to operate beyond its limits or malfunction. The truncated control values are then recorded as the final executable control values and participate in the subsequent command encapsulation process.
[0063] After feasibility verification, the executable adjustment quantities of each field execution device are encoded and encapsulated according to the device identifier to generate structured control instructions. The data structure of the control instruction includes an instruction header (containing a timestamp, instruction sequence number, and sender identifier), a device identifier field, an adjustment type field (incremental adjustment or absolute value setting), and an adjustment quantity value field, with an additional checksum for communication integrity verification. After encapsulation, the control instructions are sent to the corresponding field execution devices via the edge-side communication interface. The edge-side communication interface supports commonly used wired communication protocols in industrial settings (such as Modbus TCP and PROFINET) and wireless communication protocols (such as industrial Wi-Fi and LoRa), automatically selecting the matching protocol for transmission based on the interface type of the field execution device. After the instruction is sent, the edge side records the sending timestamp and instruction content, providing a benchmark for subsequent execution result monitoring and water quality index deviation calculation.
[0064] Hard constraints on safety boundaries take precedence over soft adjustment strategies based on correction rules, and truncation of the physical adjustment range takes precedence over theoretically calculated adjustment amounts, ensuring that control commands generated under any circumstances do not exceed the safe operating range of the equipment. The introduction of decreasing attenuation factors and historical residual compensation mechanisms enables adaptive smoothing of the adjustment behavior, suppressing the risk of process oscillations while ensuring response speed, and adapting to the complex dynamic characteristics of both gradual and abrupt changes in operating parameters during wastewater treatment.
[0065] In one alternative implementation, The execution results of the control commands are monitored and water quality index deviations are calculated. Based on the water quality index deviations, the judgment thresholds in the correction rules are adaptively corrected and the correction rules are updated to obtain optimized correction rules, which are then output as follows: The actual operating parameters of the field execution equipment after responding to the control command are obtained through the data acquisition interface. The measured values of the effluent water quality index are extracted from the actual operating parameters. The difference between the measured values of the effluent water quality index and the predicted values of the water quality index is calculated to obtain the prediction deviation. The prediction deviation is accumulated and statistically analyzed over time to obtain the deviation sequence. The root mean square deviation and the deviation trend coefficient are calculated and combined based on the deviation sequence to obtain the water quality index deviation. Extract the currently used judgment threshold and threshold adjustment boundary from the correction rule, compare the water quality index deviation with the preset deviation tolerance range, calculate the threshold correction increment when the water quality index deviation exceeds the deviation tolerance range, determine the threshold adjustment direction and adjustment range based on the threshold correction increment and the deviation trend coefficient, apply the adjustment range to the judgment threshold and constrain it within the threshold adjustment boundary to obtain the corrected judgment threshold; Replace the currently used judgment threshold in the correction rule with the corrected judgment threshold, synchronously update the device control strategy parameters associated with the currently used judgment threshold in the correction rule, and store the updated correction rule as an optimized correction rule in the edge-side rule base.
[0066] The system continuously monitors the operational status of the field equipment via a data acquisition interface. After control commands are issued, the feedback registers of each device are polled at a fixed sampling period to obtain actual operating parameters. These parameters include process quantities at the equipment level such as fan speed, aeration valve opening, and return pump frequency, as well as terminal water quality measurements such as effluent turbidity, ammonia nitrogen concentration, and total phosphorus concentration uploaded by online water quality instruments. Measured values of effluent water quality indicators are extracted from these actual operating parameters. These measured values, after instrument range calibration and outlier removal, serve as the baseline input for subsequent deviation calculations. The measured values of effluent water quality indicators are then compared with the predicted values of water quality indicators previously obtained through decision tree ensemble reasoning. The difference is calculated to obtain the prediction bias at a single sampling time. ,in , These are the measured values of the effluent water quality indicators.
[0067] For prediction bias Accumulated storage is performed in chronological order, forming a length of... deviation sequence ,in This represents the total number of sampling points within the statistical window. The root mean square deviation is calculated based on this deviation sequence. The calculation method is as follows , This reflects the overall magnitude of the prediction error; a larger value indicates a lower degree of agreement between the current prediction model and the actual water quality. While calculating the root mean square deviation, a linear trend fitting is performed on the deviation sequence, and the slope of the deviation evolution over time is estimated using the least squares method. This slope is defined as the deviation trend coefficient. , This indicates that the prediction bias is showing a continuous increasing trend. This indicates that the prediction bias is converging. This indicates that the deviation is in a state of random fluctuation. The root mean square deviation... Deviation trend coefficient The comprehensive water quality index deviation was obtained by weighted combination. The combination formula is ,in The root mean square deviation weight is used. The trend coefficient weights are 1, and the specific values are determined during the offline commissioning phase based on the emphasis placed on prediction accuracy and trend response by the wastewater treatment process.
[0068] Read the current correction rule from the edge-side rule base and extract the recorded judgment threshold. and threshold adjustment boundary ,in To determine the lower limit of the threshold that can be adjusted, To determine the upper limit of permissible threshold adjustments, both are constrained by process design specifications and emission standards, written into the rule initialization phase and kept fixed during normal operation. This integrates the deviations of water quality indicators. Deviation tolerance range from the preset value Comparison, among which This is the lower bound of the deviation tolerance interval. This is the upper bound of the deviation tolerance interval. When the prediction falls within the tolerance range, the current prediction accuracy is deemed sufficient, the threshold does not require adjustment, and the correction rule maintains the current output. When the deviation exceeds the tolerance range, the threshold correction process is triggered to calculate the threshold correction increment. .
[0069] Threshold correction increment The calculation is based on the extent to which the deviation exceeds the tolerance range, and the excess amount is defined. (when (time) or (when (when), then ,in This is the threshold correction sensitivity coefficient, ranging from 0 to 1. It reflects the driving force of a unit deviation exceeding the threshold. A value that is too large will cause frequent and drastic fluctuations in the threshold, while a value that is too small will result in a sluggish correction response. Based on the determined correction increment, this is combined with the deviation trend coefficient. Determine the direction of threshold adjustment: when Furthermore, when the predicted value remains consistently high, the judgment threshold should be adjusted towards tightening, i.e., reducing the threshold to trigger an early warning; when Furthermore, as prediction bias tends to converge, the judgment threshold can be moderately adjusted towards a more relaxed direction to avoid frequent false alarms. The adjustment range is within... Introducing a trend correction factor ,make ,in This is the trend influence coefficient. This serves as the upper limit for truncation of the trend coefficient, preventing extreme trends from causing the correction to spiral out of control. This is the sign function. The final actual adjustment range is... .
[0070] Candidate correction values are obtained by applying an adjustment to the judgment threshold. ,Will The constraint is within the threshold adjustment boundary. After correction, the threshold is determined. The constraint rule is: if ,but ;like ,but ;otherwise Boundary constraints ensure that the corrected judgment threshold always remains within the safe range allowed by the process, and will not drift to an unreasonable range due to the accumulation of continuous deviations, thereby ensuring the basic reliability of the early warning mechanism.
[0071] Use the corrected threshold to determine Replace the original rules Simultaneously, the equipment control strategy parameters associated with the judgment threshold are updated synchronously. These parameters include reference values for the adjustment step size and residual compensation coefficient of each executing device. These parameters are bound to the judgment threshold partition in the correction rules using a lookup table. When the judgment threshold changes, the corresponding parameter partition mapping relationship needs to be refreshed to ensure that the control action triggered under the new threshold condition matches the actual deviation of the current water quality state. The update method is based on the threshold change. The direction and magnitude of the parameters are scaled proportionally to the associated parameters. The scaling ratio is determined by the parameter-threshold coupling curve calibrated in the offline experiment. This curve is written into the edge-side rule base during rule initialization and is read-only during runtime.
[0072] Includes the corrected judgment threshold The complete revised rules for the synchronized updated equipment control strategy parameters are used as optimization and correction rules and written to the edge-side rule base in an incrementing version number manner, overwriting the original version. The edge-side rule base adopts a lightweight key-value storage structure, and the version number field ensures that if an anomaly such as a power outage occurs during the writing process, the old version of the rules can still be fully recovered, avoiding a corrupted state of partially written rules. After the optimization and correction rules are written, a rule update notification is sent to the upper-layer scheduling process. Subsequent early warning judgments and equipment adjustment calculations are all executed based on the new version of the optimization and correction rules, thereby achieving closed-loop adaptive correction based on actual water quality feedback.
[0073] In real-world wastewater treatment scenarios, influent water quality is affected by factors such as seasonal variations and rainfall impacts, causing the deviation between the prediction model and the actual water quality to drift slowly over time. The aforementioned adaptive correction mechanism continuously monitors the root mean square magnitude and trend direction of the deviation sequence, dynamically adjusting the judgment threshold. This allows the correction rules to track water quality changes, maintaining the effectiveness of control decisions without retraining the prediction model, significantly reducing edge-side computational resource consumption, and simultaneously maintaining high early warning accuracy and timely control response.
[0074] Figure 4 The graph shown is a monitoring curve of the control command execution effect of the wastewater quality prediction and control method based on edge inference in this embodiment of the invention. It shows the measured trend of the chemical oxygen demand (COD) of the effluent changing over time after the equipment responds to the control command. Figure 4 The horizontal axis represents the sampling time series, with the current control command issuance time as the reference point (marked as t0), and five consecutive monitoring time points from t0 to t+4 are recorded sequentially; the vertical axis represents the measured COD concentration value of the effluent, in milligrams per liter (mg / L), reflecting the dynamic response process of water quality indicators after the execution of the control command.
[0075] from Figure 4 It can be observed that after the control command is issued and executed, the COD concentration in the effluent shows a continuous downward trend. At time t0 (the last sampling point before the command execution), the measured COD value was 28.5 mg / L, indicating that the process was still in its initial state before adjustment. After one monitoring cycle, the measured COD value at time t+1 dropped to 27.8 mg / L, indicating that the adjustment of operating parameters by the executing equipment (such as blowers and reflux pumps) had initially affected the biochemical reaction system, and the organic matter degradation efficiency had improved. At time t+2, the COD further decreased to 26.9 mg / L, with the rate of decrease narrowing but still maintaining a downward trend. The measured value at time t+3 was 26.0 mg / L, and at time t+4 it reached 25.5 mg / L, a cumulative decrease of approximately 3.0 mg / L compared to the initial value, representing a decrease of approximately 10.5%.
[0076] Overall, the execution effect of the control commands showed a stable and continuous optimization trend. The COD reduction at each monitoring time was 0.7, 0.9, 0.9 and 0.5 mg / L, respectively. The fluctuation range was small, indicating that the adjustment amount was well adapted to the current process state after feasibility verification, and there was no over-adjustment or oscillation. It effectively supported the stable compliance of the effluent water quality.
[0077] A second aspect of the present invention provides a wastewater quality prediction and control system based on edge inference, comprising: The data preparation unit is used to acquire multi-source time-series data of the sewage treatment system, perform time alignment and fill missing values to obtain complete time-series data, construct a sliding window based on the complete time-series data and calculate the rate of change feature, acquire the current operating condition parameters and concatenate and standardize them with the rate of change feature to obtain a normalized feature vector. The prediction and evaluation unit is used to input the normalized feature vector into the decision tree set stored on the edge side, perform layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index, determine the risk assessment value of exceeding the standard based on the predicted value of water quality index and the preset prediction threshold, solve for the comprehensive prediction result based on the risk assessment value of exceeding the standard and the predicted value of water quality index, construct the state risk mapping relationship based on the comprehensive prediction result and the current operating condition parameters, and extract key influencing parameters. The early warning control unit is used to determine whether to trigger an early warning based on the key influencing parameters and preset safety boundary constraints. If triggered, it calculates the equipment adjustment amount and performs a feasibility verification according to preset correction rules. If the verification is successful, it generates a control command based on the equipment adjustment amount and sends it to the field execution equipment. The rule correction unit is used to monitor the execution result of the control command and calculate the water quality index deviation, adaptively correct the judgment threshold in the correction rule based on the water quality index deviation, update the correction rule, obtain the optimized correction rule, and output it.
[0078] A third aspect of the present invention provides an electronic device, comprising: A processor and a memory for storing processor-executable instructions, wherein the processor is configured to invoke instructions stored in the memory to perform the aforementioned method.
[0079] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0080] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0081] 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 scope of the technical solutions of the embodiments of the present invention.
Claims
1. A wastewater quality prediction and control method based on edge reasoning, characterized in that, include: Multi-source time-series data of the wastewater treatment system are acquired and time-aligned and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data and the rate of change feature is calculated. The current operating condition parameters are acquired and concatenated with the rate of change feature and standardized to obtain a normalized feature vector. The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined. Based on the risk assessment value of exceeding the standard and the predicted value of water quality index, the comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, the state risk mapping relationship is constructed and key influencing parameters are extracted. Based on the key influencing parameters and preset safety boundary constraints, it is determined whether to trigger an early warning. If triggered, the equipment adjustment amount is calculated and a feasibility verification is performed according to the preset correction rules. If the verification is successful, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment. The execution results of the control command are monitored and the deviation of water quality indicators is calculated. Based on the deviation of water quality indicators, the judgment threshold in the correction rule is adaptively corrected and the correction rule is updated to obtain an optimized correction rule and output it.
2. The method according to claim 1, characterized in that, Multi-source time-series data of the wastewater treatment system are acquired, time-aligned, and missing values are filled to obtain complete time-series data. A sliding window is constructed based on the complete time-series data, and the rate of change feature is calculated. Current operating parameters are obtained and concatenated with the rate of change feature, then standardized to obtain a normalized feature vector, including: The influent flow rate, reflux ratio, and chemical dosage time series data of the wastewater treatment system are obtained from the distributed acquisition interface and combined to obtain multi-source time series data. The timestamps of the multi-source time series data are extracted and a unified time axis is constructed for resampling to obtain an aligned time series dataset. The missing positions in the aligned time series dataset are identified, and the valid data points before and after the missing positions are extracted and the time distance weight is calculated. The complete time series data is obtained based on the time distance weight and the valid data points before and after the missing positions. Based on the complete time series data, a sliding window of fixed length is set and slides according to a preset step size. At each sliding window position, the numerical sequence within the window is extracted. The difference between the starting value and the ending value of the numerical sequence is calculated and combined with the window time length to obtain the first-order rate of change. The numerical sequence is then subjected to a second difference calculation and divided by the square of the window time length to obtain the second-order rate of change. The first-order rate of change and the second-order rate of change are combined to obtain the rate of change feature. The current operating condition parameters are obtained by acquiring the fan frequency parameters, dissolved oxygen concentration parameters, and sludge age parameters at the current moment. The current operating condition parameters are then concatenated with the rate of change feature to obtain a concatenated feature vector. The mean and standard deviation of each dimension of the concatenated feature vector are calculated and standardized to obtain a normalized feature vector.
3. The method according to claim 1, characterized in that, The normalized feature vector is input into the decision tree set stored on the edge side for layer-by-layer node judgment and feature splitting operations to obtain the predicted value of water quality index. Based on the predicted value of water quality index and the preset prediction threshold, the risk assessment value of exceeding the standard is determined, including: Read the root nodes of each decision tree in the decision tree set stored on the edge side, match the feature values of each dimension in the normalized feature vector with the split feature index of the root node, extract the feature values of the corresponding dimensions of the matched feature vector and compare them with the split threshold of the root node, determine the target child node based on the comparison result, enter the target child node and read the split feature index and split threshold of the target child node, repeat the feature value extraction and threshold comparison judgment on the normalized feature vector and continue node jumping until the leaf node is reached, and read the predicted value stored in the leaf node as the output value of the current decision tree; Traverse all decision trees in the decision tree set and obtain the output value of each decision tree. Then, perform a weighted summation of the output values to obtain the predicted water quality index value. The predicted value of the water quality index is compared with a preset prediction threshold. When the predicted value of the water quality index is greater than the prediction threshold, the difference between the predicted value of the water quality index and the prediction threshold is calculated, and the normalized exceedance range is calculated based on the difference. The normalized exceedance range is then subjected to a nonlinear mapping transformation to obtain an exceedance risk assessment value. When the predicted value of the water quality index is less than the prediction threshold, a preset safety benchmark value is obtained and used as the exceedance risk assessment value.
4. The method according to claim 1, characterized in that, Based on the risk assessment value of exceeding the standard and the predicted value of the water quality index, a comprehensive prediction result is obtained. Based on the comprehensive prediction result and the current operating condition parameters, a state-risk mapping relationship is constructed and key influencing parameters are extracted, including: The risk feature vector is obtained by performing feature embedding transformation on the risk assessment value of the exceedance, and the prediction feature vector is obtained by performing feature embedding transformation on the predicted value of the water quality index. The risk feature vector and the prediction feature vector are concatenated to obtain a fused feature vector. The fused feature vector is then subjected to multi-level nonlinear mapping to obtain a comprehensive prediction result. Extract the blower frequency parameter, dissolved oxygen concentration parameter, and sludge age parameter from the current operating condition parameters and construct an operating condition vector. Calculate the deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary to obtain the deviation matrix. Perform gradient perturbation analysis on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, solve for the risk contribution tensor and perform dimensionality reduction projection to construct the state-risk mapping relationship. The risk contribution of each working condition parameter in the state-risk mapping relationship is sorted in descending order, and the working condition parameters with a risk contribution greater than a preset contribution threshold are extracted as key influencing parameters and output.
5. The method according to claim 4, characterized in that, The deviation distance of each parameter in the operating condition vector relative to the pre-acquired historical operating interval boundary is calculated to obtain the deviation matrix. Gradient perturbation analysis is performed on the comprehensive prediction results to obtain the sensitivity coefficient of each operating condition parameter. Based on the sensitivity coefficient and the deviation matrix, the risk contribution tensor is obtained and dimension reduction projection is performed to construct the state-risk mapping relationship, including: Extract the historical normal operating value range corresponding to each parameter in the operating condition vector from the preset historical operating database and determine the upper boundary value and lower boundary value. Calculate the minimum distance between the current value of each parameter in the operating condition vector and the upper boundary value and lower boundary value, and construct the deviation matrix according to the operating condition parameters. Apply positive and negative perturbations of preset magnitude to each operating parameter in the comprehensive prediction result, calculate the change in the comprehensive prediction result after applying the positive perturbation and the change in the comprehensive prediction result after applying the negative perturbation respectively, solve the gradient response curve based on the change in the comprehensive prediction result corresponding to the positive and negative perturbations, and extract the slope of the gradient response curve as the sensitivity coefficient of each operating parameter. The initial risk contribution tensor is obtained by performing a tensor outer product operation on the sensitivity coefficient and the deviation matrix. The initial risk contribution tensor is then subjected to singular value decomposition to extract the dominant singular vector. A dimension-reduced projection matrix is constructed based on the dominant singular vector. The initial risk contribution tensor is then transformed by the dimension-reduced projection matrix to obtain a dimension-reduced risk contribution matrix. A mapping relationship between the operating parameters and the risk contribution degree is constructed based on the dimension-reduced risk contribution matrix as a state-risk mapping relationship.
6. The method according to claim 1, characterized in that, Based on the key influencing parameters and preset safety boundary constraints, it is determined whether an early warning is triggered. If triggered, the equipment adjustment amount is calculated according to preset correction rules and a feasibility verification is performed. If the verification passes, a control command is generated based on the equipment adjustment amount and sent to the field execution equipment, including: Extract the upper and lower limits of the allowed operation corresponding to the key impact parameters from the preset safety boundary constraint configuration file, and make an out-of-bounds judgment between the current value of the key impact parameters and the upper and lower limits of the allowed operation and determine the warning level. Read the equipment control strategy corresponding to the warning level in the preset correction rule, extract the adjustment step size parameter of each device in the equipment control strategy, calculate the preliminary adjustment amount based on the key influence parameter and the predicted value of the water quality index, apply the preset decreasing attenuation factor to the preliminary adjustment amount and combine it with the preset historical adjustment residual to obtain the equipment adjustment amount; Extract the physical adjustment range and adjustment rate limit of each field execution device from the equipment operation constraint library, determine whether the device adjustment amount meets the physical adjustment range and adjustment rate limit and complete the feasibility verification. When the feasibility verification is passed, encode and encapsulate the device adjustment amount according to the field execution device identifier to obtain the control command, and send the control command to the corresponding field execution device through the edge side communication interface.
7. The method according to claim 1, characterized in that, The execution results of the control commands are monitored and water quality index deviations are calculated. Based on the water quality index deviations, the judgment thresholds in the correction rules are adaptively corrected and the correction rules are updated to obtain optimized correction rules, which are then output as follows: The actual operating parameters of the field execution equipment after responding to the control command are obtained through the data acquisition interface. The measured values of the effluent water quality index are extracted from the actual operating parameters. The difference between the measured values of the effluent water quality index and the predicted values of the water quality index is calculated to obtain the prediction deviation. The prediction deviation is accumulated and statistically analyzed over time to obtain the deviation sequence. The root mean square deviation and the deviation trend coefficient are calculated and combined based on the deviation sequence to obtain the water quality index deviation. Extract the currently used judgment threshold and threshold adjustment boundary from the correction rule, compare the water quality index deviation with the preset deviation tolerance range, calculate the threshold correction increment when the water quality index deviation exceeds the deviation tolerance range, determine the threshold adjustment direction and adjustment range based on the threshold correction increment and the deviation trend coefficient, apply the adjustment range to the judgment threshold and constrain it within the threshold adjustment boundary to obtain the corrected judgment threshold; Replace the currently used judgment threshold in the correction rule with the corrected judgment threshold, synchronously update the device control strategy parameters associated with the currently used judgment threshold in the correction rule, and store the updated correction rule as an optimized correction rule in the edge-side rule base.
8. A wastewater quality prediction and control system based on edge inference, used to implement the method of any one of claims 1-7, characterized in that, include: The data preparation unit is used to acquire multi-source time-series data of the sewage treatment system, perform time alignment and fill missing values to obtain complete time-series data, construct a sliding window based on the complete time-series data and calculate the rate of change feature, acquire the current operating condition parameters and concatenate and standardize them with the rate of change feature to obtain a normalized feature vector. The prediction and evaluation unit is used to input the normalized feature vector into the decision tree set stored on the edge side, perform layer-by-layer node judgment and feature splitting operation to obtain the predicted value of water quality index, determine the risk assessment value of exceeding the standard based on the predicted value of water quality index and the preset prediction threshold, solve for the comprehensive prediction result based on the risk assessment value of exceeding the standard and the predicted value of water quality index, construct the state risk mapping relationship based on the comprehensive prediction result and the current operating condition parameters, and extract key influencing parameters. The early warning control unit is used to determine whether to trigger an early warning based on the key influencing parameters and preset safety boundary constraints. If triggered, it calculates the equipment adjustment amount and performs a feasibility verification according to preset correction rules. If the verification is successful, it generates a control command based on the equipment adjustment amount and sends it to the field execution equipment. The rule correction unit is used to monitor the execution result of the control command and calculate the water quality index deviation, adaptively correct the judgment threshold in the correction rule based on the water quality index deviation, update the correction rule, obtain the optimized correction rule, and output it.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.
