A module management method and system for a simulation model
By generating a function scheduling module and associated code, the problem of a large number of modules and frequent data interaction in complex simulation models is solved, thereby improving simulation performance and user experience.
Patent Information
- Application Number
- CN202411869539.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2044-12-18
AI Technical Summary
Building complex simulation models requires thousands of modules, making the construction process cumbersome and causing frequent data interactions between modules, which affects simulation performance and user experience.
By acquiring multiple modules to be synthesized by the user, a function scheduling module is generated and associated with function scheduling code, reducing the number of modules and optimizing data interaction.
While reducing the number of modules, we can ensure functional consistency, improve simulation performance, and enhance user experience.
Smart Images

Figure CN119645383B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model simulation technology, and in particular to a module management method and system for simulation models. Background Technology
[0002] GCKontrol is a powerful graphical modeling, simulation, and code generation software that allows users to build simulation models based on specific business needs using modules in the model library (such as basic modules, time functions, control theory, etc.).
[0003] However, when building some complex simulation models, it is often necessary to work together with thousands of modules. This not only makes the simulation model building process cumbersome, but also causes frequent data interaction between modules, which seriously affects simulation performance and reduces user experience. Summary of the Invention
[0004] To address the aforementioned issues, this application provides a module management method and system for simulation models, aiming to improve simulation performance and enhance user experience.
[0005] The embodiments of this application disclose the following technical solutions:
[0006] The first aspect of this application provides a module management method for simulation models, applied to GCKontrol software, the method comprising:
[0007] The system retrieves multiple modules to be synthesized from the target simulation model displayed by the user on the client interface; the target simulation model is the simulation model constructed by the user in the GCKontrol software.
[0008] A function scheduling module is generated based on the plurality of modules to be synthesized; the function scheduling module encapsulates the plurality of modules to be synthesized.
[0009] Function scheduling code is generated based on the plurality of modules to be synthesized; the function scheduling code is used to schedule the function code corresponding to the plurality of modules to be synthesized according to the connection order of the plurality of modules to be synthesized;
[0010] Associate the function scheduling module with the function scheduling code.
[0011] In an optional implementation, the step of generating function scheduling code based on the plurality of modules to be synthesized includes:
[0012] Based on the plurality of modules to be synthesized, corresponding code files are generated; the code files include the function definitions and implementations of the plurality of modules to be synthesized;
[0013] Based on the code file, function scheduling code is generated using a preset synthesis function template.
[0014] In an optional implementation, the preset synthesis function template includes: an input structure, an output structure, and a parameter structure.
[0015] Among the optional implementation methods, the module management method for the simulation model also includes:
[0016] The function scheduling code is stored in a preset function scheduling code library; the preset function scheduling code library includes various function scheduling codes.
[0017] Among the optional implementation methods, the module management method for the simulation model also includes:
[0018] Replace the multiple modules to be synthesized in the target simulation model displayed on the client interface with the function scheduling module.
[0019] A second aspect of this application provides a module management system for simulation models, applied to GCKontrol software, the system comprising:
[0020] The acquisition unit is used to acquire multiple modules to be synthesized selected by the user in the target simulation model displayed on the client interface; the target simulation model is the simulation model constructed by the user in the GCKontrol software;
[0021] A module generation unit is used to generate a function scheduling module based on the plurality of modules to be synthesized; the function scheduling module encapsulates the plurality of modules to be synthesized.
[0022] The code generation unit is used to generate function scheduling code based on the plurality of modules to be synthesized; the function scheduling code is used to schedule the function code corresponding to the plurality of modules to be synthesized according to the connection order of the plurality of modules to be synthesized.
[0023] The association unit is used to associate the function scheduling module with the function scheduling code.
[0024] In an optional implementation, the code generation unit includes:
[0025] The first generation subunit is used to generate corresponding code files based on the plurality of modules to be synthesized; the code files include the function definitions and implementations of the plurality of modules to be synthesized;
[0026] The second generation subunit is used to generate function scheduling code based on the code file using a preset synthesis function template.
[0027] In the optional implementation, the module management system for the simulation model also includes:
[0028] The template construction unit is used to construct a preset synthesis function template; the preset synthesis function template includes an input structure, an output structure, and a parameter structure.
[0029] In the optional implementation, the module management system for the simulation model also includes:
[0030] A storage unit is used to store the function scheduling code into a preset function scheduling code library; the preset function scheduling code library includes various function scheduling codes.
[0031] In the optional implementation, the module management system for the simulation model also includes:
[0032] The module replacement unit is used to replace the plurality of modules to be synthesized in the target simulation model displayed on the client interface with the function scheduling module.
[0033] Compared with the prior art, this application has the following beneficial effects:
[0034] In this technical solution, firstly, multiple modules to be synthesized are selected by the user in the target simulation model displayed on the client interface; then, a function scheduling module is generated based on the multiple modules to be synthesized; subsequently, function scheduling code is generated based on the multiple modules to be synthesized; finally, the function scheduling module and the function scheduling code are associated. It is evident that this technical solution, by merging multiple user-selected modules into a single function scheduling module and generating corresponding function scheduling code associated with it, reduces the number of modules in the simulation model while ensuring that the functionality of the synthesized function scheduling module is consistent with the functionality implemented by the original multiple modules to be synthesized. This reduces data interaction between modules during simulation, improves simulation performance, and ultimately enhances the user experience. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 A flowchart of a module management method for a simulation model provided in this application embodiment;
[0037] Figure 2 A schematic diagram of multiple modules to be synthesized selected by a user in a target simulation model, provided as an embodiment of this application;
[0038] Figure 3A schematic diagram of a function scheduling module provided in an embodiment of this application;
[0039] Figure 4 This is a schematic diagram of the structure of a module management system for a simulation model provided in an embodiment of this application. Detailed Implementation
[0040] As described earlier, when building complex simulation models, GCKontrol software often requires thousands of modules to work together. This not only makes the simulation model building process cumbersome, but also causes frequent data interactions between modules, which seriously affects simulation performance and reduces user experience.
[0041] The inventors have proposed a module management method and system for simulation models based on their research.
[0042] First, obtain the multiple modules to be synthesized selected by the user in the target simulation model displayed on the client interface; then, generate a function scheduling module based on the multiple modules to be synthesized; next, generate function scheduling code based on the multiple modules to be synthesized; finally, associate the function scheduling module with the function scheduling code.
[0043] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0044] This method embodiment applies to GCKontrol software, a powerful graphical modeling, simulation, and code generation software that allows users to build simulation models according to specific business needs using modules in the model library (such as basic modules, time functions, control theory, etc.).
[0045] See Figure 1 This figure is a flowchart of a module management method for a simulation model provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps:
[0046] S101. Obtain multiple modules to be synthesized from the target simulation model displayed by the user on the client interface.
[0047] The target simulation model is the simulation model built by the user in the GCKontrol software.
[0048] In this embodiment, the user first launches the GCKontrol software and constructs a target simulation model through a graphical user interface (GUI). This target simulation model contains multiple modules, each representing a specific function within the simulation system. For example, basic modules may include input modules, output modules, constant modules, or matrix modules; basic arithmetic modules may include addition, subtraction, multiplication, division, gain, or absolute value modules; and basic function modules may include trigonometric function modules, exponential and logarithmic function modules, power function modules, or comparison modules.
[0049] Users can select multiple modules in the target simulation model displayed on the client interface according to their own needs. Users can mark the selected modules as modules to be synthesized by clicking the corresponding buttons on the GCKontrol software interface.
[0050] In this embodiment of the application, it is first necessary to obtain the multiple modules to be synthesized selected by the user in the target simulation model displayed on the client interface.
[0051] Figure 2 This is a schematic diagram illustrating multiple modules to be synthesized by a user in a target simulation model, provided as an embodiment of this application. Figure 2 The multiple modules to be synthesized shown include the Add_Sub_in0 module, Add_Sub_in1 module, Add_Sub module, Gain module, Round module, Deadband module, and Add_Sub_out module.
[0052] S102. Generate a function scheduling module based on multiple modules to be synthesized.
[0053] In this application example, after obtaining multiple modules to be synthesized selected by the user, a new function scheduling module is generated based on these modules. The function scheduling module encapsulates the multiple modules to be synthesized.
[0054] S103. Generate function scheduling code based on multiple modules to be synthesized.
[0055] The function scheduling code is used to schedule the function code corresponding to multiple modules to be synthesized according to the connection order of multiple modules to be synthesized.
[0056] In this embodiment, based on the multiple modules to be synthesized obtained in step S101, corresponding function scheduling code is generated. The function scheduling code ensures that the data flow between the multiple modules to be synthesized proceeds in the correct order, thereby realizing the function of the target simulation model.
[0057] S104. Associate the function scheduling module with the function scheduling code.
[0058] Finally, the function scheduling module generated in step S102 is associated with the function scheduling code generated in step S103. This step can be achieved through object references or interface bindings within the GCKontrol software.
[0059] The associated function scheduling module is an executable entity that can call the functions of each module to be synthesized according to the function scheduling code to realize the functions of multiple modules to be synthesized.
[0060] Optionally, in GCKontrol software, this association can be manifested in the software's project management interface, where the function scheduling module is marked as "configured," and the user can trigger the entire simulation process by clicking the "Run" button. When the run begins, the function scheduling module will activate and coordinate the functions of each module to be synthesized in sequence according to the preset function scheduling code, completing the entire simulation process.
[0061] In this embodiment, by combining multiple user-selected modules into a single function scheduling module and generating corresponding function scheduling code associated with it, the number of modules in the simulation model is reduced while ensuring that the functionality of the synthesized function scheduling module is consistent with the functionality implemented by the original multiple modules. This reduces data interaction between modules during simulation, improves simulation performance, and enhances the user experience.
[0062] Optionally, step S103 above includes:
[0063] Step 1: Generate corresponding code files based on multiple modules to be synthesized.
[0064] In this embodiment, code files corresponding to each module to be synthesized are first generated. These code files include function definitions and implementations for multiple modules to be synthesized, ensuring the correctness of module functionality.
[0065] In this embodiment of the application, the code file includes a header file and a source file.
[0066] Header files typically have the ".h" extension, such as "stdio.h" and "stdlib.h". They are primarily used to declare functions, macros, data types, and external variables so that these declarations can be shared across multiple source files.
[0067] Source files typically have a ".c" extension, such as "main.c" or "mathlib.c". They are mainly used to define the specific implementations of functions and variables, containing the actual code logic.
[0068] Header files typically contain declarations of functions, variables, and data types defined in source files. Source files include header files to use the functions, macros, and types declared therein. By separating declarations and implementations into different files, code modularity and reusability can be achieved.
[0069] Step 2: Based on the code file, generate function scheduling code using a preset synthesis function template.
[0070] In this application example, the code files generated in step one are used to generate corresponding function scheduling code based on the preset synthesis function templates.
[0071] The preset function composition template includes an input structure, an output structure, and a parameter structure. The input structure receives data from other modules or external systems; the output structure provides data to other modules or external systems; and the parameter structure stores the parameters required for module execution. By filling these structures, the function scheduling code can sequentially call the function code of each module to be composed, according to the user-defined connection order.
[0072] In one example implementation, the default composition function template is as follows:
[0073] / / External input
[0074] typedef struct
[0075] {
[0076] }Test_AddFunIn;
[0077] / / External output
[0078] typedef struct
[0079] {
[0080] }Test_AddFunOut;
[0081] / / External parameters
[0082] typedef struct
[0083] {
[0084] }Test_AddFunParm;
[0085] int Test_AddFun_Init(void);
[0086] int Test_AddFun(const Test_AddFunIn*in,Test_AddFunOut*out,constTest_AddFunParm*parm);
[0087] In one example implementation, the generated function dispatch code based on the above synthesized function template is as follows:
[0088]
[0089]
[0090] The corresponding C file code is as follows:
[0091]
[0092]
[0093] In one alternative implementation, to improve code reusability and management efficiency, the module management method for the simulation model also includes storing function scheduling code in a pre-defined function scheduling code library.
[0094] The pre-built function scheduling code library includes various function scheduling codes, which users can directly call in future simulation projects to avoid rewriting them.
[0095] In one alternative implementation, to simplify the model structure, improve simulation efficiency, and prevent UI lag, multiple modules to be synthesized in the target simulation model displayed on the client interface can be replaced with corresponding function scheduling modules.
[0096] Figure 3 This is a schematic diagram of a function scheduling module provided in an embodiment of this application. Figure 2 The multiple modules to be synthesized shown are replaced in the target simulation model displayed on the client interface. Figure 3 The function scheduling module shown.
[0097] like Figure 3 As shown, the input and output of this function scheduling module correspond to Figure 2 The diagram shows the overall input and output of multiple modules to be synthesized, including two inputs (Add_Sub_in0 and Add_Sub_in1) and one output (Add_Sub_out). The function scheduling module is named AddFun module, where f(x) indicates the function scheduling code associated with this function scheduling module.
[0098] In this embodiment, the function scheduling module only limits the number of inputs and outputs, and the specific function scheduling module's functionality depends on its associated function scheduling code.
[0099] Optionally, the function scheduling module can associate different function scheduling codes stored in a pre-defined function scheduling code library according to user needs. By selecting different function scheduling codes, the function scheduling module can implement different business functions.
[0100] Specifically, when generating function dispatch code, different function dispatch codes are configured with different function names and corresponding component libraries. The function name can be set by the user or use the system's default function name; no specific restrictions are placed here. For example, the function name could be Test.SelMulFun, where Test indicates that the component library is Test.
[0101] The module management method for simulation models proposed in this embodiment enables users to more easily build and manage complex simulation models. The introduction of the function scheduling module not only improves the reusability and maintainability of the model but also reduces the complexity and time cost of the simulation process. Meanwhile, the pre-defined synthesis function templates and function scheduling code library further enhance the software's flexibility and extensibility, providing users with richer simulation tools and functions.
[0102] Based on the module management method for simulation models provided in the foregoing embodiments, this application also provides a module management system for simulation models, which is applied to GCKontrol software. Figure 4 This is a schematic diagram of the structure of a module management system for a simulation model provided in an embodiment of this application. Figure 4 As shown, the module management system of the simulation model includes: acquisition unit 401, module generation unit 402, code generation unit 403 and association unit 404.
[0103] The acquisition unit 401 is used to acquire multiple modules to be synthesized selected by the user in the target simulation model displayed on the client interface.
[0104] The target simulation model is the simulation model built by the user in the GCKontrol software.
[0105] In this embodiment of the application, the acquisition unit 401 can receive the user's selection through the user interaction interface and extract the module information selected by the user.
[0106] The module generation unit 402 is used to generate a function scheduling module based on the plurality of modules to be synthesized.
[0107] The function scheduling module encapsulates the multiple modules to be synthesized.
[0108] In this embodiment of the application, the module generation unit 402 generates a corresponding function scheduling module based on the multiple modules to be synthesized obtained by the acquisition unit 401.
[0109] The code generation unit 403 is used to generate function scheduling code based on the plurality of modules to be synthesized.
[0110] In this embodiment of the application, the code generation unit 403 generates corresponding function scheduling code based on the multiple modules to be synthesized obtained by the acquisition unit 401.
[0111] The function scheduling code is used to schedule the function code corresponding to the multiple modules to be synthesized according to the connection order of the multiple modules to be synthesized.
[0112] The association unit 404 is used to associate the function scheduling module with the function scheduling code.
[0113] In this embodiment, the association unit 404 associates the function scheduling module generated by the module generation unit 402 with the function scheduling code generated by the code generation unit 403 to ensure that the two can work together.
[0114] In one example implementation, the association between the function scheduling module and the function scheduling code can be achieved through internal data structures or file links.
[0115] This embodiment of the application combines the functions of the acquisition unit 401, the module generation unit 402, the code generation unit 403, and the association unit 404 to merge multiple user-selected modules into a single function scheduling module and generate corresponding function scheduling code associated with it. This reduces the number of modules in the simulation model while ensuring that the function of the merged function scheduling module is consistent with the functions implemented by the original multiple modules to be merged. This reduces data interaction between modules during simulation, improves simulation performance, and enhances the user experience.
[0116] In an optional implementation, the code generation unit 403 includes:
[0117] The first generation subunit is used to generate corresponding code files based on the plurality of modules to be synthesized; the code files include the function definitions and implementations of the plurality of modules to be synthesized.
[0118] The code file includes the function definitions and implementations of the multiple modules to be synthesized;
[0119] The second generation subunit is used to generate function scheduling code based on the code file using a preset synthesis function template.
[0120] In the optional implementation, the module management system for the simulation model also includes:
[0121] Template building units are used to build preset synthesis function templates to meet different simulation model requirements of users.
[0122] The preset synthesis function template includes an input structure, an output structure, and a parameter structure.
[0123] In one example implementation, the default composition function template is as follows:
[0124] / / External input
[0125] typedef struct
[0126] {
[0127] }Test_AddFunIn;
[0128] / / External output
[0129] typedef struct
[0130] {
[0131] }Test_AddFunOut;
[0132] / / External parameters
[0133] typedef struct
[0134] {
[0135] }Test_AddFunParm;
[0136] int Test_AddFun_Init(void);
[0137] int Test_AddFun(const Test_AddFunIn*in,Test_AddFunOut*out,constTest_AddFunParm*parm);
[0138] In the optional implementation, the module management system for the simulation model also includes:
[0139] A storage unit is used to store the function scheduling code into a preset function scheduling code library.
[0140] The pre-defined function scheduling code library includes various function scheduling codes. The code can be stored and managed through a file system or database.
[0141] In the optional implementation, the module management system for the simulation model also includes:
[0142] The module replacement unit is used to replace the plurality of modules to be synthesized in the target simulation model displayed on the client interface with the function scheduling module.
[0143] In one example implementation, the module to be synthesized can be replaced with a new function scheduling module by modifying the internal data structure or file structure of the simulation model.
[0144] In this embodiment of the application, the function scheduling module generated by the module generation unit 402 is limited only to the number of inputs and outputs, and the specific function scheduling module’s function depends on its associated function scheduling code.
[0145] Optionally, the function scheduling module generated by the module generation unit 402 can be associated with different function scheduling codes stored in a preset function scheduling code library according to user needs. By selecting different function scheduling codes, the function scheduling module can implement different business functions.
[0146] Specifically, when generating function scheduling code in code generation unit 403, different function scheduling codes are configured with different function names and corresponding component libraries. The function name can be set by the user or be the system's default function name; no specific restrictions are imposed here. For example, the function name could be Test.SelMulFun, where Test indicates that the component library is Test.
[0147] This application's embodiments, through the cooperation between various modules, achieve the automatic generation and association of the function scheduling module and function scheduling code, reducing the number of modules in the simulation model, lowering the complexity of data interaction between modules, and improving simulation performance. At the same time, it simplifies the user operation process and enhances the user experience.
[0148] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate. The components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0149] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A module management method for a simulation model, characterized in that, Applied to GCKontrol software, the method includes: The system retrieves multiple modules to be synthesized from the target simulation model displayed by the user on the client interface; the target simulation model is the simulation model constructed by the user in the GCKontrol software. A function scheduling module is generated based on the plurality of modules to be synthesized; the function scheduling module encapsulates the plurality of modules to be synthesized. Function scheduling code is generated based on the plurality of modules to be synthesized; the function scheduling code is used to schedule the function code corresponding to the plurality of modules to be synthesized according to the connection order of the plurality of modules to be synthesized; Associate the function scheduling module with the function scheduling code; The generation of function scheduling code based on the plurality of modules to be synthesized includes: Based on the plurality of modules to be synthesized, corresponding code files are generated; the code files include the function definitions and implementations of the plurality of modules to be synthesized; Based on the code file, function scheduling code is generated using a preset synthesis function template; the preset synthesis function template includes: an input structure, an output structure, and a parameter structure; The function scheduling module can associate different function scheduling codes in a preset function scheduling code library to achieve different business functions.
2. The method according to claim 1, characterized in that, The method further includes: The function scheduling code is stored in a preset function scheduling code library; the preset function scheduling code library includes various function scheduling codes.
3. The method according to claim 1, characterized in that, The method further includes: Replace the multiple modules to be synthesized in the target simulation model displayed on the client interface with the function scheduling module.
4. A module management system for a simulation model, characterized in that, The system, applied to GCKontrol software, includes: The acquisition unit is used to acquire multiple modules to be synthesized selected by the user in the target simulation model displayed on the client interface; the target simulation model is the simulation model constructed by the user in the GCKontrol software; A module generation unit is used to generate a function scheduling module based on the plurality of modules to be synthesized; the function scheduling module encapsulates the plurality of modules to be synthesized. The code generation unit is used to generate function scheduling code based on the plurality of modules to be synthesized; the function scheduling code is used to schedule the function code corresponding to the plurality of modules to be synthesized according to the connection order of the plurality of modules to be synthesized. An association unit is used to associate the function scheduling module with the function scheduling code; The code generation unit includes: The first generation subunit is used to generate corresponding code files based on the plurality of modules to be synthesized; the code files include the function definitions and implementations of the plurality of modules to be synthesized; The second generation subunit is used to generate function scheduling code based on the code file using a preset synthesis function template; The system also includes: A template construction unit is used to construct a preset synthesis function template; the preset synthesis function template includes an input structure, an output structure, and a parameter structure; The function scheduling module generated by the module generation unit can be associated with different function scheduling codes in a preset function scheduling code library to achieve different business functions.
5. The system according to claim 4, characterized in that, The system also includes: A storage unit is used to store the function scheduling code into a preset function scheduling code library; the preset function scheduling code library includes various function scheduling codes.
6. The system according to claim 4, characterized in that, The system also includes: The module replacement unit is used to replace the plurality of modules to be synthesized in the target simulation model displayed on the client interface with the function scheduling module.
Citation Information
Patent Citations
Method and device for performing software integration on multiple model codes
CN108279885A