A method, system, device and medium for elastic simulation of a Modelica model based on K8S

By using Kubernetes-based elastic scaling and Docker technologies, the simulation task runtime environment is dynamically created, solving the problem of insufficient resources on the Modelica simulation platform and achieving efficient simulation task execution and result rendering.

CN116339911BActive Publication Date: 2026-04-07SUZHOU TONGYUAN SOFT CONTROL INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-20
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

The existing Modelica modeling and simulation platform suffers from insufficient resources when faced with short-term batch simulation tasks, resulting in long waiting times for users. Furthermore, it cannot dynamically change server configurations, failing to meet the unpredictable and variable cloud computing resource demands.

Method used

By employing Kubernetes-based elastic scaling and Docker technologies, the Modelica simulation program is packaged into a Docker image. Simulation tasks are sent to a message queue via a browser. A dynamic simulation task runtime environment is created using the simulation manager and K8S, and the simulation status is monitored in real time and the result data is rendered.

Benefits of technology

It enables the provision of computing resources required for simulation tasks on demand, avoiding insufficient or wasted hardware resources and improving the execution efficiency and flexibility of simulation tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339911B_ABST
    Figure CN116339911B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on K8S's elastic simulation Modelica model method, system, equipment and medium, the method includes: Modelica simulation program is packed into Docker image;Simulation task is sent to message queue through browser, simulation manager listens to message queue, when simulation task in message queue is listened to, simulation task is pulled from message queue and is consumed;Simulation manager sends the request of creating the running environment of simulation task to K8S;K8S responds to request, creates running environment based on Docker image, after running environment is successfully created, simulation task is executed;Simulation manager real-time listens to the simulation state of simulation task currently, and according to simulation state, corresponding operation is taken.The application solves the problem that resource cannot be satisfied when online Modelica model simulation service needs indefinite time indefinite quantity to use various resources of cloud computer.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of software engineering, and in particular to a method, system, device and medium for elastic simulation of a Modelica model based on K8S. BACKGROUND

[0002] At present, the form of industrial software has long exceeded the single-client form, and major industrial software provides online cloud platforms to facilitate users to obtain the capabilities provided by the industrial software at any time and anywhere. However, the Modelica modeling and simulation platform uses a traditional task scheduler to schedule a fixed number of simulation managers, and when facing short-time batch simulation tasks, there are not enough simulation executors to complete the simulation, which requires users to wait for a long time and cannot dynamically change the configuration of the server. SUMMARY

[0003] The present application provides a method, system, device and medium for elastic simulation of a Modelica model based on K8S, which solves the problem that online Modelica model simulation services cannot satisfy the use of various resources of cloud computers at indefinite times and quantities.

[0004] A method for elastic simulation of a Modelica model based on K8S, comprising:

[0005] packing a Modelica simulation program into a Docker image;

[0006] sending a simulation task to a message queue through a browser, and listening to the message queue through a simulation manager, and when a simulation task in the message queue is listened to, pulling the simulation task from the message queue for consumption;

[0007] sending a request to create a running environment of the simulation task to K8S through the simulation manager;

[0008] the K8S creates a running environment based on the Docker image in response to the request, and after the running environment is successfully created, executes the simulation task;

[0009] the simulation manager listens to the current simulation state of the simulation task in real time, and takes corresponding operations according to the simulation state;

[0010] after the simulation task is executed, the browser receives simulation result data through an application programming interface of K8S, and renders according to the simulation result data.

[0011] In an embodiment of the present application, the running environment is created based on the Docker image, specifically comprising: scheduling an application program interface of K8S through the simulation manager, creating a Deployment for managing a container group Pod based on the image through K8S; creating a Pod through the Deployment, the Pod being used for executing the simulation task.

[0012] In an embodiment of the present application, the simulation manager is used for real-time monitoring of a current simulation state of the simulation task, and corresponding operations are taken according to the simulation state, specifically comprising: starting a thread in a simulation program for executing the simulation task, and using the thread to send a real-time heartbeat in the Deployment to the simulation manager; when the simulation manager does not receive the heartbeat in the Deployment after a preset time period, marking a state of the simulation task as failure, and scheduling an API of K8S to recycle the Deployment; when the simulation manager receives a state of simulation end, scheduling an API of K8S to recycle the Deployment, and cleaning up temporary files generated in the simulation process.

