ECU model code generation method and device, equipment, medium and product

Using the Simulink tool to build an ECU integrated model and generate code solves the problem of high ECU model code generation costs under the Autosar architecture, realizes all-in-one ECU development under non-Autosar architecture, and provides a cost-effective code generation solution.

CN118860408AInactive Publication Date: 2024-10-29格至达智能科技(江苏)有限公司

Patent Information

Application Number
CN202410901772.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing ECU model code generation solution is based on the Autosar architecture, causing small and medium-sized automotive electronics ECU manufacturers to face high tool chain costs. With the increasing pressure to reduce costs for smart electric vehicles, the industry is in need of all-in-one ECU development solutions based on non-Autosar software architecture.

Method used

By using the Simulink tool to build the ECU integration model on the application software layer, obtain the code folder and generate the code, the all-in-one ECU development application layer software model code generation under the non-Autosar software architecture is realized.

Benefits of technology

It replaces the Autosar tool, reduces the cost of ECU model code generation, meets the all-in-one ECU development needs under non-Autosar architecture, and provides a cost-effective code generation solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860408A_ABST
    Figure CN118860408A_ABST
Patent Text Reader

Abstract

The invention discloses an ECU model code generation method, relates to the technical field of ECU software development, and discloses an ECU model code generation method, an ECU model code generation device, ECU model code generation equipment, a storage medium and a computer program product.The ECU model code generation method comprises the steps that at least one ECU integrated model is constructed on an application software layer through Simulink; according to the method and the device, the code folder of the at least one ECU integrated model is obtained, the at least one ECU integrated model code is generated according to the code folder, and the technical effect of using a Simulink tool to replace an Autosar tool to complete ECU model code generation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of ECU software development, and in particular to an ECU model code generation method, an ECU model code generation apparatus, an ECU model code generation device, a storage medium, and a computer program product. Background Art

[0002] Among the current ECU (Electronic Control Unit) model code generation solutions, the model code generation method based on the Autosar (Automotive Open System Architecture) architecture is the current mainstream solution. This solution requires manufacturers to purchase expensive Autosar tools, which puts a large tool chain cost pressure on most small and medium-sized automotive electronic ECU manufacturers. In addition, with the increasing pressure to reduce costs of smart electric vehicles, mainstream OEMs (Original Equipment Manufacturers) have begun to accept non-Autosar software architecture automotive electronic embedded software development methods. However, how to establish an application layer software model code generation solution that can meet the needs of all-in-one ECU development through non-Autosar software architecture is increasingly needed by the industry. Summary of the invention

[0003] The main purpose of this application is to provide an ECU model code generation method, an ECU model code generation device, an ECU model code generation equipment, a storage medium, and a computer program product, aiming to achieve the technical effect of using Simulink tools instead of Autosar tools to complete ECU model code generation.

[0004] To achieve the above purpose, the present application proposes a method for generating ECU model code, the method comprising:

[0005] Build at least one ECU integration model on the application software layer through Simulink;

[0006] A code folder of the at least one ECU integration model is obtained, and the at least one ECU integration model code is generated according to the code folder.

[0007] In one embodiment, the application software layer includes at least one ECU integration model, and the ECU integration model includes at least one SWC subsystem model; the step of constructing at least one ECU integration model on the application software layer by Simulink includes:

[0008] Based on the model reference in Simulink, the SWC subsystem model is linked in the original ECU model to obtain at least one ECU integrated model;

[0009] Signal transmission is achieved between the SWC subsystem models in the ECU integrated model through the GotoFrom mechanism in Simulink.

[0010] In one embodiment, the step of constructing at least one ECU integration model on the application software layer through Simulink further includes:

[0011] Assigning values ​​to the global variables input and output of the ECU integrated model at the RTE layer;

[0012] Assign the function input of the SWC subsystem model to global variables.

[0013] In one embodiment, the step of constructing at least one ECU integration model on the application software layer by Simulink includes:

[0014] Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them.

[0015] In one embodiment, the step of generating the at least one ECU integrated model code according to the code folder includes:

[0016] Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them;

