Method and system for testing running efficiency of Mworks model in Linux environment
By compiling the Mworks model into a .fmu file and combining it with the comparative software model, the operating efficiency parameters are calculated using the clock difference value, and the lack of running efficiency test of the Mworks model in the Linux environment is solved, and efficient cross-platform simulation and multi-core parallelism are achieved. simulation.
Patent Information
- Application Number
- CN202411454518.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art lacks effective methods to test the operation efficiency of the Mworks model in the Linux environment.
By compiling the Mworks model into a .fmu file, and loading the .out file of the comparative software model into a Linux simulation target machine, setting the running parameters, and using the clock difference to calculate the running efficiency parameters, including the maximum single-step running time and the minimum Single step run time and average single step run time.
It realizes intuitive calculation and output of the operation efficiency of the Mworks model in the Linux environment, provides cross-platform call and multi-core parallel simulation technology, and improves the comparability of the simulation operation efficiency.
Smart Images

Figure CN119473835A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and a system for testing the running efficiency of an Mworks model in a Linux environment, and belongs to the technical field of modeling simulation testing. Background Art
[0002] As the demand and complexity of industrial products increase, the requirements for industrial software are also gradually increasing. In the field of simulation modeling technology, the rational use of modeling simulation software can improve the efficiency and correctness of product solution design.
[0003] There is currently no good way to evaluate the operating efficiency of Mworks models, especially in the Linux environment, and how it compares with other modeling software. Summary of the invention
[0004] The technical problem solved by the present invention is: to overcome the deficiencies of the prior art, to provide a method and system for testing the operating efficiency of an Mworks model in a Linux environment, and to solve the problem of testing the operating efficiency of an Mworks model in a Linux environment.
[0005] The technical solution of the present invention is: in the first aspect, a method for testing the running efficiency of an Mworks model in a Linux environment comprises:
[0006] Compile the Mworks model to be tested into a .fmu file;
[0007] Compile the comparison software model of the Mworks model to be tested into a .out file;
[0008] Load the compiled .fmu file and .out file into the Linux simulation target machine, set the running parameters and run;
[0009] After the operation is completed, the test results are output, and the test results include Linux environment operation efficiency parameters.
[0010] Furthermore, the Linux environment operation efficiency parameters include a maximum single-step operation time, a minimum single-step operation time, and an average single-step operation time.
[0011] Furthermore, the test method calculates the operation efficiency parameter by obtaining the clock before and after the single-step operation and taking the difference.
[0012] Furthermore, the Windows version of the Mworks model is recompiled into a .fmu file that supports running in a Linux environment.
[0013] In the second aspect, a system for testing the running efficiency of an Mworks model in a Linux environment includes:
[0014] The host computer compiles the Mworks model to be tested into a .fmu file, and compiles the comparison software model of the Mworks model to be tested into a .out file;
[0015] The Linux simulation target machine loads the compiled .fmu file and .out file, and runs after setting the running parameters; after the running is completed, the test results are output, and the test results include the Linux environment running efficiency parameters.
[0016] Furthermore, the Linux environment operation efficiency parameters include a maximum single-step operation time, a minimum single-step operation time, and an average single-step operation time.
[0017] Furthermore, the operating parameters include an operating step, an operating time, and an operating CPU core number.
[0018] Furthermore, the running time of the Mworks model and the comparison software model are given at the same time.
[0019] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a method for testing the running efficiency of an Mworks model in a Linux environment are implemented.
[0020] A device for testing the operating efficiency of an Mworks model in a Linux environment comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of a method for testing the operating efficiency of an Mworks model in a Linux environment are implemented.
[0021] The advantages of the present invention compared with the prior art are:
[0022] (1) The present invention realizes cross-platform calling of the Mworks model by recompiling the Mworks model into a .fmu file that can be run in the Linux environment;
[0023] (2) The present invention realizes intuitive calculation and output of the Linux environment operating efficiency parameters of the Mworks model by obtaining the clock difference method;
[0024] (3) The present invention uses multi-core parallel simulation technology to realize the simultaneous operation of the Mworks model and the comparison software model and simultaneously provide the operation efficiency parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0026] Figure 1 A flowchart of a method for testing the operating efficiency of an Mworks model in a Linux environment provided by an embodiment of the present invention;
[0027] Figure 2 The output results of the running efficiency of the Mworks model and the comparison software model in the Linux environment provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to better understand the above technical scheme, the technical scheme of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical scheme of the present invention, rather than limitations on the technical scheme of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0029] The following is a further detailed description of a method and system for testing the operating efficiency of an Mworks model in a Linux environment provided by an embodiment of the present invention in conjunction with the accompanying drawings of the specification. The specific implementation method may include:
[0030] In the first aspect, a system for testing the running efficiency of an Mworks model in a Linux environment includes: a Linux simulation target machine and a host computer; using an FMU compilation tool to compile the Mworks model into a .fmu file; using a compilation tool to compile a certain comparison software model into a .out file; loading the compiled .fmu file and .out file into the target machine, setting the running step length, running time, and running CPU core number; after the model runs, outputting the test results, including the maximum single-step running time, the minimum single-step running time, and the average single-step running time;
[0031] Furthermore, the system can run the Mworks model and the comparison software model simultaneously, and give the efficiency test results at the same time for easy comparison.
[0032] On the other hand, a method for testing the operating efficiency of an Mworks model in a Linux environment based on the Mworks model operating efficiency testing system described above comprises the following process:
[0033] Step S1, using the Mworks model compilation tool to compile the Mworks model into a .fmu file.
[0034] Step S2: Compile a certain comparison software model into a .out file using a compilation tool.
[0035] Step S3: Load the compiled .fmu file and .out file into the target machine, and set the running step size, running time and running CPU core number.
[0036] Step S4: After the model runs, the test results are output, including the maximum single-step running time, the minimum single-step running time and the average single-step running time.
[0037] In the solution provided in the embodiment of the present invention, the Mworks model and the comparison software model with the same function are run in the Linux environment to compare their simulation running efficiency.
[0038] like Figure 1 As shown, the operating efficiency test method of the Mworks model and the comparison software model in the Linux environment of this embodiment includes the following process:
[0039] Step S1, compile the Mworks model;
[0040] Specifically, first export the Mworks model to FMU in the Mworks software, and then use the FMU compilation tool Fmumodelbuild to recompile the obtained file to obtain a .fmu file that can be run in the Linux environment;
[0041] Step S2, compile and compare software models;
[0042] Specifically, the compilation tool links_rtlnx_grt is imported into the software, and after the environment configuration, the model is compiled to obtain .out files and xml files that can be run in the Linux environment.
[0043] Step S3, loading the compiled .fmu file and .out file into the target machine, and setting simulation parameters;
[0044] Specifically, import the .fmu file compiled in step S1 and the .out file compiled in step S2 into the upper computer simulation control software RTSimPlus; then set the running step size of the comparison software model to 0.001s, the running time to 10s, and the specified running CPU core number to 1; then set the running step size of the Mworks model to 0.001s, the running time to 10s, and the specified running CPU core number to 2.
[0045] Step S4, obtaining the operation result;
[0046] Specifically, Figure 2 As shown in the figure, after the operation is completed, the simulation target machine simultaneously outputs the operation efficiency information of the Mworks model and the comparison software model, including the maximum step length, the minimum step length, the maximum single-step operation time, the minimum single-step operation time, and the average single-step operation time. The two rows of data correspond to the comparison software model and the Mworks model, respectively, so as to intuitively obtain the operation efficiency information of the Mworks model and the comparison software model in the Linux environment.
[0047] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes Figure 1 The method described.
[0048] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0049] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0050] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0051] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0052] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0053] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A method for testing the operating efficiency of an Mworks model in a Linux environment, characterized in that: include: Compile the Mworks model to be tested into a .fmu file; Compile the comparison software model of the Mworks model to be tested into a .out file; Load the compiled .fmu file and .out file into the Linux simulation target machine, set the running parameters and run; After the operation is completed, the test results are output, and the test results include Linux environment operation efficiency parameters.
2. According to claim 1, a method for testing the operating efficiency of an Mworks model in a Linux environment is characterized in that: The Linux environment operation efficiency parameters include a maximum single-step operation time, a minimum single-step operation time, and an average single-step operation time.
3. The method for testing the operating efficiency of an Mworks model in a Linux environment according to claim 1, characterized in that: The test method uses a method of obtaining clocks before and after single-step operation and taking the difference to calculate the operation efficiency parameter.
4. The method for testing the operating efficiency of an Mworks model in a Linux environment according to claim 1, characterized in that: Recompile the Windows version of the Mworks model into a .fmu file that supports running in a Linux environment.
5. A system for testing the running efficiency of an Mworks model in a Linux environment, characterized in that: include: The host computer compiles the Mworks model to be tested into a .fmu file, and compiles the comparison software model of the Mworks model to be tested into a .out file; The Linux simulation target machine loads the compiled .fmu file and .out file, and runs after setting the running parameters; after the running is completed, the test results are output, and the test results include the Linux environment running efficiency parameters.
6. The Mworks model operating efficiency test system in Linux environment according to claim 5, characterized in that: The Linux environment operation efficiency parameters include a maximum single-step operation time, a minimum single-step operation time, and an average single-step operation time.
7. The Mworks model operating efficiency test system in Linux environment according to claim 5, characterized in that: The operation parameters include the operation step size, the operation time and the operation CPU core number.
8. The Mworks model operating efficiency test system in Linux environment according to claim 5, characterized in that: At the same time, the running time of the Mworks model and the comparison software model is given.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A device for testing the running efficiency of an Mworks model in a Linux environment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.