AI-driven water tank age full-cycle recording and intelligent early warning method

CN122761573APending Publication Date: 2026-09-15杭州浩水科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610904022.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-23
Publication Date
2026-09-15

AI Technical Summary

Technical Problem

问题一,静态预警模型缺少对真实流场的感知与校准,且定点检测的方式无法覆盖整个水龄周期,导致预测与实际偏差较大,检测覆盖范围小,无法满足整个供水链路的监测需求;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122761573A_ABST
    Figure CN122761573A_ABST
Patent Text Reader

Abstract

The application provides an AI-driven water tank water age full-cycle recording and intelligent early warning method, relates to the technical field of water quality monitoring, injects a trace amount of a safe tracer when water enters a water tank, the safe tracer diffuses with the water flow as the unique identity of the water body, captures the concentration spatial distribution of the safe tracer in the water tank in real time, takes the real observation data as a strong constraint condition, reversely and dynamically calibrates a preset computational fluid dynamics model, updates a digital twin, calibrates a virtual model through physical measurement data feedback, thereby calculates a full-cycle water age distribution map with centimeter-level precision and second-level refresh, constructs a machine learning early warning model fused with multi-source dynamic data, adaptively updates and adjusts a dynamic early warning threshold, can dynamically adjust the early warning threshold according to multi-dimensional parameters and perform early warning, realizes active defense, improves the safety guarantee level and operation intelligent degree of the water supply system, and realizes all-around accurate monitoring of the entire water supply link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water quality monitoring technology, specifically to an AI-driven method for recording and intelligently warning about the full life cycle of water age in water tanks. Background Technology

[0002] Water age, as a key indicator of the time water remains in a water tank or water supply system, directly affects the safety of water quality. Excessive water age leads to residual chlorine decay and increased risk of microbial growth, easily causing water quality deterioration. Currently, water age management and early warning are mainly achieved through the following methods: First, manual management based on fixed-time scheduling or simple experience is not scientific enough and is inefficient. Second, theoretical calculations are made using static hydraulic or water quality models based on theoretical assumptions, but these cannot obtain the real and dynamic flow field and mixing state inside the water tank, resulting in a huge deviation between the calculation results and the actual water age. Third, delayed alarms rely on fixed water age thresholds or single water quality parameters, and the detection method is generally fixed-point instantaneous monitoring, which cannot capture the entire water age cycle. The static early warning mode ignores the impact of dynamic factors such as seasonal temperature changes and fluctuations in water use patterns on the rate of water quality deterioration, resulting in insufficient accuracy and sensitivity in prediction.

[0003] In summary, existing water age detection and early warning technologies have the following technical problems: Problem 1: The static early warning model lacks perception and calibration of the real flow field, and the fixed-point detection method cannot cover the entire water age cycle, resulting in a large deviation between prediction and reality, a small detection coverage, and an inability to meet the monitoring needs of the entire water supply chain. Problem 2: Existing early warning methods cannot quantify the impact of dynamic external environmental factors such as temperature and water load on water quality deterioration, which can easily lead to untimely warnings or missed or false alarms. At the same time, the detection of single water quality parameters and fixed water age thresholds cannot adapt to dynamically changing scenarios, resulting in the inability to make early proactive predictions. The accuracy and timeliness of early warnings are insufficient, which is not conducive to actual water supply monitoring and management. Summary of the Invention

[0004] To achieve the above objectives, the present invention provides the following technical solution: an AI-driven method for recording and intelligently warning about the full lifecycle of water age in water tanks, the method comprising: During the water tank filling process, a safety tracer is injected, and tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data are collected simultaneously. The pre-set computational fluid dynamics model of the water tank is dynamically calibrated based on tracer concentration field data and hydraulic condition data. A digital twin is constructed and updated by running the computational fluid dynamics model of the water tank. The motion trajectory of the water body identified by the safety tracer is simulated and recorded based on the digital twin, and the full-cycle trajectory of the water age is generated. By inputting environmental and historical context data, water quality data, and the full-cycle trajectory of water age into the early warning model, dynamic early warning thresholds and the risk probability values ​​of future water quality deterioration are calculated, and graded early warning information is generated. The system executes tiered early warning information and collects actual water quality change data after execution. It then compares the actual water quality change data with the risk probability value of future water quality deterioration to generate comparison results. Based on these comparison results, the early warning model is optimized and updated.

[0005] Furthermore, the process of injecting a safety tracer during the water tank filling process, and simultaneously collecting tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data, includes: By using sensors pre-installed at different depths and horizontal positions inside the water tank, the concentration and spatial distribution of the safety tracer are detected in real time, and tracer concentration field data is obtained. The system acquires data on the instantaneous inflow rate, instantaneous outflow rate, cumulative water volume, and water level of the water tank to generate hydraulic operating condition data. Acquire water quality data from the water tank, including residual chlorine concentration, turbidity, pH value, and water temperature. Acquire real-time temperature data, real-time water flow sequences, and historical water quality records to form environmental and historical contextual data; A unified time-synchronized timestamp is added to the acquired tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data. After data cleaning and outlier removal, a multidimensional time series dataset with synchronized time and uniform format is formed.

[0006] Furthermore, the dynamic calibration of the preset computational fluid dynamics model of the water tank based on tracer concentration field data and hydraulic condition data, and the construction and updating of the digital twin, includes: The three-dimensional geometric parameters of the water tank are obtained to construct a three-dimensional mesh of the water tank. The computational fluid dynamics model of the water tank is initialized based on hydraulic condition data, and the initial flow field boundary conditions and key parameters are set. Based on the computational fluid dynamics model of the water tank, the spatial distribution of tracer concentration is simulated. The tracer concentration field data is used as the real-time observation value. With the goal of minimizing the prediction error between the simulated spatial distribution of tracer concentration and the real-time observation value, the key parameters in the computational fluid dynamics model of the water tank are adjusted in reverse. The key parameters include the turbulent viscosity coefficient and the wall drag coefficient. Iterative simulations continue based on the adjusted key parameters until the prediction error for a specified number of consecutive iterations is less than a preset error threshold, or the maximum number of iterations is reached, at which point the iteration stops, thus completing the dynamic calibration and real-time update of the digital twin.

[0007] Furthermore, the step of simulating and recording the movement trajectory of the water body identified by the safety tracer based on a digital twin to generate a full-cycle water age trajectory includes: Based on the digital twin, the water body with safety tracer identification is defined as discrete tracer particles, and the displacement vector of each tracer particle is calculated at each calculation time step. Based on the displacement vector of the tracer particles, the entire process of migration, mixing and leaving the water tank after each tracer particle enters the water tank is continuously tracked, and the spatial position sequence and time sequence of each tracer particle in the entire process are recorded. A full-cycle water age trajectory is generated based on spatial location sequences and time sequences. The full-cycle water age trajectory includes the individual movement paths and residence times of all tracer particles.

