[go: up one dir, main page]

CN116050112B - Linux-based FMU model generation method and device - Google Patents

Linux-based FMU model generation method and device Download PDF

Info

Publication number
CN116050112B
CN116050112B CN202211730209.4A CN202211730209A CN116050112B CN 116050112 B CN116050112 B CN 116050112B CN 202211730209 A CN202211730209 A CN 202211730209A CN 116050112 B CN116050112 B CN 116050112B
Authority
CN
China
Prior art keywords
fmu
model
windows
linux
simulation
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
CN202211730209.4A
Other languages
Chinese (zh)
Other versions
CN116050112A (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.)
Beijing Shi Guan Jin Yang Technology Development Co ltd
Original Assignee
Beijing Shi Guan Jin Yang Technology Development 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 Beijing Shi Guan Jin Yang Technology Development Co ltd filed Critical Beijing Shi Guan Jin Yang Technology Development Co ltd
Priority to CN202211730209.4A priority Critical patent/CN116050112B/en
Publication of CN116050112A publication Critical patent/CN116050112A/en
Application granted granted Critical
Publication of CN116050112B publication Critical patent/CN116050112B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • 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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请提供了一种基于Linux的FMU模型生成方法及装置,包括:基于建模软件,建立FMU预封装模型;利用所述FMU预封装模型,封装生成基于Windows的FMU模型;利用编译代码工具,编译所述基于Windows的FMU模型,生成基于Linux的FMU模型。这样,通过编译代码工具编译改造基于Windows的FMU模型,使其成为可以适配实时仿真机、具备实时仿真能力,且与原环境建模软件仿真结果一致的基于Linux的FMU模型,解决了现有模型无法在基于GCAir仿真引擎的实时仿真机中正确运行的问题,同时具备Windows非实时仿真功能。

The present application provides a method and device for generating a FMU model based on Linux, including: establishing a pre-packaged FMU model based on modeling software; using the pre-packaged FMU model to encapsulate and generate a Windows-based FMU model; using a compilation code tool to compile the Windows-based FMU model to generate a Linux-based FMU model. In this way, the Windows-based FMU model is compiled and transformed by the compilation code tool to become a Linux-based FMU model that can adapt to a real-time simulator, has real-time simulation capabilities, and is consistent with the simulation results of the original environment modeling software, solving the problem that the existing model cannot run correctly in a real-time simulator based on the GCAir simulation engine, and at the same time has Windows non-real-time simulation functions.

Description

