Model import method and device and electronic equipment

By obtaining the module information of the Simulink model, establishing mapping relationships and adjusting the layout, the problems of inaccurate parameter mapping, low automation and poor compatibility when importing Simulink models into other platforms are solved, and accurate reproduction and seamless migration of the model in simulation software are achieved.

CN120688247APending Publication Date: 2025-09-23BEITAI ZHENHUAN (CHONGQING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510794388.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

When importing Simulink models into other platforms, there are problems such as inaccurate parameter mapping, low automation, and poor compatibility. This causes the models to lose accuracy and stability in the new environment, making seamless migration difficult.

Method used

By obtaining the module information of the original model, establishing mapping relationships, adjusting the module layout, and determining the target solver, the model can be accurately reproduced and automatically migrated in the simulation software.

Benefits of technology

It achieves accurate mapping of model parameters, automated migration processes, and seamless cross-platform operation, ensuring the accuracy and consistency of simulation results and improving user convenience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120688247A_ABST
    Figure CN120688247A_ABST
Patent Text Reader

Abstract

The invention discloses a model importing method and device and electronic equipment. The method comprises the following steps: acquiring module information of an original model; a mapping relation between the original model and simulation software is determined according to the module information, a first model is determined according to the mapping relation, and the first model is used for representing an initial model which is functionally equivalent to the original model in the simulation software; the layout of the first model is adjusted according to the module information, a second model is obtained, and the second model is used for replacing the original model to directly run in simulation software. According to the method and the device, the technical problems of inaccurate parameter mapping, low automation degree and poor compatibility when a model is imported into a simulation software platform in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer software technology, and more specifically, to a model importing method, device, and electronic device. Background Art

[0002] Simulink is a widely used software for control system modeling and simulation, providing engineers with a graphical modeling and simulation tool. With the continuous evolution of engineering applications, the interaction between Simulink models and their derivatives has become increasingly important, especially in multidisciplinary collaborative design and cross-platform applications. While related technologies such as Simulink model import provide certain functional support, they still face the following challenges in practical applications:

[0003] First, there's the issue of parameter conversion accuracy. Importing Simulink models into other platforms often results in inaccurate parameter and variable mapping. This can cause the model to lose its original accuracy and stability in the new environment, and even produce simulation results that contradict the original design intent. This issue is particularly pronounced when working with advanced models containing numerous parameters and complex structures.

[0004] Secondly, the level of automation is low. Most conversion tools rely on tedious manual operations, such as parameter matching and model debugging, and lack effective automated processes. This means additional time and workload for engineers, especially when dealing with large or complex models.

[0005] Furthermore, compatibility issues across different platforms also limit the widespread application of Simulink models. Due to differences in data formats and computational frameworks, related technologies often struggle to achieve seamless model migration across various software environments. This issue becomes particularly prominent when maintaining the model's internal structure and logical integrity. Poor compatibility not only limits the versatility of the model but also hinders collaboration and communication within interdisciplinary projects.

[0006] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0007] The embodiments of the present application provide a model importing method, device and electronic device to at least solve the technical problems of inaccurate parameter mapping, low degree of automation and poor compatibility of models in related technologies when they are imported into simulation software platforms.

[0008] According to one aspect of an embodiment of the present application, a model import method is provided, including: obtaining module information of an original model; determining a mapping relationship between the original model and simulation software based on the module information, and determining a first model based on the mapping relationship, wherein the first model is used to represent an initial model that is functionally equivalent to the original model in the simulation software; adjusting the layout of the first model based on the module information to obtain a second model, wherein the second model is used to replace the original model and run directly in the simulation software.

[0009] Optionally, the module information includes at least one of the following: module type, module parameters, module connection relationship and solver information in the original model, wherein the module connection relationship includes the first connection relationship of each module in the original model and the second connection relationship of each module port in the original model.

[0010] Optionally, the method further includes: determining a target solver in the simulation software based on the solver information; and running the second model based on the target solver to obtain an running result.