[0017] Load the files to be compiled of each ECU integration model according to the code folder path of each ECU integration model in turn;

[0018] At least one ECU integration model code is generated according to the file to be compiled.

[0019] In one embodiment, the step of loading the files to be compiled of each ECU integration model includes:

[0020] Copy the to-be-compiled files of the first ECU integration model and the to-be-compiled files of the second ECU integration model to the compilation folder;

[0021] Rename the files to be compiled that have the same name in the compilation folder.

[0022] In addition, to achieve the above purpose, the present application also proposes an ECU model code generation device, the ECU model code generation device comprising:

[0023] A building module, used for building at least one ECU integration model on the application software layer through Simulink;

[0024] The generating module is used to obtain a code folder of the at least one ECU integrated model and generate the at least one ECU integrated model code according to the code folder.

[0025] In addition, to achieve the above-mentioned purpose, the present application also proposes an ECU model code generation device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the ECU model code generation method described above.

[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the ECU model code generation method described above are implemented.

[0027] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the ECU model code generation method described above are implemented.

[0028] This application uses the Simulink tool to build at least one ECU integration model on the application software layer, then obtains the code folder of at least one ECU integration model, generates at least one ECU integration model code according to the code folder, and uses the Simulink tool to build the ECU integration model, thereby realizing the application layer software model code generation for all-in-one ECU development using a non-Autosar software architecture. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0031] Figure 1 A flowchart of a first embodiment of the ECU model code generation method provided in this application;

[0032] Figure 2A flowchart of a second embodiment of the ECU model code generation method provided in the present application;

[0033] Figure 3 The software architecture diagram of the multi-core ECU provided for the ECU model code generation method of this application;

[0034] Figure 4 A model reference schematic diagram provided for the ECU model code generation method of this application;

[0035] Figure 5 A schematic diagram of signal transmission for the Gotofrom mechanism provided by the ECU model code generation method of this application;

[0036] Figure 6 Schematic diagram of global variable assignment of ECU integrated model provided by the ECU model code generation method of this application;

[0037] Figure 7 A schematic diagram of global variable assignment of the SWC subsystem model provided for the ECU model code generation method of this application;

[0038] Figure 8 A schematic diagram of signal interaction function interruption provided for the ECU model code generation method of this application;

[0039] Fig. 9 A schematic diagram for renaming the header file of the global variable declaration with the same name provided by the ECU model code generation method of this application;

[0040] Fig.10 A schematic diagram of the SWC subsystem model interface connection provided for the ECU model code generation method of this application;

[0041] Fig.11 A schematic diagram of a third embodiment of the ECU model code generation method provided in this application;

[0042] Fig.12 A code generation schematic diagram provided for the ECU model code generation method of this application;

[0043] Fig.13 This is a schematic diagram of the module structure of the ECU model code generation device of this application;

[0044] Fig.14 This is a schematic diagram of the device structure of the hardware operating environment involved in the ECU model code generation method of this application.

[0045] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0046] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0047] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0048] The main solutions of the embodiments of this application are:

[0049] In the current ECU (Electronic Control Unit) model code generation scheme, the model code generation method based on the Autosar (Automotive Open System Architecture) architecture is the current mainstream solution. This solution requires manufacturers to purchase expensive Autosar tools, which puts a large tool chain cost pressure on most small and medium-sized automotive electronic ECU manufacturers. In addition, with the increasing pressure to reduce costs of smart electric vehicles, mainstream OEMs (Original Equipment Manufacturers) have begun to accept non-Autosar software architecture automotive electronic embedded software development methods. However, how to establish an application layer software model code generation solution that can meet the needs of all-in-one ECU development through non-Autosar software architecture is increasingly needed by the industry.

[0050] This application uses the Simulink tool to build at least one ECU integration model on the application software layer, then obtains the code folder of at least one ECU integration model, generates at least one ECU integration model code according to the code folder, and uses the Simulink tool to build the ECU integration model, thereby realizing the application layer software model code generation for all-in-one ECU development using a non-Autosar software architecture.

[0051] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, a processor, etc. that can realize the above functions. The following takes an ECU development manufacturer as an example to illustrate this embodiment and the following embodiments.

