Simulation method and device based on graphical model operation, terminal and medium

Through a graphical model operation method based on concise primitives, the simulation model is constructed using object primitives, process primitives and relational primitives to generate target logical frameworks and complex behavior sets, the modeling complexity problem that requires code conversion in the existing technology is solved, and efficient simulation operation is achieved.

CN120256023AActive Publication Date: 2025-07-04BEIJING TONGYU ZHICHENG TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510410021.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-02
Publication Date
2025-07-04
Estimated Expiration
2045-04-02

AI Technical Summary

Technical Problem

The existing model simulation runtime system needs to be converted through code to achieve simulation operation, resulting in high modeling complexity and low efficiency, and cannot be directly run.

Method used

A graphical model operation method based on concise primitives is adopted to build a simulation model using object primitives, process primitives and relational primitives, and a target logical framework and complex behavior set are generated through intelligent parsing, so that simulation operation can be achieved without code conversion.

Benefits of technology

The modeling process is simplified, the learning difficulty is reduced, the simulation operation efficiency is improved, and a naturally runnable simulation model without code conversion is realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256023A_ABST
    Figure CN120256023A_ABST
Patent Text Reader

Abstract

The invention provides an operation simulation method and device based on a graphical model, a terminal and a medium, and the method comprises the steps: responding to a configuration operation for a basic graphical primitive, and obtaining a runnable simulation model; analyzing the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model; and verifying the target logic framework and the complex behavior set, and performing model operation simulation based on the target logic framework and the complex behavior set under the condition that the target logic framework and the complex behavior set pass verification to obtain an operation simulation result corresponding to the simulation model. The invention provides a natural runnable simulation running mechanism which is based on simple primitives to quickly construct a model and does not need to convert codes, so that the problem that an existing modeling system is limited or cannot be realized is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer simulation, and in particular to a method, device, terminal and medium for running simulation based on a graphical model. Background Art

[0002] Currently, existing model simulation running systems mainly involve systems based on UML (Unified Modeling Language), systems based on SysML (System Modeling Language), and other systems. Among them, the system based on UML is presented in terms of the dimension of the cut layer and cannot be directly run; although the system based on SysML can perform simulation running, it is also realized by configuring code in the graph; although there is model conversion to simulation running in other systems, it is also necessary to convert the model into code and then compile the code into a runnable state. These modeling systems all have limitations or situations where they cannot be realized. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, device, terminal and medium for running simulation based on a graphical model, and propose a natively runnable simulation running mechanism that quickly constructs a model based on simple graphic elements without code conversion, so as to improve the limitations or unachievable problems existing in existing modeling systems.

[0004] In a first aspect, the present invention provides a method for running simulation based on a graphical model. The method is applied to a terminal, and the terminal is configured with basic graphical elements, including object elements, process elements, and relationship elements. The method includes:

[0005] Responding to configuration operations for object elements, process elements, and relationship elements to obtain a runnable simulation model;

[0006] Parsing the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical elements included in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior control on the target basic graphical elements;

[0007] Verifying the target logic framework and the complex behavior set, and when both the target logic framework and the complex behavior set pass the verification, performing model running simulation based on the target logic framework and the complex behavior set to obtain a running simulation result corresponding to the simulation model.

[0008] In an implementation manner, the step of parsing the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model includes:

[0009] Identify the target basic graphical elements included in the simulation model, where the target basic graphical elements include target object elements, target process elements, and target relationship elements;

[0010] Read the attribute settings of the target object elements, target process elements, and target relationship elements, and identify the connection relationships between target object elements, the connection relationships between target process elements, and the connection relationships between target object elements and target process elements based on the target relationship elements;

[0011] Construct the target logic framework corresponding to the simulation model according to the attribute settings and connection relationships of the target basic graphical elements;

[0012] Generate the simulation behaviors included in the simulation model according to the target logic framework, and assemble the simulation behaviors into a complex behavior set according to the logic framework.

[0013] In one implementation, the step of constructing the target logic framework corresponding to the simulation model according to the attribute settings and connection relationships of the target basic graphical elements includes:

[0014] Perform the following operations on any target process element within the sub-logic framework of any logic level:

[0015] Based on the attribute settings of the target object element, determine the sub-process elements included in the target object element; based on the connection relationships of the sub-process elements, determine the target object elements associated with the sub-process elements, and determine the behavior manipulations performed by the sub-process elements on their associated target object elements, so as to obtain the sub-logic framework of the next logic level;

[0016] The sub-logic frameworks of all logic levels constitute the logic framework corresponding to the simulation model.

[0017] In one implementation, the step of generating the simulation behaviors included in the simulation model according to the target logic framework and assembling the simulation behaviors into a complex behavior set includes:

[0018] Perform the following operations on any target process element within the sub-logic framework of any logic level:

[0019] Generate at least one simulation behavior corresponding to the target process element based on the sub-process elements included in the target process element and the behavior manipulations performed by the sub-process elements on their associated target object elements;

[0020] Assemble each simulation behavior corresponding to the target process element into a complex behavior set corresponding to the target process element.

[0021] In one implementation, the method further includes:

[0022] Monitor the parsing process of the simulation model;