[0011] Optionally, the layout of the first model is adjusted according to the module information to obtain the second model, including: determining the module position information of the original model; determining the layout rules according to the module position information, the first connection relationship and the second connection relationship, wherein the layout rules are used to guide the layout adjustment of the first model; and adjusting each module in the first model according to the layout rules to obtain the second model.

[0012] Optionally, the target connection relationship of the second model is stored in the data structure of each module, wherein the target connection relationship includes the connection relationship of each module and the connection relationship of each module port in the second model.

[0013] Optionally, the mapping relationship includes module type mapping and parameter mapping between the original model and the simulation software, and the parameter mapping includes parameter name mapping and parameter value mapping between the original model and the simulation software.

[0014] Optionally, determining the first model based on the mapping relationship includes: determining the target module type in the simulation software based on the module type mapping, determining the target module parameter name in the simulation software based on the parameter name mapping, and determining the target module parameter value in the simulation software based on the parameter value mapping; determining the first model based on the target module type, the target module parameter name and the target module parameter value.

[0015] Optionally, the method further includes: obtaining a mapping dictionary corresponding to the parameter name mapping, wherein the mapping dictionary includes English descriptions and Chinese descriptions corresponding to each parameter name; and converting the target module parameter name into a Chinese description based on the mapping dictionary.

[0016] Optionally, the method further includes: receiving an operation instruction of the target object; obtaining adjustment information in the operation instruction, wherein the adjustment information includes at least one of the following: model parameter configuration information, model extension information, and model structure information; and adjusting the second model according to the adjustment information.

[0017] According to another aspect of an embodiment of the present application, a model import device is also provided, including: an acquisition module for acquiring module information of the original model; a determination module for determining a mapping relationship between the original model and the simulation software based on the module information, and determining a first model based on the mapping relationship, wherein the first model is used to represent an initial model that is functionally equivalent to the original model in the simulation software; an adjustment module for adjusting the layout of the first model based on the module information to obtain a second model, wherein the second model is used to replace the original model and run directly in the simulation software.

[0018] According to another aspect of the embodiments of the present application, an electronic device is provided, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned model import method.

[0019] According to another aspect of the embodiments of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned model importing method by running the computer program.

[0020] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the above-mentioned model importing method when executed by a processor.

[0021] In an embodiment of the present application, by obtaining the module information of the original model; determining the mapping relationship between the original model and the simulation software based on the module information, and determining the first model based on the mapping relationship, wherein the first model is used to represent an initial model that is functionally equivalent to the original model in the simulation software; adjusting the layout of the first model based on the module information to obtain a second model, wherein the second model is used to replace the original model and run directly in the simulation software, thereby achieving the purpose of accurately reproducing the original model in different engineering simulation software platforms, thereby achieving the technical effects of accurate mapping of model parameters, automation of migration processes and seamless operation across platforms, and thus solving the technical problems of inaccurate parameter mapping, low degree of automation and poor compatibility of models in related technologies when imported into simulation software platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0023] Figure 1 is a hardware structure diagram of a computer terminal for implementing a model import method according to an embodiment of the present application;

[0024] Figure 2 is a flow chart of a model importing method according to an embodiment of the present application;

[0025] Figure 3 is a structural diagram of an original model according to an embodiment of the present application;

[0026] Figure 4 is a structural diagram of a first model according to an embodiment of the present application;

[0027] Figure 5 is a structural diagram of a second model according to an embodiment of the present application;

[0028] Figure 6 It is a structural diagram of a model importing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] First, some nouns or terms that appear in the process of explaining the embodiments of this application are subject to the following explanations:

[0032] FMU (Functional Mock-up Unit): A standard format for exchanging models between different tools. It adheres to the FMI (Functional Mock-up Interface) standard and aims to facilitate interoperability between multidisciplinary system modeling and simulation tools. With FMU, users can export a model from one simulation tool and load it into another, enabling model sharing and joint simulation.

[0033] Hard-coding: refers to the practice of writing fixed values ​​or specific conditions directly into a program, rather than using variables or configuration files.