[0013] In an embodiment of the present application, after the running environment is successfully created, the method further comprises: monitoring a state of the Deployment through a timing task; if the Deployment is in a starting state, executing the timing task; and when the Deployment is monitored to be successfully started or failed to be started, canceling the timing task.

[0014] In an embodiment of the present application, after the simulation task is pulled from the message queue, the method further comprises: the simulation manager copying a simulation model related to the simulation task, and starting a script of the simulation program to be saved in a network file system (NFS) file system.

[0015] In an embodiment of the present application, after the running environment is created based on the Docker image, the method further comprises: if K8S successfully creates a Pod according to a request instruction of the simulation manager, returning a 201 status code to the simulation manager; and after the simulation manager receives the 201 status code, determining that the running environment is successfully created.

[0016] In an embodiment of the present application, the simulation task is sent to the message queue through a browser, specifically comprising: receiving simulation parameters set by a user using the browser through a front-end page, generating a simulation task according to the simulation parameters, and issuing a simulation instruction to a back-end server; and calling an API of the back-end server to transmit the simulation task to the message queue according to the simulation instruction.

[0017] A system for elastic simulation of a Modelica model based on K8S, comprising:

[0018] a packaging module configured to package a Modelica simulation program into a Docker image;

[0019] a browser module configured to send a simulation task to a message queue;

[0020] a simulation management module configured to listen to the message queue, and when a simulation task in the message queue is detected, pull the simulation task from the message queue for consumption; send a request to K8S to create a running environment for the simulation task;

[0021] a K8S module configured to, in response to the request, create a running environment based on the Docker image, and after the running environment is successfully created, execute the simulation task;

[0022] a simulation management module configured to listen to a current simulation state of the simulation task in real time, and take corresponding operations according to the simulation state;

[0023] a browser configured to receive simulation result data through an application program interface of K8S after the simulation task is executed, and render according to the simulation result data.

[0024] An apparatus for elastic simulation of a Modelica model based on K8S, comprising:

[0025] at least one processor; and,

[0026] a memory in communication with the at least one processor through a bus; wherein,

[0027] the memory stores instructions executable by the at least one processor, and the instructions are executed to implement:

[0028] packaging a Modelica simulation program into a Docker image;

[0029] sending a simulation task to a message queue through a browser, and listening to the message queue through a simulation manager, and when a simulation task in the message queue is detected, pulling the simulation task from the message queue for consumption;

[0030] sending a request to K8S through the simulation manager to create a running environment for the simulation task;

[0031] the K8S responds to the request, creates a running environment based on the Docker image, and after the running environment is successfully created, executes the simulation task;

[0032] The simulation manager is used for monitoring the current simulation state of the simulation task in real time, and corresponding operations are taken according to the simulation state;

[0033] After the simulation task is executed, the browser receives simulation result data through an application program interface of the K8S, and renders according to the simulation result data.

[0034] A non-volatile storage medium stores computer executable instructions executed by a processor to implement the following steps:

[0035] The Modelica simulation program is packaged into a Docker image;

[0036] The simulation task is sent to a message queue through a browser, and the simulation manager is used for monitoring the message queue, and when the simulation task in the message queue is monitored, the simulation task is pulled from the message queue for consumption;

[0037] The simulation manager is used for sending a request for creating a running environment of the simulation task to the K8S;

[0038] The K8S creates a running environment based on the Docker image in response to the request, and executes the simulation task after the running environment is successfully created;

[0039] The simulation manager is used for monitoring the current simulation state of the simulation task in real time, and corresponding operations are taken according to the simulation state;

[0040] After the simulation task is executed, the browser receives simulation result data through an application program interface of the K8S, and renders according to the simulation result data.