[0023] When it is monitored based on a preset auxiliary mechanism that the parsing process meets the auxiliary determination condition, suspend the parsing of the simulation model, and initiate a parsing confirmation prompt through the graphical user interface of the terminal;

[0024] In response to the confirmation operation for the parsing confirmation prompt, continue to parse the simulation model.

[0025] In one implementation, the verification of the target logic framework includes: primitive relationship consistency check and / or convenience and constraint check; the steps of verifying the target logic framework include:

[0026] If the relationships between the target basic graphical primitives included in the target logic framework are consistent with the preset primitive relationship rules, determine that the target logic framework passes the primitive relationship consistency check;

[0027] 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 so, determine that the target logic framework passes the convenience and constraint check; if not, determine whether the target basic graphical primitive meets the preset member constraint conditions; determine that the target logic framework passes the convenience and constraint check when the member constraint conditions are met.

[0028] In one implementation, the verification of the complex behavior set includes one or more of: behavior syntax verification, behavior semantics verification, and behavior logic verification; the steps of verifying the complex behavior set include:

[0029] If the syntax structure of the complex behavior set meets the preset primitive syntax rules, determine that the complex behavior set passes the behavior syntax verification;

[0030] If the semantics of the complex behavior set are consistent with the preset semantics Figure 1 then determine that the complex behavior set passes the behavior syntax verification.

[0031] If the behavior logic of the complex behavior set is operable, determine that the complex behavior set passes the behavior logic verification.

[0032] In a second aspect, the present invention further provides a simulation device based on a graphical model for operation, the device is applied to a terminal, the terminal is configured with basic graphical primitives, and the basic graphical primitives include object primitives, process primitives, and relationship primitives. The device includes:

[0033] A model construction module, configured to obtain a runnable simulation model in response to configuration operations for object primitives, process primitives, and relationship primitives;

[0034] A model parsing module, configured to parse a simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior control on the target basic graphical primitives;

[0035] A model verification and operation module, configured to verify the target logic framework and the complex behavior set, and based on the target logic framework and the complex behavior set to perform model operation simulation to obtain an operation simulation result corresponding to the simulation model when both the target logic framework and the complex behavior set pass the verification.

[0036] In a third aspect, the present invention further provides a terminal, including a processor and a memory, where the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method according to any one of the first aspect.

[0037] In a fourth aspect, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the method according to any one of the first aspect.

[0038] A method, device, terminal, and medium for running a simulation based on a graphical model provided by the present invention. The terminal is configured with basic graphical primitives, which include object primitives, process primitives, and relationship primitives. First, in response to configuration operations for the object primitives, process primitives, and relationship primitives, a runnable simulation model is obtained; then, the simulation model is parsed to generate a target logic framework and a complex behavior set corresponding to the simulation model. The target logic framework is used to describe the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings. The complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior control on the target basic graphical primitives; finally, the target logic framework and the complex behavior set are verified, and when both the target logic framework and the complex behavior set pass the verification, model running simulation is performed based on the target logic framework and the complex behavior set to obtain the running simulation result corresponding to the simulation model. The above method provides users with basic graphical primitives based on simple primitives, facilitating users to use the basic graphical primitives to construct a natively runnable simulation model without code conversion. By parsing the simulation model, a directory logic framework for describing the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, as well as a complex behavior set for performing behavior control on the target basic graphical primitives, are obtained. Finally, model simulation running is realized on the basis that the directory logic framework and the complex behavior set pass the verification. The present invention proposes a natively runnable simulation operation mechanism for quickly constructing a model based on simple primitives without code conversion to improve the limitations or unachievable problems existing in the existing modeling system.

[0039] Other features and advantages of the present invention will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.

[0040] To make the above objectives, features, and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. Brief Description of the Drawings

[0041] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0042] Figure 1 It is a technical framework diagram of an existing model running simulation technology provided by an embodiment of the present invention;

[0043] Figure 2 A simulation method based on a graphical model provided by an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of a basic graphical primitive provided by an embodiment of the present invention;

[0045] Figure 4 A schematic structural diagram of a simulation device based on a graphical model provided by an embodiment of the present invention;

[0046] Figure 5 A schematic structural diagram of a terminal provided by an embodiment of the present invention. Detailed implementation manners

[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. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0048] Refer to Figure 1 The technical framework diagram of an existing model operation simulation technology shown below mainly includes the following parts: (1) Primitive definition and storage: First, based on the scenario requirements used by the user, the user needs to select the corresponding modeling category, then define various graphical primitives, and can store them in the primitive library; (2) Primitive dragging 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 making the primitives executable; (3) Parsing and generating code: When the user completes the construction of the primitives and the 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 the user find problems.