[0034] In order to solve the problem of poor model import efficiency in the related art, the embodiment of the present application provides a model import method, which can be run on Figure 1 Among the computer terminals shown, the computer terminal will be described below.

[0035] The model import method embodiment provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG1 shows a hardware structure block diagram of a computer terminal for implementing a model import method. Figure 1 As shown, the computer terminal 10 may include one or more (illustrated by 102a, 102b, ..., 102n in the figure) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0036] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0037] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the model import method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned model import method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0038] The transmission module 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission module 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0039] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0040] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0041] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a model import method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0042] Figure 2 is a flow chart of a model import method according to an embodiment of the present application, such as Figure 2 As shown, the method includes the following steps:

[0043] Step S202: Obtain module information of the original model.

[0044] Step S204 , determining a mapping relationship between the original model and the simulation software based on the module information, and determining a first model based on the mapping relationship, wherein the first model is used to represent an initial model that is functionally equivalent to the original model in the simulation software.

[0045] Step S206: Adjust the layout of the first model according to the module information to obtain a second model, wherein the second model is used to replace the original model and directly run in the simulation software.

[0046] Through the above steps S202 to S206, the purpose of accurately reproducing the original model in different engineering simulation software platforms is achieved, thereby realizing the technical effects of accurate mapping of model parameters, automation of migration process and seamless operation across platforms, thereby solving the technical problems of inaccurate parameter mapping, low degree of automation and poor compatibility of models in related technologies when they are imported into simulation software platforms.

[0047] In the above step S202, the module information of the original model needs to be read first. In this application, the original model takes the Simulink model as an example. Figure 3 Specifically, according to the Simulink model format exported by the user, the model file is decompressed, and the decompressed XML file is parsed using the XML parsing library tinyxml2 to obtain all module information in the Simulink model.

[0048] Optionally, the module information includes at least one of the following: module type, module parameters, module connection relationship and solver information in the original model, wherein the module connection relationship includes the first connection relationship of each module in the original model and the second connection relationship of each module port in the original model.

[0049] In the embodiments of the present application, the term "module type" refers to the type of basic component that constitutes a Simulink model, such as Sine Wave, Subtract, Transfer Fcn, etc. Regarding module parameters, each module has specific parameter settings, such as amplitude, frequency, offset, gain, etc. These parameters determine the module's behavior and the model's dynamic characteristics. Regarding module connection relationships, a Simulink model is composed of multiple modules connected by lines, forming complex control loops and other system structures. Regarding solver information, the simulation behavior of a Simulink model depends largely on the selected solver and its configuration parameters, such as absolute error tolerance, relative error tolerance, step size control, etc. The first connection relationship of each module indicates the direct connection between modules in the Simulink model. For example, the output of module A is the input of module B, which is a direct reflection of the signal flow. The second connection relationship of each module port is detailed to the module port level, indicating the direct connection between module ports in the Simulink model. For example, the first output port of module A is connected to the second input port of module B.

[0050] The following is an example of the slx decompression file structure:

[0051] / Simulink_Model unzip the top-level folder

[0052] / metadata

[0053] / simulink

[0054] / stateflow stores the stateflow information in the model

[0055] machine.xml

[0056] chart_id.xml

[0057] / systems

[0058] system_root.xml

[0059] system_id.xml

[0060] bddefaults.xml

[0061] blockdiagram.xml

[0062] configSet0.xml

[0063] configSetInfo.xml

[0064] graphicalInterface.xml

[0065] hdlParams.xml

[0066] modelDictionary.xml

[0067] ScheduleCore.xml

[0068] ScheduleEditor.xml

[0069] windowsInfo.xml