[0008] Furthermore, the step of inputting environmental and historical context data, water quality data, and the full-cycle trajectory of water age into the early warning model, calculating dynamic early warning thresholds and the probability value of future water quality deterioration, and generating graded early warning information includes: Non-numerical data from environmental and historical context data is acquired, encoded as features, and transformed into numerical feature vectors. The numerical feature vector is input into a pre-trained first machine learning model for calculation and then outputs a dynamic warning threshold, which includes a warning water age threshold and a critical water age threshold.

[0009] Furthermore, the calculation of the dynamic early warning threshold and the probability value of future water quality deterioration includes: Trajectory feature parameters are extracted from the water age full-cycle trajectory, including the maximum water age, average water age, and standard deviation of water age spatial distribution. The trajectory feature parameters, water quality parameters, and dynamic early warning thresholds are combined to form a comprehensive feature vector; The comprehensive feature vector is input into the second machine learning model for coupled analysis, and the output represents the probability value of the risk that the water quality parameters in the water tank will exceed the safety standard within a specified time period in the future.

[0010] Furthermore, the tiered early warning information includes first-level early warning information, second-level early warning information, and third-level early warning information; Set a first risk threshold and a second risk threshold, with the second risk threshold being greater than the first risk threshold, and obtain the risk probability value and the current maximum water age value in the full-cycle water age trajectory; When the risk probability value is less than the first risk threshold and the current maximum water age value is less than or equal to the warning water age threshold, a first-level warning message is generated. When the risk probability value is greater than or equal to the first risk threshold and less than the second risk threshold, or when the current maximum water age value is greater than the warning water age threshold and less than the critical water age threshold, a second-level warning message is generated. When the risk probability value is greater than or equal to the second risk threshold, or when the current maximum water age value is greater than or equal to the critical water age threshold, a third-level early warning message is generated.

[0011] Furthermore, the comparison of actual water quality change data with the probability value of future water quality deterioration to generate comparison results includes: The system acquires and executes graded early warning information, collects water quality data after the execution of graded early warning information as real-time water quality change data, analyzes the actual degree of water quality deterioration based on real-time water quality change data, obtains the actual degree of deterioration level, and divides it based on the magnitude of risk probability value to generate predicted degree of deterioration level. The actual degree of degradation is compared with the predicted degree of degradation to generate a comparison result. The comparison result is used to identify the type of warning, and the warning type includes conservative prediction, accurate prediction and aggressive prediction. If the actual degree of deterioration is lower than the predicted degree of deterioration, it is marked as a conservative prediction. If the actual degree of degradation is equal to the predicted degree of degradation, it is marked as an accurate prediction. If the actual degree of degradation is higher than the predicted degree of degradation, it is marked as an aggressive prediction.

[0012] Furthermore, the optimization and updating of the early warning model based on the comparison results includes: Obtain the complete data record of this event after the comparison results are generated, and add the complete data record as a training sample to the historical training dataset. The complete data record includes the environmental and historical context data collected in step S100, the water age full-cycle trajectory features generated in step S200, the risk probability value calculated in step S300, and the comparison results. The early warning model is optimized and updated based on historical training datasets. The early warning model includes a first machine learning model and a second machine learning model.

[0013] Furthermore, in the environmental and historical context data, the real-time temperature data includes real-time inlet water temperature and real-time ambient temperature; Water use pattern characteristic curves are obtained based on real-time water flow sequence analysis, and these curves are used to represent the peak water use period, normal water use period, and low water use period each day. The historical water quality records include residual chlorine decay curves and records of abnormal events for the same historical period.

[0014] This invention provides an AI-driven method for recording and intelligently warning about the full lifecycle of water age in water tanks. It offers the following advantages: 1. This invention achieves accurate calculation of water age in water tanks rather than preliminary estimation by introducing a safety tracer as a physical anchor and combining it with a data-driven, dynamically calibrated digital twin. A trace amount of safety tracer is injected when water enters the tank. This tracer, acting as a unique identifier for the water, diffuses with the water flow. A deployed sensor array captures the tracer concentration field data within the tank in real time. This tracer concentration field data is used as a strong constraint to dynamically calibrate the preset digital twin. Physical measurement data is fed back to calibrate the virtual model. This combination of physical and simulation verification allows the digital twin to continuously mirror the complex mixing and flow states within the real water tank. This enables precise tracking of the complete movement trajectory of each identified water element, resulting in a full-cycle water age distribution map with centimeter-level accuracy and second-level updates. This completely changes the previous reliance on coarse estimations for water age management, achieving comprehensive and accurate monitoring of the entire water supply chain.

[0015] 2. This invention employs a machine learning-based early warning model that integrates multi-source dynamic data. It adaptively updates and adjusts dynamic early warning thresholds. Multi-dimensional environmental and historical data, such as real-time temperature, historical water quality, and dynamic water usage patterns, are encoded into numerical feature vectors. A first machine learning model generates and flexibly adjusts the early warning water age threshold and critical water age threshold in real time, taking into account factors such as seasons and peak water usage. The dynamic early warning threshold, real-time water age trajectory features, and water quality change trend parameters are combined and input into a second machine learning model for coupled analysis. This model outputs a probability value for water quality deterioration within a specific future timeframe. After each early warning action, the actual water quality change data is automatically compared with the prediction results to generate a feedback signal for continuous iterative optimization of the early warning model. Through repeated optimization and learning, it can issue tiered early warning information in the early stages when water quality indicators have not yet exceeded standards but risks have already accumulated. This achieves proactive defense from alarm to warning, improving the safety and intelligence of the water supply system and enhancing the situational awareness, prediction accuracy, and long-term adaptability of the early warning system. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating the steps of the AI-driven water tank water age full-cycle recording and intelligent early warning method of the present invention. Figure 2 This is a data transmission flowchart of the AI-driven water tank water age full-cycle recording and intelligent early warning method of the present invention. Detailed Implementation

