Digital twin system generation method, computer equipment and storage medium
By adopting a layered generation architecture that encapsulates algorithms into operators, combines models, and empowers intelligent agents, the problems of high coupling and poor reusability in digital twin systems are solved. This architecture achieves modularity, scalability, and autonomous decision-making, thereby improving the system's development efficiency and intelligence level.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI UNIV OF ENG
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies for building complex digital twin systems suffer from problems such as high coupling, poor reusability, difficulty in expansion, chaotic development processes, and unclear intelligence levels, leading to redundant construction, system rigidity, low efficiency in interdisciplinary collaboration, and difficulty in achieving autonomous decision-making.
It adopts a hierarchical generation architecture that encapsulates algorithms into operators, combines models, and empowers agents. Through containerization technology, workflow engine, and large language model, it constructs a clear hierarchical architecture, encapsulates algorithms into independent operators, combines them into models, and realizes autonomous behavior closed loop in agents, including perception, decision-making, action, and learning.
It achieves modularity and reusability, improves the scalability and maintainability of the system, enhances team collaboration efficiency, clarifies the construction path of intelligent systems, realizes intelligent layering from computation to autonomous decision-making, and solves the core problems in existing technologies.
Smart Images

Figure CN122064320A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital twin and cyber-physical system technology, and in particular relates to a method for generating a digital twin system, a computer device, and a storage medium. Background Technology
[0002] In constructing complex cyber-physical systems (CPS) such as smart water networks and digital twins, existing technologies generally adopt an integrated or tightly coupled software development model. Under this model, there is often a lack of clear boundaries between mathematical algorithms describing physical laws, computational models solving specific problems, and software functional modules executing the final business logic; they are intertwined and deeply coupled. While this development model may be acceptable in small-scale applications, its inherent flaws become glaringly apparent when facing complex systems like water conservancy networks that encompass multidisciplinary, multi-scale, and multi-source heterogeneous data. This tightly coupled model leads to a series of serious technical defects:
[0003] First, extremely poor reusability leads to severe duplication of effort. Valuable knowledge assets such as core physics algorithms and hydrodynamic models are deeply buried within specific project code, making them difficult to extract and encapsulate into independent, reusable modules. Each time a new water conservancy system or function is developed—for example, a new flood forecasting model or water resource allocation strategy—it requires starting from scratch, rewriting, integrating, and testing the code, resulting in enormous duplication of labor and waste of resources. This "siloed" development model severely limits technological accumulation and knowledge retention.
[0004] Second, the system is rigid, making it difficult to expand and maintain. Due to the lack of standardized interfaces and clear hierarchical relationships between functional modules, even minor modifications to any part of the system—such as updating an algorithm or adjusting a parameter—can trigger unpredictable chain reactions, leading to the collapse of the entire system. Adding new sensors, expanding simulation capabilities, or upgrading older prediction algorithms become exceptionally difficult and dangerous. This lack of flexibility prevents the system from evolving with technological advancements and changing business needs, severely limiting its vitality and scalability.
[0005] Third, the development process is disorganized, and interdisciplinary collaboration is inefficient. In the development of complex systems, algorithm experts, domain modeling experts, and software engineers often lack a common technical framework and "language." Algorithmic innovations, such as the application of machine learning in hydrological prediction, are difficult to quickly and reliably translate into stable software functionality. The work results from different teams are difficult to effectively integrate and collaborate, leading to lengthy development cycles, high communication costs, and severely restricting the development efficiency of large and complex systems.
[0006] Fourth, the lack of clarity regarding the levels of intelligence hinders the achievement of hierarchical autonomous decision-making. Existing systems lack a clear path for intelligent evolution from pure data computation and physical simulation to autonomous decision-making. Simple automated control logic is mixed with complex optimization decision-making models, preventing the system from automatically selecting the optimal strategy based on environmental changes, and thus failing to achieve true, hierarchical autonomous intelligence. This keeps digital twin systems at the level of "display and simulation," making it difficult to reach the higher intelligent goals of "prediction and decision-making."
[0007] In summary, existing technologies face fundamental technical challenges in constructing complex digital twin systems, including high coupling, poor reusability, and difficulty in scalability. There is an urgent need in this field for a novel and systematic method for generating digital twin systems. This method should address these issues by constructing a clear layered architecture and standardized modules, thereby achieving a paradigm shift from "programming" to "configuration" and providing core technical support for the rapid, efficient, and scalable development of fields such as smart water conservancy.
[0008] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0009] The purpose of this invention is to solve the above-mentioned problems and provide a method for generating a digital twin system, a computer device, and a storage medium.
[0010] The first aspect of this invention provides a method for generating a digital twin system, comprising the steps of: S1. General algorithm operator encapsulation: The algorithm or constraint used to solve physical laws is encapsulated into an operator with standardized input and output interfaces that can be independently called and tested. The physical laws include: the physical laws of water flow diffusion in reservoir scheduling scenarios and flood evolution conditions. S2. Operator Model Combination: Combining multiple operators according to preset business logic or physical laws to construct a systematic model for solving specific problems. Combination methods include: connecting multiple operators in the order of data flow to form a workflow mode, or using multiple operators to define a system of equations that need to be solved simultaneously. S3. Model-based Intelligent Agent Empowerment: Create an intelligent agent for a specific object in the physical world, and embed one or more of the aforementioned models as core capabilities into the intelligent agent. Simultaneously, assign the intelligent agent clear business requirements and an autonomous behavior loop. The autonomous behavior loop refers to completing the business requirements through autonomous actions aimed at achieving those requirements. The autonomous behavior loop includes four stages or steps: perception, decision-making, action, and learning. The decision-making stage is completed by calling the internal model embedded within the intelligent agent. The business requirements include: water level control and flow control. The specific object includes: reservoirs, sluice gates, or canals.
[0011] In one embodiment of the present invention, step S1 includes: encapsulating the operator using containerization technology, wherein each operator is independently packaged into an image, which includes all the code, library files and environment variables required to run the algorithm corresponding to the operator.
[0012] In one embodiment of the present invention, the operator includes at least one of the following operators: The flood evolution operator, whose corresponding pre-encapsulation algorithm is denoted as the flood evolution algorithm, is a finite volume method for solving the one-dimensional Saint-Venant equation. The input interface of the first mirror image of the flood evolution algorithm includes the upstream flow process and the river topography parameters, and the output interface returns the downstream flow process. The inflow forecasting operator, whose corresponding pre-encapsulation algorithm is denoted as the inflow forecasting algorithm, is a recurrent neural network algorithm based on historical data and weather forecasts. The inflow forecasting algorithm is packaged into an independent container. The input interface of the container receives historical rainfall, flow data and future weather forecast data, and the output interface returns the inflow forecasting result. The optimization solver operator, whose corresponding pre-encapsulation algorithm is denoted as the optimization solver algorithm, is a branch and bound method for solving mixed integer linear programming. The optimization solver algorithm is encapsulated as a microservice, whose interface follows the standard optimization problem description format. The input is the objective function and constraints, and the output is the optimal solution.
[0013] In one embodiment of the present invention, when creating the intelligent agent for a specific object in the physical world based on the model in step S2, if the intelligent agent is a reservoir scheduling intelligent agent, then the model considered when constructing the reservoir scheduling intelligent agent includes at least one of the following models: S21. Flood forecasting model, wherein the operator combination method adopts a workflow mode, defining a task flow: first, the prediction operator is called to obtain the upstream inflow prediction result, then the result is passed as data to the flood evolution operator, and finally the prediction result of the flood process at the downstream key section is obtained; S22, Reservoir Optimization Scheduling Model, in which the operator combination method adopts the equation system mode: with the reservoir optimization solver operator as the core, the objective function and constraints are defined.
[0014] In one embodiment of the present invention, the objective function includes minimizing downstream flood risk; The constraints include at least one of the following: the reservoir's water balance equation, the maximum and minimum water level limits, and the maximum discharge flow limit.
[0015] In one embodiment of the present invention, step S3 includes: The intelligent agent interacts and synchronizes information with the physical world in real time, including the following steps: S31. In the perception stage, the intelligent agent collects the status data and environmental parameters of physical devices in real time through the Open Product Communication Unified Architecture Protocol or the Message Queue Telemetry Transmission Protocol. The physical devices include at least one of the following devices: sluice gate, sensor. The status data and environmental parameters include at least one of the following data or parameters: water level, flow rate, sluice gate opening. S32. In the decision-making stage, the intelligent agent calls its internal model to perform analysis and prediction, and generates the optimal action plan. In the action stage, the action instruction to run the action plan is sent to the physical device through the open product communication unified architecture protocol or message queue telemetry transmission protocol. S33. In the learning phase, the intelligent agent introduces large-scale language model technology to solve the task, including the following steps: Using the large language model as a task scheduling center: The large language model is embedded as a cognitive model, which is used to transform unstructured macro tasks into structured constraints and parameters executed by the underlying numerical model. At the same time, the decision basis of the macro tasks is explained in natural language. The large language model is used to deconstruct open-ended questions into subtasks and generate a macro-level policy that includes a series of instructions. The strategy is used as input parameters or constraints for other numerical models within the agent. By continuously comparing the deviation between the model prediction results and the real data in the agent, the capabilities of the agent are continuously evolved through online learning or offline training.
[0016] In one embodiment of the present invention, when constructing the reservoir scheduling intelligent agent, in step S3, the model S21 and the model S22 are embedded into the reservoir scheduling intelligent agent, and the reservoir scheduling intelligent agent is given business requirements and autonomous behavior closed loop.
[0017] In one embodiment of the present invention, the multi-objective optimization function required to construct the model in the reservoir scheduling intelligent agent includes the following steps: S301. Define decision variables. The decision variables are defined as follows: In the 1st Time period The outflow rate of the reservoir at any given time is expressed in cubic meters per second. It is a positive integer; S302. Optimize the objective function, including the following steps: S3021. To balance the three objectives of flood control, power generation, and irrigation, a weighted summation method is used to construct an objective function, which is based on sub-objective functions, including the following functions: S3021a, the downstream flood control risk minimization function corresponding to the flood control target. : , To ensure risk minimization, a minimum value function is used. ; It includes all Decision vector; It is the number of moments within a scheduling cycle, and is a positive integer. It was after river channel calculations, The flow rate reaching the downstream flood control point within a given time period, expressed in cubic meters per second; It is the safe discharge threshold for downstream flood control points, in cubic meters per second; function Used to retrieve and The larger value, It is a time-varying penalty coefficient, dimensionless, with a positive value, and satisfies all... The sum is 1; S3021b, the power generation benefit maximization function corresponding to the power generation target. : , To maximize power generation efficiency, a maximum value function is used. ; The comprehensive power output coefficient is the ratio of the average total output power of a power plant or unit to its rated power during the statistical period. for The constant water purification head, that is The difference between the reservoir water level and the tailrace water level of the hydropower station at any given time, in meters; for The flow rate through the generator set at any given time, expressed in cubic meters per second; It is the time step, measured in seconds; for The on-grid electricity price at any given time is expressed in yuan / kWh. The model is allowed to respond to time-of-use pricing and generate more electricity during peak electricity price periods. S3021c, Irrigation benefit maximization function corresponding to the irrigation objective. : , in, yes The planned water demand of the irrigation area at any given time, in cubic meters; yes The actual amount of water supplied to the irrigation area at any given time, in cubic meters; This indicates the direct economic benefits brought by water supply, among which, It is an economic value coefficient and is dimensionless, with a value range of [0,1]. This is a water shortage penalty, indicating that the more severe the water shortage, the greater the marginal loss. It is a dimensionless water shortage penalty coefficient, and its value ranges from [0,1]. S3022. The aforementioned sub-item objective function is weighted by three weights: flood control basic weight. Power generation base weight Irrigation base weight Combined into a single optimization objective function: the comprehensive objective function , satisfy: , The settings of the three weights satisfy: S3022a, And the three weights are non-negative; S3022b, during the flood season or typhoon season, flood prevention is the primary task, and at this time, [the following is set up / installed]: , , ; S3022c, During the critical period of agricultural irrigation, increase the weight of irrigation; S3022d, set balanced weights during the normal water period; S3023. Set constraints, wherein the constraints include at least one of the following constraints: S3023a, Water balance constraint; , in, yes The reservoir's water storage capacity at any given time, in cubic meters. yes The inflow rate of the reservoir at any given time is expressed in cubic meters per second. yes Evaporation and leakage losses in real time, in cubic meters per second; S3023b, Water level balance constraint: , in, Through Reservoir water storage at all times The water level obtained from the reservoir capacity curve is in meters. This is the dead water level, measured in meters. yes The rigid safety constraints at all times refer to the flood control limit water level during the flood season and the normal storage water level during the non-flood season, with the unit being meters; S3023c, Outbound Flow Constraints: , In the above formula, yes The minimum discharge flow rate is measured in cubic meters per second to ensure the needs of downstream ecology and shipping. It is the present moment The maximum discharge capacity of flood discharge and power generation facilities at the current water level, expressed in cubic meters per second; S3023d, Generator Set Output Constraints: , , in, This is the total output of the generator set, measured in kilowatts (kW). 9.81 is the specific gravity of water, measured in kilowatt-hours (kN / m³). and These are the lower and upper threshold values for the total output of the generator set, respectively, in kilowatts. It is the overall efficiency of the generator set, dimensionless, and its value depends on the current... Water purifier head and power generation flow , The unit is meters. The unit is cubic meters per second; S3023e, Scheduling Plan Boundary Constraints: , in, This refers to the reservoir's water storage capacity during the current scheduling cycle, in cubic meters. It is the target water storage volume that should be achieved at the end of the current scheduling cycle, based on the expected scheduling plan cycle, and the unit is cubic meters; When the reservoir scheduling intelligent agent achieves autonomous behavior closed loop, the steps include: S311, Perception, The reservoir scheduling intelligent agent acquires sensor data in real time, and the sensor data includes at least one of the following: current reservoir water level, inflow rate, and downstream river water level. S312. Decision-making, including steps: S3121. Macro-strategy generation is cognitive upgrading. Upon receiving an instruction, the reservoir scheduling agent invokes its internally integrated large-scale language model. This large-scale language model is responsible for reasoning about the instruction and generating a macroscopic scheduling strategy, i.e., performing cognitive dimensionality enhancement. When the large-scale language model generates a macroscopic scheduling strategy, it must satisfy the following: Core principle: Flood control and safety are the top priority and must be strictly adhered to. Main task: Gradually and proactively release floodwaters in advance to lower the reservoir water level below the flood control limit before the flood arrives, thus freeing up sufficient storage capacity; Secondary tasks and trade-offs: During the pre-flood discharge process, the discharge flow should meet the downstream irrigation demand as much as possible. However, when the forecast flood peak conflicts with the peak irrigation water demand, flood control safety should be given priority, and it is permissible to temporarily sacrifice some irrigation water. Opportunistic objectives: As a byproduct of dispatching, power generation should be scheduled during peak electricity price periods, provided that the above objectives are met. The scheduling strategy needs to be quantified: after obtaining the macroscopic scheduling strategy, it needs to be translated into a multi-objective optimization function, i.e., the specific weight values in the comprehensive objective function, including the following steps: S3121a, Keyword extraction and priority ranking After obtaining the macro-level scheduling strategy, the strategy text generated by the large-scale language model is analyzed. Keywords are extracted from the various text segments of the strategy text and quantitatively scored. These text segments include: core principles, primary tasks, secondary tasks, opportunistic goals, and trade-offs. The keywords are categorized into priority levels based on their source texts, which are extracted from five text segments. The priority levels of the keywords extracted from these five text segments are, in descending order: absolute priority, high priority, medium priority, low priority, and very low priority. These five priority levels decrease sequentially and correspond to base priority scores of 10, 8, 5, 2, and -3, respectively. Absolute priority keywords include: first priority, strictly adhere; high priority keywords include: main task, proactively; medium priority keywords include: secondary task, satisfy as much as possible; low priority keywords include: by-product, arrange as much as possible; very low priority keywords include: allow temporary sacrifice. S3121b, Basic weight calculation, including the following steps: Based on the keywords included in each target in the strategy text, the corresponding basic priority score is obtained according to step S3121a, and the total priority score of each target is calculated. The total priority score is the sum of the basic priority scores corresponding to the keywords included in the target. The total priority score for each objective is obtained by summing the total priority scores. For any of the objectives, its corresponding weight is the ratio of its total priority score to its total strategy score; S3122, Numerical Computation and Optimization The reservoir scheduling intelligent agent transforms the macro strategy into specific constraints, and then calls its internal flood forecasting model and reservoir optimization scheduling model to solve them accurately, so as to obtain the predicted discharge flow process or the optimal discharge flow sequence. S313, Actions The reservoir scheduling agent sequentially sets each discharge flow in the calculated optimal discharge flow sequence as the target outflow, and then converts each target outflow into a specific gate control command in a time sequence, which is then sent to the physical actuator. set up: This refers to the target outflow rate, expressed in cubic meters per second. It is the flow coefficient, which is dimensionless; This is the net width of the gate, in meters; This is the target opening of the gate, in meters; It is the acceleration due to gravity, which is 9.81 m / s². This is the water level of the reservoir upstream of the sluice gate, in meters; This is the tailwater level downstream of the gate, in meters, and is determined by the target outflow rate. Discharge to the target opening The calculation includes the following steps: S313a, Acquire real-time sensor data. Acquired from sensor networks , ; S313b, Obtain the static parameters of the device. Read from the equipment ledger database , ; S313c, Calculate the target opening degree : , S313d, Safety and Constraint Verification The target opening The following verification is required: Physical limit verification: Ensure that the target opening does not exceed the physical travel range of the gate. , The unit is meters; Rate of change verification: ,in This represents the current opening degree of the gate, in meters. It is a change in opening degree The time taken The unit is seconds, ensuring that the rate of change of the opening does not exceed the maximum permissible speed of the gate hoist. , The unit is meters per second; S314. Learning, including the following steps: S3141: Numerical model parameter correction based on bias feedback, including: Error calculation: In step S311, the reservoir scheduling agent continuously acquires real sensor data from the physical world. Meanwhile, in step S312, the internal model generates corresponding predicted values. The reservoir scheduling agent continuously calculates the deviation between the two. : , Parameter update: the deviation It is used as a loss function to determine whether the parameters of the flood forecasting model need to be updated; if the deviation... If the value is greater than the preset value, the flood forecast model parameters are updated; otherwise, the flood forecast model parameters do not need to be updated. Post-event performance evaluation: After the reservoir scheduling agent generates a macro-strategy according to step S3121 and executes step S313, the digital twin system enters an evaluation cycle. After the evaluation cycle ends, the digital twin system utilizes the actual downstream flood peak. Actual power generation Actual irrigation water demand Replace them respectively , , The actual score is obtained by recalculating the comprehensive objective function. This will serve as a reward or penalty signal for the decision made by the large language model during this evaluation cycle:
[0018] In the above formula, , , Based on the actual downstream flood peak Actual power generation Actual irrigation water demand The actual downstream flood control risk, power generation benefits, and irrigation benefits are calculated using the aforementioned sub-item objective functions; Large-scale language model policy update: The reward / penalty signal is the actual score. The decision-making strategy used to update the large language model.
[0019] A second aspect of the present invention provides a computer device including a memory, a first processor, and a first computer program stored in the memory and executable on the first processor, wherein the first computer program, when executed by the first processor, implements the above-described digital twin system generation method.
[0020] A third aspect of the present invention provides a computer-readable storage medium for storing a second computer program, the second computer program being executable by at least one second processor to cause the at least one second processor to perform the above-described digital twin system generation method.
[0021] Compared with existing technologies, this invention proposes a hierarchical generation architecture based on "algorithm-operator-model-agent". By employing advanced technologies such as containerization, workflow engine, message queue, and large language model (LLM), it has the following significant advantages: (1) It achieves a high degree of modularity and reusability, greatly reducing development costs and repetitive work.
[0022] This invention deconstructs complex systems into a series of independent modules with clearly defined responsibilities and standardized interfaces through a hierarchical encapsulation of "algorithm → operator → model → agent". The underlying algorithms are containerized (e.g., Docker) into independently deployable and runnable operators, completely decoupling the underlying computational logic from the runtime environment. This allows operators to serve as atomic-level technical assets, plug-and-play in any new project, avoiding the dilemma of starting from scratch every time. This "develop once, reuse everywhere" mechanism provides a solid foundation for technological accumulation and knowledge consolidation, thereby significantly reducing the development cost and cycle time of complex systems such as smart water conservancy.
[0023] (2) It significantly improves the scalability and maintainability of the system, giving the system the ability to continuously evolve.
[0024] The invention's clear layered architecture and workflow engine-based (such as LiteFlow) combination mode make system upgrades and maintenance simple and secure. Because operators, models, and agents are decoupled through standardized interfaces, modifications to any module in the system will not affect other parts. For example, when upgrading a hydrological prediction algorithm, only a new operator needs to be developed and the old one replaced; the core algorithm can be updated without affecting the overall system operation. This "plug-and-play" characteristic endows the system with strong vitality and the ability to continuously evolve, effectively solving the rigidity problem of "a change in one part affects the whole" in existing technologies.
[0025] (3) The construction path and collaboration framework of the intelligent system were clarified, which significantly improved the efficiency of team collaboration.
[0026] This invention provides a unified collaboration framework and "language" for experts in different roles, such as algorithm experts, domain modeling experts, and software engineers. Algorithm experts focus on encapsulating mathematical algorithms into high-performance operators; domain experts use workflow engines to quickly combine operators in a visual manner to build specialized models; and software engineers focus on the integration and deployment of intelligent agents, as well as connections to physical devices, such as via OPC UA / MQTT. This clear division of responsibilities and collaboration model transforms the complex system building process from a traditional "programming" model to an efficient "configuration" model, greatly improving development efficiency and system quality.
[0027] (4) It realizes intelligent hierarchical transformation from computation to autonomous decision-making, and introduces cognitive intelligence to solve complex problems.
[0028] The architecture clearly defines an intelligent evolution path from pure computation (operators), problem solving (models), to autonomous decision-making (agents). Particularly noteworthy is that this invention achieves deep synergy between cognitive intelligence and numerical computation by introducing LLM as the cognitive core into the top-level agent. LLM can handle complex, unstructured, open problems, perform high-level task logic reasoning, and generate macroscopic scheduling strategies as inputs or constraints for the underlying numerical model. This enables the system not only to perform accurate physical simulations and optimization calculations but also to make more comprehensive and reasonable judgments in complex decision-making scenarios with multiple objectives and constraints, providing a new and feasible technical paradigm for building truly advanced intelligent complex systems. Attached Figure Description
[0029] Figure 1 This is a flowchart of a digital twin system generation method according to an embodiment of the present invention. Detailed Implementation
[0030] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.
[0031] The technical solution of the present invention is illustrated below through specific embodiments. It should be understood that the one or more steps mentioned in the present invention do not preclude the existence of other methods and steps before or after the combined steps, or that other methods and steps may be inserted between these explicitly mentioned steps. It should also be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Unless otherwise stated, the numbering of each method step is only for the purpose of identifying each method step, and not for limiting the order of each method or limiting the scope of the present invention. Changes or adjustments to their relative relationships, without substantial changes to the technical content, can also be considered as within the scope of the present invention.
[0032] The raw materials and instruments used in the examples are not subject to any specific restrictions on their source; they can be purchased from the market or prepared according to conventional methods known to those skilled in the art.
[0033] Figure 1 This is a flowchart of the digital twin system generation method provided by the present invention. Figure 1 As shown, and taking the construction of a reservoir scheduling intelligent agent for flood control scheduling as an example, the digital twin system generation method according to a preferred embodiment of the present invention includes the following steps.
[0034] S1, general algorithm operator encapsulation.
[0035] The algorithms or constraints used to solve physical laws are encapsulated into software operators (hereinafter referred to as operators) with standardized input / output interfaces that can be independently called and tested. These operators serve as single-function, reusable basic computational modules. The physical laws include: the physical laws of water flow diffusion under reservoir scheduling scenarios and flood evolution conditions. For these water flow diffusion physical laws: 1. To solve for flood diffusion trends, a two-dimensional hydrodynamic-hydrological coupling algorithm is encapsulated into a flood evolution operator with standardized input / output interfaces that can be independently called and tested; 2. To solve for future reservoir water level trends based on historical data, data-driven methods such as Long Short-Term Memory (LSTM) algorithms are encapsulated into an inflow prediction operator with standardized input / output interfaces that can be independently called and tested; 3. To solve mixed-integer linear programming tasks corresponding to multi-objective scheduling scenarios, the corresponding constraints are encapsulated into optimization solver operators with standardized input / output interfaces that can be independently called and tested.
[0036] Furthermore, this invention employs containerization technology (such as Docker) to encapsulate the operators. Each operator is independently packaged into a Docker image, containing all the code, library files, and environment variables required to run the algorithm corresponding to the software operator. This encapsulation method achieves complete decoupling between the operator and the underlying runtime environment, ensuring the effect of "encapsulate once, run everywhere." Communication and data exchange between operators are conducted through standardized Application Programming Interfaces (APIs) or message queues such as Kafka, thereby significantly improving the independence and reusability of the operators. The operators of this invention are physical information microservices, the core of which is the encapsulation of physical laws such as the Saint-Venant equation or data-driven algorithms such as the LSTM algorithm, rather than the encapsulation of business logic in traditional microservices. They have finer granularity, a more direct mapping to the physical world, and provide a flexible selection space for operator model combinations.
[0037] This invention employs containerization technology to encapsulate each operator, ensuring its independence, portability, and standardized interface. When constructing the reservoir scheduling intelligent agent, the operators that need to be encapsulated include: S11, Flood Evolution Operator.
[0038] The algorithm corresponding to this operator before encapsulation, denoted as the flood evolution algorithm, is a finite volume method for solving the one-dimensional Saint-Venant equation.
[0039] Packaged Contents: The flood evolution algorithm is packaged into a standalone Docker image. This Docker image contains the algorithm code, dependent libraries such as numerical computation libraries, and a runtime environment. The input interface of the Docker image is defined in JSON format, containing upstream flow processes, river topography parameters, etc.; the output interface is also in JSON format, returning the downstream flow processes.
[0040] S12, Inbound Flow Prediction Operator.
[0041] The algorithm corresponding to this operator before encapsulation, denoted as the inflow prediction algorithm, is a recurrent neural network (LSTM) algorithm based on historical data and weather forecasts.
[0042] Packaged Contents: The inflow flow prediction algorithm is packaged into a standalone Docker container. The Docker container's input interface receives historical rainfall, flow data, and future weather forecast data, while its output interface returns the inflow flow prediction results.
[0043] Inbound flow prediction operators can be deployed independently on graphics processing units (GPUs) or other accelerated hardware to improve computational efficiency.
[0044] S13, Optimize solver operators.
[0045] The algorithm before encapsulation corresponding to this operator, denoted as the optimized solver algorithm, is a branch and bound method used to solve mixed integer linear programming (MILP).
[0046] Encapsulation Content: The optimization solver algorithm is encapsulated as a microservice. Its interface follows the standard optimization problem description format such as MPS or JSON. The input is the objective function, constraints, etc., and the output is the optimal solution.
[0047] S2, Operator modeling combination.
[0048] Multiple (or more) software operators are organically combined according to preset business logic or physical laws to construct a systematic model, such as a flood forecasting model or a reservoir optimization scheduling model. The combination methods include: a workflow pattern where multiple operators are connected sequentially according to data flow, or a pattern where multiple operators are used to define a system of equations that need to be solved simultaneously. Furthermore, this invention employs a workflow engine such as LiteFlow as the core technology to manage the combination of operators. The LiteFlow architecture can define the serial, parallel, or conditional execution relationships between operators in a declarative manner, such as in XML, JSON, or YAML files, decoupling complex business logic from the code. This allows the design and adjustment of the model to be done without modifying the underlying code; only the workflow file needs to be configured, greatly improving the model's flexibility, readability, and maintainability.
[0049] Based on the aforementioned model, a digital identity, i.e., an agent, can be created for a specific object in the physical world (such as a reservoir, sluice gate, or canal). If the agent is a reservoir scheduling agent, the main models considered when constructing a reservoir scheduling agent that includes the functional algorithms required for reservoir operation include: S21, Flood Forecasting Model.
[0050] Operator combination method in flood forecasting models: A workflow model is adopted. Specifically, using LiteFlow's declarative configuration, such as XML or YAML, a task flow is defined: First, the inflow prediction operator is called to obtain the upstream inflow prediction results; then, the results are passed as data to the flood evolution operator; finally, the prediction results of the flood process at key downstream sections are obtained.
[0051] S22, Reservoir Optimization Scheduling Model.
[0052] The operator combination method in the reservoir optimization scheduling model adopts an equation system approach. Specifically, the model uses the reservoir optimization solver operator as its core, defines an objective function such as "minimizing downstream flood control risk," and defines a series of constraints, including: the reservoir's water balance equation, maximum and minimum water level limits, and maximum discharge flow limit. The water balance equation needs to be solved by calling the calculation results from the flood forecasting model.
[0053] S3, Model Intelligence Empowerment.
[0054] When constructing an intelligent agent, one or more of the aforementioned models are embedded as core capabilities within the agent. Simultaneously, the agent is given explicit business requirements and an autonomous behavior loop. The autonomous behavior loop refers to fulfilling the business requirement (such as water level or flow control) through autonomous actions. Specifically, it includes four stages or steps: perceiving water conditions, deciding on a decision, acting on an action, and learning the model. The decision-making stage is accomplished by invoking the embedded model.
[0055] Furthermore, the intelligent agent of the present invention achieves real-time interaction and information synchronization with the physical world through various technologies, including the following steps: S31. In the perception phase, the intelligent agent uses the Open Platform Communications Unified Architecture (OPC UA) protocol or the Message Queuing Telemetry Transport (MQTT) protocol to collect real-time status data and environmental parameters such as water level, flow rate, and gate opening from physical devices like sluice gates and sensors. OPC UA provides industrial-grade security and a data model, while MQTT is suitable for lightweight, large-scale IoT data transmission. These protocols provide the intelligent agent with efficient and reliable perception capabilities with the physical world. Furthermore, the real-time closed-loop interaction between the intelligent agent layer and the physical world enables autonomous evolution, a capability not found in traditional software architectures.
[0056] S32. During the decision-making phase, the intelligent agent invokes its internal model for analysis and prediction to generate the optimal action plan. In the action phase, the action instructions to execute the action plan are sent to the physical device via the same OPC UA or MQTT protocol, enabling remote control of the water conservancy facility. Furthermore, message queue technologies such as Kafka are used for asynchronous transmission of all sensing data and action instructions, ensuring the stability and reliability of the digital twin system under high concurrency and high throughput scenarios. Message queues also provide peak shaving, load balancing, and decoupling capabilities, allowing the intelligent agent and physical device to operate independently without interfering with each other.
[0057] S33. In the learning phase, LLM technology is introduced into the intelligent agent, deeply integrating cognitive intelligence with numerical computation to solve complex and open-ended tasks that are difficult to handle using traditional methods. This includes the following steps: S331. Using LLM as the "Task Scheduling Center": In the top-level decision-making and management intelligent agent, LLM is embedded as a cognitive model. This invention uses Retrieval Enhanced Generation (RAG) technology to construct a business rule base for long-distance water conveyance scheduling, hydropower scheduling, etc., an expert experience base for abnormal operating conditions such as rainstorms, water diversion, and pump station power outages, and a historical water conveyance scheduling scenario base. It then performs pattern and rule matching on the real-time perception database to provide the most accurate scheduling plan for dispatchers. When encountering open-ended problems involving multiple interests, multi-objective optimization, or requiring complex logical reasoning (e.g., "In the coming week, upstream water inflow will increase, and downstream farmland water demand will increase significantly. How to formulate a sluice gate scheduling plan that balances flood control and irrigation?"), this cognitive model can integrate historical data, real-time monitoring information, and domain knowledge bases to perform task logic reasoning. Traditional optimization algorithms struggle to model or solve open-ended problems with fuzzy objectives, complex constraints, and dynamic changes. The LLM introduced in this invention leverages its powerful natural language understanding and logical reasoning capabilities to transform unstructured macroscopic tasks into structured constraints and parameters that can be executed by the underlying numerical model, thus solving the 'cognitive gap' problem that traditional methods cannot address. Furthermore, LLM can explain the decision-making rationale for macroscopic tasks in natural language (e.g., 'Due to upstream rainfall reaching a red alert level, and according to Article X of the flood control regulations, the safety of downstream cities must be prioritized; therefore, this dispatch prioritizes pre-discharge of floodwater'), greatly enhancing the transparency and credibility of the decision-making process.
[0058] S332. Generate a macro-level strategy: LLM is responsible for deconstructing complex open problems into actionable subtasks and generating a macro-level, high-level strategy. This strategy may include a series of instructions, such as "prioritizing downstream irrigation while pre-allocating some water resources to flood storage areas."
[0059] S333, Collaborative Decision-Making: The macroscopic strategies generated by the LLM are used as input parameters or constraints for other numerical models within the agent, such as flood forecasting models and water resource scheduling models. These numerical models are responsible for performing precise calculations and simulations within the macroscopic framework set by the LLM, generating specific, executable operational instructions (e.g., "At station Y at point X, open the sluice gate to degree Z"). This collaborative mode achieves a seamless connection from macroscopic cognitive decision-making to microscopic precise calculation, greatly improving the intelligence level and decision-making capabilities of the digital twin system.
[0060] S334. Adaptive Learning: By continuously comparing the model prediction results in the intelligent agent, such as the predicted water level, with the real data perceived in the physical world, such as the actual water level, and utilizing the deviation between the model prediction results and the real data, the internal parameters of the model, such as the roughness coefficient in the hydraulic model or the weights in the machine learning model, are automatically corrected and optimized through online learning or offline training, thereby achieving the continuous evolution of the intelligent agent's capabilities.
[0061] When constructing the intelligent agent, if the intelligent agent is the reservoir scheduling intelligent agent, in step S3, models S21 and S22 are embedded into a reservoir scheduling intelligent agent, and the reservoir scheduling intelligent agent is given business requirements and autonomous behavior closed loop.
[0062] In the context of this embodiment, the reservoir is a typical integrated water conservancy hub with multiple functions such as flood control, power generation, and irrigation. Its basic structure typically includes: an upstream reservoir area for water collection and storage, a dam body for intercepting water flow, flood discharge facilities (such as floodgates and spillways) and power generation facilities (such as water diversion tunnels and power plants) for controlling downstream flow, and a downstream river channel for receiving downstream water flow.
[0063] The core characteristic of this reservoir lies in its enormous water storage capacity. By regulating the reservoir's water level, water resources can be redistributed in both time and space. The specific details of the scheduling are: based on real-time and predicted upstream water inflows, combined with downstream flood control needs, irrigation water demands, power generation plans, and navigation and ecological requirements, to dynamically decide on the downstream discharge flow over a future period (e.g., the next 3 days), i.e., the scheduling cycle. For example, flood control objectives may require lowering the water level before the flood season to create storage capacity, but this could conflict with the goal of maintaining a high water level to maximize power generation head. Simultaneously, regardless of the scheduling decision, the rigid constraints of ensuring minimum ecological flow in the downstream river channel and the safety of the dam itself must be maintained.
[0064] The business requirements of the reservoir scheduling intelligent agent are: to minimize downstream flood control risks while ensuring dam safety, and to simultaneously consider comprehensive benefits such as power generation and irrigation. Constrained by the reservoir's limited water level, minimum outflow to ensure downstream ecology and navigation, and the annual / monthly / ten-day scheduling plan, the model in the reservoir scheduling intelligent agent needs to construct a multi-objective optimization function. The construction method includes the following steps: S301. Define decision variables.
[0065] The model in the reservoir scheduling agent needs to solve the reservoir decision at each time step within the scheduling cycle, such as daily or hourly. Therefore, the decision variables are defined as follows: In the 1st Time period The outflow from the reservoir at a given time (in this invention, when the time period is less than the expected value, the time period is equivalent to the given time) (unit: m³) 3 (cubic meters) / s (seconds) It is a positive integer. This is the core variable that the model aims to optimize.
[0066] S302. Optimize the objective function.
[0067] Including the following steps: S3021. To balance the three objectives of flood control, power generation, and irrigation, this invention employs the Weighted Sum Method to construct a unified and comprehensive objective function. The function upon which this objective function is based is a set of sub-objective functions, which include: S3021a, the downstream flood control risk minimization function corresponding to the flood control target. .
[0068] Flood control risk is directly related to whether the flow rate at downstream key sections exceeds safety standards. This invention uses a function to minimize downstream flood control risk corresponding to the flood control target. Defined as minimizing the entire scheduling cycle (Or, in other words, the number of time periods or moments within the scheduling cycle, at this time) The downstream flood control point flow rate (within the range of positive integers) Exceeding its safe flow rate, i.e., the safe discharge threshold of the downstream flood control point. The sum of the penalty items: , In the above formula, a minimum value function is used to ensure that the risk is minimized. X is the subset of all The decision vector. It was after river channel calculations, The flow rate reaching the downstream flood control point within a given time period, expressed in cubic meters per second; It is the safe discharge threshold for downstream flood control points, which is determined based on the specific operating conditions, and the unit is cubic meters per second; function Used to retrieve and The larger value in the above formula, The function ensures that penalties are calculated only when traffic exceeds the limit, and the squared term is used to increase the penalty for serious over-limit situations, reflecting the principle of minimum risk. It is a time-varying penalty coefficient and is dimensionless; its value is a positive number. The sum is 1, and its specific value is determined according to the working conditions.
[0069] S3021b, the power generation benefit maximization function corresponding to the power generation target. .
[0070] Power generation efficiency is directly proportional to total power generation, and power generation is determined by water head and flow rate through the turbine. Therefore, a power generation efficiency maximization function is defined. : , In the above formula, to ensure maximum power generation efficiency, the maximum value function is used. ; The comprehensive power output coefficient is the ratio of the average total output power of a power plant or unit to its rated power during the statistical period. for The constant water purification head, that is The difference between the reservoir water level and the tailrace water level of the hydropower station at any given time, expressed in meters (m). for The flow rate through the generator set at any given time, expressed in cubic meters per second; It is the time step, measured in seconds (s). for The on-grid electricity price at any given time is expressed in yuan per kilowatt-hour. The model is allowed to respond to time-of-use pricing and generate more electricity during peak electricity price periods.
[0071] S3021c, Irrigation benefit maximization function corresponding to the irrigation objective. .
[0072] Irrigation efficiency is measured by the degree to which planned water demand is met, with the goal of minimizing water shortage. This invention transforms this goal into maximizing water supply satisfaction to define an irrigation efficiency maximization function. : , In the above formula, yes The planned water demand of the irrigation area at any given time, in cubic meters; yes The actual amount of water supplied to the irrigation area at any given time, in cubic meters; This indicates the direct economic benefits brought by water supply, among which, It is an economic value coefficient and is dimensionless. Its value ranges from [0,1], and the specific value is determined according to the working conditions. This is a water shortage penalty, indicating that the more severe the water shortage, the greater the marginal loss. It is a dimensionless water shortage penalty coefficient, and its value ranges from [0,1]. The specific value is determined according to the working conditions.
[0073] S3022, the above three sub-items The objective function uses configurable weights: basic flood control weights. Power generation base weight The basic irrigation weights are combined into a single optimization objective function: the comprehensive objective function. .
[0074] To unify the approach, this invention transforms the minimization problem (i.e., minimizing the downstream flood control risk function) into a maximization problem by taking the negative of the function, resulting in: , The settings of the three weights satisfy: S3022a, Furthermore, all weights are non-negative.
[0075] S3022b, during the flood season or typhoon season, flood prevention is the primary task, and at this time, [the following is set up / installed]: , , When setting weights, it was considered that power generation and irrigation would be sacrificed to ensure downstream safety; S3022c, During the critical period of agricultural irrigation, increase the irrigation weight, such as... , , .
[0076] S3022d, during the normal water period, set a balanced weight, such as... =0.5, , .
[0077] S3023, Set constraints.
[0078] Any optimized scheduling scheme must operate under the following physical and security constraints: S3023a, Water Balance Constraint: , In the above formula, yes The reservoir's water storage capacity at any given time, in cubic meters. yes The inflow rate of the reservoir at any given time is expressed in cubic meters per second. yes Evaporation and leakage losses in real time, expressed in cubic meters per second. for The reservoir's water storage level at any given time.
[0079] S3023b, Water level balance constraint: , In the above formula, Through Reservoir water storage at all times The water level obtained from the reservoir capacity curve is in meters (m). This is the dead water level, measured in meters. yes The rigid safety constraint at all times is the flood control limit water level during the flood season and the normal storage water level during the non-flood season, with the unit being meters.
[0080] S3023c, Outbound Flow Constraints: , In the above formula, yes The minimum discharge flow rate is measured in cubic meters per second to ensure the needs of downstream ecology and shipping. It is the present moment The maximum discharge capacity of flood discharge and power generation facilities at a given water level, expressed in cubic meters per second.
[0081] S3023d, Generator Set Output Constraints: , , In the above formula, This is the total output of the generator set, measured in kilowatts (kW). 9.81 is the specific gravity of water, measured in kilonewtons per cubic meter (kN / m³). Value between and between, and These are the lower and upper limits of the total output of the generator set, respectively, in kilowatts. It is the overall efficiency of the generator set, dimensionless, and its value depends on the current... Water purifier head and power generation flow In practical applications, the overall efficiency is obtained by consulting the unit's efficiency characteristic curve or by fitting a function. yes The flow rate passing through the generator set at any given time, i.e., the power generation flow rate, is measured in cubic meters per second. The unit is meters (m).
[0082] S3023e, Scheduling Plan Boundary Constraints: , In the above formula, This refers to the reservoir's water storage at the end of the current scheduling cycle, such as the end of a ten-day period, expressed in cubic meters. It is the target water storage volume that should be achieved at the end of the current scheduling cycle, based on the expected scheduling plan cycle, such as monthly or annually, in order to ensure long-term benefits; When a reservoir management intelligent agent achieves a closed-loop autonomous behavior, the following steps are included: S311, Perception, The reservoir scheduling intelligent agent acquires sensor data in real time, including the current reservoir water level, inflow rate, and downstream river water level. S312. Decision-making, including: S3121. Macro-strategy generation is cognitive upgrading. Upon receiving an instruction, the reservoir scheduling agent invokes its internally integrated Large Language Model (LLM). The LLM performs high-level reasoning on the instruction, generating a macro-level scheduling strategy—a process known as "cognitive upscaling"—and outputs a structured macro-level scheduling strategy containing clear priorities and trade-offs. The instruction is typically an unstructured, complex one, such as: "The weather forecast predicts continuous heavy rainfall in the basin over the next week, posing a high risk of disaster. Simultaneously, downstream rice is in its critical heading stage, making irrigation extremely urgent. Please develop a comprehensive scheduling plan." Whether an instruction is complex is determined by technical personnel. When generating macro-level scheduling policies, LLM must satisfy the following: Core principle: Flood control and safety are the top priority and must be strictly adhered to.
[0083] Main task: Gradually and proactively release floodwaters in advance to lower the reservoir water level below the flood control limit before the flood arrives, thus freeing up sufficient storage capacity.
[0084] Secondary tasks and trade-offs: During the pre-flood discharge process, the discharge flow should meet the downstream irrigation demand as much as possible. However, when the forecast flood peak conflicts with the peak irrigation water demand, flood control safety should be given priority, and it is permissible to temporarily sacrifice some irrigation water.
[0085] Opportunistic objectives: As a byproduct of dispatching, power generation should be scheduled during peak electricity price periods, provided that the above objectives are met.
[0086] The scheduling strategy needs to be quantified: after obtaining the macro-level scheduling strategy, it needs to be translated into a multi-objective optimization function, i.e., the specific weight values in the comprehensive objective function, including the following steps: S3121a, Keyword extraction and priority sorting.
[0087] After obtaining the macro-level scheduling strategy, the strategy text generated by the LLM is analyzed. In the "macro-level strategy generation, i.e., cognitive dimensionality enhancement" step, when the Large Language Model (LLM) receives an unstructured complex instruction (such as a comprehensive scheduling scheme for flood control and irrigation), the LLM performs high-level reasoning on the instruction. At this point, the strategy text is the output generated by the LLM reasoning, specifically manifested as a "structured macro-level scheduling strategy containing clear priorities and trade-offs." Keywords are extracted and quantitatively scored from several textual parts (such as core principles, primary tasks, secondary tasks, opportunistic goals, and trade-offs) in this strategy text.
[0088] The keywords are classified into levels according to their source texts. The source texts can be taken from five text parts of the strategy text generated by LLM: core principles, primary tasks, secondary tasks, opportunistic goals, and trade-offs. The priority levels of the keywords extracted from the five text parts are as follows: absolute priority, high priority, medium priority, low priority, and very low priority. These five priority levels decrease in order and correspond to the following basic priority scores: 10, 8, 5, 2, and -3, respectively.
[0089] Absolute priority keywords include: first priority, strictly adhere to; high priority keywords include: main task, proactively; medium priority keywords include: secondary task, satisfy as much as possible; low priority keywords include: by-product, arrange as much as possible; very low priority keywords include: allow temporary sacrifice.
[0090] S3121b, Basic weight calculation, including the following steps: 1. Based on the keywords (including implicit keywords) included in each target in the strategy text, obtain the corresponding basic priority score according to step S3121a, and calculate the total priority score of each target. The total priority score is the sum of the basic priority scores of each keyword included in the corresponding target.
[0091] 2. The total strategy score is obtained by summing the total priority scores for each objective.
[0092] 3. For any given objective, its weight is the ratio of its total priority score to the total strategy score.
[0093] For example, regarding the strategy text "Based on forecast data analysis, we are currently in a flood risk period. It is permissible to sacrifice some irrigation needs to drain water as quickly as possible to ensure the safety of the project and the watershed," analysis reveals that the keyword "drain water as quickly as possible" corresponds to flood control as the primary task, with the highest priority. The keyword "permissible to sacrifice some irrigation needs" is a secondary task, a task that can be sacrificed, with irrigation as its objective. While ensuring the primary and secondary tasks are accomplished, daily power generation should be prioritized. Therefore, the strategy text implicitly corresponds to the keyword "power generation" for this task, and its objective needs to be achieved through adjustments based on operational conditions, making it an opportunistic objective. From this strategy text, we can conclude: The basic flood control weight corresponding to the target flood control The total priority score for flood control targets comes from “first priority” (10) + “main task” (8) = 18.
[0094] Irrigation base weight corresponding to the target irrigation The total priority score for target irrigation comes from "secondary tasks" (5) + "allow sacrifices" (-3) = 2.
[0095] The base weight of power generation corresponding to the target power generation The total priority score for target power generation comes from “opportunistic targets” (2) = 2.
[0096] At this point, the total strategy score is 18 + 2 + 2 = 22.
[0097] Perform weight normalization calculation: , , .
[0098] Thus, a set of basic weights was generated: {Flood control basic weight: 0.82, Irrigation basic weight: 0.09, Power generation basic weight: 0.09}.
[0099] It should be noted that the analysis process and the calculated basic weights of LLM need to be finally confirmed by scheduling experts. The calculated basic weights can be directly adopted, or the calculated basic weights can be fine-tuned, and then multi-objective optimization calculations can be performed using multi-objective optimization functions.
[0100] S3122, Numerical Calculation and Optimization.
[0101] Based on the above steps, the reservoir scheduling agent transforms the macro-strategy provided by LLM into specific constraints, and then calls its internal flood forecasting model and reservoir optimization scheduling model to solve them accurately, so as to obtain the optimal discharge flow process or the optimal discharge flow sequence for the predicted future period.
[0102] S313, Action.
[0103] For reservoir gates, adjustments need to be made according to a time sequence, such as at fixed time intervals (e.g., 5 minutes). Therefore, each discharge flow in the optimal discharge flow sequence calculated by the reservoir scheduling agent is sequentially defined as the target outflow flow. Each target outflow flow is then converted into specific gate control instructions in a time sequence, such as "open gate X to Y degrees," and these instructions are published as MQTT messages via an OPC UA client and sent to the physical execution mechanism. All instructions are transmitted asynchronously via message queues such as Kafka.
[0104] set up: The target outbound flow rate is referred to as the target flow rate, and its unit is cubic meters per second. It is the flow coefficient, which is dimensionless. This coefficient is obtained through hydraulic model tests or empirical calibration and is related to the gate type, opening degree, and flow pattern. To simplify the calculation, it can be regarded as a constant for now. It is the net width of the gate, in meters (m). It is the target opening of the gate, that is, the target opening height of the gate, abbreviated as gate opening, which is the height difference between the bottom edge of the gate and its bottom sill that needs to be calculated, and the unit is meters; It is the acceleration due to gravity, which is 9.81 m / s². This is the water level of the reservoir upstream of the sluice gate, in meters; This is the tailwater level downstream of the gate, in meters. Then, based on the target flow rate... To the gate control value, i.e., the gate opening degree The calculation includes the following steps: S313a, Acquire real-time sensor data.
[0105] At the instant of calculation, real-time hydrological data is acquired from sensor networks such as Supervisory Control and Data Acquisition (SCADA) systems: the water level of the reservoir upstream of the gate. The tailwater level downstream of the gate .
[0106] S313b, Obtain device static parameters.
[0107] Retrieve the fixed physical parameters of the target gate from the equipment ledger database: the gate's net width. Flow coefficient .
[0108] S313c, Calculate the target opening degree .
[0109] .
[0110] S313d, Safety and Constraint Verification.
[0111] Calculated target opening It must undergo rigorous verification: Physical limit verification: Ensure the target opening does not exceed the physical travel range of the gate. , The unit is meters.
[0112] Rate of change verification: ,in This represents the current opening degree of the gate, in meters. It is a change in opening degree The time taken The unit is seconds. Ensure that the rate of change in gate opening does not exceed the maximum permissible speed of the gate hoist. , The unit is meters per second to prevent damage to the equipment. If the calculated adjustment range is too large, it needs to be implemented in stages.
[0113] Example: Suppose at a certain moment, the reservoir scheduling agent needs to execute the following scheduling instructions: The decision-making layer instruction is: target outflow rate. Real-time sensor data: , Combined with the ledger parameters of a single gate device: , .
[0114] First, calculate the effective head: .
[0115] This leads to the velocity term related to water head: .
[0116] Then solve for the target opening. : .
[0117] The calculated results must be verified before being sent out: Assuming the maximum gate opening is 5.0m and the current opening is 0.80m, the calculated target of 0.894m is within the physical limits and the change is very small, meeting the rate requirements. Therefore, based on the calculated results, a final instruction is generated. The target opening of 0.894m will be encapsulated into a standardized digital instruction and sent out via an Industrial Internet of Things (IIoT) protocol. It should be noted that to ensure the decoupling and high availability of the digital twin system executing this invention, this instruction message will not be sent directly to the device, but rather published to an enterprise-level message queue. The reservoir scheduling agent, acting as the producer, publishes the above instruction message to a designated topic, such as dam_control.gate_commands. A dedicated protocol adapter service, acting as the consumer, subscribes to this topic. Once a new message is received, it is responsible for translating the semantics of the instruction message into a write operation to the corresponding node on the OPC UA server. The OPCUA server ultimately communicates with the PLC (Programmable Logic Controller) on site. The PLC drives the hydraulic or motor system of the gate to move the gate precisely to a position of 0.894m.
[0118] Through the above methods, the digital twin system achieves complete, reliable, and secure closed-loop control from abstract cognition to precise physical action.
[0119] S314, Learning.
[0120] The learning phase is the core closed loop for achieving autonomous evolution and continuous optimization of the intelligent agent. This step establishes a two-layer learning mechanism, combining parameter correction of the lower-level numerical model with policy optimization of the upper-level cognitive model, thus achieving comprehensive learning from physical quantities to decision "formulas." This step further includes the following steps: S3141: Numerical model parameter correction (i.e., physical quantity update) based on bias feedback. The goal of this learning level is to ensure the accuracy of numerical models (such as the S21 flood forecasting model) in simulating the physical world. It includes: Error Calculation: The reservoir scheduling agent continuously acquires real sensor data from the physical world during the "perception" phase. For example, the actual reservoir water level and the actual downstream flow. Meanwhile, during the "decision-making" phase, the internal model generates corresponding predicted values. And continuously calculate the deviation (Error) between the two. : , Parameter update: This deviation It is used as a loss function to determine whether the parameters of the flood forecasting model need to be updated, if the deviation... If the value is greater than the preset value, such as 10cm, the flood forecast model parameters should be updated; otherwise, the flood forecast model parameters do not need to be updated.
[0121] S3142: Cognitive model strategy optimization based on performance rewards and punishments (i.e., LLM formula learning).
[0122] The goal of this learning level is to optimize the top-level LLM's ability to generate macro-level strategies and quantify "formulas" (i.e., multi-objective optimization weights), making its decisions more aligned with the long-term, comprehensive business needs of the digital twin system. This includes: Post-event performance evaluation (Reward calculation): Based on the macro-strategy generated in step S3121 (quantified as basic flood control weights), the reservoir dispatching agent performs the following evaluation: Power generation base weight Irrigation base weight After executing the "Action" in step S313, the digital twin system enters an evaluation cycle (e.g., a complete scheduling cycle). At the end of this cycle, the digital twin system utilizes the "sensed" real-world data, such as actual downstream flood peaks. Actual power generation Actual irrigation water demand Replace them respectively , , The actual score of the multi-objective optimization function, i.e., the comprehensive objective function, is recalculated. This will serve as a reward signal for the LLM's decision regarding the aforementioned evaluation cycle: , In the above formula, , , These are, respectively, the actual downstream flood control risk, power generation benefits, and irrigation benefits calculated using the sub-item objective functions based on the actual results that occurred in the physical world during the end of the assessment period, i.e., the actual data.
[0123] LLM Strategy Update (“Formula Learning”): The reward / penalty signal is the actual score. The decision-making policy is used to update the LLM. This invention employs a reinforcement learning framework (such as RLHF - Reinforcement Learning from Human Feedback based on PPO - Proximal Policy Optimization) to fine-tune the LLM: In step S3121, the LLM's generation of the macro-policy and weights process is considered as a policy, and the reward / penalty signals... In return for this strategy, by maximizing expected returns, a better "formula" (i.e., weights) is autonomously generated, thereby continuously optimizing the total benefits (such as flood control safety and power generation revenue) calculated by the digital twin system in long-term operation.
[0124] Through the two-layer learning mechanism of S3141 and S3142, this invention realizes the comprehensive and autonomous evolutionary capability of the intelligent agent from "fitting physical laws" to "optimizing decision-making strategies".
[0125] The present invention also provides a computer device, which includes a memory, a first processor, and a first computer program stored in the memory and executable on the first processor. When the first computer program is executed by the first processor, it implements the above-described digital twin system generation method.
[0126] The present invention also provides a computer-readable storage medium for storing a second computer program, which can be executed by at least one second processor to perform the above-described digital twin system generation method.
[0127] This invention achieves high modularity and reusability by employing advanced technologies such as containerization, workflow engines, message queues, and LLM, significantly reducing development costs and repetitive work; it significantly improves the scalability and maintainability of digital twin systems, giving the systems the ability to continuously evolve; it clarifies the construction path and collaboration framework of intelligent systems, significantly improving team collaboration efficiency; it realizes intelligent layering from computation to autonomous decision-making, and introduces cognitive intelligence to solve complex problems.
[0128] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.
Claims
1. A method for generating a digital twin system, characterized in that, Including the following steps: S1. General algorithm operator encapsulation: The algorithm or constraint used to solve physical laws is encapsulated into an operator with standardized input and output interfaces that can be independently called and tested. The physical laws include: the physical laws of water flow diffusion in reservoir scheduling scenarios and flood evolution conditions. S2. Operator Model Combination: Combining multiple operators according to preset business logic or physical laws to construct a systematic model. The combination methods include: connecting multiple operators in the order of data flow to form a workflow mode, or using multiple operators to define a system of equations that need to be solved simultaneously. S3. Model-based Intelligent Agent Empowerment: Create an intelligent agent for a specific object in the physical world, and embed one or more of the aforementioned models as core capabilities into the intelligent agent. Simultaneously, assign the intelligent agent clear business requirements and an autonomous behavior loop. The autonomous behavior loop refers to completing the business requirements through autonomous actions aimed at achieving those requirements. The autonomous behavior loop includes four stages or steps: perception, decision-making, action, and learning. The decision-making stage is completed by calling the internal model embedded within the intelligent agent. The business requirements include: water level control and flow control. The specific object includes: reservoirs, sluice gates, or canals.
2. The method for generating a digital twin system according to claim 1, characterized in that, Step S1 includes: encapsulating the operator using containerization technology, with each operator being independently packaged into an image, which includes all the code, library files, and environment variables required to run the algorithm corresponding to the operator.
3. The method for generating a digital twin system according to claim 2, characterized in that, The operator includes at least one of the following operators: The flood evolution operator, whose corresponding pre-encapsulation algorithm is denoted as the flood evolution algorithm, is a finite volume method for solving the one-dimensional Saint-Venant equation. The input interface of the first mirror image of the flood evolution algorithm includes the upstream flow process and the river topography parameters, and the output interface returns the downstream flow process. The inflow forecasting operator, whose corresponding pre-encapsulation algorithm is denoted as the inflow forecasting algorithm, is a recurrent neural network algorithm based on historical data and weather forecasts. The inflow forecasting algorithm is packaged into an independent container. The input interface of the container receives historical rainfall, flow data and future weather forecast data, and the output interface returns the inflow forecasting result. The optimization solver operator, whose corresponding pre-encapsulation algorithm is denoted as the optimization solver algorithm, is a branch and bound method for solving mixed integer linear programming. The optimization solver algorithm is encapsulated as a microservice, whose interface follows the standard optimization problem description format. The input is the objective function and constraints, and the output is the optimal solution.
4. The method for generating a digital twin system according to claim 3, characterized in that, Based on the model in step S2, when creating the intelligent agent for a specific object in the physical world, if the intelligent agent is a reservoir scheduling intelligent agent, then the model considered when constructing the reservoir scheduling intelligent agent includes at least one of the following models: S21. Flood forecasting model, wherein the operator combination method adopts a workflow mode, defining a task flow: first, the prediction operator is called to obtain the upstream inflow prediction result, then the result is passed as data to the flood evolution operator, and finally the prediction result of the flood process at the downstream key section is obtained; S22, Reservoir Optimization Scheduling Model, in which the operator combination method adopts the equation system mode: with the reservoir optimization solver operator as the core, the objective function and constraints are defined.
5. The method for generating a digital twin system according to claim 4, characterized in that, The objective function includes minimizing downstream flood control risk; The constraints include at least one of the following: the reservoir's water balance equation, the maximum and minimum water level limits, and the maximum discharge flow limit.
6. The method for generating a digital twin system according to claim 1, characterized in that, Step S3 includes: The intelligent agent interacts and synchronizes information with the physical world in real time, including the following steps: S31. In the perception stage, the intelligent agent collects the status data and environmental parameters of physical devices in real time through the Open Product Communication Unified Architecture Protocol or the Message Queue Telemetry Transmission Protocol. The physical devices include at least one of the following devices: sluice gate, sensor. The status data and environmental parameters include at least one of the following data or parameters: water level, flow rate, sluice gate opening. S32. In the decision-making stage, the intelligent agent calls its internal model to perform analysis and prediction, and generates the optimal action plan. In the action stage, the action instruction to run the action plan is sent to the physical device through the open product communication unified architecture protocol or message queue telemetry transmission protocol. S33. In the learning phase, the intelligent agent introduces large-scale language model technology to solve the task, including the following steps: Using the large language model as a task scheduling center: The large language model is embedded as a cognitive model, which is used to transform unstructured macro tasks into structured constraints and parameters executed by the underlying numerical model. At the same time, the decision basis of the macro tasks is explained in natural language. The large language model is used to deconstruct open-ended questions into subtasks and generate a macro-level policy that includes a series of instructions. The strategy is used as input parameters or constraints for other numerical models within the agent. By continuously comparing the deviation between the model prediction results and the real data in the agent, the capabilities of the agent are continuously evolved through online learning or offline training.
7. The method for generating a digital twin system according to claim 4, characterized in that, When constructing the reservoir scheduling intelligent agent, in step S3, the models S21 and S22 are embedded into the reservoir scheduling intelligent agent, and the reservoir scheduling intelligent agent is given business requirements and autonomous behavior closed loop.
8. The method for generating a digital twin system according to claim 7, characterized in that, The steps for constructing the multi-objective optimization function required for the model in the reservoir scheduling agent include: S301. Define decision variables. The decision variables are defined as follows: In the 1st Time period The outflow rate of the reservoir at any given time is expressed in cubic meters per second. It is a positive integer; S302. Optimize the objective function, including the following steps: S3021. To balance the three objectives of flood control, power generation, and irrigation, a weighted summation method is used to construct an objective function, which is based on sub-objective functions, including the following functions: S3021a, the downstream flood control risk minimization function corresponding to the flood control target. : , To ensure risk minimization, a minimum value function is used. ; It includes all Decision vector; It is the number of moments within a scheduling cycle, and is a positive integer. It was after river channel calculations, The flow rate reaching the downstream flood control point within a given time period, expressed in cubic meters per second; It is the safe discharge threshold for downstream flood control points, in cubic meters per second; function Used to retrieve and The larger value, It is a time-varying penalty coefficient, dimensionless, with a positive value, and satisfies all... The sum is 1; S3021b, the power generation benefit maximization function corresponding to the power generation target. : , To maximize power generation efficiency, a maximum value function is used. ; The comprehensive power output coefficient is the ratio of the average total output power of a power plant or unit to its rated power during the statistical period. for The constant water purification head, that is The difference between the reservoir water level and the tailrace water level of the hydropower station at any given time, in meters; for The flow rate through the generator set at any given time, expressed in cubic meters per second; It is the time step, measured in seconds; for The on-grid electricity price at any given time is expressed in yuan / kWh. The model is allowed to respond to time-of-use pricing and generate more electricity during peak electricity price periods. S3021c, Irrigation benefit maximization function corresponding to the irrigation objective. : , in, yes The planned water demand of the irrigation area at any given time, in cubic meters; yes The actual amount of water supplied to the irrigation area at any given time, in cubic meters; This indicates the direct economic benefits brought by water supply, among which, It is an economic value coefficient and is dimensionless, with a value range of [0,1]. This is a water shortage penalty, indicating that the more severe the water shortage, the greater the marginal loss. It is a dimensionless water shortage penalty coefficient, and its value ranges from [0,1]. S3022. The sub-item objective function is weighted by three weights: flood control basic weight. Power generation base weight Irrigation base weight Combined into a single optimization objective function: the comprehensive objective function , satisfy: , The settings of the three weights satisfy: S3022a, And the three weights are non-negative; S3022b, during the flood season or typhoon season, flood prevention is the primary task, and at this time, [the following is set up / installed]: , , ; S3022c, During the critical period of agricultural irrigation, increase the weight of irrigation; S3022d, set a balanced weight during the normal water period; S3023. Set constraints, wherein the constraints include at least one of the following constraints: S3023a, Water balance constraint; , in, yes The reservoir's water storage capacity at any given time, in cubic meters. yes The inflow rate of the reservoir at any given time is expressed in cubic meters per second. yes Evaporation and leakage losses in real time, in cubic meters per second; S3023b, Water level balance constraint: , in, Through Reservoir water storage at all times The water level obtained from the reservoir capacity curve is in meters. This is the dead water level, measured in meters. yes The rigid safety constraints at all times refer to the flood control limit water level during the flood season and the normal storage water level during the non-flood season, with the unit being meters; S3023c, Outbound Flow Constraints: , In the above formula, yes The minimum discharge flow rate is measured in cubic meters per second to ensure the needs of downstream ecology and shipping. It is the present moment The maximum discharge capacity of flood discharge and power generation facilities at the current water level, expressed in cubic meters per second; S3023d, Generator Set Output Constraints: , , in, This is the total output of the generator set, measured in kilowatts (kW). 9.81 is the specific gravity of water, measured in kilowatt-hours (kN / m³). and These are the lower and upper threshold values for the total output of the generator set, respectively, in kilowatts. It is the overall efficiency of the generator set, dimensionless, and its value depends on the current... Water purifier head and power generation flow , The unit is meters. The unit is cubic meters per second; S3023e, Scheduling Plan Boundary Constraints: , in, This refers to the reservoir's water storage capacity during the current scheduling cycle, in cubic meters. It is the target water storage volume that should be achieved at the end of the current scheduling cycle, based on the expected scheduling plan cycle, and the unit is cubic meters; When the reservoir scheduling intelligent agent achieves autonomous behavior closed loop, the steps include: S311, Perception, The reservoir scheduling intelligent agent acquires sensor data in real time, and the sensor data includes at least one of the following: current reservoir water level, inflow rate, and downstream river water level. S312. Decision-making, including steps: S3121. Macro-strategy generation is cognitive upgrading. Upon receiving an instruction, the reservoir scheduling agent invokes its internally integrated large-scale language model. This large-scale language model is responsible for reasoning about the instruction and generating a macroscopic scheduling strategy, i.e., performing cognitive dimensionality enhancement. When the large-scale language model generates a macroscopic scheduling strategy, it must satisfy the following: Core principle: Flood control and safety are the top priority and must be strictly adhered to. Main task: Gradually and proactively release floodwaters in advance to lower the reservoir water level below the flood control limit before the flood arrives, thus freeing up sufficient storage capacity; Secondary tasks and trade-offs: During the pre-flood discharge process, the discharge flow should meet the downstream irrigation demand as much as possible. However, when the forecast flood peak conflicts with the peak irrigation water demand, flood control safety should be given priority, and it is permissible to temporarily sacrifice some irrigation water. Opportunistic objectives: As a byproduct of dispatching, power generation should be scheduled during peak electricity price periods, provided that the above objectives are met. The scheduling strategy needs to be quantified: after obtaining the macroscopic scheduling strategy, it needs to be translated into a multi-objective optimization function, i.e., the specific weight values in the comprehensive objective function, including the following steps: S3121a, Keyword Extraction and Priority Ranking After obtaining the macro-level scheduling strategy, the strategy text generated by the large-scale language model is analyzed. Keywords are extracted from the various text segments of the strategy text and quantitatively scored. These text segments include: core principles, primary tasks, secondary tasks, opportunistic goals, and trade-offs. The keywords are categorized into priority levels based on their source texts, which are extracted from five text segments. The priority levels of the keywords extracted from these five text segments are, in descending order: absolute priority, high priority, medium priority, low priority, and very low priority. These five priority levels decrease sequentially and correspond to base priority scores of 10, 8, 5, 2, and -3, respectively. Absolute priority keywords include: first priority, strictly adhere; high priority keywords include: main task, proactively; medium priority keywords include: secondary task, satisfy as much as possible; low priority keywords include: by-product, arrange as much as possible; very low priority keywords include: allow temporary sacrifice. S3121b, Basic weight calculation, including the following steps: Based on the keywords included in each target in the strategy text, the corresponding basic priority score is obtained according to step S3121a, and the total priority score of each target is calculated. The total priority score is the sum of the basic priority scores corresponding to the keywords included in the target. The total priority score for each objective is obtained by summing the total priority scores. For any of the objectives, its corresponding weight is the ratio of its total priority score to its total strategy score; S3122, Numerical Computation and Optimization The reservoir scheduling intelligent agent transforms the macro strategy into specific constraints, and then calls its internal flood forecasting model and reservoir optimization scheduling model to solve them accurately, so as to obtain the predicted discharge flow process or the optimal discharge flow sequence. S313, Actions The reservoir scheduling agent sequentially defines each discharge flow in the optimal discharge flow sequence as the target outflow, and then converts each target outflow into a specific gate control command in a time sequence, which is then sent to the physical actuator. set up: This refers to the target outflow rate, expressed in cubic meters per second. It is the flow coefficient, which is dimensionless; This is the net width of the gate, in meters; This is the target opening of the gate, in meters; It is the acceleration due to gravity, which is 9.81 m / s². This is the water level of the reservoir upstream of the sluice gate, in meters; This is the tailwater level downstream of the gate, in meters, and is determined by the target outflow rate. Discharge to the target opening The calculation includes the following steps: S313a, Acquire real-time sensor data. Acquired from sensor networks , ; S313b, Obtain the static parameters of the device. Read from the equipment ledger database , ; S313c, Calculate the target opening degree : , S313d, Safety and Constraint Verification The target opening The following verification is required: Physical limit verification: Ensure that the target opening does not exceed the physical travel range of the gate. , The unit is meters; Rate of change verification: ,in This represents the current opening degree of the gate, in meters. It is a change in opening degree The time taken The unit is seconds, ensuring that the rate of change of the opening does not exceed the maximum permissible speed of the gate hoist. , The unit is meters per second; S314. Learning, including the following steps: S3141: Numerical model parameter correction based on bias feedback, including: Error calculation: In step S311, the reservoir scheduling agent continuously acquires real sensor data from the physical world. Meanwhile, in step S312, the internal model generates corresponding predicted values. The reservoir scheduling agent continuously calculates the deviation between the two. : , Parameter update: the deviation It is used as a loss function to determine whether the parameters of the flood forecasting model need to be updated; if the deviation... If the value is greater than the preset value, the flood forecast model parameters are updated; otherwise, the flood forecast model parameters do not need to be updated. Post-event performance evaluation: After the reservoir scheduling agent generates a macro-strategy according to step S3121 and executes step S313, the digital twin system enters an evaluation cycle. After the evaluation cycle ends, the digital twin system utilizes the actual downstream flood peak. Actual power generation Actual irrigation water demand Replace them respectively , , The actual score is obtained by recalculating the comprehensive objective function. This will serve as a reward or penalty signal for the decision made by the large language model during this evaluation cycle: In the above formula, , , Based on the actual downstream flood peak Actual power generation Actual irrigation water demand The actual downstream flood control risk, power generation benefits, and irrigation benefits are calculated using the aforementioned sub-item objective functions; Large-scale language model policy update: The reward / penalty signal is the actual score. The decision-making strategy used to update the large language model.
9. A computer device, characterized in that, The system includes a memory, a first processor, and a first computer program stored in the memory and executable on the first processor, wherein the first computer program, when executed by the first processor, implements the digital twin system generation method according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a second computer program, which can be executed by at least one second processor to cause the at least one second processor to perform the digital twin system generation method according to any one of claims 1-8.