[0049] Based on the existing technical solutions and described from an objective perspective, the problems and disadvantages of the existing technologies are as follows: (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 graphic elements, resulting in a large number of modeling types, complex graphic elements, and high learning difficulty; (2) The existing modeling technologies do not have the characteristic of being inherently executable. If you want the model to be executable, you must configure code at key links and achieve the executable characteristic through the logical connection of the code; (3) In the existing modeling and simulation process, when parsing the model graphic elements and the relationships between graphic elements, it is necessary to first convert the code and then compile it to be executable, and the conversion process is complex.

[0050] Based on this, the embodiments of the present invention provide a method, device, terminal, and medium for running a simulation based on a graphical model, and propose an inherently executable simulation operation mechanism for quickly constructing a model based on simple graphic elements without code conversion, so as to improve the limitations or problems that cannot be achieved in the existing modeling system.

[0051] To facilitate the understanding of this embodiment, first, a method for running a simulation based on a graphical model disclosed in the embodiments of the present invention will be introduced in detail. This method is applied to a terminal, and the terminal is configured with basic graphical elements, including object graphic elements, process graphic elements, and relationship graphic elements. Refer to Figure 2 The schematic flowchart of a method for running a simulation based on a graphical model shown, and this method mainly includes the following steps S202 to step S206:

[0052] Step S202, in response to the configuration operations for object graphic elements, process graphic elements, and relationship graphic elements, obtain an executable simulation model.

[0053] Among them, object graphic elements, process graphic elements, and relationship graphic elements, that is, use simple and standardized graphical forms to express objects, processes, and relationships. These basic graphical elements are used as the basis for constructing a simulation model, and the basic graphical elements have high reusability and flexibility, and can cover various basic elements and components required in the simulation deduction.

[0054] In one example, requirements are abstracted using object primitives, process primitives, and relationship primitives to construct a natively runnable simulation model that does not require code conversion. The simulation model includes target basic graphical primitives such as target object primitives, target process primitives, and target relationship primitives, as well as the connection relationships and attribute settings of each target basic graphical primitive. Among them, the target object primitive contains members and attributes, which are used to express the characteristics of the target object primitive. The target process primitive is used to express the functions or behaviors of the target object primitive. The target relationship primitive is used to describe the relationships between target object primitives, the relationships between target process primitives, and the relationships between target object primitives and target process primitives, describing the dependencies and interaction connections between the primitives.

[0055] Step S204, parse the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model.

[0056] Among them, the target logic framework is used to describe the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings. The complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior manipulation on the target basic graphical primitives.

[0057] In one example, first identify the target basic graphical primitives included in the simulation model, read the attribute settings of the target basic graphical primitives, and identify the connection relationships between the target basic graphical primitives; then combine the attribute settings and connection relationships to construct the target logic framework inside the simulation model to describe the overall structure and behavior of the simulation model through this target logic framework; finally, automatically generate corresponding simulation behaviors according to this target logic framework, and assemble the simulation behaviors into a complex behavior set according to the target logic framework. The complex behavior set is the core for model running simulation of the simulation model.

[0058] Step S206, verify the target logic framework and the complex behavior set, and when both the target logic framework and the complex behavior set pass the verification, perform model running simulation based on the target logic framework and the complex behavior set to obtain the running simulation result corresponding to the simulation model.

[0059] Among them, the verification of the target logic framework includes: primitive relationship consistency check and / or convenience and constraint check; the verification of the complex behavior set includes one or more of behavior syntax verification, behavior semantic verification, and behavior logic verification.

[0060] In one example, when both the target logic framework and the complex behavior set pass the verification, the complex behavior set can be called to perform behavior manipulation on the corresponding target basic graphical primitives according to the running logic characterized by the attribute information and connection relationships of each target basic graphical primitive in the target logic framework, so as to perform running simulation on the simulation model and obtain the required running simulation result.

[0061] If any one of the target logic framework and the complex behavior set fails to pass the verification, the target basic graphical primitive that fails to pass the verification can be located, and a prompt for failing to pass the verification is generated for the target basic graphical primitive to prompt the user to modify the target basic graphical primitive until it passes the verification.

[0062] The simulation method based on the graphical model provided by the embodiment of the present invention provides the user with basic graphical primitives based on simple primitives, which facilitates the user to construct a natively runnable simulation model without code conversion using the basic graphical primitives. By parsing the simulation model, a catalog logic framework for describing the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, and a complex behavior set for performing behavior control on the target basic graphical primitives are obtained. Finally, model simulation operation is realized on the basis that the catalog logic framework and the complex behavior set pass the verification. The present invention proposes a natively runnable simulation operation mechanism for quickly constructing a model based on simple primitives without code conversion to improve the limitations or problems that cannot be achieved in the existing modeling system.

[0063] For ease of understanding, the embodiment of the present invention provides a specific implementation manner of the simulation method based on the graphical model. The core of the embodiment of the present invention is to use three simple and standardized primitives of object, process, and relationship as the basis for constructing the model. These primitives have high reusability and flexibility and can cover various basic elements and components required in the simulation deduction. The user can quickly combine these primitives together through intuitive operation methods such as dragging and connecting to construct simulation models that meet specific requirements for logical modeling, process modeling, and arithmetic modeling. During the process of constructing the model, no code needs to be written or converted. When performing simulation operation, a set of intelligent parsing and operation mechanisms are inherited inside the mechanism, which can automatically identify the connection relationships and attribute settings between the primitives and generate the corresponding target logic framework and complex behavior set accordingly. This means that the user can easily perform model simulation operation without professional programming knowledge.

[0064] Before performing the foregoing step S202, it is necessary to design basic graphical primitives. The embodiment of the present invention uses a set of standardized and simple graphical primitives to represent the basic elements and components in the simulation model as the basis for model simulation operation. Exemplarily, refer to Figure 3 the schematic diagram of a basic graphical primitive shown.

[0065] The rectangular primitive represents an object primitive, and different attributes of the object primitive are represented by adding different annotations at different positions inside the object primitive. Among them, the elements (such as Figure 3The "m" in it represents different meanings. For example, m represents the constituent members of an instance, p represents the associated objects of an instance, t represents the temporary members of an instance, a represents the attribute members of an instance, c represents a constant, or represents a class when the graph is empty, or represents an interface when there is a circle inside the graph, etc.; the upper right corner of the object primitive is used to describe visibility. For example, it represents public when there is no content in the upper right corner of the object primitive, represents protected when there is an empty graph (such as a triangle) in the upper right corner of the object primitive, and represents private when there is a filled graph (such as a triangle) in the upper right corner of the object primitive; the graph located in the lower right corner of the object primitive represents "reference", such as the reference document cited by this object primitive, etc.

[0066] The oval primitive represents a process primitive, 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 into process primitives, the process of writing the process as code can be omitted. The upper left corner of the process primitive contains elements for representing process settings, elements for representing process code, etc. Process settings include time-independent, time-related, first start, subprocess, etc.; the upper right corner of the process primitive is used to describe visibility; the graph located in the lower right corner of the process primitive represents "reference". Optionally, different elements can also be added in front of the title "Time-Related Process" to represent that this process is a built-in process or constructor; time parameters can also be added below the title "Time-Related Process", including time unit, time precision, duration distribution, shortest time, expected time, longest time, etc.

[0067] The arrow-shaped primitive represents a relationship primitive, and different arrow shapes, filling methods, and arrow directions (such as bidirectional or unidirectional) represent different connection relationships. The connection relationships are divided into structural relationships and program relationships. Structural relationships include composition relationship, representation relationship, inheritance relationship, attribution relationship, structural control relationship, unidirectional labeled relationship, bidirectional labeled relationship, etc. Program relationships include consumption relationship, generation relationship, input influence relationship, output influence relationship, bidirectional influence relationship, state transition relationship, state transition relationship pair, dominant relationship, conditional relationship, call relationship, self-call relationship, timeout exception call relationship, time shortage exception call relationship, etc.

[0068] For the foregoing step S202, the embodiment of the present invention provides a specific implementation manner for obtaining a runnable simulation model in response to configuration operations for object primitives, process primitives, and relationship primitives, including: the user combines these basic graphical primitives together through operations such as dragging and connecting configurations, and realizes 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] For the foregoing step S204, an embodiment of the present invention provides a specific implementation manner for parsing a simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model. An intelligent parsing module is integrated inside the system, and this module can automatically generate the corresponding target logic framework and complex behavior set according to the graphic elements and their mutual relationships. The specific steps include the following steps 1 to 4:

[0070] Step 1: Identify the target basic graphical elements included in the simulation model. The target basic graphical elements include target object elements, target process elements, and target relationship elements.

[0071] The system identifies each target basic graphical element in the simulation model constructed by the user. Exemplarily, for any target basic graphical element, a shape parsing logic is called to extract the shape feature of the target basic graphical element, and the specific category of the target basic graphical element (that is, the target object element, the target process element, or the target relationship element) is determined according to the shape feature. For example, if a target basic graphical element is a rectangle, it is determined that the target basic graphical element is a target object element; if a target basic graphical element is an ellipse, it is determined that the target basic graphical element is a target process element; if a target basic graphical element is an arrow, it is determined that the target basic graphical element is a target relationship element.

[0072] Step 2: Read the attribute settings of the target object elements, the target process elements, and the target relationship elements, and identify the connection relationships between the target object elements, the connection relationships between the target process elements, and the connection relationships between the target object elements and the target process elements based on the target relationship elements.

[0073] In one example, read the attribute settings of each target basic graphical element, including its type, members, processes, and internal parameters and input / output relationships, etc. When specifically implemented, according to the specific type of the identified target basic graphical element, the attribute parsing process corresponding to the specific type can be called, and the attribute parsing process is used to read the attribute settings of the target basic graphical element. Taking the target object element as an example, the attribute parsing process corresponding to the category of the target object element is called, and each element of the target object element is identified by using this attribute parsing process. For example, the upper left corner of the target object element is identified to determine the type of the target object element (such as class, interface, constant, composition members of the instance, associated objects of the instance, temporary members of the instance, attribute members of the instance, etc.), the upper right corner of the target object element is identified to determine the visibility of the target object, and the lower right corner of the target object element is identified to determine the reference of the object; similarly, the attribute settings of the target process element can be identified.

[0074] In one example, the system analyzes the connection relationships between the target basic graphical elements and determines the data flow and information flow between them. When specifically implemented, based on the shape characteristics of the target relational elements and the elements pointed to by the first and last positions of the target relational elements, the connection relationships between the target object elements, the connection relationships between the target process elements, and the connection relationships between the target object elements and the target process elements can be obtained.

[0075] Step 3: Construct the target logic framework corresponding to the simulation model according to the attribute settings and connection relationships of the target basic graphical elements.

[0076] In one example, for any target process element within the sub-logic framework of any logical level, the following operations are performed: Based on the attribute settings of the target object element, determine the sub-process elements included in the target object element; Based on the connection relationships of the sub-process elements, determine the target object elements associated with the sub-process elements, and determine the behavior control executed by the sub-process elements on their associated target object elements, so as to obtain the sub-logic framework of the next logical level; The sub-logic frameworks of all logical levels constitute the logical framework corresponding to the simulation model.

[0077] When specifically implemented, the target process element is the definition of a type of behavior, and the target process element can include sub-process elements. Based on this, first traverse the target process elements included in the first logical level. According to the connection relationships of the target process elements, determine the target object elements associated with the target process elements, and the behavior control executed by the target process elements on their associated target object elements, so as to obtain the sub-logic framework of the first logical level; For the target process elements included in the first logical level, based on the attribute settings of the target process elements, identify the sub-process elements included in the target process elements. Here, the attribute settings are specifically the attribute settings identified based on the upper left corner of the process element. For any sub-process element included in the target process element within the first logical level (i.e., the target process element included in the second logical level), according to the connection relationships of the sub-process elements, determine the target object elements associated with the sub-process elements, and determine the behavior control executed by the sub-process elements on their associated target object elements, so as to obtain the sub-logic framework of the second logical level; Repeat the above process to obtain the target logic framework for describing the overall structure of the simulation model.

[0078] Step 4: Generate the simulation behaviors included in the simulation model according to the target logic framework, and assemble the simulation behaviors into a complex behavior set according to the logic framework.

[0079] In one example, for any target process primitive within the sub-logic framework of any logical level, the following operations are performed: Based on the sub-process primitives included in the target process primitive and the behavior 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] Exemplarily, 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 a large model. The behavior manipulations corresponding to sub-process primitive 1 and 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 to perform corresponding behavior manipulations on its associated target object primitive.