[0017] 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] like Figures 1 to 2 As shown, an AI-driven method for recording and intelligently warning about the water age of a water tank throughout its entire lifecycle includes the following: In step S100, a safety tracer is injected during the water tank filling process, and tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data are collected simultaneously. The injection concentration of the safety tracer is calculated in real time and controlled in a closed loop based on the total volume of the water tank, the water flow rate, and the minimum detection limit of the dedicated sensor to ensure that the overall tracer concentration in the water tank after injection remains above the minimum detection limit, but far below the limit value of such substances or related indicators in the national standard. The injection concentration is achieved by adjusting the pump speed or valve opening of the precision injection device. The total amount, concentration, and injection start and end time of each injection of safety tracer are recorded and linked to the corresponding water filling event. Safety tracers are harmless, chemically stable, easily detectable, and fully miscible with water. Examples of suitable tracers include electrolyte tracers such as low-concentration food-grade sodium chloride (salt water) and fluorescent tracers such as stilbene derivatives. Electrolyte tracers can be monitored by installing multiple high-precision conductivity sensors at different depths and horizontal positions in the water tank. Fluorescent tracers can be monitored by installing online fluorescence sensors inside the water tank, irradiating the water with a specific wavelength of laser, and monitoring the fluorescence intensity. Safety tracers give water quality a unique identifier. By tracking the spatial distribution and migration of safety tracers within the water tank, water entering the tank at different times can be accurately identified and distinguished. Sensors corresponding to the detection of safety tracers are preset at different depths and horizontal positions in the three-dimensional space inside the water tank. The sensors collect the concentration value of the safety tracers at a set frequency, and detect the concentration and spatial distribution of the safety tracers in real time. The readings of all sensors are correlated with the three-dimensional spatial coordinates of the water tank and combined with a unified timestamp to form concentration field data describing the spatial distribution and temporal evolution of the safety tracer concentration. The tracer concentration field data can directly and realistically reflect the mixing, flow and retention of water inside the water tank. By installing electromagnetic flow meters or ultrasonic flow meters on the inlet and outlet pipes of the water tank, the instantaneous flow rate is read in real time and integrated to obtain the cumulative water volume. A pressure level gauge or ultrasonic level gauge is installed on the side wall of the water tank to continuously measure the water level height. Thus, the data of the water tank's inlet instantaneous flow rate, outlet instantaneous flow rate, cumulative water volume and water level height are obtained and a unified timestamp is assigned to form hydraulic condition data. By installing a multi-parameter online water quality monitor that integrates a residual chlorine sensor, a turbidity sensor, a pH electrode, and a temperature probe at designated points inside the water tank, such as the middle or halfway through the water depth, the monitor can automatically sample and measure at set cycles and frequencies to obtain water quality data including residual chlorine concentration, turbidity, pH value, and water temperature. Real-time temperature data, real-time water flow sequence, and historical water quality records are acquired to form environmental and historical context data. The real-time temperature data includes real-time inlet water temperature and real-time ambient temperature. The real-time inlet water temperature is obtained by a temperature sensor on the inlet pipe, and the real-time ambient temperature is obtained by an outdoor ambient temperature and humidity sensor installed at the location of the water tank. The real-time water flow sequence is obtained by continuous readings of the flow meter in the hydraulic condition data. The historical water quality records are retrieved from the complete data records in the historical training dataset. Water usage pattern characteristic curves are obtained based on real-time water flow sequence analysis. These curves represent the peak, normal, and low water usage periods of each day. The water usage pattern characteristic curves are representative daily water consumption curves extracted from long-term or defined-time (e.g., the past 30 days) daily water flow data through statistical analysis. They are used to quantitatively describe the user's water usage patterns. During peak water usage periods, the water flow is large, the water retention time is short, the replacement rate is fast, and the risk of water quality deterioration is relatively small. Conversely, during low water usage periods, the water retention time is long, and the risk of water quality deterioration is relatively large. This provides the main data basis for predicting the risk of water aging in water tanks. Historical water quality records include residual chlorine decay curves and abnormal event records for the same historical period. The residual chlorine decay curve is a curve describing the natural consumption pattern of residual chlorine, obtained by summarizing and analyzing data points of residual chlorine measurement values ​​over time under similar ambient temperatures and initial residual chlorine concentrations in the past. It provides a baseline expected value for residual chlorine consumption for the early warning model. Abnormal event records include historical records of water quality parameters exceeding standards (such as residual chlorine below the standard, sudden increase in turbidity), equipment malfunction alarms, and records of manual intervention. Abnormal events are usually automatically defined by the system: when any online monitored water quality parameter exceeds the national standard safety limit for multiple consecutive measurements, or when the parameter undergoes a sudden change in a very short period of time (the rate of change exceeds the preset threshold), it is automatically marked as an abnormal event and related data before and after it is recorded. A unified time stamp is added to the acquired tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data. After data cleaning and outlier removal, a time-synchronized and formatted multidimensional time series dataset is formed. The multidimensional time series dataset provides a unified data input for constructing digital twins, generating full-cycle water age trajectories, and early warning calculations.

[0019] Step S200: Based on tracer concentration field data and hydraulic condition data, the preset computational fluid dynamics model of the water tank is dynamically calibrated. A digital twin is constructed and updated by running the computational fluid dynamics model of the water tank. Based on the digital twin, the motion trajectory of the water body identified by the safety tracer is simulated and recorded, generating a full-cycle trajectory of the water age. The computational fluid dynamics model of the water tank is a virtual three-dimensional mathematical model established in a computer based on fluid dynamics principles, used to simulate the flow, mixing, and mass transfer processes of water inside the water tank. This includes the establishment and division of the three-dimensional mesh of the water tank, and the control equations describing the basic laws of fluid motion, while ensuring the conservation of mass and momentum. It should be noted that, based on the turbulence model equations provided by the FLUENT software, the equations are solved using parameters such as water velocity, pressure, tracer volume concentration, and density as outputs, to predict the entire process of water and tracer motion. Furthermore, the mass conservation, momentum conservation, and governing equations of the turbulence model can be directly used in FLUENT software, so the specific formulas will not be elaborated. The entire prediction and solution process can be directly used in FLUENT software, which is a software for computational fluid dynamics. It includes physical models of fluid flow, heat conduction, and chemical reactions, as well as various numerical solution algorithms, and can be directly used for water flow simulation.

[0020] Step S201, construct and update the digital twin, including: First, the three-dimensional geometric parameters of the water tank are obtained. The computational fluid dynamics model of the water tank constructs a three-dimensional mesh in a virtual environment based on these parameters. Initial flow field boundary conditions and key parameters are set in the three-dimensional mesh based on hydraulic condition data. These key parameters include the turbulent viscosity coefficient and the wall drag coefficient. Specifically, the acquired instantaneous inlet flow rate, instantaneous outlet flow rate, and water level are used as the dynamic initial flow field boundary condition inputs to the computational fluid dynamics model. The instantaneous inlet flow rate data is converted into the average velocity or velocity distribution at the inlet boundary and assigned a value. For the outlet, it is set as a pressure outlet or a specified flow rate outlet based on the hydraulic condition data. All solid wall properties of the water tank are set as static walls and assigned specific roughness parameters to characterize the resistance of the walls to the water flow. Secondly, based on the computational fluid dynamics model of the water tank, N model copies are generated, where N is an integer. The N model copies correspond to N different key parameters. At the same time t, the N model copies are simulated with the set key parameters to generate N virtual concentration fields. The virtual concentration fields contain the spatial distribution of the simulated tracer concentration, resulting in a set of predicted states containing N virtual concentration fields. Then, the tracer concentration field data measured by the sensor at time t is acquired. This data is compared point-by-point with the virtual concentration field as the real-time observation. The spatial distribution difference between the two is calculated by the root mean square error to obtain the prediction error. The correlation between key parameters and the magnitude of the prediction error is analyzed. For example, in regions where the virtual concentration field is lower than the real-time observation, a smaller model replica of the key parameter turbulent viscosity coefficient results in a larger prediction error. This leads to the conclusion that increasing the turbulent viscosity coefficient can improve prediction accuracy. The Kalman filter algorithm is then used to invert and adjust the key parameters, obtaining the updated prediction state set. The formula is: X update =X forecast +K*(Y) obs -H*X forecast ); Among them, X update For the updated set of predicted states; X forecast The set of predicted states representing all model replicas, including tracer concentration values ​​and key parameters; Y obs H represents the tracer concentration field data measured by the sensor, i.e., the real-time observation value; H is the observation operator, used to map the model's predicted state to the specific location of the sensor, and is a difference matrix; K is the Kalman gain matrix, which is an automatically calculated weight based on the statistical contrast of the predicted state set and the observation error. X is obtained after one update update Starting with the corresponding key parameters, the simulation is repeated. Through repeated simulation calculations, the virtual concentration field gradually approaches the measured tracer concentration field. Finally, through iterative calculation, if the change in the spatial root mean square error between the virtual concentration field and the real-time observation value is less than the preset error threshold (e.g., 0.01 mg / L) for three consecutive iterations, or if the maximum number of iterations (e.g., 10) is reached, it is determined that the convergence condition is met. At this time, the updated predicted state set X is taken. update The mean value is the optimal calibrated model parameters and flow field state at this moment. The corresponding key parameters are the optimal values. This state constitutes the high-fidelity digital twin at the current moment. The virtual flow field state in the digital twin is consistent with the actual fluid mixing state in the water tank, thus completing the dynamic calibration and real-time update of the digital twin.

