A method and system for automatically generating interface models based on MATLAB
Automatically identify and manage automotive ECU interface signals through matlab scripts, and use preset template tables to process CAN and LIN protocol signals. This solves the time-consuming and error-prone problem of manually building interface software models, and achieves fast and accurate interface software model generation. .
Patent Information
- Application Number
- CN202111435175.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-11-29
AI Technical Summary
The construction of existing automotive ECU interface software models requires a lot of manual effort and is prone to signal wiring errors, leading to misaligned signal transmission.
Establish a connection with the automotive interface software model through matlab scripts, automatically identify and manage target data, generate interface software models, and use preset template tables to process CAN and LIN protocol signals to avoid manual construction errors.
It greatly shortens the development cycle and completely avoids the problem of misaligned signal transmission. It only takes a few minutes to complete the software generation of thousands of interface signals.
Smart Images

Figure CN114117798B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a MATLAB-based automatic interface model generation method and system. Background Art
[0002] The automotive ECU interface software model is mainly responsible for receiving fixed template management data such as hard-wired signals, CAN signals, LIN signals, and storage signals in the underlying software that need to be passed to the application layer software, and performing operations such as accuracy, offset, and limitation on the underlying signals. Currently, most interface software models are built manually by engineers. Due to the large number of interface signals, engineers need to spend a lot of effort to complete them, and it is very easy to have wiring errors, resulting in misaligned signal transmission. Summary of the invention
[0003] The purpose of the present invention is to solve the above problems and provide a MATLAB-based automatic interface model generation method and system that can solve the problem of large workload and easy signal connection misalignment in manually building interface software models.
[0004] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0005] A method for automatically generating an interface model based on MATLAB, comprising the following steps:
[0006] S1, the matlab script is connected to the automobile interface software model, and data search and identification are performed according to the data type preset in the matlab script to obtain the target data;
[0007] S2, copy the target data preset by the matlab script, and temporarily store the target data in the form of a structure;
[0008] S3, extracting the data signal from the temporarily stored target data in step S2, and managing it using the template table preset by the matlab script;
[0009] S4, matlab script completes the addition, appearance change, position change, name change and parameter setting of basic calculation models through data signals;
[0010] S5. According to the data signal, call the matlab script command to connect the generated basic calculation model;
[0011] S6. Divide the data in the template table according to the functional blocks of the basic calculation model, and package and generate respective library models by calling matlab script commands.
[0012] Furthermore, in step S2, the target data preset by the matlab script includes: data provided by the automobile ECU CAN protocol and data provided by the automobile ECU LIN protocol.
[0013] This method automatically generates an interface software model by automatically reading the automobile ECU CAN protocol, automobile ECU LIN protocol, and ECU hardware, faults, data flow and other information managed by a pre-set template table, calling the command of the matlab script according to the interface signal processing rules. According to this method, it only takes a few minutes to complete a version of software with thousands of interface signals, which greatly shortens the development cycle. Moreover, since the method works according to the pre-set rules, it completely avoids the problem of signal transmission dislocation that is very easy to make mistakes in the development stage.
[0014] Furthermore, in step S3, the data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit, lower limit, period, sender and receiver information.
[0015] Furthermore, in step S3, the preset template table management content includes ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals and storage signals.
[0016] Furthermore, in step S6, the functional block includes a CAN signal, a LIN signal, an ECU hardware signal, a fault signal, a data stream signal, an IO control signal, a routine control signal and a storage signal.
[0017] An automatic interface model generation system based on MATLAB, including
[0018] A connection module, used to establish a connection with the vehicle interface software model and perform data transmission;
[0019] A data extraction module is used to search, identify and copy preset target data, and extract fixed template management data and information signals from the target data;
[0020] Basic calculation model establishment module, used to complete the addition, appearance change, position change, name change and parameter setting of basic calculation models;
[0021] The model library establishment module completes the connection between basic calculation models according to data signals, and divides and packages the data in the template table to generate respective library models.
[0022] Furthermore, the target data includes: data provided by the automobile ECU CAN protocol and data provided by the automobile ECU LIN protocol.
[0023] Furthermore, the data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit value, lower limit value, period, sender and receiver information.
[0024] Furthermore, the preset template table management content includes ECU hardware signals, fault signals, data flow signals, IO control signals, routine control signals and storage signals.
[0025] Furthermore, the basis for dividing the functional blocks includes CAN signals, LIN signals, ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals and storage signals.
[0026] Compared with the prior art, the present invention has the following beneficial effects: the present method automatically reads the automobile ECU CAN protocol and the ECU hardware, faults, data flow and other information managed according to a fixed template, and automatically generates an interface software model by calling the command of the matlab script according to the interface signal processing rules. According to this method, it only takes a few minutes to complete a version of software with thousands of interface signals, which greatly shortens the development cycle, and because the method works according to pre-set rules, it completely avoids the problem of signal transmission dislocation that is very easy to make mistakes in the development stage. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of the working process of the ECU CAN protocol for an automobile in the embodiment. DETAILED DESCRIPTION
[0028] The present invention is described in detail below in conjunction with test examples and specific implementation methods. However, this should not be understood as the scope of the above subject matter of the present invention being limited to the following embodiments, and all technologies realized based on the content of the present invention belong to the scope of the present invention.
[0029] A method for automatically generating an interface model based on MATLAB, comprising the following steps:
[0030] S1, the matlab script is connected to the automobile interface software model, and data search and identification are performed according to the data type preset in the matlab script to obtain the target data;
[0031] S2, copy the target data preset by the matlab script, and temporarily store the target data in the form of a structure;
[0032] S3, extracting the data signal from the temporarily stored target data in step S2, and managing it using the template table preset by the matlab script;
[0033] S4. The matlab script completes the addition, appearance change, position change, name change and parameter setting of the basic calculation model through data signals; the addition, appearance change, position change, name change and parameter setting of the basic calculation model belong to the basic module of the matlab script function, or the corresponding work can be achieved through code.
[0034] In step S3, the staff can edit the set template form to establish a corresponding and independent software model as required.
[0035] S5. According to the data signal, call the matlab script command to connect the generated basic calculation model;
[0036] S6. Divide the data in the template table according to the functional blocks of the basic calculation model, and package and generate respective library models by calling matlab script commands.
[0037] Specifically, in step S2, the target data preset by the matlab script includes: data provided by the automobile ECU CAN protocol and data provided by the automobile ECU LIN protocol.
[0038] This method automatically generates an interface software model by automatically reading the automobile ECU CAN protocol, automobile ECU LIN protocol, and ECU hardware, faults, data flow and other information managed by a pre-set template table, calling the command of the matlab script according to the interface signal processing rules. According to this method, it only takes a few minutes to complete a version of software with thousands of interface signals, which greatly shortens the development cycle. Moreover, since the method works according to the pre-set rules, it completely avoids the problem of signal transmission dislocation that is very easy to make mistakes in the development stage.
[0039] Specifically, in step S3, the data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit, lower limit, period, sender and receiver information.
[0040] Staff can edit the matlab script according to their needs, select all or any combination of CAN signals and LIN signals to complete the addition, appearance change, position change, name change and parameter setting of the basic calculation model, and can also set the specified parameters of the basic calculation model.
[0041] Specifically, in step S3, the preset template table management content includes ECU hardware signals, fault signals, data flow signals, IO control signals, routine control signals and storage signals.
[0042] Specifically, in step S6, the functional blocks include CAN signals, LIN signals, ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals, and storage signals.
[0043] An automatic interface model generation system based on MATLAB, including
[0044] A connection module, used to establish a connection with the vehicle interface software model and perform data transmission;
[0045] A data extraction module is used to search, identify and copy preset target data, and extract fixed template management data and information signals from the target data;
[0046] Basic calculation model establishment module, used to complete the addition, appearance change, position change, name change and parameter setting of basic calculation models;
[0047] The model library establishment module completes the connection between basic calculation models according to data signals, and divides and packages the data in the template table to generate respective library models.
[0048] The system can realize the fully automatic interface signal construction with the automotive interface software model, replacing the traditional manual construction by engineers, greatly improving efficiency and saving time, while avoiding the problem of connection errors that are prone to manual construction.
[0049] Specifically, the target data includes: data provided by the automobile ECU CAN protocol and data provided by the automobile ECU LIN protocol.
[0050] Specifically, the data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit value, lower limit value, period, sender and receiver information.
[0051] Through the above generation method, the system selects all or any combination of CAN signals and LIN signals to complete the addition, appearance change, position change, name change and parameter setting of the basic calculation model, and can also set the specified parameters of the basic calculation model.
[0052] Specifically, the pre-set template table management content includes ECU hardware signals, fault signals, data flow signals, IO control signals, routine control signals and storage signals.
[0053] Specifically, the basis for dividing the functional blocks includes CAN signals, LIN signals, ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals and storage signals.
[0054] The system automatically reads the automobile ECU CAN protocol, automobile ECU LIN protocol, and ECU hardware, faults, data flow and other information managed according to the preset template table, and calls the MATLAB script command according to the interface signal processing rules to automatically generate the interface software model.
[0055] It can replace the traditional manual construction method, shorten the project process and avoid unnecessary wiring errors.
Claims
1. A method for automatically generating an interface model based on MATLAB, characterized in that: The following steps are involved: S1, the matlab script is connected to the automobile interface software model, and data search and identification are performed according to the data type preset in the matlab script to obtain the target data; S2, copy the target data preset by the matlab script, and temporarily store the target data in the form of a structure; In step S2, the target data preset by the matlab script includes: data provided by the ECU CAN protocol of the car and data provided by the ECU LIN protocol of the car; S3, extracting the data signal in the temporarily stored target data in step S2, and managing it using the template table preset by the matlab script; in step S3, the preset template table management content includes ECU hardware signal, fault signal, data flow signal, IO control signal, routine control signal and storage signal; S4, matlab script completes the addition, appearance change, position change, name change and parameter setting of basic calculation models through data signals; S5. According to the data signal, call the matlab script command to connect the generated basic calculation model; S6. Divide the data in the template table according to the functional blocks of the basic calculation model, and package and generate respective library models by calling matlab script commands.
2. The method for automatically generating an interface model based on MATLAB according to claim 1, characterized in that: In step S3, the data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit, lower limit, period, sender and receiver information.
3. The method for automatically generating an interface model based on MATLAB according to claim 1, characterized in that: In step S6, the functional blocks include CAN signals, LIN signals, ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals and storage signals.
4. A matlab-based automatic interface model generation system, characterized in that: It includes a connection module, which is used to establish a connection between the matlab script and the automobile interface software model, and to search and identify data according to the data type preset in the matlab script to obtain target data; The data extraction module is used to copy the target data preset by the matlab script and temporarily store the target data in the form of a structure; Extract the data signal from the temporarily stored target data and manage it using the template table preset by the matlab script; the target data includes: data provided by the ECU CAN protocol of the car and data provided by the ECU LIN protocol of the car; the management content of the preset template table includes ECU hardware signal, fault signal, data flow signal, IO control signal, routine control signal and storage signal; The basic calculation model establishment module is used for the MATLAB script to complete the addition, appearance change, position change, name change and parameter setting of the basic calculation model through data signals; The model library establishment module is used to call the matlab script command according to the data signal to connect the generated basic calculation model; divide the data in the template table according to the functional blocks of the basic calculation model, and package and generate the respective library models by calling the matlab script command.
5. The automatic interface model generation system based on MATLAB according to claim 4, characterized in that: The data signal includes a CAN signal obtained from the automobile ECU CAN protocol and a LIN signal obtained from the automobile ECU LIN protocol; the CAN signal and the LIN signal respectively include one or any combination of their corresponding message ID, signal name, data type, length, precision, offset, upper limit value, lower limit value, cycle, sender and receiver information.
6. The automatic interface model generation system based on MATLAB according to claim 4, characterized in that: The basis for dividing the functional blocks includes CAN signals, LIN signals, ECU hardware signals, fault signals, data stream signals, IO control signals, routine control signals and storage signals.