[0081] Furthermore, the embodiment of the present invention also sets up an auxiliary mechanism to ensure the efficient and accurate real-time parsing of simulation behaviors and continuous optimization, etc. Specifically, the parsing process of the simulation model is monitored. When it is detected based on the preset auxiliary mechanism that the parsing process meets the auxiliary determination condition, the parsing of the simulation model is paused, and a parsing confirmation prompt is initiated through the graphical user interface of the terminal. Then, in response to the confirmation operation for the parsing confirmation prompt, the parsing of the simulation model continues.

[0082] Among them, the auxiliary determination condition can be a determination condition based on the parsing process or a determination condition based on the primitive. Exemplarily, taking the determination condition based on the parsing process as an example, when reaching a pre-marked key parsing process, it is determined that the auxiliary determination condition is met. Taking the determination condition based on the primitive as an example, during the process of establishing the simulation model, in response to the marking operation for a specified target basic graphical primitive; during the process of parsing the simulation model, it is detected whether the currently parsed target basic graphical primitive carries a mark. If it carries a mark, it is determined that the auxiliary determination condition is met.

[0083] When the auxiliary determination condition is met, the parsing process will be paused, and the parsing result generated by the current parsing process will be displayed through the graphical user interface. At the same time, a parsing confirmation prompt is initiated. If not confirmed, it will directly jump to the editing page of the target basic graphical primitive involved in the current parsing process to enable the user to modify the target basic graphical primitive or other target basic graphical primitives associated with it; if confirmed, the parsing process continues.

