Batch simulation method, apparatus, and system
By using parameter processing container groups and task allocation container groups on the K8s cluster server to dynamically adjust the number of model container groups, efficient parallel processing of photovoltaic power plant simulation is achieved, solving the problem of excessive simulation time in existing technologies and improving simulation efficiency and resource utilization.
Patent Information
- Application Number
- CN202210555180.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-05-20
AI Technical Summary
Existing photovoltaic power plant simulation software takes too long to perform large-scale batch simulations and cannot efficiently handle a large number of simulation tasks.
Using a K8s cluster server, simulation parameters are parsed through parameter processing container groups, the number of model container groups is dynamically adjusted through task allocation container groups, simulation tasks are processed in parallel, and the model container groups perform simulations and obtain results.
It improves the processing efficiency of simulation tasks and the utilization rate of server resources, and realizes seamless connection and efficient parallel processing of multiple simulation tasks.
Smart Images

Figure CN115048771B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of cloud simulation technology, and in particular to a batch simulation method, apparatus and system. Background Technology
[0002] With the continuous expansion of the photovoltaic industry, the number of grid-connected photovoltaic power plants is increasing. Since simulating the power generation capacity of photovoltaic power plants can guide their design and operation, the demand for such simulations is growing rapidly. To explore the impact of different design schemes on the power generation of a photovoltaic power plant, or to find the optimal power generation design, it is necessary to change the values of multiple simulation variables within a certain range. These variables include the azimuth angle, tilt angle, spacing between rows, height above ground, and number of strings of the modules. Assuming a simulation project includes three parameters, each with ten possible values, there are a thousand possible parameter combinations, requiring one thousand simulations.
[0003] Currently, large-scale batch simulations using conventional photovoltaic simulation software (such as PVsyst) are too time-consuming. Summary of the Invention
[0004] This invention provides a batch simulation method, apparatus, and system to improve the processing efficiency of simulation tasks.
[0005] In a first aspect, embodiments of the present invention provide a batch simulation method, which is applied to a K8s cluster server, the K8s cluster server including multiple servers;
[0006] Batch simulation methods include:
[0007] The parameter processing container group parses the simulation parameters of each simulation project to obtain multiple simulation tasks;
[0008] The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server.
[0009] The task allocation container group queries the status of each model container group based on the number of model container groups in each server, and dispatches simulation tasks according to the status of the model container group.
[0010] The model container group performs simulations on the simulation task and obtains simulation results.
[0011] Optionally, before allocating the number of model container groups for each server, the following steps are included:
[0012] Create a group of model containers on any server;
[0013] The model container group sequentially simulates any simulation task of each simulation project to obtain the server resource consumption rate of any simulation task in each simulation project.
[0014] Optionally, methods for allocating the number of model container groups to each server include:
[0015] The target resource consumption rate for each server is determined based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by the model container group of each server.
[0016] The upper limit of the number of model container groups for each server is determined based on the target resource consumption rate and the resource idle rate of each server.
[0017] Adjust the number of model container groups on each server based on the maximum number of model container groups per server.
[0018] Optionally, the method for determining the target resource consumption rate for each server includes:
[0019] Determine the number of simulation projects that each server can process;
[0020] Determine if the number of simulation projects processed by each server is greater than 1:
[0021] If so, the target resource consumption rate is the maximum resource consumption rate of the simulation task currently being processed by the server's model container group;
[0022] Otherwise, the target resource consumption rate is the resource consumption rate of the simulation tasks currently being processed by the model container group on the server.
[0023] Optionally, after the model container group simulates the simulation task, it also includes:
[0024] The model container group sends the simulation results to the display container group.
[0025] Optionally, after the model container group obtains the simulation task, the state of the model container group is changed to the simulation state;
[0026] After the model container group sends the simulation results to the display container group, the model container group deletes the simulation task and changes the status of the model container group to idle.
[0027] Optionally, multiple simulation results from multiple model container groups belonging to the same simulation project can be displayed in the same display container group.
[0028] Optionally, after the model container group simulates the simulation task, it also includes:
[0029] If the model container group simulation fails, restart the model container group and the model container group will reprocess the simulation task.
[0030] If the simulation is normal after restarting the model container group, the model container group will send the simulation results to the display container group.
[0031] If the simulation still fails after restarting the model container group, continue to restart the model container group until the simulation is normal or the number of restarts reaches the preset number.
[0032] Secondly, embodiments of the present invention also provide a batch simulation device, which is applied to a K8s cluster server, the K8s cluster server including multiple servers;
[0033] The batch simulation device includes:
[0034] The parameter processing container group is used to parse the simulation parameters of each simulation project to obtain multiple simulation tasks;
[0035] Task allocation container groups are used to allocate the number of model container groups to each server based on the resource consumption rate of simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server.
[0036] The task allocation container group is used to query the status of each model container group based on the number of model container groups in each server, and to dispatch simulation tasks according to the status of the model container group.
[0037] Model container groups are used to simulate simulation tasks and obtain simulation results.
[0038] Thirdly, embodiments of the present invention also provide a batch simulation system, which includes a simulation parameter collection device, a K8s cluster server, and a simulation result display device;
[0039] Both the simulation parameter collection device and the simulation result display device are connected to the K8s cluster server; the K8s cluster server is used to execute any of the batch simulation methods proposed in the above embodiments.
[0040] This invention, through a parameter processing container group, parses the simulation parameters of each simulation project. It can extract all possible values of the simulation parameters for the same project and configure all simulation parameters for that project. Each different configuration of simulation parameters constitutes the simulation content corresponding to each simulation task. This ensures that all configurations of simulation parameter combinations are simulated subsequently, leading to the optimal design solution. The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server. This allows the task allocation container group to increase or decrease the number of model container groups processing simulation tasks in real time, thereby increasing the number of model container groups processing simulation tasks in parallel, improving the processing efficiency of simulation tasks, and increasing the resource utilization of each server. The task allocation container group queries the status of each model container group based on the number of model container groups in each server and dispatches simulation tasks according to the status of the model container groups. This allows for seamless connection between each model container group processing new and old tasks, further improving simulation processing efficiency. The model container groups perform simulations on the simulation tasks to obtain simulation results. In summary, compared with existing simulation methods, this scheme can process multiple simulation tasks in parallel, thereby improving the processing efficiency of simulation. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 A flowchart illustrating a batch simulation method provided in an embodiment of the present invention;
[0043] Figure 2 A schematic diagram illustrating the relationship between a container group and a container provided by the present invention;
[0044] Figure 3 A flowchart illustrating another batch simulation method provided in an embodiment of the present invention;
[0045] Figure 4 A flowchart illustrating a method for allocating the number of model container groups for each server, provided in an embodiment of the present invention;
[0046] Figure 5 A flowchart illustrating a method for determining the target resource consumption rate of each server, provided in an embodiment of the present invention;
[0047] Figure 6This invention provides a schematic diagram of a business process for simulated engineering processing.
[0048] Figure 7 This is a schematic diagram of the structure of a batch simulation device provided in an embodiment of the present invention;
[0049] Figure 8 This is a schematic diagram of the structure of a batch simulation system provided in an embodiment of the present invention. Detailed Implementation
[0050] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0051] It should be noted that the terms "target," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the term "comprising" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0052] This embodiment is applicable to situations requiring batch simulation. The method can be executed by a batch simulation device, which can be implemented in hardware and / or software. This batch simulation method is applied to a Kubernetes cluster server, which comprises multiple servers. Figure 1 This is a flowchart illustrating a batch simulation method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, batch simulation specifically includes the following steps:
[0053] S110, the parameter processing container group parses the simulation parameters of each simulation project to obtain multiple simulation tasks.
[0054] Specifically, the parameter processing container group is configured within a Kubernetes (K8s) cluster server. A K8s cluster server refers to a cluster of servers with K8s software installed. A server cluster involves bringing together many servers to perform the same service. This allows for parallel computing across multiple computers, resulting in high computational speed. Furthermore, multiple computers can be used for backup; even if one server fails, the other servers in the cluster can continue to operate normally, and no data will be lost.
[0055] Kubernetes (K8s) is a container orchestration and management tool used to manage containerized applications across multiple servers in a cloud platform. Its goal is to make deploying containerized applications simple and efficient. Specifically, Kubernetes can automatically schedule containers based on the performance and load of each server in the cluster. For example, it can schedule containers to run on the server with the best performance or the server with the least available resources. Furthermore, it can automatically restart and resume operation if a container unexpectedly terminates. Each container on a server is isolated from the others, each has its own file system, and processes within containers do not interfere with each other, allowing for the differentiation of computing resources.
[0056] A container is a virtual environment that contains business software and the components required for the software to run. For example, if a photovoltaic simulation model is written in Python script, then the photovoltaic simulation container contains the photovoltaic simulation model Python script, the Python interpreter, and the Python dependency packages.
[0057] Furthermore, this solution is applied to Kubernetes (K8s) cluster servers, allowing containers to run within containers called container groups. A container group contains all the containers needed to run a piece of software. For example, in a photovoltaic (PV) simulation on a K8s cluster server, the simulation needs to be performed within a PV simulation model container group. Besides running the PV simulation model, this also requires running a logging program that records error messages when simulation errors occur. The PV simulation program and the logging program run as containers within a single PV simulation model container group—namely, the PV simulation container and the logging program container. The PV simulation model container group can be viewed as a complete PV simulation program. Multiple container groups can run simultaneously on a single K8s cluster server, enabling the concurrent execution of multiple simulation programs.
[0058] For example, Figure 2 This invention provides a schematic diagram illustrating the relationship between a container group and its containers, as shown below. Figure 2As shown, the photovoltaic simulation model container group 10 includes a photovoltaic simulation container 11 and a logger container 12. The photovoltaic simulation container 11 includes a photovoltaic simulation model Python script 111, a Python interpreter 112, and a Python dependency package 113. The logger container 12 includes a logger jar package 121, a Java interpreter 122, and a Java dependency package 123.
[0059] In summary, simulation software can be deployed as container groups on a Kubernetes cluster server, allowing each container group to execute simulation tasks independently without interfering with each other.
[0060] Furthermore, the parameter processing container group is a container group that processes all simulation parameters received from the same simulation project. Simulation parameters are quantities that vary within a certain range in the simulation project. For example, the simulation parameters of a photovoltaic simulation project include the module azimuth range, module azimuth step size, tilt angle range, tilt angle step size, front-to-back row spacing range, and front-to-back row spacing step size. The parameter processing container group can parse out the possible values of all simulation parameters for the same project and configure all simulation parameters for the same project. Each combination of simulation parameters with different configurations obtained in this way constitutes the simulation content corresponding to each simulation task.
[0061] For example, suppose the parameter processing container group receives simulation parameters A, B, and C from a simulation project. The values for simulation parameters A, B, and C are all in the range of 1-10; all three are positive integers. The parameter processing container group can parse out ten possible values for simulation parameters A, B, and C: 1, 2, 3, 4, ..., 8, 9, 10; ten possible values for simulation parameters B, B, and C: 1, 2, 3, 4, ..., 8, 9, 10. After configuring simulation parameters A, B, and C with different values, the parameter processing container group can generate 1000 different simulation tasks. Among the 1000 different simulation tasks, simulation task one can be: simulation parameter A=1, simulation parameter B=1, simulation parameter C=1; simulation task two can be: simulation parameter A=1, simulation parameter B=2, simulation parameter C=1; and so on.
[0062] S120. The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server.
[0063] Specifically, task allocation container groups are configured within the Kubernetes cluster servers. These groups can dynamically adjust the number of model container groups on each server based on its load, and then dynamically allocate simulation tasks to these model container groups after adjustment, enabling multiple batch simulation projects to run concurrently. A model container group is a group of containers that handles simulation tasks; one model container group can process one simulation task.
[0064] Because different simulation projects have different simulation parameter configurations, the computational load of simulation tasks varies across projects (for example, enabling shadow occlusion evaluation increases computational load). Therefore, before batch simulations begin, it is necessary to pre-obtain the resource consumption rate required for any simulation task in each simulation project within the simulation model container group. Thus, at the start of batch simulations, the task allocation container group can obtain the resource consumption rate of simulation tasks from different simulation projects currently being processed by the model container group on each server.
[0065] Additionally, the resource idle rate of each server refers to the remaining resource rate of each server. At the start of batch simulation, the task allocation container group needs to obtain in real-time the resource consumption rate of simulation tasks in different simulation projects currently being processed by each server's model container group and the resource idle rate of each server. This allows the calculation of the upper limit for the number of model container groups that can be set, and the adjustment of the number of model container groups created within each server based on this upper limit. For example, if a server's model container group is currently processing only one simulation project, and the resource consumption rate of that simulation project is 0.2%, and the server's resource idle rate is 20%, then the upper limit for the number of model container groups that can be set on that server is 20% / 0.2% = 100. If the number of model container groups on that server is 80, the task allocation container group will create 20 model container groups; if the number of model container groups on that server is 110, the task allocation container group will delete 10 model container groups. Therefore, the number of model container groups that process simulation tasks can be increased or decreased in real time, thereby increasing the number of model container groups that process simulation tasks in parallel, improving the processing efficiency of simulation tasks, and increasing the resource utilization of each server.
[0066] S130. The task allocation container group queries the status of each model container group based on the number of model container groups in each server, and dispatches simulation tasks according to the status of the model container group.
[0067] Within this system, model container groups on each server can dynamically release server resources after completing simulation tasks. The task allocation container group can create a model container group resource table, which contains the interface address and status of each model container group. The status of each model container group in the resource table is updated in real time. The task allocation container group can consult the model container group resource table to obtain the status and address of each model container group, enabling it to promptly and accurately assign simulation tasks to model container groups without existing tasks. In summary, the task allocation container group can achieve seamless transitions between handling new and old tasks for each model container group, without needing to monitor the number of simulations for each model container group or wait for other model container groups on the same server to complete their simulation tasks before unified allocation, thereby further improving simulation processing efficiency. For example, assuming there are 3 servers, each containing 10 model container groups, and currently 35 simulation tasks, the task allocation container group will continuously monitor the status of the current 30 task allocation container groups. Once a task allocation container group is in an idle state, the task allocation container group will assign simulation tasks to that idle model container group. Once an idle model container group receives a simulation task, its state changes to simulation state until the simulation task is completed.
[0068] S140, the model container group performs simulation on the simulation task and obtains simulation results.
[0069] The model container groups are configured within the Kubernetes cluster servers. Each model container group corresponds to one simulation task. Each model container in each server is independent and does not interfere with each other. After completing a simulation task, resources can be released in a timely manner to take on new simulation tasks.
[0070] This invention, through a parameter processing container group, parses the simulation parameters of each simulation project. It can extract all possible values of the simulation parameters for the same project and configure all simulation parameters for that project. Each different configuration of simulation parameters constitutes the simulation content corresponding to each simulation task. This ensures that all configurations of simulation parameter combinations are simulated subsequently, leading to the optimal design solution. The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server. This allows the task allocation container group to increase or decrease the number of model container groups processing simulation tasks in real time, thereby increasing the number of model container groups processing simulation tasks in parallel, improving the processing efficiency of simulation tasks, and increasing the resource utilization of each server. The task allocation container group queries the status of each model container group based on the number of model container groups in each server and dispatches simulation tasks according to the status of the model container groups. This allows for seamless connection between each model container group processing new and old tasks, further improving simulation processing efficiency. The model container groups perform simulations on the simulation tasks to obtain simulation results. In summary, compared with existing simulation methods, this scheme can process multiple simulation tasks in parallel, thereby improving the processing efficiency of simulation.
[0071] Figure 3 This is a flowchart illustrating another batch simulation method provided in an embodiment of the present invention, as shown below. Figure 3 As shown, batch simulation specifically includes the following steps:
[0072] S210, the parameter processing container group parses the simulation parameters of each simulation project to obtain multiple simulation tasks.
[0073] S220. Create a model container group on any server.
[0074] It should be noted that different simulation projects have different simulation parameter configurations, which will lead to different simulation computation amounts for simulation tasks in different simulation projects (for example, enabling shadow occlusion evaluation will increase the computation amount). Therefore, before starting batch simulation, it is necessary to obtain in advance the resource consumption rate required for any simulation task in each simulation project to be simulated in the simulation model container group.
[0075] Before the batch simulation begins, the task allocation container determines the number of model container groups that need to be created on each server, and at this point, multiple model container groups are not required to process simulation tasks in parallel. Therefore, since the resource consumption rate required for any simulation task in each simulation project to be simulated in the simulation model container group is obtained in advance, only one model container group needs to be temporarily created on any server.
[0076] S230 and the model container group sequentially simulate any simulation task of each simulation project to obtain the server resource consumption rate of any simulation task of each simulation project.
[0077] Specifically, model container groups consume the same amount of resources when processing simulation tasks belonging to the same simulation project. Therefore, a model container group only needs to simulate any one simulation task from each simulation project. The model container group performs simulations according to the order in which it receives any simulation task from each simulation project. While simulating any simulation task from each simulation project, the model container group continuously monitors the resource consumption rate of the server to which it belongs until the simulation is completed. After monitoring, it records the server resource consumption rate for each simulation project's simulation tasks processed by the model container group. The server resource consumption rate includes the peak utilization rate of the server's CPU. This allows for obtaining the server resource consumption rate for any simulation task from each simulation project, facilitating subsequent task allocation container group queries for the resource consumption rates of simulation tasks from different simulation projects currently being processed by each server's model container group. Furthermore, it enables the allocation of the number of model container groups to each server based on the resource consumption rates of simulation tasks from different simulation projects currently being processed by each server's model container group and the resource idle rate of each server. This increases the number of model container groups capable of parallel processing of simulation tasks, improves the processing efficiency of simulation tasks, and increases the resource utilization rate of each server.
[0078] S240. The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server.
[0079] S250: The task allocation container group queries the status of each model container group based on the number of model container groups in each server, and dispatches simulation tasks according to the status of the model container group.
[0080] S260 and the model container group perform simulation tasks and obtain simulation results.
[0081] In summary, this scheme creates a model container group on any server before allocating the number of model container groups to each server. The model container group sequentially simulates any simulation task of each simulation project, obtaining the resource consumption rate of each simulation task on the server. This facilitates the subsequent task allocation container group in querying the resource consumption rate of simulation tasks of different simulation projects currently being processed by the model container group on each server. The task allocation container group can then allocate the number of model container groups to each server based on the resource consumption rate of simulation tasks of different simulation projects currently being processed by the model container group on each server and the resource idle rate of each server. This increases the number of model container groups that can process simulation tasks in parallel, improves the processing efficiency of simulation tasks, and increases the resource utilization of each server.
[0082] For example, Figure 4 This is a flowchart illustrating a method for allocating the number of model container groups on each server according to an embodiment of the present invention. Based on the above embodiment, the method for allocating the number of model container groups on each server is further described in detail:
[0083] S310. Determine the target resource consumption rate for each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by the model container group of each server.
[0084] The target resource consumption rate is the maximum value that the simulation tasks of different simulation projects currently being processed by the model container group on the server cannot exceed. Therefore, resources are allocated to each model container group in the server based on the target resource consumption rate, so as to ensure that each model container group can process the simulation tasks of different simulation projects normally, thereby improving the processing efficiency of simulation tasks to a certain extent.
[0085] S320. Determine the upper limit of the number of model container groups for each server based on the target resource consumption rate and the resource idle rate of each server.
[0086] For example, the maximum number of model container groups on a server is equal to the server's resource idle rate divided by the server's target resource consumption rate.
[0087] S330. Adjust the number of model container groups on each server according to the maximum number of model container groups on each server.
[0088] The task allocation container group increases or decreases the number of model container groups for processing simulation tasks in real time based on the upper limit of the number of model container groups on each server. This can increase the number of model container groups for parallel processing of simulation tasks, improve the processing efficiency of simulation tasks, and increase the resource utilization of each server.
[0089] In summary, this solution determines and adjusts the number of model container groups on each server by using the target resource consumption rate and the resource idle rate of each server. This ensures that all model container groups within the server can process simulation tasks normally, thereby improving the processing efficiency of simulation tasks and increasing the resource utilization of each server to a certain extent.
[0090] For example, Figure 5 This is a flowchart illustrating a method for determining the target resource consumption rate of each server according to an embodiment of the present invention. Based on the above embodiment, the method for determining the target resource consumption rate of each server is further described in detail:
[0091] S410. Determine the number of simulation projects that each server can process.
[0092] Each simulation project is assigned a unique identity document (ID), and simulation tasks belonging to the same simulation project all have the same ID. Therefore, the number of simulation projects processed by each server can be determined based on the simulation tasks currently being processed by the model container group of each server.
[0093] S420. Determine whether the number of simulation projects processed by each server is greater than 1.
[0094] S430. If so, the target resource consumption rate is the maximum resource consumption rate of the simulation task currently being processed by the model container group on the server.
[0095] For example, suppose there are two simulation projects running on the server. The resource consumption rate of any simulation task in simulation project 1 processed by the model container group is Q1, and the resource consumption rate of any simulation task in simulation project 2 processed by the model container group is Q2. Where Q2>Q1, then the target resource consumption rate is Q2.
[0096] S440. Otherwise, the target resource consumption rate is the resource consumption rate of the simulation tasks currently being processed by the model container group on the server.
[0097] For example, assuming there is only one simulation project running on the server, and the resource consumption rate of the model container group for processing any simulation task in that simulation project is Q1, then the target resource consumption rate is Q1.
[0098] In summary, the target resource consumption rate determined by the above method can ensure that all model container groups within the server can process simulation tasks normally, thereby improving the processing efficiency of simulation tasks and increasing the resource utilization of each server to a certain extent.
[0099] Exemplarily, based on the above embodiments, an example of the method for allocating the number of model container groups for each server is given:
[0100] Suppose there is only one simulation project 1 in server R for simulation. The resource consumption rate of any simulation task in simulation project 1 processed by the model container group is Q1. At this time, the target resource consumption rate is Q1, the upper limit of the number of model container groups in server R is M1, and the task allocation container group adjusts the number of model container groups in server R to M1.
[0101] Suppose at a certain moment, a new simulation project 2 is added to server R for simulation. The resource consumption rate of any simulation task in simulation project 1 processed by the model container group is Q1, and the resource consumption rate of any simulation task in simulation project 2 processed by the model container group is Q2. If Q2 < Q1, then the target resource consumption rate is Q1 at this time, and the number of model container groups in server R remains M1 without adjustment. If Q2 > Q1, then the target resource consumption rate is Q2 at this time, the number of model container groups in server R is M2, and the task allocation container group needs to reduce the number of model container groups.
[0102] Based on the above embodiments, after obtaining the simulation results, the simulation results need to be stored. The following is a specific description:
[0103] Optionally, after the model container group simulates the simulation task, it further includes: the model container group sends the simulation results to the display container group.
[0104] Specifically, the display container group is the container group for storing and displaying the simulation results. The model container group sends the simulation results to the display container group, which is convenient for viewing the operation results of the simulation task and selecting the optimal simulation parameter configuration according to the simulation results.
[0105] Specifically, the multiple simulation results of multiple model container groups belonging to the same simulation project are displayed in the same display container group.
[0106] Among them, displaying the multiple simulation results of multiple model container groups belonging to the same simulation project in the same display container group is convenient for comparing all the simulation results and is easy to analyze or select the optimal simulation parameter configuration.
[0107] Optionally, after the model container group obtains the simulation task, the status of the model container group is modified to the simulation status; after the model container group sends the simulation results to the display container group, the model container group deletes the simulation task and modifies the status of the model container group to the idle status.
[0108] It should be noted that the model container group resource table created by the task allocation container group can be updated in real time according to the status of each model container group. This allows the task allocation container to promptly and accurately assign simulation tasks to model container groups that do not have simulation tasks, achieving a seamless transition between processing new and old tasks for each model container group, thereby further improving the processing efficiency of simulation.
[0109] Based on the above embodiments, if the simulation of the model container group fails and simulation results cannot be obtained after the model container group has performed the simulation task, the following is a detailed explanation:
[0110] Optionally, after the model container group simulates the simulation task, it also includes:
[0111] If the model container group experiences a simulation error, restart the model container group, and the model container group will reprocess the simulation task.
[0112] If the simulation is normal after restarting the model container group, the model container group will send the simulation results to the display container group.
[0113] If the simulation still fails after restarting the model container group, continue to restart the model container group until the simulation is normal or the number of restarts reaches the preset number.
[0114] If the simulation still fails after the preset number of restarts, the model container group can send the error information to the result display container group based on the simulation project ID. The model container group will then delete the simulation task and change its status to idle, waiting to be assigned a new simulation task.
[0115] For example, the preset number of restarts for simulation errors is two. If a simulation task fails or is unexpectedly terminated, the model container group pushes the error message to the corresponding result display container group based on the simulation project ID in the simulation parameters. Subsequently, the model container group is restarted to re-start the simulation. If it fails again, the model container group pushes the error message to the corresponding result display container group based on the simulation project ID in the simulation parameters, deletes the simulation configuration, and sets its status to "idle," waiting to be assigned a new simulation task.
[0116] In summary, if a simulation task is unexpectedly terminated, it can be restarted without affecting the normal operation of other model container groups, thus preventing data loss.
[0117] Figure 6 This invention provides a schematic diagram of a business process for simulated engineering processing. For example... Figure 6 As shown.
[0118] 1) Users can create simulation project 710 by running a parameter collection program on the simulation parameter collection device and input photovoltaic simulation parameters, such as the module azimuth range, module azimuth step size, tilt angle range, tilt angle step size, front-to-back row spacing range, and front-to-back row spacing step size. The parameter collection program assigns a unique ID to each simulation project 710. The parameter collection program transmits the simulation parameters to the Kubernetes cluster server via the HTTP protocol, which includes the ID of the simulation project 710. For example, the simulation parameters can be transmitted to the Kubernetes cluster server in JSON file format via a RESTful API.
[0119] 2) Run the parameter processing program in the parameter processing container group 720 in the K8s cluster server to parse the simulation parameters. It should be noted that different simulation projects 710 have different simulation parameter configurations, which will lead to different photovoltaic simulation computational loads (for example, enabling shading evaluation will increase the computational load). Therefore, before each batch simulation starts, it is necessary to first evaluate the CPU resources required to run a single photovoltaic simulation model container group 740.
[0120] First, randomly select one parameter from the parameter configuration parsed in step 2) and send it as a JSON file to any server in the cluster via a RESTful API. Create a model container group 740 on that server and perform photovoltaic simulation based on the received simulation parameters. Continuously monitor the CPU utilization of model container group 740 on that server until the simulation is complete, and record the peak CPU utilization δmax for a single simulation. When multiple simulation projects 710 are running in parallel, evaluate the CPU resources required by a single photovoltaic simulation model container group 740 for each simulation project 710, and take the maximum value as δmax.
[0121] 3) Task allocation container group 730 collects the CPU idle rate δspare of each server in the K8s cluster server, calculates the maximum number of model container groups 740 in each server as M = δspare / δmax, and creates a model container group resource table. The model container group resource table contains the interface address and current status (idle / in simulation) of each model container group 740. Subsequently, task allocation container group 730 creates the corresponding number of model container groups 740 in each server of the K8s cluster server.
[0122] 4) When a new simulation project 710 starts, evaluate the CPU resources required by each single photovoltaic simulation model container group 740 of the simulation project 710, take the maximum value as δmax, and update the value of M according to the maximum peak CPU occupancy rate of a single simulation δmax and the CPU idle rate δspare of each server. Exemplarily, assume that there is originally a simulation project 710 running in the K8s cluster server, the peak CPU occupancy rate of a single simulation is δmax1, and the upper limit of the number of model container groups 740 in each server is M1. At this time, a new simulation project 710 starts, and the peak CPU occupancy rate of a single simulation is δmax2. If δmax2 < δmax1, then take δmax = δmax1, and the upper limit of the number of model container groups 740 in each server remains M1 unchanged; if δmax2 > δmax1, then take δmax = δmax2, and the upper limit of the number of model container groups 740 in each server becomes M2 = δspare / δmax2; since M2 < M1 at this time, the number of model container groups 740 needs to be reduced. At this time, the task allocation container group 730 deletes the model container groups 740 in the "idle" state in the model container group resource table until the number of existing model container groups 740 becomes M2.
[0123] 5) The parameter processing container group 720 sends the determined simulation parameter configuration (including the ID of the simulation project 710) to the task allocation container group 730 in the form of a json file through the Restful API, and the task allocation container group 730 dispatches simulation tasks according to the status of each model container group 740.
[0124] 6) In the K8s cluster server, create a corresponding result display container group 750 according to the number of simulation projects 710, and a simulation result display program runs in the result display container group 750.
[0125] 7) When the model container group 740 receives the simulation parameter configuration, it starts the simulation task and sets the status to "simulating". When the simulation is completed, it sends the simulation result to the corresponding result display container group 750 in the form of a json file through the Restful API according to the ID of the simulation project 710 in the simulation parameter configuration, then deletes the simulation configuration, changes the status to "idle", and waits to be dispatched a new simulation task. Every time the status of the model container group 740 changes, it synchronizes the status to the task allocation container group 730.
[0126] 8) If a simulation task fails or is aborted unexpectedly, the model container group 740 pushes the error message to the corresponding result display container group 750 according to the ID of the simulation project 710 in the simulation parameter configuration; subsequently, the model container group 740 is restarted to resume the simulation. If it fails again, the model container group 740 pushes the error message to the corresponding result display container group 750 according to the ID of the simulation project 710 in the simulation parameter configuration, deletes the simulation configuration, and changes the status to "idle" to wait for a new simulation task to be dispatched.
[0127] 9) When all simulation tasks in a simulation project 710 are completed, the result display container group 750 presents the simulation results (and error messages) on a display device, such as a computer monitor, mobile phone, etc.
[0128] Exemplarily, continue to refer to Figure 6 , assume that there are 2 simulation projects 710 in server R for simulation. After being parsed by the parameter processing container group 720, the simulation project 711 obtains 5 tasks. The resource consumption rate for the model container group 740 to process any simulation task in the simulation project 711 is Q1. At this time, the target resource consumption rate is Q1, and the upper limit of the number of model container groups 740 in server R is 4. The task allocation container group 730 adjusts the number of model container groups 740 in server R to 4, namely the model container group 741, the model container group 742, the model container group 743, and the model container group 744. When the result display container group 751 displays the simulation results of 4 simulation tasks in the simulation project 711, the simulation project 712 starts the simulation. After being parsed by the parameter processing container group 720, the simulation project 712 obtains 4 tasks. The resource consumption rate for the model container group 740 to process any simulation task in the simulation project 712 is Q2. If Q2 < Q1 at this time, it is determined that the target resource consumption rate is Q1, and the number of model container groups 740 in server R remains 4. The task allocation container group 730 does not need to adjust the number of model container groups 740. When the result display container group 751 displays the simulation results of 5 simulation tasks in the simulation project 711, the simulation project 711 is completed. When the result display container group 752 displays the simulation results of 4 simulation tasks in the simulation project 712, the simulation project 712 is completed.
[0129] Figure 7 The structural schematic diagram of a batch simulation device provided by an embodiment of the present invention is shown as Figure 7 shown. This batch simulation device is applied to a K8s cluster server, and the K8s cluster server includes multiple servers;
[0130] The batch simulation device includes:
[0131] A parameter processing container group 610, configured to parse the simulation parameters of each simulation project to obtain multiple simulation tasks;
[0132] Task allocation container group 620 is used to allocate the number of model container groups to each server based on the resource consumption rate of simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server.
[0133] Task allocation container group 620 is used to query the status of each model container group based on the number of model container groups in each server, and dispatch simulation tasks according to the status of the model container group.
[0134] Model container group 630 is used to simulate simulation tasks and obtain simulation results.
[0135] This invention, through a parameter processing container group, parses the simulation parameters of each simulation project. It can extract all possible values of the simulation parameters for the same project and configure all simulation parameters for that project. Each different configuration of simulation parameters constitutes the simulation content corresponding to each simulation task. This ensures that all configurations of simulation parameter combinations are simulated subsequently, leading to the optimal design solution. The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by each server's model container group and the resource idle rate of each server. This allows the task allocation container group to increase or decrease the number of model container groups processing simulation tasks in real time, thereby increasing the number of model container groups processing simulation tasks in parallel, improving the processing efficiency of simulation tasks, and increasing the resource utilization of each server. The task allocation container group queries the status of each model container group based on the number of model container groups in each server and dispatches simulation tasks according to the status of the model container groups. This allows for seamless connection between each model container group processing new and old tasks, further improving simulation processing efficiency. The model container groups perform simulations on the simulation tasks to obtain simulation results. In summary, compared with existing simulation methods, this scheme can process multiple simulation tasks in parallel, thereby improving the processing efficiency of simulation.
[0136] Optionally, before allocating the number of model container groups to each server in the task allocation container group,
[0137] Task assignment container groups are also used to create model container groups on any server;
[0138] The resource monitoring module performs simulations on any simulation task of each simulation project in the model container group in sequence to obtain the resource consumption rate of the server for any simulation task of each simulation project.
[0139] Optionally, task assignment container groups are also specifically used for
[0140] The target resource consumption rate for each server is determined based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by the model container group of each server.
[0141] The upper limit of the number of model container groups for each server is determined based on the target resource consumption rate and the resource idle rate of each server.
[0142] Adjust the number of model container groups on each server based on the maximum number of model container groups per server.
[0143] Optionally, task assignment container groups are also specifically used for
[0144] Determine the number of simulation projects that each server can process;
[0145] Determine if the number of simulation projects processed by each server is greater than 1:
[0146] If so, the target resource consumption rate is the maximum resource consumption rate of the simulation task currently being processed by the server's model container group;
[0147] Otherwise, the target resource consumption rate is the resource consumption rate of the simulation tasks currently being processed by the model container group on the server.
[0148] Optionally, the batch simulation apparatus also includes a display container group;
[0149] The display container group is used to display the simulation results obtained by the model container group in processing simulation tasks.
[0150] Optionally, after the model container group obtains the simulation task, the state of the model container group is changed to the simulation state;
[0151] After the model container group sends the simulation results to the display container group, the model container group deletes the simulation task and changes the status of the model container group to idle.
[0152] Optionally, multiple simulation results from multiple model container groups belonging to the same simulation project can be displayed in the same display container group.
[0153] Optionally, after the model container group simulates the simulation task,
[0154] The restart module is used to restart the model container group if the simulation of the model container group is abnormal, and the model container group will reprocess the simulation task.
[0155] The model container group is also used to send the simulation results to the display container group if the simulation is normal after restarting the model container group;
[0156] The restart module is also used to continue restarting the model container group if the simulation is still abnormal after restarting, until the simulation is normal or the number of restarts reaches the preset number.
[0157] The batch simulation device provided in the embodiments of the present invention can execute the batch simulation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0158] Figure 8 A schematic diagram of a batch simulation system is provided as an embodiment of the present invention, such as... Figure 8 As shown, the batch simulation system includes a simulation parameter collection device 810, a K8s cluster server 820, and a simulation result display device 830; both the simulation parameter collection device 810 and the simulation result display device 830 are communicatively connected to the K8s cluster server 820; the K8s cluster server 820 is used to execute the batch simulation method provided in any embodiment of the present invention.
[0159] The simulation parameter collection device 810 is used to collect simulation parameters for each simulation project and send these parameters to the Kubernetes cluster server 820 via the HTTP protocol. The simulation parameter collection device 810 may include devices such as mobile phones or computers. The Kubernetes cluster server 820 includes at least three servers with identical configurations and performance, and these servers can interact with each other via the HTTP protocol. The simulation result display device 830 is used to display the simulation results. The Kubernetes cluster server 820 can send the simulation results to the simulation result display device 830 via the HTTP protocol. The simulation result display device 830 may include devices such as mobile phones or computers.
[0160] Furthermore, the batch simulation system includes a batch K8s cluster server 820 provided in any embodiment of the present invention. The K8s cluster server 820 is used to execute the batch simulation method provided in any embodiment of the present invention. Therefore, the batch simulation system can execute the batch simulation method provided in any embodiment of the present invention and has the corresponding functional modules and beneficial effects of the execution method.
[0161] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0162] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A batch simulation method, characterized in that, This is applied to a K8s cluster server, which includes multiple servers; The batch simulation method includes: The parameter processing container group parses the simulation parameters of each simulation project to obtain multiple simulation tasks; The task allocation container group allocates the number of model container groups to each server based on the resource consumption rate of the simulation tasks of the different simulation projects currently being processed by the model container group of each server and the resource idle rate of each server. The task allocation container group queries the status of each model container group based on the number of model container groups in each server, and dispatches the simulation task according to the status of the model container group. The model container group performs the simulation task and obtains the simulation results.
2. The batch simulation method according to claim 1, characterized in that, Before allocating the number of model container groups for each of the servers, the following steps are included: Create the model container group in any of the servers described; The model container group sequentially simulates any simulation task of each simulation project to obtain the resource consumption rate of the server occupied by any simulation task of each simulation project.
3. The batch simulation method according to claim 1, characterized in that, A method for allocating the number of model container groups for each of the servers includes: The target resource consumption rate of each server is determined based on the resource consumption rate of the simulation tasks of different simulation projects currently being processed by the model container group of each server. The upper limit of the number of model container groups for each server is determined based on the target resource consumption rate and the resource idle rate of each server. The number of model container groups for each server is adjusted according to the maximum number of model container groups for each server.
4. The batch simulation method according to claim 3, characterized in that, A method for determining the target resource consumption rate of each of the aforementioned servers includes: Determine the number of simulation projects processed by each of the servers; Determine whether the number of simulation projects processed by each server is greater than 1: If so, the target resource consumption rate is the maximum resource consumption rate currently used by the model container group of the server to process the simulation task; Otherwise, the target resource consumption rate is the resource consumption rate of the simulation task currently being processed by the model container group of the server.
5. The batch simulation method according to claim 1, characterized in that, After the model container group simulates the simulation task, the following is also included: The model container group sends the simulation results to the display container group.
6. The batch simulation method according to claim 5, characterized in that, After the model container group obtains the simulation task, the state of the model container group is changed to the simulation state; After the model container group sends the simulation results to the display container group, the model container group deletes the simulation task and changes the status of the model container group to idle.
7. The batch simulation method according to claim 5, characterized in that, Multiple simulation results belonging to multiple model container groups of the same simulation project are displayed in the same display container group.
8. The batch simulation method according to claim 1, characterized in that, After the model container group simulates the simulation task, the following is also included: If the simulation of the model container group fails, the model container group is restarted and the model container group reprocesses the simulation task. If the simulation is normal after restarting the model container group, the model container group will send the simulation results to the display container group. If the simulation still fails after restarting the model container group, continue to restart the model container group until the simulation is normal or the number of restarts reaches the preset number.
9. A batch simulation device, characterized in that, This is applied to a K8s cluster server, which includes multiple servers; The batch simulation device includes: The parameter processing container group is used to parse the simulation parameters of each simulation project to obtain multiple simulation tasks; The task allocation container group is used to allocate the number of model container groups to each server based on the resource consumption rate of the simulation tasks of the different simulation projects currently being processed by the model container group of each server and the resource idle rate of each server. The task allocation container group is used to query the status of each model container group based on the number of model container groups in each server, and to dispatch the simulation task based on the status of the model container group. The model container group is used to simulate the simulation task and obtain simulation results.
10. A batch simulation system, characterized in that, This includes simulation parameter collection equipment, Kubernetes cluster servers, and simulation result display equipment; Both the simulation parameter collection device and the simulation result display device are communicatively connected to the K8s cluster server; the K8s cluster server is used to execute the batch simulation method according to any one of claims 1-8.
Citation Information
Patent Citations
Simulation task deployment method, system and related device
CN113722091A
Container scheduling method and scheduler
CN113760496A