A modelica-based component selection method, device and equipment
By using a component selection method based on Modelica, generating component model code and performing simulations, the problem of low efficiency in verifying multiple system design schemes is solved, and the optimal design scheme can be selected quickly.
Patent Information
- Application Number
- CN202310022114.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-06
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-01-06
AI Technical Summary
Existing Modelica modeling and simulation software is inefficient and costly in verifying multiple system design schemes, and cannot quickly select the best system design scheme.
By using the Modelica-based component selection method, component model code is generated, the arrangement is determined, a system model template is generated, simulation is performed, key performance indicator variable curves are plotted, and the optimal system design scheme is selected.
It enables rapid model generation and batch simulation of multiple system design schemes in Modelica, allowing users to quickly verify the performance of key system indicators and select the best design scheme.
Smart Images

Figure CN116225384B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of software engineering, and in particular to a Modelica-based component selection method, device and equipment. BACKGROUND
[0002] In the Modelica system modeling process and the MBSE verification process, there are often multiple system design schemes, that is, the component models of the system exist in multiple types and multiple parameters of the to-be-verified working conditions. Verification of the multiple system design schemes requires the user to respectively establish multiple-type and multiple-parameter component models and integrate system models of various working conditions. The traditional multiple system design scheme verification method is low in efficiency and high in cost, and cannot quickly select the best system design scheme for verification. SUMMARY
[0003] The present application provides a Modelica-based component selection method, device and equipment, which solves the problem of the lack of rapid verification of multiple system design schemes based on Modelica in the current Modelica-based modeling and simulation software.
[0004] A Modelica-based component selection method, comprising:
[0005] Obtaining a component principle model based on multiple system design schemes of a user, and generating component model codes of multiple component models based on the component principle model in batch design;
[0006] Determining an arrangement mode included in the system design scheme, and generating a system model template according to the arrangement mode;
[0007] Generating system model codes of multiple system models according to the system model template;
[0008] Calling the system model codes for simulation to obtain simulation results of the multiple system models;
[0009] Determining key performance indicator variables of the multiple system models, and drawing key performance indicator variable curves of the simulation results according to the key performance indicator variables;
[0010] Determining an optimal system design scheme according to the key performance indicator variable curves.
[0011] In an embodiment of the present application, the component model codes of the multiple component models generated in batch design based on the component principle model specifically include: newly creating multiple component models, the newly created component models inheriting the corresponding component principle models; obtaining parameters of the component models, and generating component model codes according to the obtained parameters.
[0012] In an embodiment of the present application, the generating system model codes of the plurality of system models according to the system model template specifically comprises: obtaining model trees of a plurality of source system models, replacing to-be-replaced components of the model trees of the source system models with the component models based on the system model template to form model trees of a plurality of new system models, and generating a plurality of corresponding system model codes according to the model trees of the plurality of new system models.
[0013] In an embodiment of the present application, the system model template comprises [{to-be-replaced component type, newly designed component model}];wherein "[]" represents a list and "{}" represents a key-value pair.
[0014] In an embodiment of the present application, the arrangement mode comprises full arrangement and sequential arrangement.
[0015] A component selection device based on Modelica, comprising:
[0016] A component model generation module is configured to obtain a component principle model based on a plurality of system design schemes of a user, and to generate component model codes of a plurality of component models in batches based on the component principle model;
[0017] A system model generation module is configured to determine an arrangement mode included in the system design scheme, to generate a system model template according to the arrangement mode, and to generate system model codes of a plurality of system models according to the system model template;
[0018] A simulation module is configured to call the system model codes to perform simulation and to obtain simulation results of the plurality of system models;
[0019] An optimal scheme selection module is configured to determine key performance indicator variables of the plurality of system models, to draw key performance indicator variable curves of the simulation results according to the key performance indicator variables, and to determine an optimal system design scheme according to the key performance indicator variable curves.
[0020] In an embodiment of the present application, the system model generation module further comprises a system model code generation submodule configured to obtain model trees of a plurality of source system models, to replace to-be-replaced components of the model trees of the source system models with the component models based on the system model template to form model trees of a plurality of new system models, and to generate a plurality of corresponding system model codes according to the model trees of the plurality of new system models.
[0021] A component selection device based on Modelica, comprising:
[0022] at least one processor; and
[0023] a memory in communication with the at least one processor via a bus; wherein,
[0024] The memory stores instructions executable by the at least one processor, the instructions being executed to implement:
[0025] Obtain a component principle model based on a plurality of system design schemes of a user, and generate component model codes of a plurality of component models based on the component principle model batch design;
[0026] Determine an arrangement mode included in the system design scheme, and generate a system model template according to the arrangement mode;
[0027] Generate system model codes of a plurality of system models according to the system model template;
[0028] Call the system model codes to perform simulation, and obtain simulation results of the plurality of system models;
[0029] Determine key performance indicator variables of the plurality of system models, and draw key performance indicator variable curves of the simulation results according to the key performance indicator variables;
[0030] Determine an optimal system design scheme according to the key performance indicator variable curves.
[0031] A non-volatile storage medium stores computer executable instructions, which are executed by a processor to implement the following steps:
[0032] Obtain a component principle model based on a plurality of system design schemes of a user, and generate component model codes of a plurality of component models based on the component principle model batch design;
[0033] Determine an arrangement mode included in the system design scheme, and generate a system model template according to the arrangement mode;
[0034] Generate system model codes of a plurality of system models according to the system model template;
[0035] Call the system model codes to perform simulation, and obtain simulation results of the plurality of system models;
[0036] Determine key performance indicator variables of the plurality of system models, and draw key performance indicator variable curves of the simulation results according to the key performance indicator variables;
[0037] Determine an optimal system design scheme according to the key performance indicator variable curves.
[0038] The application provides a Modelica-based component selection method, device and equipment, and at least has the following beneficial effects: based on the Modelica modeling specification, the Modelica multi-system design scheme is realized to generate a fast model, to perform batch simulation on multiple instances, to support the user to verify the performance of a key indicator of a system when multiple system design schemes exist, and to select the best system design scheme. BRIEF DESCRIPTION OF DRAWINGS
[0039] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not limit the application. In the drawings:
[0040] Figure 1 A Modelica-based component selection method provided for an embodiment of the application is shown in a schematic diagram;
[0041] Figure 2 An effect diagram displayed on an MWORKS client when a component model is designed for the embodiment of the application is shown;
[0042] Figure 3 A combination scheme diagram for full permutation of a designed component model for the embodiment of the application is shown;
[0043] Figure 4 A combination scheme diagram for sequential permutation of a designed component model for the embodiment of the application is shown;
[0044] Figure 5 A curve example diagram of a key performance indicator variable of a system model on an MWORKS client for the embodiment of the application is shown;
[0045] Figure 6 A technical roadmap for verification of a key performance indicator of a system of a Modelica multi-system design scheme and selection of the best design scheme for the embodiment of the application is shown;
[0046] Figure 7 A Modelica-based component selection device provided for the embodiment of the application is shown in a schematic diagram;
[0047] Figure 8 A Modelica-based component selection device provided for the embodiment of the application is shown in a schematic diagram. DETAILED DESCRIPTION
[0048] In order to make the objects, technical solutions and advantages of the present application clearer, the following will clearly and completely describe the present application in conjunction with specific embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of protection of the present application.
[0049] It should be noted that those of ordinary skill in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments without conflict. Unless otherwise defined, the technical terms or scientific terms involved in the present application should be understood as the usual meaning by those of ordinary skill in the art to which the present application belongs. The terms "one", "a", "an", "the", and similar words involved in the present application do not represent quantity limitation, but can represent singular or plural. The terms "include", "contain", "have", and any variations thereof involved in the present application are intended to cover non-exclusive inclusion; the terms "first", "second", "third", and the like involved in the present application are only to distinguish similar objects, and do not represent a specific order of the objects.
[0050] The present application provides a Modelica-based component selection method, device and equipment. The following will be specifically described.
[0051] Figure 1 The steps of a Modelica-based component selection method provided for the embodiments of the present application can include the following steps:
[0052] S110: Obtain a component principle model based on a plurality of system design schemes of a user, and generate component model codes of a plurality of component models based on the component principle model.
[0053] Specifically, in the system model, the system design scheme verification of multiple working conditions can focus on a few component models, and this part of the components should be the design point of the system design scheme, and the multiple model and multiple parameter working condition design verification needs to be performed on this part of the components.
[0054] In an embodiment of the present application, the component model codes of the plurality of component models are generated based on the component principle model batch design, and specifically include: creating a plurality of component models, and the created component models inherit the corresponding component principle model; obtaining parameters of the component models, and generating the component model codes according to the obtained parameters.
[0055] Specifically, based on the designed component principle model, a batch of component models with different models and different parameters are designed. The component model design content includes:
[0056] Full name of source system model where the component is located, full name of the component in the source system model, full name of the principle model of the newly designed component model, full name of the newly designed component model, description of the newly designed component model, parameter setting of the newly designed component model.
[0057] The design of the above component model automatically generates component model code based on the Modelica specification:
[0058] (1) A new component model is created, and the component model name is the full name of the newly designed component model, which is inherited from the component principle model corresponding to the newly designed component model;
[0059] (2) The description of the newly designed component model is set, and the component model parameters are modified according to the input component parameter settings;
[0060] (3) The set component model is saved as a model file, and the content of the model file is the code of the corresponding component model.
[0061] As shown in Figure 2 The effect diagram displayed on the MWORKS client when designing the component model.
[0062] According to the designed component model code, the component model is automatically generated based on the Modelica specification.
[0063] S120: Determine the arrangement mode included in the system design scheme, and generate a system model template according to the arrangement mode.
[0064] Specifically, in the system scheme design, there are usually multiple component models to be verified. According to the verification requirements, the present application provides a scheme for generating a system model by full arrangement and sequential arrangement of n groups of designed component models.
[0065] For example, there are 3 groups of designed component model 1 and component model 2. As shown in Figure 3 The combination scheme for full arrangement of the designed component model generates 3x3=9 combination schemes; as shown in Figure 4 The combination scheme for sequential arrangement of the designed component model generates 3 combination schemes.
[0066] In an embodiment of the present application, the designed component type in the source system model is replaced by the newly designed component model in batches based on the Modelica modeling specification, and the system model code of the corresponding design scheme is automatically generated:
[0067] The system model template is generated according to the arrangement mode of the design scheme, and the system model template includes [{component type to be replaced, newly designed component model}]; wherein "[]" represents a list, and "{}" represents a key-value pair.
[0068] S130: generating system model codes of the plurality of system models according to the system model template.
[0069] In an embodiment of the present application, the system model codes of the plurality of system models are generated according to the system model template, specifically comprising: obtaining model trees of a plurality of source system models, replacing to-be-replaced components of the model trees of the source system models with component models based on the system model template to form model trees of a plurality of new system models; and generating a plurality of corresponding system model codes according to the model trees of the plurality of new system models.
[0070] Specifically, the system models are generated one by one according to the system design schemes:
[0071] a. copying a model tree (Modelica Class Tree) of a source system model;
[0072] b. replacing component types to be replaced in the copied source system model with newly designed component models;
[0073] c. generating model codes from the new system model trees and saving the model codes as mo files.
[0074] S140: calling the system model codes to perform simulation to obtain simulation results of the plurality of system models.
[0075] S150: determining key performance indicator variables of the plurality of system models, drawing key performance indicator variable curves of the simulation results according to the key performance indicator variables, and determining an optimal system design scheme according to the key performance indicator variable curves.
[0076] Specifically, as Figure 5 is an example of a curve diagram of a system model key performance indicator variable on an MWORKS client.
[0077] As Figure 6 is a technical roadmap for verifying system key performance indicators of a Modelica multi-system design scheme and selecting an optimal design scheme provided by an embodiment of the present application.
[0078] According to the system design scheme, a to-be-designed component principle model is determined, a plurality of newly designed component models are designed based on the to-be-designed component principle model, system key performance indicator variables are determined according to the system design scheme, and component model codes are generated according to the designed component models. In order to select an optimal scheme from a plurality of system design schemes, the components are combined in different arrangement manners to replace to-be-replaced components in a source system model to form a plurality of new system models, batch simulation is performed on the plurality of new system models to obtain simulation results of the system design schemes corresponding to the system models, key performance indicator variable curves are drawn according to the simulation results, and an optimal system model corresponding to an optimal system design scheme is selected according to the curve drawing results.
[0079] The above is a Modelica-based component selection method provided by the embodiment of the present application. Based on the same inventive concept, the embodiment of the present application also provides a corresponding Modelica-based component selection device, as shown in Figure 7 .
[0080] The component model generation module 701 is configured to obtain a component principle model based on a plurality of system design schemes of a user, and generate component model codes of a plurality of component models based on the component principle model; the system model generation module 702 is configured to determine an arrangement mode included in the system design scheme, generate a system model template according to the arrangement mode, generate system model codes of a plurality of system models according to the system model template; the simulation module 703 is configured to call the system model codes to perform simulation, and obtain simulation results of the plurality of system models; the optimal scheme selection module 704 is configured to determine key performance indicator variables of the plurality of system models, draw key performance indicator variable curves of the simulation results according to the key performance indicator variables, and determine an optimal system design scheme according to the key performance indicator variable curves.
[0081] In an embodiment of the present application, the system model generation module 702 further includes a system model code generation submodule 7021 configured to obtain model trees of a plurality of source system models, replace to-be-replaced components of the model trees of the source system models with component models based on the system model template to form model trees of a plurality of new system models, and generate a plurality of corresponding system model codes according to the model trees of the plurality of new system models.
[0082] The embodiment of the present application also provides a corresponding Modelica-based component selection device, as shown in Figure 8 .
[0083] The embodiment of the present application provides a Modelica-based component selection device, which comprises:
[0084] at least one processor 801; and a memory 802 in communication with the at least one processor 801 through a bus 808; wherein the memory 802 stores instructions executable by the at least one processor 801, and the instructions are executed by the at least one processor 801 to enable the at least one processor 801 to perform:
[0085] The component principle model is acquired based on a plurality of system design schemes of a user, a plurality of component model codes of component models are generated in batch design based on the component principle model, an arrangement mode included in the system design scheme is determined, a system model template is generated according to the arrangement mode, system model codes of a plurality of system models are generated according to the system model template, simulation is performed by calling the system model codes, simulation results of the plurality of system models are obtained, key performance indicator variables of the plurality of system models are determined, key performance indicator variable curves of the simulation results are drawn according to the key performance indicator variables, and an optimal system design scheme is determined according to the key performance indicator variable curves.
[0086] Based on the same idea, some embodiments of the application also provide a medium corresponding to the above method.
[0087] Some embodiments of the application provide a storage medium storing computer executable instructions, and the computer executable instructions are executed by a processor to implement the following steps:
[0088] The component principle model is acquired based on a plurality of system design schemes of a user, a plurality of component model codes of component models are generated in batch design based on the component principle model, an arrangement mode included in the system design scheme is determined, a system model template is generated according to the arrangement mode, system model codes of a plurality of system models are generated according to the system model template, simulation is performed by calling the system model codes, simulation results of the plurality of system models are obtained, key performance indicator variables of the plurality of system models are determined, key performance indicator variable curves of the simulation results are drawn according to the key performance indicator variables, and an optimal system design scheme is determined according to the key performance indicator variable curves.
[0089] Each of the embodiments in the application is described in a progressive manner, and the same or similar parts of each of the embodiments can be referred to each other, and each of the embodiments mainly describes the difference from other embodiments. Especially, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the related parts can be referred to the part of the description of the method embodiments.
[0090] The device and medium provided by the embodiments of the application are one-to-one corresponding to the method, and therefore, the device and medium also have the similar beneficial technical effects as the method, and since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the device and medium will not be described here.
[0091] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0092] The above embodiments are only used to illustrate the present application, but not to limit it. Although the present application has been described in detail with general description and specific embodiments, modifications and improvements made on the basis of the present application are obvious to those skilled in the art. Therefore, these modifications and improvements made without departing from the spirit of the present application are within the scope of the present application.
Claims
1. A Modelica-based component selection method, characterized by, The method comprises the following steps: Obtain a plurality of different types of component principle models based on a plurality of system design schemes of a user, and generate component model codes of a plurality of different types and parameters of component models based on batch design of each component principle model; Determine an arrangement mode included in the system design scheme, wherein the arrangement mode refers to a mode of combining the plurality of different types and parameters of component models to form a system model; Generate a system model template according to the arrangement mode, wherein the system model template is a list containing a mapping relationship between a component type to be replaced and a corresponding newly designed component model; Replace the component type to be replaced in a source system model with the corresponding newly designed component model according to the system model template, and generate system model codes of a plurality of system models; Call the system model codes to perform simulation, and obtain simulation results of the plurality of system models; Determine key performance indicator variables of the plurality of system models, and draw key performance indicator variable curves of the simulation results according to the key performance indicator variables; Determine an optimal system design scheme according to the key performance indicator variable curves.
2. The method of claim 1, wherein, The method for generating the component model codes of the plurality of component models based on the batch design of the component principle models comprises the following steps: Create a plurality of component models, wherein the created component models inherit corresponding component principle models; Obtain parameters of the component models, and generate component model codes according to the obtained parameters.
3. The method of claim 1, wherein, The method for generating the system model codes of the plurality of system models according to the system model template comprises the following steps: Obtain model trees of a plurality of source system models, replace component types to be replaced in the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate a plurality of corresponding system model codes according to the model trees of the new system models. The system model template comprises [{component type to be replaced, newly designed component model}].
4. The method of claim 1, wherein, Wherein, “[]” represents a list, and “{}” represents a key-value pair. The arrangement mode comprises full arrangement and sequential arrangement.
5. The method of claim 1, wherein, The method comprises the following steps:
6. A Modelica-based component selection apparatus, characterized by comprising: A component model generation module is configured to obtain a plurality of different types of component principle models based on a plurality of system design schemes of a user, and generate component model codes of a plurality of different types and parameters of component models based on batch design of each component principle model; A system model generation module is configured to determine an arrangement mode included in the system design scheme, wherein the arrangement mode refers to a mode of combining the plurality of different types and parameters of component models to form a system model; generate a system model template according to the arrangement mode, wherein the system model template is a list containing a mapping relationship between a component type to be replaced and a corresponding newly designed component model; and replace the component type to be replaced in a source system model with the corresponding newly designed component model according to the system model template, and generate system model codes of a plurality of system models; A simulation module is configured to call the system model codes to perform simulation, and obtain simulation results of the plurality of system models; The optimal scheme selection module is configured to determine key performance indicator variables of the plurality of system models, draw key performance indicator variable curves of the simulation results according to the key performance indicator variables, and determine an optimal system design scheme according to the key performance indicator variable curves.
7. The apparatus of claim 6, wherein, The system model generation module further includes: The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models.
8. A Modelica-based component selection device, characterized by The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. The system model code generation submodule is configured to obtain model trees of the plurality of source system models, replace to-be-replaced component types of the model trees of the source system models with the component models based on the system model template, form model trees of a plurality of new system models, and generate system model codes of the plurality of new system models according to the model trees of the plurality of new system models. 9. A non-transitory storage medium storing computer-executable instructions, the computer-executable instructions comprising: determining an optimal system design based on the key performance indicator variable curve.
Citation Information
Patent Citations
Modelica-based aircraft environment control system modeling method and system and electronic equipment
CN115481543A
Simulation analysis method and device for ventilation system of track carrier
CN115544845A