[0084] For the foregoing step S206, after the target logic framework and the complex behavior set pass the verification, the embodiment of the present invention also provides a specific implementation manner for verifying the target logic framework and the complex behavior set.

[0085] In practical applications, after generating a complex behavior set, it is necessary to perform syntax checking, semantic checking, consistency checking of graphic element relationships, convenience and constraint checking, simulation logic checking, etc. on the target logic framework and the complex behavior set.

[0086] In one example, the steps for verifying the target logic framework include:

[0087] (1.1) If the relationships between the target basic graphical elements included in the target logic framework are consistent with the preset graphic element relationship rules, it is determined that the target logic framework passes the consistency check of graphic element relationships. Among them, the graphic relationship rules are used to describe the conditions that should be satisfied by the relationships between basic graphical elements. For example, the relationship between target process elements should be a program relationship. Suppose the relationship between two target process elements is an inheritance relationship. Since the inheritance relationship belongs to a structural relationship, it is determined that the relationship between these two target process elements does not conform to the graphic element relationship rules. At this time, it is determined that the consistency check of graphic element relationships is not passed.

[0088] (1.2) For any target basic graphical element included in the target logic framework, determine whether the target basic graphical element satisfies the preset convenience conditions; if so, it is determined that the target logic framework passes the convenience and constraint check; if not, determine whether the target basic graphical element satisfies the preset member constraint conditions; if the member constraint conditions are satisfied, it is determined that the target logic framework passes the convenience and constraint check. Among them, the member constraint conditions can be understood as: when a target basic graphical element must contain a certain member (or other constraints), the target basic graphical element has the execution condition; the convenience conditions can be understood as: some object elements or process elements themselves lack a certain member (or other constraints), so for these object elements or process elements, they also have the execution condition when they do not meet the constraint conditions. In specific implementation, determine whether a certain target basic graphical element is a preset basic graphical element that meets the convenience conditions. If so, it can be directly determined that it passes the convenience and constraint check. If not, further determine whether the target basic graphical element contains the specified member. If so, it can be determined that it passes the convenience and constraint check, otherwise it does not pass.