[0021] A dynamically calibrated digital twin is a computational fluid dynamics model of a water tank that can reflect the real-time hydraulic conditions and mixing state of the actual water tank with high fidelity, and its data state. The digital twin includes the calibrated three-dimensional mesh, parameters, and flow field boundary conditions of the water tank, as well as the virtual three-dimensional flow field data calculated and synchronized with the real physical time, such as the velocity field and pressure field of the water body. It can realize the fine-grained, full-cycle tracking and retrospective analysis of the water body's movement trajectory with extremely low cost and risk.

[0022] Step S202: Based on digital twin simulation, the movement trajectory of the water body identified by the safety tracer is recorded to generate a full-cycle water age trajectory, including: First, based on the digital twin, the water body with the safety tracer identifier is defined as discrete tracer particles, and the displacement vector of each tracer particle is calculated at each computation time step. The water body carrying the safety tracer injected in each water inflow event is discretized into M virtual tracer particles with mass attributes, where M is an integer. Within each extremely short computation time step, such as 0.1 seconds, the three-dimensional flow velocity vector of the spatial grid node where the tracer particle is located is read, and the distance and direction of the tracer particle's movement are calculated to form the tracer particle displacement vector. The position of the tracer particle is updated to the original position plus the displacement vector. Secondly, based on the displacement vector of the tracer particles, the entire process of migration, mixing, and leaving the water tank after each tracer particle enters the tank is continuously tracked, and the spatial position sequence and time sequence of each tracer particle in the entire process are recorded. Among them, the spatial position sequence refers to the record of a series of three-dimensional coordinates (x, y, z) that each tracer particle passes through from the time it enters the water tank until it leaves or is identified as stationary. This is used to accurately depict the movement path of the particle in the water tank and analyze hydraulic characteristics such as short-circuiting and dead zones. The time sequence refers to the timestamp record corresponding to each of the above spatial position points. This is used to accurately record the specific time when the particle arrives at each spatial position and is the direct basis for calculating its local residence time (water age). The combination of the two completely defines the spatiotemporal history of any water particle in the water tank. Finally, based on the spatial location sequence and time series, the residence time of tracer particles in any spatial region within the water tank is obtained, the distribution location of tracer particles at any time point is obtained, and a full-cycle water age trajectory is generated. The full-cycle water age trajectory includes the individual movement path and residence time of all tracer particles. The full-cycle water age trajectory can obtain the total residence time of each tracer particle from water inlet to water outlet (i.e., individual water age), the statistical distribution of the water age of all tracer particles in the water tank at any time (such as maximum water age, average water age), the spatial aggregation area of ​​high-water-age particles in the water tank (i.e., dead zone location), and the mixing process of new water inlet and old water. Step S300: Input environmental and historical context data, water quality data, and the full-cycle water age trajectory into the early warning model to calculate the dynamic early warning threshold and the probability value of future water quality deterioration, and generate graded early warning information. The early warning model includes a first machine learning model and a second machine learning model. The early warning model uses the first and second machine learning models for state description and risk prediction. By receiving the full-cycle water age trajectory generated by digital twin processing, real-time monitored water quality data, and environmental historical context data, the first machine learning model dynamically calculates the dynamic early warning threshold adapted to the specific conditions at this moment based on the current environmental and historical context data. This eliminates the limitations of fixed thresholds in traditional methods, allowing the early warning threshold to be dynamically adjusted based on water body data, incorporating factors other than the water quality data itself, and their impact on water quality, making the early warning more accurate and facilitating early risk assessment. Then, the second machine learning model performs deep fusion analysis of the dynamic early warning threshold, the full-cycle water age trajectory, and water quality parameters, quantifying and outputting the probability value of future water quality deterioration. Through the early warning model, complex fluid dynamics simulation results, multi-dimensional monitoring data, and historical experience knowledge are transformed into operable, graded early warning information. Step S301, calculate the dynamic early warning threshold, including: First, non-numerical data from environmental and historical context data is acquired and encoded into numerical feature vectors. This non-numerical data primarily includes date types (e.g., seasons, weekdays / holidays), water usage pattern stage labels (e.g., "peak water usage period," "off-peak water usage period"), and descriptions of historical abnormal events (e.g., "residual chlorine depletion," "sudden increase in turbidity"). Feature encoding is necessary because machine learning models are essentially mathematical calculation tools and cannot directly understand text or category labels; they must be converted into numerical forms. Numerical feature vectors are a set of numbers obtained by mapping the aforementioned non-numerical data using specific rules (e.g., one-heat encoding, sequential encoding). These numbers, together with the original numerical data (e.g., temperature, flow rate), form a complete, model-readable input array. This process losslessly transforms real-world contextual information with predictive value but not numerical representation into features that can be recognized and utilized by mathematical models, enabling early warning models to understand the different impacts of "off-peak periods on summer weekends" and "normal periods on winter weekdays" on water quality risk. Then, the numerical feature vector is input into the pre-trained first machine learning model for calculation and outputs a dynamic warning threshold, which includes a warning water age threshold and a critical water age threshold. The first machine learning model uses a gradient boosting decision tree model, an additive model composed of multiple sequentially constructed decision trees, to process numerical feature vectors and output dynamic warning thresholds, including: First, the input layer performs initial predictions. The input layer of the first machine learning model receives a numerical feature vector F encoded from environmental and historical context data. env Set an initial predicted value (such as the average of the target threshold for all samples) as the starting point; Then, sequential decision tree construction and residual learning are performed; the first tree (Tree1) is constructed first, based on the input F. env By finding the best features and split points, a series of if-then rules are created, with the goal of predicting the difference between the true threshold and the initial predicted value, i.e., the residual. After the model is built, the predicted value is updated: new predicted value = initial predicted value + learning rate * Tree1 prediction result. The second tree (Tree2) is constructed with the goal of predicting the new residuals remaining after the first tree's prediction; and so on, with the goal of the Nth tree (TreeN) being to predict the residuals that have not yet been fitted after the predictions of the first N-1 trees. Each tree contains multiple decision nodes and leaf nodes. Each node makes a judgment based on a feature (such as "real-time influent temperature") and a threshold, dividing the data sample into different branches. Eventually, each sample will reach a leaf node, which is assigned a specific output value. The specific output value is calculated from the residual of the training samples falling into this leaf node, usually the average. Through this additive modeling and sequential fitting of residuals mechanism, each tree focuses on correcting the errors of the previous tree, and finally combines into a powerful ensemble model that can fit the complex mapping function between features and dynamic thresholds with extremely high accuracy. Finally, after all the trees are constructed, for a given new input feature vector F env(new) The final predicted value is obtained by weighted summation of the outputs of all trees: Final predicted value = Initial predicted value + Learning rate * (Tree1 prediction result + Tree2 prediction result + ... + TreeN prediction result). Since this task outputs two thresholds, the model actually trains two independent gradient boosting decision tree regressors in parallel, one with the warning water age threshold as the learning target and the other with the critical water age threshold as the learning target, sharing the same input feature F. env However, by learning different mapping relationships, the parallel dual-output structure enables the model to simultaneously and independently learn and output two closely related but different warning water age thresholds and critical water age thresholds.

