Hydrodynamic model calibration method and system based on improved particle swarm optimization
By improving the particle swarm optimization algorithm and parallel computing framework, the problems of low efficiency and premature convergence in traditional hydrodynamic model parameter calibration methods have been solved, realizing efficient and automated hydrodynamic model parameter calibration and improving the emergency response capability of water conservancy projects.
Patent Information
- Application Number
- CN202511162249.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2025-11-21
AI Technical Summary
Traditional hydrodynamic model parameter calibration methods are inefficient, highly sensitive to dimensionality, and prone to premature convergence, making it difficult to meet the accuracy and efficiency requirements of the explosive growth of multi-source heterogeneous data, especially in responding to sudden water disasters.
An improved particle swarm optimization algorithm is adopted, which initializes the particle swarm through Latin hypercube sampling. Combined with a parallel computing framework, the inertia weight and learning factor are dynamically adjusted to achieve automated parameter parsing and optimization. Combined with multi-source data, it supports high-dimensional parameter calibration.
It improves calibration time efficiency by more than 50%, enhances robustness, adapts to complex scenarios, supports high-dimensional parameter calibration and extreme condition verification, and improves the reliability of water conservancy project decisions.
Smart Images

Figure CN120995876A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model parameter calibration technology, and in particular to a method and system for calibrating hydrodynamic models based on an improved particle swarm optimization algorithm. Background Technology
[0002] Hydrodynamic models, as a core tool in modern hydrological simulation and water conservancy engineering, play an irreplaceable role in flood forecasting, water resource management, and river regulation. With the comprehensive advancement of smart water conservancy construction, especially the introduction of the digital twin watershed concept, higher demands are placed on the accuracy and computational efficiency of hydrodynamic models. In practical engineering applications, the accurate calibration of model parameters is a crucial step in ensuring the reliability of simulation results, and its quality directly affects the decision-making effectiveness of water conservancy projects in planning and design, operation management, and disaster prevention.
[0003] Currently, the water conservancy industry is at a critical stage of digital transformation. Hydrodynamic models, as core tools for digital twin watersheds, flood forecasting, and water resource management, directly impact the reliability of water conservancy project decisions due to their parameter calibration accuracy. With the advancement of smart water conservancy construction, on the one hand, monitoring technologies are rapidly developing, significantly improving the ability to acquire multi-source heterogeneous data (such as remote sensing data, IoT sensor data, and historical disaster data), providing rich data support for model optimization; on the other hand, computing hardware performance is continuously improving, providing a better hardware foundation for the computation of complex models. However, as a bridge connecting data and applications, the development of hydrodynamic model parameter calibration technology has lagged behind, making it difficult to cope with the higher demands for efficiency and accuracy brought about by the explosive growth of multi-source heterogeneous data. This has become a significant bottleneck restricting the improvement of water conservancy informatization. Especially in responding to sudden flood disasters, traditional calibration methods are unable to meet the timeliness requirements of emergency response, a problem that has been particularly prominent in the response to several major floods in recent years.
[0004] Specifically, traditional calibration methods mainly include:
[0005] 1. Improved Monte Carlo methods: such as the stochastic doubling convergence strategy based on water level error feedback proposed by the Three Gorges Group, although it improves the convergence speed of the traditional Monte Carlo method, it still has insufficient computational efficiency for high-dimensional parameter optimization.
[0006] 2. Particle Swarm Optimization (PSO) Application: In coal mine camera parameter optimization, PSO improves accuracy through dynamic inertia weight adjustment, but it does not solve problems such as complex parameter correlations and local convergence in hydrodynamic models. ③ Digital Twin Technology: For example, the Kunming Panlongjiang pilot project achieves forecasting and early warning through hydrological data integration, but it relies on manual experience to set model parameters, resulting in insufficient automated calibration capabilities.
[0007] The aforementioned traditional calibration method has the following technical drawbacks:
[0008] 1. Low efficiency: The manual trial-and-error method relies on expert experience, takes several weeks, and is highly subjective.
[0009] 2. Dimension sensitivity: Algorithms such as gradient descent have an exponentially increasing computational cost under high-dimensional parameters and are prone to getting trapped in local optima.
[0010] 3. Premature convergence: Traditional PSO algorithm is unbalanced between parameter space exploration and convergence speed, and surrogate model method has high requirements for data quality. Summary of the Invention
[0011] The purpose of this invention is to solve at least one technical problem in the background art and to provide a method and system for calibrating hydrodynamic models based on an improved particle swarm optimization algorithm.
[0012] To achieve the above objectives, this invention provides a method for calibrating a hydrodynamic model based on an improved particle swarm optimization algorithm, comprising:
[0013] S1. Obtain the hydrodynamic model file, parse the hydrodynamic model file, and obtain the correspondence between the hydrodynamic model cross-sectional information and the roughness.
[0014] S2. Establish the correspondence between cross sections and actual measurement stations, and define the roughness parameter range and allowable error range for each cross section;
[0015] S3. Initialize the particle swarm based on the range of roughness parameters and calibration parameters of the cross section;
[0016] S4. Based on the matrix number of the particle swarm, the hydrodynamic model is called in parallel to calculate and obtain the simulation result data set;
[0017] S5. Compare the simulation results with the measured results over time and calculate the error value;
[0018] S6. Screen the optimal solution and find the roughness parameter corresponding to the particle with the smallest error;
[0019] S7. Determine whether the calibration optimal solution is within the error range. If yes, proceed directly to step S8. If no, determine whether the calibration optimal solution is within the defined allowable error range. If no, generate a new particle swarm around the calibration parameter range where the current calibration optimal solution is located, and repeat steps S4 and S5 until the calibration optimal solution is within the error range.
[0020] S8. Output the optimal calibration solution, displaying the calibration result and measured result process line as well as the optimal parameters.
[0021] According to one aspect of the present invention, the initialization of the particle swarm based on the roughness parameter range and calibration parameter range of the cross-section comprises: initializing the particle swarm using the Latin hypercube sampling method based on the roughness parameter range and calibration parameter range of the cross-section, including:
[0022] Parameter range definition:
[0023] Based on the roughness parameter range of each cross-section, the allowable range of the roughness parameter for each cross-section is as follows:
[0024] [aj,bj];
[0025] Where: aj is the lower limit of the roughness of the j-th cross section; bj is the upper limit of the roughness of the j-th cross section;
[0026] Subinterval partitioning:
[0027] The roughness range [aj, bj] of each cross section is uniformly divided into N sub-intervals, and the width of each sub-interval is:
[0028]
[0029] Where: N is the number of particles;
[0030] The boundaries of the subintervals are:
[0031] sub_intervals = [a j ,a j +Δ,a j +2Δ,…,b j ];
[0032] Random sampling:
[0033] Within each sub-interval, a value is randomly selected as the roughness parameter of the cross-section. The sampling formula is as follows:
[0034] x ij =Uniform(a j +kΔ,a j +(k+1)Δ);
[0035] Where: x ij Let be the roughness value of the j-th cross section in the i-th particle; k is the index of the sub-interval, k = 0, 1, ..., N-1; Uniform(a,b) is uniform random sampling within the interval [a,b].
[0036] Shuffle the order:
[0037] The sampling results from each cross-section are randomly shuffled and assigned to N particles, i.e.:
[0038] Shuffle([x 1j ,x 2j ,…,x Nj ]);
[0039] Particle position vector:
[0040] By combining the sampling results from all cross-sections, a position vector representing the roughness parameter of each particle is formed:
[0041] x i =[x i1 ,x i2 ,…,x im ];
[0042] Where: x i Let be the position vector of the i-th particle; m is the number of cross-sections;
[0043] The final generated particle swarm matrix is: Particles = [x1, x2, ..., x N ] T Its dimensions are: N×m.
[0044] According to one aspect of the present invention, the step of parallel invocation of the hydrodynamic model based on the matrix number of the particle swarm to obtain a simulation result data set includes:
[0045] Input the particle swarm matrix;
[0046] Define a task function f(x) i ), used based on the particle position vector x i Call the hydrodynamic model and return the simulation results;
[0047] The mathematical expression of the function is:
[0048] f(x i = execute_model(x i );
[0049] Where: execute_model(x i This function calls the hydrodynamic model and runs the simulation, outputting the simulation results.
[0050] Perform parallel computing:
[0051] All particles are processed in parallel using a parallel computing framework:
[0052] Divide N particles into multiple task groups, each task group containing several particles, and execute them in parallel using the following formula:
[0053]
[0054] Where: P is the number of parallel tasks; TaskGroup k Let be the set of particles in the k-th task group; ∪ represents the merging operation of results;
[0055] The results are stored in memory:
[0056] Collect the simulation results of all particles and store the results in memory in the form of a data structure;
[0057] The results are stored as a list or array:
[0058] Results = [R1, R2, ..., R N ];
[0059] Where: R i This represents the simulation result for the i-th particle; Results represents the set of simulation results for all particles.
[0060] Result indexing and association:
[0061] The simulation result of each particle and its corresponding particle position vector x i There is a clear index association;
[0062] Associations are represented by index particle i:
[0063] According to one aspect of the present invention, the step of comparing the simulation results with the measured results over a time series and calculating the error value includes:
[0064] Input simulation results and measured results;
[0065] The root mean square error is used as the error metric.
[0066]
[0067] Among them: RMSE i The r represents the error value of the i-th particle, where i = 1, 2, ..., N; it Let y be the simulated value of the i-th particle at time step t; t Let be the measured value at time step t; T is the total length of the time series.
[0068] Storage error value:
[0069] Store the error value of each particle as a set:
[0070] Errors=[RMSE1,RMSE2,…,RMSE N ].
[0071] According to one aspect of the present invention, the screening rate determination of the optimal solution, finding the roughness parameter corresponding to the particle record with the minimum error, includes:
[0072] The particle with the smallest error is selected from all particles, and its corresponding roughness parameter is recorded.
[0073] The particle index with the smallest error is found using the following formula:
[0074] i best =arg minRMSE i ;
[0075] Where: i best argmin represents the particle index with the smallest error; argmin indicates taking the variable value that minimizes the objective function.
[0076] To achieve the above objectives, the present invention also provides a hydrodynamic model calibration system based on an improved particle swarm optimization algorithm, comprising:
[0077] The cross-sectional roughness relationship acquisition module acquires the hydrodynamic model file, parses the hydrodynamic model file, and obtains the correspondence between the cross-sectional information and roughness of the hydrodynamic model.
[0078] The roughness calibration parameter range setting module establishes the correspondence between the cross section and the actual measurement station, and defines the roughness parameter range and allowable error range for each cross section.
[0079] The particle swarm initialization module initializes the particle swarm based on the range of roughness parameters and calibration parameters of the cross section.
[0080] The simulation results acquisition module calls the hydrodynamic model in parallel to calculate based on the number of matrices in the particle swarm, and obtains a set of simulation results data.
[0081] The error calculation module compares the simulation results with the measured results over a time series and calculates the error value.
[0082] The calibration optimal solution screening module filters the calibration optimal solution and finds the roughness parameter corresponding to the particle record with the smallest error.
[0083] The optimal solution error range determination module determines whether the calibration optimal solution is within the error range. If yes, the result output module is executed directly. If no, it determines whether the calibration optimal solution is within the defined allowable error range. If no, a new particle swarm is generated around the calibration parameter range where the current calibration optimal solution is located, and the simulation result acquisition module and error calculation module are executed repeatedly until the calibration optimal solution is within the error range.
[0084] The results output module outputs the optimal calibration solution, displays the calibration results and measured results process line, and the optimal parameters.
[0085] To achieve the above objectives, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described above.
[0086] To achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described above.
[0087] According to the solution of the present invention, the present invention can achieve the following beneficial effects:
[0088] Improve efficiency: By automating parameter parsing and improving the PSO algorithm, calibration time can be reduced by more than 50%.
[0089] Enhance robustness: Dynamically adjust inertia weights and learning factors to balance global search and local optimization, and avoid premature convergence.
[0090] Adaptable to complex scenarios: Combining multi-source data with parallel computing, it supports high-dimensional parameter calibration and extreme condition verification. Attached Figure Description
[0091] Figure 1 The flowchart schematically illustrates a hydrodynamic model calibration method based on an improved particle swarm optimization algorithm according to an embodiment of the present invention. Detailed Implementation
[0092] The invention will now be discussed with reference to exemplary embodiments. It should be understood that the described embodiments are merely intended to enable those skilled in the art to better understand and thus implement the invention, and are not intended to imply any limitation on the scope of the invention.
[0093] As used herein, the term "comprising" and its variations are to be interpreted as open-ended terms meaning "including but not limited to". The term "based on" is to be interpreted as "at least partially based on". The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment".
[0094] Figure 1 The flowchart schematically illustrates a hydrodynamic model calibration method based on an improved particle swarm optimization algorithm according to an embodiment of the present invention. Figure 1 As shown, in this embodiment, the hydrodynamic model calibration method based on the improved particle swarm optimization algorithm includes:
[0095] S1. Obtain the hydrodynamic model file, parse the hydrodynamic model file, and obtain the correspondence between the hydrodynamic model cross-sectional information and the roughness.
[0096] S2. Establish the correspondence between cross sections and actual measurement stations, and define the roughness parameter range and allowable error range for each cross section;
[0097] S3. Initialize the particle swarm based on the range of roughness parameters and calibration parameters (i.e., the range of roughness of the cross section);
[0098] S4. Based on the matrix number of the particle swarm, the hydrodynamic model is called in parallel to calculate and obtain the simulation result data set;
[0099] S5. Compare the simulation results with the measured results over time and calculate the error value;
[0100] S6. Screen the optimal solution and find the roughness parameter corresponding to the particle with the smallest error;
[0101] S7. Determine whether the calibration optimal solution is within the error range (the error range of the water conservancy industry forecast). If yes, proceed directly to step S8. If no, determine whether the calibration optimal solution is within the defined allowable error range. If no, generate a new particle swarm around the calibration parameter range where the current calibration optimal solution is located, and repeat steps S4 and S5 until the calibration optimal solution is within the error range.
[0102] S8. Output the optimal calibration solution, displaying the calibration result and measured result process line as well as the optimal parameters.
[0103] Furthermore, in step S1 above, the hydrodynamic model file is an INP file;
[0104] Parsing hydrodynamic model files includes:
[0105] The template definition is used to parse the file and define the parameter areas in the INP file, such as [OPTIONS] and [JUNCTIONS].
[0106] Record the physical meaning, data type, position characteristics (line number or delimiter pattern), unit, and default value of each parameter;
[0107] Efficient algorithms such as binary search are used to quickly locate the target parameter region, and the parameters are parsed line by line according to the template;
[0108] For fixed-width fields, slicing techniques are used for extraction; for free-format fields, regular expressions are applied for parameter matching.
[0109] Parameter matching:
[0110] The parameter matching formula described above extracts parameters of a specific type from multi-line text data. Specifically, it uses regular expression matching (RegExMatch) to match parameters in each line of text. k Search for the pattern (P) corresponding to the i-th type of parameter. i ), and merge all matching results into a single set (Param). i), applicable to all parameter types from 1 to n. Where Param i Represents the set of the i-th parameter; Represents the union operation from k=1 to K; RegExMatch represents the regular expression matching function; line k P represents the text content of the k-th line; i This represents the regular expression used to match the i-th type of parameter; This represents the index of all parameter i of type; {1,...,n} represents the set of integers from 1 to n.
[0111] Furthermore, in this embodiment, a hash table is used to store the mapping relationship between the hydrodynamic model cross-sectional information and the roughness. Using a hash table for storage is also applicable within the allowable error range.
[0112] Relational storage model: R = (P j ,R j )∣P j ∈R d1 ,R j ∈R d2 .
[0113] In the formula, P j For cross-sectional encoding (key), R j Let R represent the relational storage model, where R is the roughness value (the value corresponding to the key). d1 Let P represent a d1-dimensional real space, where P j R is a vector belonging to this space; d2 Let R denote a d²-dimensional real space, where R is a finite number space. j It is a vector belonging to this space.
[0114] In this embodiment, a hash table is used as the underlying data structure to store and manage relation pairs (Pj, Rj), achieving the effect of relational storage model storage.
[0115] Further, according to one embodiment of the present invention, in the above-described S3 step, initializing the particle swarm based on the roughness parameter range and calibration parameter range of the cross-section is as follows: initializing the particle swarm using the Latin hypercube sampling method based on the roughness parameter range and calibration parameter range of the cross-section includes:
[0116] Parameter range definition:
[0117] Based on the roughness parameter range of each cross section, the allowable range of its roughness parameter for each cross section j is as follows:
[0118] [aj,bj];
[0119] Where: aj is the lower limit of the roughness of the j-th cross section; bj is the upper limit of the roughness of the j-th cross section;
[0120] Subinterval partitioning:
[0121] The roughness range [aj, bj] of each cross section is uniformly divided into N sub-intervals, and the width of each sub-interval is:
[0122]
[0123] Where: N is the number of particles (particle swarm size);
[0124] The boundaries of the subintervals are:
[0125] sub_intervals = [a j ,a j +Δ,a j +2Δ,…,b j ];
[0126] Random sampling:
[0127] Within each sub-interval, a value is randomly selected as the roughness parameter of the cross-section. The sampling formula is as follows:
[0128] x ij =Uniform(a j +kΔ,a j +(k+1)Δ);
[0129] Where: x ij Let be the roughness value of the j-th cross section in the i-th particle; k is the index of the sub-interval, k = 0, 1, ..., N-1; Uniform(a,b) is uniform random sampling within the interval [a,b].
[0130] Shuffle the order:
[0131] The sampling results from each cross-section are randomly shuffled and assigned to N particles, i.e.:
[0132] Shuffle([x 1j ,x 2j ,…,x Nj ]);
[0133] Particle position vector:
[0134] By combining the sampling results from all cross-sections, a position vector representing the roughness parameter of each particle is formed:
[0135] x i =[x i1 ,x i2 ,…,x im ];
[0136] Where: x i Let be the position vector of the i-th particle (a set of roughness parameters); m is the number of cross sections;
[0137] The final generated particle swarm matrix is: Particles = [x1, x2, ..., x N ] T Its dimensions are: N×m.
[0138] Furthermore, according to one embodiment of the present invention, in step S4 above, the hydrodynamic model is called in parallel according to the matrix number of the particle swarm to obtain a simulation result data set, including:
[0139] Input particle swarm matrix Particles = [x1, x2, ..., x N ] T The number of particles is N, and each particle corresponds to a position vector (a set of roughness parameters);
[0140] Define a task function f(x) i ), used based on the particle position vector x i Call the hydrodynamic model and return the simulation results;
[0141] The mathematical expression of the function is:
[0142] f(x i = execute_model(x i );
[0143] Where: execute_model(x i This function calls the hydrodynamic model and runs the simulation, outputting the simulation results.
[0144] Perform parallel computing:
[0145] All particles are processed in parallel using a parallel computing framework:
[0146] Divide the N particles into multiple task groups, each task group containing a number of particles. The parallel execution formula is as follows:
[0147]
[0148] Where: P is the number of parallel tasks; TaskGroup k Let be the set of particles in the k-th task group; ∪ represents the merging operation of results;
[0149] The results are stored in memory:
[0150] Collect the simulation results of all particles and store the results in memory in the form of a data structure;
[0151] The results are stored as a list or array:
[0152] Results = [R1, R2, ..., R N ];
[0153] Where: R i This represents the simulation result for the i-th particle; Results represents the set of simulation results for all particles.
[0154] Result indexing and association:
[0155] The simulation result of each particle and its corresponding particle position vector x i There is a clear index association;
[0156] Associations are represented by index particle i:
[0157] Furthermore, according to one embodiment of the present invention, in step S5 above, the simulation results are compared with the measured results over time, and the error value is calculated, including:
[0158] Input simulation result R i =[r i1 ,r i2 ,…,r it ] and the measured result Y=[y1,y2,…,y t ];
[0159] The root mean square error is used as the error metric.
[0160]
[0161] Among them: RMSE i The r represents the error value of the i-th particle, where i = 1, 2, ..., N; it Let y be the simulated value of the i-th particle at time step t; t Let be the measured value at time step t; T is the total length of the time series.
[0162] Of course, other alternative error measurement methods can also be used:
[0163] Mean Absolute Error (MAE):
[0164] Normalized root mean square error (NRMSE):
[0165] Storage error value:
[0166] Store the error value of each particle as a set:
[0167] Errors=[RMSE1,RMSE2,…,RMSE N ].
[0168] Furthermore, according to one embodiment of the present invention, in the above-described S6 step, screening and calibrating the optimal solution to find the roughness parameter corresponding to the particle record with the minimum error includes:
[0169] The particle with the smallest error is selected from all particles, and its corresponding roughness parameter is recorded.
[0170] The particle index with the smallest error is found using the following formula:
[0171] i best =arg minRMSE i ;
[0172] Where: i best argmin represents the particle index with the smallest error; argmin indicates taking the variable value that minimizes the objective function.
[0173] According to the above-described scheme of the present invention, the hydrodynamic model calibration method based on the improved particle swarm optimization (PSO) proposed in this invention designs a range scaling particle swarm optimization strategy guided by the optimal solution, and combines result matching technology to realize intelligent search of the parameter space.
[0174] This invention develops an intelligent parsing method for INP files of hydrodynamic models, employing regular expression matching and other methods to automate parameter extraction and correlation analysis. This method, through an integrated workflow of "model parsing - optimization calculation - verification output," reduces traditional calibration time by more than 50%.
[0175] This invention designs a dynamic weighting and feedback mechanism: combining water level error feedback to dynamically adjust PSO parameters, thereby solving the premature convergence problem of traditional algorithms.
[0176] The intelligent parsing engine of this invention is based on INP file parsing technology with multi-level syntax analysis, and supports mainstream models such as SWMM and HEC-RAS.
[0177] This invention designs a parallel optimization architecture: a distributed computing framework to achieve calibrate 100-dimensional parameters, reducing the traditional calibration time by more than 50%.
[0178] Furthermore, traditional manual calibration methods suffer from problems such as operational complexity, low efficiency, and high human resource consumption. Taking the Zhangwei River basin as an example, 16 sections of one-dimensional hydrodynamic models required four professionals to spend eight hours manually adjusting parameters and comparing results segment by segment. This was not only labor-intensive but also susceptible to inconsistencies due to human factors. In contrast, the calibration method of this invention, through intelligent model file parsing, parallel computing, and optimization algorithms, can complete the calibration of the entire basin in just two hours, and can be operated by a single person, significantly improving efficiency and accuracy.
[0179] This invention demonstrates significant advantages in terms of time, economy, and quality: efficiency is increased by approximately four times, labor costs are significantly reduced, and the accuracy and consistency of results are ensured through global optimization and visual analysis. This not only shortens project cycles but also provides more reliable technical support for emergency response and scientific decision-making, powerfully promoting the digital transformation of the water conservancy industry.
[0180] Furthermore, to achieve the above objectives, the present invention also provides a hydrodynamic model calibration system based on an improved particle swarm optimization algorithm, comprising:
[0181] The cross-sectional roughness relationship acquisition module acquires the hydrodynamic model file, parses the hydrodynamic model file, and obtains the correspondence between the cross-sectional information and roughness of the hydrodynamic model.
[0182] The roughness calibration parameter range setting module establishes the correspondence between the cross section and the actual measurement station, and defines the roughness parameter range and allowable error range for each cross section.
[0183] The particle swarm initialization module initializes the particle swarm based on the range of roughness parameters and calibration parameters of the cross section.
[0184] The simulation results acquisition module calls the hydrodynamic model in parallel to calculate based on the number of matrices in the particle swarm, and obtains a set of simulation results data.
[0185] The error calculation module compares the simulation results with the measured results over a time series and calculates the error value.
[0186] The calibration optimal solution screening module filters the calibration optimal solution and finds the roughness parameter corresponding to the particle record with the smallest error.
[0187] The optimal solution error range determination module determines whether the calibration optimal solution is within the error range. If yes, the result output module is executed directly. If no, it determines whether the calibration optimal solution is within the defined allowable error range. If no, a new particle swarm is generated around the calibration parameter range where the current calibration optimal solution is located, and the simulation result acquisition module and error calculation module are executed repeatedly until the calibration optimal solution is within the error range.
[0188] The results output module outputs the optimal calibration solution, displays the calibration results and measured results process line, and the optimal parameters.
[0189] The hydrodynamic model calibration system based on the improved particle swarm optimization algorithm of the present invention can realize the hydrodynamic model calibration method based on the improved particle swarm optimization algorithm. The specific process steps are as described above and will not be repeated here.
[0190] Furthermore, to achieve the above objectives, the present invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described above.
[0191] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described above.
[0192] Those skilled in the art will recognize that the modules and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0193] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and equipment can be referred to the corresponding process in the foregoing method implementation, and will not be repeated here.
[0194] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0195] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0196] In addition, the functional modules in the embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0197] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the sending / receiving methods of various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0198] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this application.
[0199] It should be understood that the sequence number of each step in the invention and its embodiments does not absolutely imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Claims
1. A method for calibrating hydrodynamic models based on an improved particle swarm optimization algorithm, characterized in that: include: S1. Obtain the hydrodynamic model file, parse the hydrodynamic model file, and obtain the correspondence between the hydrodynamic model cross-sectional information and the roughness. S2. Establish the correspondence between cross sections and actual measurement stations, and define the roughness parameter range and allowable error range for each cross section; S3. Initialize the particle swarm based on the range of roughness parameters and calibration parameters of the cross section; S4. Based on the matrix number of the particle swarm, the hydrodynamic model is called in parallel to calculate and obtain the simulation result data set; S5. Compare the simulation results with the measured results over time and calculate the error value; S6. Screen the optimal solution and find the roughness parameter corresponding to the particle with the smallest error; S7. Determine whether the calibration optimal solution is within the error range. If yes, proceed directly to step S8. If no, determine whether the calibration optimal solution is within the defined allowable error range. If no, generate a new particle swarm around the calibration parameter range where the current calibration optimal solution is located, and repeat steps S4 and S5 until the calibration optimal solution is within the error range. S8. Output the optimal calibration solution, displaying the calibration result and measured result process line as well as the optimal parameters.
2. The hydrodynamic model calibration method based on the improved particle swarm optimization algorithm according to claim 1, characterized in that, The initialization of the particle swarm based on the roughness parameter range and calibration parameter range of the cross-section is as follows: The particle swarm is initialized using the Latin hypercube sampling method based on the roughness parameter range and calibration parameter range of the cross-section, including: Parameter range definition: Based on the roughness parameter range of each cross-section, the allowable range of the roughness parameter for each cross-section is as follows: [aj,bj]; Where: aj is the lower limit of the roughness of the j-th cross section; bj is the upper limit of the roughness of the j-th cross section; Subinterval partitioning: The roughness range [aj, bj] of each cross section is uniformly divided into N sub-intervals, and the width of each sub-interval is: Where: N is the number of particles; The boundaries of the subintervals are: sub_intervals=[a j ,a j +Δ,a j +2Δ,…,b j ]; Random sampling: Within each sub-interval, a value is randomly selected as the roughness parameter of the cross-section. The sampling formula is as follows: x ij =Uniform(a j +kΔ,a j +(k+1)Δ); Where: x ij Let be the roughness value of the j-th cross section in the i-th particle; k is the index of the sub-interval, k = 0, 1, ..., N-1; Uniform(a,b) is uniform random sampling within the interval [a,b]. Shuffle the order: The sampling results from each cross-section are randomly shuffled and assigned to N particles, i.e.: Shuffle([x 1j ,x 2j ,…,x Nj ]); Particle position vector: By combining the sampling results from all cross-sections, a position vector representing the roughness parameter of each particle is formed: x i =[x i1 ,x i2 ,…,x im ]; Where: x i Let be the position vector of the i-th particle; m is the number of cross-sections; The final generated particle swarm matrix is: Particles = [x1, x2, ..., x N ] T Its dimensions are: N×m.
3. The hydrodynamic model calibration method based on the improved particle swarm optimization algorithm according to claim 2, characterized in that, The simulation results dataset is obtained by parallel invoking the hydrodynamic model based on the particle swarm matrix number, including: Input the particle swarm matrix; Define a task function f(x) i ), used based on the particle position vector x i Call the hydrodynamic model and return the simulation results; The mathematical expression of the function is: f(x i )=execute_model(x i ); Where: execute_model(x i This function calls the hydrodynamic model and runs the simulation, outputting the simulation results. Perform parallel computing: All particles are processed in parallel using a parallel computing framework: Divide N particles into multiple task groups, each task group containing several particles, and execute them in parallel using the following formula: Where: P is the number of parallel tasks; TaskGroup k Let be the set of particles in the k-th task group; ∪ represents the merging operation of results; The results are stored in memory: Collect the simulation results of all particles and store the results in memory in the form of a data structure; The results are stored as a list or array: Results=[R1,R2,…,R N ]; Where: R i The result is the simulation result for the i-th particle; Results represents the set of simulation results for all particles. Result indexing and association: The simulation result of each particle and its corresponding particle position vector x i There is a clear index association; Associations are represented by index particle i:
4. The hydrodynamic model calibration method based on the improved particle swarm optimization algorithm according to claim 3, characterized in that, The step of comparing the simulation results with the measured results over time and calculating the error value includes: Input simulation results and measured results; The error between the simulation results and the measured results is calculated, and the root mean square error is used as the error metric. Among them: RMSE i The r represents the error value of the i-th particle, where i = 1, 2, ..., N; it Let y be the simulated value of the i-th particle at time step t; t Let be the measured value at time step t; T is the total length of the time series. Storage error value: Store the error value of each particle as a set: Errors=[RMSE1,RMSE2,…,RMSE N ]。 5. The hydrodynamic model calibration method based on the improved particle swarm optimization algorithm according to claim 4, characterized in that, The screening and calibration of the optimal solution finds the roughness parameters corresponding to the particle record with the minimum error, including: The particle with the smallest error is selected from all particles, and its corresponding roughness parameter is recorded. The particle index with the smallest error is found using the following formula: i best =arg minRMSE i ; Where: i best arg min represents the index of the particle with the smallest error, indicating the value of the variable that minimizes the objective function.
6. A hydrodynamic model calibration system based on an improved particle swarm optimization algorithm, characterized in that, include: The cross-sectional roughness relationship acquisition module acquires the hydrodynamic model file, parses the hydrodynamic model file, and obtains the correspondence between the cross-sectional information and roughness of the hydrodynamic model. The roughness calibration parameter range setting module establishes the correspondence between the cross section and the actual measurement station, and defines the roughness parameter range and allowable error range for each cross section. The particle swarm initialization module initializes the particle swarm based on the range of roughness parameters and calibration parameters of the cross section. The simulation results acquisition module calls the hydrodynamic model in parallel to calculate based on the number of matrices in the particle swarm, and obtains a set of simulation results data. The error calculation module compares the simulation results with the measured results over a time series and calculates the error value. The calibration optimal solution screening module filters the calibration optimal solution and finds the roughness parameter corresponding to the particle record with the smallest error. The optimal solution error range determination module determines whether the calibration optimal solution is within the error range. If yes, the result output module is executed directly. If no, it determines whether the calibration optimal solution is within the defined allowable error range. If no, a new particle swarm is generated around the calibration parameter range where the current calibration optimal solution is located, and the simulation result acquisition module and error calculation module are executed repeatedly until the calibration optimal solution is within the error range. The results output module outputs the optimal calibration solution, displays the calibration results and measured results process line, and the optimal parameters.
7. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the hydrodynamic model calibration method based on the improved particle swarm algorithm as described in any one of claims 1-5.
Citation Information
Cited By
Roughness factor joint calibration method and device, electronic equipment and storage medium
CN122047104A
A roughness joint calibration method and device, electronic equipment and storage medium
CN122047104B