[0089] In one example, the steps for verifying the complex behavior set include:

[0090] (2.1) If the syntax structure of the complex behavior set meets the preset graphic element syntax rules, it is determined that the complex behavior set passes the behavior syntax verification. In specific implementation, perform syntax checking on the complex behavior set, which includes checking whether the syntax structure in the complex behavior set is correct, and whether expressions, control flows (loops and conditional judgments), etc. conform to the graphic element syntax rules recognized by the graphic programming or simulation system.

[0091] (2.2) If the semantics of a complex behavior set is consistent with the pre-set semantics Figure 1 If the complex behavior set is consistent, it is determined that the complex behavior set has passed the behavior syntax verification. In the specific implementation, the semantics needs to be verified to ensure that each element (type, member, process, etc.) in the complex behavior set is semantically correct, that is, their usage is consistent with the predefined or user-set scenario intentions, etc.

[0092] (2.3) If the behavior logic of the complex behavior set is executable, it is determined that the complex behavior set has passed the behavior logic verification. In the specific implementation, the behavior logic after the entire modeling analysis is verified to ensure that it can be simulated and run.

[0093] For the aforementioned step S206, the embodiment of the present invention further provides a specific implementation method for performing model operation simulation based on the target logic framework and the complex behavior set to obtain the operation simulation result corresponding to the simulation model.

[0094] In actual applications, once the target logic framework and complex behavior set pass the verification and validation, they will enter the runnable state, and combined with the run simulation mechanism, demonstrate the model's ability to run simulation. Specifically, according to the run logic represented by the attribute information and connection relationship of each target basic graphic primitive in the target logic framework, the complex behavior set can be called to manipulate the behavior of the corresponding target basic graphic primitive, realize the run simulation of the simulation model, and obtain the required run simulation results.

[0095] In summary, the method for running simulation based on a graphical model provided by the embodiment of the present invention converts 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, the deduction efficiency is made more efficient and simple, the system logic complexity is reduced, and the actual operation experience of the user is improved. Specifically, the embodiment of the present invention has at least the following features:

[0096] (1) The model is constructed based on the scenario. The model consists of objects, processes, and relationships, and the modeling method is simple and convenient. (2) The constructed simulation model can meet the needs of logical modeling, process modeling, arithmetic modeling, etc. The constructed graphics and graphics relationships are inherently executable without the need for separate code configuration. (3) Model analysis does not require code conversion or compilation, and can directly identify graphics information.

[0097] Based on the above embodiments, an embodiment of the present invention provides a simulation device based on a graphical model. The device is applied to a terminal. The terminal is configured with basic graphical primitives. The basic graphical primitives include object primitives, process primitives, and relationship primitives. Figure 4 The schematic diagram of the structure of a simulation device based on a graphical model is shown, and the device mainly includes the following parts:

[0098] A model construction module 402, configured to obtain a runnable simulation model in response to configuration operations for object primitives, process primitives, and relationship primitives.

[0099] A model parsing module 404, configured to parse the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior control on the target basic graphical primitives.

[0100] A model verification and running module 406, configured to verify the target logic framework and the complex behavior set, and perform model running simulation based on the target logic framework and the complex behavior set when both the target logic framework and the complex behavior set pass the verification, so as to obtain a running simulation result corresponding to the simulation model.

[0101] The graphical model-based running simulation device provided by the embodiments of the present invention provides users with basic graphical primitives based on simple primitives, facilitating users to use the basic graphical primitives to construct a natively runnable simulation model without code conversion. By parsing the simulation model, a directory logic framework for describing the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, as well as a complex behavior set for performing behavior control on the target basic graphical primitives, are obtained. Finally, model simulation running is realized on the basis that the directory logic framework and the complex behavior set pass the verification. The present invention proposes a natively runnable simulation running mechanism for quickly constructing a model based on simple primitives without code conversion to improve the limitations or problems that cannot be achieved in existing modeling systems.

[0102] In one implementation, the model parsing module 404 is specifically configured to:

[0103] Identify the target basic graphical primitives included in the simulation model, where the target basic graphical primitives include target object primitives, target process primitives, and target relationship primitives;

[0104] Read the attribute settings of the target object primitives, target process primitives, and target relationship primitives, and identify the connection relationships between target object primitives, the connection relationships between target process primitives, and the connection relationships between target object primitives and target process primitives based on the target relationship primitives;

[0105] Construct a target logic framework corresponding to the simulation model according to the attribute settings and connection relationships of the target basic graphical primitives;