[0041] The application provides a K8S-based elastic simulation Modelica model method, system, device and medium, at least including the following beneficial effects: based on the elastic scaling technology of Kubernetes, various computer resources required by batch tasks can be provided on demand, the owner of the cloud simulation system does not need to worry about the problem of insufficient or excessive waste of hardware resources, and online simulation becomes possible. BRIEF DESCRIPTION OF DRAWINGS

[0042] The accompanying drawings, which are included to provide a further understanding of the application, constitute a part of the application and illustrate the illustrative embodiments of the application and their description serve to explain the application, and do not constitute improper limitations on the application. In the drawings:

[0043] Figure 1 A K8S-based elastic simulation Modelica model method step schematic diagram provided for the embodiments of the application.

[0044] Figure 2 A method flow diagram of an elastic simulation Modelica model based on K8S is provided for an embodiment of the application.

[0045] Figure 3 A system diagram of an elastic simulation Modelica model based on K8S is provided for an embodiment of the application.

[0046] Figure 4 A device diagram of an elastic simulation Modelica model based on K8S is provided for an embodiment of the application. DETAILED DESCRIPTION

[0047] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described below in detail with specific embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0048] It should be noted that those skilled in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict. Unless otherwise defined, the technical terms or scientific terms involved in the present application should be understood as the usual meaning by those skilled in the art. The terms "one", "a", "an", "the" and similar words involved in the present application do not represent quantity limitation, which can represent singular or plural. The terms "include", "contain", "have" and any variations thereof involved in the present application are intended to cover non-exclusive inclusion; the terms "first", "second", "third" and the like involved in the present application only distinguish similar objects, and do not represent a specific order of the objects.

[0049] Docker is an open source application container engine. Developers can package their applications and dependencies into a portable container, which can be published on popular Linux machines, and also realize virtualization.

[0050] Kubernetes, K8S for short, is an open source container cluster management system, which can realize the functions of automatic deployment, automatic scaling, maintenance and the like of container cluster.

[0051] Network File System (NFS) is mainly used to share files or directories between different host systems through a local area network. In the present scheme, most of the data before and after simulation is stored, and only a small part of the data is saved in the MySQL database, such as simulation records.

[0052] The model cloud simulation problem mainly has the following points:

[0053] 1. The computer resources required for each simulation are variable. It may only need CPU 1 core and 2GB of memory, or it may need CPU 64 core and 128GB of memory.

[0054] 2. The number of simulation tasks is variable. There may be no simulation for several hours, or there may be several hundred simulations within 1 minute.

[0055] 3. A simulation may monopolize a simulation executor for several months.

[0056] The traditional fixed simulation task scheduling scheme cannot meet the Modelica model cloud simulation, and a solution is needed to solve the above problems.

[0057] Based on the elastic scaling technology and Docker technology of K8S, the present application provides a method, system, device and medium for elastic simulation of Modelica model based on K8S, which can provide various computer resources required for batch simulation tasks on demand, making elastic simulation possible. The following will be described in detail.

[0058] Figure 1 The steps of the method for elastic simulation of Modelica model based on K8S provided by the embodiment of the present application can include the following steps:

[0059] S110: Pack the Modelica simulation program into a Docker image.

[0060] Specifically, the Modelica model simulation program is packed into a Docker image SIMULATION_IMAGE.

[0061] S120: Send the simulation task to the message queue through the browser, and listen to the message queue through the simulation manager. When the simulation task in the message queue is listened to, the simulation task is pulled from the message queue for consumption.

[0062] In an embodiment of the present application, the simulation task is sent to the message queue through the browser, specifically including: receiving the simulation parameters set by the user using the browser through the front-end page, generating the simulation task according to the simulation parameters, and issuing the simulation instruction to the background server; and transmitting the simulation task to the message queue according to the simulation instruction by calling the API of the background server.

[0063] Specifically, as shown in the figure, Figure 2 the user sets the simulation parameters through the front-end page using the browser, clicks the related control to issue the simulation instruction to the background server, and transmits the generated simulation task to the message queue according to the simulation instruction by calling the API of the background server.