[0070] Simulink_Model is the top-level folder after decompression, containing the metadata and simulink folders. The simulink folder contains all model information, and contains the stateflow and systems folders. The stateflow folder stores the model's stateflow information, including the machine.xml file and its referenced XML files. You can map the chart ID referenced in the machine file to a specific chart_id.xml file. The systems folder stores information such as the parameters and connections of the model's modules, including the system_root file and its referenced XML files. You can map the referenced ID to a specific system_id.xml file. Other files in the systems folder include bddefaults for module default parameters, blockdiagram for Simulink UI information, configSet0 for the Simulink version and model solver information, configSetInfo for Simulink configuration flags, graphicalInterface for Simulink UI information, modelDictionary for the model's representation ID, ScheduleCore and SceduleEditor for other information, and windowInfo for Simulink window information.

[0071] It should be noted that for nested systems, recursive parsing is used to reference subsystems. Specifically, starting from the main system, all modules under the main system are traversed to obtain the module type, name, and ID. When the module type is detected as a subsystem ("SubSystem"), a subsystem data structure is created, and the system parsing function is recursively called. After completion, the created subsystem data structure is stored in the parent subsystem container. Finally, the connection information of each system is parsed to obtain the starting module ID and port number of the connection, and the ending module ID and port number.

[0072] Table 1 Recursive function pseudo code example

[0073]

[0074] The stateflow parsing process uses a method of traversing the referenced chart file and storing the sub-function results obtained by parsing in an array. The position stored in the array is the corresponding reference ID when parsing the system.

[0075] Examples of sub-functions referenced in the system are as follows:

[0076]

[0077] The ending sequence number of the Tag field is the order of the files referenced in the machine file, that is, 2 in the Stateflow S-Function 2 example above.

[0078] Table 2 Pseudo-code example of parsing machine file

[0079]

[0080] The following is an example of quoting chart file content:

[0081] <? xml version="1.0" encoding="utf-8"? >

[0082] <chart id="7">

[0083] <children>

[0084] <eml>

[0085] <p name="script">function y=fcn(u)

[0086] y=u:

[0087]

[0088] < / eml> < / children>

[0089]

[0090] During parsing, the sub-function content can be obtained by sequentially parsing the script field.

[0091] Finally, it is necessary to parse the solver information of Simulink and obtain the solver parameters to create the corresponding Beitai Zhenyuan solver.

[0092] The solver file structure example in the slx file is as follows:

[0093] <? xml version="1.0" encoding="utf-8"? >

[0094] <configset>

[0095] <object version="23.1.0"classname="simulink.configset">

[0096] <Array PropName="Components"Type="Handle"Dimension="1*10">

[0097] <object objectid="2"version="23.1.0"classname="simulink.solvercc">

[0098] <p name="starttime">0.0

[0099] <p name="stoptime">10.0

[0100] <p name="abstol">0.01

[0101] <p name="fixedstep">0.1

[0102] <p name="initialstep">0.1

[0103] <p name="maxstep">0.1

[0104] <p name="minstep">0.01

[0105] <p name="reltol">1e-3

[0106] <p name="solvername"> ode45

[0107] < / object>

[0108]

[0109] < / object>

[0110] < / configset>

[0111] The parsing of an MDL file is similar to that of an SLX file. The essence of an MDL file is to integrate all the XML files after decompressing the SLX files into one file. The parsing process is to first identify the key fields in the file, such as bddefaults.xml in the following example. Then, the content of the fields is stored in XML as the file structure after decompressing the SLX file. The parsing can then be performed in the same way as the SLX file.

[0112] The mdl file structure example is as follows:

[0113] #MathWorks OPC Text Package

[0114] Model{

[0115] Version 10.7

[0116] Description"Simulink model exported from R2023b to R2023a format"

[0117] }

[0118] __MWOPC_PACKAGE_BEGIN__R2023b

[0119] __MWOPC_PART_BEGIN__ / simulink / bddefaults.xml

[0120] <? xml version="1.0" encoding="utf-8"? >

[0121] <blockdiagramdefaults>

[0122] <MaskDefaults SelfModifiable="off">

[0123] <dialogcontrol>

[0124] < / dialogcontrol>

[0125]

[0126] < / blockdiagramdefaults>

[0127] __MWOPC_PACKAGE_END__