[0023] Among them, the warning water age threshold is a suggestive threshold. When the local water age of a water body approaches this value, it indicates that there is a potential risk of water quality deterioration and attention should be paid. The critical water age threshold is an action threshold. When the water age reaches or exceeds this value, it means that the water quality has deteriorated or is about to deteriorate unacceptably, and intervention measures must be taken immediately. From the historical training database, event records that did not exhibit water quality anomalies under similar environmental and water usage patterns are selected. The maximum water age data of the full-cycle water age trajectory in these event records is extracted to form a safe water age sample set. Statistical analysis is performed on the safe water age sample set. For example, the warning water age threshold is set to the 90th percentile of the water age distribution in this sample set, and the critical water age threshold is set to the 99th percentile or the maximum safe water age. The learning objective of the first machine learning model is to predict the warning water age threshold and the critical water age threshold based on the input numerical feature vector, ensuring that the warning water age threshold and the critical water age threshold can be flexibly adjusted according to external factors such as season and water usage patterns.

[0024] Step S302, calculate the probability value of future water quality deterioration, including: First, trajectory feature parameters are extracted from the full-cycle water age trajectory. These parameters include the maximum water age, average water age, standard deviation of water age spatial distribution, and spatial aggregation degree of high-water-age particles. The trajectory feature parameters condense the complex three-dimensional spatiotemporal trajectory data into several core features. At a specified analysis time, the individual water ages of all tracer particles still in the water tank are obtained from the full-cycle water age trajectory. The maximum value (maximum water age), average value (average water age), and standard deviation (spatial distribution standard deviation) of these individual water ages are calculated. The spatial aggregation regions of tracer particles with water ages higher than the average value are identified, and the proportion of the total volume of such regions to the effective volume of the water tank is calculated as the spatial aggregation degree of high-water-age particles. Then, the trajectory feature parameters, water quality parameters, and dynamic early warning thresholds are combined to form a comprehensive feature vector. The comprehensive feature vector is generally generated by a simple vector concatenation operation, for example: comprehensive feature vector = [maximum water age, average water age, standard deviation of water age spatial distribution, spatial clustering, current residual chlorine, current turbidity, early warning water age threshold, critical water age threshold]. A single trajectory feature parameter only reflects the water age status, water quality parameters only reflect the current health status of the water, and dynamic early warning thresholds reflect the safety standards under the current environment. Only by combining these three to construct a feature space with complete information, enabling the second machine learning model to perform multi-dimensional coupled analysis, can accurate probabilistic prediction be achieved. Finally, the comprehensive feature vector is input into the second machine learning model for coupling analysis, and the output represents the risk probability value of the water quality parameters in the water tank exceeding the safety standard within a specified time period in the future. The second machine learning model specifically uses a multilayer perceptron neural network, including an input layer, hidden layers, and an output layer. This second machine learning model is a typical feedforward neural network that performs coupled analysis on the comprehensive feature vector to generate risk probability values, including: Input layer: Receives the comprehensive feature vector F composite The number of neurons in the input layer is equal to F. compositeIn the dimension of F, each neuron is responsible for receiving F composite One of the feature values ​​is used to inject all the information into the network in numerical form; Hidden layer: Input F composite The input is first passed to the first hidden layer, where each neuron in the first hidden layer processes all inputs F. composite Perform a weighted summation and add a bias term to form the net input z of the neuron: ; Where z is the net input or weighted sum of the neurons; w i The weights are represented by w, where each input corresponds to an independent weight. i The larger the value, the better the input x. i The greater the impact on the final output z, the better; i The input represents each feature from the composite feature vector, such as x. i It can be the maximum water age or the current residual chlorine value; b represents a constant term, ensuring that the neuron can produce a non-zero output even when all inputs are close to 0; The calculated z is fed into a nonlinear activation function (such as ReLU or Sigmoid) to produce the neuron's output a, where a is the activated z. Coupling analysis is a weighted summation process that automatically performs linear combination of input features to generate new latent features. For example, if a neuron learns to assign a high positive weight to the ratio of "maximum water age / warning water age threshold" and a high negative weight to "current residual chlorine concentration", then this neuron becomes a detector specifically designed to detect the risk pattern of "high water age and low residual chlorine". The output 'a' of the first hidden layer is used as the input of the second hidden layer. The above process of weighted summation and non-linear activation is repeated. Feedforward neural networks usually contain multiple hidden layers. Output layer: The output of the last hidden layer is passed to the output layer, which typically has only one neuron (used for binary classification probability prediction). This neuron also performs a weighted summation and adds a bias to obtain the final linear output o, which is then fed into the sigmoid activation function. ; Where P is the risk probability value, e is the Euler number, approximately equal to 2.71828, a fixed constant and the base of the natural logarithm function; o is the input to the Sigmoid function, which is a weighted sum of the outputs of the last hidden layer in the output layer, i.e. a i It is the output of the last hidden layer, w i b and b are the weights and biases of the output layer; The Sigmoid function compresses and maps an arbitrary range of real numbers o to the interval (0, 1). The mapped value P is then interpreted as the risk probability. When o is a very large negative number, e -o Very large, P is close to 0; when o=0, e -o =1, P=1 / (1+1)=0.5; when o is a very large positive number, e -o When the value of o is close to 0, P is close to 1; the larger the value of o, the closer P is to 1, indicating that the model integrates information from all deeply coupled analyses and judges the risk to be higher.