[0064] In an embodiment of the present application, after pulling the simulation task from the message queue, the simulation manager copies the simulation model related to the simulation task, and starts the simulation program to save to the network file system (NFS) file system.

[0065] Specifically, the simulation manager listens to the simulation task in the message queue, creates when receiving a new task, and the simulation manager copies the model related to the simulation task, starts the simulation program to save to the NFS file system. The NFS file system is used to store most of the data in the simulation process, and a small part of the data (such as simulation records, etc.) is saved in the MySQL database.

[0066] S130: sending a request for creating a running environment of the simulation task to K8S through the simulation manager.

[0067] Specifically, after preparing the data before simulation to the NFS file system, the simulation manager sends a request for creating a running environment of Deployment and Pod to K8S to run the simulation task.

[0068] S140: K8S responds to the request, creates a running environment based on a Docker image, and executes the simulation task after the running environment is successfully created.

[0069] In an embodiment of the present application, the running environment is created based on a Docker image, specifically including: scheduling the application program interface of K8S through the simulation manager, creating Deployment for managing container group Pod based on the image through K8S; creating Pod through Deployment, and Pod is used to execute the simulation task.

[0070] Specifically, the simulation manager schedules an API Server of K8S to create a Deployment based on the SIMULATION_IMAGE image and configure the number of CPU cores, memory, etc., and create a Pod through the Deployment. The Pod is the smallest unit level managed by K8S, which is a combination of one or more containers; one Deployment is responsible for deploying and managing one Pod.

[0071] In an embodiment of the present application, after the running environment is created based on the Docker image, if the K8S successfully creates the Pod according to the request instruction of the simulation manager, a 201 status code is returned to the simulation manager; after the simulation manager receives the 201 status code, it is determined that the running environment is successfully created.

[0072] Specifically, if the K8S successfully receives the request of the simulation manager and creates the Pod according to the request instruction of the simulation manager, a 201 status code is returned to the simulation manager to determine that the simulation program execution environment is successfully established.

[0073] In an embodiment of the present application, after the running environment is successfully created, a timing task is established to listen to the state of the Deployment; if the Deployment is starting, the timing task is executed; when the Deployment startup success or startup failure is listened to, the timing task is canceled.

[0074] Specifically, after the running environment is successfully created, the Deployment is not necessarily in the RUNNING state, so a timing task (timer) needs to be written separately to check the state of the Deployment in real time. The state of the Deployment includes:

[0075] 1. The Deployment is starting

[0076] The timer continues to execute.

[0077] 2. The Deployment startup is successful

[0078] The lifecycle of K8S triggers the simulation execution script. The Pod script first informs the simulation manager that the simulation script has started to execute, and then starts the simulation program; the timer is canceled.

[0079] 3. The Deployment startup fails

[0080] The timer is canceled.

[0081] S150: The simulation manager listens to the current simulation state of the simulation task in real time, and takes corresponding operations according to the simulation state.

[0082] In an embodiment of the present application, the simulation manager is used to monitor the current simulation state of the simulation task in real time, and take corresponding operations according to the simulation state, which specifically includes: starting a thread in the simulation program of the simulation task to send real-time heartbeats in the Deployment to the simulation manager; when the simulation manager does not receive the heartbeats in the Deployment after a preset time period, marking the state of the simulation task as failed, and scheduling the API of K8S to recover the Deployment; when the simulation manager receives the end state of the simulation, scheduling the API of K8S to recover the Deployment, and cleaning up the temporary files generated in the simulation process.

[0083] Specifically, after the simulation starts, the simulation program in the Deployment synchronizes the current simulation state to the simulation manager in real time, and saves the simulation result data to the CSV file or the IoTDB database; the simulation state is limited, the interval time between states is not fixed, and cannot be used to monitor the state of the simulation program, for monitoring the state of the simulation program (including checking, translation, simulation, pause or stop) in the Deployment, a thread can be started in the simulation program to send real-time heartbeats to the simulation manager.

[0084] When the simulation manager does not receive the heartbeats in the Deployment for a preset time period (such as 30 minutes), the state of the simulation task is marked as failed, and the Deployment is recovered.

