Simulation method, device and equipment for OPM model
Through dynamic simulation and deduction of the OPM model, the high communication and understanding cost caused by the static nature of the OPM model is solved, and the dynamic execution and understanding of the model are improved.
Patent Information
- Application Number
- CN202410154550.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-04
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-02-04
AI Technical Summary
As a static model, the OPM model lacks dynamic capabilities, which leads to high cost of communicating and understanding the model for multiple people.
By obtaining the OPM model to be deduced, the model is parsed to obtain the relationship between things and things, a runnable simulation deduction code is generated, and the running code is loaded to realize the dynamic simulation deduction of the model.
The dynamic simulation deduction of the OPM model is realized, which improves the comprehensibility of the model and reduces the cost of multi-person communication and understanding the model.
Smart Images

Figure CN117951026B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of simulation and deduction technology, and in particular to a simulation and deduction method, device and equipment for an OPM model. Background Art
[0002] The Object Process Method (OPM) is a conceptual modeling methodology proposed by IEEE Lifetime Fellow Dov Dori. This methodology has been recognized as the international standard ISO / PAS19450:2015, corresponding to the national standard GB / T 39470-2020. The Object Process Methodology is one of the mainstream modeling methodologies in the current MBSE field. However, the OPM model is a static model, and the model itself does not have dynamic capabilities, which leads to high costs for multiple people to communicate and understand the OPM model. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a simulation and deduction method, device and equipment for an OPM model, which can realize the dynamic simulation and deduction of the OPM model, improve the comprehensibility of the model, and thus help reduce the cost of communication and understanding of the model for multiple people.
[0004] In a first aspect, an embodiment of the present invention provides a simulation method for an OPM model, comprising:
[0005] Obtain the OPM model to be deduced;
[0006] The OPM model is parsed to merge and select the things and the relationships between things included in the OPM model to obtain the relationship between things; wherein the things include objects and processes;
[0007] Generate an executable simulation code based on the object association relationship, load and run the simulation code to obtain the loading and running process of the simulation code and / or the OPM model.
[0008] In one embodiment, the OPM model includes a plurality of OPDs, each of which includes things and relationships between things;
[0009] The OPM model is parsed to merge and select the objects and the relationships between the objects contained in the OPM model to obtain the relationship between the objects, including:
[0010] Traversing each of the OPDs and each of the things contained in the OPDs to determine the association relationships that the things have in the OPDs;
[0011] Determine whether the current thing exists in the pre-built thing set;
[0012] If yes, then the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set are merged and selected;
[0013] If not, the association relationship of the current thing in the OPD is stored in the thing set;
[0014] When the traversal is completed, the thing association relationship corresponding to the OPM model is obtained.
[0015] In one implementation, the step of merging and selecting the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set includes:
[0016] If the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set are different association relationships between the current thing and the same thing, the target merging and rejection strategy is determined according to the mapping relationship between the type of the thing, the type of the association relationship and the merging and rejection strategy;
[0017] Based on the target merging and rejection strategy, the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set are merged and rejected.
[0018] In one embodiment, the steps of generating an executable simulation deduction code based on the object association relationship, loading and running the simulation deduction code to obtain a simulation deduction result corresponding to the OPM model include:
[0019] Generate program code according to the object association relationship; wherein the program code includes one or more of object code, object code, process code, state code, constraint code, master control code, initialization code, stop condition code, event code, message code and system automatic processing object code;
[0020] Compiling the program code at least once, generating executable simulation deduction code each time; wherein the package path and / or namespace configured each time during compilation are different;
[0021] The simulation deduction code is loaded and run, and the loading and running process of the simulation deduction code is controlled. When the simulation deduction code stops running, the simulation deduction result corresponding to the OPM model is obtained.
[0022] In one embodiment, the method is applied to a simulation system;
[0023] The method further comprises: upon receiving a call request from a target device for the simulation and deduction system, providing the simulation and deduction system to the target device in a microservice form;
[0024] The method also includes: registering the simulation system in a service registration center so that the simulation system obtains instance addresses of other services provided by the service registration center and calls other services based on the instance addresses.
[0025] In one embodiment, the simulation system is configured with a clock;
[0026] The method further comprises:
[0027] Record the simulation deduction code generated by compiling the process code as the process simulation deduction code, and record the simulation deduction code generated by compiling the system automatic processing object code as the automatic processing object simulation deduction code;
[0028] In the case where the operation trigger condition of the process simulation deduction code is related to time information, the time information provided by the clock is processed by the automatic processing object simulation deduction code to determine whether the operation trigger condition is met according to the processing result;
[0029] If yes, then load and run the process simulation code.
[0030] In one embodiment, the method further comprises:
[0031] During the loading and running of the simulation code, when a change in the simulation state, an object instance or a process instance is detected, system snapshot information of the simulation system is output, and / or a full-process record of the simulation is generated;
[0032] Among them, the simulation and deduction full process record is used to record the changes in the simulation and deduction state, the changes in the object instance and the changes in the process instance, so as to restore the loading and running process of the simulation and deduction code.
[0033] In one embodiment, the simulation system supports a plug-and-play configuration process monitoring and display interface; the method further comprises:
[0034] The loading and running process of the simulation deduction code is pushed to multiple identical or different configuration process monitoring and display interfaces, so as to render and display the loading and running process of the simulation deduction code through the configuration process monitoring and display interfaces.
[0035] In a second aspect, an embodiment of the present invention further provides a simulation and deduction device for an OPM model, comprising:
[0036] A model acquisition module is used to obtain the OPM model to be deduced;
[0037] A model parsing module, used to parse the OPM model, so as to merge and select the objects and the relationships between the objects contained in the OPM model, and obtain the relationship between the objects; wherein the objects include objects and processes;
[0038] A simulation and deduction module is used to generate an executable simulation and deduction code based on the object association relationship, load and run the simulation and deduction code to obtain the loading and running process of the simulation and deduction code and / or the simulation and deduction results corresponding to the OPM model.
[0039] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement any one of the methods provided in the first aspect.
[0040] The embodiment of the present invention provides a simulation deduction method, device and equipment for an OPM model. First, the OPM model to be deduced is obtained; then the OPM model is parsed to merge and select the things contained in the OPM model and the relationship between things to obtain the relationship between things; wherein things include objects and processes; finally, an executable simulation deduction code is generated based on the relationship between things, and the simulation deduction code is loaded and run to determine the simulation deduction result corresponding to the OPM model. The above method parses and processes the OPM model to obtain the relationship between things, and generates an executable simulation deduction code on this basis, and loads and runs the code to realize simulation deduction, thereby obtaining the simulation deduction result. The embodiment of the present invention improves the comprehensibility of the model through the dynamic execution of the OPM model, which is convenient for modelers to verify the model, and also helps to reduce the cost of communication and understanding of the model by multiple people.
[0041] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A schematic diagram of a flow chart of a simulation deduction method of an OPM model provided by an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of the overall process of a simulation deduction method of an OPM model provided by an embodiment of the present invention;
[0046] Figure 3 A model diagram for parsing and processing an OPM model provided by an embodiment of the present invention;
[0047] Figure 4 A model diagram for generating program code provided by an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of the structure of a simulation and deduction device for an OPM model provided by an embodiment of the present invention;
[0049] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] Currently, there is no deduction method or tool based on the OPM model. The commonly used greatarch software is a modeling tool that does not have deduction and simulation capabilities. Based on this, the present invention implements a simulation deduction method, device and equipment for an OPM model, which can realize dynamic simulation deduction of the OPM model and improve the comprehensibility of the model, thereby helping to reduce the cost of communication and understanding of the model by multiple people.
[0052] To facilitate understanding of this embodiment, a simulation deduction method of an OPM model disclosed in an embodiment of the present invention is first described in detail. The method is applied to a simulation deduction system, see Figure 1The flowchart of a simulation deduction method of an OPM model shown in FIG. 1 mainly includes the following steps S102 to S106:
[0053] Step S102, obtaining the OPM model to be derived.
[0054] Among them, the OPM model includes multiple OPDs. Different OPDs only describe things with different focuses, levels or granularities. Each OPD includes things and the relationships between things. Things include objects and processes.
[0055] Step S104, parsing the OPM model to merge and select the objects and the relationships between the objects included in the OPM model to obtain the relationship between the objects.
[0056] Among them, the thing association relationship includes all objects, processes and their association relationships in the OPM model. In one embodiment, the same thing may appear in different OPDs, and the accompanying associations may also be different. The deduction is not run one by one according to the OPD, but all things must be integrated together to form an overall thing association relationship to facilitate subsequent deduction and simulation. Therefore, it is necessary to parse each OPD contained in the OPM model, merge the things contained in the OPD and the associations between things, and if the same thing has different or even contradictory associations, it can be merged and selected according to the pre-configured merging and selection strategies to retain the correct and reasonable associations and form an overall thing association relationship.
[0057] Step S106, generating executable simulation deduction code based on the object association relationship, loading and running the simulation deduction code to obtain the loading and running process of the simulation deduction code and / or the simulation deduction result corresponding to the OPM model.
[0058] Among them, the simulation deduction code can be a bytecode or a machine code. In one embodiment, the corresponding program code can be generated based on the above-mentioned object association relationship, and the program code includes one or more of the object code, object code, process code, state code, constraint code, master control code, initialization code, stop condition code, event code, message code and system automatic processing object code; then the above-mentioned program code is compiled to obtain the executable simulation deduction code corresponding to each degree code; the simulation deduction code obtained by the compilation is loaded and run to realize the simulation deduction of the OPM model, and the deduction control can be performed during the simulation deduction process, and the simulation deduction result corresponding to the OPM model can be obtained when the simulation deduction is completed.
[0059] The simulation and deduction method of the OPM model provided in the embodiment of the present invention parses and processes the OPM model to obtain the relationship between things, and generates executable simulation and deduction code on this basis, and realizes the simulation and deduction by loading and running the code, so as to obtain the simulation and deduction result. The embodiment of the present invention improves the comprehensibility of the model through the dynamic execution of the OPM model, facilitates the model verification by the modeler, and also helps to reduce the cost of communication and understanding of the model by multiple people.
[0060] For ease of understanding, the present invention provides a specific implementation of a simulation method for an OPM model. Figure 2 The overall flow diagram of the simulation deduction method of an OPM model shown includes: obtaining the OPM model; parsing and processing the OPM model to obtain the overall relationship between things; generating program code; compiling the code to obtain bytecode and machine code; loading and running for deduction, viewing and controlling the deduction process through deduction control, and obtaining the deduction result. The embodiment of the present invention can dynamically display and verify the logic of the model through the dynamic execution of the model, improve the comprehensibility of the model, facilitate the model verification by the modeler, and also facilitate multiple people to communicate and understand the model.
[0061] Further, for the aforementioned step S104, the embodiment of the present invention provides an implementation method for parsing the OPM model to merge and select the objects and the relationships between the objects included in the OPM model to obtain the relationship between the objects, see Figure 3 A model diagram for parsing and processing an OPM model is shown. For multiple OPDs (ie, OPDs) contained in the OPM model, each OPD is parsed, and the information of the same thing located in different OPDs is merged in combination with the rules of merging and selection to obtain the overall thing association relationship.
[0062] For details, please refer to steps 1 to 5 below:
[0063] Step 1, traverse each OPD and each thing contained in the OPD to determine the association relationship that the thing has in the OPD.
[0064] In one example, the same thing may appear in different OPDs, and the associated associations may also be different, so it is necessary to loop all OPDs and loop each thing T contained in each OPD.
[0065] Step 2: Determine whether the current transaction exists in the pre-built transaction set. If yes, go to step 3; if no, go to step 4.
[0066] In one example, an empty transaction set TS is pre-established. During the loop process, it is determined whether the transaction T currently being looped (referred to as the current transaction) exists in the transaction set TS. If so, step 3 is executed; if not, step 4 is executed.
[0067] Step 3: merge and select the associations of the current object in the OPD and the associations of the current object stored in the object set.
[0068] In one example, if the current thing T exists in the thing set TS, the association R of the thing T in the current OPD is checked cyclically, and the association R is compared with each association R1 of the current thing T in the thing set TS. If it is an association with the same thing T1, the association R and association R1 are merged and discarded according to the pre-configured merge and discard strategy.
[0069] Among them, there is a mapping relationship between the merging and rejection strategy and the type of things and the type of association relationship. The merging and rejection strategies mainly adopt the following types: retain the existing associations in the thing set TS; or, retain the corresponding associations based on the priority of OPD, such as if the priority of the OPD where the association R is located is higher than the priority of the OPD where the association R1 is located, then retain the association R and eliminate the association R1; or, retain the corresponding association according to the priority of the type of association relationship, such as the types of association relationships include expansion-representation, aggregation-dispersion, generalization-specialization, and classification-instantiation, and give priority to retaining associations with high priorities; or, retain both the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set.
[0070] Based on the above-mentioned merging and selection rules, the embodiment of the present invention provides an implementation method for merging and selecting the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set, see the following steps 3.1 to 3.2:
[0071] Step 3.1, if the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set are different association relationships between the current thing and the same thing, then determine the target merging and rejection strategy based on the mapping relationship between the type of thing, the type of association relationship and the merging and rejection strategy.
[0072] For example, assuming that the current thing T has an association R with thing T1 in OPD, and has an association R1 with thing T1 in the thing set, then the corresponding target merging and rejection strategy is determined based on the types of things T and thing T1, and the types of associations R and association R1.
[0073] Step 3.2, based on the target merging and selection strategy, merge and select the associations of the current object in the OPD and the associations of the current object stored in the object set.
[0074] Exemplarily, assuming that the current thing T is an object, thing T1 is a process, and the types of association relationships R1 and R are both "display-representation", then association R will be discarded and association R1 will be retained.
[0075] Step 4: Store the association relationship of the current thing in OPD into the thing collection.
[0076] In one example, if the current object T does not exist in the object set TS, the current object T and its associated relationship R are saved in the object set TS.
[0077] Step 5: When the traversal is completed, the object association relationship corresponding to the OPM model is obtained.
[0078] For the aforementioned step S106, the embodiment of the present invention further provides an implementation method of generating an executable simulation deduction code based on the relationship between things, loading and running the simulation deduction code, and determining the simulation deduction result corresponding to the OPM model, see the following steps a to c:
[0079] Step a: Generate program code based on the relationship between things. Figure 4 A model diagram for generating program code is shown, which generates code according to the overall relationship between things, and sets the stop condition and the initialization condition at the same time to obtain the final program code.
[0080] Among them, the program code includes one or more of transaction code, object code, process code, status code, constraint code, master control code, initialization code, stop condition code, event code, message code and system automatic processing object code. The control and presentation logic of the OPM model can be realized based on the generated program code.
[0081] The code is explained from an object-oriented perspective as follows:
[0082] In one example, things have a base class, objects have a base class that is a subclass of the thing base class, and procedures have a base class that is a subclass of the thing base class. Each object will generate a class (that is, the object code) that is a subclass of the object base class, and each procedure will generate a class (that is, the procedure code) that is a subclass of the procedure base class.
[0083] In one example, the constraint has a constraint base class, and each constraint will generate a constraint class (that is, constraint code) which is a subclass of the constraint base class. Optionally, an embodiment of the present invention provides an end constraint syntax compiler that complies with the OPM standard. The end constraint compiler can be used to compile the end constraint statements of the model to ultimately form the constraint code.
[0084] In one example, the master control class is responsible for the control of the deduction process and the management of each object process instance, initialization, stop judgment, event and message generation, and maintenance of automatic objects such as seasons, months, and clocks. The functions of these classes are consistent with the functions of the corresponding objects and associations in the model, or conversely, these classes are the code expressions of the objects and associations in the model.
[0085] In one example, if there is a consumption event association between object A and process P, then there will be an annotation on the class generated by object A; conversely, there will also be an annotation on the class generated by process P. In another example, if there is a display representation association between object A and object B, then there will be an annotation on the class generated by object A; member variables will also be declared inside A, and the variables will also have annotations to explain this association.
[0086] When generating a thing class, the things in the thing set TS mentioned above will be looped, and each will generate a unique thing class. And according to the relationship between it and other things, appropriate annotations will be used to describe this relationship.
[0087] Step b, compile the program code at least once, and each compilation generates executable simulation code.
[0088] In one example, the simulation deduction code can be an intermediate code and a machine code. Specifically, the .class generated after the Java version of the program code is compiled is the intermediate code, and the C++ version of the program code is compiled to generate the machine code.
[0089] In one example, the package path and / or namespace configured each time the compilation is performed are different. In the specific implementation, the code generated each time is unique, but for the same OPM model, under the same initialization conditions and stop conditions, the code logic is the same, and the running results are the same. This mechanism ensures that multiple repeated deductions can be performed simultaneously. In an embodiment of the present invention, the package path or namespace of the code generated each time is different, so although the code functions are the same, from an object-oriented perspective, they are completely different classes. Therefore, after dynamic loading, each code will be executed separately without conflict.
[0090] In one example, if there is a compilation error, the error information will be accurately fed back. The user makes modifications based on the error feedback. In actual applications, the compilers used in the simulation system are all modern standard compilers corresponding to the language, and the compilation error positioning is relatively accurate. However, this feedback information cannot be directly shown to the user because the code is dynamically generated. Therefore, the error information given by the compiler needs to be parsed and translated into relevant error information of visible things in the model before being provided to the user.
[0091] Step c, load and run the simulation deduction code, and control the loading and running process of the simulation deduction code. In one example, part of the simulation deduction process can be continued; or, when the simulation deduction code stops running, the simulation deduction result corresponding to the OPM model can be obtained.
[0092] In one example, the intermediate code or machine code obtained by the compilation is loaded and executed, which will be executed according to the set control logic (initialization model logic) and stop when the stop condition is reached.
[0093] Furthermore, the loading and running process of the simulation deduction code can also be controlled. In the specific implementation, a visual display of the deduction process is provided, including various detailed information such as stop conditions, model object information, current status of each object, change process, etc. Control means are provided, including pausing deduction, continuing deduction, stopping deduction, and replaying deduction.
[0094] Furthermore, a deduction speed control means is provided, which can speed up the deduction speed, slow down the deduction speed, and restore the normal deduction speed. Event viewing and information viewing means are provided. The embodiment of the present invention defines a unique simulation deduction time mechanism, so that the system can support the time accuracy of the deduction world of any scale. The evolution speed of the simulation deduction system can be controlled by the user, and stepless speed change is supported. The time progress of the deduction world depends on the time slice ratio M:N set between the deduction world and the real world. It can be faster than the real world (M is greater than N), slower than the real world (M is less than N), and of course it can be equal to (M is equal to N). The unique thing is that during the deduction process, both M and N can be adjusted or even adjusted at the same time. Generally, after the deduction is set, only N can be adjusted.
[0095] Furthermore, a human-in-the-loop method is provided, and the state and various attributes of the object can be modified during the simulation process. The embodiment of the present invention supports the human-in-the-loop method. During the simulation process, it can be paused / continued at any time, and new object instances can be created, object instances can be deleted, and the state and attribute values of objects can be modified at any time, which facilitates the data and process control during the simulation process. Optional, there are only the following modification methods at present: pausing the modification or not pausing the modification. The control interface can select the object to be modified, and there are buttons to modify the state and attributes.
[0096] In one embodiment, the loading and running process of the simulation deduction code is pushed to multiple identical or different configuration process monitoring and display interfaces, so as to render and display the loading and running process of the simulation deduction code through the configuration process monitoring and display interface. In the specific implementation, the deduction system decouples each link through a reasonable architecture design, and supports plug-and-play configuration process monitoring and display interface. During the deduction process, the user can view and control the deduction process through multiple identical or different interfaces. In the embodiment of the present invention, the architecture design is developed around the data flow.
[0097] In one example, data is continuously generated during the simulation process, and this data has two destinations: (1) the in-memory database; (2) if there is a websocket connection, it is sent to the other end in real time and continuously through the websocket. The simulation display interface receives / queries this data to display detailed information about the simulation. In addition, the simulation accepts commands from two channels: (1) commands received through the Web interface; (2) commands received through the websocket connection. The simulation monitoring interface can control the simulation through both command channels. Based on this, the simulation system and the simulation control and display interface are in a many-to-many relationship.
[0098] In one implementation, when a call request for a simulation deduction system is received from a target device, the simulation deduction system is provided to the target device in the form of a microservice. In the embodiment of the present invention, the deduction system itself is implemented in the form of a microservice, which can be easily called by other systems, and can quickly expand the service capacity of the simulation deduction through linear stacking, so that the system can reasonably distribute the system capacity through load balancing.
[0099] Specifically, obtain the IP, port, and interface URL of the simulation system from the registration center. In the case of multiple deployments, the above information can be saved in a list form, and then one of them is selected for calling (Web or RPC) according to the load balancing strategy.
[0100] In one embodiment, the simulation deduction system is registered with the service registration center so that the simulation deduction system obtains the instance addresses of other services provided by the service registration center and calls other services based on the instance addresses. The embodiment of the present invention can conveniently call any existing service through the service registration center, greatly expanding the capability range of the deduction system. In the specific implementation, the deduction system registers with the service registration center, so the instance addresses of other services can be obtained through the service registration center, and other services can be called very conveniently. The most important thing is that through this mode of service registration and calling, the capability boundary of the deduction is greatly expanded.
[0101] Specifically, to call other services, you only need to access the external service interface through the external service access method provided by the deduction system. When calling, you only need to provide other service names, interface URLs, and parameters. The steps behind this include: obtaining a list of services to be called through the service registration center; selecting one of them to call (Web or RPC) according to the load balancing strategy; packaging the results into corresponding objects or object attributes that can be used by the generated model code for use by the model code.
[0102] Furthermore, the present invention extends OPM. Each process can input a piece of code, which is called and executed during the process instance execution. This design greatly expands the capabilities of the process. In order to standardize this capability, a set of application integration frameworks (APIs) used in process codes are provided, including the function of accessing the Web. The following is an example of a process code (the bold ones are all methods defined in the API):
[0103]
[0104]
[0105] In one embodiment, the simulation deduction system is configured with a clock. On this basis, the simulation deduction system also provides the following functions: (a) recording the simulation deduction code generated by compiling the process code as the process simulation deduction code, and recording the simulation deduction code generated by compiling the system automatic processing object code as the automatic processing object simulation deduction code; (b) when the running trigger condition of the process simulation deduction code is related to the time information, the time information provided by the clock is processed by the automatic processing object simulation deduction code to determine whether the running trigger condition is met according to the processing result; (c) if yes, the running process simulation deduction code is loaded.
[0106] In the specific implementation, the deduction system comes with automatic evolution logic such as clocks (such as second-level clocks), seasons, months, and weeks, and provides related things for use in the deduction model, which strongly supports the model logic related to time, seasons, and months, and can greatly simplify the writing of related models. This simplification means that the deduction system will automatically and correctly set the clock, season, month, and week as the deduction time progresses. It would be cumbersome to express the changes of these objects with models, and it is not easy to express or the expression does not help the evolution of the model. For example, when the time of the deduction world changes from spring to summer, the state of the season will be automatically changed from spring to summer.
[0107] For example, the logical execution flow of the OPM model depends on the execution of the process, and the execution of the process needs to be triggered by an event. The event here refers to the event in the OPM model, which is reflected in the connection line with an e icon. Events include the existence of an object, the state of an object, etc. Corresponding to the seasons here, because there are four states of seasons: spring, summer, autumn and winter, when the state changes from spring to summer, if there is a process associated with e starting from the summer state, it will be continuously triggered.
[0108] In one embodiment, during the loading and running of the simulation code, when a change in the simulation state, an object instance, or a process instance is detected, the system snapshot information of the simulation system is output. Specifically, the system snapshot information is output every time something changes during the running process. The purpose of outputting the system snapshot is: (1) to display and control as much information as possible during the simulation process; and (2) to replay the simulation and require accurate information.
[0109] In another embodiment, a full-process record of simulation deduction can also be generated, and the full-process record of simulation deduction is used to record the changes in the simulation deduction state, the changes in the object instance, and the changes in the process instance, so as to restore the loading and running process of the simulation deduction code. The embodiment of the present invention provides a full-process record of simulation deduction, which completely records the changes in the simulation deduction state, each change of each object instance, and each change of each process instance. The whole process of simulation deduction can be restored 100%, providing a basis for personalized playback customization.
[0110] Furthermore, the embodiment of the present invention also subdivides the life cycle of objects and process instances, and system events are defined and recorded at each change node, so as to facilitate the customization of personalized monitoring and display clients.
[0111] In summary, the embodiments of the present invention support all OPM models. The system can be used for adversarial exercises as well as for conceptual process display and verification. As long as the OPM model can be drawn, deduction can be performed. In addition, for OPM models that use uncertain result factors such as probability, statistical sampling verification can be achieved through multiple deductions. The deduction method provided in the embodiments of the present invention can dynamically display and verify the logic of the model through dynamic execution of the model, thereby improving the comprehensibility of the model, facilitating model verification by modelers, and facilitating communication and understanding of the model among multiple people.
[0112] Based on the above embodiments, the present invention provides a simulation device for an OPM model. Figure 5 The structure diagram of a simulation deduction device of an OPM model shown in FIG. 1 mainly includes the following parts:
[0113] A model acquisition module 502 is used to acquire the OPM model to be deduced;
[0114] The model parsing module 504 is used to parse the OPM model to merge and select the things and the relationships between things included in the OPM model to obtain the relationship between things; wherein things include objects and processes;
[0115] The simulation module 506 is used to generate executable simulation code based on the relationship between things, load and run the simulation code to obtain the loading and running process of the simulation code and / or the simulation result corresponding to the OPM model.
[0116] The simulation and deduction device of the OPM model provided in the embodiment of the present invention parses and processes the OPM model to obtain the relationship between things, and generates executable simulation and deduction code on this basis, and realizes simulation and deduction by loading and running the code, thereby obtaining simulation and deduction results. The embodiment of the present invention improves the comprehensibility of the model through the dynamic execution of the OPM model, facilitates the model verification by the modeler, and also helps to reduce the cost of communication and understanding of the model by multiple people.
[0117] In one embodiment, the OPM model includes multiple OPDs, each of which includes objects and relationships between objects; the model parsing module 504 is also used to:
[0118] Traverse each OPD and each thing contained in the OPD to determine the relationship between the things in the OPD;
[0119] Determine whether the current thing exists in the pre-built thing set;
[0120] If yes, then merge and select the associations of the current thing in the OPD and the associations of the current thing stored in the thing set;
[0121] If not, store the associations that the current thing has in OPD into the thing set;
[0122] When the traversal is completed, the object association relationship corresponding to the OPM model is obtained.
[0123] In one implementation, the model parsing module 504 is further configured to:
[0124] If the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set are different association relationships between the current thing and the same thing, the target merging and rejection strategy is determined according to the mapping relationship between the type of the thing, the type of the association relationship and the merging and rejection strategy;
[0125] Based on the target merging and selection strategy, the associations of the current thing in the OPD and the associations of the current thing stored in the thing set are merged and selected.
[0126] In one embodiment, the simulation module 506 is further configured to:
[0127] Generate program code according to the relationship between things; wherein the program code includes one or more of thing code, object code, process code, state code, constraint code, master control code, initialization code, stop condition code, event code, message code and system automatic processing object code;
[0128] Compile the program code at least once, and generate executable simulation code each time; wherein the package path and / or namespace configured in each compilation is different;
[0129] Load and run the simulation code, and control the loading and running process of the simulation code. When the simulation code stops running, the simulation result corresponding to the OPM model is obtained.
[0130] In one embodiment, the method is applied to a simulation system;
[0131] It also includes a service providing module, which is used to: when receiving a call request from a target device for the simulation and deduction system, provide the simulation and deduction system to the target device in the form of a microservice;
[0132] It also includes a service calling module, which is used to: register the simulation system in the service registration center so that the simulation system can obtain the instance addresses of other services provided by the service registration center and call other services based on the instance addresses.
[0133] In one embodiment, the simulation system is configured with a clock; and further includes a clock module for:
[0134] Record the simulation deduction code generated by compiling the process code as the process simulation deduction code, and record the simulation deduction code generated by compiling the system automatic processing object code as the automatic processing object simulation deduction code;
[0135] In the case where the operation trigger condition of the process simulation deduction code is related to the time information, the time information provided by the clock is processed by the automatic processing object simulation deduction code to determine whether the operation trigger condition is met according to the processing result;
[0136] If so, load and run the process simulation code.
[0137] In one embodiment, a monitoring module is further included, which is used to:
[0138] During the loading and running of the simulation code, when a change in the simulation state, an object instance, or a process instance is detected, system snapshot information of the simulation system is output, and / or a full-process record of the simulation is generated;
[0139] Among them, the full process record of simulation is used to record the changes of simulation status, object instance and process instance, so as to restore the loading and running process of simulation code.
[0140] In one embodiment, the simulation system supports a plug-and-play configuration process monitoring and display interface; and also includes a display module for:
[0141] The loading and running process of the simulation deduction code is pushed to multiple identical or different configuration process monitoring and display interfaces, so as to render and display the loading and running process of the simulation deduction code through the configuration process monitoring and display interfaces.
[0142] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0143] An embodiment of the present invention provides an electronic device. Specifically, the electronic device includes a processor and a storage device. The storage device stores a computer program, and when the computer program is executed by the processor, it executes the method described in any one of the above-mentioned implementation methods.
[0144] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present invention, the electronic device 100 includes: a processor 60, a memory 61, a bus 62 and a communication interface 63, wherein the processor 60, the communication interface 63 and the memory 61 are connected via the bus 62; the processor 60 is used to execute an executable module stored in the memory 61, such as a computer program.
[0145] The memory 61 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0146] The bus 62 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0147] Among them, the memory 61 is used to store programs, and the processor 60 executes the program after receiving the execution instruction. The method executed by the device for flow process definition disclosed in any embodiment of the above-mentioned embodiment of the present invention can be applied to the processor 60 or implemented by the processor 60.
[0148] The processor 60 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 hardware integrated logic circuit or software instructions in the processor 60. The above processor 60 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field 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. The storage medium is located in the memory 61, and the processor 60 reads the information in the memory 61 and completes the steps of the above method in combination with its hardware.
[0149] The computer program product of the readable storage medium provided in the embodiment of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be referred to the previous method embodiments, which will not be repeated here.
[0150] If the functions are implemented in the form of 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 the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0151] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; 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 be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A simulation method for an OPM model, characterized in that: include: Obtain the OPM model to be deduced; The OPM model is parsed to merge and select the things and the relationships between things included in the OPM model to obtain the relationship between things; wherein the things include objects and processes; Generate an executable simulation deduction code based on the object association relationship, load and run the simulation deduction code to obtain the loading and running process of the simulation deduction code and / or the simulation deduction result corresponding to the OPM model; The OPM model includes multiple OPDs, each of which includes things and the associations between things; the OPM model is parsed to merge and select the things and the associations between things contained in the OPM model to obtain the steps of obtaining the associations between things, including: traversing each OPD and each thing contained in the OPD to determine the associations that the thing has in the OPD; judging whether the current thing exists in the pre-constructed thing set; if so, merging and selecting the associations that the current thing has in the OPD and the associations that the current thing has stored in the thing set; if not, storing the associations that the current thing has in the OPD in the thing set; when the traversal is completed, obtaining the thing associations that correspond to the OPM model; The steps of merging and discarding the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set include: if the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set are different association relationships between the current thing and the same thing, then determining the target merging and discarding strategy according to the mapping relationship between the type of thing, the type of association relationship and the merging and discarding strategy; based on the target merging and discarding strategy, merging and discarding the association relationships of the current thing in the OPD and the association relationships of the current thing stored in the thing set.
2. The simulation deduction method of the OPM model according to claim 1, characterized in that: The steps of generating executable simulation deduction code based on the thing association relationship, loading and running the simulation deduction code to obtain the simulation deduction result corresponding to the OPM model include: Generate program code according to the object association relationship; wherein the program code includes one or more of object code, object code, process code, state code, constraint code, master control code, initialization code, stop condition code, event code, message code and system automatic processing object code; Compiling the program code at least once, generating executable simulation deduction code each time; wherein the package path and / or namespace configured each time during compilation are different; The simulation deduction code is loaded and run, and the loading and running process of the simulation deduction code is controlled. When the simulation deduction code stops running, the simulation deduction result corresponding to the OPM model is obtained.
3. The simulation method of the OPM model according to any one of claims 1 to 2, characterized in that: The method is applied to a simulation system; The method further comprises: upon receiving a call request from a target device for the simulation and deduction system, providing the simulation and deduction system to the target device in a microservice form; The method also includes: registering the simulation system in a service registration center so that the simulation system obtains instance addresses of other services provided by the service registration center and calls other services based on the instance addresses.
4. The simulation deduction method of the OPM model according to claim 3 is characterized in that: The simulation and deduction system is configured with a clock; The method further comprises: Record the simulation deduction code generated by compiling the process code as the process simulation deduction code, and record the simulation deduction code generated by compiling the system automatic processing object code as the automatic processing object simulation deduction code; In the case where the operation trigger condition of the process simulation deduction code is related to time information, the time information provided by the clock is processed by the automatic processing object simulation deduction code to determine whether the operation trigger condition is met according to the processing result; If yes, then load and run the process simulation code.
5. The simulation deduction method of the OPM model according to claim 3 is characterized in that: The method further comprises: During the loading and running of the simulation code, when a change in the simulation state, an object instance or a process instance is detected, system snapshot information of the simulation system is output, and / or a full-process record of the simulation is generated; Among them, the simulation and deduction full process record is used to record the changes in the simulation and deduction state, the changes in the object instance and the changes in the process instance, so as to restore the loading and running process of the simulation and deduction code.
6. The simulation deduction method of the OPM model according to claim 3 is characterized in that: The simulation system supports a plug-and-play configuration process monitoring and display interface; the method further includes: The loading and running process of the simulation deduction code is pushed to multiple identical or different configuration process monitoring and display interfaces, so as to render and display the loading and running process of the simulation deduction code through the configuration process monitoring and display interfaces.
7. A simulation and deduction device for an OPM model, characterized in that: include: A model acquisition module is used to obtain the OPM model to be deduced; A model parsing module, used to parse the OPM model, so as to merge and select the objects and the relationships between the objects contained in the OPM model, and obtain the relationship between the objects; wherein the objects include objects and processes; A simulation deduction module, used to generate an executable simulation deduction code based on the object association relationship, load and run the simulation deduction code to obtain the loading and running process of the simulation deduction code and / or the simulation deduction result corresponding to the OPM model; The OPM model includes multiple OPDs, each of which includes things and the associations between things; the model parsing module is specifically used to: traverse each OPD and each thing contained in the OPD to determine the associations that the thing has in the OPD; determine whether the current thing exists in the pre-constructed thing set; if yes, merge and select the associations that the current thing has in the OPD and the associations that the current thing has stored in the thing set; if not, store the associations that the current thing has in the OPD in the thing set; when the traversal is completed, obtain the thing associations that correspond to the OPM model; The model parsing module is specifically used for: if the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set are different association relationships between the current thing and the same thing, then determine the target merging and rejection strategy according to the mapping relationship between the type of thing, the type of association relationship and the merging and rejection strategy; based on the target merging and rejection strategy, merge and reject the association relationship of the current thing in the OPD and the association relationship of the current thing stored in the thing set.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein 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 6.
Citation Information
Patent Citations
Modeling method based on OPM
CN113721897A
OPM-based aircraft system fault simulation modeling method
CN116187012A