Irrigation canal network water distribution optimization control method and device, electronic equipment, medium
By combining the canal network hydrodynamic model with the Transformer model in the irrigation canal network water distribution system, the problem of low simulation accuracy was solved, efficient irrigation water resource management and scheduling optimization were achieved, and the accuracy and flexibility of the irrigation canal network water distribution system were improved.
Patent Information
- Application Number
- CN202411660261.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The simulation accuracy of the existing irrigation canal network water distribution optimization model is not high enough, resulting in a large difference between the control plan and the actual situation, and a lack of flexibility and timeliness.
A simulation dataset is generated using a canal network hydrodynamic model to perform rough training on the Transformer model. The particle swarm algorithm is then used to find the optimal gate scheduling scheme. The Transformer model is then iteratively trained using actual irrigation data, and a model with an attention mechanism is constructed to improve its robustness and versatility.
It improves the simulation accuracy of the water transfer model, reduces the application difficulty in irrigation areas with insufficient informatization construction, realizes flexible adjustment and continuous iterative prediction of the model, and improves irrigation water utilization and system efficiency.
Smart Images

Figure CN119168427B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of irrigation water distribution in irrigation areas, and in particular to a method and device, electronic equipment, and medium for optimizing and controlling water supply and distribution in irrigation channel networks. Background Art
[0002] With global climate change and population growth, the contradiction between water supply and demand is becoming increasingly prominent. This is particularly true in the agricultural sector, where the rational allocation of water resources is crucial for ensuring food security and sustainable development. Therefore, scientifically guiding the optimization of water distribution in irrigation areas, reducing canal losses, and improving irrigation water utilization efficiency are key to the stable development of agricultural water conservancy.
[0003] In traditional irrigation district water distribution, due to a lack of real-time data support and intelligent management, water distribution plans are often formulated based on crop growth patterns, irrigation canal distribution, and manual experience. This model is relatively fixed in time and difficult to respond to real-time changes in meteorological conditions and water source conditions, resulting in a crude water distribution model that lacks flexibility and timeliness. With the development of information technology and artificial intelligence, real-time canal water distribution based on meteorological conditions and irrigation water demand forecasts has become possible. The optimization objective has also evolved from simply minimizing canal water distribution losses to multi-objective modeling that also considers stable canal water delivery.
[0004] In the research on irrigation canal water distribution optimization models, a variety of intelligent algorithms have emerged, such as differential evolution, multi-objective particle swarm optimization, and NSGA-II. These algorithms have improved the timeliness and refinement of irrigation canal water distribution issues. However, in the process of realizing the present invention, the inventors found that there are at least the following problems in the existing technology: the simulation accuracy of the water delivery model is not high enough, resulting in a significant difference between the subsequent optimization plan and the actual situation.
[0005] In summary, the development of irrigation district canal network water supply and distribution optimization control technology not only needs to consider the rational allocation and utilization of water resources, but also needs to combine modern information technology and intelligent algorithms to achieve scientific management and efficient scheduling of irrigation districts. Summary of the Invention
[0006] The purpose of the embodiments of the present application is to provide a method and device, electronic equipment, and medium for optimizing and controlling water supply and distribution in an irrigation canal network, so as to solve the technical problem in the related art that the simulation accuracy of the water supply model is not high enough.
[0007] According to a first aspect of an embodiment of the present application, a method for optimizing water supply and distribution in an irrigation canal network is provided, comprising:
[0008] S1: Collect historical irrigation data and data collected by sensors after the informatization construction. The irrigation data includes meteorological characteristics data, crop data, soil moisture data of different layers in each irrigation area, and gate scheduling plans for corresponding time periods;
[0009] S2: Construct a canal network hydrodynamic model;
[0010] S3: calibrating the canal network hydrodynamic model using the irrigation data of the irrigation area, and generating a simulation data set using the calibrated canal network hydrodynamic model;
[0011] S4: Build a Transformer model and train the Transformer model using the simulation dataset;
[0012] S5: Use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization goal;
[0013] S6: Acquire actual irrigation data of the irrigation area to which the optimal gate scheduling scheme is applied, and use the actual irrigation data of the irrigation area as negative feedback to retrain the Transformer model trained in S4.
[0014] According to a second aspect of an embodiment of the present application, a device for optimizing and controlling water supply and distribution in an irrigation canal network is provided, comprising:
[0015] The data acquisition module is used to collect irrigation data recorded in historical text and irrigation data collected by sensors after the construction of informatization. The irrigation data includes meteorological characteristics data, crop data, soil moisture data of different soil layers in each irrigation area, and gate scheduling plans for corresponding time periods;
[0016] Model building module, used to build canal network hydrodynamic model;
[0017] a calibration and data generation module, configured to calibrate the canal network hydrodynamic model using the irrigation data of the irrigation area, and generate a simulation data set using the calibrated canal network hydrodynamic model;
[0018] A model building and training module, used to build a Transformer model and train the Transformer model using the simulation dataset;
[0019] The optimization module is used to use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization objective;
[0020] The negative feedback module is used to obtain actual irrigation data of the irrigation area to which the optimal gate scheduling scheme is applied, and to use the actual irrigation data of the irrigation area as negative feedback to retrain the Transformer model trained by the model construction and training module.
[0021] According to a third aspect of the embodiments of the present application, there is provided an electronic device, including:
[0022] one or more processors;
[0023] a memory for storing one or more programs;
[0024] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.
[0025] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0026] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0027] The method of first using the canal network hydrodynamic model to generate a simulation data set to perform rough training on the Transformer model, and then using the actual irrigation data after scheduling to iteratively train the Transformer model, not only solves the problem of insufficient simulation accuracy of the water delivery model, but also reduces the difficulty of applying the water delivery model in irrigation areas with insufficient information construction. Compared with the irrigation area canal network water supply and distribution optimization control method based on hydrodynamic simulation, the present invention can flexibly adjust the model complexity according to actual conditions and needs. At the very least, a simplified canal network hydrodynamic model can be constructed in the absence of high-precision three-dimensional vector data of the irrigation area and without solving the Saint-Venant equations, which reduces the threshold for use of the present invention.
[0028] Compared to irrigation canal network water distribution optimization methods based on RNN, LSTM, GRU, and SRU models, the Transformer model used in this paper does not rely on the previous calculation results, resulting in faster calculation speeds and better coordination with optimization algorithms. Secondly, by using simulation data generated from a canal network hydrodynamic model to train the Transformer model, it gains greater robustness.
[0029] In addition, the present invention takes into account the issue of subsequent model maintenance. By using a Transformer model with an attention mechanism, the model can continue to iterate the prediction accuracy after deployment, making it more versatile.
[0030] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0032] Figure 1 The present invention is a flow chart showing a method for optimizing water supply and distribution in an irrigation canal network according to an exemplary embodiment.
[0033] Figure 2 The figure shows a generalized diagram of an irrigation canal network according to an exemplary embodiment.
[0034] Figure 3 The present invention is a block diagram of a device for optimizing water supply and distribution in an irrigation canal network according to an exemplary embodiment.
[0035] Figure 4 The figure is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0036] Exemplary embodiments are described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different drawings represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with this application.
[0037] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a," "the," and "the" used in this application are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0038] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0039] Figure 1 FIG. 1 is a flow chart showing a method for optimizing water supply and distribution in an irrigation canal network according to an exemplary embodiment. Figure 1 As shown, the method includes the following steps:
[0040] S1. Collect irrigation data recorded in historical text and irrigation data collected by sensors after the construction of informatization. The irrigation data include meteorological characteristic data, crop data, soil moisture data of different soil layers in each irrigation area, and gate scheduling plans for corresponding time periods.
[0041] Specifically, the meteorological characteristic data includes light, rainfall, temperature and humidity, and the crop data includes planting type and growth period. The specific representation is as follows:
[0042] Illumination I = [I1, I2, ... , I t ], length is t;
[0043] Rainfall P = [P1, P2, ... , P t ], length is t;
[0044] Temperature T = [T1, T2, ... , T t ], length is t;
[0045] Humidity F = [F1, F2, ... , F t ], length is t;
[0046] Planting type Cv = [Cv1, Cv2, ... , Cv t ], length is t;
[0047] Growth period Ct = [Ct1, Ct2, ... , Ct t ], length is t;
[0048] Soil moisture information M = [M1, M2, M3, ... , M n , ... , M c ], c represents the number of soil layers, where M n =[M n_1 , M n_2 , M n_3 , ... , M n_t ], length is c×t;
[0049] Gate scheduling scheme O = [O1, O2, O3, ... , O n , ... , O p ], p represents the number of gates, where O n = [O n_1 , O n_2 , O n_3 , ... , O n_t ], length is p×t;
[0050] In order to enhance model performance, reduce the risk of overfitting, and ensure data consistency, the irrigation data of the irrigation district can also be cleaned and formatted first. Specifically, the data are aligned according to the time and combined into a two-dimensional matrix of size (6+c+p)×t. In the case of missing data, it is repaired based on contextual data, gate operation data, and historical text records. Subsequently, the data that may exist in the data is preliminarily screened by using the 3σ rule or clustering method, and corrections are made based on the experience of irrigation district managers. The cleaned data is normalized, mapped to the interval [-1,1], and integrated into a calibration data set for calibrating the simplified canal network hydrodynamic model. This operation facilitates improving the model training speed and model prediction accuracy.
[0051] S2. Constructing a canal network hydrodynamic model. This step may include the following sub-steps:
[0052] S21: Based on the canal network conditions of the irrigation area, the upstream and downstream relationships of the diversion gates, and the corresponding relationships between the diversion gates and the irrigation sections, a tree-like relationship network is established. The tree-like relationship network will determine the calculation order of water flow in the canal network hydrodynamic model;
[0053] Specifically, Figure 2 This is a schematic diagram of an irrigation canal network, shown according to an exemplary embodiment. The flow direction at the diversion gates is determined based on the upstream and downstream relationships of the diversion gates in the diagram. The diversion gates and irrigation areas are then used to determine the irrigation areas into which the water flows at each diversion gate. The area of each irrigation area in the diagram is then used to determine the proportion of water flowing into each diversion gate. Based on the flow direction, the irrigation areas into which the water flows at each diversion gate, and the area of each irrigation area, the calculation sequence in the canal network hydrodynamic model is determined: water flows from the main canal through the diversion gates and then through the branch canals to the irrigation areas.
[0054] S22: Initializing the flow direction, water diversion, and flow ratio parameters after the diversion gate based on the tree-like relationship network and the designed flow ratio of the main canal and branch canals. The parameters will determine the diversion size and flow direction of the water flow in the canal network hydrodynamic model.
[0055] Specifically, based on the ratio of the designed flow of the branch canals behind each diversion gate to the designed flow of the main canal, the diversion ratio at the diversion gate is determined, and parameters for flow direction, diversion status, and flow ratio after the diversion gate are initialized. These parameters determine the diversion magnitude and direction of flow in the canal network hydrodynamic model, and determine the flow ratio from the main canal to the branch canals when calculating flow through the diversion gates, as well as the flow ratio from the branch canals to the individual irrigation sections.
[0056] S23: Initialize the water infiltration parameters and evaporation parameters in the canal network hydrodynamic model based on the relationship between the meteorological characteristic data and water evaporation at the irrigation area, as well as the relationship between the soil moisture conditions and water infiltration at the irrigation area;
[0057] Specifically, a regression analysis was conducted on canal data at the irrigation district's location, including channel bed soil composition and structure, channel cross-sectional form and hydraulic characteristics, groundwater depth, channel length, and channel lining conditions, with water infiltration data to determine the impact weight of soil moisture. A regression analysis was also conducted on meteorological data at the irrigation district's location, including wind speed, air temperature, vapor pressure, and relative humidity, with water evaporation data to determine the impact weight of each meteorological characteristic on water evaporation in the main and branch canals. Based on these impact weights, the water infiltration and evaporation parameters in the canal network hydrodynamic model were initialized.
[0058] S24: Construct a canal network hydrodynamic model using a tree-like relationship network, flow direction, water diversion conditions, and flow rate ratio parameters after the diversion gate, infiltration parameters, and evaporation parameters.
[0059] Specifically, a simplified canal network hydrodynamic model is constructed using the calculation sequence of water flow, water flow direction, water diversion situation, water flow ratio after the diversion gate, infiltration parameters and evaporation parameters when water flows through the main and branch canals, and it is encapsulated as a model interface to facilitate subsequent model debugging and calling.
[0060] S3. Calibrate the canal network hydrodynamic model using the irrigation data of the irrigation area, and generate a simulation data set using the calibrated canal network hydrodynamic model. This step may include the following sub-steps:
[0061] S31. Arrange and format the meteorological characteristic data, crop data, soil moisture data, and gate scheduling plan to form an irrigation data set for the irrigation area, including:
[0062] Take the model input X at time t t = is:
[0063] X t =[I t ,P t ,T t ,F t ,Cv t ,Ct t ,M 1_(t-1) ,M 2_(t-1) ,......,M c_(t-1) ,O 1_t ,O 2_t ,......,O p_t ], where I t represents the average light intensity at time t, P trepresents the rainfall from time t-1 to time t, T t represents the average temperature at time t, F t Indicates the average humidity at time t, Cv t Indicates the crop planting type at time t, Ct t represents the crop growth period at time t, M 1_(t-1) to M c_(t-1) represents the soil moisture condition of the soil layers numbered 1 to c at time t-1, O 1_t to O p_t Indicates the gate opening of gates numbered 1 to p at time t;
[0064] Let the model expected output Y at time t be t for:
[0065] Y t =[M 1_t ,M 2_t ,......,M c_t] , where t∈[t0,t n ], M 1_t to M c_t represents the actual observed soil moisture conditions of the soil layers numbered 1 to c at time t;
[0066] S32. Take the total length of the irrigation data set of the irrigation area as n, set the sliding window width as S, and obtain n-(S-1) gate scheduling processes with a scheduling duration of S through the sliding window method to form a calibration data set, where:
[0067] The model input x is: x=[x0,x1,......,x n-S ], where x t =[X t ,X t+1 ,......,X t+(S-1) ];
[0068] The model expects the output y to be: y=[y0,y1,......,y n-S ], where y t =[Y t ,Y t+1 ,......,Y t+(S-1) ];
[0069] S33. Use the canal network hydrodynamic model to traverse and calculate the calibration data set to obtain the model calculation output y':
[0070] y`=[y0`,y1`,......,y n-S `], where y t `=[Y t `,Y t+1`,......,Y t+(S-1) `]
[0071] The model input x t It is a two-dimensional matrix of size (6+c+p)×t. The model expects the output y t And the model calculates the output y t Both are one-dimensional matrices of size 1×c. The size of S in this step can be adjusted based on the data length in the specific application scenario and the model size supported by the hardware. A larger L value can better identify periodic patterns, but it also has the disadvantage of increasing training and computation time. Therefore, using L=72 is a reasonable value in practice.
[0072] S34, comparing the difference between the expected model output y and the calculated model output y', and modifying the parameters of the canal network hydrodynamic model in S2 according to the difference so that the difference is less than a set threshold;
[0073] Specifically, the difference between the model's expected output y and the model's calculated output y', i.e., the error e = y − y', is calculated. A parameter sensitivity analysis is performed to identify the parameters that have the greatest impact on the model output. Based on the error analysis results and parameter sensitivity analysis, the model parameters are adjusted to reduce the error. The model parameters include the flow rate ratio after the diversion gate, the infiltration parameter when the water flows through the main and branch canals, and the evaporation parameter. After adjusting the parameters, the model is run again to verify whether the parameter adjustment has effectively reduced the error and ensure the consistency of the model output with the observed data. If the error is still greater than the set threshold, the parameter adjustment and model verification steps are repeated until the error requirement is met. When the adjusted parameters make the difference between the model output y' and the expected output y less than or equal to the set threshold, the model parameters are updated and the adjustment history is recorded.
[0074] Models run on real data, making decisions more data-driven and reducing the risk of relying on experience or intuition. Furthermore, by comparing model outputs with actual observations, model parameters can be regularly verified and updated, ensuring the model adapts over time and to changing circumstances.
[0075] S35, generating meteorological characteristic data, crop information data, gate scheduling plan and soil moisture data before scheduling, and using them as inputs of the canal network hydrodynamic model to calculate the soil moisture data after scheduling;
[0076] Specifically, meteorological characteristic data, crop information data, gate scheduling plans, and pre-scheduling soil moisture data are generated. Meteorological characteristic data and soil moisture data: Based on the existing irrigation area data collected by S1, the normal distribution parameters μ and σ for sunlight, rainfall, temperature, humidity, and soil moisture are calculated, respectively. These parameters are used to generate meteorological characteristic data and pre-scheduling soil moisture data. Crop information data: Based on the proportion of crop types in the irrigation area, probability weights are determined, and crop type and growth cycle data are randomly generated. Gate scheduling plans: The opening of each gate at each moment is randomly generated.
[0077] S36, based on the meteorological characteristic data, crop information data, gate scheduling plan, soil moisture data before scheduling, and soil moisture data after scheduling generated in S35, repeatedly execute S31 and S32 to form a simulation data set;
[0078] Specifically, the meteorological characteristic data, crop information data, gate scheduling plan, pre-scheduling soil moisture data, and post-scheduling soil moisture data generated in S35 are formatted into simulation data sets of x and y. This formatting facilitates data visualization and verification of the simulation data, ensuring data accuracy and reliability. Furthermore, it helps reduce the workload of data integration for subsequent models.
[0079] S4: Build a Transformer model and train the Transformer model using the simulation dataset. This step includes the following sub-steps:
[0080] S41: performing data preprocessing on the simulation data set;
[0081] Specifically, use min-max normalization, Z-score normalization, or logarithmic transformation methods to adjust the range or distribution of the data to a specified range. Perform data dimensionality reduction using the PCA method to reduce the dimension and scale of the data while retaining the most important information. Augment, obfuscate, or generate the original data to increase its diversity and scale and improve the generalization ability of the model. Use the Pandas and NumPy libraries in Python to simplify the data preprocessing process and improve efficiency. Data preprocessing can not only reduce the computing resources and time required for model training through data reduction and dimensionality reduction, but also reduce the model's sensitivity to noisy data and avoid overfitting through feature selection and regularization.
[0082] S42: Build a Transformer model, randomly initialize the weights of each layer, and send the simulation data set to the Transformer model for training;
[0083] Specifically, a Transformer model is constructed and the weights of each layer are randomly initialized. In this embodiment, the Transformer model mainly consists of four parts: input module, encoding module, decoding module, and output module. t As input, it is first converted into a series of embedding vectors x through the input module (Input) t_1 , these vectors include word embeddings and positional encodings to preserve the position information of words in the sequence.
[0084] The encoder module (Encoder) consists of multiple encoder layers (Encoder Layer), each layer contains two sub-layers: Multi-Head Self-Attention sub-layer and Feed-Forward Neural Network sub-layer. t_1 After passing through the encoding module, it will be encoded into x t_2 .
[0085] The decoding module (Decoder) is also composed of multiple decoding layers (Dncoder Layer), each layer contains three sub-layers: Mask Multi-Head Self-Attention sub-layer, Multi-Head Self-Attention sub-layer and Feed-Forward Neural Network sub-layer. t_2 The encoded information will be decoded into x after passing through the decoding module t_3 .
[0086] The output module (Output) consists of a fully connected layer (Linear Layer) and a Softmax layer, which converts the x t_3 Various feature information is mapped from high-dimensional space to the output result y t `, thereby realizing the complex nonlinear fitting capability of the model.
[0087] Compared to RNN, LSTM, GRU, and SRU models, the Transformer model can calculate all subsequent results at once, independent of the previous calculation results. Choosing the Transformer model results in faster calculations and better coordination with optimization algorithms.
[0088] S43: During the training process, a back propagation algorithm is used to update the parameters of each layer in the Transformer model.
[0089] Specifically, during training, the backpropagation algorithm is used to update the parameters of each layer within the model. After training, the Transformer model is fed with x, and the output is the predicted soil moisture value y'. The loss function used in training the Transformer model is the root mean square error (RMS), which is the sum of the RMS of the actual monitored value y and the predicted value y'. The optimization goal is to minimize the loss function.
[0090] S5. Use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization objective. This step may include the following sub-steps:
[0091] S51: Configuration optimization objectives: Minimize canal system water loss, minimize main canal flow fluctuation, minimize irrigation time, and meet soil moisture requirements;
[0092] Specifically, the optimization problem of the irrigation system is transformed into an objective function with multiple objectives: minimizing canal water loss, minimizing main canal flow fluctuations, minimizing irrigation time, and meeting soil moisture requirements. The goal of minimizing canal water loss is to reduce water loss caused by leakage and evaporation during the water transmission process by optimizing canal water distribution; the goal of minimizing main canal flow fluctuations is to maintain the stability of the main canal flow and reduce uneven irrigation and water resource waste caused by flow fluctuations; the goal of minimizing irrigation time is to reduce the total time required for irrigation and improve irrigation efficiency; the goal of meeting soil moisture requirements is to ensure that the moisture in the soil meets the needs of crop growth and avoid the adverse effects of excessive or insufficient moisture on crop growth. By modifying the weight of each objective in the objective function and setting the importance of each objective, it is convenient for subsequent algorithm optimization.
[0093] S52: The trained Transformer model is responsible for calculating the post-schedule soil moisture data when different gate scheduling schemes are applied while keeping the meteorological characteristic data, crop information data, and pre-schedule soil moisture data unchanged.
[0094] Specifically, the system uses meteorological data, crop information, pre-scheduling soil moisture data, and a gate scheduling solution provided by a particle swarm algorithm as input. The trained Transformer model calculates the post-scheduling soil moisture data. Multiple computation requests within a short period of time are combined into a single batch and fed into the Transformer model for parallel computation. This effectively speeds up the computation and facilitates the particle swarm algorithm's optimization.
[0095] S53: The particle swarm algorithm is responsible for finding the optimal gate scheduling scheme to meet the optimization goal and obtain the optimal gate scheduling scheme for irrigation in the irrigation area.
[0096] Specifically, the parameters of the PSO algorithm are set, including the number of particles, number of iterations, learning factor, inertia weight, etc. A set of particles is randomly initialized in the search space, each representing a potential gate scheduling solution. Its fitness value, i.e., the value of the objective function, is calculated. The particle's velocity and position are continuously updated through an iterative process. The particle's velocity update is influenced by the individual learning factor, social learning factor, and inertia weight. In each iteration, the fitness value of each particle is evaluated, and the individual and global extreme values are updated accordingly. Based on the individual and global extreme values, the particle's velocity and position are updated to search for a more optimal gate scheduling solution. When the preset number of iterations is reached or other termination conditions are met, the algorithm terminates and outputs the currently found optimal solution. The optimal solution output by the algorithm is analyzed to verify its feasibility and effectiveness in actual irrigation systems.
[0097] S6. Acquire actual irrigation data of the irrigation district to which the optimal gate scheduling scheme is applied, and use the actual irrigation data of the irrigation district as negative feedback to retrain the Transformer model trained in S4.
[0098] Specifically, during the implementation of the optimal gate scheduling plan described in S53, actual irrigation data for the irrigation area is collected and acquired. The actual irrigation data for the irrigation area includes meteorological characteristic data at the time, crop information data, the gate scheduling plan, soil moisture data before scheduling, and soil moisture data after scheduling. Using the process described in S36, the actual irrigation data for the irrigation area is processed into a dataset in the format of x and y. Using the actual irrigation data for the irrigation area as negative feedback, the Transformer model trained in S4 is retrained using the process described in S43.
[0099] It can be seen from the above embodiments that the present application adopts a method of first using the canal network hydrodynamic model to generate a simulation data set to perform rough training on the Transformer model, and then using the actual irrigation data after scheduling to iteratively train the Transformer model. This not only solves the problem of insufficient simulation accuracy of the water delivery model, but also reduces the difficulty of applying the water delivery model in irrigation areas with insufficient informatization construction.
[0100] Corresponding to the aforementioned embodiment of the method for optimizing the control of water supply and distribution in the irrigation canal network, the present application also provides an embodiment of the device for optimizing the control of water supply and distribution in the irrigation canal network.
[0101] Figure 3 This is a block diagram of an irrigation canal network water supply and distribution optimization control device according to an exemplary embodiment. Figure 3 , the device comprises:
[0102] Data acquisition module 1 is used to collect irrigation data of the irrigation area recorded in historical text and irrigation data collected by sensors after the construction of informatization. The irrigation data of the irrigation area includes meteorological characteristics data, crop data, soil moisture data of different soil layers in each irrigation area, and gate scheduling plans for corresponding time periods;
[0103] Model building module 2, used to build a canal network hydrodynamic model;
[0104] a calibration and data generation module 3, configured to calibrate the canal network hydrodynamic model using the irrigation data of the irrigation area, and generate a simulation data set using the calibrated canal network hydrodynamic model;
[0105] Model building and training module 4, used to build a Transformer model and train the Transformer model using the simulation data set;
[0106] Optimization module 5 is used to use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization objective;
[0107] The negative feedback module 6 is used to obtain actual irrigation data of the irrigation area to which the optimal gate scheduling scheme is applied, and use the actual irrigation data of the irrigation area as negative feedback to retrain the Transformer model trained by the model construction and training module.
[0108] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0109] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0110] Accordingly, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned irrigation canal network water supply and distribution optimization control method. Figure 4As shown in the figure, it is a hardware structure diagram of any device with data processing capability where an irrigation canal network water distribution optimization control device provided by an embodiment of the present invention is located. Figure 4 In addition to the processor and memory shown, any device with data processing capabilities in which the apparatus in the embodiment is located may also include other hardware according to the actual functions of the device with data processing capabilities, which will not be described in detail.
[0111] Accordingly, the present application also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the above-mentioned irrigation canal network water supply and distribution optimization control method. The computer-readable storage medium can be an internal storage unit of any device with data processing capabilities described in any of the aforementioned embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of a wind turbine, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium can also include both an internal storage unit and an external storage device of any device with data processing capabilities. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capabilities, and can also be used to temporarily store data that has been output or is to be output.
[0112] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the contents disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed in this application.
[0113] It will be understood that the present application is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.
Claims
1. A method for optimizing water supply and distribution in an irrigation canal network, characterized in that: include: S1: Collect historical irrigation data and data collected by sensors after the informatization construction. The irrigation data includes meteorological characteristics data, crop data, soil moisture data of different layers in each irrigation area, and gate scheduling plans for corresponding time periods; S2: Construct a canal network hydrodynamic model; S3: calibrating the canal network hydrodynamic model using the irrigation data of the irrigation area, and generating a simulation data set using the calibrated canal network hydrodynamic model; S4: Build a Transformer model and train the Transformer model using the simulation dataset; S5: Use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization goal; S6: Acquire actual irrigation data of the irrigation area to which the optimal gate scheduling scheme is applied, and use the actual irrigation data of the irrigation area as negative feedback to retrain the Transformer model trained in S4; The construction of the canal network hydrodynamic model includes: S21: Based on the canal network of the irrigation area, the upstream and downstream relationship of the water diversion gate, and the corresponding relationship between the water diversion gate and each irrigation section, a tree-like relationship network is established. The tree-like relationship network will determine the calculation order of water flow in the canal network hydrodynamic model; S22: Initializing the flow direction, water diversion, and flow ratio parameters after the diversion gate based on the tree-like relationship network and the designed flow ratio of the main canal and branch canals. The parameters will determine the diversion size and flow direction of the water flow in the canal network hydrodynamic model. S23: Initialize the water infiltration parameters and evaporation parameters in the canal network hydrodynamic model based on the relationship between the meteorological characteristic data and water evaporation at the irrigation area, as well as the relationship between the soil moisture conditions and water infiltration at the irrigation area; S24: Construct a canal network hydrodynamic model using the tree relationship network, water flow direction, water diversion conditions, and the flow rate ratio parameters after the diversion gate, infiltration parameters, and evaporation parameters; The method of calibrating the canal network hydrodynamic model using the irrigation data of the irrigation area and generating a simulation data set using the calibrated canal network hydrodynamic model includes: S31: Arrange and format the meteorological characteristic data, crop data, soil moisture data, and gate scheduling plan to form an irrigation data set for the irrigation area, including: Take the model input X at time t t for: X t =[I t ,P t ,T t ,F t ,Cv t ,Ct t ,M 1_(t-1) ,M 2_(t-1) ,......,M c_(t-1) ,O 1_t ,O 2_t ,......,O p_t ], where I t represents the average light intensity at time t, P t represents the rainfall from time t-1 to time t, T t represents the average temperature at time t, F t Indicates the average humidity at time t, Cv t Indicates the crop planting type at time t, Ct t represents the crop growth period at time t, M 0_(t-1) to M c_(t-1) represents the soil moisture condition of the soil layers numbered 1 to c at time t-1, O 0_t to O p_t Indicates the gate opening of gates numbered 1 to p at time t; Take the model expected output Y at time t t for: Y t =[M 0_t ,M 1_t ,......,M c_t] , where t∈[t0,t n ], M0_t to Mc_t represent the actual observed soil moisture conditions of the soil layers numbered 0 to c at time t; S32: Take the total length of the irrigation data set of the irrigation area as n, set the sliding window width as S, and obtain n-(S-1) gate scheduling processes with a scheduling duration of S through the sliding window method to form a calibration data set, where: The model input x is: x=[x0,x1,......,x n-S ], where x t =[X t ,X t+1 ,......,X t+(S-1) ]; The model expects the output y to be: y=[y0,y1,......,y n-S ], where y t =[Y t ,Y t+1 ,......,Y t+(S-1) ]; S33: Use the canal network hydrodynamic model to traverse and calculate the calibration data set to obtain the model calculation output y': y` = [y0`, y1`,......, y n-S `], where y t ` = [Y t `, Y t+1 `,......, Y t+(S-1) `] S34: comparing the difference between the model expected output y and the model calculated output y', and modifying the parameters of the canal network hydrodynamic model according to the difference so that the difference is less than a set threshold; S35: Generate meteorological characteristic data, crop information data, gate operation plan and soil moisture data before operation, and use them as inputs of the canal network hydrodynamic model to calculate the soil moisture data after operation; S36: Based on the meteorological characteristic data, crop information data, gate scheduling plan, soil moisture data before scheduling, and soil moisture data after scheduling generated in S35, S31 and S32 are repeatedly executed to form a simulation data set; Using the trained Transformer model and particle swarm optimization algorithm, combined with optimization objectives, we find the optimal gate scheduling solution, including: S51: Configuration optimization objectives: Minimize canal system water loss, minimize main canal flow fluctuation, minimize irrigation time, and meet soil moisture requirements; S52: The trained Transformer model is responsible for calculating the post-schedule soil moisture data when different gate scheduling schemes are applied while keeping the meteorological characteristic data, crop information data, and pre-schedule soil moisture data unchanged. S53: The particle swarm algorithm is responsible for finding the optimal gate scheduling scheme to meet the optimization goal and obtain the optimal gate scheduling scheme for irrigation in the irrigation area.
2. The method according to claim 1, characterized in that After collecting the irrigation data of the irrigation area recorded in historical text and the irrigation data of the irrigation area collected by sensors after the informatization construction, the method further includes: performing data cleaning and formatting processing on the irrigation data of the irrigation area.
3. The method according to claim 1, characterized in that The meteorological characteristic data include sunlight, rainfall, temperature and humidity, and the crop data include planting type and growth period.
4. The method according to claim 1, wherein Training the Transformer model using the simulation dataset includes: S41: performing data preprocessing on the simulation data set; S42: Build a Transformer model, randomly initialize the weights of each layer, and send the simulation data set to the Transformer model for training; S43: During the training process, a back propagation algorithm is used to update the parameters of each layer in the Transformer model.
5. An irrigation canal network water supply and distribution optimization control device, characterized in that: include: The data acquisition module is used to collect irrigation data recorded in historical text and irrigation data collected by sensors after the construction of informatization. The irrigation data includes meteorological characteristics data, crop data, soil moisture data of different soil layers in each irrigation area, and gate scheduling plans for corresponding time periods; Model building module, used to build canal network hydrodynamic model; a calibration and data generation module, configured to calibrate the canal network hydrodynamic model using the irrigation data of the irrigation area, and generate a simulation data set using the calibrated canal network hydrodynamic model; A model building and training module, used to build a Transformer model and train the Transformer model using the simulation dataset; The optimization module is used to use the trained Transformer model and particle swarm optimization algorithm to find the optimal gate scheduling solution in combination with the optimization objective; A negative feedback module is used to obtain actual irrigation data of the irrigation area to which the optimal gate scheduling scheme is applied, and to use the actual irrigation data of the irrigation area as negative feedback to retrain the Transformer model trained by the model construction and training module; The construction of the canal network hydrodynamic model includes: S21: Based on the canal network of the irrigation area, the upstream and downstream relationship of the water diversion gate, and the corresponding relationship between the water diversion gate and each irrigation section, a tree-like relationship network is established. The tree-like relationship network will determine the calculation order of water flow in the canal network hydrodynamic model; S22: Initializing the flow direction, water diversion, and flow ratio parameters after the diversion gate based on the tree-like relationship network and the designed flow ratio of the main canal and branch canals. The parameters will determine the diversion size and flow direction of the water flow in the canal network hydrodynamic model. S23: Initialize the water infiltration parameters and evaporation parameters in the canal network hydrodynamic model based on the relationship between the meteorological characteristic data and water evaporation at the irrigation area, as well as the relationship between the soil moisture conditions and water infiltration at the irrigation area; S24: Construct a canal network hydrodynamic model using the tree relationship network, water flow direction, water diversion conditions, and the flow rate ratio parameters after the diversion gate, infiltration parameters, and evaporation parameters; The method of calibrating the canal network hydrodynamic model using the irrigation data of the irrigation area and generating a simulation data set using the calibrated canal network hydrodynamic model includes: S31: Arrange and format the meteorological characteristic data, crop data, soil moisture data, and gate scheduling plan to form an irrigation data set for the irrigation area, including: Take the model input X at time t t for: X t =[I t ,P t ,T t ,F t ,Cv t ,Ct t ,M 1_(t-1) ,M 2_(t-1) ,......,M c_(t-1) ,O 1_t ,O 2_t ,......,O p_t ], where I t represents the average light intensity at time t, P t represents the rainfall from time t-1 to time t, T t represents the average temperature at time t, F t Indicates the average humidity at time t, Cv t Indicates the crop planting type at time t, Ct t represents the crop growth period at time t, M 0_(t-1) to M c_(t-1) represents the soil moisture condition of the soil layers numbered 1 to c at time t-1, O 0_t to O p_t Indicates the gate opening of gates numbered 1 to p at time t; Take the model expected output Y at time t t for: Y t =[M 0_t ,M 1_t ,......,M c_t] , where t∈[t0,t n ], M0_t to Mc_t represent the actual observed soil moisture conditions of the soil layers numbered 0 to c at time t; S32: The total length of the irrigation data set of the irrigation area is set to n, and the sliding window width is set to S. n-(S-1) gate scheduling processes with a scheduling duration of S are obtained through the sliding window method to form a calibration data set, where: The model input x is: x=[x0,x1,......,x n-S ], where x t =[X t ,X t+1 ,......,X t+(S-1) ]; The model expects the output y to be: y=[y0,y1,......,y n-S ], where y t =[Y t ,Y t+1 ,......,Y t+(S-1) ]; S33: Use the canal network hydrodynamic model to traverse and calculate the calibration data set to obtain the model calculation output y': y` = [y0`, y1`,......, y n-S `], where y t ` = [Y t `, Y t+1 `,......, Y t+(S-1) `] S34: comparing the difference between the model expected output y and the model calculated output y', and modifying the parameters of the canal network hydrodynamic model according to the difference so that the difference is less than a set threshold; S35: Generate meteorological characteristic data, crop information data, gate operation plan and soil moisture data before operation, and use them as inputs of the canal network hydrodynamic model to calculate the soil moisture data after operation; S36: Based on the meteorological characteristic data, crop information data, gate scheduling plan, soil moisture data before scheduling, and soil moisture data after scheduling generated in S35, S31 and S32 are repeatedly executed to form a simulation data set; Using the trained Transformer model and particle swarm optimization algorithm, combined with optimization objectives, we find the optimal gate scheduling solution, including: S51: Configuration optimization objectives: Minimize canal system water loss, minimize main canal flow fluctuation, minimize irrigation time, and meet soil moisture requirements; S52: The trained Transformer model is responsible for calculating the post-schedule soil moisture data when different gate scheduling schemes are applied while keeping the meteorological characteristic data, crop information data, and pre-schedule soil moisture data unchanged. S53: The particle swarm algorithm is responsible for finding the optimal gate scheduling scheme to meet the optimization goal and obtain the optimal gate scheduling scheme for irrigation in the irrigation area.
6. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Optimized regulation and control method for water transportation and distribution of irrigation district canal network based on hydrodynamic simulation
CN116415526A
Urban water network multi-scale flood control and drainage joint optimization scheduling method and system
CN117236673A