[0085] When the simulation manager receives the end state of the simulation, the API of K8S is scheduled to recover the Deployment; in order to save storage resources, the simulation manager will clean up the temporary files generated in the simulation process after the simulation ends.

[0086] S160: After the simulation task is executed, the browser receives the simulation result data through the application programming interface of K8S, and renders according to the simulation result data.

[0087] Through the above method, the Kubernetes-based elastic scaling technology can provide various computer resources required by the Modelica batch simulation task on demand, and the owner of the cloud simulation system does not need to worry about the problem of insufficient hardware resources or excessive waste, so that online simulation becomes possible.

[0088] The above is a method for elastically simulating a Modelica model based on K8S provided by an embodiment of the present application, based on the same inventive concept, an embodiment of the present application also provides a corresponding system for elastically simulating a Modelica model based on K8S, as shown in Figure 3 .

[0089] The packaging module 302 is configured to package the Modelica simulation program into a Docker image; the browser module 304 is configured to send a simulation task to a message queue; the simulation management module 306 is configured to listen to the message queue, and when a simulation task in the message queue is listened to, the simulation task is pulled from the message queue for consumption; a request for creating a running environment of the simulation task is sent to K8S; the K8S module 308 is configured to create the running environment based on the Docker image in response to the request, and after the running environment is successfully created, the simulation task is executed; the simulation management module 306 is configured to listen to a current simulation state of the simulation task in real time, and take corresponding operations according to the simulation state; and the browser 304 is configured to receive simulation result data through an application program interface of K8S after the simulation task is executed, and render according to the simulation result data.

[0090] The embodiment of the present application also provides a corresponding device for elastic simulation of a Modelica model based on K8S, as shown in the accompanying drawings, which comprises: Figure 4

[0091] at least one processor 410, a communications interface 420, a memory 430 and a communications bus 440; wherein the processor 410, the communications interface 420 and the memory 430 complete mutual communication through the communications bus 440; the processor 410 can invoke a logical instruction stored in the memory 430, so that the at least one processor 410 executes:

[0092] packaging the Modelica simulation program into a Docker image; sending a simulation task to a message queue through a browser, listening to the message queue through a simulation manager, and when a simulation task in the message queue is listened to, the simulation task is pulled from the message queue for consumption; sending a request for creating a running environment of the simulation task to K8S through the simulation manager; K8S creates the running environment based on the Docker image in response to the request, and after the running environment is successfully created, the simulation task is executed; the simulation manager listens to a current simulation state of the simulation task in real time, and takes corresponding operations according to the simulation state; and after the simulation task is executed, the browser receives simulation result data through an application program interface of K8S, and renders according to the simulation result data.

[0093] Based on the same idea, some embodiments of the present application also provide a medium corresponding to the above method.

[0094] Some embodiments of the present application provide a storage medium, which stores computer executable instructions, and the computer executable instructions are executed by a processor to implement the following steps: ​

[0095] The Modelica simulation program is packaged into a Docker image; a simulation task is sent to a message queue through a browser, a message queue is listened to by a simulation manager, when a simulation task in the message queue is listened to, the simulation task is pulled from the message queue for consumption; a request for creating a running environment of the simulation task is sent to K8S by the simulation manager; K8S responds to the request, creates a running environment based on the Docker image, and executes the simulation task after the running environment is successfully created; the simulation manager listens to the current simulation state of the simulation task in real time, and takes corresponding operations according to the simulation state; after the simulation task is executed, the browser receives simulation result data through an application programming interface of K8S, and renders according to the simulation result data.

[0096] Each of the embodiments in the present application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment mainly explains the difference from other embodiments. Especially, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0097] The device and medium provided by the embodiments of the present application are one-to-one corresponding to the method, so the device and medium also have similar beneficial technical effects as the method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device and medium will not be described here.

[0098] It should be further understood that the terms “comprise”, “contain” or any other variant thereof are intended to cover non-exclusive inclusion, so that the process method product or method comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process method product or method. Without more limitation, the element defined by the statement “comprising a” does not exclude the existence of another same element in the process method product or method comprising the element.