[0025] The risk probability value is a numerical value between 0 and 1, quantitatively representing the likelihood that at least one key water quality parameter (such as residual chlorine) in the water tank will exceed the safety standard within a specified time period (such as the next 6 hours). It provides a continuous and intuitive quantitative risk indicator, supporting more refined risk classification and preventive decision-making compared to a simple "yes / no" alarm. The risk probability value represents the confidence level of the future event. For example, a risk probability value of 0.85 means that based on all current water age trajectory characteristics, water quality conditions, and environmental standards, the model has an 85% confidence that there will be a risk of water quality exceeding the standard in the next few hours. The risk probability value includes the model's learning of historical similar patterns and the comprehensive judgment of the current multi-source data coupling analysis. Step S303: Generate graded early warning information, which includes first-level early warning information, second-level early warning information, and third-level early warning information; Set a first risk threshold R1 and a second risk threshold R2, where R2 > R1. Obtain the warning water age threshold T1 and critical water age threshold T2 calculated in step S301, where T2 > T1. Obtain the risk probability value P and the current maximum water age value A in the water age full-cycle trajectory. When P < R1 and A ≤ T1, it indicates a relatively safe state, with a low probability of water quality deterioration in the near future, and no abnormal stagnation events in the current water body. A Level 1 warning message for routine monitoring is generated. This Level 1 warning message includes the spatial location of the high-water-age area and a warning prompt. For example, the Level 1 warning message might be: "Please note that there is a high water age in the bottom northwest corner of the water tank (maximum water age 35 hours, close to the warning threshold of 38 hours). It is recommended to prioritize the scheduling of water in this area during the next low-water-age period." When R1≤P<R2, or T1<A<T2, it indicates that a risk state has been entered. The former indicates that the possibility of water quality deterioration has increased based on multiple indicators, while the latter indicates that water retention time has been observed to exceed the warning line and is approaching the critical line, indicating that the risk is developing and requires active human or automatic intervention to stop the risk process. In this case, a second-level warning message is generated. The second-level warning message includes the specific water tank area identification, the predicted type of water quality deterioration, and the recommended intervention and scheduling strategy. For example, the second-level warning message is "Central coordinates (X, Y, Z) of Zone B: It is expected that the residual chlorine in this area will decrease to below the critical value in the next 6 hours. It is recommended to start the dedicated circulation pump in Zone B and circulate at a flow rate of not less than 20 m³ / h for 30 minutes." When P≥R2 or A≥T2, it indicates a high-risk or economic state. The former indicates certainty that the water quality is about to exceed the standard, while the latter indicates that the water body has exceeded the safety limit in terms of retention time, and water quality deterioration has occurred. Strong measures must be taken to ensure water supply safety, generating a Level 3 warning message. The Level 3 warning message includes a clear emergency response area identifier and mandatory emergency control instructions. For example, the Level 3 warning message is "Immediately isolate all water bodies in Area A" or "Instructions have been issued to close the outlet valve of Area A, activate the emergency sewage valve of Area A, and activate the backup water source to replenish water to Area A." The Level 3 warning message is usually accompanied by an audible and visual alarm and is directly pushed to the highest-ranking person in charge.

[0026] Among them, the first risk threshold R1 and the second risk threshold R2 are two key probability thresholds for classifying risk probability values. They are set to 0 < R1 < R2 < 1, such as R1 = 0.7 and R2 = 0.85. Through R1 and R2, continuous risk probability values ​​are divided into three action intervals, which serve as one of the core criteria for triggering different levels of warnings. R1 indicates that the risk has moved from the stage of needing attention to the stage of needing intervention, while R2 indicates that the risk has escalated to the stage of needing emergency response.

[0027] Step S400: Execute the graded early warning information and collect the actual water quality change data after execution. Compare the actual water quality change data with the risk probability value of future water quality deterioration to generate comparison results. Optimize and update the early warning model based on the comparison results.

[0028] Step S401: Compare the actual water quality change data with the risk probability value of future water quality deterioration to generate comparison results, including: First, tiered early warning information is acquired and executed. Within several hours of the execution of the tiered early warning information, water quality data is collected at a set frequency, such as every minute or every five minutes. After the execution of the tiered early warning information, the sampling frequency of the online monitoring instrument for multiple water quality parameters in the water tank is maintained or increased. The monitored data, such as residual chlorine and turbidity, are continuously stored along with timestamps to form a high-temporal-resolution water quality change curve covering the validity period after the early warning. This curve represents the actual water quality change data. Real-time water quality data collected after the execution of the tiered early warning information is used as real-time water quality change data. The actual degree of water quality deterioration is analyzed based on this real-time water quality change data. The actual water quality change data includes all parameters in the water quality data, such as residual chlorine concentration and turbidity. Then, the actual degree of water quality deterioration is compared with the predicted deterioration trend based on the risk probability value of future water quality deterioration. The actual degree of water quality deterioration is then graded to obtain the actual degree of deterioration level, which, from low to high, includes no deterioration, slight deterioration, and severe deterioration. At the same time, the previously output risk probability value is mapped to the predicted degree of deterioration level according to preset rules: risk probability value 0-0.3 is mapped to predicted no deterioration, risk probability value 0.3-0.7 is mapped to predicted slight deterioration, and risk probability value 0.7-1.0 is mapped to predicted severe deterioration. The actual degree of deterioration level is compared with the predicted degree of deterioration level to generate a comparison result. The comparison result is used to identify the warning type, and the warning type includes conservative prediction, accurate prediction, and aggressive prediction. If the actual degree of degradation is lower than the predicted degree of degradation, it is marked as a conservative prediction. The situation is recorded but the early warning model is not adjusted immediately. Conservative prediction is an acceptable early warning strategy. If it occurs multiple times in a row, the dynamic early warning threshold set by the first machine learning model will be reviewed. If the actual degree of deterioration is equal to the predicted degree of deterioration, it is marked as an accurate prediction. The complete data record of the warning event is stored in the historical training dataset as a training template to consolidate the correct judgment pattern of the warning model. If the actual level of degradation is higher than the predicted level of degradation, it is marked as an aggressive prediction. The complete data record of this warning is then marked as a high-priority optimized sample, indicating that the risk was not identified and immediately triggering the correction of the warning model.