[0052] Based on this, the embodiment of the present application provides an ECU model code generation method, referring to Figure 1 , Figure 1 A flowchart of the first embodiment of the ECU model code generation method provided in the present application.

[0053] In this embodiment, the ECU model code generation method includes steps S10 to S20:

[0054] Step S10, constructing at least one ECU integration model on the application software layer through Simulink;

[0055] It should be noted that Simulink is a visual simulation tool in MATLAB launched by MathWorks in the United States. It is a block diagram environment for multi-domain simulation and model-based design. Simulink supports system design, simulation, automatic code generation, and continuous testing and verification of embedded systems. It provides a graphical editor, a customizable module library, and a solver, and is capable of modeling and simulating dynamic systems.

[0056] In addition, it should be noted that the application software layer (ASW) generally refers to the software layer in the software architecture that directly interacts with the user or provides services for specific applications. In the ECU, the application software layer may include various control algorithms, user interface logic, diagnostic programs, etc. In this embodiment, each ECU occupies a CPU core.

[0057] An integrated model refers to a whole system model formed by combining multiple components or subsystems. In Simulink, different modules or external system models can be integrated into a unified framework to facilitate the simulation and analysis of the entire system.

[0058] Step S20, obtaining a code folder of the at least one ECU integration model, and generating the at least one ECU integration model code according to the code folder.

[0059] It should be noted that the code folder is used to store program codes. This folder contains source files, header files and other files that constitute the software application. In this embodiment, the code folder may refer to a file structure containing ECU integration model related codes.

[0060] This embodiment provides an ECU model code generation method, which uses the Simulink tool to build at least one ECU integration model on the application software layer, then obtains the code folder of the at least one ECU integration model, generates at least one ECU integration model code according to the code folder, and uses the Simulink tool to build the ECU integration model, thereby realizing the application layer software model code generation for all-in-one ECU development using a non-Autosar software architecture.

[0061] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above introduction, and will not be described in detail later. Figure 2 , Figure 2A flowchart of the second embodiment of the ECU model code generation method provided in the present application.

[0062] Step S10, the application software layer includes at least one ECU integration model, and the ECU integration model includes at least one SWC (Software Component) subsystem model; the ECU model code generation method also includes steps A10 to A11:

[0063] Reference Figure 3 , Figure 3 Software architecture diagram of a multi-core ECU provided for the ECU model code generation method of this application.

[0064] ASW can include multiple ECU integration models, which can include multiple SWC subsystem models. The ECU integration model is responsible for managing the signal transmission and task scheduling of different SWC subsystem models. RTE (Runtime Environment) is responsible for signal transmission between different ECUs in the application layer and between application software and basic software.

[0065] Step A10, based on the model reference in Simulink, linking the SWC subsystem model in the original ECU model to obtain at least one ECU integrated model;

[0066] It should be noted that model reference is a mechanism in Simulink that allows users to include another model in one model. In this way, a complex model can be decomposed into multiple smaller and more manageable subsystem models. The subsystem model in the ECU integration model uses model reference to reference each SWC subsystem model in each SWC folder; the subsystem model, i.e., the SWC subsystem model, can be referenced multiple times in the main model, i.e., the original ECU model, and each reference can be used to set parameters and configure them. Changes to the SWC subsystem model will be automatically synchronized to the ECU integration model.

[0067] SWC subsystem model refers to the basic unit that constitutes the application software layer in the automotive electronic system, such as input unit, diagnostic unit, control unit; a SWC subsystem model can have multiple functions (Runnable); the original ECU model can refer to the model existing in Simulink; linking usually refers to the process of connecting the input or output of one model to the input or output of another model.

[0068] For example, refer to Figure 4 , Figure 4 A model reference schematic diagram provided for the ECU model code generation method of this application.