[0106] Generate simulation behaviors included in the simulation model according to the target logic framework, and assemble the simulation behaviors into a complex behavior set according to the logic framework.

[0107] In one implementation, the model parsing module 404 is specifically configured to:

[0108] Perform the following operations on any target process primitive within the sub-logic framework of any logic level:

[0109] Based on the attribute settings of the target object primitive, determine the sub-process primitives included in the target object primitive; based on the connection relationships of the sub-process primitives, determine the target object primitives associated with the sub-process primitives, and determine the behavior control that the sub-process primitives perform on their associated target object primitives, so as to obtain the sub-logic framework of the next logic level;

[0110] The sub-logic frameworks of all logic levels constitute the logic framework corresponding to the simulation model.

[0111] In one implementation, the model parsing module 404 is specifically configured to:

[0112] Perform the following operations on any target process primitive within the sub-logic framework of any logic level:

[0113] Based on the sub-process primitives included in the target process primitive, and the behavior control that the sub-process primitives perform on their associated target object primitives, generate at least one simulation behavior corresponding to the target process primitive;

[0114] Assemble each simulation behavior corresponding to the target process primitive into a complex behavior set corresponding to the target process primitive.

[0115] In one implementation, it further includes an auxiliary parsing module, which is used to:

[0116] Monitor the parsing process of the simulation model;

[0117] When it is monitored based on a preset auxiliary mechanism that the parsing process meets the auxiliary determination condition, suspend the parsing of the simulation model, and initiate a parsing confirmation prompt through the graphical user interface of the terminal;

[0118] Respond to the confirmation operation for the parsing confirmation prompt, and continue to parse the simulation model.

[0119] In one implementation, the verification of the target logic framework includes: primitive relationship consistency check and / or convenience and constraint check; the model verification and operation module 406 is specifically configured to:

[0120] If the relationships between the target basic graphical primitives included in the target logic framework are consistent with the preset primitive relationship rules, determine that the target logic framework passes the primitive relationship consistency check;

[0121] 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 so, determine that the target logic framework passes the convenience and constraint check; if not, determine whether the target basic graphical primitive meets the preset member constraint conditions; and determine that the target logic framework passes the convenience and constraint check when the member constraint conditions are met.

[0122] In one implementation, the verification of the complex behavior set includes one or more of: behavior syntax verification, behavior semantics verification, and behavior logic verification; the model verification and operation module 406 is specifically configured to:

[0123] If the syntax structure of the complex behavior set meets the preset primitive syntax rules, determine that the complex behavior set passes the behavior syntax verification;

[0124] If the semantics of the complex behavior set is consistent with the preset semantics Figure 1 then determine that the complex behavior set passes the behavior syntax verification.

[0125] If the behavior logic of the complex behavior set is executable, determine that the complex behavior set passes the behavior logic verification.

[0126] The device provided by the embodiments of the present invention has the same implementation principle and the same technical effects as those of the foregoing method embodiments. For the sake of brief description, for the parts not mentioned in the device embodiments, reference may be made to the corresponding content in the foregoing method embodiments.

[0127] The embodiments of the present invention provide a terminal. Specifically, the terminal includes a processor and a storage device; a computer program is stored on the storage device, and the computer program executes the method according to any one of the foregoing implementations when being run by the processor.

[0128] Figure 5 FIG. is a schematic structural diagram of a terminal provided by 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 configured to execute an executable module stored in the memory 51, such as a computer program.

[0129] Among them, the memory 51 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 53 (which may be wired or wireless), a communication connection is realized between the system network element and at least one other network element, and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.

[0130] The bus 52 can be an ISA bus, a PCI bus, an EISA bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 5 only a bidirectional arrow is used in Figure 5 , but it does not mean that there is only one bus or one type of bus.

[0131] Among them, the memory 51 is used to store a program. After receiving an execution instruction, the processor 50 executes the program. The method executed by the device defined by the flow process disclosed in any one of the foregoing embodiments of the present invention can be applied to the processor 50 or implemented by the processor 50.

[0132] The processor 50 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 50 or the instructions in the form of software. The above-mentioned processor 50 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 51, and the processor 50 reads the information in the memory 51 and combines its hardware to complete the steps of the above method.

[0133] The computer program product of the readable storage medium provided by 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 method described in the foregoing method embodiments. For the specific implementation, reference can be made to the foregoing method embodiments and will not be elaborated here.

[0134] If the above-mentioned functions are implemented in the form of software function 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 the present invention, in essence, or the part that contributes to the prior art, or a part of this 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 enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0135] Finally, it should be noted that the above-mentioned embodiments are only specific implementation manners of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the technical field can still modify the technical solutions recorded in the foregoing embodiments, or easily conceive of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A method for running a simulation based on a graphical model, characterized in that The method is applied to a terminal, which is configured with basic graphical primitives, and the basic graphical primitives include object primitives, process primitives, and relationship primitives. The method includes: Responding to configuration operations on the object primitive, the process primitive, and the relationship primitive to obtain a runnable simulation model; Parsing the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model. Among them, the target logic framework is used to describe the target basic graphical primitives included in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior control on the target basic graphical primitives; Verifying the target logic framework and the complex behavior set, and when both the target logic framework and the complex behavior set pass the verification, performing model running simulation based on the target logic framework and the complex behavior set to obtain a running simulation result corresponding to the simulation model.