Linux-based FMU model generation method and device
Technical Field
The application relates to the technical field of model simulation, in particular to a method and a device for generating an FMU model based on Linux.
Background
FMI (Functional Mock-up Interface) is an open, third party standard Interface protocol independent of modeling software, enabling models to be packaged as FMUs (Functional Mock-up units) according to the FMI protocol. Through the FMI interface, joint simulation can be realized with other heterogeneous software supporting FMI. The simulation engine (SimulationEngine) of GCAir simulation test integrated software developed by Beijing Shiguan Jinyang technology development limited is an entity which actually runs a simulation model, receives a command of an upper computer GCAir through a TCP to perform simulation calculation, and feeds simulation result data back to GCAir in real time.
The FMU file running in GCAir real-time simulator needs to meet at least one of (1) 64-bit Linux edition dynamic library(s) containing model, and (2) source code containing model and corresponding Makefile file or configuration script, and can be compiled correctly in Linux system. At present, an FMU model derived based on modeling software common in the engineering field does not have the capability of directly and correctly operating a GCAir real-time simulator.
Therefore, how to solve the problem that the existing model cannot be correctly run in the real-time simulator based on GCAir simulation engine is a technical problem that needs to be solved by those skilled in the art.
Disclosure of Invention
In view of this, the embodiment of the application provides a Linux-based FMU model generating method and device, which aims to solve the problem that the existing model cannot be correctly operated in a GCAir simulation engine-based real-time simulator.
In a first aspect, an embodiment of the present application provides a Linux-based FMU model generating method, including:
establishing an FMU pre-packaging model based on modeling software;
packaging to generate a Windows-based FMU model by using the FMU pre-packaging model;
And compiling the Windows-based FMU model by utilizing a compiling code tool to generate a Linux-based FMU model.
Optionally, the establishing the FMU pre-package model based on the modeling software includes:
Setting a result output interface and a fixed step length solver;
and based on the modeling software, establishing an FMU pre-packaging model by utilizing the result output interface and a fixed-step length solver.
Optionally, the encapsulating to generate the FMU model based on Windows by using the FMU pre-encapsulation model includes:
setting a save type and a path for exporting a model;
and according to the storage type and the path of the derived model, the Windows-based FMU model is encapsulated and created, and is an FMU model for retaining source codes.
Optionally, compiling the FMU model based on Windows by using a compiling code tool to generate the FMU model based on Linux, including:
Decompressing the FMU model based on Windows to obtain a file set, wherein the file set comprises source folders;
Copying a plurality of files of the compiled code tool to the sources folder, wherein the plurality of files of the compiled code tool comprise running files;
running the running files in the sources folder with the identity of an administrator;
Copying a result file set to the Windows-based FMU model to generate a Linux-based FMU model, wherein the result file set is a plurality of files of a compiled code tool except the running file in the source folder.
Optionally, before the decompressing the FMU model based on Windows to obtain the file set, the method further includes:
decompressing the Makefile program to obtain a plurality of files of the compiled code tool.
Optionally, after the modeling software is used to build the FMU pre-package model, the method further includes:
acquiring an operation curve of the FMU pre-encapsulation model;
After compiling the Windows-based FMU model with the compiling code tool to generate a Linux-based FMU model, the method further includes:
Importing the Linux-based FMU model into a simulation engine, wherein the simulation engine comprises an upper computer local Windows simulation engine and a lower computer Linux real-time simulation engine;
Acquiring a first simulation result, wherein the first simulation result is a simulation result of a local Windows simulation engine of the upper computer;
Obtaining a second simulation result, wherein the second simulation result is a simulation result of the lower computer Linux real-time simulation engine;
Comparing the first simulation result, the second simulation result and the running curve of the FMU pre-encapsulation model to verify the simulation capability of the FMU model based on Linux.
In a second aspect, an embodiment of the present application provides a Linux-based FMU model generating apparatus, including:
The model creation module is used for creating an FMU pre-encapsulation model based on modeling software;
the packaging module is used for packaging and generating a Windows-based FMU model by utilizing the FMU pre-packaging model;
And the compiling module is used for compiling the FMU model based on Windows by utilizing a compiling code tool to generate the FMU model based on Linux.
Optionally, the compiling module includes:
the first decompression unit is used for decompressing the FMU model based on Windows to obtain a file set, wherein the file set comprises sources folders;
a first copying unit configured to copy a plurality of files of the compiled code tool to the sources folder, the plurality of files of the compiled code tool including an operation file;
The operation module is used for operating the operation files in the sources folder according to the identity of the administrator;
and the second copying unit is used for copying a result file set to the Windows-based FMU model to generate a Linux-based FMU model, wherein the result file set is a plurality of files of a compiling code tool except the running file in the sources folder.
In a third aspect, an embodiment of the present application provides an apparatus, where the apparatus includes a memory and a processor, where the memory is configured to store instructions or codes, and the processor is configured to execute the instructions or codes, so that the apparatus performs the Linux-based FMU model generating method according to any one of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer storage medium, where code is stored, and when the code is executed, a device that executes the code implements the Linux-based FMU model generating method of any one of the first aspect.
The embodiment of the application provides a method and a device for generating an FMU model based on Linux, which are characterized in that when the method is executed, an FMU pre-packaging model is built based on modeling software, the FMU pre-packaging model is used for packaging to generate an FMU model based on Windows, and finally, a compiling code tool is used for compiling the FMU model based on Windows to generate the FMU model based on Linux. Therefore, the FMU model based on Windows is compiled and modified through the compiling code tool, so that the FMU model based on Windows is adaptive to a real-time simulator, has real-time simulation capability and is consistent with the simulation result of the original environment modeling software, the problem that the existing model cannot be correctly operated in the real-time simulator based on GCAir simulation engines is solved, and meanwhile, the FMU model based on Windows non-real-time simulation function is achieved.
Drawings
In order to more clearly illustrate this embodiment or the technical solutions of the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that some embodiments in the following description may be obtained from these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram of a configuration of IP addresses of a lower computer simulation engine according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for generating a Linux-based FMU model according to an embodiment of the present application;
FIG. 3 is a directory structure diagram of an FMU model according to an embodiment of the present application;
FIG. 4 is a flowchart of another method of generating a Linux-based FMU model according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a result output interface according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a fixed-step solver setup provided by an embodiment of the present application;
FIG. 7 is a graph illustrating operation of an FMU pre-package model according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a save type according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a path of a derived model according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a Windows-based FMU model according to an embodiment of the present application;
FIG. 11 is a diagram of a plurality of files of a compiled code tool according to an embodiment of the present application;
FIG. 12 is a schematic diagram of a decompressed Windows-based FMU model according to an embodiment of the present application;
FIG. 13 is a schematic diagram of a replicated file according to an embodiment of the present application;
FIG. 14 is a schematic diagram illustrating operation provided by an embodiment of the present application;
FIG. 15 is a schematic diagram of judging success of operation according to an embodiment of the present application;
FIG. 16 is a schematic diagram of replication provided by an embodiment of the present application;
FIG. 17 is a schematic diagram of an embodiment of the present application;
FIG. 18 is a schematic diagram of an engine configuration according to an embodiment of the present application;
FIG. 19 is a schematic diagram of a first simulation result provided by an embodiment of the present application;
FIG. 20 is a schematic view of yet another engine configuration provided in an embodiment of the present application;
FIG. 21 is a schematic diagram of a second simulation result provided by an embodiment of the present application;
fig. 22 is a schematic structural diagram of a Linux-based FMU model generating apparatus according to an embodiment of the present application.
Detailed Description
FMI (Functional Mock-up Interface) is an open, third party standard Interface protocol independent of modeling software, enabling models to be packaged as FMUs (Functional Mock-up units) according to the FMI protocol. And through an FMI interface, the method and the system realize joint simulation with other heterogeneous software supporting FMI.
The simulation engine (SimulationEngine) of GCAir simulation test integrated software developed by Beijing Shiguan Jinyang technology development limited is an entity which actually runs a simulation model, receives a command of an upper computer GCAir through a TCP to perform simulation calculation, and feeds simulation result data back to GCAir in real time.
When the real-time simulation calculation is performed, the simulation engine IP address of the lower computer (real-time simulator) can be configured in the simulation tool of the upper computer GCAir to perform real-time simulation. Referring to fig. 1, fig. 1 is a configuration diagram of an IP address of a lower computer simulation engine according to an embodiment of the present application. In this way, the Linux real-time simulation engine can inherit all functions of the Windows version simulation engine, for example, the existing GCAir simulation model can be transited from the Windows version simulation engine to the real-time simulation engine.
When the FMU is automatically recompiled, the real-time simulation engine automatically tries to compile a corresponding Linux version dynamic library, and packages a new FMU to replace the old FMU. If the FMU file does not contain an available Linux version dynamic library, the real-time simulation engine searches the Makefile under the source code path of the FMU, if the Makefile does not exist, the configuration script is continuously searched, and if the Makefile does not exist, the FMU cannot be compiled. Therefore, GCAir real-time simulation has certain requirements on the model, namely, the FMU file operated by the GCAir real-time simulator needs to meet at least one of (1) a 64-bit Linux version dynamic library(s) containing the model, and (2) a source code containing the model and a corresponding Makefile or configuration script, and can be compiled correctly under a Linux system.
The method provided by the embodiment of the application is executed by computer equipment and is used for solving the problem that the existing model cannot be correctly operated in the real-time simulation machine based on GCAir simulation engine.
It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Referring to fig. 2, fig. 2 is a flowchart of a method for generating a Linux-based FMU model according to an embodiment of the present application, including:
Step S201, based on modeling software, establishing an FMU pre-packaging model.
Currently, modeling software common in the engineering field includes Simulink, simulationX, AMESim, dymola, C/C++, fortran, and the like. All the modeling software can convert the FMU file, but the derived FMU model does not have the capability of directly operating the real-time simulator at GCAir. Thus, one of the above modeling software can be utilized first to prepare the environment and build a preliminary FMU pre-package model.
And S202, encapsulating and generating a Windows-based FMU model by utilizing the FMU pre-encapsulation model.
And packaging the FMU pre-packaging model on the basis of the modeling software, and packaging to generate a Windows-based FMU model.
The FMU model based on Windows can be essentially regarded as a compressed package, the suffix name of which is changed, and the directory structure conforming to the FMU model can be operated correctly. Referring to fig. 3, fig. 3 is a directory structure diagram of an FMU model according to an embodiment of the present application. In the figure, FMU model Simcap includes sources (including simcap. C, fmuTemplate. H), documents (including index. Html, including plot_h. PNG), binaries (including win64, win64 including simcap. Dll), model description. Xml, and model. Png.
When the above file is provided, folder simcap is compressed to simcap.zip (only the. Zip compression algorithm) using a compression tool (e.g., 7 zip), then the. Zip is modified to. FMU, and the FMU is ready to be used after simcap.
It should be noted that the names of the directory folders are all necessary and the names are not changed as much as possible, win64 represents a computer for 64 bits, dll files are necessary, source files under the source folders may not be provided if the codes are required to be kept secret, model. Png is a display icon of the FMU and model description. Xml is necessary for providing basic information of the FMU.
And S203, compiling the FMU model based on Windows by utilizing a compiling code tool to generate the FMU model based on Linux.
The compiling code tool can perform 'makefile' compiling operation on the FMU model based on Windows, so that a compiled result is a Linux version FMU model supporting GCAir real-time simulator running. Preferably, the compiled code tool may be a compiled code tool makefile_gen.exe developed by beijing, singer science and technology development limited.
In summary, according to the embodiment, the FMU model based on Windows is compiled and modified by the compiling code tool, so that the FMU model is a Linux-based FMU model which can be adapted to a real-time simulator, has real-time simulation capability and is consistent with the simulation result of the original environment modeling software, the problem that the existing model cannot be correctly operated in the real-time simulator based on GCAir simulation engines is solved, and meanwhile, the FMU model has a Windows non-real-time simulation function.
In the embodiment of the present application, there are a plurality of possible implementations of the steps described in fig. 2, and the following descriptions are provided separately. It should be noted that the implementations presented in the following description are only exemplary and not representative of all implementations of the embodiments of the present application.
Referring to fig. 4, the flowchart of another method of the Linux-based FMU model generating method according to the embodiment of the present application includes:
And step S401, establishing an FMU pre-packaging model based on modeling software.
Specifically, a result output interface and a fixed-step length solver can be set first, and then an FMU pre-packaging model is established by utilizing the result output interface and the fixed-step length solver based on modeling software.
Taking modeling software as Simulink as an example, a process of setting a result output interface and a fixed-step-length solver is introduced. Fig. 5 is a schematic diagram of a result output interface provided in an embodiment of the present application. Through the Simulink definition result output interface, a basis can be provided for checking whether the simulation result of the packaged FMU model in GCAir simulation test integrated environment is consistent with the result of the original modeling software simulation environment, the process of setting the fixed-step solver is shown in FIG. 6, and FIG. 6 is a schematic diagram of setting the fixed-step solver provided by the embodiment of the application. Simulink solvers can be divided into two main categories, variable-step solvers and fixed-step solvers. In view of the simulation requirements, a fixed-step solver must be used in generating the real-time operation code, and thus the solver needs to be set as a fixed-step solver.
As a possible implementation mode, after the FMU pre-packaging model is established based on modeling software, an operation curve of the FMU pre-packaging model is acquired, so that whether the model can normally operate or not can be confirmed on the one hand, and contrast data can be provided for testing and checking after subsequent packaging on the other hand. Referring to fig. 7, fig. 7 is a graph illustrating operation of the FMU pre-package model according to an embodiment of the present application.
And step S402, packaging and generating a Windows-based FMU model by utilizing the FMU pre-packaging model.
Referring to fig. 8, fig. 8 is a schematic diagram of a save type according to an embodiment of the present application. The save types of the encapsulated Windows-based FMU model include Web view, protected model. Thus, the save type can be selectively set as an independent FMU.
Referring to fig. 9, fig. 9 is a schematic path diagram of a derived model according to an embodiment of the present application. The path for deriving the model may be set as needed, and is not limited herein. As a possible implementation, only "Save source code to FMU" may be checked in the export dialog, and the source code is reserved, so that the Windows-based FMU model created by encapsulation is the FMU model that retains the source code, depending on the save type and the path of the export model.
The generated FMU model based on Windows may refer to fig. 10, and fig. 10 is a schematic diagram of the FMU model based on Windows provided in the embodiment of the present application.
And S403, decompressing the Makefile program to obtain a plurality of files of the compiled code tool.
The Makefile program is a compiled code tool program developed by beijing world guan yang technology development limited company, and the Makefile program is decompressed to obtain a plurality of files of the compiled code tool, wherein the plurality of files of the compiled code tool comprise an operation file makefile_gen.exe, and further comprise fmi2functions.h, fmi2functions types.h, fmi2types platform.h, makefile and a using method txt file, and fig. 11 is a schematic diagram of a plurality of files of the compiled code tool provided by the embodiment of the application.
Step S404, decompressing the FMU model based on Windows to obtain a file set.
As a possible implementation, decompressing the Windows-based FMU model may use a compression tool 7zip. Referring to fig. 12, fig. 12 is a schematic diagram of a decompressed FMU model based on Windows according to an embodiment of the present application. Decompressing the obtained file set, including source folders.
And step S405, copying a plurality of files of the compiled code tool to the sources folder.
Referring to fig. 13, fig. 13 is a schematic diagram of a copy file according to an embodiment of the present application. After the files are copied to the source folders, the files in the source folders can be utilized to change the files of the compiling code tool by operating the operation files, so that the modification of the FMU model is realized.
Step S406, running the running files in the source folders with the identity of the administrator.
Referring to fig. 14, fig. 14 is a schematic operation diagram provided in an embodiment of the present application. And running the running file with the identity of the manager, changing a plurality of files of the compiled code tool, and realizing the reconstruction of the FMU model. After the operation is successful, a subsequent step may be performed, and whether the operation is successful or not may be determined through a makefile file, referring to fig. 15, and fig. 15 is a schematic diagram for determining the operation success according to the embodiment of the present application. And judging whether the operation is successful or not according to the content selected by the black frame.
And S407, copying the result file set to the FMU model based on Windows to generate the FMU model based on Linux.
The result file set is a plurality of files of the compiled code tool except the running file in the sources folder. And copying the result file set to the Windows-based FMU model, namely copying fmi2functions, fmi2functions types, fmi2types platform, and Makefile into a compressed package of the original FMU model. Referring to fig. 16, fig. 16 is a schematic diagram illustrating replication provided in an embodiment of the present application. Therefore, the FMU of the two versions is combined, so that the FMU has the Linux real-time and Windows non-real-time simulation functions at the same time, and the two simulation results are kept consistent.
Step S408, verifying the simulation capability of the FMU model based on Linux.
The method comprises the steps of firstly importing the Linux-based FMU model into a simulation engine, wherein the simulation engine comprises an upper computer local Windows simulation engine and a lower computer Linux real-time simulation engine, then obtaining a first simulation result which is the simulation result of the upper computer local Windows simulation engine, then obtaining a second simulation result which is the simulation result of the lower computer Linux real-time simulation engine, and finally comparing the first simulation result, the second simulation result and the running curve of the FMU pre-encapsulation model to verify the simulation capability of the Linux-based FMU model. If the three are the same, the simulation capability of the FMU model based on Linux is proved to meet the preset requirement.
As a possible implementation manner, the simulation engine may be GCAir simulation engines, the Linux-based FMU model may be first imported GCAir, see fig. 17, fig. 17 is a schematic importing diagram provided by an embodiment of the present application, then a local Windows simulation engine is set to obtain a first simulation result, see fig. 18 and 19, fig. 18 is a schematic engine setting diagram provided by an embodiment of the present application, fig. 19 is a schematic first simulation result provided by an embodiment of the present application, then a lower computer Linux real-time simulation engine is changed to obtain a second simulation result, see fig. 20 and 21, fig. 20 is a schematic engine setting diagram provided by an embodiment of the present application, fig. 21 is a schematic second simulation result provided by an embodiment of the present application, and finally, the first simulation result, the second simulation result and an operation curve of the FMU pre-package model are compared to verify the simulation capability of the Linux-based FMU model.
In summary, according to the embodiment, the FMU model based on Windows is compiled by expanding the compiling code tool, so that the FMU model based on Windows is modified, the FMU model based on Linux which is adaptive to a real-time simulator and has real-time simulation capability and consistent with the simulation result of the original environment modeling software is provided as a floor-type implementation scheme, the problem that the existing model cannot be correctly operated in the real-time simulator based on GCAir simulation engines is solved, the FMU model based on Windows is provided with a non-real-time simulation function, and the simulation capability of the FMU model after modification is verified by comparing the obtained simulation result with the simulation result before modification, so that the accuracy of the method is improved.
The embodiments of the present application provide some specific implementation manners of the Linux-based FMU model generating method, and based on this, the present application also provides a corresponding device. The apparatus provided by the embodiment of the present application will be described in terms of functional modularization.
Referring to fig. 22, a schematic structural diagram of a Linux-based FMU model generating apparatus includes a model creation module 2201, an encapsulation module 2202, and a compiling module 2203.
The model creation module 2201 is configured to create an FMU pre-encapsulation model based on modeling software;
The packaging module 2202 is configured to generate a Windows-based FMU model by using the FMU pre-packaging model;
the compiling module 2203 is configured to compile the FMU model based on Windows by using a compiling code tool, and generate the FMU model based on Linux.
As a possible implementation manner, the model creation module 2201 includes:
The first setting unit is used for setting a result output interface and a fixed-step length solver;
And the model creation unit is used for establishing an FMU pre-encapsulation model by utilizing the result output interface and the fixed-step length solver based on the modeling software.
As one possible implementation, the packaging module 2202 includes:
a second setting unit configured to set a save type and a path from which the model is derived;
and the packaging unit is used for packaging and creating the Windows-based FMU model according to the storage type and the path of the derived model, wherein the Windows-based FMU model is an FMU model for retaining source codes.
As a possible implementation manner, the compiling module 2203 includes:
the first decompression unit is used for decompressing the FMU model based on Windows to obtain a file set, wherein the file set comprises sources folders;
a first copying unit configured to copy a plurality of files of the compiled code tool to the sources folder, the plurality of files of the compiled code tool including an operation file;
The operation module is used for operating the operation files in the sources folder according to the identity of the administrator;
and the second copying unit is used for copying a result file set to the Windows-based FMU model to generate a Linux-based FMU model, wherein the result file set is a plurality of files of a compiling code tool except the running file in the sources folder.
As a possible implementation manner, the device further comprises:
and the second decompression unit is used for decompressing the Makefile program to obtain a plurality of files of the compiled code tool.
As a possible implementation manner, the device further comprises:
The curve acquisition module is used for acquiring an operation curve of the FMU pre-encapsulation model;
The model importing module is used for importing the Linux-based FMU model into a simulation engine, wherein the simulation engine comprises an upper computer local Windows simulation engine and a lower computer Linux real-time simulation engine;
the first simulation module is used for obtaining a first simulation result, wherein the first simulation result is a simulation result of the local Windows simulation engine of the upper computer;
The second simulation module is used for obtaining a second simulation result, wherein the second simulation result is a simulation result of the lower computer Linux real-time simulation engine;
and the comparison module is used for comparing the first simulation result, the second simulation result and the running curve of the FMU pre-encapsulation model so as to verify the simulation capability of the FMU model based on Linux.
The embodiment of the application also provides corresponding equipment and a computer storage medium, which are used for realizing the scheme provided by the embodiment of the application.
The device comprises a memory and a processor, wherein the memory is used for storing instructions or codes, and the processor is used for executing the instructions or codes to enable the device to execute the Linux-based FMU model generating method according to any embodiment of the application.
The computer storage medium stores codes, and when the codes are executed, equipment for executing the codes realizes the Linux-based FMU model generating method according to any embodiment of the application.
The "first" and "second" in the names of "first", "second" (where present) and the like in the embodiments of the present application are used for name identification only, and do not represent the first and second in sequence.
From the above description of embodiments, it will be apparent to those skilled in the art that all or part of the steps of the above described example methods may be implemented in software plus general hardware platforms. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, which may be stored in a storage medium, such as a read-only memory (ROM)/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network communication device such as a router) to perform the method according to the embodiments or some parts of the embodiments of the present application.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing description of the exemplary embodiments of the application is merely illustrative of the application and is not intended to limit the scope of the application.