[0069] In the original ECU model, linking the SWC subsystem model means embedding the SWC subsystem model into the original ECU model so that the input or output of the SWC subsystem model can be used as part of the input or output of the ECU integrated model, such as Figure 4 ECU1 is an integrated model, which references the SWC1 subsystem model and the SWC2 subsystem model. The input of the SWC1 subsystem model can be used as the input of the ECU1 integrated model, and the output of the SWC2 subsystem model can be used as the output of the ECU1 integrated model. In this way, the original ECU model forms an integrated model that can simulate the interaction with other software components.

[0070] Step A20, using the GotoFrom mechanism in Simulink, signal transmission is implemented between the SWC subsystem models in the ECU integrated model.

[0071] For example, refer to Figure 5 , Figure 5 The GotoFrom mechanism provided by the ECU model code generation method of this application is a schematic diagram for signal transmission. The GotoFrom connection is used for signal transmission between different functions within the SWC subsystem model, and the GotoFrom connection can also be used for signal transmission between SWC subsystem models. Figure 5 , inside the SWC1 subsystem model, function SWC1_Runable1 is connected to function SWC1_Runable2 through GotoFrom2, and function SWC1_Runable1 in the SWC1 subsystem model is connected to function SWC2_Runable1 in the SWC2 subsystem model through GotoFrom1.

[0072] In this embodiment, the SWC subsystem model is integrated into the original ECU model by using the model reference function, thus realizing the modularization of the ECU integrated model. The signal transmission between different functions within the SWC subsystem model and between SWC subsystem models uses the GotoFrom mechanism of Simulink to realize the signal transmission between different subsystem models.

[0073] In one implementation, in step S10, the ECU model code generation method further includes steps B10 to B11:

[0074] Step B10, assigning values ​​to the global variables input and output of the ECU integrated model at the RTE layer;

[0075] It should be noted that the ECU integration model configures the input and output modules as global variables through signal attribute configuration. In the RTE layer, handwritten code can be used to assign values ​​to global variables to complete signal transmission between different ECU integration models.

[0076] For example, refer to Figure 6 , Figure 6 Schematic diagram of global variable assignment for the ECU integrated model provided by the ECU model code generation method of this application.

[0077] Step B11, assigning the function input of the SWC subsystem model to a global variable.

[0078] It should be noted that the input and output of each function are the input and output of the entire SWC subsystem model, and will be connected with other SWC subsystem models in the ECU integration model. For example, in the ECU1 integration model, the input and output of the SWC1 subsystem model can be connected with the input and output of the SWC2 subsystem model. For example, refer to Figure 7 , Figure 7 Schematic diagram of global variable assignment of SWC subsystem model provided for the ECU model code generation method of this application.

[0079] In the SWC subsystem model, different functions are directly connected using GotoFrom. The input of a function may come from the output of another function. Figure 8 , Figure 8 The signal interaction function interruption diagram provided for the ECU model code generation method of this application. If the priorities and scheduling cycles of two functions are different, the low-priority function will be interrupted by the high-priority function. When the low-priority function uses the output of the high-priority function as input, the input value before and after the interruption is rewritten by the high-priority function, resulting in changes.

[0080] For example, a high-order filter algorithm may use the historical running results of a variable, such as the last running result or the last running result, to participate in the calculation. If the variable changes within a calculation cycle, it may lead to the output of unexpected results, so it is necessary to avoid such a phenomenon.

[0081] In this embodiment, step B11 reassigns the input of each function when the function starts running, and reassigns all inputs to the global variables used by the current function. After the global variables are assigned, even if a low-priority function is interrupted by a high-priority function, the input will not change. Within a scheduling cycle, the global variables assigned when the function just starts running are used for calculations, thereby avoiding the phenomenon of abnormal output caused by changes in input data during operation.

[0082] In this embodiment, by configuring the ECU integrated model input and output as global variables, it can be ensured that the access and modification of data are controlled during the function scheduling process, reducing the risk of illegal data tampering. Assigning values ​​to global variables in the ECU integrated model can better control the data flow.

[0083] In addition, in this embodiment, the function input of the SWC subsystem model is assigned as a global variable, which can simplify the data exchange between functions. The problem of data tampering during function scheduling can be solved by configuring the global variables of the SWC subsystem model.

[0084] In one implementation, after step S10, the ECU model code generation method includes:

[0085] Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them.

[0086] It should be noted that, refer to Fig. 9 , Fig. 9 A schematic diagram of renaming the global variable declaration header file with the same name provided for the ECU model code generation method of this application, with the global variable declaration header file with the same name on the left and the global variable declaration header file after being renamed on the right.

[0087] The data of each SWC subsystem model will be managed in the data dictionary of each SWC subsystem model, and the global variables of each SWC subsystem model will be set and declared in SWC_Var.h (header file). In the ECU integration model that references the SWC subsystem model, if the interface where the global variables defined in the SWC subsystem model are located is connected to the interface of other SWC subsystem models, refer to Fig.10 , Fig.10 Schematic diagram of the SWC subsystem model interface connection provided for the ECU model code generation method of this application. If the SWC1_Signal signal is transmitted in GotoFrom1, the global variable of the SWC1_Signal signal will be generated in the folder of the ECU integrated model, that is, the global variable of the signal transmitted between different SWC subsystem models belongs to the ECU integrated model, and other global variables will still be generated in the code folder of the SWC1 subsystem model. If the SWC1_Signal signal is transmitted in GotoFrom2, the global variable of the SWC1_Signal signal will be generated in the code folder of the SWC1 subsystem model, that is, the global variable of the signal transmitted by different functions inside the SWC subsystem model belongs to the SWC subsystem model, but the declaration header files of these two types of signals are both SWC1_Var.h, that is, two SWC1_Var.h will be generated.

[0088] Therefore, in order to avoid errors in the files to be compiled, in one implementation, the movefile command of Matlab can be used to rename SWC1_Var.h in the ECU code folder to ECU_SWC1_Var.h to distinguish it.

[0089] In this implementation, multiple global variable declaration header files with the same name are renamed to avoid naming conflicts, ensure the correctness of the files to be compiled, and prevent compilation errors from affecting code generation.

[0090] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above introduction, and will not be described in detail later. Fig.11 , Fig.11 A flowchart of the third embodiment of the ECU model code generation method provided in the present application.

[0091] Step S20, the ECU model code generation method includes steps D10 to D30:

[0092] Step D10, renaming one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them;

[0093] It should be noted that the specific implementation details of step D10 refer to the implementation in the second embodiment above, which will not be repeated here.

[0094] Step D20, loading the files to be compiled of each ECU integration model according to the code folder path of each ECU integration model in turn;

[0095] It should be noted that the code folder path refers to the specific location where the code files are stored, which are usually classified and stored according to a certain organizational structure in the computer system. The files to be compiled refer to the source code files that have not been processed by the compiler. These files usually contain the logic and instructions of the program. Among them, the files to be compiled are the renamed files.

[0096] Step D30, generating at least one ECU integration model code according to the file to be compiled.

[0097] It should be noted that the files to be compiled of each ECU integration model are found and loaded according to the code folder path, and the files to be compiled are copied to the compilation folder, and the system compiles the compilation folder to generate model code. Exemplarily, when generating at least one ECU integration model code, it can be generated sequentially, such as first generating the code of the ECU1 integration model, then generating the code of the ECU2 integration model, and then generating other ECU integration model codes in sequence like this; it can also generate the codes of the ECU1 integration model, the ECU2 integration model, the ECU3 integration model, etc. at the same time.

[0098] In this embodiment, the to-be-compiled files of the ECU integration model are loaded through the code folder path of the ECU integration model, and the system generates the ECU integration model code according to the to-be-compiled files, thereby realizing automatic model code generation using the Simulink tool.

[0099] In one embodiment, step D20, the ECU model code generation method includes steps E10 to E20:

[0100] Step E10, copying the to-be-compiled files of the first ECU integrated model and the to-be-compiled files of the second ECU integrated model to a compilation folder;