2. The simulation method based on a graphical model according to claim 1, wherein The step of parsing the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model includes: Identifying the target basic graphical primitives included in the simulation model, where the target basic graphical primitives include target object primitives, target process primitives, and target relationship primitives; Reading the attribute settings of the target object primitive, the target process primitive, and the target relationship primitive, and identifying the connection relationships between the target object primitives, the connection relationships between the target process primitives, and the connection relationships between the target object primitive and the target process primitive based on the target relationship primitive; Constructing a target logic framework corresponding to the simulation model according to the attribute settings and the connection relationships of the target basic graphical primitives; Generating simulation behaviors included in the simulation model according to the target logic framework, and assembling the simulation behaviors into a complex behavior set according to the logic framework.

3. The method for running a simulation based on a graphical model according to claim 2, wherein The step of constructing a target logic framework corresponding to the simulation model according to the attribute settings and the connection relationships of the target basic graphical primitives includes: Performing the following operations on any target process primitive within a sub-logic framework at any logic level: Determining sub-process primitives included in the target object primitive based on the attribute settings of the target object primitive; determining the target object primitives associated with the sub-process primitive and the behavior control performed by the sub-process primitive on the associated target object primitive based on the connection relationship of the sub-process primitive to obtain a 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.

4. The method for running a simulation based on a graphical model according to claim 3, wherein The step of generating simulation behaviors included in the simulation model according to the target logic framework and assembling the simulation behaviors into a complex behavior set according to the logic framework includes: Performing the following operations on any target process primitive within a sub-logic framework at any logic level: Based on the sub - process graph elements included in the target process graph element and the behavior manipulation performed by the sub - process graph elements on the associated target object graph elements, generate at least one simulation behavior corresponding to the target process graph element; Assemble each of the simulation behaviors corresponding to the target process graph element into a complex behavior set corresponding to the target process graph element.

5. The simulation method based on a graphical model according to claim 1, wherein The method further includes: Monitor the parsing process of the simulation model; When it is monitored based on a preset auxiliary mechanism that the parsing process meets the auxiliary determination condition, pause the parsing of the simulation model and initiate a parsing confirmation prompt through the graphical user interface of the terminal; In response to the confirmation operation for the parsing confirmation prompt, continue to parse the simulation model.

6. The simulation method based on a graphical model according to claim 1, wherein The verification of the target logic framework includes: verification of the consistency of graph element relationships and / or verification of convenience and constraints; the steps for verifying the target logic framework include: If the relationships between the target basic graphical graph elements included in the target logic framework are consistent with the preset graph element relationship rules, determine that the target logic framework passes the graph element relationship consistency verification; For any target basic graphical graph element included in the target logic framework, determine whether the target basic graphical graph element meets the preset convenience conditions; if so, determine that the target logic framework passes the convenience and constraint verification; if not, determine whether the target basic graphical graph element meets the preset member constraint conditions; determine that the target logic framework passes the convenience and constraint verification when the member constraint conditions are met.

7. The method for running a simulation based on a graphical model according to claim 1, wherein The verification of the complex behavior set includes: one or more of behavior syntax verification, behavior semantics verification, and behavior logic verification; the steps for verifying the complex behavior set include: If the syntax structure of the complex behavior set meets the preset graph element syntax rules, determine that the complex behavior set passes the behavior syntax verification; If the semantics of the complex behavior set are consistent with the preset semantic intentions, determine that the complex behavior set passes the behavior syntax verification. If the behavior logic of the complex behavior set is executable, determine that the complex behavior set passes the behavior logic verification.

8. A simulation device based on a graphical model, characterized in that, The device is applied to a terminal, the terminal is configured with basic graphical graph elements, and the basic graphical graph elements include object graph elements, process graph elements, and relationship graph elements. The device includes: A model construction module, configured to obtain a runnable simulation model in response to configuration operations for the object graph element, the process graph element, and the relationship graph element; A model parsing module, configured to parse the simulation model to generate a target logic framework and a complex behavior set corresponding to the simulation model; wherein, the target logic framework is used to describe the target basic graphical graph elements included in the simulation model and their connection relationships and attribute settings, and the complex behavior set is composed of multiple simulation behaviors, and the simulation behaviors are used to perform behavior manipulation on the target basic graphical graph elements; The model verification and operation module is used to verify the target logic framework and the complex behavior set, and when both the target logic framework and the complex behavior set pass the verification, perform model operation simulation based on the target logic framework and the complex behavior set to obtain the operation simulation result corresponding to the simulation model.

9. A terminal, characterized in that, It includes a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Visual modeling method for distributed simulation platform

    CN105677446A

  • Domain-entity oriented graphic modeling and analyzing environment and implementation method thereof

    CN106446382A

  • SIMSCRIPT language-oriented discrete event simulation graphical modeling method

    CN111880784A

  • Visual modeling method for virtual operation environment of complex embedded system

    CN112926109A

  • Nuclear power plant control model construction method, electronic equipment and storage medium

    CN119292205A