Digital twin mechanism model parameter standardization system and method for water resources regulation
By constructing a digital twin model platform, the water resource scheduling model was analyzed and standardized, solving the problem of deep coupling between the mechanism model and the business platform, realizing efficient management and visualization of the model, and improving operation and maintenance efficiency and business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG YUANSUAN TECH CO LTD
- Filing Date
- 2026-05-08
- Publication Date
- 2026-06-05
Smart Images

Figure CN122152354A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital twin and computer simulation technology, and specifically relates to a system and method for standardizing parameters of digital twin mechanism models for water resource scheduling. Background Technology
[0002] Digital twin systems are playing an increasingly important role in many key fields today. By constructing virtual models corresponding to physical entities, digital twin systems can simulate and predict the behavior and performance of physical entities, providing strong support for decision-making. Within digital twin systems, mechanistic models are an indispensable core component, with different types of mechanistic models having specific application purposes and technical problems to be solved in particular scenarios.
[0003] Definition of a mechanistic model: A precise mathematical model established based on the internal mechanisms of an object, production process, or the transmission mechanism of material flow. It is a mathematical model of an object or process obtained based on mass balance equations, energy balance equations, momentum balance equations, phase balance equations, as well as certain physical property equations, chemical reaction laws, and fundamental circuit laws. The advantage of mechanistic models is that their parameters have very clear physical meanings. These models exist in various industries, require sufficient input conditions, and produce outputs that can simulate the entire process.
[0004] Currently, digital twin business platforms primarily employ a "point-to-point" hard-coded interface when integrating mechanistic models. This means that after professional modelers complete the model construction, business developers directly embed the model's source code into the business system. This model results in deep coupling between the mechanistic model and the business model platform, leading to a series of problems. These mainly include the following: Poor stability and high iteration costs: The deep coupling between the mechanism model and the business platform means that once the model algorithm, parameters, etc. need to be optimized or adjusted, the code of the entire business platform must be modified and redeployed. This update method leads to long cycles, high risks, and the business system may become unavailable due to model changes.
[0005] The results lack interpretability: Under the current integration method, the entire model is a complete black box. The business platform is only responsible for data input and result display, and has no understanding of the structure and physical meaning of the model's internal parameters, output parameters, and input parameters. Business personnel cannot intuitively see the model's input data and parameter information, resulting in a lack of interpretability in the results.
[0006] Model version replacement is cumbersome and cannot guarantee business continuity: The current integration method lacks standardized interfaces, requiring manual intervention in the code for model version replacement. When a business platform needs to replace a model version, it must go through a process of downtime-code modification-deployment, which can lead to business interruption.
[0007] Model management is fragmented, resulting in low operational efficiency: Various mechanism models are scattered across different business platforms, forming model silos. Managers cannot have a global grasp of the quantity, version, and operational status of model assets. When model calculation results are abnormal, operations and maintenance personnel need to check the logs of the business system for troubleshooting, leading to low operational efficiency. This is especially problematic in time-sensitive scenarios such as flood control, which can easily lead to serious consequences.
[0008] Therefore, there is an urgent need for a system and method for centralized management of mechanism models and standardization of parameters. By decoupling the model from the business platform, it can provide standardized interface calls and a unified regulatory environment, thereby improving the maintainability, traceability and continuous operation capability of the digital twin system. Summary of the Invention
[0009] To address the aforementioned technical challenges, this invention provides a standardized system and method for digital twin mechanism model parameters in water resource scheduling. This system standardizes and visualizes the input, output, and calculation parameters of all models involved in digital twin application scenarios, facilitating collaboration between different teams, promoting information exchange and sharing, and enabling rapid problem identification and significantly reducing maintenance costs when model results are abnormal or calculations fail, all models are under a unified management environment.
[0010] A parameter standardization method for a digital twin mechanism model of water resource allocation includes the following steps: S1, Build a digital twin model platform and configure a digital twin mechanism model; S2, through the constructed digital twin model platform, parses the uploaded model, obtains the parsing results, and generates the relative access path of the uploaded model file based on the parsing results; S3: Based on the relative access path of the generated uploaded model file, read the model file information and complete the addition of the model; S4 tests the results of S3 through the digital twin model platform, obtains the test results and the API address for calling and querying the configured digital twin mechanism model; S5 transmits real-time water resource monitoring or forecast data to the constructed digital twin model platform via API address, triggering model execution; S6: After the model runs, the model results analysis is obtained. The model results analysis data is called through the API address and the model results analysis is displayed.
[0011] Further, in step S2, a corresponding model file package is uploaded according to the built-in model template. The model file package is a compressed package of model files prepared by the modeler, which includes example input files, example output files, parameter files, and a configuration file spec.json. The configuration file spec.json includes fields such as input file list inputs, output file list outputs, log file logfile, recommended cores recommendedcores, step, type, scriptTemplate, and solver. The input file list inputs and output file list outputs are used to describe the relative identifiers of the input / output files (filename and description desc) and do not include information such as the server name and address.
[0012] Furthermore, step S2 specifically includes the following processes: S2.1, by reading the uploaded model file compressed package, determine whether the uploaded model file compressed package has a configuration file. If not, report an error; otherwise, decompress the uploaded model to obtain the current temporary decompression root directory DIR. root ; S2.2 performs an existence check on the files described in the spec.json configuration file. It iterates through the input file list (inputs) data in the configuration file. For each input entry, it calculates the target path and checks if the example input file exists. If the file does not exist, it reports an error, prompts the user that the content is incomplete, stops the iteration, and requires re-uploading. If all files exist, it continues to execute. S2.3, based on the results of temporary decompression of the root directory and traversal, uses a path concatenation algorithm to generate the relative access path of the uploaded model file.
[0013] Further, step S3 includes: S3.1, Based on the relative access path of the generated and uploaded model file, obtain the parsed file of the model corresponding to the access path through an asynchronous network request; S3.2, a linear traversal algorithm is used to traverse the parsed input file list inputs, read the file name (fileName) and description (desc) of each data in the input file list inputs, map these two values to form attribute components and attach them to the document object model in sequence, thereby realizing the dynamic generation and display of the configuration form; S3.3 Perform name uniqueness verification. Check whether the uploaded model name is the same as an existing model name. If there is a duplicate, prompt to rename it, and then complete the addition of the model.
[0014] After a model is successfully added in S3, a new model data entry will be added to the model data management list. This step only adds the model data, so the data status is the initial untested state, and the model needs to be tested.
[0015] Further, step S4 includes: S4.1, construct a temporary running directory, copy the example input files in the model package to the corresponding input path location in this directory, and generate running commands based on the script template and solver to trigger model execution tests; S4.2 During test execution, the test is performed in the order of the preset test process and the status of each step is monitored. If an error flag is detected, the circuit breaker mechanism is triggered to stop the subsequent process and the test status is updated to failure. If all steps are successful, the status is updated to published, and the output file is generated at the output path location of the temporary running directory. The content of the output file is checked to see if it matches the filename in the output file list specified in the configuration file. If they do not match, the test status is updated to failure. If they match, a unique identifier for the model and a fixed network call address, i.e., the API address, is generated for calling.
[0016] Furthermore, step S5 specifically includes the following processes: S5.1, call the API address and pass in the input data about water resource scheduling that meets the requirements of the example input file. Generate a unique task serial number, and create a task folder DIR based on the task serial number. task ; S5.2, triggers model execution based on the model script and solver in S4.1; S5.3 displays the tasks to be executed in the model job list and adjusts the priority of model jobs using heap structure reconstruction.
[0017] Furthermore, step S5.3 specifically includes the following process: S5.3.1 Displays running and queued models (due to limited computing resources, queuing issues may occur) in the model task list; S5.3.2 Allows adjusting the priority of queued model jobs, using Go language slicing to construct a binary heap structure HeapQueue, ensuring that any node i is aligned with its parent node. The inequality Priority(i) ≤ Priority(p) is always satisfied to ensure that high-priority jobs are always placed at the top.
[0018] Furthermore, step S6 specifically includes the following processes: S6.1, after completing the run, parses and adjusts the format of each uploaded file based on its address and file type, converting the txt files into csv files; S6.2, determine the graphical display method based on the content of the CSV file and perform corresponding processing, specifically including: When the data contains a time field and needs to show the continuous change of status over time, the time column in the CSV is extracted as the X-axis, and the remaining columns are used as multiple Y-axis to display a line chart. An interpolation fitting algorithm is used to connect the discrete data points into a smooth curve. When the data contains a time field and the total amount within a unit of time needs to be displayed, the time column in the CSV is extracted as the X-axis and the remaining columns are used as the Y-axis. Each time point is mapped to an independent column container. The Y-axis directly reflects the value within that time period, and gaps are reserved between the columns to reflect the concept of intervals. S6.3 After the model runs, it generates the taskID and the corresponding output data from the input data in S5.1, and stores the output data in DIR. task In the output data folder, queries and calls are made using taskID.
[0019] A parameter standardization system for a digital twin mechanism model of water resource allocation includes: The building module is used to build a digital twin model platform and configure the digital twin mechanism model; The parsing module is used to parse the uploaded model through the constructed digital twin model platform, obtain the parsing results, and generate the access path of the uploaded model based on the parsing results; A new module has been added to read model file information based on the access path of the generated uploaded model and complete the addition of the model. The testing module is used to conduct tests through the digital twin model platform, obtain test results, and generate API addresses for calling and querying the corresponding model. The execution module is used to transmit real-time water resource monitoring or forecasting data to the constructed digital twin model platform via API address, triggering model execution; The analysis and display module generates model result analysis after the model runs. It calls the model result analysis data through the API address and displays the model result analysis.
[0020] Beneficial effects: This application provides multiple model import methods for centralized model addition, automatically parses model input and output content, establishes a testing mechanism, and flexibly adjusts job priorities, solving problems such as the lack of unified standards, difficulty in verifying usability, and insufficient ability to cope with emergencies in traditional model management. The generated standardized model data can flexibly meet the calling needs of different systems, enabling more efficient and accurate model management and application, and providing important guidance for the design, maintenance, and use of models in multiple domains. Attached Figure Description
[0021] Figure 1This is a flowchart of Example 1; Figure 2 Flowchart for the newly added model; Figure 3 A flowchart for model testing; Figure 4 A flowchart for inputting model data; Figure 5 A flowchart is provided to illustrate the results. Figure 6 A diagram of the model publishing page for an application example; Figure 7 A diagram of the data management page for an application example; Figure 8 Test diagram for application example; Figure 9 A page layout ready for testing; Figure 10 Enable a success state graph for the model; Figure 11 For instance control diagram; Figure 12 This is a graph showing the results of the medium- to long-term water inflow analysis. Figure 13 This is a graph showing the results of the short-term water inflow analysis; Figure 14 This is a diagram illustrating the water distribution model. Figure 15 A flow rate diagram for irrigation surface scheduling in the scheduling model; Figure 16 This is a diagram showing the gate opening degree of the scheduling model. Figure 17 For the running schedule list diagram; Figure 18 This is a graph showing the input data for the water distribution model. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. To make the above-mentioned objectives, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0023] Example 1 A parameter standardization method for a digital twin mechanism model of water resource allocation, such as Figures 1 to 5 As shown, it includes the following steps: S1. Construct a digital twin model platform and configure a digital twin mechanism model on the digital twin model platform; S2, the uploaded model is parsed through the constructed digital twin model platform to obtain the parsing results, and an access path for the uploaded model is generated based on the parsing results; the specific process of step S2 includes: S2.1, by reading the uploaded model file compressed package, determine whether the uploaded model file compressed package has a configuration file. If not, report an error; otherwise, decompress the uploaded model file compressed package to obtain the current temporary decompression root directory DIR. root The model file compressed package is a packaged model file, which includes example input files, example output files, parameter files, and configuration files. The configuration file includes fields such as input file list (inputs), output file list (outputs), log file (logfile), recommended cores (recommendcores), step (step), type (type), script template (scriptTemplate), and solver (slover). The input file list (inputs) and output file list (outputs) are used to describe the relative identifiers of the input / output files (filename and description, desc), but do not include information such as the server name and address. S2.2 performs an existence check on the filename described in the configuration file (spec.json). It iterates through the input file list (inputs) data in the configuration file. For each input entry, it calculates the target path and checks if the file exists. If the file does not exist, it reports an error, prompts the user that the content is incomplete, stops the iteration, and requires re-uploading. If all files exist, it continues to execute.
[0024] S2.3, based on the results of temporary decompression of the root directory and traversal, uses a path concatenation algorithm to generate the relative access path of the uploaded model file.
[0025] Specifically, after uploading the model file, the system parses the configuration file (spec.json) within the model package to automatically match the model parameters and parse out the input and output content of the model file.
[0026] The model package contains sample input and output files for the model, as well as a data configuration file (spec.json). First, the data configuration file (spec.json) is read from the model package. Existence checks are performed on the input file list (inputs) and output file list (outputs) in the configuration file. The inputs and outputs only contain relative identifiers of the files (file name and description), and do not include information such as the server name and address.
[0027] The specific process is as follows: For each input entry Calculate the target path and check if the file exists:
[0028]
[0029] If any If the error message is incomplete, you need to re-upload it.
[0030] If it does not exist After traversing all the content, the path concatenation algorithm is used to concatenate the relative identifiers (filenames) of the temporary decompression root directory and the files to generate the access path.
[0031] The formula that satisfies this condition is:
[0032] Wherein: F spec For the filename in the configuration file, P target The path read by the system, DIR root This is a temporary unzipped root directory.
[0033] The relative path positioning method decouples the model package from the storage location. No matter which server or directory the model is uploaded to, the platform can read the corresponding file information by combining the file name with the working directory, without modifying the code.
[0034] S3, based on the relative access path of the generated uploaded model file, reads the model file information and completes the addition of the model.
[0035] Step S3 includes: S3.1 Based on the relative access path of the generated uploaded model file, obtain the parsed file of the model corresponding to the access path through an asynchronous network request; S3.2, a linear traversal algorithm is used to traverse the parsed input file list inputs, read the file name (fileName) and description (desc) of each data in the input file list inputs, map these two values to form attribute components and mount them in order, thereby realizing the dynamic generation and display of the configuration form; S3.3 Perform name uniqueness verification. Check whether the uploaded model name is the same as an existing model name. If there is a duplicate, prompt to rename it, and then complete the addition of the model.
[0036] Display the parsed content on the front-end interface to complete the operation of adding a new model. The name of the new model must not be the same as the name in the model list.
[0037] In S3, the backend returns the file access path to the frontend. After receiving the path, the frontend initiates an asynchronous network request. The browser directly reads and parses the file content stored on the server. After obtaining the parsed content (including all files including input and output), the frontend uses a linear traversal algorithm to traverse the inputs array, reads the filename and desc for each data, and directly converts these two values into the filename and description attributes of the component for display on the interface. The frontend then mounts the converted components to the document object model in sequence to achieve dynamic generation of the configuration form.
[0038] This method enables the form to be displayed on the front-end interface. After the model name and model input / output parameters are displayed on the front-end interface, the model name can be modified, the details of the model input / output parameters can be viewed, and the model can be added to the platform after clicking confirm.
[0039] Additionally, there is a name uniqueness check on the backend. If the newly added model name is duplicated with a model name in the model list, the platform will prompt that the name is duplicated. You need to modify the name and resubmit the check until the model name is not duplicated with any existing names in the list before the model can be added successfully.
[0040] S4 tests the results of S3 through a digital twin model platform, obtaining the test results and generating the corresponding API addresses for calling and querying the model; specifically including: S4.1, construct a temporary running directory, copy the example input file from the model package to the corresponding input path location in this directory, and generate a running command based on the script template and solver to trigger the model execution test; S4.2 During test execution, the test is performed in the order of the preset test process and the status of each step is monitored. If an error flag is detected, the circuit breaker mechanism is triggered to stop the subsequent process and the model test status in the database is updated to failure. If all steps are successful, the status is updated to published, and the output file is generated at the output path location of the temporary running directory. The content of the output file is checked to see if it is consistent with the filename in the output file list specified in the configuration file. If they are inconsistent, the test status is updated to failure. If they are consistent, a unique identifier for the model is generated and a fixed network call address, i.e., the API address, is generated for calling.
[0041] After the front-end clicks to trigger the model test, the model test will proceed according to a series of preset processes. The back-end monitors this process in real time, obtaining success or failure information. During the monitoring process, if an error flag is detected, the system triggers a circuit breaker mechanism, stopping all subsequent calculation processes, updating the database status to test failure, and recording detailed logs. After the front-end obtains this failure status, it directly displays the test failure. If all processes succeed, the final result will be output to the output file.
[0042] The model testing process is an ordered set. Execution step S b The state determination function is f(S) b );
[0043] The success of testing the entire process depends on the success of each part of the process, ultimately S n Need to go from S1 to S n-1 It will only be triggered after all steps are successful.
[0044] The next step can only be carried out after the model passes the test; otherwise, the problem needs to be investigated according to the error log, and the above process needs to be repeated until the test passes.
[0045] S5 transmits real-time water resource monitoring or forecasting data to the constructed digital twin model platform via API address, triggering model execution. Specifically, this includes: S5.1, call the API address and pass in the input data about water resource scheduling that meets the requirements of the example input file. Generate a unique task serial number, and create a task folder DIR based on the task serial number. task ; S5.2, triggers model execution based on the model script and solver in S4.1; S5.3 displays the tasks to be executed in the model job list and adjusts the priority of model jobs using heap structure reconstruction.
[0046] S5.3.1 Displays running and queued models in the model task list; S5.3.2 uses Go language slicing to construct a binary heap structure HeapQueue, such that any node i is related to its parent node. The inequality Priority(i) ≤ Priority(p) is always satisfied to ensure that high-priority jobs are always at the top, thereby enabling the adjustment of the priority of model jobs waiting to be run.
[0047] To enable priority adjustment, the platform uses Go language slices to construct a binary heap structure called HeapQueue.
[0048] HeapQueue[]t is defined, abandoning the traditional linked list heap structure and using slices to implement it. Because slices are distributed continuously in memory, the CPU can read continuous content very quickly. This design will improve the CPU cache hit rate under high-frequency scheduling and ensure the high throughput performance of the scheduler.
[0049] Then, the sorting rule of "the larger the priority value, the higher the weight" was defined using the Less method. For any node i and its parent node... The inequality must always be satisfied: Priority(i) ≤ Priority(p). This ensures that high-priority jobs are always listed first.
[0050] S6: After the model runs, the model results analysis is obtained. This analysis data is then retrieved via the API address and displayed. The specific process includes: S6.1, after completing the run, parses and adjusts the format of each uploaded file based on its address and file type, converting the txt files into csv files; In S6.2, the front-end determines the graphical display method based on the content of the CSV file and performs corresponding processing, specifically including: When the data contains a time field and needs to show the continuous change of status over time, the time column in the CSV is extracted as the X-axis, and the remaining columns are used as multiple Y-axis to display a line chart. An interpolation fitting algorithm is used to connect the discrete data points into a smooth curve. When the data contains a time field and the total amount within a unit of time needs to be displayed, the time column in the CSV is extracted as the X-axis and the remaining columns are used as the Y-axis. Each time point is mapped to an independent column container. The Y-axis directly reflects the value within that time period, and gaps are reserved between the columns to reflect the concept of intervals. The CSV file is directly bound to the front-end DataGrid component and displayed on the front-end page. When the data includes a time field and needs to show continuous changes in status over time, such as flow rate, water level, and flow velocity, the time column from the CSV is extracted as the X-axis, and the remaining columns are used as multiple Y-axis lines to display a line chart. An interpolation fitting algorithm is used to connect discrete data points into a smooth curve. When the data includes a time field and needs to show the total amount per unit time, such as rainfall or water demand, the time column from the CSV is extracted as the X-axis, and the remaining columns are used as the Y-axis. Each time point is mapped to an independent column container, and the Y-axis directly reflects the numerical value within that time period. Gaps are maintained between the columns to represent the interval concept.
[0051] S6.3 After the model finishes running, it generates a taskID and an output data file corresponding to the input data, and stores the output data in DIR. taskThe middle directory allows for querying and accessing data via taskID.
[0052] Example 2 A parameter standardization system for a digital twin mechanism model of water resource allocation includes: The building module is used to build a digital twin model platform and configure the digital twin mechanism model; The parsing module is used to parse the uploaded model through the constructed digital twin model platform, obtain the parsing results, and generate the access path of the uploaded model based on the parsing results; A new module has been added to read model file information based on the access path of the generated uploaded model and complete the addition of the model.
[0053] The testing module is used to test the results obtained from the new module through the digital twin model platform, obtain the test results, and generate the API address for calling and querying the corresponding model. Run module: Used to transmit real-time water resource monitoring or forecast data to the constructed digital twin model platform via API address, triggering model execution; Analysis and Display Module: After the model runs, the model results analysis is obtained. The model results analysis data is called through the API address and displayed.
[0054] Application examples To more clearly explain the present invention, a specific embodiment is provided below to illustrate the specific implementation method of the present invention. This embodiment takes a water resource scheduling platform in an irrigation district as an example. Figures 6 to 18 As shown.
[0055] First, the modelers establish digital twin mechanistic models required for irrigation district water resource scheduling. This includes short-term inflow forecasting, long-term inflow forecasting, water demand models, water allocation models, and scheduling models (these are all mechanistic models, each with a different mechanism, so they need to be established separately), and provide model file packages. In the model publishing process, click on the long-term inflow model to view details. After importing the model package and automatically parsing the content, click "OK." The long-term inflow model is then added to the data management list and automatically updated with a version number, named "Long-term Inflow Model V1." Next, click on the short-term inflow forecasting model, water demand model, water allocation model, and scheduling model respectively, repeating the above steps. This adds the short-term inflow model, water demand model, water allocation model, and scheduling model to the data management list, named "Short-term Inflow Model V1," "Water Demand Model V1," "Water Allocation Model V1," and "Schedule Model V1," respectively. Figure 6 As shown in the figure. At this point, the relative access path for the uploaded model file has been generated (not shown in the figure).
[0056] Initially, each model in its initial state is tested by clicking "Test" to check if it can run successfully and output results. At this point, the model's status is "Testing." Once the model outputs results, the test is considered passed, and its status changes to "Ready." Only models in the "Ready" state can be activated. After activating, an API is generated, which the water resources business system can then directly call to input data and trigger the model's execution. Figure 7 , Figure 8 As shown. Specific real-time water resource monitoring or forecasting data (i.e., input data) are respectively from the water allocation model (e.g., Figure 18 (As shown in the figure), the input data graphs for the water demand model and the short-term water inflow model.
[0057] Each time a model runs, a model job is generated in instance management. If the test is to see if the model can run successfully, the model status will be "under testing". Figure 8 If the model test passes, the model state becomes ready, such as... Figure 9 Clicking on a model in the ready state will successfully enable it, such as... Figure 10 .
[0058] The results analysis button will only appear after the model assignment is completed, such as... Figure 11 As shown.
[0059] Review the results analysis separately. The results analysis includes three parts: line charts, data output, and output documents. For example... Figures 12-16 As shown.
[0060] The medium- and long-term inflow analysis provides data for each reservoir. The line graph shows the curve of the predicted flow rate over time, the output data is a table showing the changes in predicted flow rate and predicted water level over time, and the output file is the forecast output file for the next ten days / months. Each reservoir can be viewed separately.
[0061] The inflow results analysis includes the predicted inflow rate, predicted inflow volume, and soil moisture content for each reservoir. These can be viewed sequentially for each reservoir. The predicted inflow rate line graph shows the curve of the predicted inflow rate changing over time, with the corresponding data table. The output files are files for inflow rate, inflow volume, and soil moisture content. Similarly, the predicted inflow volume line graph shows the curve of the predicted inflow volume changing over time, with the corresponding data table. The output files are files for inflow rate, inflow volume, and soil moisture content. Likewise, the soil moisture content line graph shows the curve of soil moisture content changing over time, with the corresponding data table. The output files are files for inflow rate, inflow volume, and soil moisture content. Figure 13 As shown.
[0062] The water demand model results analysis covers the industrial, agricultural, domestic, ecological, and total water demand for each irrigated area. The bar charts show the changes in industrial, agricultural, domestic, and ecological water demand over time. The results data include tables of industrial, agricultural, domestic, ecological, and total water demand, and the final file is the water demand results file.
[0063] The water allocation model results analysis presents the optimized water allocation results for each irrigation surface. Bar charts show the time-varying water allocation for domestic, industrial, agricultural, and ecological purposes. The resulting data includes tables showing the time-varying data for rainfall runoff, reservoir discharge, upstream surplus water, total inflow, actual allocation, theoretical allocation, surplus water, domestic water demand, domestic water allocation, industrial water demand, industrial water allocation, agricultural water demand, agricultural water allocation, ecological water demand, and ecological water allocation. The resulting file contains the water allocation optimization results. Figure 14 As shown.
[0064] The scheduling model results analysis shows the required flow rate for each irrigation face and the opening degree for each gate. The irrigation face line graph shows the flow rate change over time, the output data is a table of flow rate changes over time, and the output file is the scheduling model result. The gate opening line graph shows the gate opening change over time, the output data is a table of gate opening changes over time, and the output file is the scheduling model result. For example... Figure 15 , Figure 16 As shown.
[0065] Task priority adjustment in the queue: If you need to increase the priority of a model job, click "Adjust Priority" in the runtime scheduler to adjust the model job priority. Increasing the priority will move the model job to the top of the queue, and decreasing it will move it to the bottom. For example... Figure 17 As shown.
[0066] It should be noted that the above content merely illustrates the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. For those skilled in the art, various improvements and modifications can be made without departing from the principle of the present invention, and all such improvements and modifications fall within the scope of protection of the claims of the present invention.
Claims
1. A method for standardizing parameters of a digital twin mechanism model for water resource allocation, characterized in that, Includes the following steps: S1, Build a digital twin model platform and configure a digital twin mechanism model; S2, through the constructed digital twin model platform, parses the uploaded model, obtains the parsing results, and generates the relative access path of the uploaded model file based on the parsing results; S3: Based on the relative access path of the generated uploaded model file, read the model file information and complete the addition of the model; S4 tests the results of S3 through the digital twin model platform, obtains the test results and the API address for calling and querying the configured digital twin mechanism model; S5 transmits real-time water resource monitoring or forecast data to the constructed digital twin model platform via API address, triggering model execution; S6: After the model runs, the model results analysis is obtained. The model results analysis data is called through the API address and the model results analysis is displayed.
2. The method for standardizing parameters of the digital twin mechanism model for water resource allocation according to claim 1, characterized in that, In step S2, a corresponding model file compressed package is uploaded according to the built-in model template. The model file compressed package is a packaged model file, which includes an example input file, an example output file, a parameter file, and a configuration file. The configuration file includes an input file list, an output file list, a log file, a recommended number of cores, steps, types, script templates, and solver fields. The input file list / output file list is used to describe the relative identifiers of the input / output files, which are the file names and descriptions.
3. The method for standardizing parameters of the digital twin mechanism model for water resource allocation according to claim 2, characterized in that, Step S2 specifically includes the following processes: S2.1, by reading the uploaded model file compressed package, determine whether the uploaded model file compressed package has a configuration file. If not, report an error. If it does, decompress the uploaded model file compressed package to obtain the current temporary decompression root directory. S2.2, perform existence checks on the files described in the configuration file, traverse the list of input files in the configuration file, calculate the target path for each input entry and check if it exists in the example input file. If the file does not exist, an error is reported, the user is prompted that the content is incomplete, and the traversal action is stopped, requiring re-uploading; if all files exist, the process continues. S2.3, based on the results of temporary decompression of the root directory and traversal, uses a path concatenation algorithm to generate the relative access path of the uploaded model file.
4. The method for standardizing parameters of the digital twin mechanism model for water resource allocation according to claim 1, characterized in that, Step S3 includes: S3.1 Based on the relative access path of the generated uploaded model file, obtain the parsed file of the model corresponding to the access path through an asynchronous network request; S3.2, use a linear traversal algorithm to traverse the parsed list of input files, read the file name and description of each data in the list of input files, map these two values to form attribute components and mount them in order; S3.3 Perform name uniqueness verification. Check whether the uploaded model name is the same as an existing model name. If there is a duplicate, prompt to rename it, and then complete the addition of the model.
5. The method for standardizing parameters of the digital twin mechanism model for water resource allocation according to claim 1, characterized in that, Step S4 includes: S4.1, construct a temporary running directory, copy the example input files in the model package to the corresponding input path location in this directory, and generate running commands based on the script template and solver to trigger model execution tests; S4.2 During test execution, the test is performed in the order of the preset test process and the status of each step is monitored. If an error flag is detected, the circuit breaker mechanism is triggered to stop the subsequent process and the test status is updated to failure. If all steps are successful, the status is updated to published, and the output file is generated in the output path of the temporary running directory. The filename in the output file is checked to see if it matches the filename in the output file list specified in the configuration file. If they do not match, the test status is updated to failure. If they match, a unique identifier for the model and a fixed network call address, i.e., the API address, is generated for calling.
6. The method for standardizing parameters of a digital twin mechanism model according to claim 5, characterized in that, The S5 process includes: S5.1, call the API address and pass in the input data about water resource scheduling that meets the requirements of the example input file. Generate a unique task serial number, and create a task folder DIR based on the task serial number. task ; S5.2, triggers model execution based on the model script and solver in S4.1; S5.3 displays the tasks to be executed in the model job list and adjusts the priority of model jobs using heap structure reconstruction.
7. The method for standardizing parameters of a digital twin mechanism model according to claim 6, characterized in that, The specific process in S5.3 includes: S5.3.1 Displays running and queued models in the model task list; S5.3.2 uses Go language slicing to construct a binary heap structure HeapQueue, such that any node i is related to its parent node. The inequality Priority(i) ≤ Priority(p) is always satisfied to ensure that high-priority jobs are always at the top, thereby enabling the adjustment of the priority of model jobs waiting to be run.
8. The method for standardizing parameters of a digital twin mechanism model according to claim 6, characterized in that, The S6 process includes: S6.1, after completing the run, parses and adjusts the format of each uploaded file based on its address and file type, converting the txt files into csv files; S6.2, determine the graphical display method based on the content of the CSV file and perform corresponding processing, specifically including: When the data contains a time field and needs to show the continuous change of status over time, the time column in the CSV is extracted as the X-axis, and the remaining columns are used as multiple Y-axis to display a line chart. An interpolation fitting algorithm is used to connect the discrete data points into a smooth curve. When the data contains a time field and the total amount within a unit of time needs to be displayed, the time column in the CSV is extracted as the X-axis and the remaining columns are used as the Y-axis. Each time point is mapped to an independent column container. The Y-axis directly reflects the value within that time period, and gaps are reserved between the columns to reflect the concept of intervals. S6.3 After the model runs, it generates the taskID and the corresponding output data from the input data in S5.1, and stores the output data in DIR. task In this context, querying and calling are achieved through taskID.
9. A parameter standardization system for a digital twin mechanism model, characterized in that, include: The building module is used to build a digital twin model platform and configure the digital twin mechanism model; The parsing module is used to parse the uploaded model through the constructed digital twin model platform, obtain the parsing results, and generate the access path of the uploaded model based on the parsing results; A new module has been added to read model file information based on the access path of the generated uploaded model and complete the addition of the model. The testing module is used to test the results obtained from the new module through the digital twin model platform, obtain the test results, and generate the API address for calling and querying the corresponding model. The execution module is used to transmit real-time water resource monitoring or forecasting data to the constructed digital twin model platform via API address, triggering model execution; The analysis and display module generates model result analysis after the model runs. It calls the model result analysis data through the API address and displays the model result analysis.
Citation Information
Patent Citations
Job scheduling optimization method, device and apparatus based on priority, and storage medium
CN110427256A
Machine learning model management method and device, management platform and storage medium
CN115293365A
Industrial model platformization implementation method and system
CN115708114A
Digital twin hydraulic engineering operation and maintenance monitoring system and method based on multi-modal data
CN121637831A