Graph-based model running simulation method and device, terminal and medium
The simulation method, which uses a graphical model to run simulations, constructs simulation models using objects, processes, and relational primitives, generating target logic frameworks and complex behavior sets. This overcomes the limitation of existing technologies that require code conversion and enables simulations that are inherently runnable without code conversion.
Patent Information
- Application Number
- CN202510410021.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-04-02
AI Technical Summary
Existing model simulation systems have limitations, such as not being able to run directly and requiring code conversion, thus failing to achieve direct simulation operation.
A simulation method based on graphical models is adopted, which uses object primitives, process primitives and relation primitives to construct simulation models. By parsing and generating target logic framework and complex behavior sets, it can achieve inherent runnability without code conversion.
It enables rapid model construction using simple primitives without the need for code conversion, improving the efficiency of model simulation and user experience, and reducing system logic complexity.
Smart Images

Figure CN120256023B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer simulation technology, and in particular to a method, apparatus, terminal and medium for running simulation based on a graphical model. Background Technology
[0002] Currently, existing model simulation systems mainly involve systems based on UML (Unified Modeling Language), systems based on SysML (System Modeling Language), and other systems. Among these, UML-based systems present data at a layer-by-layer level and cannot be run directly; SysML-based systems, while capable of simulation, do so by configuring code within graphics; and other systems, although capable of model-to-simulation conversion, still require converting the model into code and then compiling it into a runnable state. These modeling systems all have limitations or are unable to achieve these steps. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a simulation method, device, terminal and medium based on a graphical model, and to propose a simulation operation mechanism that is inherently runnable and can quickly build models based on simple primitives without the need for code conversion, so as to improve the limitations or unachievable problems of existing modeling systems.
[0004] In a first aspect, the present invention provides a simulation method based on a graphical model. The method is applied to a terminal configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. The method includes:
[0005] The system responds to configuration operations on object primitives, process primitives, and relation primitives to obtain a runnable simulation model.
[0006] The simulation model is parsed to generate the target logic framework and complex behavior set corresponding to the simulation model. The target logic framework is used to describe the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings. The complex behavior set is composed of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives.
[0007] The target logic framework and complex behavior set are verified. If both the target logic framework and complex behavior set pass the verification, the model is run and simulated based on the target logic framework and complex behavior set to obtain the running simulation results corresponding to the simulation model.
[0008] In one implementation, the step of parsing the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model includes:
[0009] Identify the target basic graphical primitives contained in the simulation model. The target basic graphical primitives include target object primitives, target process primitives, and target relationship primitives.
[0010] Read the attribute settings of target object primitives, target process primitives and target relationship primitives, and identify the connection relationships between target object primitives, between target process primitives and between target object primitives based on the target relationship primitive;
[0011] Based on the attribute settings and connection relationships of the target basic graphical primitives, construct the target logic framework corresponding to the simulation model;
[0012] The simulation behavior contained in the simulation model is generated according to the target logical framework, and the simulation behavior is assembled into a complex set of behaviors according to the logical framework.
[0013] In one implementation, the step of constructing the target logic framework corresponding to the simulation model based on the attribute settings and connection relationships of the target basic graphical primitives includes:
[0014] For any target process primitive within a sub-logical framework at any logical level, perform the following operation:
[0015] Based on the attribute settings of the target object graph element, determine the sub-process graph elements contained in the target object graph element; based on the connection relationship of the sub-process graph elements, determine the target object graph elements associated with the sub-process graph elements, and determine the behavior manipulation performed by the sub-process graph elements on their associated target object graph elements, so as to obtain the sub-logic framework of the next logical level.
[0016] All the sub-logic frameworks at all logical levels constitute the logical framework corresponding to the simulation model.
[0017] In one implementation, the steps of generating simulation behaviors contained in the simulation model according to the target logic framework, and assembling the simulation behaviors into a complex set of behaviors according to the logic framework, include:
[0018] For any target process primitive within a sub-logical framework at any logical level, perform the following operation:
[0019] Based on the subprocess graphs contained in the target process graph, and the behavioral manipulations performed by the subprocess graphs on their associated target object graphs, at least one simulation behavior corresponding to the target process graph is generated.
[0020] Each simulation behavior corresponding to the target process primitive is assembled into a set of complex behaviors corresponding to the target process primitive.
[0021] In one implementation, the method further includes:
[0022] Monitor the analysis process of the simulation model;
[0023] When the analysis process is detected to meet the auxiliary judgment conditions based on the preset auxiliary mechanism, the analysis of the simulation model is paused, and an analysis confirmation prompt is initiated through the graphical user interface of the terminal.
[0024] In response to the confirmation prompt, continue parsing the simulation model.
[0025] In one implementation, the verification of the target logical framework includes: a consistency check of primitive relationships and / or a convenience and constraint check; the steps for verifying the target logical framework include:
[0026] If the relationships between the target basic graphical primitives contained in the target logical framework are consistent with the preset primitive relationship rules, then the target logical framework is determined to have passed the primitive relationship consistency test.
[0027] For any target basic graphical primitive contained in the target logic framework, determine whether the target basic graphical primitive satisfies the preset convenience conditions; if yes, determine that the target logic framework passes the convenience and constraint test; if no, determine whether the target basic graphical primitive satisfies the preset member constraint conditions; if the member constraint conditions are satisfied, determine that the target logic framework passes the convenience and constraint test.
[0028] In one implementation, the verification of a complex behavior set includes one or more of the following: behavior syntax verification, behavior semantic verification, and behavior logic verification; the steps for verifying a complex behavior set include:
[0029] If the grammatical structure of a complex behavior set satisfies the preset primitive grammar rules, then the complex behavior set is determined to pass the behavior grammar verification.
[0030] If the semantics of a complex set of behaviors differs from the pre-defined semantics... Figure 1 If the result is consistent, then the complex set of behaviors is confirmed to pass the behavior syntax validation.
[0031] If the behavioral logic of a complex set of behaviors is operable, then the complex set of behaviors is determined to have passed the behavioral logic verification.
[0032] Secondly, the present invention also provides a simulation device based on a graphical model. The device is applied to a terminal, which is configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. The device includes:
[0033] The model building module is used to respond to configuration operations on object primitives, process primitives, and relation primitives to obtain a runnable simulation model;
[0034] The model parsing module is used to parse the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model. The target logic framework is used to describe the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings. The complex behavior set is composed of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives.
[0035] The model verification and execution module is used to verify the target logic framework and complex behavior set. If both the target logic framework and complex behavior set pass the verification, the module performs model execution simulation based on the target logic framework and complex behavior set to obtain the corresponding simulation results.
[0036] Thirdly, the present invention also provides a terminal including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement any of the methods provided in the first aspect.
[0037] Fourthly, the present invention also provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement any of the methods provided in the first aspect.
[0038] This invention provides a simulation method, apparatus, terminal, and medium based on a graphical model. The terminal is configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. First, it responds to configuration operations on the object primitives, process primitives, and relationship primitives to obtain a runnable simulation model. Then, it parses the simulation model to generate a target logic framework and a set of complex behaviors corresponding to the simulation model. The target logic framework describes the target basic graphical primitives contained in the simulation model, their connection relationships, and attribute settings. The set of complex behaviors consists of multiple simulation behaviors used to perform behavioral manipulation on the target basic graphical primitives. Finally, the target logic framework and the set of complex behaviors are verified. If both the target logic framework and the set of complex behaviors pass verification, the model is run and simulated based on the target logic framework and the set of complex behaviors to obtain the running simulation results corresponding to the simulation model. The above method provides users with basic graphical primitives based on concise primitives, making it easy for users to build inherently runnable simulation models without code conversion. By parsing the simulation model, a directory logic framework describing the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings is obtained, as well as a complex set of behaviors for performing behavioral manipulation on the target basic graphical primitives. Finally, the model simulation is realized based on the verification of the directory logic framework and the complex set of behaviors. This invention proposes a simulation operation mechanism that allows for rapid model construction based on concise primitives without code conversion, thereby improving the limitations or inability to achieve the desired results in existing modeling systems.
[0039] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0040] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0041] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0042] Figure 1 A technical framework diagram of an existing model running simulation technology provided for an embodiment of the present invention;
[0043] Figure 2 This invention provides a simulation method based on a graphical model.
[0044] Figure 3 A schematic diagram of a basic graphical primitive provided in an embodiment of the present invention;
[0045] Figure 4 A schematic diagram of a simulation device based on a graphical model is provided in an embodiment of the present invention;
[0046] Figure 5 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] See Figure 1 The technical framework diagram of an existing model running simulation technology shown mainly includes the following parts: (1) Primitive definition and storage: First, based on the user's scenario requirements, the user needs to select the corresponding modeling category, then define various graphical primitives, and store them in the primitive library; (2) Primitive drag and drop and connection: The user drags the required primitives through the graphical interface and connects them according to their logical relationships. At the same time, code can be configured on their primitives or relationships to achieve the purpose of primitive execution; (3) Parsing and code generation: After the user completes the construction of primitives and relationship association, the graphical tool will parse according to the currently configured primitives and relationships, and automatically convert the configured model into executable code; (4) Running and debugging: The generated program code is then compiled or interpreted and run. During the running process, the graphical programming tool can provide real-time debugging information to help users find problems.
[0049] Based on the existing technical solutions, from an objective perspective, the following three problems and shortcomings of the existing technologies are found: (1) Whether it is UML, SysML or other types of graphical modeling tools, it is necessary to combine the user's scenario, first construct the modeling type, and then select the primitives, resulting in many modeling types, complex primitives, and high learning difficulty; (2) The existing modeling technologies do not have the characteristic of being inherently runnable. If the model is to be able to execute, code must be configured in key links, and the runnable characteristic can only be achieved through the logical connection of the code; (3) In the existing modeling simulation process, when analyzing the model primitives and primitive relationships, it is necessary to first convert the code and then compile it to be runnable, which is a complex conversion process.
[0050] Based on this, the present invention provides a simulation method, device, terminal and medium based on a graphical model, and proposes a simulation operation mechanism that is inherently runnable and can quickly build models based on simple primitives without the need for code conversion, so as to improve the limitations or unachievable problems of existing modeling systems.
[0051] To facilitate understanding of this embodiment, a detailed description of a simulation method based on a graphical model disclosed in this embodiment of the invention will be provided first. This method is applied to a terminal, which is configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. See [link to documentation]. Figure 2 The diagram shows a flowchart of a simulation method based on a graphical model. This method mainly includes the following steps S202 to S206:
[0052] Step S202: Respond to the configuration operations for object primitives, process primitives, and relation primitives to obtain a runnable simulation model.
[0053] Among them, object primitives, process primitives, and relationship primitives, that is, objects, processes, and relationships expressed in a concise and standardized graphical form, serve as the basis for building simulation models. Moreover, these basic graphical primitives have high reusability and flexibility, and can cover various basic elements and components required in simulation and deduction.
[0054] In one example, the requirements are abstracted using object primitives, process primitives, and relationship primitives to construct a natively runnable simulation model that requires no code conversion. The simulation model includes target object primitives, target process primitives, target relationship primitives, and other basic graphical primitives, as well as the connection relationships and attribute settings of each basic graphical primitive. Specifically, the target object primitive contains members and attributes to express its characteristics; the target process primitive expresses its function or behavior; and the target relationship primitive describes the relationships between target object primitives, the relationships between target process primitives, and the relationships between target object primitives and their corresponding target process primitives, thus describing the dependencies and interactions between the primitives.
[0055] Step S204: Analyze the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model.
[0056] The target logic framework describes the target basic graphical primitives contained in the simulation model, their connection relationships, and attribute settings. The complex behavior set consists of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives.
[0057] In one example, the target basic graphical primitives contained in the simulation model are first identified, the attribute settings of the target basic graphical primitives are read, and the connection relationships between the target basic graphical primitives are identified. Then, the target logic framework inside the simulation model is constructed by combining the attribute settings and connection relationships, so as to describe the overall structure and behavior of the simulation model through the target logic framework. Finally, the corresponding simulation behaviors are automatically generated according to the target logic framework, and the simulation behaviors are assembled into a complex behavior set according to the target logic framework. The complex behavior set is the core of model running simulation for the simulation model.
[0058] Step S206: Verify the target logic framework and complex behavior set. If both the target logic framework and complex behavior set pass the verification, perform model operation simulation based on the target logic framework and complex behavior set to obtain the corresponding simulation results.
[0059] The verification of the target logical framework includes: consistency test of graph element relationships and / or convenience and constraint test; the verification of complex behavior sets includes: one or more of the following: behavior syntax verification, behavior semantic verification, and behavior logic verification.
[0060] In one example, if both the target logic framework and the complex behavior set are verified, the complex behavior set can be invoked to manipulate the behavior of the corresponding target basic graphical primitives according to the attribute information and connection relationships of each target basic graphical primitive in the target logic framework, thereby realizing the simulation of the simulation model and obtaining the required simulation results.
[0061] If any item in the target logic framework and complex behavior set fails validation, the unvalidated target basic graphical primitive can be located, and a failure message can be generated for that target basic graphical primitive to prompt the user to modify it until it passes validation.
[0062] The simulation method based on a graphical model provided by this invention offers users a basic graphical primitive based on concise primitives. This allows users to build a naturally runnable simulation model without code conversion using the basic graphical primitives. By parsing the simulation model, a directory logic framework describing the target basic graphical primitives and their connection relationships and attribute settings is obtained, along with a complex set of behaviors for manipulating the target basic graphical primitives. Finally, the model simulation is run based on the verification of the directory logic framework and the complex set of behaviors. This invention proposes a simulation running mechanism that allows for rapid model construction based on concise primitives without code conversion, thereby improving the limitations or inability to implement existing modeling systems.
[0063] To facilitate understanding, this invention provides a specific implementation of a simulation method based on a graphical model. The core of this invention lies in utilizing three simple and standardized graphical primitives—objects, processes, and relationships—as the foundation for model construction. These primitives possess high reusability and flexibility, capable of encompassing various basic elements and components required for simulation deduction. Users can quickly combine these primitives through intuitive operations such as dragging and connecting to construct simulation models that meet specific needs, including logical modeling, process modeling, and arithmetic modeling. No code needs to be written or converted during model construction. During simulation execution, the mechanism internally inherits an intelligent parsing and execution mechanism that automatically identifies the connection relationships and attribute settings between primitives, and generates corresponding target logic frameworks and complex behavior sets accordingly. This means that users can easily perform model simulation without requiring professional programming knowledge.
[0064] Before performing the aforementioned step S202, it is necessary to design basic graphical primitives. This embodiment of the invention uses a set of standardized and concise graphical primitives to represent the basic elements and components in the simulation model, serving as the basis for model simulation. For example, see... Figure 3 The diagram shows a basic graphical primitive.
[0065] Rectangular primitives represent object primitives, and different attributes of the object primitive are represented by adding different annotations at different positions inside the object primitive. Among them, elements in the shape (such as a triangle) located in the upper left corner of the object primitive (such as...) Figure 3The "m" in the object primitive has different meanings. For example, m represents a component member of an instance, p represents an associated object of an instance, t represents a temporary member of an instance, a represents an attribute member of an instance, c represents a constant, or an empty graphic represents a class, or a graphic containing a circle represents an interface, etc. The upper right corner of the object primitive is used to describe visibility. For example, an empty upper right corner of the object primitive represents public, an empty graphic (such as a triangle) in the upper right corner of the object primitive represents protected, and a filled graphic (such as a triangle) in the upper right corner of the object primitive represents private. The graphic located in the lower right corner of the object primitive represents a "reference", such as a referenced file referenced by the object primitive.
[0066] Elliptical primitives represent process primitives, and different attributes of the process primitive are represented by adding different annotations at different positions inside the process primitive. In one example, by encapsulating components, functions, algorithms, or other models as process primitives, the process of writing the process as code can be avoided. The upper left corner of the process primitive contains elements representing process settings, elements representing process code, etc. Process settings include time-independent, time-dependent, first start, subprocess, etc.; the upper right corner of the process primitive describes visibility; the graphic in the lower right corner of the process primitive represents "reference". Optionally, different elements can be added before the title "Time-dependent Process" to indicate that the process is a built-in process or constructor; time parameters can also be added below the title "Time-dependent Process", including time unit, time precision, duration distribution, shortest time, expected time, longest time, etc.
[0067] Arrow-shaped primitives represent relational primitives. Different arrow shapes, fill methods, and arrow directions (such as bidirectional or unidirectional) represent different connection relationships. Connection relationships are divided into structural relationships and procedural relationships. Structural relationships include composition relationships, representation relationships, inheritance relationships, ownership relationships, structural control relationships, unidirectional labeled relationships, and bidirectional labeled relationships. Procedural relationships include consumption relationships, generation relationships, input influence relationships, output influence relationships, bidirectional influence relationships, state transition relationships, state transition pairs, dominance relationships, conditional relationships, calling relationships, self-calling relationships, timeout exception calling relationships, and insufficient time exception calling relationships.
[0068] Regarding the aforementioned step S202, this embodiment of the invention provides a specific implementation method for responding to configuration operations on object primitives, process primitives, and relationship primitives to obtain a runnable simulation model, including: the user combines these basic graphical primitives together through drag-and-drop, connection configuration, and other operations, and implements modeling behaviors such as logic, process, and arithmetic through the primitives to construct a directly runnable simulation model. In this process, the system can automatically identify the connection relationships and attribute settings between the basic graphical primitives.
[0069] Regarding the aforementioned step S204, this embodiment of the invention provides a specific implementation method for parsing the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model. The system integrates an intelligent parsing module, which can automatically generate the corresponding target logic framework and complex behavior set based on the primitives and their interrelationships. Specifically, it includes the following steps 1 to 4:
[0070] Step 1: Identify the target basic graphical primitives contained in the simulation model. The target basic graphical primitives include target object primitives, target process primitives, and target relationship primitives.
[0071] The system identifies each target basic graphical primitive in the user-constructed simulation model. For example, for any target basic graphical primitive, shape parsing logic is invoked to extract its shape features, and the specific category of the target basic graphical primitive (i.e., target object primitive, target process primitive, or target relationship primitive) is determined based on these features. For instance, if a target basic graphical primitive is a rectangle, it is determined to be a target object primitive; if it is an ellipse, it is determined to be a target process primitive; and if it is an arrow, it is determined to be a target relationship primitive.
[0072] Step 2: Read the attribute settings of the target object primitive, the target process primitive, and the target relationship primitive, and identify the connection relationships between target object primitives, between target process primitives, and between target object primitives and target process primitives based on the target relationship primitive.
[0073] In one example, the attribute settings of each target basic graphical primitive are read, including its type, members, procedures, and internal parameters and input / output relationships. In specific implementation, based on the identified specific type of the target basic graphical primitive, the corresponding attribute parsing process can be invoked to read the attribute settings of the target basic graphical primitive. Taking the target object primitive as an example, the attribute parsing process corresponding to this category is invoked. This process identifies each element of the target object primitive, such as identifying the top-left corner to determine its type (e.g., class, interface, constant, instance members, associated objects, temporary members, attribute members), identifying the top-right corner to determine its visibility, and identifying the bottom-right corner to determine its reference. Similarly, the attribute settings of the target procedure primitive can be identified.
[0074] In one example, the system analyzes the connections between the target basic graphical primitives to determine their data and information flows. Specifically, based on the shape characteristics of the target relationship primitives and the primitives that the first and first elements of the target relationship primitives point to, the connections between target object primitives, between target process primitives, and between target object primitives and target process primitives can be obtained.
[0075] Step 3: Based on the attribute settings and connection relationships of the target basic graphical primitives, construct the target logic framework corresponding to the simulation model.
[0076] In one example, for any target process element within a sub-logic framework at any logical level, the following operations are performed: based on the attribute settings of the target object element, the sub-process elements contained in the target object element are determined; based on the connection relationships of the sub-process elements, the target object elements associated with the sub-process elements are determined, as well as the behavioral manipulations performed by the sub-process elements on their associated target object elements are determined, so as to obtain the sub-logic framework at the next logical level; the sub-logic frameworks at all logical levels constitute the logical framework corresponding to the simulation model.
[0077] In practical implementation, the target process primitive is the definition of the behavior of a type, and the target process primitive can contain sub-process primitives. Based on this, firstly, the target process primitives contained in the first-level logical hierarchy are traversed. According to the connection relationship of the target process primitive, the target object primitives associated with the target process primitive and the behavior control performed by the target process primitive on its associated target object primitive are determined, thus obtaining the sub-logical framework of the first-level logical hierarchy. For the target process primitives contained in the first-level logical hierarchy, the sub-process primitives contained in the target process primitive are identified based on the attribute settings of the target process primitive. Here, the attribute settings are specifically based on the attribute settings identified from the upper left corner of the process primitive. For any sub-process primitive contained in the target process primitive within the first-level logical hierarchy (i.e., the target process primitive contained in the second-level logical hierarchy), according to the connection relationship of the sub-process primitive, the target object primitives associated with the sub-process primitive and the behavior control performed by the sub-process primitive on its associated target object primitive are determined, thus obtaining the sub-logical framework of the second-level logical hierarchy. The above process is repeated to obtain the target logical framework used to describe the overall structure of the simulation model.
[0078] Step 4: Generate the simulation behaviors contained in the simulation model according to the target logical framework, and assemble the simulation behaviors into a complex set of behaviors according to the logical framework.
[0079] In one example, for any target process primitive within a sub-logic framework at any logical level, the following operations are performed: based on the sub-process primitives contained in the target process primitive and the behavioral manipulations performed by the sub-process primitives on their associated target object primitives, at least one simulation behavior corresponding to the target process primitive is generated; each simulation behavior corresponding to the target process primitive is assembled into a complex behavior set corresponding to the target process primitive.
[0080] For example, taking any target process primitive as an example, the target process primitive includes sub-process primitive 1, sub-process primitive 2, etc. Sub-process primitive 1 initializes its associated target object primitive, and sub-process primitive 2 processes its associated target object primitive using the large model. The behavior control corresponding to sub-process primitive 1 and the behavior control corresponding to sub-process primitive 2 are encapsulated into a complex behavior set corresponding to the target process primitive. When the complex behavior set corresponding to the target process primitive is used, the corresponding behavior control is performed on its associated target object primitive.
[0081] Furthermore, this embodiment of the invention also includes an auxiliary mechanism to ensure efficient and accurate real-time simulation analysis, and to continuously optimize the process. Specifically, the analysis process of the simulation model is monitored. When the analysis process meets the auxiliary judgment conditions based on the preset auxiliary mechanism, the analysis of the simulation model is paused, and a confirmation prompt is initiated through the graphical user interface of the terminal. Then, in response to the confirmation operation for the confirmation prompt, the analysis of the simulation model continues.
[0082] The auxiliary judgment conditions can be based on the parsing process or on the primitives. For example, taking the parsing process-based judgment condition, when a pre-marked key parsing process is executed, the auxiliary judgment condition is determined to be met. Taking the primitive-based judgment condition, during the simulation model building process, a marking operation is performed on the specified target basic graphical primitive; during the parsing of the simulation model, it is detected whether the currently parsed target basic graphical primitive carries a mark; if it does, the auxiliary judgment condition is determined to be met.
[0083] When the auxiliary judgment conditions are met, the parsing process will be paused, and the parsing results generated by the current parsing process will be displayed through the graphical user interface. At the same time, a parsing confirmation prompt will be issued. If no confirmation is made, the user will be directly redirected to the editing page of the target basic graphical primitive involved in the current parsing process, so that the user can modify the target basic graphical primitive or other related target basic graphical primitives. If confirmation is made, the parsing process will continue.
[0084] Regarding the aforementioned step S206, after the target logic framework and complex behavior set have been verified, this embodiment of the invention also provides a specific implementation method for verifying the target logic framework and complex behavior set.
[0085] In practical applications, after the complex behavior set is generated, it is necessary to perform syntax checks, semantic checks, graph primitive relationship consistency checks, convenience and constraint checks, and simulation logic checks on the target logic framework and the complex behavior set.
[0086] In one example, the steps for validating the target logic framework include:
[0087] (1.1) If the relationships between the target basic graphical primitives contained in the target logical framework are consistent with the preset primitive relationship rules, then the target logical framework is determined to have passed the primitive relationship consistency check. The graphical relationship rules describe the conditions that the relationships between basic graphical primitives should meet. For example, the relationship between target process primitives should be a program relationship. If the relationship between two target process primitives is an inheritance relationship, since inheritance is a structural relationship, the relationship between these two target process primitives does not conform to the primitive relationship rules, and thus the primitive relationship consistency check will be deemed unsuccessful.
[0088] (1.2) For any target basic graphical primitive contained in the target logic framework, determine whether the target basic graphical primitive meets the preset convenience conditions; if yes, determine that the target logic framework passes the convenience and constraint test; if no, determine whether the target basic graphical primitive meets the preset member constraint conditions; if the member constraint conditions are met, determine that the target logic framework passes the convenience and constraint test. The member constraint conditions can be understood as: the target basic graphical primitive must contain a certain member (or other constraint) for it to have the execution condition; the convenience conditions can be understood as: some object primitives or process primitives themselves lack a certain member (or other constraint), therefore, for these object primitives or process primitives, even if the constraint conditions are not met, they still have the execution condition. In specific implementation, determine whether a target basic graphical primitive is a basic graphical primitive that meets the preset convenience conditions; if yes, it can be directly determined that it passes the convenience and constraint test; if not, further determine whether the target basic graphical primitive contains the specified member; if yes, it can be determined that it passes the convenience and constraint test; otherwise, it fails.
[0089] In one example, the steps for validating a complex set of behaviors include:
[0090] (2.1) If the syntactic structure of the complex behavior set satisfies the preset primitive grammar rules, then the complex behavior set is determined to have passed the behavior grammar verification. In specific implementation, the complex behavior set is grammatically verified, which includes checking whether the syntactic structure in the complex behavior set is correct, and whether expressions, control flow (loops and conditional judgments), etc., conform to the primitive grammar rules recognized by the graphical programming or simulation system.
[0091] (2.2) If the semantics of the complex behavior set is different from the preset semantic meaning Figure 1 If the behavior set is validated, then the complex behavior set is confirmed to pass the behavior syntax validation. In the specific implementation, semantic validation is required to ensure that each element (type, member, procedure, etc.) in the complex behavior set is semantically correct, that is, their usage is consistent with the predefined or user-defined scenario intent.
[0092] (2.3) If the behavioral logic of a complex set of behaviors is operable, then the complex set of behaviors is deemed to have passed the behavioral logic verification. In the specific implementation, the entire behavioral logic after modeling and parsing is verified to ensure that it can be simulated and run.
[0093] Regarding the aforementioned step S206, this embodiment of the invention also provides a specific implementation method for performing model operation simulation based on a target logic framework and a complex behavior set to obtain the corresponding operation simulation results of the simulation model.
[0094] In practical applications, once the target logic framework and complex behavior set pass verification and validation, they will enter a runnable state. Combined with the simulation mechanism, the model's ability to run simulations will be demonstrated. Specifically, according to the attribute information and connection relationships of each target basic graphical primitive in the target logic framework, the complex behavior set can be invoked to manipulate the behavior of the corresponding target basic graphical primitives, thereby enabling the simulation model to run and obtain the required simulation results.
[0095] In summary, the simulation method based on a graphical model provided by the embodiments of the present invention, by converting the simulation model into a graphical language recognizable by the simulation system, and through the mechanism of identifying, analyzing, and simulating the graphical simulation model, makes the simulation more efficient and convenient, reduces the complexity of system logic, and improves the user's actual operating experience. Specifically, the embodiments of the present invention have at least the following characteristics:
[0096] (1) The model is built based on the scenario. The model consists of objects, processes and relationships. The modeling method is simple and convenient. (2) The constructed simulation model can meet the requirements of logical modeling, process modeling, arithmetic modeling and other methods. The constructed primitives and primitive relationships do not require separate code configuration and are inherently runnable. (3) The model parsing does not require code conversion or compilation and can directly identify primitive information.
[0097] Based on the foregoing embodiments, this invention provides a simulation device based on a graphical model. This device is applied to a terminal, which is configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. (See [link to previous document]). Figure 4 The diagram shows a schematic of a simulation device based on a graphical model. This device mainly includes the following parts:
[0098] The model building module 402 is used to respond to configuration operations on object primitives, process primitives and relation primitives to obtain a runnable simulation model.
[0099] The model parsing module 404 is used to parse the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model. The target logic framework is used to describe the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings. The complex behavior set is composed of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives.
[0100] The model verification and execution module 406 is used to verify the target logic framework and the complex behavior set. If both the target logic framework and the complex behavior set pass the verification, the module performs model execution simulation based on the target logic framework and the complex behavior set to obtain the execution simulation results corresponding to the simulation model.
[0101] The simulation device based on a graphical model provided in this invention offers users a basic graphical primitive based on concise primitives. This allows users to build a naturally runnable simulation model without code conversion using the basic graphical primitives. By parsing the simulation model, a directory logic framework describing the target basic graphical primitives and their connection relationships and attribute settings is obtained, along with a complex set of behaviors for manipulating the target basic graphical primitives. Finally, the model simulation is run based on the verification of the directory logic framework and the complex set of behaviors. This invention proposes a simulation running mechanism that allows for rapid model construction based on concise primitives without code conversion, thereby improving the limitations or inability to implement existing modeling systems.
[0102] In one implementation, the model parsing module 404 is specifically used for:
[0103] Identify the target basic graphical primitives contained in the simulation model. The target basic graphical primitives include target object primitives, target process primitives, and target relationship primitives.
[0104] Read the attribute settings of target object primitives, target process primitives and target relationship primitives, and identify the connection relationships between target object primitives, between target process primitives and between target object primitives based on the target relationship primitive;
[0105] Based on the attribute settings and connection relationships of the target basic graphical primitives, construct the target logic framework corresponding to the simulation model;
[0106] The simulation behavior contained in the simulation model is generated according to the target logical framework, and the simulation behavior is assembled into a complex set of behaviors according to the logical framework.
[0107] In one implementation, the model parsing module 404 is specifically used for:
[0108] For any target process primitive within a sub-logical framework at any logical level, perform the following operation:
[0109] Based on the attribute settings of the target object graph element, determine the sub-process graph elements contained in the target object graph element; based on the connection relationship of the sub-process graph elements, determine the target object graph elements associated with the sub-process graph elements, and determine the behavior manipulation performed by the sub-process graph elements on their associated target object graph elements, so as to obtain the sub-logic framework of the next logical level.
[0110] All the sub-logic frameworks at all logical levels constitute the logical framework corresponding to the simulation model.
[0111] In one implementation, the model parsing module 404 is specifically used for:
[0112] For any target process primitive within a sub-logical framework at any logical level, perform the following operation:
[0113] Based on the subprocess graphs contained in the target process graph, and the behavioral manipulations performed by the subprocess graphs on their associated target object graphs, at least one simulation behavior corresponding to the target process graph is generated.
[0114] Each simulation behavior corresponding to the target process primitive is assembled into a set of complex behaviors corresponding to the target process primitive.
[0115] In one implementation, an auxiliary parsing module is also included, for:
[0116] Monitor the analysis process of the simulation model;
[0117] When the analysis process is detected to meet the auxiliary judgment conditions based on the preset auxiliary mechanism, the analysis of the simulation model is paused, and an analysis confirmation prompt is initiated through the graphical user interface of the terminal.
[0118] In response to the confirmation prompt, continue parsing the simulation model.
[0119] In one implementation, the verification of the target logical framework includes: primitive relationship consistency check and / or convenience and constraint check; the model verification and execution module 406 is specifically used for:
[0120] If the relationships between the target basic graphical primitives contained in the target logical framework are consistent with the preset primitive relationship rules, then the target logical framework is determined to have passed the primitive relationship consistency test.
[0121] For any target basic graphical primitive contained in the target logic framework, determine whether the target basic graphical primitive satisfies the preset convenience conditions; if yes, determine that the target logic framework passes the convenience and constraint test; if no, determine whether the target basic graphical primitive satisfies the preset member constraint conditions; if the member constraint conditions are satisfied, determine that the target logic framework passes the convenience and constraint test.
[0122] In one implementation, the verification of complex behavior sets includes one or more of the following: behavior syntax verification, behavior semantic verification, and behavior logic verification; the model verification and execution module 406 is specifically used for:
[0123] If the grammatical structure of a complex behavior set satisfies the preset primitive grammar rules, then the complex behavior set is determined to pass the behavior grammar verification.
[0124] If the semantics of a complex set of behaviors differs from the pre-defined semantics... Figure 1 If the result is consistent, then the complex set of behaviors is confirmed to pass the behavior syntax validation.
[0125] If the behavioral logic of a complex set of behaviors is operable, then the complex set of behaviors is determined to have passed the behavioral logic verification.
[0126] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0127] This invention provides a terminal, specifically, the terminal includes a processor and a storage device; the storage device stores a computer program, and the computer program, when run by the processor, executes the method described in any of the above embodiments.
[0128] Figure 5 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. The terminal 100 includes: a processor 50, a memory 51, a bus 52 and a communication interface 53. The processor 50, the communication interface 53 and the memory 51 are connected through the bus 52. The processor 50 is used to execute executable modules, such as computer programs, stored in the memory 51.
[0129] The memory 51 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 53 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.
[0130] Bus 52 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0131] The memory 51 is used to store programs. After receiving an execution instruction, the processor 50 executes the programs. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 50 or implemented by the processor 50.
[0132] Processor 50 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 50 or by instructions in software form. Processor 50 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 51. The processor 50 reads the information in memory 51 and, in conjunction with its hardware, completes the steps of the above method.
[0133] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the foregoing method embodiments, which will not be repeated here.
[0134] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0135] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A simulation method based on a graphical model, characterized in that, The method is applied to a terminal configured with basic graphical primitives, including object primitives, process primitives, and relationship primitives. The method includes: In response to configuration operations on the object primitives, process primitives, and relation primitives, a runnable simulation model is obtained; The simulation model is parsed to generate a target logic framework and a set of complex behaviors corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings, and the set of complex behaviors is composed of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives. The target logic framework and the complex behavior set are verified, and if both the target logic framework and the complex behavior set pass the verification, the model is run and simulated based on the target logic framework and the complex behavior set to obtain the running simulation results corresponding to the simulation model. The steps of parsing the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model include: Identify the target basic graphical primitives contained in the simulation model, which include target object primitives, target process primitives, and target relationship primitives; Read the attribute settings of the target object primitive, the target process primitive, and the target relationship primitive, and identify the connection relationships between the target object primitives, the connection relationships between the target process primitives, and the connection relationships between the target object primitives and the target process primitives based on the target relationship primitives; Based on the attribute settings and connection relationships of the target basic graphical primitives, a target logic framework corresponding to the simulation model is constructed, including: for any target process primitive within a sub-logic framework at any logic level, the following operations are performed: based on the attribute settings of the target object primitive, the sub-process primitives contained in the target object primitive are determined; based on the connection relationships of the sub-process primitives, the target object primitives associated with the sub-process primitives are determined, and the behavioral manipulations performed by the sub-process primitives on their associated target object primitives are determined, to obtain the sub-logic framework at the next logic level; the sub-logic frameworks at all logic levels constitute the logic framework corresponding to the simulation model; The simulation behaviors contained in the simulation model are generated according to the target logic framework, and the simulation behaviors are assembled into a complex behavior set according to the logic framework, including: for any target process primitive within a sub-logic framework at any logic level, the following operations are performed: based on the sub-process primitives contained in the target process primitive, and the behavior manipulations performed by the sub-process primitives on the associated target object primitives, at least one simulation behavior corresponding to the target process primitive is generated; each simulation behavior corresponding to the target process primitive is assembled into a complex behavior set corresponding to the target process primitive.
2. The simulation method based on a graphical model according to claim 1, characterized in that, The method further includes: The analysis process of the simulation model is monitored; When the parsing process is detected to meet the auxiliary judgment conditions based on the preset auxiliary mechanism, the parsing of the simulation model is paused, and a parsing confirmation prompt is initiated through the graphical user interface of the terminal. In response to the confirmation operation for the parsing confirmation prompt, the simulation model continues to be parsed.
3. The simulation method based on a graphical model according to claim 1, characterized in that, The verification of the target logical framework includes: consistency check of primitive relationships and / or convenience and constraint check; the steps for verifying the target logical framework include: If the relationship between the target basic graphical primitives contained in the target logical framework is consistent with the preset primitive relationship rules, then the target logical framework is determined to have passed the primitive relationship consistency test. For any target basic graphical primitive included in the target logic framework, determine whether the target basic graphical primitive meets the preset convenience conditions; if yes, determine that the target logic framework passes the convenience and constraint test; if no, determine whether the target basic graphical primitive meets the preset member constraint conditions; if the member constraint conditions are met, determine that the target logic framework passes the convenience and constraint test.
4. The simulation method based on a graphical model according to claim 1, characterized in that, The verification of the complex behavior set includes one or more of the following: behavior syntax verification, behavior semantic verification, and behavior logic verification; the steps for verifying the complex behavior set include: If the grammatical structure of the complex behavior set satisfies the preset primitive grammar rules, then the complex behavior set is determined to pass the behavior grammar verification. If the semantics of the complex behavior set is consistent with the preset semantic intent, then the complex behavior set is determined to have passed the behavior syntax verification. If the behavioral logic of the complex behavior set is operable, then the complex behavior set is determined to have passed the behavioral logic verification.
5. A simulation device based on a graphical model, characterized in that, The device is applied to a terminal, the terminal being configured with basic graphical primitives, the basic graphical primitives including object primitives, process primitives, and relationship primitives, and the device includes: The model building module is used to respond to configuration operations for the object primitives, the process primitives, and the relationship primitives to obtain a runnable simulation model; The model parsing module is used to parse the simulation model to generate the target logic framework and complex behavior set corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical primitives contained in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, which are used to perform behavioral manipulation on the target basic graphical primitives; The model verification and execution module is used to verify the target logic framework and the complex behavior set, and, if the target logic framework and the complex behavior set pass the verification, to perform model execution simulation based on the target logic framework and the complex behavior set, and obtain the execution simulation results corresponding to the simulation model. The model parsing module is specifically used for: Identify the target basic graphical primitives contained in the simulation model, which include target object primitives, target process primitives, and target relationship primitives; Read the attribute settings of the target object primitive, the target process primitive, and the target relationship primitive, and identify the connection relationships between the target object primitives, the connection relationships between the target process primitives, and the connection relationships between the target object primitives and the target process primitives based on the target relationship primitives; Based on the attribute settings and connection relationships of the target basic graphical primitives, a target logic framework corresponding to the simulation model is constructed, including: for any target process primitive within a sub-logic framework at any logic level, the following operations are performed: based on the attribute settings of the target object primitive, the sub-process primitives contained in the target object primitive are determined; based on the connection relationships of the sub-process primitives, the target object primitives associated with the sub-process primitives are determined, and the behavioral manipulations performed by the sub-process primitives on their associated target object primitives are determined, to obtain the sub-logic framework at the next logic level; the sub-logic frameworks at all logic levels constitute the logic framework corresponding to the simulation model; The simulation behaviors contained in the simulation model are generated according to the target logic framework, and the simulation behaviors are assembled into a complex behavior set according to the logic framework, including: for any target process primitive within a sub-logic framework at any logic level, the following operations are performed: based on the sub-process primitives contained in the target process primitive, and the behavior manipulations performed by the sub-process primitives on the associated target object primitives, at least one simulation behavior corresponding to the target process primitive is generated; each simulation behavior corresponding to the target process primitive is assembled into a complex behavior set corresponding to the target process primitive.
6. A terminal, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Domain-entity oriented graphic modeling and analyzing environment and implementation method thereof
CN106446382A
SIMSCRIPT language-oriented discrete event simulation graphical modeling method
CN111880784A