Claims (7)

1.一种基于Linux的FMU模型生成方法,其特征在于,所述方法包括:1. A method for generating a FMU model based on Linux, characterized in that the method comprises: 基于建模软件,建立FMU预封装模型;Establish FMU pre-packaged model based on modeling software; 利用所述FMU预封装模型,封装生成基于Windows的FMU模型;Using the FMU pre-packaged model, encapsulating and generating a Windows-based FMU model; 解压Makefile程序,得到编译代码工具的多个文件;Unzip the Makefile program to get multiple files of the compilation code tool; 利用编译代码工具,编译所述基于Windows的FMU模型,生成基于Linux的FMU模型;具体包括:解压所述基于Windows的FMU模型,得到文件集合,所述文件集合包括sources文件夹;将所述编译代码工具的多个文件复制至所述sources文件夹,所述编译代码工具的多个文件包括运行文件;以管理员身份运行所述sources文件夹中的运行文件;将结果文件集合复制至所述基于Windows的FMU模型,生成基于Linux的FMU模型,所述结果文件集合为所述sources文件夹中,除所述运行文件以外的编译代码工具的多个文件。Compile the Windows-based FMU model by using a compiling code tool to generate a Linux-based FMU model; specifically include: decompress the Windows-based FMU model to obtain a file set, the file set includes a sources folder; copy multiple files of the compiling code tool to the sources folder, the multiple files of the compiling code tool include a running file; run the running file in the sources folder as an administrator; copy the result file set to the Windows-based FMU model to generate a Linux-based FMU model, the result file set is multiple files of the compiling code tool in the sources folder except the running file. 2.根据权利要求1所述的方法,其特征在于,所述基于建模软件,建立FMU预封装模型,包括:2. The method according to claim 1, characterized in that the establishing of the FMU pre-packaged model based on the modeling software comprises: 设置结果输出接口和定步长求解器;Set up the result output interface and fixed-step solver; 基于所述建模软件,利用所述结果输出接口和定步长求解器,建立FMU预封装模型。Based on the modeling software, the FMU pre-packaged model is established by utilizing the result output interface and the fixed-step solver. 3.根据权利要求1所述的方法,其特征在于,所述利用所述FMU预封装模型,封装生成基于Windows的FMU模型,包括:3. The method according to claim 1, characterized in that the using the FMU pre-packaged model to encapsulate and generate a Windows-based FMU model comprises: 设置保存类型和导出模型的路径;Set the save type and path for exporting the model; 依据所述保存类型和导出模型的路径,封装创建所述基于Windows的FMU模型,所述基于Windows的FMU模型为保留源代码的FMU模型。According to the saving type and the path of the exported model, the Windows-based FMU model is encapsulated and created, and the Windows-based FMU model is an FMU model with source code retained. 4.根据权利要求1所述的方法,其特征在于,在所述基于建模软件,建立FMU预封装模型之后,所述方法还包括:4. The method according to claim 1, characterized in that after establishing the FMU pre-packaged model based on the modeling software, the method further comprises: 获取所述FMU预封装模型的运行曲线;Obtaining an operating curve of the FMU pre-packaged model; 在所述利用编译代码工具,编译所述基于Windows的FMU模型,生成基于Linux的FMU模型之后,所述方法还包括:After using the compiling code tool to compile the Windows-based FMU model to generate the Linux-based FMU model, the method further includes: 将所述基于Linux的FMU模型导入仿真引擎,所述仿真引擎包括上位机本地Windows仿真引擎和下位机Linux实时仿真引擎;Importing the Linux-based FMU model into a simulation engine, wherein the simulation engine includes a local Windows simulation engine of a host computer and a Linux real-time simulation engine of a slave computer; 获取第一仿真结果,所述第一仿真结果为所述上位机本地Windows仿真引擎的仿真结果;Obtaining a first simulation result, where the first simulation result is a simulation result of a local Windows simulation engine of the host computer; 获取第二仿真结果,所述第二仿真结果为所述下位机Linux实时仿真引擎的仿真结果;Obtaining a second simulation result, where the second simulation result is a simulation result of the Linux real-time simulation engine of the lower computer; 比对所述第一仿真结果、所述二仿真结果和所述FMU预封装模型的运行曲线,以验证所述基于Linux的FMU模型的仿真能力。The first simulation result, the second simulation result and the operation curve of the FMU pre-packaged model are compared to verify the simulation capability of the Linux-based FMU model. 5.一种基于Linux的FMU模型生成装置,其特征在于,所述装置包括:5. A Linux-based FMU model generation device, characterized in that the device comprises: 模型创建模块,用于基于建模软件,建立FMU预封装模型;Model creation module, used to build FMU pre-packaged models based on modeling software; 封装模块,用于利用所述FMU预封装模型,封装生成基于Windows的FMU模型;A packaging module, used for packaging and generating a Windows-based FMU model using the FMU pre-packaged model; 第二解压单元,用于解压Makefile程序,得到编译代码工具的多个文件;The second decompression unit is used to decompress the Makefile program to obtain multiple files of the compilation code tool; 编译模块,用于利用编译代码工具,编译所述基于Windows的FMU模型,生成基于Linux的FMU模型;A compiling module, used for compiling the Windows-based FMU model using a compiling code tool to generate a Linux-based FMU model; 所述编译模块,包括:The compilation module comprises: 第一解压单元,用于解压所述基于Windows的FMU模型,得到文件集合,所述文件集合包括sources文件夹;A first decompression unit, used for decompressing the Windows-based FMU model to obtain a file set, wherein the file set includes a sources folder; 第一复制单元,用于将所述编译代码工具的多个文件复制至所述sources文件夹,所述编译代码工具的多个文件包括运行文件;A first copying unit, used to copy a plurality of files of the code compiling tool to the sources folder, wherein the plurality of files of the code compiling tool include a running file; 运行模块,用于以管理员身份运行所述sources文件夹中的运行文件;A run module, used to run the run file in the sources folder as an administrator; 第二复制单元,用于将结果文件集合复制至所述基于Windows的FMU模型,生成基于Linux的FMU模型,所述结果文件集合为所述sources文件夹中,除所述运行文件以外的编译代码工具的多个文件。The second copying unit is used to copy the result file set to the Windows-based FMU model to generate a Linux-based FMU model, wherein the result file set is a plurality of files of the compiling code tool in the sources folder except the running file. 6.一种设备,其特征在于,所述设备包括存储器和处理器,所述存储器用于存储指令或代码,所述处理器用于执行所述指令或代码,以使所述设备执行权利要求1至4任一项所述的基于Linux的FMU模型生成方法。6. A device, characterized in that the device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes, so that the device executes the Linux-based FMU model generation method described in any one of claims 1 to 4. 7.一种计算机存储介质,其特征在于,所述计算机存储介质中存储有代码,当所述代码被运行时,运行所述代码的计算机存储设备实现权利要求1至4任一项所述的基于Linux的FMU模型生成方法。7. A computer storage medium, characterized in that a code is stored in the computer storage medium, and when the code is executed, the computer storage device executing the code implements the Linux-based FMU model generation method according to any one of claims 1 to 4.
CN202211730209.4A 2022-12-30 2022-12-30 Linux-based FMU model generation method and device Active CN116050112B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211730209.4A CN116050112B (en) 2022-12-30 2022-12-30 Linux-based FMU model generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211730209.4A CN116050112B (en) 2022-12-30 2022-12-30 Linux-based FMU model generation method and device

