An intelligent scheduling method for canal system gate of irrigation area based on PySWMM and digital twinning
By constructing a digital twin of the physical-virtual dual system of the irrigation area and an event-state collaborative scheduling mechanism, the problems of low accuracy and delayed response of traditional gate scheduling were solved, achieving high-precision and high-stability gate scheduling, and improving the water supply efficiency and system security of the irrigation area.
Patent Information
- Application Number
- CN202610757306.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-08-25
AI Technical Summary
Traditional irrigation district gate scheduling relies on manual experience, which cannot adapt to the non-steady flow characteristics of complex canal systems and the spatiotemporal dynamic changes in water demand, resulting in ineffective water resource loss, insufficient water supply and equipment wear and tear. Existing scheduling schemes based on hydrodynamic models are not adaptable to sudden working conditions and lack collaborative control and conflict avoidance mechanisms, leading to frequent start-stop and water level fluctuations.
A digital twin of the physical and virtual dual systems of the irrigation area is constructed. Data is synchronized in real time through the MQTT protocol, and the virtual system is updated in combination with the PySWMM model. An offline-online hierarchical optimization framework is established by adopting an event-state collaborative scheduling mechanism and a multi-objective optimization algorithm, forming a closed-loop intelligent scheduling system of optimization-simulation-control, so as to achieve high-precision, high-stability and high-timeliness gate scheduling.
It has increased the water supply guarantee rate of the irrigation area to over 95%, reduced the water conveyance loss rate of the canal system by over 10%, significantly improved the stability and safety of the dispatching system, adapted to dynamic operating conditions, and reduced the impact of hydrodynamic lag.
Smart Images

