Real-time calculation and visualization method and device for SWMM model
By building a sensor network object model and registering it with a sensor network data server, combining the SWMM model to realize real-time input of sensor data and real-time output of calculation results, the problem of difficulty in decoding and real-time visualization of the output results of the SWMM model is solved, and the calculation process and visualization display method of the model are optimized.
Patent Information
- Application Number
- CN202411988491.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The output results of the SWMM model are proprietary binary data and require specialized software to decode, which has an impact on the display and visualization of real-time results.
By building a sensor network object model and registering it with the sensor network data server, combining the first rainstorm and flood management model and the sensor network object model, the second rainstorm and flood management model is built to realize the real-time input of sensor data and the real-time output of calculation results, and query the calculation results from the sensor network data server through standard access methods for visual display.
It solves the problem that the output results of SWMM models are difficult to decode and visualize in real time, and realizes cloud-based or remote computing based on sensor network data, greatly optimizing the model's calculation process and visual display method of results.
Smart Images

Figure CN119903487A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of environmental models, and in particular to a method and device for real-time calculation and visualization of a SWMM model. Background Art
[0002] The Storm Water Management Model (SWMM) is an open source and one of the most commonly used hydrological models. It is widely used in urban precipitation and flood prediction, design and planning of hydrological facilities and other fields.
[0003] With the rapid development of computer networks and the increasing popularity of cloud services, the simulation and operation methods of the traditional SWMM hydrological model have exposed several shortcomings: lack of good interoperability. The SWMM model is designed for desktop simulation and calculation, and it is difficult to run directly as an online service, which brings great difficulties to data sharing; it is impossible to achieve real-time calculation and simulation. When using the SWMM model for simulation operations, the user must input all sensor data, run the model and output the results at one time. Sensor data has a strong timeliness, which makes it difficult for the SWMM model to directly connect to the sensor network for real-time data stream input and calculation; the output results of the SWMM model are proprietary binary data, which requires special software to decode, which affects the display and visualization of real-time results.
[0004] Therefore, there is an urgent need for a real-time calculation and visualization method and device for the SWMM model. Summary of the invention
[0005] The present application provides a SWMM model real-time calculation and visualization method and device, which solves the problem that the output results of the SWMM model are proprietary binary data and require special software to decode, which affects the display and visualization of real-time results.
[0006] In a first aspect of the present application, a real-time calculation and visualization method for a SWMM model is provided, the method comprising: constructing a first storm and flood management model, abstractly classifying and object-oriented modeling a plurality of element objects in the first storm and flood management model, the abstract classification being used to construct a first correspondence between a plurality of element objects and a plurality of element types, and the object-oriented modeling being used to construct a second correspondence between a plurality of element objects and a plurality of attribute types, wherein one element object corresponds to one or more element types, and one element object corresponds to one attribute type; constructing a sensor network object model according to the first correspondence and the second correspondence, and registering the sensor network object model to a sensor network data server; constructing a second storm and flood management model by combining the first storm and flood management model with the sensor network object model; inputting sensor data into the second storm and flood management model, and outputting calculation results according to the second storm and flood management model, the sensor data comprising precipitation data, watershed wetness data, and air direction data; querying the calculation results from the sensor network data server through a standard access method, and visually displaying the calculation results.
[0007] Optionally, the multiple feature objects include a rain gauge object, a sub-catchment area object, a connection object, a node object, and a calculation attribute object, and a first correspondence relationship between the multiple feature objects and the multiple feature types is constructed, specifically including: classifying the multiple feature types according to the feature characteristics of the multiple feature objects, obtaining the sensor type corresponding to the rain gauge object in the multiple feature types, the watershed type corresponding to the sub-catchment area object in the multiple feature types, the hydrological facility type corresponding to the connection object in the multiple feature types, the hydrological facility type corresponding to the node object in the multiple feature types, the data stream type corresponding to the calculation attribute object in the multiple feature types, and the multiple feature types. The calculated attribute object corresponds to the observed attribute type; constructs the first sub-correspondence between the rain gauge object and the sensor type, constructs the second sub-correspondence between the sub-catchment area object and the watershed type, constructs the third sub-correspondence between the connection object and the hydrological facility type, constructs the fourth sub-correspondence between the node object and the hydrological facility type, constructs the fifth sub-correspondence between the calculated attribute object and the data stream type, and constructs the sixth sub-correspondence between the calculated attribute object and the observed attribute type, wherein the first correspondence includes the first sub-correspondence, the second sub-correspondence, the third sub-correspondence, the fourth sub-correspondence, the fifth sub-correspondence and the sixth sub-correspondence.
[0008] Optionally, a second correspondence between multiple feature objects and multiple attribute types is constructed, specifically including: obtaining feature attributes corresponding to the target feature object, the target feature object is any one of the multiple feature objects, and the feature attributes are any one of static attributes and dynamic attributes; static attributes include hydrological facility name attributes and pipeline length attributes, and dynamic attributes include surface runoff attributes and precipitation attributes; if it is confirmed that the feature attribute is a static attribute, constructing a seventh sub-correspondence between the target feature object and the inherent attribute type, conversely, if it is confirmed that the feature attribute is a dynamic attribute, constructing an eighth sub-correspondence between the target feature object and the calculated attribute type, wherein the second correspondence includes the seventh sub-correspondence and the eighth sub-correspondence.
[0009] Optionally, constructing a sensor network object model specifically includes: constructing a target random forest model, and dynamically mapping and converting multiple feature objects to map the target random forest model to a corresponding sensor network object model; dynamically mapping and converting multiple feature objects specifically includes: constructing a third correspondence between multiple feature objects and multiple sensor network objects, one element object corresponds to one or more sensor network objects, and dynamically mapping and converting according to the third correspondence, wherein; the sensor network object includes a sensor object, a feature object of interest, a thing object, an observation attribute object, and a data stream object, and the third correspondence includes a correspondence between a rain gauge object and a sensor network object, a correspondence between a sub-catchment area and a feature object of interest, a correspondence between a sub-catchment area and a thing object, a correspondence between a connection object and a thing object, a correspondence between a node object and a thing object, a correspondence between a calculation attribute object and an observation attribute object, and a correspondence between a calculation attribute object and a data stream object.
[0010] Optionally, constructing a target random forest model specifically includes: taking feature objects, feature types, attribute types, first corresponding relationships, and second corresponding relationships as model training parameters, and adjusting the model training parameters according to a grid search method until preset conditions are met; and constructing a target random forest model using the model training parameters that meet the preset conditions.
[0011] Optionally, registering the sensor network object model with the sensor network data server specifically includes: obtaining a first identity corresponding to a first sensor network object model, where the first sensor network object model is any model in the sensor network object model; determining whether the first identity exists in the sensor network data server; if the first identity exists in the sensor network data server, confirming that the first sensor network object model is a registered object, and obtaining a second identity corresponding to a second sensor network object model, where the second sensor network object model is a model in the sensor network object model other than the first sensor network object model; determining whether the second identity exists in the sensor network data server; if the second identity does not exist in the sensor network data server, confirming that the second sensor network object model is an unregistered object, and registering the second sensor network object model with the sensor network data server according to a preset process.
[0012] Optionally, the calculation results are queried from the sensor network data server through a standard access method and the calculation results are visualized, specifically including: querying the calculation results from the sensor network data server through a hypertext transfer protocol / message queue telemetry transmission protocol and visually displaying the calculation results.
[0013] In a second aspect of the present application, a SWMM model real-time calculation and visualization device is provided, the device comprising a call module, a mapping module and a calculation and visualization module, wherein:
[0014] A calling module is installed to construct a first rainstorm flood management model, and to perform abstract classification and object-oriented modeling on multiple feature objects in the first rainstorm flood management model. The abstract classification is used to construct a first corresponding relationship between multiple feature objects and multiple feature types, and the object-oriented modeling is used to construct a second corresponding relationship between multiple feature objects and multiple attribute types, wherein one feature object corresponds to one or more feature types, and one feature object corresponds to one attribute type.
[0015] The mapping module is used to construct a sensor network object model according to the first corresponding relationship and the second corresponding relationship, and register the sensor network object model to the sensor network data server; and construct a second rainstorm flood management model by combining the first rainstorm flood management model and the sensor network object model.
[0016] The calculation and visualization module is used to input sensor data into the second rainstorm flood management model and output calculation results according to the second rainstorm flood management model. The sensor data includes precipitation data, watershed humidity data and air direction data; the calculation results are queried from the sensor network data server through standard access methods and the calculation results are visualized.
[0017] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0018] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to perform any of the above methods.
[0019] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0020] 1. Through abstract classification and object-oriented modeling, the mapping relationship between sensor data and each element object in the storm and flood management model is constructed, so that the sensor data can effectively drive the operation of the storm and flood management model, thus solving the problem that the SWMM model depends on real-time sensor data; and through the construction and registration of the sensor network object model, it breaks the limitation that the traditional SWMM model can only run on desktop computers. Combined with sensor data input and calculation result output, it supports cloud or remote computing based on sensor network data, greatly optimizing the model's calculation process and result visualization display method.
[0021] 2. The feature object, feature type, attribute type, first correspondence and second correspondence are used as model training parameters, and the model training parameters are adjusted according to the grid search method until the preset conditions are met. That is, the model with the minimum error is selected and serialized and saved, thereby constructing the target random forest model through the model training parameters that meet the preset conditions, greatly improving the accuracy of the model.
[0022] 3. Through the Hypertext Transfer Protocol / Message Queue Telemetry Transmission Protocol, the calculation results are queried from the sensor network data server and visualized, which significantly improves the real-time performance and user interaction experience of the storm flood management model. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a flow chart of a real-time calculation and visualization method of a SWMM model provided in an embodiment of the present application;
[0024] Figure 2 It is a UML class diagram for object-oriented modeling and expression of element objects of a SWMM model provided by an embodiment of the present application;
[0025] Figure 3 It is a UML activity diagram of an initialization process of factor object conversion and registration provided by an embodiment of the present application;
[0026] Figure 4 It is a UML activity diagram of a visualized process provided in an embodiment of the present application;
[0027] Figure 5 It is a module schematic diagram of a SWMM model real-time calculation and visualization device provided in an embodiment of the present application;
[0028] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0029] Explanation of the reference numerals: 51, calling module; 52, mapping module; 53, calculation and visualization module; 601, processor; 602, communication bus; 603, user interface; 604, network interface; 605, memory. DETAILED DESCRIPTION
[0030] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0031] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0032] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0033] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings.
[0034] Please refer to Figure 1 , which shows a flow chart of a real-time calculation and visualization method of a SWMM model provided in an embodiment of the present application, and the flow chart mainly includes the following steps: S101 to S105.
[0035] Step S101, constructing a first storm flood management model, performing abstract classification and object-oriented modeling on multiple element objects in the first storm flood management model, wherein the abstract classification is used to construct a first corresponding relationship between multiple element objects and multiple element types.
[0036] Specifically, a first storm water management model (SWMM) is constructed, hereinafter referred to as the SWMM model. Multiple element objects used to construct the first SWMM model are obtained, and multiple element objects in the first storm water management model are abstractly classified and object-oriented modeling is performed. Among them, the abstract classification is used to construct a first correspondence between multiple element objects and multiple element types, and the object-oriented modeling is used to construct a second correspondence between multiple element objects and multiple attribute types. The multiple element objects are different facilities of the hydrological system, including but not limited to rain gauges, sub-catchment areas, pipelines, nodes, pumping stations, outlets, regulating pools, etc. These element objects play different roles in the model and represent different hydrological facilities and areas. By abstractly classifying these objects, they can be divided into multiple categories such as sensor type, watershed type, hydrological facility type, etc., and object-oriented modeling is performed according to the characteristics of each category. Each object has its inherent attributes and calculated attributes. The inherent attributes such as the name of the hydrological facility and the length of the pipeline are determined when the model is initialized, while the calculated attributes such as surface runoff, flow and water level change dynamically when the model is running. A feature object corresponds to one or more feature types, and a feature object corresponds to one attribute type.
[0037] In a possible implementation, step S101 further includes: multiple feature objects include rain gauge objects, sub-catchment area objects, connection objects, node objects, and calculation attribute objects; multiple feature types are classified according to feature features of the multiple feature objects to obtain sensor types corresponding to rain gauge objects in multiple feature types, hydrological facility types corresponding to connection objects in multiple feature types, hydrological facility types corresponding to node objects in multiple feature types, data stream types corresponding to calculation attribute objects in multiple feature types, and observation attribute types corresponding to calculation attribute objects in multiple feature types; constructing a first sub-correspondence between rain gauge objects and sensor types, constructing a second sub-correspondence between sub-catchment area objects and watershed types, constructing a third sub-correspondence between connection objects and hydrological facility types, constructing a fourth sub-correspondence between node objects and hydrological facility types, constructing a fifth sub-correspondence between calculation attribute objects and data stream types, and constructing a sixth sub-correspondence between calculation attribute objects and observation attribute types, wherein the first correspondence includes a first sub-correspondence, a second sub-correspondence, a third sub-correspondence, a fourth sub-correspondence, a fifth sub-correspondence, and a sixth sub-correspondence.
[0038] Specifically, analyze all types of feature objects contained in the first SWMM model. The root feature object uses feature characteristics to classify multiple feature types and classify objects into several abstract types: Sensor type: can provide sensor data input, such as precipitation data, atmospheric data, etc.; Region or basin type: usually represents a region or basin, has a certain area attribute, and can receive or store precipitation; Hydrological facility type: usually a variety of hydrological facilities in a hydrological system, such as pipes, connections, pumps, outlets, etc., which are key elements supporting the operation of the entire hydrological system. Data flow type: feature objects of the data flow type are used to represent the transmission, processing and storage of data, including observation data generated by sensors; Observation attribute type: feature objects of the observation attribute type are used to represent the calculation results or real-time monitoring results in the SWMM model. Each observation attribute is associated with the calculation attribute of the hydrological facility or basin; Afterwards, use an object-oriented approach to model the feature objects in the first SWMM model, and use the Java object-oriented programming language to implement the object model. Please refer to Figure 2 , which shows a UML class diagram for object-oriented modeling and expression of the element objects of the SWMM model provided by the embodiment of the present application, Figure 1 The following types are mainly included: RainGage is the rain gauge type in the first SWMM model, which is used to input precipitation data and belongs to the sensor type in the above SWMM model classification; Subcatchment is the subcatchment area type in the first SWMM model, which can receive precipitation and belongs to the area or basin type in the above SWMM model classification; Link is the link abstract type in the first SWMM model, and its specific types include conduit, outlet, pump station, orifice, weir, etc., which belong to the hydrological facility type in the above SWMM model classification; Node is the node abstract type in the first SWMM model, and its specific types include Junction, outlet, etc. belong to the hydrological facility type in the above SWMM model classification; in addition, VisualObject is the abstract parent class of all hydrological model feature classes, which contains the common properties of all objects. The SWMMSystem class is used to represent the system status of the entire SWMM model, and the first sub-correspondence between the rain gauge object and the sensor type is constructed, the second sub-correspondence between the sub-catchment area object and the watershed type is constructed, the third sub-correspondence between the connection object and the hydrological facility type is constructed, the fourth sub-correspondence between the node object and the hydrological facility type is constructed, the fifth sub-correspondence between the calculation attribute object and the data stream type is constructed, and the sixth sub-correspondence between the calculation attribute object and the observation attribute type is constructed.
[0039] In a possible implementation, the multiple feature objects include a rain gauge object, a sub-catchment area object, a connection object, a node object, and a calculated attribute object, and step S101 further includes: classifying the multiple feature types according to the feature features of the multiple feature objects to obtain the sensor type corresponding to the rain gauge object in the multiple feature types, the watershed type corresponding to the sub-catchment area object in the multiple feature types, the hydrological facility type corresponding to the connection object in the multiple feature types, the hydrological facility type corresponding to the node object in the multiple feature types, the data stream type corresponding to the calculated attribute object in the multiple feature types, and the observation attribute type corresponding to the calculated attribute object in the multiple feature types; constructing a first sub-correspondence relationship between the rain gauge object and the sensor type, constructing a second sub-correspondence relationship between the sub-catchment area object and the watershed type, constructing a third sub-correspondence relationship between the connection object and the hydrological facility type, constructing a fourth sub-correspondence relationship between the node object and the hydrological facility type, constructing a fifth sub-correspondence relationship between the calculated attribute object and the data stream type, and constructing a sixth sub-correspondence relationship between the calculated attribute object and the observation attribute type, wherein the first correspondence relationship includes a first sub-correspondence relationship, a second sub-correspondence relationship, a third sub-correspondence relationship, a fourth sub-correspondence relationship, a fifth sub-correspondence relationship, and a sixth sub-correspondence relationship between the calculated attribute object and the observation attribute type.
[0040] Specifically, the feature attributes corresponding to the target feature object are obtained, and the target feature object is any one of the multiple feature objects. Each feature object in the SWMM model has different attributes. According to the properties of different attributes, the attributes of the object are classified into the following types, and the second corresponding relationship between each feature object and the following types is constructed: Intrinsic attributes: attributes that are assigned to the object when the model is initialized and will not change subsequently, such as the name of a hydrological facility, the length of a pipeline, etc.; Calculated attributes: attributes that will change when the model is simulated and run, for example, the surface runoff of a region will change in real time during the model operation, then the surface runoff attribute is the calculated attribute of the basin. According to the above abstraction and classification of the SWMM model feature objects, all SWMM model elements are expressed in an object-oriented way to complete the establishment of the information model of the feature objects in the SWMM model.
[0041] Step S102: construct a sensor network object model according to the first corresponding relationship and the second corresponding relationship, and register the sensor network object model with the sensor network data server.
[0042] Specifically, by using JNI (Java Native Interface) technology to call the swmm5.dll or libswmm5.so dynamic link library file of the first SWMM model engine, and extracting and converting the call result into a Java class object, the user can completely use the Java language and the class and object method to call the SWMM model and control the operation of the model. After that, the constructed sensor network object model is registered to the sensor network data server.
[0043] In a possible implementation, step S102 also includes: obtaining a first identity corresponding to a first sensor network object model, where the first sensor network object model is any model in the sensor network object model; determining whether the first identity exists in the sensor network data server; if the first identity exists in the sensor network data server, confirming that the first sensor network object model is a registered object, and obtaining a second identity corresponding to a second sensor network object model, where the second sensor network object model is a model in the sensor network object model other than the first sensor network object model; determining whether the second identity exists in the sensor network data server; if the second identity does not exist in the sensor network data server, confirming that the second sensor network object model is an unregistered object, and registering the second sensor network object model to the sensor network data server according to a preset process.
[0044] Specifically, a Web application is built using the Spring Boot framework. The SWMM model engine is assembled and called through automatic configuration. When it starts, all hydrological element objects in the hydrological model are read and converted into standard objects in SensorThings. The objects are registered in the existing SensorThings API server. For the overall initialization process, please refer to Figure 3 , which shows a UML activity diagram of an initialization process of factor object conversion and registration provided by an embodiment of the present application, Figure 3 The initialization process includes S21 to S27:
[0045] S21, start the server, traverse all objects in the SWMM model, query the SensorThings API server according to the ID of each object, if it already exists in the server, it will not be registered repeatedly, and continue to traverse the next object;
[0046] S22, if the object does not exist in the server, it enters the initialization process and first maps it to the Sensor object defined in SensorThings;
[0047] S23, determine the type of the SWMM model object. If it is a region or watershed type object, it will be converted into a FeatureOfInterest object defined in SensorThings and registered with the SensorThings API server;
[0048] S24, continue to determine the SWMM model object type, if it is a hydrological facility type, it will continue to be converted into a Thing object containing Location geographical location information;
[0049] S25, reading all calculated properties of the SWMM model object, and converting each calculated property into an ObservedProperty object and a Datastream object defined in the SensorThings standard;
[0050] S26, assembling the Thing, Sensor and ObservedProperty objects obtained above into the Datastream object to complete the association;
[0051] S27, sending the assembled Datastream object to the SensorThings API server for registration. This process completes the registration of all related SensorThings API objects at one time.
[0052] Step S103: constructing a second rainstorm and flood management model by combining the first rainstorm and flood management model with the sensor network object model.
[0053] Specifically, the first rainstorm flood management model and the sensor network object model are combined to establish a mapping relationship between the object elements in the SWMM model and the sensor network object model.
[0054] In a possible implementation, step S103 also includes: constructing a target random forest model, and mapping the target random forest model to a corresponding sensor network object model by dynamically mapping and converting multiple feature objects; dynamically mapping and converting multiple feature objects, specifically including: constructing a third correspondence between multiple feature objects and multiple sensor network objects, one element object corresponds to one or more sensor network objects, and dynamically mapping and converting according to the third correspondence, wherein; the sensor network object includes a sensor object, a feature object of interest, a thing object, an observation attribute object, and a data stream object, and the third correspondence includes a correspondence between a rain gauge object and a sensor network object, a correspondence between a sub-catchment area and a feature object of interest, a correspondence between a sub-catchment area and a thing object, a correspondence between a connection object and a thing object, a correspondence between a node object and a thing object, a correspondence between a calculation attribute object and an observation attribute object, and a correspondence between a calculation attribute object and a data stream object.
[0055] Specifically, the specific mapping method is as follows: mark the RainGage rain gauge object in SWMM as a sensor type, corresponding to the Sensor object in the SensorThings API; mark the Subcatchment subcatchment area type in SWMM as an area or basin type, corresponding to the FeatureOfInterest and Thing objects in the SensorThings API; mark all Link connections and Node node types in SWMM as hydrological facility types, corresponding to the Thing objects in the SensorThings API.
[0056] In a possible implementation, step S102 also includes: taking feature objects, feature types, attribute types, first corresponding relationships, and second corresponding relationships as model training parameters, and adjusting the model training parameters according to a grid search method until preset conditions are met; and constructing a target random forest model using the model training parameters that meet the preset conditions.
[0057] Specifically, random forest is selected as the machine learning model to realize the feature recognition and classification of SWMM objects. Random forest is an integrated algorithm based on decision tree (Classification and Regression Tree, CART). It constructs multiple decision trees by randomly sampling data and features, and finally integrates them to obtain more accurate and stable prediction results. The main training and modeling process is as follows:
[0058] Prepare model training parameters, and use feature objects, feature types, attribute types, first correspondences, and second correspondences as model training parameters in the training set. According to the classification of SWMM objects, different SWMM objects are marked, where RainGage is marked as a sensor type, Subcatchment is marked as a region or basin type, and various pipeline and node objects are marked as hydrological facility types. In addition, the corresponding rules with sensor objects in the existing data in the training set are as follows: RainGage in the SWMM model corresponds to the Sensor object in the SensorThings API; Subcatchment in the SWMM model corresponds to the FeatureOfInterest object and Things object in the SensorThings API; Conduit, Junction, Outfall and other nodes and link objects in the SWMM model correspond to the Thing object in the SensorThings API; the calculated properties of SWMM objects (simulated properties contained in the calculation results) correspond to the ObservedProperty object and Datastream object in the SensorThings API; all calculation results in SWMM correspond to the Observation object in the SensorThings API; the object correspondence of the training set is as follows:
[0059]
[0060] Among them, f is the training set, According to the classification label and structural characteristics of the feature object as the independent variable of the model training, the mapping relationship between the feature object and different sensor network standard objects is used as the dependent variable to train and establish the random forest model; adjust the main parameters of the random forest model: the number of decision trees, the maximum number of features and the maximum depth of the decision tree, and 1 Score (F 1 -Score) is used as the evaluation index of model classification accuracy. 1 The score is calculated based on two indicators: precision and recall. Precision refers to the accuracy of the model's prediction of the positive class, that is, how many positive samples are correctly classified. Assuming that TP is the number of positive samples that are correctly classified (true positives), and FP is the number of positive samples that are incorrectly classified (false positives), the calculation formula for precision is:
[0061]
[0062] Recall rate refers to the model's ability to identify positive samples, that is, how many positive samples are correctly identified. Assuming FN is the number of negative samples that are misclassified (false negatives), the calculation formula for recall rate is:
[0063]
[0064] Combining the precision and recall indicators, calculate the F1 score indicator:
[0065]
[0066] Based on the grid search method, we can adjust the parameters and select the optimal model, and select the optimal model with the lowest error for subsequent feature matching. This mainly includes: selecting the main core parameters: the number of decision trees n_estimators, the maximum depth max_depth and the maximum number of features ax_features, defining the hyperparameter space, and constructing the search grid as follows:
[0067] param_grid=
[0068] *n_estimators:,100,300-,max_depth:,8,15-,max_features:,5,10-+;
[0069] Where param_grid is the hyperparameter space. According to each hyperparameter combination, the model training is performed based on the established grid parameters, and the accuracy of the model is evaluated using K-Fold Cross Validation. Let D i is the validation set of the i-th fold, f θ is the model trained by the current hyperparameter combination, θ is the hyperparameter set, F 1 (f θ ,D i ) is the F of the model at the i-th fold 1 score, then the cross-validation score C is calculated as follows:
[0070]
[0071] According to the calculated cross-validation score C for each hyperparameter combination, select the hyperparameter combination θ with the highest score best As optimal configuration parameters:
[0072]
[0073] The highest scoring hyperparameter combination θ is bestThe above method uses the Weka framework to read the training data set and build a random forest model. It selects the best hyperparameter configuration based on the grid search method, selects the core parameters: the number of decision trees, the maximum number of features, and the maximum depth of the decision tree to build the search grid, and uses F 1 The model accuracy is evaluated by score, and the model with the smallest error is selected and serialized and saved, which greatly improves the accuracy of the model.
[0074] Step S104, inputting the sensor data into the second rainstorm and flood management model, and outputting the calculation results according to the second rainstorm and flood management model.
[0075] Specifically, the second rainstorm flood management model is the first rainstorm flood management model after the mapping operation, and the sensor data includes precipitation data, watershed humidity data and air direction data.
[0076] Step S105, querying the calculation results from the sensor network data server through a standard access method, and visually displaying the calculation results.
[0077] Specifically, according to the Web application built in step S103, the calculation results are queried from the sensor network data server through the hypertext transfer protocol / message queue telemetry transmission protocol, and the calculation results are visualized. Please refer to Figure 4 , which shows a UML activity diagram of a visualized process provided by an embodiment of the present application, wherein the steps in the diagram include S31 to S35:
[0078] S31, after starting the server, waits to receive sensor data through HTTP or MQTT protocol;
[0079] After receiving the sensor data, it is input into the SWMM model, and at the same time, the calculation results of the SWMM model are subscribed to in a new process.
[0080] S32, after inputting the SWMM model, simulates a step and the results are published to the result subscribers;
[0081] S33, after the subscription process receives the SWMM model calculation result subscription, it will query the corresponding Datastream object from the SensorThings API server according to the SWMM model object ID corresponding to the calculation result and its calculation attribute name;
[0082] S34, after querying the Datastream object, convert the calculation results of the hydrological model into Observation objects and associate them with the Datastream, and then send them to the SensorThings API server;
[0083] S35, through HTTP or MQTT protocol, uses the standard request method defined in the SensorThings API specification to query the corresponding observation data, the status of all objects in the hydrological system sensor network, and some historical data of the hydrological system from the SensorThings API server in real time, and further completes the real-time visualization of the data.
[0084] This application adopts the above method, through abstract classification and object-oriented modeling, to construct a mapping relationship between sensor data and each element object in the storm and flood management model, so that the sensor data can effectively drive the operation of the storm and flood management model, thereby solving the problem that the SWMM model depends on real-time sensor data; and through the construction and registration of the sensor network object model, it breaks the limitation that the traditional SWMM model can only be run on desktop computers. Combined with sensor data input and calculation result output, it supports cloud or remote computing based on sensor network data, greatly optimizing the model's calculation process and result visualization display method.
[0085] Please refer to Figure 5 , which shows a module schematic diagram of a SWMM model real-time calculation and visualization device provided in an embodiment of the present application, the device includes a call module 51, a mapping module 52 and a calculation and visualization module 53, wherein,
[0086] The calling module 51 is used to construct a first rainstorm and flood management model, and to perform abstract classification and object-oriented modeling on multiple element objects in the first rainstorm and flood management model. The abstract classification is used to construct a first correspondence between multiple element objects and multiple element types, and the object-oriented modeling is used to construct a second correspondence between multiple element objects and multiple attribute types, wherein one element object corresponds to one or more element types, and one element object corresponds to one attribute type.
[0087] The mapping module 52 is used to construct a sensor network object model according to the first corresponding relationship and the second corresponding relationship, and register the sensor network object model to the sensor network data server; and construct a second rainstorm flood management model by combining the first rainstorm flood management model and the sensor network object model.
[0088] The calculation and visualization module 53 is used to input the sensor data into the second rainstorm flood management model and output the calculation results according to the second rainstorm flood management model. The sensor data includes precipitation data, watershed humidity data and air direction data; the calculation results are queried from the sensor network data server through standard access methods and the calculation results are visualized.
[0089] In a possible implementation, the plurality of element objects include a rain gauge object, a sub-catchment area object, a connection object, a node object, and a calculation attribute object. The calling module 51 is used to construct a first correspondence between the plurality of element objects and the plurality of element types, specifically including: classifying the plurality of element types according to the element characteristics of the plurality of element objects, obtaining a sensor type corresponding to the rain gauge object in the plurality of element types, a watershed type corresponding to the sub-catchment area object in the plurality of element types, a hydrological facility type corresponding to the connection object in the plurality of element types, a hydrological facility type corresponding to the node object in the plurality of element types, and a data stream type corresponding to the calculation attribute object in the plurality of element types. type and the calculated attribute objects in multiple feature types correspond to the observed attribute types; construct a first sub-correspondence between the rain gauge object and the sensor type, construct a second sub-correspondence between the sub-catchment area object and the watershed type, construct a third sub-correspondence between the connection object and the hydrological facility type, construct a fourth sub-correspondence between the node object and the hydrological facility type, construct a fifth sub-correspondence between the calculated attribute object and the data stream type, and construct a sixth sub-correspondence between the calculated attribute object and the observed attribute type, wherein the first correspondence includes a first sub-correspondence, a second sub-correspondence, a third sub-correspondence, a fourth sub-correspondence, a fifth sub-correspondence and a sixth sub-correspondence.
[0090] In a possible implementation, the calling module 51 is used to construct a second correspondence between multiple feature objects and multiple attribute types, specifically including: obtaining the feature attribute corresponding to the target feature object, the target feature object is any one of the multiple feature objects, and the feature attribute is any one of a static attribute and a dynamic attribute; the static attributes include a hydrological facility name attribute and a pipeline length attribute, and the dynamic attributes include a runoff attribute and a precipitation attribute; if it is confirmed that the feature attribute is a static attribute, constructing a seventh sub-correspondence between the target feature object and the inherent attribute type, conversely, if it is confirmed that the feature attribute is a dynamic attribute, constructing an eighth sub-correspondence between the target feature object and the calculated attribute type, wherein the second correspondence includes the seventh sub-correspondence and the eighth sub-correspondence.
[0091] In a possible implementation, the mapping module 52 is used to construct a sensor network object model, specifically including: constructing a target random forest model, and mapping the target random forest model to a corresponding sensor network object model by dynamically mapping and converting multiple element objects; dynamically mapping and converting multiple element objects, specifically including: constructing a third correspondence between multiple element objects and multiple sensor network objects, one element object corresponds to one or more sensor network objects, and performing dynamic mapping and conversion according to the third correspondence, wherein; the sensor network object includes a sensor object, a feature object of interest, a thing object, an observation attribute object, and a data stream object, and the third correspondence includes a correspondence between a rain gauge object and a sensor network object, a correspondence between a sub-catchment area and a feature object of interest, a correspondence between a sub-catchment area and a thing object, a correspondence between a connection object and a thing object, a correspondence between a node object and a thing object, a correspondence between a calculation attribute object and an observation attribute object, and a correspondence between a calculation attribute object and a data stream object.
[0092] In one possible implementation, the mapping module 52 is used to construct a target random forest model, specifically including: taking feature objects, feature types, attribute types, first corresponding relationships, and second corresponding relationships as model training parameters, and adjusting the model training parameters according to a grid search method until preset conditions are met; and constructing a target random forest model using model training parameters that meet the preset conditions.
[0093] In a possible implementation, the mapping module 52 is used to register the sensor network object model to the sensor network data server, specifically including: obtaining a first identity corresponding to the first sensor network object model, the first sensor network object model being any model in the sensor network object model; determining whether the first identity exists in the sensor network data server; if the first identity exists in the sensor network data server, confirming that the first sensor network object model is a registered object, and obtaining a second identity corresponding to the second sensor network object model, the second sensor network object model being a model in the sensor network object model other than the first sensor network object model; determining whether the second identity exists in the sensor network data server; if the second identity does not exist in the sensor network data server, confirming that the second sensor network object model is an unregistered object, and registering the second sensor network object model to the sensor network data server according to a preset process.
[0094] In one possible implementation, the calculation and visualization module 53 is used to query the calculation results from the sensor network data server through a standard access method and to visualize the calculation results, specifically including: querying the calculation results from the sensor network data server through the hypertext transfer protocol / message queue telemetry transmission protocol and to visualize the calculation results.
[0095] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0096] The present application also provides an electronic device. Figure 6 , Figure 6 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include: at least one processor 601, at least one communication bus 602, a user interface 603, at least one network interface 604, and a memory 605.
[0097] The communication bus 602 is used to realize the connection and communication between these components.
[0098] The user interface 603 may include a display screen (Display) and a camera (Camera), and the optional user interface 603 may also include a standard wired interface and a wireless interface.
[0099] The network interface 604 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0100] Among them, the processor 601 may include one or more processing cores. The processor 601 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 605, and calling data stored in the memory 605. Optionally, the processor 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 601 can integrate one or more combinations of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 601, and it can be implemented by a single chip.
[0101] Among them, the memory 605 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 605 may optionally be at least one storage device located away from the aforementioned processor 601. Refer to Figure 6 , the memory 605 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a SWMM model real-time calculation and visualization application.
[0102] exist Figure 6In the electronic device shown, the user interface 603 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 601 can be used to call the SWMM model real-time calculation and visualization application stored in the memory 605. When executed by one or more processors 601, the electronic device executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described order of actions, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0103] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors, the electronic device executes one or more of the methods described in the above embodiments.
[0104] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0106] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0107] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0108] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0109] The above are only exemplary embodiments disclosed in this application, and the scope of the disclosure of this application cannot be limited by this. That is, any equivalent changes and modifications made according to the teachings disclosed in this application are still within the scope of the disclosure of this application. After considering the specification and the practice disclosure, those skilled in the art will easily think of other implementation schemes disclosed in this application.
[0110] This application is intended to cover any modifications, uses or adaptive changes disclosed in this application, which follow the general principles disclosed in this application and include common knowledge or customary technical means in the technical field not recorded in this application.
Claims
1. A real-time calculation and visualization method for SWMM model, characterized in that: The method comprises: Constructing a first rainstorm and flood management model, performing abstract classification and object-oriented modeling on a plurality of element objects in the first rainstorm and flood management model, wherein the abstract classification is used to construct a first correspondence between a plurality of the element objects and a plurality of element types, and the object-oriented modeling is used to construct a second correspondence between a plurality of the element objects and a plurality of attribute types, wherein one element object corresponds to one or more element types, and one element object corresponds to one attribute type; Constructing a sensor network object model according to the first corresponding relationship and the second corresponding relationship, and registering the sensor network object model to a sensor network data server; By combining the first rainstorm and flood management model with the sensor network object model, a second rainstorm and flood management model is constructed; Inputting sensor data into the second storm flood management model, and outputting calculation results according to the second storm flood management model, the sensor data including precipitation data, watershed humidity data, and air direction data; The calculation results are queried from the sensor network data server through a standard access method, and the calculation results are visually displayed.
2. The method according to claim 1, characterized in that The plurality of element objects include a rain gauge object, a subcatchment area object, a connection object, a node object, and a calculation attribute object. The first corresponding relationship between the plurality of element objects and the plurality of element types is constructed, specifically including: Classify the plurality of element types according to the element features of the plurality of element objects, and obtain the sensor type corresponding to the rain gauge object in the plurality of element types, the watershed type corresponding to the subcatchment area object in the plurality of element types, the hydrological facility type corresponding to the connection object in the plurality of element types, the hydrological facility type corresponding to the node object in the plurality of element types, the data stream type corresponding to the calculation attribute object in the plurality of element types, and the observation attribute type corresponding to the calculation attribute object in the plurality of element types; A first sub-correspondence relationship between the rain gauge object and the sensor type is constructed, a second sub-correspondence relationship between the sub-catchment area object and the watershed type is constructed, a third sub-correspondence relationship between the connection object and the hydrological facility type is constructed, a fourth sub-correspondence relationship between the node object and the hydrological facility type is constructed, a fifth sub-correspondence relationship between the calculation attribute object and the data stream type is constructed, and a sixth sub-correspondence relationship between the calculation attribute object and the observation attribute type is constructed, wherein the first correspondence relationship includes the first sub-correspondence relationship, the second sub-correspondence relationship, the third sub-correspondence relationship, the fourth sub-correspondence relationship, the fifth sub-correspondence relationship, and the sixth sub-correspondence relationship.
3. The method according to claim 2, characterized in that The step of constructing a second correspondence between the plurality of feature objects and the plurality of attribute types specifically includes: Acquire a feature attribute corresponding to a target feature object, wherein the target feature object is any one of the multiple feature objects, and the feature attribute is any one of a static attribute and a dynamic attribute; the static attribute includes a hydrological facility name attribute and a pipeline length attribute, and the dynamic attribute includes a surface runoff attribute and a precipitation attribute; If it is confirmed that the feature attribute is the static attribute, the seventh sub-correspondence between the target feature object and the inherent attribute type is constructed. Conversely, if it is confirmed that the feature attribute is the dynamic attribute, the eighth sub-correspondence between the target feature object and the calculated attribute type is constructed, wherein the second correspondence includes the seventh sub-correspondence and the eighth sub-correspondence.
4. The method according to claim 3, characterized in that The construction of the sensor network object model specifically includes: Constructing a target random forest model, and mapping the target random forest model to the corresponding sensor network object model by dynamically mapping and converting the plurality of element objects; the dynamically mapping and converting the plurality of element objects specifically includes: Construct a third correspondence between a plurality of the element objects and a plurality of sensor network objects, wherein one element object corresponds to one or more of the sensor network objects, and perform the dynamic mapping conversion according to the third correspondence, wherein; the sensor network object includes a sensor object, a feature object of interest, a thing object, an observation attribute object and a data stream object, and the third correspondence includes a correspondence between the rain gauge object and the sensor network object, a correspondence between the sub-catchment area and the feature object of interest, a correspondence between the sub-catchment area and the thing object, a correspondence between the connection object and the thing object, a correspondence between the node object and the thing object, a correspondence between the calculation attribute object and the observation attribute object, and a correspondence between the calculation attribute object and the data stream object.
5. The method according to claim 4, characterized in that The construction of the target random forest model specifically includes: The feature object, the feature type, the attribute type, the first corresponding relationship, and the second corresponding relationship are used as model training parameters, and the model training parameters are adjusted according to a grid search method until preset conditions are met; The target random forest model is constructed by using the model training parameters that meet the preset conditions.
6. The method according to claim 1, characterized in that The registering the sensor network object model to the sensor network data server specifically includes: Acquire a first identity corresponding to a first sensor network object model, where the first sensor network object model is any one of the sensor network object models; Determining whether the first identity exists in the sensor network data server; If the first identity exists in the sensor network data server, confirming that the first sensor network object model is a registered object, and obtaining a second identity corresponding to a second sensor network object model, where the second sensor network object model is a model in the sensor network object model other than the first sensor network object model; Determining whether the second identity exists in the sensor network data server; If the second identity does not exist in the sensor network data server, it is determined that the second sensor network object model is an unregistered object, and the second sensor network object model is registered to the sensor network data server according to a preset process.
7. The method according to claim 1, characterized in that The step of querying the calculation result from the sensor network data server through a standard access method and visually displaying the calculation result specifically includes: The calculation result is queried from the sensor network data server through the hypertext transfer protocol / message queue telemetry transmission protocol, and the calculation result is visualized.
8. A SWMM model real-time calculation and visualization device, characterized in that: The device includes a loading and calling module, a mapping module and a calculation and visualization module, wherein: The assembly calling module is used to construct a first storm and flood management model, and to perform abstract classification and object-oriented modeling on a plurality of element objects in the first storm and flood management model, wherein the abstract classification is used to construct a first correspondence between a plurality of the element objects and a plurality of element types, and the object-oriented modeling is used to construct a second correspondence between a plurality of the element objects and a plurality of attribute types, wherein one element object corresponds to one or more element types, and one element object corresponds to one attribute type; The mapping module is used to construct a sensor network object model according to the first corresponding relationship and the second corresponding relationship, and register the sensor network object model to the sensor network data server; and construct a second rainstorm and flood management model by combining the first rainstorm and flood management model with the sensor network object model; A calculation and visualization module is used to input sensor data into the second storm flood management model, and output calculation results according to the second storm flood management model, wherein the sensor data includes precipitation data, watershed humidity data and air direction data; query the calculation results from the sensor network data server through a standard access method, and visualize the calculation results.
9. An electronic device, characterized in that: It includes a processor, a communication bus, a user interface, a network interface and a memory, wherein the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
Hydrodynamic simulation method, device and equipment
CN115795763A
Modeling method and device for SWMM drainage basin model and electronic equipment
CN116738667A
Visual commanding and dispatching management system for urban drainage
CN118607746A
Power grid facility waterlogging disaster intelligent prediction method and device based on fluid large model
CN118735046A