[0128] In the above step S204, once the module information is obtained, a mapping relationship between the Simulink model and the simulation software can be established based on the module information, and an initial model framework (module structure in the simulation software) equivalent to the original model function can be determined based on the mapping relationship, that is, the above first model, such as Figure 4In this application, taking Beitai Zhenyuan simulation software as an example, the method of importing Simulink model into Beitai Zhenyuan simulation software is described.

[0129] Optionally, the mapping relationship includes module type mapping and parameter mapping between the original model and the simulation software, and the parameter mapping includes parameter name mapping and parameter value mapping between the original model and the simulation software.

[0130] In an embodiment of the present application, module type mapping refers to mapping each module type in the Simulink model, such as Sine Wave (sine wave), Subtract (subtractor), Transfer Fcn (transfer function), etc., to the corresponding module type in Beitai Zhenyuan software. This mapping ensures that each functional unit in the original model can find an equivalent implementation on the target platform, which is the basis of model conversion. For example, the Sine Wave module in the Simulink model may be called a Sin module in Beitai Zhenyuan, but they all have the function of generating a sine wave signal.

[0131] Parameter mapping is more detailed and includes two subcategories: parameter name mapping and parameter value mapping. Parameter name mapping involves matching parameter names in the Simulink model with corresponding parameter names in the Beitai Zhenyuan software. Given that different simulation software may have different terminology, even modules with the same functionality may have different parameter names. For example, a "Bias" parameter in Simulink may be called "Offset" in Beitai Zhenyuan. Parameter name mapping ensures that model parameter settings on the target platform remain consistent with the original model, thereby maintaining the model's original behavior and simulation results. Parameter value mapping involves converting the actual parameter values. Even if the parameter names remain consistent after mapping, due to differences in computational precision or data formats between different software, the actual parameter values ​​must be converted or adjusted to ensure they are correctly interpreted and applied in the target software. For example, if a parameter value in Simulink is 1.0, the mapped parameter value in Beitai Zhenyuan should also be 1.0, and the format, unit, and representation of this value should be consistent with the original model.

[0132] The specific module parameter mapping is shown in Table 1:

[0133] Table 1 Module parameter mapping example

[0134]

[0135] Optionally, determining the first model based on the mapping relationship includes: determining the target module type in the simulation software based on the module type mapping, determining the target module parameter name in the simulation software based on the parameter name mapping, and determining the target module parameter value in the simulation software based on the parameter value mapping; determining the first model based on the target module type, the target module parameter name and the target module parameter value.

[0136] In an embodiment of the present application, first, through module type mapping, the module type in the Beitaizhenyuan software corresponding to each module type in the Simulink model is identified. Then, through parameter name mapping, the parameter name in the Simulink model is matched with the corresponding parameter name in the Beitaizhenyuan software. Finally, the parameter value mapping focuses on the conversion between the actual numerical value of the parameter in the Simulink model and the corresponding parameter value in the Beitaizhenyuan software. Since the numerical format, unit and precision may be different in different software environments, the parameter value mapping must not only keep the numerical value unchanged, but also consider the adaptability of the numerical expression form. Based on the above mapping process, we can determine the type, parameter name and parameter value of the target module in the Beitaizhenyuan software, and then create a first model that is functionally equivalent to the Simulink model.

[0137] The pseudo code example of the module creation process is shown in Table 2:

[0138] Table 2 Module creation code example

[0139]

[0140] Optionally, the above method also includes: obtaining a mapping dictionary corresponding to the parameter name mapping, wherein the mapping dictionary includes English descriptions and Chinese descriptions corresponding to each parameter name; and converting the target module parameter name into a Chinese description based on the mapping dictionary.

[0141] In this embodiment, the concept of a parameter name mapping dictionary is introduced to further enhance the user-friendliness and localization of model conversion. The mapping dictionary contains Simulink parameter names and their corresponding Chinese descriptions. By using this dictionary, parameter names originally described in English can be converted to Chinese during the creation of the first model, ensuring that users can set up and adjust complex system models in the most natural and familiar way.

[0142] The following is an example of a mapping dictionary:

[0143]