Figure CN122632767A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart water conservancy technology, and in particular to a method for intelligent scheduling of gates in irrigation canal systems based on PySWMM and digital twins. Background Technology
[0002] Traditional irrigation gate scheduling relies on static scheduling based on manual experience, which cannot adapt to the complex unsteady flow characteristics of canal systems and the spatiotemporal dynamic changes in water demand. This can easily lead to ineffective water resource loss, insufficient water supply during critical crop growth periods, and abnormal equipment wear and tear. Existing hydrodynamic model-based scheduling, which focuses on offline global optimization, can only generate fixed schemes based on historical data and is not adaptable to sudden operating conditions such as fluctuations in water inflow and sudden changes in water demand.
[0003] Current dual-mode intelligent scheduling lacks collaborative control and conflict avoidance mechanisms, easily leading to frequent gate opening and stopping, canal water level fluctuations, and potential engineering safety hazards. Simultaneously, data barriers exist between simulation and execution, the model lacks a dynamic update mechanism, and digital twins remain only at the visualization level, failing to achieve a closed-loop empowerment across the entire process. The development of the Internet of Things, digital twins, and intelligent optimization algorithms provides a new path to overcome these bottlenecks. Summary of the Invention
[0004] To overcome the shortcomings of current technology and solve the core problems of low accuracy, slow response, frequent scheduling conflicts, and disconnect between simulation and control in traditional gate scheduling in irrigation districts, this invention proposes an intelligent gate scheduling method for irrigation district canal systems based on PySWMM and digital twins. By constructing a digital twin of the physical-virtual dual systems of the irrigation district, the core design includes an event-state collaborative scheduling mechanism and priority control rules. An offline-online hierarchical optimization solution framework is built, ultimately forming an intelligent scheduling system with a complete closed loop of optimization, simulation, and control, achieving high-precision, high-stability, and high-timeliness management of gate scheduling in irrigation districts.
[0005] To solve the technical problem, the technical solution of the present invention is as follows:
[0006] A method for intelligent scheduling of gates in irrigation canal systems based on PySWMM and digital twins, the method comprising:
[0007] S1: Use the MQTT protocol to synchronize the data collected in real time from the irrigation area physical system to the virtual model built based on PySWMM, drive the virtual model to update, and obtain a virtual operating state that is dynamically synchronized with the physical system;
[0008] S2: The real-time collected data is fused with water demand data and gate status data. The fused data is identified according to preset quantification rules, and the system status is output as normal water supply, insufficient water supply, or excessive water supply.
[0009] S3: Set an execution time window for each gate action in the irrigation plan; within the window, only the preset timed scheduling command is executed; outside the window, if the system status output by S2 is insufficient water supply or excessive water delivery, a status scheduling requirement is generated.
[0010] S4: Establish a multi-objective optimization model with the objectives of minimizing water supply error, minimizing water conveyance loss, and minimizing gate adjustment frequency, and set water level constraints, flow constraints, gate opening constraints, irrigation timing constraints, and water balance constraints.
[0011] S5: The NSGA-II algorithm is used offline to solve the multi-objective optimization model. The optimal compromise solution is selected from the Pareto optimal solution set by the TOPSIS method to obtain the basic scheduling strategy corresponding to different hydrological year types and crop growth periods. Online, the current matching basic scheduling strategy is used as the initial solution. Based on the state scheduling requirements generated in S3, the particle swarm optimization algorithm (PSO) is used to quickly find the optimal solution and output the preliminary scheduling scheme.
[0012] S6: Input the preliminary scheduling scheme into the virtual model in S1 for hydrodynamic simulation. If the water level and channel flow obtained from the simulation meet the constraints set in S4, output the final scheduling scheme; otherwise, return to S5 to re-optimize.
[0013] S7: Convert the final scheduling scheme into control commands and send them to the gate for execution; update the virtual operating state of the virtual model in S1 using the measured data collected after execution and calculate the scheduling error to correct the online optimization input in S5; when the deviation between the predicted value and the measured value of the virtual operating state exceeds the threshold, regenerate the corrected scheduling scheme through the PSO algorithm.
[0014] Furthermore, the virtual model built based on PySWMM described in S1 has its core computational engine based on the one-dimensional Saint-Venant equations, including the continuity equation and the momentum equation:
[0015] Continuity equation:
[0016] Momentum equation:
[0017] In the formula, The cross-sectional area of the channel through which water flows. For time, For channel cross-sectional traffic, Distance along the canal line, The lateral inflow rate per unit length of the channel. It is the acceleration due to gravity. The cross-sectional water level For channel traffic modulus;
[0018] In the virtual model described in S1, the gate flow rate calculation is divided into two conditions: weir flow and orifice flow. When the gate opening is greater than the critical weir flow height, the weir flow formula is used. When the gate opening is less than or equal to the critical weir height, the orifice flow formula is used. In the formula, For the flow rate of the weir, The flow coefficient of the weir is... For the clear width of the gate, The effective head above the weir, For orifice flow rate, The orifice flow coefficient is... For the gate opening, The difference in water level between the upstream and downstream of the sluice gate;
[0019] The virtual model described in S1 uses measured water level and flow data from historical irrigation periods in the irrigation district for calibration and verification, with the Nash efficiency coefficient (NSE) used as the accuracy evaluation index.
[0020]
[0021] In the formula, for Real-time traffic measurement for Simulate traffic at all times. This represents the average measured flow rate.
[0022] Furthermore, in S2, the collected data undergoes preprocessing including outlier removal, timestamp alignment, and missing value completion; the missing value completion uses linear interpolation.
[0023]
[0024] In the formula, for Interpolation results for missing values at time points. , The data points are valid times before and after the missing time. , These are the valid data values at the corresponding time.
[0025] Furthermore, the specific expression of the preset quantization rule mentioned in S2 is as follows:
[0026] Normal water supply conditions require the following conditions to be met simultaneously:
[0027]
[0028] A water supply shortage requires the following conditions to be met simultaneously:
[0029]
[0030] Excessive water transfer requires the following conditions to be met simultaneously:
[0031]
[0032] In the formula, For the first The design operating water level of each control section for The measured water level at that cross-section at that time. This represents the actual water supply flow rate. This represents the water requirement for crops.
[0033] Furthermore, the execution time window mentioned in S3 is the period before and after the preset gate action execution time. minute, The value range is 5~30min, and it is adaptively adjusted according to the length of the irrigation canal system and the hydrodynamic propagation time; the priority control rule is: when... When the system is locked in a state, the scheduling trigger logic only executes preset timed scheduling instructions; when... When this happens, the triggering permission for state scheduling is restored.
[0034] Furthermore, the multi-objective optimization model described in S4 is specifically as follows:
[0035] Minimize water supply error target:
[0036] Minimize water transfer losses:
[0037] Minimum target for gate regulation frequency:
[0038] In the formula, for Time period The actual water supply flow of each water-using unit For water flow rate, for The inflow rate at the head of the main canal during the period for The discharge flow rate at the end of the period for Total water supply flow during the period for Time period The opening value of each gate;
[0039] The water level constraint mentioned in S4 is The flow constraint is The gate opening constraint is The timing constraint for rotational irrigation is that the water supply periods of different rotational irrigation groups do not overlap. Water balance constraint is In the formula For irrigation water volume, For rainfall, Water consumption in crop fields The maximum allowable water loss.
[0040] Furthermore, the parameters of the NSGA-II algorithm described in S5 are set as follows: population size 100~200, number of iterations 500~1000, crossover probability 0.7~0.9, mutation probability 0.05~0.1; the TOPSIS method uses proximity... Select the optimal compromise solution, where , The first The Euclidean distance from each solution to the positive and negative ideal solutions.
[0041] Furthermore, the velocity and position update formulas for the PSO algorithm described in S5 are as follows:
[0042]
[0043] The parameters are set as follows: population size 20~50, number of iterations 50~100, and solution time ≤10s.
[0044] Furthermore, the convergence criterion for the hydrodynamic simulation described in S6 is:
[0045]
[0046] In the formula, , For simulation Time of the first The water level at each cross-section is similar to the first Traffic from multiple channels , The minimum and maximum allowable water levels, , These represent the minimum and maximum overcurrent capacity.
[0047] Furthermore, the control commands described in S7 are Modbus-RTU commands, containing a time sequence of the target opening degree, action execution time, and action duration for each gate; the timing coordination control formula for multiple gates is as follows: In the formula For the first The timing of the execution of control commands for each gate The water dynamics of the canal system are transmitted from the head of the main canal to the next... The lag time of the section where each gate is located;
[0048] Specifically, the dynamic correction described in S7 involves calculating a traffic correction factor when the deviation between the predicted and measured values of the virtual operating state exceeds a threshold. The traffic target of the basic scheduling strategy in S5 online optimization is corrected by the correction factor, and the PSO algorithm is re-driven to generate a corrected scheduling scheme, where... This is the average measured flow rate. This is to simulate the average flow rate.
[0049] This application has the following advantages:
[0050] A digital twin dual system for irrigation districts is constructed based on PySWMM. High-precision hydrodynamic simulation is achieved using the one-dimensional Saint-Venant equations. Physical-virtual spatiotemporal synchronization is achieved through dynamic mapping (mapping error ≤5%), solving the problem of disconnect between traditional model simulation and actual operation, and providing a high-precision digital foundation for intelligent scheduling.
[0051] The core of the system is an event-state collaborative scheduling mechanism. It proposes a priority rule for locking state scheduling within a time window of timed scheduling, thereby avoiding conflicts between the two types of scheduling instructions from the root, solving the pain points of frequent gate adjustments and drastic fluctuations in canal water levels, and significantly improving the stability and security of the scheduling system.
[0052] An offline-online hierarchical optimization solution framework is built. The basic scheduling strategy library is formed by offline global optimization of NSGA-II, and the PSO algorithm is corrected online in real time. It takes into account both global optimality and response speed to sudden working conditions, and solves the problem that traditional static scheduling cannot adapt to dynamic working conditions.
[0053] A closed-loop scheduling system integrating optimization, simulation, and control is constructed to achieve full-process automation and unattended operation, increasing the irrigation water supply guarantee rate of the irrigation area to over 95% and reducing the water conveyance loss rate of the canal system by over 10%, demonstrating significant economic benefits and promotional value.
[0054] A dynamic adaptive gate scheduling system was constructed, which dynamically corrects the scheduling scheme based on real-time monitoring data. This effectively reduces the impact of hydrodynamic lag in cold regions and fluctuations in spring snowmelt water, and further enhances the adaptive capability and robustness of the scheduling system. Attached Figure Description
[0055] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0056] Figure 1 This is a technical roadmap for the intelligent scheduling method of irrigation canal system gates based on PySWMM and digital twins provided in the embodiments of this application. Detailed Implementation
[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] Example 1:
[0059] like Figure 1 As shown in the figure, this embodiment proposes an intelligent scheduling method for irrigation canal system gates based on PySWMM and digital twins, which includes the following steps:
[0060] S1: Construction of a digital twin model of the irrigation district;
[0061] A digital twin of the irrigation district's "physical-virtual" dual systems is constructed. The physical system is the actual canal network and gate system of the irrigation district, while the virtual system is a one-dimensional hydrodynamic simulation model of the irrigation district's canal system built based on PySWMM. The virtual system is driven by real-time operation data of the irrigation district, realizing the dynamic mapping and synchronous updating of the virtual model to the physical system's operating status.
[0062] The specific method for this step is as follows:
[0063] S11: Physical system construction;
[0064] Centered on the actual canal system topology of the irrigation area, gate equipment clusters, and on-site IoT monitoring equipment, it covers a four-level canal system network including main canals, branch canals, distribution canals, and farm canals. Radar water level gauges and ultrasonic flow meters are deployed at key control sections, and gate opening instruments and PLC control cabinets are installed at each gate to realize the real-time acquisition and transmission of canal system operation data.
[0065] S12: Virtual system construction;
[0066] By equating open channels with open channel elements, the application of SWMM in simulating unsteady flow in open channels is expanded. A one-dimensional hydrodynamic simulation model of an irrigation district is built based on PySWMM. The core computing engine of PySWMM achieves high-precision simulation of unsteady flow in open channels based on the one-dimensional Saint-Venant equations. The equations include the continuity equation and the momentum equation, as shown below:
[0067] Continuity equation:
[0068]
[0069] In the formula, A is the cross-sectional area of the channel (m²). 2 ), t is time (s), Q is the channel cross-sectional flow rate (m³). 3 / s), where x is the distance along the canal line (m). Lateral inflow rate per unit length of channel (m) 2 / s).
[0070] Momentum equation:
[0071]
[0072] In the formula, g is the acceleration due to gravity (m / s²). 2 Z represents the cross-sectional water level (m), and K represents the channel flow modulus, reflecting the channel's flow capacity.
[0073] Based on the measured topography of the irrigation area, canal system design data, and gate equipment parameters, the topological relationships of canal system nodes, canal sections, and gate structures were constructed in PySWMM. For the canals, parameters such as cross-section type, bottom width, side slope coefficient, roughness coefficient, and bottom slope were set. For the gates, parameters such as orifice size, weir flow / orifice flow coefficient, and maximum opening were set to complete the basic construction of the model.
[0074] The calculation of gate flow rate is divided into two conditions: weir flow and orifice flow. The calculation formula is as follows:
[0075] Weir flow conditions (gate opening greater than critical weir flow height):
[0076]
[0077] In the formula, The flow rate of the weir (m³) 3 / s), The flow coefficient of the weir is... H is the net width of the gate (m). e The effective head (m) is the water head above the weir.
[0078] Orifice flow condition (gate opening less than or equal to critical weir height):
[0079]
[0080] In the formula, Orifice flow rate (m 3 / s), The orifice flow coefficient is... The gate opening (m) is the gate opening degree. The difference in water level (m) is the difference between the upstream and downstream sides of the gate.
[0081] The model was calibrated and validated using measured water level and flow data from historical irrigation periods in the irrigation district, ensuring the accuracy of the hydrodynamic simulation. The formula for calculating the Nash efficiency coefficient is as follows:
[0082]
[0083] In the formula, The measured flow rate at time t Let t be the simulated flow rate. The mean of the measured flow rate is given by denoted as ...
[0084] S13: Dynamic mapping and synchronous updates;
[0085] Real-time data collected by on-site IoT devices is transmitted to the virtual system via the MQTT protocol. The synchronization update frequency is set to 1-10 minutes per update. Each update includes the real-time water level of each control node in the canal system, the real-time flow rate of the canal section, and the real-time gate opening. This achieves spatiotemporal synchronization between the virtual and physical systems. The mapping error is calculated using the following formula:
[0086]
[0087] In the formula, For the relative error of the mapping, Let be the measured parameters of the physical system at time t. Given the simulation parameters of the virtual system at time t, the relative error of the mapping is required. ≤5%, providing a high-precision digital foundation for subsequent scheduling decisions.
[0088] S2: Multi-source data fusion and system status identification;
[0089] Data on irrigation canal water level and flow, water demand, and gate operation status are collected, and the multi-source data is cleaned, aligned, and fused. Based on the fused data, the operation status of the irrigation area is identified in real time, and three system states are classified: normal water supply, insufficient water supply, and excessive water transfer.
[0090] The specific method for this step is as follows:
[0091] S21: Multi-source data acquisition and fusion;
[0092] The collected data includes: ① Canal water situation data: real-time water level and flow data of each control section collected by radar water level gauges and ultrasonic flow meters, with the collection frequency consistent with the update frequency of the digital twin model; ② Water demand data: field crop water demand calculated based on crop growth period water demand model, water use plans declared by water users, and ecological base flow demand data of irrigation area, focusing on key crop growth stages; ③ Equipment status data: real-time gate opening, operating status, and fault information data collected by gate opening meter and PLC control cabinet.
[0093] The collected multi-source data undergoes preprocessing including outlier removal, timestamp alignment, and missing value imputation. Missing value imputation is performed using linear interpolation, with the following formula:
[0094]
[0095] In the formula, The interpolation result for the missing values at time t. , The data points are valid times before and after the missing time. , To obtain the valid data values at the corresponding time, the spatiotemporal fusion of multi-source data is finally completed, ensuring data consistency and availability.
[0096] S22: Real-time system status identification;
[0097] Based on the fused full-dimensional data, the operational status of the irrigation district is identified in real time according to preset quantification rules. The quantification expression of the division rules is as follows:
[0098] Normal water supply status:
[0099]
[0100]
[0101] In the formula, Let i be the design operating water level of the i-th control section. Let t be the measured water level at this cross-section.
[0102] Insufficient water supply:
[0103]
[0104]
[0105] Excessive water transfer status:
[0106]
[0107]
[0108] The system status is identified every 1 to 10 minutes, and the identification results serve as the core basis for subsequent scheduling triggers.
[0109] S3: Construction of an event-state collaborative scheduling mechanism;
[0110] A dual-mode collaborative scheduling mechanism is constructed, which includes timed scheduling and state scheduling. Timed scheduling is a time-series scheduling based on a preset irrigation water supply plan using TimedEvents, while state scheduling is an event-driven scheduling based on real-time water level / flow thresholds using StateEvents. A scheduling priority control rule is introduced, which prohibits the triggering and execution of state scheduling when any time is within the execution time window of timed scheduling, and only the preset timed scheduling instructions are executed.
[0111] The specific method for this step is as follows:
[0112] S31: Timed scheduling mechanism;
[0113] Based on the irrigation district's rotational irrigation system, the irrigation rotation period and rotational irrigation group division are preset, and a water supply plan is formulated for each rotational irrigation group, including the gate opening / closing time, target opening degree, water supply duration, and flow target. This forms a timed scheduling sequence table based on TimedEvents, serving as the basic water supply scheduling mode for the irrigation district. This ensures the orderly execution of the rotational irrigation system and adapts to the water demand patterns of crops throughout their entire growth cycle. The trigger condition expression for timed scheduling is:
[0114]
[0115] In the formula, This is the execution time of the k-th preset timed action. For a half-length execution time window, This refers to the execution time window for scheduled events.
[0116] S32: State scheduling mechanism;
[0117] Based on real-time system status recognition results, status trigger thresholds are set. When a water shortage is detected, the opening of the upstream control gate and intake gate is increased to ensure the water demand of crops during sensitive periods. When an excessive water transfer is detected, the opening of the upstream gate is reduced to prevent the water level in the canal from exceeding the warning level and water waste. When a normal water supply is detected, no status scheduling is triggered. This mode serves as an emergency supplementary scheduling mode for the irrigation area, adapting to conditions such as fluctuations in water inflow and sudden rainfall in the irrigation area.
[0118] S33: Priority control rules;
[0119] Set the execution time window of the timed schedule to be T before and after the preset action execution time. w Minutes, Tw The value range is 5~30min, and it can be adaptively adjusted according to the length of the irrigation canal system and the hydrodynamic propagation time. A priority control logic expression is introduced:
[0120] Execute the scheduled command: ;
[0121] Allow state scheduling to be triggered: ;
[0122] Within the time window for scheduled execution, the system automatically locks the triggering logic of state scheduling, prohibits the execution of state scheduling, and only executes the preset scheduled instructions. After the time window ends, the triggering permission of state scheduling is automatically restored, thus avoiding instruction conflicts between the two scheduling modes from the root and ensuring the stability of system operation.
[0123] S4: Construction of a multi-objective optimization scheduling model;
[0124] With the optimization objectives of minimizing water supply error, water conveyance loss, and gate adjustment frequency in the irrigation area, a multi-objective optimization scheduling model is constructed. Boundary conditions are set, including canal water level constraints, flow constraints, gate opening constraints, and irrigation rotation sequence constraints.
[0125] The specific method for this step is as follows:
[0126] S41: Construction of the objective function;
[0127] (1) Minimize water supply error: Ensure the water demand of crops in the irrigation area and improve the irrigation water supply guarantee rate;
[0128]
[0129] In the formula, Let be the actual water supply flow rate of the i-th water-using unit during time period t. Let be the crop water demand of the i-th water-using unit in time period t, n be the total number of water-using units, and T be the total number of time periods in the scheduling cycle.
[0130] (2) Minimize water conveyance loss: reduce water loss due to canal leakage, evaporation and drainage, and improve water resource utilization efficiency;
[0131]
[0132] In the formula, The inflow rate at the head of the irrigation canal during time period t is... The discharge flow at the end of the irrigation area during time period t. t represents the total water supply flow of the irrigation district during the time period.
[0133] (3) Minimum gate adjustment frequency target: reduce the number of gate actions and adjustment range, reduce equipment wear and tear, and extend service life;
[0134]
[0135] In the formula, Let t be the opening value of the j-th gate during time period t, and m be the total number of gates in the irrigation area.
[0136] S42: Constraint settings;
[0137] Water level constraints:
[0138]
[0139] In the formula, , The minimum and maximum allowable water levels at the i-th control section are used to ensure that the canal system does not experience the risk of drying up or overflowing.
[0140] Flow constraints:
[0141]
[0142] In the formula, , The minimum and maximum current carrying capacity of the j-th channel are used to ensure that the channel operates within the design operating range.
[0143] Gate opening constraints:
[0144]
[0145] In the formula, The maximum fully open degree of the j-th gate conforms to the physical operating boundary of the gate equipment.
[0146] Irrigation timing constraints:
[0147]
[0148] In the formula, , For the water supply periods of the p-th and q-th irrigation groups, ensure that the water-using units within the same irrigation group are supplied with water according to the preset time sequence, and that the water supply time sequences of different irrigation groups do not overlap.
[0149] Water balance constraints:
[0150]
[0151] In the formula, Let t be the amount of irrigation water used during time period t. The rainfall during period t is This represents the crop field water consumption during time period t. This represents the maximum allowable water loss during time period t.
[0152] S5: Construction of a hierarchical optimization solution mechanism;
[0153] A two-layer optimization framework is constructed, consisting of offline global optimization and online real-time correction. The offline global optimization layer uses the NSGA-II multi-objective optimization algorithm to solve the multi-objective optimization scheduling model, obtain the Pareto optimal solution set, and select it to form a basic scheduling strategy library for the irrigation district. The online real-time optimization layer uses the particle swarm optimization algorithm (PSO) to quickly correct and locally optimize the basic scheduling strategy based on the real-time operating status of the irrigation district and the system identification results, and output a real-time feasible scheduling scheme.
[0154] The specific method for this step is as follows:
[0155] S51: Offline global optimization layer;
[0156] The scheduling cycle is the crop irrigation cycle, ranging from 7 to 30 days. The NSGA-II multi-objective optimization algorithm is adopted. This algorithm is a genetic algorithm based on the Pareto optimality concept. On the basis of the basic genetic algorithm, the selection and regeneration method is improved. Each individual is stratified according to its dominance and non-dominance relationship, and then the selection operation is performed. It has excellent performance in multi-objective optimization.
[0157] The core formula for calculating congestion in the algorithm is:
[0158]
[0159] In the formula, Let M be the crowding degree of the i-th individual, and M be the number of target items to optimize. , Let k be the objective function value of the individuals immediately before and after the i-th individual. , Let be the maximum and minimum values of the k-th objective function.
[0160] The algorithm implementation steps are as follows:
[0161] Randomly generate an initial population P of size N. t After non-dominated sorting, selection, crossover, and mutation, a progeny population Q is generated. t The two populations are then combined to form a population R of size 2N. t ;
[0162] A fast non-dominated sort is performed, and the crowding degree of individuals in each non-dominated layer is calculated. Based on the non-dominated relationship and the crowding degree of individuals, suitable individuals are selected to form a new parent population P. t+1 ;
[0163] A new offspring population Q is generated through basic operations of the genetic algorithm. t+1 , will P t+1 With Qt+1 Merging to form a new population R t Repeat the above steps until the conditions for program termination are met.
[0164] Algorithm parameter settings: population size is 100~200, number of iterations is 500~1000, crossover probability is 0.7~0.9, and mutation probability is 0.05~0.1. After solving the multi-objective optimization model to obtain the Pareto optimal solution set, the optimal compromise solution is selected from the Pareto optimal solution set by the TOPSIS method. The basic scheduling strategies corresponding to different hydrological year types such as wet year, normal year, and dry year, as well as different crop growth stages, are formed to form a standardized scheduling strategy library for irrigation districts.
[0165] The formula for calculating the closeness of the TOPSIS method is as follows:
[0166]
[0167] In the formula, Let i be the proximity of the i-th solution. Let this be the Euclidean distance from the solution to the positive ideal solution. The Euclidean distance from the solution to the negative ideal solution is taken as the optimal compromise solution.
[0168] S52: Online real-time optimization layer;
[0169] The scheduling step size is 1~10min, and the Particle Swarm Optimization (PSO) algorithm is used. This algorithm is based on the theory of swarm intelligence and finds the optimal solution through the cooperation and information sharing among individuals in the swarm. It has the advantages of fast convergence speed and small computational load, and is suitable for the response requirements of real-time scheduling.
[0170] The core algorithm's speed and position update formulas are:
[0171]
[0172]
[0173] In the formula, Let ω be the velocity of the i-th particle in the d-th dimension during the (k+1)-th iteration, and ω be the inertia weight. Let be the position of the i-th particle in the d-th dimension during the k-th iteration, where c1 and c2 are learning factors, and r1 and r2 are random numbers in the interval [0,1]. Let be the optimal position for the i-th particle. This is the globally optimal position for the population.
[0174] Algorithm parameter settings: population size is 20~50, number of iterations is 50~100, the basic scheduling strategy obtained offline is used as the initial solution, and the scheduling strategy is quickly corrected and locally optimized based on real-time collected water level and flow data and system status identification results. The solution time is ≤10s, which meets the response requirements of real-time scheduling and takes into account both global optimality and real-time response speed.
[0175] S6: Optimization-Simulation-Control Closed-Loop Mechanism Construction;
[0176] A closed-loop scheduling system is constructed, which includes "real-time data acquisition, system status identification, multi-objective optimization decision-making, PySWMM simulation verification, gate control execution, and operation status update". After the real-time scheduling scheme is verified to be feasible by PySWMM simulation, it is sent to the gate automatic control system for execution. The operation data after execution is fed back to the digital twin model to complete the status update.
[0177] The specific method for this step is as follows:
[0178] S61: Closed-loop process construction;
[0179] Constructing a closed-loop scheduling link for the entire process: Real-time collected operational data is first input into the digital twin model to complete state updates and system state identification. The identification result triggers the corresponding scheduling mode, and the optimization module solves to obtain the real-time scheduling scheme. After simulation verification, the scheduling scheme is sent to the gate PLC control system for execution. After execution, the gate operation data and canal water condition data are collected again in real time and fed back to the digital twin model to complete the closed-loop update, realizing intelligent scheduling with no human intervention throughout the entire process.
[0180] The error feedback formula for a closed-loop system is:
[0181]
[0182] In the formula, The scheduling error at time t serves as the correction input for the optimization solution at time t+1. The measured value of the canal system's operating status at time t. Let t be the simulated predicted value of the scheduling scheme at time t.
[0183] S62: PySWMM simulation verification mechanism;
[0184] The optimized scheduling scheme is input into the dynamically mapped PySWMM hydrodynamic model, and a full-time hydrodynamic simulation is performed to verify whether the canal water level and flow rate meet the constraints. The convergence criterion formula is as follows:
[0185]
[0186]
[0187] In the formula, , The simulated cross-sectional water level and channel flow rate at time t are given.
[0188] If the simulation results do not meet the above convergence conditions, the solution is returned to the optimization module for re-solution; if the constraints are met, the scheduling scheme is issued for execution to avoid operational risks caused by infeasible scheduling schemes and ensure the security of scheduling decisions.
[0189] S7: Intelligent gate control command output and dynamic adaptation system construction;
[0190] Based on the final scheduling scheme output by the closed-loop scheduling system, standardized control commands for the target opening degree and scheduling action time sequence of each gate are generated and transmitted to the automatic control system of the irrigation district gate for execution. At the same time, a gate scheduling dynamic adaptation system with multiple modules is constructed to realize real-time dynamic correction of the irrigation district gate scheduling.
[0191] The specific method for this step is as follows:
[0192] S71: Intelligent gate control command output;
[0193] Based on the final scheduling scheme output by the closed-loop scheduling system, standardized Modbus-RTU control instructions are generated, including the time sequence of target opening degree, action execution time, and action duration for each gate. These instructions are transmitted to the PLC control cabinet in the irrigation area via industrial Ethernet to drive the gate actuators to complete automatic adjustment. The timing synchronization formula for the control instructions is as follows:
[0194]
[0195] In the formula, Let j be the time when the control command for the j-th gate is executed. This refers to the lag time of the propagation of water dynamics from the head of the main canal to the section where the j-th gate is located, in order to achieve time-sequential coordinated control of multiple gates.
[0196] S72: Construction of a dynamic adaptive system for gate scheduling;
[0197] The constructed gate scheduling dynamic adaptation system consists of a data reading module, a data analysis and storage module, a reference scheduling strategy selection module, a canal system operation status prediction module, a dynamic adaptation module, a user interface and operation module, and a system management and maintenance module. The functions of each module are as follows:
[0198] Data reading module: Reads real-time monitoring data stored in S2, including canal water level and flow, gate operation status, and meteorological and hydrological parameters;
[0199] Data analysis and storage module: Analyzes and stores the read data, and combines the simulation results of the PySWMM hydrodynamic model to accurately assess the current canal system operation status and hydrodynamic conditions;
[0200] Reference scheduling strategy selection module: Based on the hydrological year type and crop growth period of the planning year, select an optimized scheduling strategy in S5 as the reference base strategy for dynamic correction.
[0201] Canal system operation status prediction module: Using a reference scheduling strategy and real-time data to drive the PySWMM model, the predicted results of canal system water level and flow are obtained and compared with the measured values to determine whether to modify the scheduling scheme.
[0202] Dynamic Adaptation Module: When the hydrological prediction error does not meet the constraints or the deviation between the simulated and measured operating states exceeds the threshold, the optimal gate scheduling scheme is re-determined through the PySWMM model coupled with the Particle Swarm Optimization (PSO) algorithm. The formula for calculating the correction factor is as follows:
[0203]
[0204] In the formula, α is the flow correction factor. This is the average measured flow rate. To simulate the average traffic flow, the traffic target of the basic scheduling strategy is dynamically adjusted using a correction factor.
[0205] User interface and operation module: A user-friendly visual interface that supports functions such as viewing scheduling schemes, setting parameters, and manual control;
[0206] System Management and Maintenance Module: Responsible for user management, permission allocation, and the repair and improvement of system functions.
[0207] Example 2:
[0208] This embodiment applies to Embodiment 1. This embodiment uses a rice planting example in a large irrigation area in the cold region of Northeast China to further illustrate the present invention.
[0209] This invention provides an intelligent scheduling method for irrigation canal systems based on PySWMM and digital twins. This embodiment is applied to a typical rice-growing irrigation area in the cold region of Northeast China. The irrigation area has a designed irrigation area of 820,000 mu, with rice as the core crop. It adopts a zoned rotation irrigation system. The irrigation canal system includes 1 main canal, 2 branch canals, 18 distribution canals, and 70 farm canals. The entire canal system is equipped with 90 gates of various types, including control gates, diversion gates, and intake gates. It is a typical large-scale gravity-flow irrigation area in the Songnen Plain of Northeast my country, facing common industry problems such as delayed hydrodynamic propagation in cold regions, large fluctuations in spring flood water, insufficient water supply guarantee rate of traditional experience-based scheduling, and frequent gate scheduling conflicts.
[0210] The specific implementation steps of this method are as follows:
[0211] S1: Construction of a digital twin model of the irrigation district;
[0212] A digital twin of the physical-virtual dual system of the irrigation district is constructed to achieve high-precision dynamic mapping between the physical canal system and the virtual model.
[0213] S11: Physical system construction;
[0214] Centered on the actual four-level canal network of the irrigation area, a cluster of 90 gate equipment, and on-site IoT monitoring equipment, the system covers the entire canal network, including 1 main canal, 2 branch canals, 18 distribution canals, and 70 farm canals. At the head of the main canal, the inlet and outlet of the 2 branch canals, and the inlet of the 18 distribution canals, 22 radar level gauges and 21 ultrasonic flow meters are installed at key control sections. Gate opening instruments and PLC control cabinets are installed at each of the 90 gates to achieve real-time acquisition of canal water level data and gate operation data. Data transmission adopts the MQTT protocol with a transmission delay of ≤1s, meeting the communication requirements for real-time scheduling.
[0215] S12: Virtual system construction;
[0216] A one-dimensional hydrodynamic simulation model of the irrigation area was built based on PySWMM, using the one-dimensional Saint-Venant equations as the core calculation engine to accurately simulate the unsteady flow process in the open channel. Based on the measured topography of the irrigation area, canal system design drawings, and gate equipment parameters, the topological relationships of canal system nodes, canal segments, and gate structures were constructed in PySWMM. The main canals, branch canals, and distribution canals all adopted trapezoidal cross sections, and the bottom width, side slope coefficient, roughness coefficient, and bottom slope parameters of the cross sections were set segment by segment. All 90 gates adopted the orifice-weir flow dual-condition calculation mode, and the orifice size, weir flow / orifice flow coefficient, and maximum opening parameters were set for each gate, thus completing the basic framework of the model. The model was calibrated and validated using measured water level and flow series during the rice irrigation season in the irrigation district from 2023 to 2024. During the calibration period, the model's Nash efficiency coefficient (NSE) was 0.89 and the coefficient of determination (R²) was 0.93. During the validation period, the model's NSE was 0.87 and R² was 0.91, both of which met the simulation accuracy requirements and could accurately reproduce the hydrodynamic propagation process of the irrigation district's canal system.
[0217] S13: Dynamic mapping and synchronous updates;
[0218] The real-time data collected by the on-site IoT devices is transmitted to the virtual system via the MQTT protocol. The synchronization update frequency is set to 5 minutes / time. Each update includes the real-time water level of each control node in the entire canal system, the real-time flow of the canal section, and the real-time opening of 90 gates. This achieves spatiotemporal synchronization between the virtual system and the physical system, and the relative mapping error is stably controlled within 3%, providing a high-precision digital foundation for subsequent scheduling decisions.
[0219] S2: Multi-source data fusion and system status identification;
[0220] S21: Multi-source data acquisition and fusion;
[0221] The system collects comprehensive operational data covering all dimensions of the irrigation district, including: ① Canal water situation data: real-time water level and flow data at each control section of the main, branch, and distribution canals, collected via radar water level gauges and ultrasonic flow meters; ② Water demand data: field water demand calculated based on a rice growth cycle water demand model, farmer water use plans, and ecological base flow demand data for the irrigation district's main canals, focusing on four key water demand stages: rice greening, tillering, jointing and booting, and grain filling; ③ Equipment status data: real-time opening, operating status, and fault information data of 90 gates, collected via gate opening meters and PLC control cabinets. The collected multi-source data undergoes preprocessing, including outlier removal, timestamp alignment, and missing value completion. For data disconnection scenarios, linear interpolation is used to complete missing value completion, ultimately achieving spatiotemporal fusion of multi-source data to ensure data consistency and usability.
[0222] S22: Real-time system status identification;
[0223] Based on the fused full-dimensional data, the operational status of the irrigation district is identified in real time according to preset quantification rules. The status identification of the entire canal system is completed every 5 minutes. The quantification expression of the division rules is as follows:
[0224] Normal water supply status:
[0225]
[0226]
[0227] In the formula, Let i be the design operating water level of the i-th control section. Let t be the measured water level at this cross-section.
[0228] Insufficient water supply:
[0229]
[0230]
[0231] Excessive water transfer status:
[0232]
[0233]
[0234] The identification results serve as the core basis for subsequent scheduling triggers, with insufficient water supply and excessive water transfer triggering the corresponding emergency scheduling logic.
[0235] S3: Construction of an event-state collaborative scheduling mechanism;
[0236] A dual-mode collaborative scheduling mechanism, including timed scheduling and state scheduling, is constructed, and priority control rules are introduced to solve the scheduling instruction conflict problem at its root.
[0237] S31: Timed scheduling mechanism;
[0238] Based on the rice irrigation system in Northeast China, with a pre-set irrigation rotation period of 7 days, the 18 distribution canals are divided into 6 rotation irrigation groups, each containing 3 distribution canals. A water supply plan is formulated for each rotation irrigation group, specifying the opening / closing time of each gate, the target opening degree, the water supply duration, and the design flow rate. This forms a timed scheduling sequence table based on TimedEvents, serving as the basic water supply scheduling mode for the irrigation area. This ensures the orderly implementation of the rice rotation irrigation system and adapts to the water demand patterns throughout the entire growth period of rice.
[0239] S32: State scheduling mechanism;
[0240] Based on real-time system status recognition results, status trigger thresholds are set. When a water supply shortage is identified, the opening of the corresponding upstream control gate and diversion gate is increased to ensure the water supply needs of downstream paddy fields. When an excessive water transfer is identified, the opening of the corresponding upstream gate is decreased to reduce water transfer and prevent the water level in the canal system from exceeding the warning level and the leakage loss from aggravating. When a normal water supply is identified, status scheduling is not triggered. This mode serves as an emergency supplementary scheduling mode for irrigation districts and is suitable for sudden conditions such as fluctuations in spring flood water and sudden changes in field water demand in the Northeast irrigation district.
[0241] S33: Priority control rules;
[0242] Based on the total length of the irrigation canal and the hydrodynamic propagation time, the execution time window for timed scheduling is set to 15 minutes before and after the preset action execution time, and a priority control logic expression is introduced:
[0243] Execute the scheduled command:
[0244] Allow state scheduling to be triggered:
[0245] In the formula, This refers to the execution time of the k-th preset timed scheduling action. Within the time window for timed scheduling, the system automatically locks the triggering logic of state scheduling, prohibits the execution of state scheduling, and only executes the preset timed scheduling instructions; after the time window ends, the triggering permission of state scheduling is automatically restored. Through this rule, this embodiment completely avoids instruction conflicts between the two scheduling modes, reduces the number of invalid gate adjustments by 88%, and stably controls the fluctuation range of the canal water level within ±3%, significantly improving the stability of the scheduling system.
[0246] S4: Construction of a multi-objective optimization scheduling model;
[0247] With the optimization objectives of minimizing water supply error, water conveyance loss, and gate adjustment frequency in the irrigation area, a multi-objective optimization scheduling model adapted to rice irrigation areas is constructed, and boundary constraints are set simultaneously.
[0248] S41: Construction of the objective function;
[0249] (1) Minimize water supply error: Ensure water demand for rice throughout its entire growth period and improve irrigation water supply guarantee rate.
[0250]
[0251] In the formula, i is the irrigation group number, with a total of 6 irrigation groups; t is the scheduling period, with a step size of 30 minutes, and a total of 336 time periods in a 7-day rotation period; Let be the actual water supply flow of the i-th irrigation group during time period t. The water demand for rice in this irrigation group during time period t is t.
[0252] (2) Minimize water conveyance loss: reduce water loss due to canal leakage, evaporation and drainage, and improve water resource utilization efficiency.
[0253]
[0254] In the formula, The inflow rate at the head of the irrigation canal during time period t is... The discharge flow at the end of the irrigation area during time period t. t represents the total water supply flow of the irrigation district during the time period.
[0255] (3) Minimum gate adjustment frequency target: Reduce the number of gate operations and adjustment ranges of 90 gates, reduce equipment wear and tear, and extend service life.
[0256]
[0257] In the formula, Let j be the opening value of the j-th gate in time period t, where j is the gate number. There are a total of 90 gates in the entire canal system.
[0258] S42: Constraint settings;
[0259] Water level constraints:
[0260]
[0261] In the formula, , The minimum and maximum allowable water levels at the i-th control section are used to ensure that the canal system does not experience the risk of drying up or overflowing.
[0262] Flow constraints:
[0263]
[0264] In the formula, , The minimum and maximum current carrying capacity of the j-th channel are determined to ensure that the channel operates within the design operating range.
[0265] Gate opening constraints:
[0266]
[0267] In the formula, The maximum fully open degree of the j-th gate conforms to the physical operating boundary of the gate equipment;
[0268] Irrigation timing constraints:
[0269]
[0270] In the formula, , For the water supply periods of the p-th and q-th irrigation groups, ensure that the 6 irrigation groups are supplied with water according to the preset time sequence, with no overlap in water supply periods;
[0271] Water balance constraints:
[0272]
[0273] In the formula, Let t be the amount of irrigation water used during time period t. The rainfall during period t is This represents the crop field water consumption during time period t. This represents the maximum allowable water loss during time period t.
[0274] S5: Construction of a hierarchical optimization solution mechanism;
[0275] A two-layer optimization solution framework is built, which combines offline global optimization and online real-time correction, taking into account both the global optimality of the scheduling scheme and the real-time operating condition response speed.
[0276] S51: Offline global optimization layer;
[0277] The scheduling cycle is 7 days for rice irrigation rotation. The NSGA-II multi-objective optimization algorithm is used, with a population size of 150, 800 iterations, a crossover probability of 0.8, and a mutation probability of 0.1. The Pareto optimal solution set is obtained by solving the multi-objective optimization model. The closeness of each solution is calculated by the TOPSIS method, and the optimal compromise solution is selected. The basic scheduling strategies corresponding to three hydrological year types (wet year, normal year, and dry year) and five growth stages (rice greening stage, tillering stage, jointing and booting stage, grain filling stage, and maturity stage) are formed to create a standardized scheduling strategy library for the irrigation area, providing a globally optimal basic framework for real-time scheduling.
[0278] S52: Online real-time optimization layer;
[0279] The scheduling step size is 5 minutes. The Particle Swarm Optimization (PSO) algorithm is used with a population size of 30 and 80 iterations. The basic scheduling strategy obtained from offline optimization is used as the initial solution. Based on the real-time collected water level and flow data and system status identification results, the scheduling strategy is quickly corrected and locally optimized. The average solution time is 5.8 seconds, which meets the real-time scheduling response requirement of ≤10 seconds. It achieves a balance between global optimality and real-time response speed, and is suitable for sudden scenarios such as water fluctuations and sudden changes in field water demand in the Northeast irrigation area.
[0280] S6: Optimization-Simulation-Control Closed-Loop Mechanism Construction;
[0281] Construct a closed-loop scheduling system covering the entire process of "real-time data acquisition - system status identification - multi-objective optimization decision-making - PySWMM simulation verification - gate control execution - operation status update" to achieve intelligent scheduling with no human intervention throughout the entire process.
[0282] S61: Closed-loop process construction;
[0283] Constructing a closed-loop scheduling chain: Real-time collected operational data is first input into the digital twin model to complete state updates and system state identification. The identification result triggers the corresponding scheduling mode, and the optimization module solves for the real-time scheduling scheme. The scheduling scheme is verified by PySWMM simulation and then sent to the gate PLC control system for execution. After execution, the gate operation data and canal water level data are collected again in real time and fed back to the digital twin model to complete the closed-loop update, forming an error feedback correction mechanism. The error feedback formula is:
[0284]
[0285] In the formula, The scheduling error at time t serves as the correction input for the optimization solution at time t+1. The measured value of the canal system's operating status at time t. Let t be the simulated predicted value of the scheduling scheme at time t.
[0286] S62: PySWMM simulation verification mechanism;
[0287] The optimized scheduling scheme is input into the dynamically mapped PySWMM hydrodynamic model, and a full-time hydrodynamic simulation is performed to verify whether the canal water level and flow rate meet the constraints and converge. .
[0288]
[0289] In the formula, , For the simulated cross-sectional water level and channel flow at time t, if the simulation results do not meet the above convergence conditions, the solution is returned to the optimization module for re-solving; if the constraints are met, the scheduling plan is issued for execution, thus avoiding operational risks such as overtopping and insufficient water supply caused by infeasible scheduling plans from the source, and ensuring the safety of scheduling decisions.
[0290] S7: Intelligent gate control command output and dynamic adaptation system construction;
[0291] S71: Intelligent gate control command output;
[0292] Based on the final scheduling scheme output by the closed-loop scheduling system, standardized Modbus-RTU control commands are generated, containing the time series of target opening degree, action execution time, and action duration for all 90 gates in the canal system. Combined with the lag time of water dynamics propagating from the head of the main canal to each gate section, multi-gate time-sequential coordinated control is achieved. The timing synchronization formula for the control commands is:
[0293]
[0294] In the formula, Let j be the time when the control command for the j-th gate is executed. This refers to the lag time for the propagation of water dynamics from the head of the main canal to the section where the j-th gate is located. Control commands are transmitted to the PLC control cabinet in the irrigation area via industrial Ethernet, driving the gate actuators to complete automatic adjustments and achieving coordinated intelligent control of all gates in the canal system.
[0295] S72: Construction of a dynamic adaptive system for gate scheduling;
[0296] A gate scheduling dynamic adaptation system is constructed, comprising a data reading module, a data analysis and storage module, a reference scheduling strategy selection module, a canal system operation status prediction module, a dynamic adaptation module, a user interface and operation module, and a system management and maintenance module. When the canal system operation status prediction module detects that the relative error between the simulated water level and flow rate and the measured values exceeds 10%, the dynamic adaptation module immediately couples the calibrated PySWMM model and the PSO algorithm, dynamically corrects the basic scheduling strategy through a flow correction factor, and re-determines the optimal gate scheduling scheme. The formula for calculating the correction factor is:
[0297]
[0298] In the formula, For flow correction factor, This is the average measured flow rate. This is to simulate the average flow rate.
[0299] This system can effectively adapt to scenarios such as fluctuations in snowmelt water and sudden rainfall in irrigation areas of Northeast China during spring, enabling real-time dynamic correction of scheduling plans and further improving the robustness of the scheduling system.
[0300] After implementing the method described in this invention, the irrigation water supply guarantee rate of rice in the irrigation area increased from 81% to 96.5%, the water loss rate of the canal system decreased from 29% to 15.2%, the number of ineffective adjustments of 90 gates decreased by 88%, there were no scheduling conflicts during the entire irrigation period, and the average yield of rice per mu increased by 9.2%. The water-saving, yield-increasing, and efficiency-enhancing effects are significant, which meets the intelligent upgrading needs of large-scale rice irrigation areas in Northeast China.
[0301] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0302] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for intelligent scheduling of gates in irrigation canal systems based on PySWMM and digital twins, characterized in that, The method includes: S1: Use the MQTT protocol to synchronize the data collected in real time from the irrigation area physical system to the virtual model built based on PySWMM, drive the virtual model to update, and obtain a virtual operating state that is dynamically synchronized with the physical system; S2: The real-time collected data is fused with water demand data and gate status data. The fused data is identified according to preset quantification rules, and the system status is output as normal water supply, insufficient water supply, or excessive water supply. S3: Set an execution time window for each gate action in the irrigation plan; within the window, only the preset timed scheduling command is executed; outside the window, if the system status output by S2 is insufficient water supply or excessive water delivery, a status scheduling requirement is generated. S4: Establish a multi-objective optimization model with the objectives of minimizing water supply error, minimizing water conveyance loss, and minimizing gate adjustment frequency, and set water level constraints, flow constraints, gate opening constraints, irrigation timing constraints, and water balance constraints. S5: The NSGA-II algorithm is used offline to solve the multi-objective optimization model. The optimal compromise solution is selected from the Pareto optimal solution set by the TOPSIS method to obtain the basic scheduling strategy corresponding to different hydrological year types and crop growth periods. Online, the current matching basic scheduling strategy is used as the initial solution. Based on the state scheduling requirements generated in S3, the particle swarm optimization algorithm (PSO) is used to quickly find the optimal solution and output the preliminary scheduling scheme. S6: Input the preliminary scheduling scheme into the virtual model in S1 for hydrodynamic simulation. If the water level and channel flow obtained from the simulation meet the constraints set in S4, output the final scheduling scheme; otherwise, return to S5 to re-optimize. S7: Convert the final scheduling scheme into control commands and send them to the gate for execution; update the virtual operating state of the virtual model in S1 using the measured data collected after execution and calculate the scheduling error to correct the online optimization input in S5; when the deviation between the predicted value and the measured value of the virtual operating state exceeds the threshold, regenerate the corrected scheduling scheme through the PSO algorithm.
2. The method according to claim 1, characterized in that, The virtual model built on PySWMM described in S1 has a core computational engine based on the one-dimensional Saint-Venant equations, including the continuity equation and the momentum equation: Continuity equation: , Momentum equation: , In the formula, The cross-sectional area of the channel through which water flows. For time, For channel cross-sectional traffic, Distance along the canal line, The lateral inflow rate per unit length of the channel. It is the acceleration due to gravity. The cross-sectional water level For channel traffic modulus; In the virtual model described in S1, the gate flow rate calculation is divided into two conditions: weir flow and orifice flow. When the gate opening is greater than the critical weir flow height, the weir flow formula is used. When the gate opening is less than or equal to the critical weir height, the orifice flow formula is used. In the formula, For the flow rate of the weir, The flow coefficient of the weir is... For the clear width of the gate, The effective head above the weir, For orifice flow rate, The orifice flow coefficient is... For the gate opening, The difference in water level between the upstream and downstream of the sluice gate; The virtual model described in S1 uses measured water level and flow data from historical irrigation periods in the irrigation district for calibration and verification, with the Nash efficiency coefficient (NSE) used as the accuracy evaluation index. , In the formula, for Real-time traffic measurement for Simulate traffic at all times. This represents the average measured flow rate.
3. The method according to claim 1, characterized in that, In S2, the collected data undergoes preprocessing including outlier removal, timestamp alignment, and missing value completion; the missing value completion uses linear interpolation. , In the formula, for Interpolation results for missing values at time points. , The data points are valid times before and after the missing time. , These are the valid data values at the corresponding time.
4. The method according to claim 1, characterized in that, The specific expression for the preset quantization rule mentioned in S2 is: Normal water supply conditions require the following conditions to be met simultaneously: , A water supply shortage requires the following conditions to be met simultaneously: , Excessive water transfer requires the following conditions to be met simultaneously: , In the formula, For the first The design operating water level of each control section for The measured water level at that cross-section at that time. This represents the actual water supply flow rate. This represents the water requirement for crops.
5. The method according to claim 1, characterized in that, The execution time window mentioned in S3 refers to the period before and after the preset gate action execution time. minute, The value range is 5~30min, and it is adaptively adjusted according to the length of the irrigation canal system and the hydrodynamic propagation time; the priority control rule is: when... When the system is locked in a state, the scheduling trigger logic only executes preset timed scheduling instructions; when... When this happens, the triggering permission for state scheduling is restored.
6. The method according to claim 1, characterized in that, The multi-objective optimization model described in S4 is specifically as follows: Minimize water supply error target: , Minimize water transfer losses: , Minimum target for gate regulation frequency: , In the formula, for Time period The actual water supply flow of each water-using unit For water flow rate, for The inflow rate at the head of the main canal during the period for The discharge flow rate at the end of the period for Total water supply flow during the period for Time period The opening value of each gate; The water level constraint mentioned in S4 is The flow constraint is The gate opening constraint is The timing constraint for rotational irrigation is that the water supply periods of different rotational irrigation groups do not overlap. Water balance constraint is In the formula For irrigation water volume, For rainfall, Water consumption in crop fields The maximum allowable water loss.
7. The method according to claim 1, characterized in that, The parameters of the NSGA-II algorithm described in S5 are set as follows: population size 100~200, number of iterations 500~1000, crossover probability 0.7~0.9, mutation probability 0.05~0.1; the TOPSIS method uses proximity... Select the optimal compromise solution, where , The first The Euclidean distance from each solution to the positive and negative ideal solutions.
8. The method according to claim 1, characterized in that, The velocity and position update formulas for the PSO algorithm described in S5 are as follows: , The parameters are set as follows: population size 20~50, number of iterations 50~100, and solution time ≤10s.
9. The method according to claim 1, characterized in that, The convergence criterion for the hydrodynamic simulation described in S6 is: , In the formula, , For simulation Time of the first The water level at each cross-section is similar to the first Traffic from multiple channels , The minimum and maximum allowable water levels, , These represent the minimum and maximum overcurrent capacity.
10. The method according to claim 1, characterized in that, The control commands described in S7 are Modbus-RTU commands, containing a time sequence of the target opening degree, action execution time, and action duration for each gate; the time-series coordinated control formula for multiple gates is: In the formula For the first The timing of the execution of control commands for each gate The water dynamics of the canal system are transmitted from the head of the main canal to the next... The lag time of the section where each gate is located; Specifically, the dynamic correction described in S7 involves calculating a traffic correction factor when the deviation between the predicted and measured values of the virtual operating state exceeds a threshold. The traffic target of the basic scheduling strategy in S5 online optimization is corrected by the correction factor, and the PSO algorithm is re-driven to generate a corrected scheduling scheme, where... This is the average measured flow rate. This is to simulate the average flow rate.