[0029] When analyzing the actual degree of water quality deterioration, time period data matching the early warning prediction period is extracted from the actual water quality change data. The data within this time period is then quantitatively analyzed. The analysis includes calculating the slope of the decrease in residual chlorine concentration, statistically analyzing the cumulative duration of turbidity exceeding the safety limit, and identifying whether water quality parameters have reached the preset actual deterioration judgment line (such as residual chlorine below 0.05 mg / L). The quantitative analysis results (such as the rate of decrease and the duration of exceeding the standard) or a binary judgment (whether or not the standard has been exceeded) are comprehensively evaluated and converted into a quantitative level of the actual degree of deterioration. For example, "residual chlorine decreased linearly from 0.3 mg / L to 0.02 mg / L within 3 hours" is assessed as "severe deterioration". The deterioration trend predicted by the risk probability value is not a direct curve, but is implicit in the magnitude of the risk probability value and the comparison of its R1 and R2. While generating the risk probability value in step S302, the model's qualitative judgment on the future is interpreted in reverse based on the warning level to which the risk probability value belongs and the dynamic warning threshold used at that time. For example, a high risk probability value of 0.9, combined with the fact that the water age is close to the critical age threshold at that time, can be interpreted as a predicted trend of "a certain area is very likely to experience residual chlorine depletion within the next 6 hours". The interpretation is a semantic mapping of the trend based on the correspondence between high probability values ​​and high degree of deterioration during model training. The comparison results are a structured record, mainly including the warning event ID and timestamp, the predicted risk probability value and the interpreted predicted trend and level, the actual observed water quality data and the analyzed actual degree and level of deterioration, the warning type compared between the two, and key contextual information; key contextual information such as the water age trajectory characteristics at that time, dynamic thresholds, and the control measures implemented, etc.

[0030] Step S402, optimize and update the early warning model based on the comparison results, including: Obtain the complete data record of this event after the comparison results are generated, and add the complete data record as a training sample to the historical training dataset. The complete data record includes the environmental and historical context data collected in step S100, the water age full-cycle trajectory features generated in step S200, the risk probability value calculated in step S300, and the comparison results; optimize and update the early warning model based on the historical training dataset. After each warning cycle ends and comparison results are generated, the complete data record of the event is packaged into a labeled training sample. These training samples are added to a continuously expanding historical training dataset. The model optimization and update process is initiated periodically (e.g., weekly) or when the number of aggressive predictions reaches a certain number. The optimizations and updates to the first machine learning model include: First, environmental and historical context data of all training samples are extracted from the historical training dataset. Then, the ideal dynamic threshold is obtained by back-calculation based on the actual water quality safety status after the event of the training sample. The ideal dynamic threshold is calculated back-calculated based on the maximum safe water age without actual deterioration or the critical water age at which deterioration has just occurred. The environmental and historical context data are used as features and the ideal dynamic threshold is used as a label to form feature-label data pairs. Then, using the feature label data pairs, the first machine learning model is incrementally trained or fully retrained. The training objective is to minimize the mean square error between the model's dynamic prediction threshold and the ideal dynamic threshold. Finally, the performance of the optimized model is validated using a training sample that was not used in the training. Once the prediction error on the validation set is lower than the preset standard and no systematic bias occurs, the old model running online is seamlessly replaced with the optimized new model to complete the update.

[0031] The optimization updates to the second machine learning model include: First, extract the comprehensive feature vector (feature) of each sample from the historical training dataset. At the same time, generate a binary or multi-class true risk label for the sample based on the actual degree of degradation in the comparison results. For example, if severe degradation has occurred, the label is "1" and if there is no degradation, the label is "0". Combine the comprehensive feature vector and the true risk label to form a feature label data pair. Then, the second machine learning model is retrained using feature-labeled data pairs. During training, samples with aggressive predictions (missed predictions) are often given higher weights to ensure that the model focuses on learning and correcting risk patterns that were not correctly identified before. Finally, the performance of the optimized model is evaluated on the validation set, with key metrics including prediction accuracy and recall (especially the ability to capture high-risk events). Once the model's recall for high-risk events improves and its overall performance stabilizes, the optimized model is deployed online to replace the old model.

[0032] Through optimization and updates, it has learned from practice and evolved through practice. The accuracy of its dynamic early warning and the reliability of its risk probability prediction have been continuously enhanced over time and with the accumulation of cases.

[0033] In this embodiment, by introducing a safety tracer as a physical anchor and combining it with a data-driven dynamically calibrated digital twin, the accurate calculation of the water age in the tank is achieved instead of a preliminary estimate. A trace amount of safety tracer is injected when the water enters the tank. The safety tracer serves as the unique identifier of the water and diffuses with the water flow. A deployed sensor array captures the tracer concentration field data in the tank in real time. The tracer concentration field data is used as a strong constraint to calibrate the preset digital twin in reverse and dynamically. The virtual model is calibrated by feeding back physical measurement data. By adopting a verification method that combines physics and simulation, the digital twin can continuously mirror the complex mixing and flow state in the real water tank. This allows for the accurate tracking of the complete movement trajectory of each water body with an identifier, thereby calculating a full-cycle water age distribution map with centimeter-level accuracy and second-level updates. This completely changes the previous situation where water age management relied on coarse estimation and achieves comprehensive and accurate monitoring of the entire water supply chain.

[0034] A machine learning-based early warning model integrating multi-source dynamic data is constructed to adaptively update and adjust dynamic early warning thresholds. Multi-dimensional environmental and historical data, such as real-time temperature, historical water quality, and dynamic water usage patterns, are encoded into numerical feature vectors. A first machine learning model generates and flexibly adjusts the early warning water age threshold and critical water age threshold in real time, taking into account factors such as seasons and peak water usage. The dynamic early warning threshold, real-time water age trajectory features, and water quality change trend parameters are combined and input into a second machine learning model for coupled analysis. This model outputs the probability value of water quality deterioration within a specific future time period. After each early warning action, the actual water quality change data is automatically compared with the prediction results to form a feedback signal for continuous iterative optimization of the early warning model. Through repeated optimization and learning, tiered early warning information can be issued in the early stages when water quality indicators have not yet exceeded standards but risks have already accumulated. This achieves proactive defense from alarm to warning, improving the safety and intelligence of the water supply system, and enhancing the situational awareness, prediction accuracy, and long-term adaptability of the early warning system.

[0035] This application also provides an electronic device. The electronic device may include one or more processors and one or more memories. The memories store computer-readable code, which, when executed by the one or more processors, can perform the AI-driven method for recording and intelligently warning about the water age of a water tank throughout its entire lifecycle, as described above.

[0036] The method according to the embodiments of this application can also be implemented using the architecture of the electronic device shown in this application. The electronic device may include a bus, one or more CPUs, ROM, RAM, a communication port connected to a network, input / output, a hard disk, etc. The storage device in the electronic device, such as a ROM or hard disk, may store the AI-driven water tank water age full-cycle recording and intelligent early warning method provided in this application. Furthermore, the electronic device may also include a user interface. Of course, the architecture shown in this application is merely exemplary; when implementing different devices, one or more components in the electronic device shown in this application may be omitted according to actual needs.