[0144] In the above step S206, in order to make the first model not only functionally equivalent in Beitai Zhenyuan but also intuitive in layout and similar to the original Simulink model, it is necessary to adjust the model layout.

[0145] Optionally, the layout of the first model is adjusted according to the module information to obtain the second model, including: determining the module position information of the original model; determining the layout rules according to the module position information, the first connection relationship and the second connection relationship, wherein the layout rules are used to guide the layout adjustment of the first model; and adjusting each module in the first model according to the layout rules to obtain the second model.

[0146] In an embodiment of the present application, the module position information is the screen coordinates of each component in the Simulink model, which defines the relative position of the module on the model canvas, such as four-dimensional data such as "[650,385,680,415]", which represents the coordinates of the lower left corner and the upper right corner of the module, and is the basis of the model layout. Next, a set of layout rules is constructed based on the module position information of the original model, the first connection relationship (direct connection between modules) and the second connection relationship (connection at the port level). According to the formulated layout rules, the layout of the first model created in the Beitai Zhenyuan software is adjusted, such as repositioning the modules, redrawing the connections, and reconnecting the ports, until consistency or approximate consistency with the visual layout of the Simulink model is achieved, and the second model can be obtained, such as Figure 5 shown.

[0147] Optionally, the target connection relationship of the second model is stored in the data structure of each module, wherein the target connection relationship includes the connection relationship of each module and the connection relationship of each module port in the second model.

[0148] In an embodiment of the present application, the Simulink model records the connection relationship at the system layer in the form of starting point id->starting point port number->end point id->end point port number; and in Beitai Zhenyuan, the second model records the connection relationship of each module and the connection relationship of each module port in the module's data structure. The module stores information of input and output ports, wherein the information of the input port records the id, type and port number of the module at the other end connected to the input port, while the information of the output port records the id, type and port number of the module at the other end connected to the output port.

[0149] Therefore, the second model in Beitai Zhenyuan adopts a more modular and localized approach to connection information management. This model not only includes its own parameter settings but also includes information about its input and output ports and the connections to connected modules, including their IDs, types, and port numbers. This design emphasizes the independence and self-descriptive capabilities of modules, allowing each module to carry sufficient contextual information for local adjustments and module reuse. It also simplifies the model's overall data structure, helping to improve the efficiency of model loading and execution.

[0150] Optionally, the above method further includes: determining a target solver in the simulation software according to the solver information; and running the second model according to the target solver to obtain an running result.

[0151] In an embodiment of the present application, the solver information used in the Simulink model, including but not limited to solver type, solver parameters (such as absolute error tolerance) and the algorithm setting of the solver. After completing the basic conversion of the model, it is also necessary to determine the target solver that should be adopted in the Beitai Zhenyuan software according to the Simulink solver information. For example, the solver type in Simulink is mapped to an equivalent or similar solver type in Beitai Zhenyuan, and the solver parameters are matched one to one to ensure that the same solution accuracy and algorithm are used in the target software.

[0152] Once the target solver is determined and set up in the second model, the second model can be run according to that solver to obtain the run results. These run results can also be compared with the simulation results of the original Simulink model. The comparison clearly shows that the simulation results of the converted second model and the original model are highly consistent in terms of transient response, steady-state performance, and behavior triggered by specific events. The error results are generally less than 10 to the power of -6, which is considered extremely small in the field of engineering simulation and is almost negligible.

[0153] Optionally, the above method also includes: receiving an operation instruction of the target object; obtaining adjustment information in the operation instruction, wherein the adjustment information includes at least one of the following: model parameter configuration information, model extension information, and model structure information; and adjusting the second model according to the adjustment information.

