CN116362060B - Automatic generation method, device and equipment for system simulation model - Google Patents

Automatic generation method, device and equipment for system simulation model Download PDF

Info

Publication number
CN116362060B
CN116362060B CN202310627947.4A CN202310627947A CN116362060B CN 116362060 B CN116362060 B CN 116362060B CN 202310627947 A CN202310627947 A CN 202310627947A CN 116362060 B CN116362060 B CN 116362060B
Authority
CN
China
Prior art keywords
model
subsystem
system simulation
codes
simulation model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310627947.4A
Other languages
Chinese (zh)
Other versions
CN116362060A (en
Inventor
徐丽杰
布向伟
彭昊旻
姚颂
魏凯
张弛
刘畅
王晨曦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongfang Space Jiangsu Aerospace Power Co ltd
Dongfang Space Technology Shandong Co Ltd
Orienspace Hainan Technology Co Ltd
Orienspace Technology Beijing Co Ltd
Original Assignee
Dongfang Space Technology Shandong Co Ltd
Orienspace Hainan Technology Co Ltd
Orienspace Technology Beijing Co Ltd
Orienspace Xian Aerospace Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dongfang Space Technology Shandong Co Ltd, Orienspace Hainan Technology Co Ltd, Orienspace Technology Beijing Co Ltd, Orienspace Xian Aerospace Technology Co Ltd filed Critical Dongfang Space Technology Shandong Co Ltd
Priority to CN202310627947.4A priority Critical patent/CN116362060B/en
Publication of CN116362060A publication Critical patent/CN116362060A/en
Application granted granted Critical
Publication of CN116362060B publication Critical patent/CN116362060B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a method, a device and equipment for automatically generating a system simulation model, and relates to the technical field of computer information processing, wherein the method comprises the following steps: acquiring source codes of at least one subsystem model and an XML configuration file of an extensible markup language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description; generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file; and generating a system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model. The scheme of the invention can realize automatic generation of the system simulation model code by utilizing the XML configuration file, thereby carrying out rapid system simulation model simulation.

Description

Automatic generation method, device and equipment for system simulation model
Technical Field
The invention relates to the technical field of computer information processing, in particular to a method, a device and equipment for automatically generating a system simulation model.
Background
At present, in the research and development process of a complex system, simulation analysis is an essential technical means for improving the design quality. In the simulation analysis process, subsystem models are required to be integrated to form a system simulation model, and in a complex system, the involved subsystem and part components are numerous, and a plurality of professional engineers are usually required to independently design and develop, so that the technical problems that modeling tools are not uniform and complex system model integration is difficult to realize are caused. The current common technical means is to compile each platform model into a C code model with a unified interface standard, and realize integrated simulation of the system model on a unified platform. However, the existing integration methods have respective disadvantages as follows:
the first mode of the prior art is as follows: the modeling platform in the mode has a technical path for directly integrating the C source code model, and the C source code model integration can be realized rapidly according to an integration mode specified by software. However, the integrated C source code model does not support a built-in solver and cannot adapt to application conditions of different subsystems requiring different solvers and solving parameter configuration. Even if the solver function is forcefully written in the C source code model, the solver function still needs to be called again by the platform solver, and useless calculation and model complexity are increased.
The second mode of the prior art is as follows: the model C code of the target platform is compiled by adopting a specific compiling plug-in unit by each modeling tool platform in the mode, and the compiled subsystem model is integrated. However, in the integration stage, subsystem models are binary codes, debugging is difficult, and encapsulated function interfaces are standardized interfaces, so that function expansion of the interfaces is difficult.
Disclosure of Invention
The invention aims to solve the technical problem of providing a method, a device and equipment for automatically generating a system simulation model, which can utilize an XML configuration file to automatically generate a system simulation model code so as to perform quick simulation of the system simulation model.
In order to solve the technical problems, the technical scheme of the invention is as follows:
an automatic generation method of a system simulation model comprises the following steps:
acquiring source codes of at least one subsystem model and an XML configuration file of an extensible markup language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file;
And generating a system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model.
Optionally, generating simulation model codes of each subsystem model of the system simulation model according to the source code of at least one subsystem model and the XML configuration file, including:
generating a system engineering basic information code of a system simulation model according to the system simulation model engineering description in the XML configuration file;
processing source codes of all subsystem models of the system simulation model according to subsystem model calling condition description in the XML configuration file to generate simulation codes of model instances of all subsystem models of the system simulation model;
according to the system simulation model solving related description in the XML configuration file, processing source codes of all subsystem models of the system simulation model to generate solving related codes of all subsystem models of the system simulation model;
and obtaining simulation model codes of all subsystem models of the system simulation model according to the system engineering basic information codes, the simulation codes of the model examples of all subsystem models of the system simulation model and the solving related codes of all subsystem models of the system simulation model.
Optionally, the system simulation model engineering description includes: at least one of an engineering name of the system simulation model, a storage path of the system simulation model, and version information of the system simulation model;
the subsystem model call case description includes: at least one of model types of subsystem models, model instantiations of subsystem models, model instance parameters of subsystem models, interface mapping relations of model instances of subsystem models, and model instance solving configurations of subsystem models;
the system simulation model solving related description comprises the following steps: the solver type and at least one of parameters of the solver, calculation sequence of model instances of the subsystem model, data storage related settings and external interfaces of the subsystem model.
Optionally, according to the description of the subsystem model call condition in the XML configuration file, the source code of each subsystem model of the system simulation model is processed, and the simulation code of the model instance of each subsystem model of the system simulation model is generated, which includes:
generating instance definition and declaration codes of the subsystem model and result pool codes of the model instance of the subsystem model according to the model type of the subsystem model and the model instance of the subsystem model in the XML configuration file;
Generating a parameter assignment code of a subsystem model instance according to the model instance parameters of the subsystem model in the XML configuration file;
generating binding codes of input variables of subsystem model examples and corresponding result variables in a result pool according to the input mapping relation of interfaces of the subsystem model examples in the XML configuration file;
generating codes for storing output variables of subsystem model examples into a result pool according to the output mapping relation of interfaces of the subsystem model examples in the XML configuration file;
and according to the model instance solving configuration of the subsystem model in the XML configuration file, generating codes for calling the solver and configuring parameters of the solver.
Optionally, according to the system simulation model solution related description in the XML configuration file, source codes of subsystem models of the system simulation model are processed, and solution related codes of subsystem models of the system simulation model are generated, including:
generating codes for calling the solver and configuring parameters of the solver according to the types of the solver and the parameters of the solver in the XML configuration file;
generating a subsystem model list and a sequence traversing code according to the calculation sequence of the model instance of the subsystem model in the XML configuration file;
Generating a result storage code according to the data storage related setting in the XML configuration file;
and generating an interface code between the result pool variable and the external environment according to the subsystem model external interface in the XML configuration file.
Optionally, generating the system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model includes:
operating an instance code of a subsystem model of a current subsystem model in a subsystem model list formed by subsystem models of a system simulation model to obtain a first operation result;
operating the parameter assignment code of the model instance of the subsystem model of the current subsystem model according to the first operation result to obtain a second operation result;
initializing a model instance of the current subsystem model according to the second operation result to obtain a sub-model initial value;
writing the initial value of the sub-model of the current subsystem model into a result pool;
and performing time domain iterative solution calculation on the initial value of the sub-model until the simulation code operation of the model instance of each subsystem model of the system simulation model is finished, so as to obtain the system simulation model.
Optionally, performing time domain iterative solution calculation on the initial value of the sub-model includes:
Inputting related variables through an interface of a model instance of the current subsystem model;
according to the related variables, running a solver of a model instance of the current subsystem model and configuring codes of solver parameters to obtain target state variables;
and outputting the target state variable through an external interface of the model instance of the current subsystem model.
The invention also provides an automatic generation device of the system simulation model, which comprises the following steps:
the system comprises an acquisition module for acquiring source codes of at least one subsystem model and an XML configuration file of an extensible markup language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
the processing module generates simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file; and generating a system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model.
The present invention also provides a computing device comprising: a processor, a memory storing a computer program which, when executed by the processor, performs the method as described above.
The invention also provides a computer readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a method as described above.
The scheme of the invention at least comprises the following beneficial effects:
according to the scheme, the source code of at least one subsystem model and the XML configuration file of the extensible markup language are obtained, and the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description; generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file; and generating a system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model. The XML configuration file can be utilized to realize the automatic generation of the system simulation model code, thereby carrying out rapid system simulation model simulation.
Drawings
FIG. 1 is a flow chart of a method for automatically generating a system simulation model according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a technical path of a method for automatically generating a system simulation model according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of code generation of a system simulation model automatic generation method according to an embodiment of the present invention;
FIG. 4 is a flow chart of a system simulation code calculation of a system simulation model automatic generation method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an automatic system simulation model generating device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As shown in fig. 1, an embodiment of the present invention provides a method for automatically generating a system simulation model, including:
step 11, acquiring source codes of at least one subsystem model and an XML configuration file of an expansion mark language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
step 12, generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file;
And step 13, generating a system simulation model according to the calculation sequence of the simulation model codes of all subsystem models of the system simulation model.
In this embodiment, as shown in fig. 2, the code generation technology of the XML configuration file is used to implement engineering information configuration, model information configuration, solution related configuration, and the like, and automatically generate the system simulation model code, so that the development difficulty and the task amount in the actual project requirements can be reduced, the rapid development of the system simulation model code can be implemented, and meanwhile, the reliability of the system simulation model code is improved, and the universality and maintainability are enhanced. The method effectively solves the problems that the commercial modeling platform cannot realize the integration system model of the source code subsystem with the solver C, and the integration stage of the commercial integration platform system is inconvenient to debug and poor in expansibility of interface functions, and realizes the generation of the simulation model code of the system according to the code construction of the model code of the multi-source subsystem based on the code generation technology of the XML configuration file.
In an alternative embodiment of the present invention, step 12 may include:
step 121, generating a system engineering basic information code of a system simulation model according to the system simulation model engineering description in the XML configuration file;
step 122, processing the source codes of the subsystem models of the system simulation model according to the subsystem model call condition description in the XML configuration file, and generating simulation codes of model instances of the subsystem models of the system simulation model;
Step 123, processing source codes of subsystem models of the system simulation model according to the system simulation model solving related description in the XML configuration file to generate solving related codes of subsystem models of the system simulation model;
and step 124, obtaining simulation model codes of all subsystem models of the system simulation model according to the system engineering basic information codes, the simulation codes of the model instance of all subsystem models of the system simulation model and the solving related codes of all subsystem models of the system simulation model.
In this embodiment, three aspects including a system simulation model project, a subsystem model calling condition and a system simulation model solving relation are preset in an XML configuration file to describe the simulation task, and a subsystem model C source code is combined according to the description contents of the three parts to generate a system simulation model code.
In an alternative embodiment of the present invention, the system simulation model engineering description includes: at least one of an engineering name of the system simulation model, a storage path of the system simulation model, and version information of the system simulation model;
the subsystem model call case description includes: at least one of model types of subsystem models, model instantiations of subsystem models, model instance parameters of subsystem models, interface mapping relations of model instances of subsystem models, and model instance solving configurations of subsystem models;
The system simulation model solving related description comprises the following steps: the solver type and at least one of parameters of the solver, calculation sequence of model instances of the subsystem model, data storage related settings and external interfaces of the subsystem model.
In this embodiment, the system simulation model engineering is a related computer program file generated for a simulation task, and includes an XML file, a C code, and the like; the subsystem model calling conditions, namely, which sub models are involved in the simulation task, for example, the sub models of an engine, a suspension, a steering mechanism, vehicle dynamics, aerodynamics, a vehicle control unit and the like are involved in the simulation task of a certain type of automobile at a time. The sub-models define types in a model library, and instantiation codes need to be generated in the current simulation task. In a preset XML configuration file, according to the vehicle model characteristics of the simulation task, defining parameters in the sub-model instance and the input-output mapping relation between the sub-models determined by the natural physical characteristics. For example, in the example of vehicle dynamics model simulation, relevant parameters such as weight, wheelbase and the like of the vehicle are set according to the specific situation of the vehicle, and the parameters are all aimed at the current simulation task, so that the parameters of the sub-model example need to be described through an XML configuration file to modify the relevant parameters (default parameters) in the model example into values required in the current simulation task.
And setting the system simulation model solving related description, namely setting the solving of the defined subsystem model, such as the related settings of parameters of a configuration solver, subsystem model calculation sequence, data storage and the like, so as to realize the solving of the system simulation model according to the expected sequence and rule.
In an alternative embodiment of the present invention, step 122 may include:
step 1221, generating an instance definition, a declaration code and a result pool code of the subsystem model according to the model type of the subsystem model and the model instance of the subsystem model in the XML configuration file;
step 1222, generating parameter assignment codes of subsystem model examples according to the model example parameters of the subsystem models in the XML configuration file;
step 1223, generating binding codes of input variables of subsystem model examples and corresponding result variables in a result pool according to the input mapping relation of interfaces of the subsystem model examples in the XML configuration file;
step 1224, generating a code for storing the output variable of the subsystem model instance into a result pool according to the output mapping relation of the interface of the subsystem model instance in the XML configuration file;
And step 1225, according to the model instance solution configuration of the subsystem model in the XML configuration file, generating codes for calling the solver and configuring the parameters of the solver.
In this embodiment, the corresponding relationship between the description content of each part in the XML configuration file and the generated system simulation model code is shown in fig. 3, where the subsystem model calling condition part in the XML configuration file performs model instantiation according to the source code of the subsystem model C in the model library, and synchronously configures model parameters, relationships between input and output interfaces, solution settings, and the like, so as to correspondingly generate the detailed model code of the system simulation model architecture. Taking the model instantiation of step 1221 as an example, the code in the model library defines the type of subsystem, e.g., the motor model class motor, and the subsystem instantiation is described in a preset XML configuration file, e.g.:
<subModels>
<subModel>
<class>motor</class>
<modelName>servoMotor1<modelName>
</subModel>
</subModels>
generating an instantiation simulation code according to the XML configuration file:
motor servoMotor1 = new motor();
in the finally obtained simulation code, the object servoMotor1 (servo motor) is an example of a motor type.
In an alternative embodiment of the present invention, step 123 may include:
step 1231, generating codes for calling the solver and configuring parameters of the solver according to the types of the solver and the parameters of the solver in the XML configuration file;
Step 1232, generating a subsystem model list and a sequence traversing code according to the calculation sequence of the model instance of the subsystem model in the XML configuration file;
step 1233, according to the data storage related settings in the XML configuration file, generating a result storage code;
step 1234, generating an interface code between the result pool variable and the external environment according to the subsystem model external interface in the XML configuration file.
In this embodiment, the system solution correlation is configured, in the above-mentioned instantiated sub-model code, only the right value required by the solver is calculated, and the solver needs to integrate the right value, so that the solver needs to be configured according to the simulation task, for example, the parameters of the solver, such as the integration step length and the integration ending condition, and the configuration subsystem model instance calculation sequence, the relevant configuration storage, and the like, such as specifically selecting which calculation results are stored in the hard disk, and the like. The solver parameters of step 1231 are configured, for example, such that the solver software interface type is class odeSolve, and the main parameters include:
odeSolve.startTime;
odeSolve.stopTime;
odeSolve.method;
odeSolve.tStep;
etc.;
definition in XML:
<solver>
<method>RK45</method>
<stratTime>0.0</startTime>
<stopTime unit=’second’>100.0</stopTime>
<tStep unit=’second’>0.01</tStep >
</solver>
and finally generating codes:
odeSolve sl1 = new odeSolve ();
sl1.method = ‘RK45’;
sl1.stratTime = 0.0;
sl1.stopTime = 100.0;
sl1.tStep = 0.01;
....
in an alternative embodiment of the present invention, step 13 may include:
step 131, running an instance code of a subsystem model of a current subsystem model in a subsystem model list formed by subsystem models of a system simulation model to obtain a first running result;
Step 132, according to the first operation result, operating the parameter assignment code of the model instance of the subsystem model of the current subsystem model to obtain a second operation result;
step 133, initializing a model instance of the current subsystem model according to the second operation result to obtain a sub-model initial value;
step 134, writing the initial value of the sub-model of the current subsystem model into a result pool;
and 135, performing time domain iterative solution calculation on the initial value of the sub-model until the simulation code operation of the model instance of each subsystem model of the system simulation model is finished, and obtaining the system simulation model.
In this embodiment, as shown in fig. 4, the simulation calculation flow of the system simulation model code generated based on the XML configuration file first traverses the subsystem model list, executes the sub-model instantiation, then sequentially executes the parameter assignment code, executes the model initialization code, and writes the initial values of the sub-models into the code of the result pool.
In an optional embodiment of the present invention, performing a time domain iterative solution calculation on the initial value of the sub-model includes:
inputting related variables through an interface of a model instance of the current subsystem model;
According to the related variables, running a solver of a model instance of the current subsystem model and configuring codes of solver parameters to obtain target state variables;
and outputting the target state variable through an external interface of the model instance of the current subsystem model.
In this embodiment, after obtaining the initial value of each sub-model, that is, the right value required by the solver, the configuration parameters of the solver need to be integrated by the solver according to the above embodiment, that is, the time domain iterative solution calculation is performed. For example, using a motor as an example, dy=motor (t, y, u), the related variable u is first obtained through the external interface, and then a single-step inner integration solution iteration is performed: and solving dy, transmitting the dy to a solver for one-step integration, and obtaining a target state variable y after the integration. In the process of carrying out single-step internal integral solving iteration, according to whether the submodel is provided with an independent solver for carrying out respective processing, the operations of reading result pool data as input, single-step calculation of the submodel and writing the result into the result pool are sequentially executed. And finally, storing the calculated data of y, dy and the like into a result pool for other models to use. Finally, the simulation calculation is stopped, and if the next simulation is needed, the steps of setting parameters and initializing are not needed to be executed.
As shown in fig. 5, an embodiment of the present invention further provides an automatic system simulation model generating apparatus 50, including:
the obtaining module 51 obtains source code of at least one subsystem model and an XML configuration file, where the XML configuration file includes: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
a processing module 52 for generating simulation model codes of each subsystem model of the system simulation model according to the source code of at least one subsystem model and the XML configuration file; and generating a system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model.
Optionally, generating simulation model codes of each subsystem model of the system simulation model according to the source code of at least one subsystem model and the XML configuration file, including:
generating a system engineering basic information code of a system simulation model according to the system simulation model engineering description in the XML configuration file;
processing source codes of all subsystem models of the system simulation model according to subsystem model calling condition description in the XML configuration file to generate simulation codes of model instances of all subsystem models of the system simulation model;
According to the system simulation model solving related description in the XML configuration file, processing source codes of all subsystem models of the system simulation model to generate solving related codes of all subsystem models of the system simulation model;
and obtaining simulation model codes of all subsystem models of the system simulation model according to the system engineering basic information codes, the simulation codes of the model examples of all subsystem models of the system simulation model and the solving related codes of all subsystem models of the system simulation model.
Optionally, the system simulation model engineering description includes: at least one of an engineering name of the system simulation model, a storage path of the system simulation model, and version information of the system simulation model;
the subsystem model call case description includes: at least one of model types of subsystem models, model instantiations of subsystem models, model instance parameters of subsystem models, interface mapping relations of model instances of subsystem models, and model instance solving configurations of subsystem models;
the system simulation model solving related description comprises the following steps: the solver type and at least one of parameters of the solver, calculation sequence of model instances of the subsystem model, data storage related settings and external interfaces of the subsystem model.
Optionally, according to the description of the subsystem model call condition in the XML configuration file, the source code of each subsystem model of the system simulation model is processed, and the simulation code of the model instance of each subsystem model of the system simulation model is generated, which includes:
generating instance definition and declaration codes of the subsystem model and result pool codes of the model instance of the subsystem model according to the model type of the subsystem model and the model instance of the subsystem model in the XML configuration file;
generating a parameter assignment code of a subsystem model instance according to the model instance parameters of the subsystem model in the XML configuration file;
generating binding codes of input variables of subsystem model examples and corresponding result variables in a result pool according to the input mapping relation of interfaces of the subsystem model examples in the XML configuration file;
generating codes for storing output variables of subsystem model examples into a result pool according to the output mapping relation of interfaces of the subsystem model examples in the XML configuration file;
and according to the model instance solving configuration of the subsystem model in the XML configuration file, generating codes for calling the solver and configuring parameters of the solver.
Optionally, according to the system simulation model solution related description in the XML configuration file, source codes of subsystem models of the system simulation model are processed, and solution related codes of subsystem models of the system simulation model are generated, including:
generating codes for calling the solver and configuring parameters of the solver according to the types of the solver and the parameters of the solver in the XML configuration file;
generating a subsystem model list and a sequence traversing code according to the calculation sequence of the model instance of the subsystem model in the XML configuration file;
generating a result storage code according to the data storage related setting in the XML configuration file;
and generating an interface code between the result pool variable and the external environment according to the subsystem model external interface in the XML configuration file.
Optionally, generating the system simulation model according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model includes:
operating an instance code of a subsystem model of a current subsystem model in a subsystem model list formed by subsystem models of a system simulation model to obtain a first operation result;
operating the parameter assignment code of the model instance of the subsystem model of the current subsystem model according to the first operation result to obtain a second operation result;
Initializing a model instance of the current subsystem model according to the second operation result to obtain a sub-model initial value;
writing the initial value of the sub-model of the current subsystem model into a result pool;
and performing time domain iterative solution calculation on the initial value of the sub-model until the simulation code operation of the model instance of each subsystem model of the system simulation model is finished, so as to obtain the system simulation model.
Optionally, performing time domain iterative solution calculation on the initial value of the sub-model includes:
inputting related variables through an interface of a model instance of the current subsystem model;
according to the related variables, running a solver of a model instance of the current subsystem model and configuring codes of solver parameters to obtain target state variables;
and outputting the target state variable through an external interface of the model instance of the current subsystem model.
It should be noted that, the device is a device corresponding to the above method, and all implementation manners in the above method embodiments are applicable to the embodiment of the device, so that the same technical effects can be achieved.
Embodiments of the present invention also provide a computing device comprising: a processor, a memory storing a computer program which, when executed by the processor, performs the method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a method as described above. All the implementation manners in the method embodiment are applicable to the embodiment, and the same technical effect can be achieved.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
Furthermore, it should be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. Also, the steps of performing the series of processes described above may naturally be performed in chronological order in the order of description, but are not necessarily performed in chronological order, and some steps may be performed in parallel or independently of each other. It will be appreciated by those of ordinary skill in the art that all or any of the steps or components of the methods and apparatus of the present invention may be implemented in hardware, firmware, software, or a combination thereof in any computing device (including processors, storage media, etc.) or network of computing devices, as would be apparent to one of ordinary skill in the art after reading this description of the invention.
The object of the invention can thus also be achieved by running a program or a set of programs on any computing device. The computing device may be a well-known general purpose device. The object of the invention can thus also be achieved by merely providing a program product containing program code for implementing said method or apparatus. That is, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. It is apparent that the storage medium may be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is apparent that the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention. The steps of executing the series of processes may naturally be executed in chronological order in the order described, but are not necessarily executed in chronological order. Some steps may be performed in parallel or independently of each other.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.

Claims (5)

1. An automatic generation method of a system simulation model is characterized by comprising the following steps:
acquiring source codes of at least one subsystem model and an XML configuration file of an extensible markup language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file;
generating a system simulation model according to the calculation sequence of the simulation model codes of all subsystem models of the system simulation model;
generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file, wherein the simulation model codes comprise:
generating a system engineering basic information code of a system simulation model according to the system simulation model engineering description in the XML configuration file;
Processing source codes of all subsystem models of the system simulation model according to subsystem model calling condition description in the XML configuration file to generate simulation codes of model instances of all subsystem models of the system simulation model;
according to the system simulation model solving related description in the XML configuration file, processing source codes of all subsystem models of the system simulation model to generate solving related codes of all subsystem models of the system simulation model;
obtaining simulation model codes of all subsystem models of the system simulation model according to the system engineering basic information codes, the simulation codes of the model examples of all subsystem models of the system simulation model and the solving related codes of all subsystem models of the system simulation model;
wherein, the system simulation model engineering description includes: at least one of an engineering name of the system simulation model, a storage path of the system simulation model, and version information of the system simulation model;
the subsystem model call case description includes: at least one of model types of subsystem models, model instantiations of subsystem models, model instance parameters of subsystem models, interface mapping relations of model instances of subsystem models, and model instance solving configurations of subsystem models;
The system simulation model solving related description comprises the following steps: at least one of parameters of the solver type and the solver, calculation sequence of model examples of the subsystem model, data storage related setting and subsystem model external interfaces;
the method comprises the steps of processing source codes of subsystem models of a system simulation model according to subsystem model calling condition descriptions in the XML configuration file to generate simulation codes of model instances of the subsystem models of the system simulation model, and comprises the following steps:
generating instance definition and declaration codes of the subsystem model and result pool codes of the model instance of the subsystem model according to the model type of the subsystem model and the model instance of the subsystem model in the XML configuration file;
generating a parameter assignment code of a subsystem model instance according to the model instance parameters of the subsystem model in the XML configuration file;
generating binding codes of input variables of subsystem model examples and corresponding result variables in a result pool according to the input mapping relation of interfaces of the subsystem model examples in the XML configuration file;
generating codes for storing output variables of subsystem model examples into a result pool according to the output mapping relation of interfaces of the subsystem model examples in the XML configuration file;
According to the model instance solving configuration of the subsystem model in the XML configuration file, generating codes for calling the solver and configuring parameters of the solver;
the method comprises the steps of processing source codes of subsystem models of a system simulation model according to the system simulation model solving related description in the XML configuration file to generate solving related codes of the subsystem models of the system simulation model, and comprises the following steps:
generating codes for calling the solver and configuring parameters of the solver according to the types of the solver and the parameters of the solver in the XML configuration file;
generating a subsystem model list and a sequence traversing code according to the calculation sequence of the model instance of the subsystem model in the XML configuration file;
generating a result storage code according to the data storage related setting in the XML configuration file;
generating an interface code between a result pool variable and an external environment according to an external interface of a subsystem model in the XML configuration file;
wherein, according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model, generating the system simulation model comprises:
operating an instance code of a subsystem model of a current subsystem model in a subsystem model list formed by subsystem models of a system simulation model to obtain a first operation result;
Operating the parameter assignment code of the model instance of the subsystem model of the current subsystem model according to the first operation result to obtain a second operation result;
initializing a model instance of the current subsystem model according to the second operation result to obtain a sub-model initial value;
writing the initial value of the sub-model of the current subsystem model into a result pool;
and performing time domain iterative solution calculation on the initial value of the sub-model until the simulation code operation of the model instance of each subsystem model of the system simulation model is finished, so as to obtain the system simulation model.
2. The automatic generation method of a system simulation model according to claim 1, wherein performing time domain iterative solution calculation on the initial value of the sub model comprises:
inputting related variables through an interface of a model instance of the current subsystem model;
according to the related variables, running a solver of a model instance of the current subsystem model and configuring codes of solver parameters to obtain target state variables;
and outputting the target state variable through an external interface of the model instance of the current subsystem model.
3. An automatic system simulation model generating device, comprising:
The system comprises an acquisition module for acquiring source codes of at least one subsystem model and an XML configuration file of an extensible markup language, wherein the XML configuration file comprises: a system simulation model engineering description, a subsystem model calling condition description and a system simulation model solving related description;
the processing module generates simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file; generating a system simulation model according to the calculation sequence of the simulation model codes of all subsystem models of the system simulation model;
generating simulation model codes of all subsystem models of the system simulation model according to the source codes of at least one subsystem model and the XML configuration file, wherein the simulation model codes comprise:
generating a system engineering basic information code of a system simulation model according to the system simulation model engineering description in the XML configuration file;
processing source codes of all subsystem models of the system simulation model according to subsystem model calling condition description in the XML configuration file to generate simulation codes of model instances of all subsystem models of the system simulation model;
according to the system simulation model solving related description in the XML configuration file, processing source codes of all subsystem models of the system simulation model to generate solving related codes of all subsystem models of the system simulation model;
Obtaining simulation model codes of all subsystem models of the system simulation model according to the system engineering basic information codes, the simulation codes of the model examples of all subsystem models of the system simulation model and the solving related codes of all subsystem models of the system simulation model;
wherein, the system simulation model engineering description includes: at least one of an engineering name of the system simulation model, a storage path of the system simulation model, and version information of the system simulation model;
the subsystem model call case description includes: at least one of model types of subsystem models, model instantiations of subsystem models, model instance parameters of subsystem models, interface mapping relations of model instances of subsystem models, and model instance solving configurations of subsystem models;
the system simulation model solving related description comprises the following steps: at least one of parameters of the solver type and the solver, calculation sequence of model examples of the subsystem model, data storage related setting and subsystem model external interfaces;
the method comprises the steps of processing source codes of subsystem models of a system simulation model according to subsystem model calling condition descriptions in the XML configuration file to generate simulation codes of model instances of the subsystem models of the system simulation model, and comprises the following steps:
Generating instance definition and declaration codes of the subsystem model and result pool codes of the model instance of the subsystem model according to the model type of the subsystem model and the model instance of the subsystem model in the XML configuration file;
generating a parameter assignment code of a subsystem model instance according to the model instance parameters of the subsystem model in the XML configuration file;
generating binding codes of input variables of subsystem model examples and corresponding result variables in a result pool according to the input mapping relation of interfaces of the subsystem model examples in the XML configuration file;
generating codes for storing output variables of subsystem model examples into a result pool according to the output mapping relation of interfaces of the subsystem model examples in the XML configuration file;
according to the model instance solving configuration of the subsystem model in the XML configuration file, generating codes for calling the solver and configuring parameters of the solver;
the method comprises the steps of processing source codes of subsystem models of a system simulation model according to the system simulation model solving related description in the XML configuration file to generate solving related codes of the subsystem models of the system simulation model, and comprises the following steps:
Generating codes for calling the solver and configuring parameters of the solver according to the types of the solver and the parameters of the solver in the XML configuration file;
generating a subsystem model list and a sequence traversing code according to the calculation sequence of the model instance of the subsystem model in the XML configuration file;
generating a result storage code according to the data storage related setting in the XML configuration file;
generating an interface code between a result pool variable and an external environment according to an external interface of a subsystem model in the XML configuration file;
wherein, according to the calculation sequence of the simulation model codes of each subsystem model of the system simulation model, generating the system simulation model comprises:
operating an instance code of a subsystem model of a current subsystem model in a subsystem model list formed by subsystem models of a system simulation model to obtain a first operation result;
operating the parameter assignment code of the model instance of the subsystem model of the current subsystem model according to the first operation result to obtain a second operation result;
initializing a model instance of the current subsystem model according to the second operation result to obtain a sub-model initial value;
Writing the initial value of the sub-model of the current subsystem model into a result pool;
and performing time domain iterative solution calculation on the initial value of the sub-model until the simulation code operation of the model instance of each subsystem model of the system simulation model is finished, so as to obtain the system simulation model.
4. A computing device, comprising: a processor, a memory storing a computer program which, when executed by the processor, performs the method of any one of claims 1 to 2.
5. A computer readable storage medium storing instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 2.
CN202310627947.4A 2023-05-31 2023-05-31 Automatic generation method, device and equipment for system simulation model Active CN116362060B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310627947.4A CN116362060B (en) 2023-05-31 2023-05-31 Automatic generation method, device and equipment for system simulation model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310627947.4A CN116362060B (en) 2023-05-31 2023-05-31 Automatic generation method, device and equipment for system simulation model

Publications (2)

Publication Number Publication Date
CN116362060A CN116362060A (en) 2023-06-30
CN116362060B true CN116362060B (en) 2023-08-22

Family

ID=86922521

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310627947.4A Active CN116362060B (en) 2023-05-31 2023-05-31 Automatic generation method, device and equipment for system simulation model

Country Status (1)

Country Link
CN (1) CN116362060B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1387305A1 (en) * 2002-07-30 2004-02-04 Bull S.A. Method and system for automatically providing a global model of an architectural simulation
CN101420437A (en) * 2008-11-14 2009-04-29 北京航空航天大学 Interface device for prototype system and HLA simulation system
WO2009103089A1 (en) * 2008-02-15 2009-08-20 Invensys Systems, Inc. System and method for autogenerating simulations for process control system checkout and operator training
CN104598240A (en) * 2015-01-20 2015-05-06 北京仿真中心 Platform-spanning simulation model development method and system
WO2016049750A1 (en) * 2014-10-03 2016-04-07 Quanser Consulting Inc. Digital content infrastructure
DE102019003851A1 (en) * 2018-06-01 2019-12-05 The Mathworks, Inc. Systems and methods for the automatic realization of models for co-simulation
CN110705078A (en) * 2019-09-25 2020-01-17 哈尔滨工程大学 Simulation model development system and analysis method of nuclear power device
CN112100817A (en) * 2020-08-20 2020-12-18 上海机电工程研究所 Intelligent heterogeneous IO data conversion method and system based on distributed simulation system
CN113032963A (en) * 2021-02-26 2021-06-25 北京经纬恒润科技股份有限公司 Simulink model simulation acceleration method and device
CN115454395A (en) * 2022-08-12 2022-12-09 浙江大学 Method and device for constructing computing interface of industrial digital twin system unit equipment
CN116107873A (en) * 2022-12-12 2023-05-12 北京轩宇信息技术有限公司 Simulation test platform and automatic generation method thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8510088B2 (en) * 2008-09-30 2013-08-13 Uchicago Argonne Llc Flexible evaluator for vehicle propulsion systems

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1387305A1 (en) * 2002-07-30 2004-02-04 Bull S.A. Method and system for automatically providing a global model of an architectural simulation
WO2009103089A1 (en) * 2008-02-15 2009-08-20 Invensys Systems, Inc. System and method for autogenerating simulations for process control system checkout and operator training
CN101420437A (en) * 2008-11-14 2009-04-29 北京航空航天大学 Interface device for prototype system and HLA simulation system
WO2016049750A1 (en) * 2014-10-03 2016-04-07 Quanser Consulting Inc. Digital content infrastructure
CN104598240A (en) * 2015-01-20 2015-05-06 北京仿真中心 Platform-spanning simulation model development method and system
DE102019003851A1 (en) * 2018-06-01 2019-12-05 The Mathworks, Inc. Systems and methods for the automatic realization of models for co-simulation
CN110705078A (en) * 2019-09-25 2020-01-17 哈尔滨工程大学 Simulation model development system and analysis method of nuclear power device
CN112100817A (en) * 2020-08-20 2020-12-18 上海机电工程研究所 Intelligent heterogeneous IO data conversion method and system based on distributed simulation system
CN113032963A (en) * 2021-02-26 2021-06-25 北京经纬恒润科技股份有限公司 Simulink model simulation acceleration method and device
CN115454395A (en) * 2022-08-12 2022-12-09 浙江大学 Method and device for constructing computing interface of industrial digital twin system unit equipment
CN116107873A (en) * 2022-12-12 2023-05-12 北京轩宇信息技术有限公司 Simulation test platform and automatic generation method thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CAD/CAE集成的高速列车子系统仿真分析一体化平台;唐兆;朱允瑞;聂隐愚;张卫华;;西南交通大学学报(01期);全文 *

Also Published As

Publication number Publication date
CN116362060A (en) 2023-06-30

Similar Documents

Publication Publication Date Title
US11074049B2 (en) Method and system for generating program code modified by rule sets
US8150673B1 (en) Partitioning a model in modeling environments
US8869103B2 (en) Using intermediate representations to verify computer-executable code generated from a model
US10860298B2 (en) Method and system for editing a block diagram model
US7194726B2 (en) Method for automatically decomposing dynamic system models into submodels
Julius et al. Transformation of GRAFCET to PLC code including hierarchical structures
Selim et al. Model transformations for migrating legacy models: an industrial case study
US11126408B2 (en) Incremental code generation method
US10915302B2 (en) Identification and visualization of associations among code generated from a model and sources that affect code generation
Haberl et al. Model-level debugging of embedded real-time systems
CN111650847A (en) Method for integrating actuator model in aeroengine hardware on loop platform
Weiland et al. A classification of modeling variability in simulink
Di Natale et al. An MDA approach for the generation of communication adapters integrating SW and FW components from Simulink
CN110347588B (en) Software verification method, device, computer equipment and storage medium
US20220019414A1 (en) Method for merging architecture data
CN116362060B (en) Automatic generation method, device and equipment for system simulation model
Di Natale et al. A Model-based approach for the synthesis of software to firmware adapters for use with automatically generated components
Zaeh et al. Model-driven development of PLC software for machine tools
Maschotta et al. Model-driven aspect-specific systems engineering in the automotive domain
Kaijser et al. Towards simulation-based verification for continuous integration and delivery
Erkkinen et al. Automatic code generation-technology adoption lessons learned from commercial vehicle case studies
Haupt et al. Near automatic translation of autonomie-based power train architectures for multi-physics simulations using high performance computing
Kirchner et al. Using sysml for modelling and code generation for smart sensor asics
Haberl et al. From COLA Models to Distributed Embedded Systems Code
Graf et al. Gaining insight into executable models during runtime: Architecture and mappings

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 265118 No.1 Haixiang Middle Road, Fengcheng street, Haiyang City, Yantai City, Shandong Province

Patentee after: Dongfang space technology (Shandong) Co.,Ltd.

Country or region after: China

Patentee after: Dongfang Space (Jiangsu) Aerospace Power Co.,Ltd.

Patentee after: Oriental space technology (Beijing) Co.,Ltd.

Patentee after: Orient Space (Hainan) Technology Co.,Ltd.

Address before: 265118 No.1 Haixiang Middle Road, Fengcheng street, Haiyang City, Yantai City, Shandong Province

Patentee before: Dongfang space technology (Shandong) Co.,Ltd.

Country or region before: China

Patentee before: Oriental space technology (Beijing) Co.,Ltd.

Patentee before: Dongfang Space (Jiangsu) Aerospace Power Co.,Ltd.

Patentee before: Orient Space (Hainan) Technology Co.,Ltd.

Address after: 265118 No.1 Haixiang Middle Road, Fengcheng street, Haiyang City, Yantai City, Shandong Province

Patentee after: Dongfang space technology (Shandong) Co.,Ltd.

Country or region after: China

Patentee after: Oriental space technology (Beijing) Co.,Ltd.

Patentee after: Dongfang Space (Jiangsu) Aerospace Power Co.,Ltd.

Patentee after: Orient Space (Hainan) Technology Co.,Ltd.

Address before: 265118 No.1 Haixiang Middle Road, Fengcheng street, Haiyang City, Yantai City, Shandong Province

Patentee before: Dongfang space technology (Shandong) Co.,Ltd.

Country or region before: China

Patentee before: Oriental space technology (Beijing) Co.,Ltd.

Patentee before: Oriental space (Xi'an) Aerospace Technology Co.,Ltd.

Patentee before: Orient Space (Hainan) Technology Co.,Ltd.