[0037] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a reference structure" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0038] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. An AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks, characterized in that, The method includes: During the water tank filling process, a safety tracer is injected, and tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data are collected simultaneously. The pre-set computational fluid dynamics model of the water tank is dynamically calibrated based on tracer concentration field data and hydraulic condition data. A digital twin is constructed and updated by running the computational fluid dynamics model of the water tank. The motion trajectory of the water body identified by the safety tracer is simulated and recorded based on the digital twin, and the full-cycle trajectory of the water age is generated. By inputting environmental and historical context data, water quality data, and the full-cycle trajectory of water age into the early warning model, dynamic early warning thresholds and the risk probability values ​​of future water quality deterioration are calculated, and graded early warning information is generated. The system executes tiered early warning information and collects actual water quality change data after execution. It then compares the actual water quality change data with the risk probability value of future water quality deterioration to generate comparison results. Based on these comparison results, the early warning model is optimized and updated.

2. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 1, characterized in that, The process of injecting a safety tracer during the water tank filling process, and simultaneously collecting tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data, includes: By using sensors pre-installed at different depths and horizontal positions inside the water tank, the concentration and spatial distribution of the safety tracer are detected in real time, and tracer concentration field data is obtained. The system acquires data on the instantaneous inflow rate, instantaneous outflow rate, cumulative water volume, and water level of the water tank to generate hydraulic operating condition data. Acquire water quality data from the water tank, including residual chlorine concentration, turbidity, pH value, and water temperature. Acquire real-time temperature data, real-time water flow sequences, and historical water quality records to form environmental and historical contextual data; A unified time-synchronized timestamp is added to the acquired tracer concentration field data, hydraulic condition data, water quality data, and environmental and historical context data. After data cleaning and outlier removal, a multidimensional time series dataset with synchronized time and uniform format is formed.

3. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 1, characterized in that, The process of dynamically calibrating a pre-set computational fluid dynamics model of the water tank based on tracer concentration field data and hydraulic condition data, and constructing and updating a digital twin by running the computational fluid dynamics model of the water tank, includes: The three-dimensional geometric parameters of the water tank are obtained to construct a three-dimensional mesh of the water tank. The computational fluid dynamics model of the water tank is initialized based on hydraulic condition data, and the initial flow field boundary conditions and key parameters are set. Based on the computational fluid dynamics model of the water tank, the spatial distribution of tracer concentration is simulated. The tracer concentration field data is used as the real-time observation value. With the goal of minimizing the prediction error between the simulated spatial distribution of tracer concentration and the real-time observation value, the key parameters in the computational fluid dynamics model of the water tank are adjusted in reverse. The key parameters include the turbulent viscosity coefficient and the wall drag coefficient. Iterative simulations continue based on the adjusted key parameters until the prediction error for a specified number of consecutive iterations is less than a preset error threshold, or the maximum number of iterations is reached, at which point the iteration stops, thus completing the dynamic calibration and real-time update of the digital twin.

4. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 3, characterized in that, The process of simulating and recording the movement trajectory of the water body identified by the safety tracer based on a digital twin to generate a full-cycle water age trajectory includes: Based on the digital twin, the water body with safety tracer identification is defined as discrete tracer particles, and the displacement vector of each tracer particle is calculated at each calculation time step. Based on the displacement vector of the tracer particles, the entire process of migration, mixing and leaving the water tank after each tracer particle enters the water tank is continuously tracked, and the spatial position sequence and time sequence of each tracer particle in the entire process are recorded. A full-cycle water age trajectory is generated based on spatial location sequences and time sequences. The full-cycle water age trajectory includes the individual movement paths and residence times of all tracer particles.

5. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 1, characterized in that, The process involves inputting environmental and historical context data, water quality data, and the full-cycle trajectory of water age into the early warning model to calculate dynamic early warning thresholds and the probability value of future water quality deterioration, generating tiered early warning information, including: Non-numerical data from environmental and historical context data is acquired, encoded as features, and transformed into numerical feature vectors. The numerical feature vector is input into a pre-trained first machine learning model for calculation and then outputs a dynamic warning threshold, which includes a warning water age threshold and a critical water age threshold.

6. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 5, characterized in that, The calculation of the dynamic early warning threshold and the probability value of future water quality deterioration includes: Trajectory feature parameters are extracted from the water age full-cycle trajectory, including the maximum water age, average water age, and standard deviation of water age spatial distribution. The trajectory feature parameters, water quality parameters, and dynamic early warning thresholds are combined to form a comprehensive feature vector; The comprehensive feature vector is input into the second machine learning model for coupled analysis, and the output represents the probability value of the risk that the water quality parameters in the water tank will exceed the safety standard within a specified time period in the future.

7. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 6, characterized in that, The tiered early warning information includes Level 1 early warning information, Level 2 early warning information, and Level 3 early warning information; Set a first risk threshold and a second risk threshold, with the second risk threshold being greater than the first risk threshold, and obtain the risk probability value and the current maximum water age value in the full-cycle water age trajectory; When the risk probability value is less than the first risk threshold and the current maximum water age value is less than or equal to the warning water age threshold, a first-level warning message is generated. When the risk probability value is greater than or equal to the first risk threshold and less than the second risk threshold, or when the current maximum water age value is greater than the warning water age threshold and less than the critical water age threshold, a second-level warning message is generated. When the risk probability value is greater than or equal to the second risk threshold, or when the current maximum water age value is greater than or equal to the critical water age threshold, a third-level early warning message is generated.

8. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 7, characterized in that, The process of comparing actual water quality change data with the probability value of future water quality deterioration to generate comparison results includes: The system acquires and executes graded early warning information, collects water quality data after the execution of graded early warning information as real-time water quality change data, analyzes the actual degree of water quality deterioration based on real-time water quality change data, obtains the actual degree of deterioration level, and divides it based on the magnitude of risk probability value to generate predicted degree of deterioration level. The actual degree of degradation is compared with the predicted degree of degradation to generate a comparison result. The comparison result is used to identify the type of warning, and the warning type includes conservative prediction, accurate prediction and aggressive prediction. If the actual degree of deterioration is lower than the predicted degree of deterioration, it is marked as a conservative prediction. If the actual degree of degradation is equal to the predicted degree of degradation, it is marked as an accurate prediction. If the actual degree of degradation is higher than the predicted degree of degradation, it is marked as an aggressive prediction.

9. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 8, characterized in that, The optimization and updating of the early warning model based on the comparison results includes: Obtain the complete data record of this event after the comparison results are generated, and add the complete data record as a training sample to the historical training dataset. The complete data record includes the environmental and historical context data collected in step S100, the water age full-cycle trajectory features generated in step S200, the risk probability value calculated in step S300, and the comparison results. The early warning model is optimized and updated based on historical training datasets. The early warning model includes a first machine learning model and a second machine learning model.

10. The AI-driven method for full-cycle recording and intelligent early warning of water age in water tanks according to claim 2, characterized in that, In the environmental and historical context data, the real-time temperature data includes real-time inlet water temperature and real-time ambient temperature; Water use pattern characteristic curves are obtained based on real-time water flow sequence analysis, and these curves are used to represent the peak water use period, normal water use period, and low water use period each day. The historical water quality records include residual chlorine decay curves and records of abnormal events for the same historical period.