[0154] In an embodiment of the present application, the operation instruction of the target object can be directly input by the user through the interface of the Beitai Zhenyuan software, or it can be a signal from an automated script or an external control system. The adjustment information is obtained according to the operation instruction. The model parameter configuration information involves the parameter adjustment of the module in the model, such as the change of the numerical value of gain, frequency, offset, etc. This type of information allows the user to fine-tune the behavior of the model to adapt to different simulation conditions or achieve specific design goals without changing the basic structure of the model. Model extension information includes adding new modules or new connections to the existing model to enhance the model function or explore more complex system behavior. For example, adding a PID controller or a noise source module to the model. Model structure information involves adjustments to the overall structure of the model, such as the removal, rearrangement or modification of the model hierarchy of modules. This enables the user to reconstruct the model layout as needed, or to greatly simplify or complicate the model. Once the adjustment information in the operation instruction is obtained, the Beitai Zhenyuan software will make real-time or predefined adjustments to the second model based on this information.

[0155] In the embodiments of the present application, not only the precise mapping of the model structure and the precise conversion of parameters are covered, but also the visual restoration of the model layout and the seamless connection of the solver configuration are deepened. By adopting the module and parameter mapping method, the present application solves the problems of insufficient conversion accuracy, low degree of automation and compatibility in the relevant technologies, and realizes the efficient, accurate and intuitive import of Simulink models in simulation software. In addition, by establishing a Chinese mapping dictionary for parameter names, the convenience and experience of user operations are further improved, reflecting a deep insight into localization needs. Finally, by accurately matching the solver parameter information, it ensures that the simulation effect after model migration is highly consistent with the original Simulink model, and the error is controlled at an extremely low level. It has significant technological leadership and practical application value in the field of engineering simulation.

[0156] According to an embodiment of the present application, a model importing device is provided. It should be noted that the model importing device of the embodiment of the present application can be used to execute the model importing method provided in the embodiment of the present application. The model importing device provided in the embodiment of the present application is introduced below.

[0157] Figure 6 This is a structural diagram of a model introduction device provided according to an embodiment of the present application. Figure 6 As shown, the device includes:

[0158] An acquisition module 60 is used to obtain module information of the original model;

[0159] a determination module 62 for determining a mapping relationship between the original model and the simulation software based on the module information, and determining a first model based on the mapping relationship, wherein the first model is used to represent an initial model that is functionally equivalent to the original model in the simulation software;

[0160] The adjustment module 64 is used to adjust the layout of the first model according to the module information to obtain a second model, wherein the second model is used to replace the original model and directly run in the simulation software.

[0161] Through the acquisition module, determination module and adjustment module in the above-mentioned model import device, the purpose of accurately reproducing the original model in different engineering simulation software platforms is achieved, thereby realizing the technical effects of accurate mapping of model parameters, automation of migration process and seamless operation across platforms, thereby solving the technical problems of inaccurate parameter mapping, low degree of automation and poor compatibility of models in related technologies when they are imported into simulation software platforms.

[0162] In the model import device provided in the embodiment of the present application, the determination module is also used to determine the target module type in the simulation software based on the module type mapping, determine the target module parameter name in the simulation software based on the parameter name mapping, and determine the target module parameter value in the simulation software based on the parameter value mapping; determine the first model based on the target module type, target module parameter name and target module parameter value.

[0163] In the model import device provided in the embodiment of the present application, the determination module is also used to obtain a mapping dictionary corresponding to the parameter name mapping, wherein the mapping dictionary includes English descriptions and Chinese descriptions corresponding to each parameter name; and the target module parameter name is converted into a Chinese description based on the mapping dictionary.

[0164] In the model import device provided in the embodiment of the present application, the adjustment module is also used to determine the module position information of the original model; determine the layout rules based on the module position information, the first connection relationship and the second connection relationship, wherein the layout rules are used to guide the layout adjustment of the first model; adjust each module in the first model according to the layout rules to obtain the second model.

[0165] In the model import device provided in the embodiment of the present application, the adjustment module is also used to obtain adjustment information in the operation instruction, wherein the adjustment information includes at least one of the following: model parameter configuration information, model extension information, and model structure information; and adjust the second model based on the adjustment information.

[0166] The model importing device provided in the embodiment of the present application further includes an operation module 66, which is used to determine the target solver in the simulation software based on the solver information; and run the second model based on the target solver to obtain an operation result.