Publications (2)

Publication Number Publication Date
CN116050112A CN116050112A (en) 2023-05-02
CN116050112B true CN116050112B (en) 2025-05-30

Family

ID=86121217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211730209.4A Active CN116050112B (en) 2022-12-30 2022-12-30 Linux-based FMU model generation method and device

Country Status (1)

Country Link
CN (1) CN116050112B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119356118A (en) * 2024-09-29 2025-01-24 中国科学院理化技术研究所 A semi-hardware dynamic simulation method and simulation platform for a turbine expander unit
CN119310876A (en) * 2024-09-29 2025-01-14 中国科学院理化技术研究所 A semi-hardware dynamic simulation method and simulation platform for a cold compression unit

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367511A (en) * 2020-03-02 2020-07-03 北京中科宇航技术有限公司 Simulation model interface adaptation development system and working method thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102019003851A1 (en) * 2018-06-01 2019-12-05 The Mathworks, Inc. Systems and methods for the automatic realization of models for co-simulation
CN109948213A (en) * 2019-03-11 2019-06-28 北京世冠金洋科技发展有限公司 A kind of synergy emulation method and device based on FMI standard
CN112667242B (en) * 2020-12-28 2023-08-22 北京世冠金洋科技发展有限公司 Method and device for encapsulating C codes into FMU
CN113791793B (en) * 2021-09-09 2024-11-19 中国汽车技术研究中心有限公司 Multi-source heterogeneous model joint simulation method, device, equipment and medium based on FMI
CN114721666A (en) * 2022-04-20 2022-07-08 北京世冠金洋科技发展有限公司 Code packaging method and device
CN115421940A (en) * 2022-09-02 2022-12-02 西安中锐创联科技有限公司 Multi-source heterogeneous model white box integration method based on shared memory technology

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367511A (en) * 2020-03-02 2020-07-03 北京中科宇航技术有限公司 Simulation model interface adaptation development system and working method thereof