[0099] The above is only an embodiment of the present application and is not intended to limit the present application. Although the present application has been described in detail above with general description and specific embodiments, some modifications or improvements can be made on the basis of the present application, which is obvious to those skilled in the art. Therefore, these modifications or improvements made without deviating from the spirit of the present application are within the scope of the present application.

Claims

1. A method for elastic simulation of the Modelica model based on Kubernetes, characterized in that, include: Package the Modelica simulation program into a Docker image; The simulation task is sent to the message queue through the browser, and the simulation manager listens to the message queue. When a simulation task is detected in the message queue, the simulation task is retrieved from the message queue for consumption. The simulation manager sends a request to K8S to create the runtime environment for the simulation task. In response to the request, K8S creates a runtime environment based on the Docker image, and executes the simulation task after the runtime environment is successfully created. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. After the simulation task is completed, the browser receives the simulation result data through the K8S application programming interface and renders the simulation result data accordingly. The process of creating a runtime environment based on the Docker image specifically includes: scheduling the Kubernetes application interface through the simulation manager; creating a Deployment for managing container groups (Pods) based on the image through Kubernetes; and creating Pods through the Deployment, wherein the Pods are used to execute the simulation task. After the runtime environment is successfully created, the simulation manager monitors the status of the Deployment by establishing a scheduled task; if the Deployment is starting, the scheduled task is executed; when the Deployment is detected to have started successfully or failed to start, the scheduled task is canceled. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. Specifically, after the simulation starts, a separate thread is started in the simulation program executing the simulation task to send real-time heartbeats from the Deployment to the simulation manager; if the simulation manager does not receive heartbeats from the Deployment after a preset time, the simulation task is marked as failed, and the Kubernetes API is scheduled to reclaim the Deployment; when the simulation manager receives the simulation completion status, the Kubernetes API is scheduled to reclaim the Deployment and clean up the temporary files generated during the simulation.

2. The method according to claim 1, characterized in that, After retrieving the simulation task from the message queue, the method further includes: The simulation manager copies the simulation model associated with the simulation task and saves the script of the simulation program to the Network File System (NFS) file system.

3. The method according to claim 1, characterized in that, After creating the runtime environment based on the Docker image, the method further includes: If Kubernetes successfully creates a Pod according to the emulation manager's request, it returns a 201 status code to the emulation manager. Upon receiving the 201 status code, the simulation manager determines that the runtime environment has been successfully created.

4. The method according to claim 1, characterized in that, Sending simulation tasks to a message queue via a browser includes: The front-end page receives the simulation parameters set by the user using the browser, generates a simulation task based on the simulation parameters, and sends simulation instructions to the back-end server. The simulation task is sent to the message queue by calling the API of the backend server according to the simulation instructions.

5. A system for elastic simulation of the Modelica model based on Kubernetes, characterized in that, include: The packaging module is used to package the Modelica simulation program into a Docker image; The browser module is used to send simulation tasks to the message queue; The simulation management module is used to monitor the message queue. When a simulation task is detected in the message queue, the module retrieves the simulation task from the message queue for consumption and sends a request to K8S to create a runtime environment for the simulation task. The K8S module is used to respond to the request, create a runtime environment based on the Docker image, and execute the simulation task after the runtime environment is successfully created. Creating a runtime environment based on the Docker image specifically includes: scheduling the Kubernetes application interface through the simulation manager; creating a Deployment for managing container groups (Pods) based on the image through Kubernetes; and creating Pods through the Deployment, wherein the Pods are used to execute the simulation task. The simulation management module is used to monitor the current simulation status of the simulation task in real time and take corresponding actions based on the simulation status. A browser is used to receive simulation result data through the K8S application interface after the simulation task is completed, and the browser renders the simulation result data accordingly. The system is also used to: after the runtime environment is successfully created, the simulation manager monitors the status of the Deployment by establishing a scheduled task; if the Deployment is starting, the scheduled task is executed; when the system detects that the Deployment has started successfully or failed to start, the scheduled task is canceled. The K8S module is also used to: monitor the current simulation status of the simulation task in real time through the simulation manager, and take corresponding operations according to the simulation status, specifically including: after the simulation starts, starting a separate thread in the simulation program executing the simulation task to send the real-time heartbeat in the Deployment to the simulation manager; when the simulation manager does not receive the heartbeat in the Deployment after a preset time, marking the status of the simulation task as failed, and scheduling the K8S API to reclaim the Deployment; when the simulation manager receives the status of the simulation ending, scheduling the K8S API to reclaim the Deployment and clean up the temporary files generated during the simulation.