[0167] An embodiment of the present application also provides an electronic device, including: a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute the above-mentioned model import method.

[0168] It should be noted that the above electronic equipment is used to perform Figure 2 The model import method shown in the figure is as follows, so the relevant explanations in the above model import method are also applicable to the electronic device and will not be repeated here.

[0169] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned model import method by running the computer program.

[0170] It should be noted that the above non-volatile storage medium is used to execute Figure 2 The model import method shown in the figure is as follows, so the relevant explanations in the above model import method are also applicable to the non-volatile storage medium and will not be repeated here.

[0171] An embodiment of the present application also provides a computer program product, including computer instructions, which implement the above-mentioned model import method when executed by a processor.

[0172] It should be noted that the above-mentioned computer program product is used to execute Figure 2 The model import method shown, therefore the relevant explanations in the above model import method are also applicable to the computer program product and will not be repeated here.

[0173] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0174] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0175] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0176] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0177] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0179] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A model import method, characterized in that: include: Get the module information of the original model; Determining a mapping relationship between the original model and the simulation software based on the module information, and determining a first model based on the mapping relationship, wherein the first model is used to represent an initial model in the simulation software that is functionally equivalent to the original model; The layout of the first model is adjusted according to the module information to obtain a second model, wherein the second model is used to replace the original model and directly run in the simulation software.

2. The method according to claim 1, characterized in that The module information includes at least one of the following: module type, module parameters, module connection relationship and solver information in the original model, wherein the module connection relationship includes the first connection relationship of each module in the original model and the second connection relationship of each module port in the original model.

3. The method according to claim 2, characterized in that The method further comprises: determining a target solver in the simulation software according to the solver information; The second model is run according to the target solver to obtain an operation result.

4. The method according to claim 2, characterized in that Adjusting the layout of the first model according to the module information to obtain a second model includes: Determining module position information of the original model; Determining a layout rule based on the module position information, the first connection relationship, and the second connection relationship, wherein the layout rule is used to guide the first model to perform layout adjustment; Each module in the first model is adjusted according to the layout rule to obtain the second model.

5. The method according to claim 4, characterized in that The target connection relationship of the second model is stored in the data structure of each module, wherein the target connection relationship includes the connection relationship of each module and the connection relationship of each module port in the second model.

6. The method according to claim 1, characterized in that The mapping relationship includes module type mapping and parameter mapping between the original model and the simulation software, and the parameter mapping includes parameter name mapping and parameter value mapping between the original model and the simulation software.

7. The method according to claim 6, characterized in that Determining a first model according to the mapping relationship includes: Determining a target module type in the simulation software according to the module type mapping, determining a target module parameter name in the simulation software according to the parameter name mapping, and determining a target module parameter value in the simulation software according to the parameter value mapping; The first model is determined according to the target module type, the target module parameter name and the target module parameter value.

8. The method according to claim 7, characterized in that The method further comprises: Obtain a mapping dictionary corresponding to the parameter name mapping, wherein the mapping dictionary includes an English description and a Chinese description corresponding to each parameter name; The target module parameter name is converted into a Chinese description according to the mapping dictionary.

9. The method according to claim 1, characterized in that The method further comprises: Receive operation instructions from the target object; Acquire adjustment information in the operation instruction, wherein the adjustment information includes at least one of the following: model parameter configuration information, model extension information, and model structure information; The second model is adjusted according to the adjustment information.

10. A model introduction device, characterized in that: include: Get module, used to obtain the module information of the original model; a determination module, configured to determine a mapping relationship between the original model and the simulation software based on the module information, and to determine a first model based on the mapping relationship, wherein the first model is used to represent an initial model in the simulation software that is functionally equivalent to the original model; An adjustment module is used to adjust the layout of the first model according to the module information to obtain a second model, wherein the second model is used to replace the original model and run directly in the simulation software.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory and is used to execute the model import method described in any one of claims 1 to 9.

12. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the model importing method according to any one of claims 1 to 9 by running the computer program.

13. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the model importing method according to any one of claims 1 to 9 is implemented.