Also Published As

Publication number Publication date
CN116050112A (en) 2023-05-02

Similar Documents

Publication Publication Date Title
CN116050112B (en) Linux-based FMU model generation method and device
CN110008113B (en) Test method and device and electronic equipment
CN113238850B (en) RPA realization method, device, equipment and medium based on browser
CN111985055B (en) Model packaging method and device and electronic equipment
CN105574000B (en) Method and device for expanding APK file application
US10725893B2 (en) System and method for determination of code coverage for software applications in a network environment
CN113297073A (en) Verification method, device and equipment of algorithm module in chip and readable storage medium
CN114428728B (en) Information-physical test protocol processing system and method
CN106897107A (en) A kind of web teledatas calculating realizes system and method with emulation
CN108829400B (en) A kind of channel packaging method that iOS need not be compiled repeatedly
CN108563572A (en) A kind of regression testing method, device and server
US20070150249A1 (en) Verification Operation Supporting System and Method of the Same
CN113590465A (en) Method for automatically generating mock service based on SDK
CN112615759A (en) Full link voltage measurement assembly, full link voltage measurement method and device
CN107844410A (en) The adjustment method and device of a kind of distributed cluster system
CN107357588B (en) Object code generation method and device
CN115809076A (en) ECU software automation integration method and system
CN115202630A (en) Scaffold construction method based on web front-end engineering
CN114968198A (en) A website development method, system and storage medium thereof
CN113741954A (en) System software generation method and device, electronic equipment and storage medium
CN111367512A (en) Method and device for creating Android library module dependency relationship in application development
CN115617386A (en) Method, device, equipment and storage medium for constructing firmware in storage equipment
Setyautami et al. Modeling multi software product lines using UML
CN117290233A (en) Method, system and equipment for custom generation of identification card number based on JMeter
CN113821222A (en) A kind of method and device for generating original OTA package

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