[0101] When generating code according to the first ECU integration model, after renaming the global variable declaration header file with the same name in the first ECU code folder, load the first ECU integration model code folder path, which includes the code folders of the ECU integration model and the referenced SWC subsystem model; copy all source files and header files (i.e., files to be compiled) in the first ECU integration model code folder to the compilation folder for compilation; after compilation, delete the first ECU integration model code folder path. Deleting the first ECU integration model code folder path is to prepare for generating the second ECU integration model, avoid affecting the second ECU integration model code generation, and thus avoid loading multiple ECU integration model code folder paths, and further avoid possible errors and other problems when multiple paths are loaded at the same time.

[0102] Next, after deleting the first ECU integrated model code folder path, rename the global variable declaration header file with the same name in the second ECU code folder, and then load the second ECU integrated model code folder path. The subsequent generation steps are the same as those of the first ECU integrated model.

[0103] Step E20, rename the to-be-compiled files with duplicate names in the compilation folder.

[0104] Exemplarily, after all source files and header files (i.e., files to be compiled) in the first ECU integrated model code folder are copied to the compilation folder for compilation, the files to be compiled in the second ECU integrated model code folder will also be copied to the compilation folder for compilation, so there will be files to be compiled with the same name in the compilation folder. The compiler may confuse the files to be compiled with the same name, resulting in the inability to correctly parse the file content, thereby generating a compilation error, so the files to be compiled with the same name need to be renamed, wherein the movefile command can be used for renaming, or a renaming tool can be used, and the specific method is not limited.

[0105] For example, refer to Fig.12 , Fig.12 A code generation diagram provided for the ECU model code generation method of this application.

[0106] In this embodiment, by renaming the to-be-compiled files with the same name, naming conflicts are avoided, the correctness of the to-be-compiled files is ensured, and compilation errors are prevented from affecting code generation.

[0107] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the ECU model code generation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0108] The present application also provides an ECU model code generation device, referring to Fig.13 , the ECU model code generating device comprises:

[0109] A construction module 10, used to construct at least one ECU integration model on the application software layer through Simulink;

[0110] The generating module 20 is used to obtain a code folder of the at least one ECU integrated model, and generate the at least one ECU integrated model code according to the code folder.

[0111] Optionally, the application software layer includes at least one ECU integration model, and the ECU integration model includes at least one SWC subsystem model; the construction module 10 is further used for:

[0112] Based on the model reference in Simulink, the SWC subsystem model is linked in the original ECU model to obtain at least one ECU integrated model;

[0113] Signal transmission is achieved between the SWC subsystem models in the ECU integrated model through the GotoFrom mechanism in Simulink.

[0114] Optionally, the building block 10 is further used for:

[0115] Assigning values ​​to the global variables input and output of the ECU integrated model at the RTE layer;

[0116] Assign the function input of the SWC subsystem model to global variables.

[0117] Optionally, the building block 10 is further used for:

[0118] Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them.

[0119] Optionally, the generating module 20 is further used for:

[0120] Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them;

[0121] Load the files to be compiled of each ECU integration model according to the code folder path of each ECU integration model in turn;

[0122] At least one ECU integration model code is generated according to the file to be compiled.

[0123] Optionally, the generating module 20 is further used for:

[0124] Copy the to-be-compiled files of the first ECU integration model and the to-be-compiled files of the second ECU integration model to the compilation folder;

[0125] Rename the files to be compiled that have the same name in the compilation folder.

[0126] The ECU model code generation device provided in the present application adopts the ECU model code generation method in the above-mentioned embodiment, and achieves the technical effect of using Simulink tool instead of Autosar tool to complete ECU model code generation.

[0127] Compared with the prior art, the beneficial effects of the ECU model code generation device provided in the present application are the same as the beneficial effects of the ECU model code generation method provided in the above-mentioned embodiment, and other technical features in the ECU model code generation device are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.

[0128] The present application provides an ECU model code generation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the ECU model code generation method in the above-mentioned first embodiment.

[0129] Reference below Fig.14 , which shows a schematic diagram of the structure of an ECU model code generation device suitable for implementing an embodiment of the present application. The ECU model code generation device in the embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.14 The ECU model code generation device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0130] like Fig.14As shown, the ECU model code generation device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the ECU model code generation device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the ECU model code generation device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an ECU model code generation device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.