6. A device for elastically simulating Modelica models based on Kubernetes, characterized in that, include: At least one processor; as well as, The memory is connected to the at least one processor via a bus; wherein, The memory stores instructions executable by the at least one processor, which are executed to achieve: Package the Modelica simulation program into a Docker image; The simulation task is sent to the message queue through the browser, and the simulation manager listens to the message queue. When a simulation task is detected in the message queue, the simulation task is retrieved from the message queue for consumption. The simulation manager sends a request to K8S to create the runtime environment for the simulation task. In response to the request, K8S creates a runtime environment based on the Docker image, and executes the simulation task after the runtime environment is successfully created. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. After the simulation task is completed, the browser receives the simulation result data through the K8S application programming interface and renders the simulation result data accordingly. The process of creating a runtime environment based on the Docker image specifically includes: scheduling the Kubernetes application interface through the simulation manager; creating a Deployment for managing container groups (Pods) based on the image through Kubernetes; and creating Pods through the Deployment, wherein the Pods are used to execute the simulation task. After the runtime environment is successfully created, the simulation manager monitors the status of the Deployment by establishing a scheduled task; if the Deployment is starting, the scheduled task is executed; when the Deployment is detected to have started successfully or failed to start, the scheduled task is canceled. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. Specifically, after the simulation starts, a separate thread is started in the simulation program executing the simulation task to send real-time heartbeats from the Deployment to the simulation manager; if the simulation manager does not receive heartbeats from the Deployment after a preset time, the simulation task is marked as failed, and the Kubernetes API is scheduled to reclaim the Deployment; when the simulation manager receives the simulation completion status, the Kubernetes API is scheduled to reclaim the Deployment and clean up the temporary files generated during the simulation.

7. A non-volatile storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are executed by the processor to perform the following steps: Package the Modelica simulation program into a Docker image; The simulation task is sent to the message queue through the browser, and the simulation manager listens to the message queue. When a simulation task is detected in the message queue, the simulation task is retrieved from the message queue for consumption. The simulation manager sends a request to K8S to create the runtime environment for the simulation task. In response to the request, K8S creates a runtime environment based on the Docker image, and executes the simulation task after the runtime environment is successfully created. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. After the simulation task is completed, the browser receives the simulation result data through the K8S application programming interface and renders the simulation result data accordingly. The process of creating a runtime environment based on the Docker image specifically includes: scheduling the Kubernetes application interface through the simulation manager; creating a Deployment for managing container groups (Pods) based on the image through Kubernetes; and creating Pods through the Deployment, wherein the Pods are used to execute the simulation task. After the runtime environment is successfully created, the simulation manager monitors the status of the Deployment by establishing a scheduled task; if the Deployment is starting, the scheduled task is executed; when the Deployment is detected to have started successfully or failed to start, the scheduled task is canceled. The simulation manager monitors the current simulation status of the simulation task in real time and takes corresponding actions based on the simulation status. Specifically, after the simulation starts, a separate thread is started in the simulation program executing the simulation task to send real-time heartbeats from the Deployment to the simulation manager; if the simulation manager does not receive heartbeats from the Deployment after a preset time, the simulation task is marked as failed, and the Kubernetes API is scheduled to reclaim the Deployment; when the simulation manager receives the simulation completion status, the Kubernetes API is scheduled to reclaim the Deployment and clean up the temporary files generated during the simulation.

Citation Information

Patent Citations

  • Docker-based virtual simulation experiment system and method

    CN112560244A

  • Simulation task deployment method, system and related device

    CN113722091A