[0131] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0132] The ECU model code generation device provided in the present application adopts the ECU model code generation method in the above-mentioned embodiment, and achieves the technical effect of using Simulink tool instead of Autosar tool to complete ECU model code generation.

[0133] Compared with the prior art, the beneficial effects of the ECU model code generation device provided in the present application are the same as the beneficial effects of the ECU model code generation method provided in the above embodiment, and other technical features in the ECU model code generation device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0134] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0135] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0136] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the ECU model code generation method in the above-mentioned embodiment.

[0137] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0138] The computer-readable storage medium may be included in the ECU model code generation device; or may exist independently without being installed in the ECU model code generation device.

[0139] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the ECU model code generation device, the ECU model code generation device: builds at least one ECU integration model on the application software layer through Simulink; obtains the code folder of the at least one ECU integration model, and generates the at least one ECU integration model code according to the code folder.

[0140] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0143] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned ECU model code generation method, thereby achieving the technical effect of using Simulink tools instead of Autosar tools to complete ECU model code generation.

[0144] Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the ECU model code generation method provided in the above-mentioned embodiment, and will not be elaborated here.

[0145] The present application also provides a computer program product, including a computer program, which implements the steps of the ECU model code generation method as described above when executed by a processor.

[0146] The computer program product provided by this application achieves the technical effect of using Simulink tools instead of Autosar tools to complete ECU model code generation.

[0147] Compared with the prior art, the beneficial effects of the computer program product provided in the present application are the same as the beneficial effects of the ECU model code generation method provided in the above-mentioned embodiment, which will not be elaborated here.

[0148] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for generating ECU model code, characterized in that: The method includes: Build at least one ECU integration model on the application software layer through Simulink; A code folder of the at least one ECU integration model is obtained, and the at least one ECU integration model code is generated according to the code folder.

2. The method according to claim 1, characterized in that The application software layer includes at least one ECU integration model, and the ECU integration model includes at least one SWC subsystem model; the step of constructing at least one ECU integration model on the application software layer by Simulink includes: Based on the model reference in Simulink, the SWC subsystem model is linked in the original ECU model to obtain at least one ECU integrated model; Signal transmission is achieved between the SWC subsystem models in the ECU integrated model through the GotoFrom mechanism in Simulink.

3. The method according to claim 1, characterized in that The step of constructing at least one ECU integration model on the application software layer through Simulink also includes: Assigning values ​​to the global variables input and output of the ECU integrated model at the RTE layer; Assign the function input of the SWC subsystem model to global variables.

4. The method according to claim 1, characterized in that The step of constructing at least one ECU integration model on the application software layer by Simulink includes: Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them.

5. The method according to claim 1, characterized in that The step of generating the at least one ECU integrated model code according to the code folder comprises: Rename one of the global variable declaration header files with the same name in the ECU code folder and the SWC code folder to distinguish them; Load the files to be compiled of each ECU integration model according to the code folder path of each ECU integration model in turn; At least one ECU integration model code is generated according to the file to be compiled.

6. The method according to claim 5, characterized in that The step of loading the files to be compiled of each ECU integrated model includes: Copy the to-be-compiled files of the first ECU integration model and the to-be-compiled files of the second ECU integration model to the compilation folder; Rename the files to be compiled that have the same name in the compilation folder.

7. An ECU model code generation device, characterized in that: The device comprises: A building module, used for building at least one ECU integration model on the application software layer through Simulink; The generating module is used to obtain a code folder of the at least one ECU integrated model and generate the at least one ECU integrated model code according to the code folder.

8. An ECU model code generation device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the ECU model code generation method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the ECU model code generation method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the ECU model code generation method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • General car code conversion method

    CN102622470A

  • Single-chip microcomputer development system and method based on ECUCoder

    CN103365638A

  • Application layer model and bottom layer C code integration method and device

    CN114564181A

  • Method for developing and testing application layer model based on Simulink

    CN115878088A

  • Software testing method, system and equipment and storage medium

    CN116069648A

Cited By

  • Rapid prototype algorithm verification platform and method

    CN119536717A

  • Method and device for generating description file of SWC in ECU and vehicle-mounted ECU

    CN121116289A