CAN parsing and packaging method, device, equipment and storage medium based on Simulink
By distributing and testing CAN messages, a distribution result that meets the ECU load rate is generated, which solves the problem of high ECU load rate and improves the stability and real-time performance of the ECU.
Patent Information
- Application Number
- CN202210107139.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-01-28
AI Technical Summary
In the prior art, when Simulink is used for CAN packetization and parsing, the ECU load rate is high, which affects the real-time performance of the ECU.
By counting and distributing the number of CAN messages, the distribution results are generated. Then, through Simulink model construction and ECU testing, it is determined whether the test results meet the preset conditions. CAN parsing and packaging are then performed after cyclic adjustment until the load rate requirements are met.
It reduces the load rate of ECU, improves the stability and real-time performance of ECU, and reduces the timing deviation of ECU tasks.
Smart Images

Figure CN114564384B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle electronics, and in particular to a method, device, equipment and storage medium for CAN parsing and packaging based on Simulink. Background Art
[0002] CAN (Controller Area Network) is an ISO internationally standardized serial communication protocol. In the current automotive industry, vehicle status and control commands are exchanged via CAN messages on the CAN bus.
[0003] In the existing technology, Simulink is used to build a model for CAN packaging and parsing, and a fixed parsing method based on the program running cycle is used, which increases the ECU running consumption and makes the ECU load rate higher, which may affect the real-time performance of the ECU.
[0004] It should be noted that, in the prior art, ECU function input and output design is performed by parsing the CAN module and packaging the CAN signals based on Matlab software, which results in a high ECU load rate. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a method, apparatus, device and storage medium for CAN parsing and packaging based on Simulink, which can reduce the load rate when designing the functions of the Electronic Control Unit (ECU).
[0006] According to a first aspect of the present application, a method for CAN parsing and packaging based on Simulink is provided, the method comprising: counting the number of CAN messages; distributing and dividing the number of CAN messages to obtain a distribution result; implementing the distribution result through Simulink model construction and generating test code, and testing through an electronic control unit (ECU) to generate a first test result; judging whether the first test result meets a preset condition; if the preset condition is not met, returning to execute the step of distributing and dividing the number of CAN messages to obtain a distribution result, generating a second test result, until the second test result meets the preset condition, a model for CAN parsing and packaging is constructed through Simulink.
[0007] Optionally, the method further includes: when the first test result meets a preset condition, building a CAN parsing and packaging model through Simulink.
[0008] Optionally, counting the number of CAN messages includes counting the number of CAN messages according to a preset CAN message period.
[0009] Optionally, before implementing the distribution results through Simulink model building and generating test code, and testing through the electronic control unit ECU to generate the first test result, the method also includes: using Simulink to build a model for parsing and packaging CAN messages based on the distribution results and the CAN message cycle, and generating a test program; executing the distribution results through Simulink model building and generating test code according to the test program, and testing through the electronic control unit ECU to generate the first test result.
[0010] Optionally, the number of CAN messages is divided and distributed to obtain distribution results, including:
[0011] The number of CAN messages is distributed and divided according to the preset requirements to obtain the distribution results; wherein, the preset requirements are that the distribution division is based on the requirements, and the distribution division is based on the requirements including: the requirements of the project on the input and output signals, the allowable initial deviation time of the signal, and the segmentation of the ECU task operation cycle, that is, the distribution division is within the allowable range of the project requirements.
[0012] Optionally, the number of CAN messages is distributed and divided according to preset requirements to obtain distribution results, including:
[0013] The preset ECU operation cycle is segmented to obtain a segmented cycle; the number of CAN messages is distributed and divided according to the segmented cycle to obtain a distribution result.
[0014] According to the second aspect of the present application, a device for CAN parsing and packaging based on Simulink is provided, which includes: a message quantity statistics module for counting the number of CAN messages; a quantity distribution division module for distributing and dividing the number of CAN messages to obtain a distribution result; a testing module for implementing the distribution result through Simulink model construction and generating test code, and testing through ECU to generate a first test result; a judgment module for judging whether the first test result meets a preset condition; a first parsing and packaging module for returning to execute the step of distributing and dividing the number of CAN messages to obtain a distribution result if the preset condition is not met, and generating a second test result, until the second test result meets the preset condition, a model for CAN parsing and packaging is built through Simulink.
[0015] Optionally, the device further includes: a second parsing and packaging module, which is used to build a CAN parsing and packaging model through Simulink when the first test result meets the preset conditions.
[0016] Optionally, the message quantity statistics module is used to: count the number of CAN messages according to a preset CAN message period.
[0017] Optional function implementation module, used to use Simulink to generate CAN message parsing and packaging model building and test program based on distribution results and CAN message cycle;
[0018] The test module is used to implement the distribution results through the Simulink model and generate test code according to the test program, and perform the test through the electronic control unit ECU to generate the first test result.
[0019] Optionally, a quantity distribution division module is used to distribute and divide the number of CAN messages according to preset requirements to obtain distribution results; wherein the preset requirements are that the distribution division is based on requirements, and the distribution division is based on requirements including: the project requirements for input and output signals, the allowable initial deviation time of the signal, and the segmentation of the ECU task operation cycle, that is, the distribution division is within the allowable range of the project requirements.
[0020] Optionally, a quantity distribution division module is used to: divide the preset ECU operation cycle into segments to obtain segmented cycles, and distribute and divide the number of CAN messages according to the segmented cycles to obtain distribution results.
[0021] According to a third aspect of the present application, an electronic device is provided, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the Simulink-based CAN parsing and packaging method of the first aspect are implemented.
[0022] According to a fourth aspect of the present application, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the Simulink-based CAN parsing and packaging method of the first aspect are implemented.
[0023] In an embodiment of the present application, the number of CAN messages is counted; the number of CAN messages is distributed and divided to obtain a distribution result; the distribution result is modeled and a test code is generated through Simulink, and then the electronic control unit ECU is tested to generate a first test result; it is determined whether the first test result meets a preset condition; if the preset condition is not met, the step of distributing and dividing the number of CAN messages to obtain a distribution result is returned to generate a second test result, and CAN parsing and packaging are performed until the second test result meets the preset condition. Therefore, compared with the related art, the embodiment of the present application distributes the CAN messages before CAN parsing and packaging. After generating the distribution results, the ECU is tested according to the distribution results to determine whether the generated test results meet the load rate of the ECU, that is, the test results can meet the load rate of the ECU to achieve the effect of reducing the load rate on the original basis. Among them, when the ECU load rate is not met, the above-mentioned distribution and division of the number of CAN messages is returned to obtain the distribution result; the distribution result is tested by the electronic control unit ECU to generate the first test result, and the execution is looped until the generated test result can meet the preset load rate. After the loop is completed, the CAN parsing and packaging function design is performed through Simulink modeling, which is used for the input and output functions of the electronic control unit (ECU) to reduce the load rate of the ECU. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 Flowchart of the CAN parsing and packaging method based on Simulink according to an embodiment of the present invention;
[0026] Figure 2 Flowchart of the CAN parsing and packaging method based on Simulink according to an embodiment of the present invention;
[0027] Figure 3 A flowchart of a CAN parsing and packaging method based on Simulink according to an embodiment of the present invention; and
[0028] Figure 4 Schematic diagram of a CAN parsing and packaging system based on Simulink according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the above and other features and advantages of the present application more clear, the present invention is further described below with reference to the accompanying drawings. It should be understood that the specific embodiments given herein are for the purpose of explaining to those skilled in the art and are only exemplary and not restrictive.
[0030] In the following description, many specific details are set forth to provide a thorough understanding of the present invention. However, it will be apparent to one of ordinary skill in the art that it is not necessary to adopt the specific details to practice the present invention. In other cases, well-known steps or operations are not described in detail to avoid obscuring the present invention.
[0031] Based on the background technology, it can be seen that using Simulink's CAN packaging and parsing module and parsing and packaging CAN messages through CAN message import, and executing CAN message parsing and packaging according to the program cycle will result in a high load rate of ECU functions.
[0032] After research, the applicant found that in order to solve the above technical problems, CAN message distribution and division should be carried out before ECU function development and the target ECU should be used for testing to determine whether the generated test results meet the preset conditions. If the preset conditions are not met, the process will return to distributing and dividing the number of CAN messages to obtain the distribution results; the distribution results will be tested through the electronic control unit ECU to generate the first test results. CAN parsing and packaging function development can only be carried out until the generated test results meet the preset conditions.
[0033] The following, in conjunction with the accompanying drawings, describes in detail the CAN parsing and packaging method provided in the embodiment of the present application through specific embodiments and their application scenarios.
[0034] like Figure 1 As shown, the CAN parsing and packaging method based on Simulink provided in the embodiment of the present application may include:
[0035] Step S11: Count the number of CAN messages.
[0036] Specifically, in this application, according to the project CAN message protocol, in combination with Table 1, there are a variety of CAN message periods, and messages of different periods can be parsed and packaged according to the message period in combination with project requirements.
[0037]
[0038] Table 1
[0039] The following is a further explanation of Table 1:
[0040] In the figure, CAN Statistical Table, CAN period, and CAN Count are displayed. The number of CAN messages received and sent varies in different time periods.
[0041] In order to accurately count the number of CAN messages, in an optional embodiment, counting the number of CAN messages in step S11 includes:
[0042] The number of CAN messages is counted according to the preset CAN message period.
[0043] In conjunction with Table 2, the number of CAN messages needs to be counted according to a preset CAN message period. The preset CAN message period can be the message sending frequency, that is, a message is sent within a certain period of time, that is, the number of CAN messages is counted within the corresponding period.
[0044] It should be noted that the preset CAN message period can be 10ms, 20ms, or 30ms, which is not specifically limited and can be set accordingly by those skilled in the art according to actual conditions.
[0045]
[0046] Table 2
[0047] The following is a further explanation of Table 2:
[0048] In the figure, CAN Distribution period (distribution table), CAN Distribution Counter (distribution quantity), Ccycle (cycle), among which, when the initial deviation time is 40ms, the results in the figure are obtained.
[0049] Specifically, in the present application, after the number of CAN messages is collected, in order to obtain a distribution result of the number of CAN messages, the number of CAN messages may be distributed and divided.
[0050] In order to obtain the distribution result, step S13 is executed to distribute and divide the number of CAN messages to obtain the distribution result.
[0051] It should be noted that step S11 and step S13 are distributed and divided according to the CAN protocol and DBC (Dynamic Body Control) is imported through Simulink to perform CAN parsing and packaging function design.
[0052] In order to make the distribution result more accurate and ensure the stable operation of the ECU, in one embodiment, the number of CAN messages is distributed and divided in step S13 to obtain the distribution result, including:
[0053] The number of CAN messages is distributed and divided according to the preset requirements to obtain the distribution results; wherein, the preset requirements are that the distribution division is based on the requirements, and the distribution division is based on the requirements including: the requirements of the project on the input and output signals, the allowable initial deviation time of the signal, and the segmentation of the ECU task operation cycle, that is, the distribution division is within the allowable range of the project requirements.
[0054] To meet the project's input and output signal requirements, the number of CAN messages is distributed and divided according to the signal's allowable initial deviation time. This means that the distribution results vary depending on the project's input and output signal requirements, and the corresponding values vary for different projects. For example, in a vehicle control unit (VCU) project, distributing CAN messages based on the ECU's requirements can make the ECU run more stable.
[0055] It should be noted that the initial deviation time may be 20ms, 40ms, or 60ms, which is not specifically limited and can be set accordingly by those skilled in the art according to actual conditions.
[0056] In order to make the distribution result more accurate, in one embodiment, the number of CAN messages is distributed and divided according to preset requirements to obtain the distribution result, which may include:
[0057] The preset ECU operation cycle is divided into segments to obtain segmented cycles.
[0058] The number of CAN messages is distributed and divided according to the segment period to obtain the distribution result.
[0059] When the aforementioned preset requirements are met, the ECU operating cycle is segmented. The ECU operating cycle can be 20ms, 40ms, or 60ms, without specific limitations, and can be set accordingly by those skilled in the art based on actual conditions. After the ECU operating cycle is segmented, the number of CAN messages is further distributed and segmented to obtain a distribution result, further defining the distribution of the number of CAN messages, thereby increasing the accuracy of the CAN message distribution.
[0060] Step S15 , implementing the distribution result through Simulink model construction and generating test code, and performing test verification through the electronic control unit ECU to generate a first test result.
[0061] Step S17: determine whether the first test result meets a preset condition.
[0062] Specifically, in this solution, after obtaining the distribution result, Simulink is used to build a model and generate test code, and then the CAN distribution load rate test is performed through the electronic control unit ECU to generate a first test result, and a judgment is made on the first test result to determine whether the preset conditions are met.
[0063] In an optional embodiment, the first test result may be a specific value, and thus the preset condition may also be a specific value, i.e., a value used to determine whether the first test result satisfies the preset condition. For example, if the first test result is 60% and the preset condition is 75%, then the condition is determined not to be met. If the first test result is 75% and the preset condition is 75%, then the preset condition is determined to be met.
[0064] In an optional embodiment, the first test result may be a range value, and thus the preset condition may also be a range value, i.e., determining whether the range of the first test result satisfies the range of the preset condition. For example, if the range of the first test result is 65%-67% and the range of the preset condition is 65%-70%, then the preset condition is determined to be met. If the range of the first test result is 55%-65% and the range of the preset condition is 65%-70%, then the preset condition is determined to be not met.
[0065] Step S19, if the preset conditions are not met, return to the step of distributing and dividing the number of CAN messages to obtain the distribution results, generate a second test result, and until the second test result meets the preset conditions, build a CAN parsing and packaging model through Simulink.
[0066] Specifically, in the present application, after obtaining the test results, the electronic control unit ECU can judge the first test result, wherein, when it is judged that the first test result does not meet the preset conditions, it returns to step S13, and loops through steps S13 and S15 to generate a second test result, until the generated result meets the preset conditions, stops the loop, and performs CAN parsing and packaging; when the preset conditions are met, does not loop through steps S13 and S15, and performs CAN parsing and packaging.
[0067] It should be noted that the above-mentioned preset conditions can produce an optimal distribution for the load rate test that satisfies the functional design of the electronic control unit ECU.
[0068] In order to make CAN parsing and packaging more efficient, in an optional embodiment, CAN parsing and packaging are performed when the first test result meets a preset condition.
[0069] When the first test result satisfies the optimal distribution of the load rate of the electronic control unit ECU function, CAN parsing and packaging are performed, that is, there is no need to perform the cycle of step S13 and step S15.
[0070] Compared with the prior art, this solution distributes CAN messages, generates distribution results, tests the ECU based on the distribution results, and determines whether the generated test results meet the load rate of the ECU, that is, the test results can meet the load rate of the ECU to achieve the effect of reducing the load rate on the original basis. If the ECU load rate is not met, the above steps S13 and S15 are returned to and executed in a loop until the generated test results can meet the preset load rate, that is, the load rate is reduced. After the loop is completed, CAN parsing and packaging function design is performed through Simulink modeling, which is used for the input and output functions of the Electronic Control Unit (ECU) to reduce the load rate of the ECU.
[0071] like Figure 2 As shown, in order to improve the running speed of the software, in step S15, before the distribution result is implemented by building a Simulink model and generating a test code, and testing it through the electronic control unit ECU to generate the first test result, the method further includes:
[0072] Step S141 , using Simulink to build a model for parsing and packaging CAN messages based on the distribution results and the CAN message cycle, and to generate a test program.
[0073] Step S142 is a step of implementing the distribution result through a Simulink model and generating a test code according to the test program, and performing a test through an electronic control unit ECU to generate a first test result.
[0074] Specifically, in this application, after executing step S13 to distribute and divide the number of CAN messages and obtain the distribution results, Simulink software is used to model the distribution results and the CAN message cycle using DBC to generate a test program. After the test program is generated, the program is tested on the ECU to generate a first test result, i.e., executing step S15.
[0075] This solution uses Matlab-based Simulink software to model DBC. Since Simulink can express mathematical models intuitively in a graphical way and solve them through its internal numerical solver, it is very convenient to use Simulink in the design.
[0076] Combine Figure 3 As shown, in one embodiment, this solution provides an optional method for reducing ECU load rate by CAN parsing and packaging based on Simulink technology and CAN network technology:
[0077] The method includes:
[0078] Step S31: CAN message quantity statistics are performed according to the CAN protocol and DBC.
[0079] Step S33: distribute and divide the number of CAN messages.
[0080] Step S35: Use Simulink software to generate a test model through DBC modeling.
[0081] Step S37: Use the ECU to test the test model and generate test results.
[0082] Step S39: determine whether the test result is consistent with the optimized test result.
[0083] Specifically, this solution counts the number of received and sent messages based on the CAN message cycle. Based on the project's requirements for input and output signals, the system then segments the messages according to the allowable initial deviation time and the ECU task cycle. CAN messages of different cycles are then divided into different time periods, and various distributions are calculated over time. Based on these distributions, Simulink software and the CAN message cycle are used to trigger trial analysis, build a packaging model, and generate a program. Finally, the program is tested on the ECU to determine the optimal distribution that meets the load reduction requirements.
[0084] Compared with the prior art, this solution distributes CAN messages, generates distribution results, tests the ECU based on the distribution results, and determines whether the generated test results meet the load rate of the ECU, that is, the test results can meet the load rate of the ECU to achieve the effect of reducing the load rate on the original basis. If the ECU load rate is not met, the above steps S13 and S15 are returned to and executed in a loop until the generated test results can meet the preset load rate, that is, the load rate is reduced. After the loop is completed, CAN parsing and packaging function design is performed through Simulink modeling, which is used for the input and output functions of the Electronic Control Unit (ECU) to reduce the load rate of the ECU.
[0085] In addition, the optimal distribution is used through DBC modeling in Matlab-based Simulink software to improve the software running speed and reduce the ECU task timing deviation while determining the optimal preset load rate, ensuring stable ECU operation.
[0086] In one embodiment, the present application further provides a Simulink-based CAN parsing and packaging device, the device comprising:
[0087] The message quantity statistics module 41 is used to count the number of CAN messages; the quantity distribution division module 42 is used to distribute and divide the number of CAN messages to obtain a distribution result; the test module 43 is used to test the distribution result through the ECU to generate a first test result; the judgment module 44 is used to judge whether the first test result meets the preset conditions; the first parsing and packaging module 45 is used to return to the step of distributing and dividing the number of CAN messages to obtain a distribution result if the preset conditions are not met, and generate a second test result until the second test result meets the preset conditions, and then build a model for CAN parsing and packaging through Simulink. Specifically, in this application, according to the project CAN message protocol, there are multiple messages with different periods in the number of CAN messages. Messages with different periods can be parsed and packaged according to the message period in combination with project requirements. Among them, the number of CAN messages needs to be counted according to the preset CAN message period. The preset CAN message period can be the message sending frequency, that is, sending a message within a certain period of time, that is, within the corresponding period, the different numbers of CAN messages are counted. It should be noted that the preset CAN message period can be 10ms, 20ms, or 30ms, and there is no specific limitation on this. It can be set accordingly by those skilled in the art based on actual conditions. The number of CAN messages is distributed and divided based on the allowable initial deviation time of the signal, while meeting the project's requirements for input and output signals. This means that the distribution results obtained by dividing the number of CAN messages based on the allowable initial deviation time of the signal will be different depending on the project's requirements for input and output signals. This means that the values corresponding to different devices are different. For example, when the test device is an ECU, distributing and dividing the CAN messages based on the ECU's requirements can make the ECU run more stable.
[0088] In one embodiment, the second parsing and packaging module is used to build a CAN parsing and packaging model through Simulink when the first test result meets the preset conditions.
[0089] If the first test result satisfies the optimal distribution of the distributed load rate test of the electronic control unit ECU function, CAN parsing and packaging are performed, that is, the loop of steps S13 and S15 is no longer required, thereby improving the efficiency of CAN parsing and packaging.
[0090] In one embodiment, the message quantity statistics module 41 is configured to count the number of CAN messages according to a preset CAN message period.
[0091] The number of CAN messages needs to be counted based on the preset CAN message period. The preset CAN message period can be the message sending frequency, that is, one message is sent within a certain period of time. In other words, the number of different CAN messages is counted within the corresponding period. This ensures that the CAN message number statistics are accurate.
[0092] In one embodiment, the function development module is used to use Simulink to build a model for parsing and packaging CAN messages based on the distribution results and the CAN message cycle, and to generate a test program. The test module 43 is used to implement the distribution results through the Simulink model according to the test program and generate test code, and to test through the electronic control unit ECU to generate a first test result.
[0093] Simulink is used to perform functional design based on the distribution results and CAN message cycle, and to generate a test program for parsing and packaging CAN messages. After executing step S13 to distribute and divide the CAN message quantity and obtain the distribution results, Simulink software is used to model the distribution results and CAN message cycle using DBC to generate a test program. After the test program is generated, it is tested on the ECU to generate a first test result, i.e., executing step S15 to determine the rationality of the distribution.
[0094] In one embodiment, the quantity distribution division module 42 is used to distribute and divide the number of CAN messages according to preset requirements to obtain a distribution result; wherein the preset requirements are that the distribution division is based on requirements, and the distribution division is based on requirements including: the project requirements for input and output signals, the allowable initial deviation time of the signal, and the segmentation of the ECU task operation cycle, that is, the distribution division is within the allowable range of the project requirements.
[0095] To meet the project's input and output signal requirements, the number of CAN messages is distributed and divided according to the signal's allowable initial deviation time. This means that the distribution results vary depending on the project's input and output signal requirements, and the corresponding values vary for different projects. For example, in a vehicle control unit (VCU) project, distributing CAN messages based on the ECU's requirements can make the ECU run more stable.
[0096] In one embodiment, the quantity distribution division module 42 is configured to: divide the preset ECU operation cycle into segments to obtain segmented cycles, and distribute and divide the quantity of CAN messages according to the segmented cycles to obtain distribution results.
[0097] When the aforementioned preset requirements are met, the ECU operating cycle is segmented. The ECU operating cycle can be 20ms, 40ms, or 60ms, without specific limitations, and can be set accordingly by those skilled in the art based on actual conditions. After the ECU operating cycle is segmented, the number of CAN messages is further distributed and segmented to obtain a distribution result, further defining the distribution of the number of CAN messages, thereby increasing the accuracy of the CAN message distribution.
[0098] Compared with the prior art, this solution distributes CAN messages, generates distribution results, tests the ECU based on the distribution results, and determines whether the generated test results meet the load rate of the ECU, that is, the test results can meet the load rate of the ECU to achieve the effect of reducing the load rate on the original basis. If the ECU load rate is not met, the above steps S13 and S15 are returned to and executed in a loop until the generated test results can meet the preset load rate, that is, the load rate is reduced. After the loop is completed, CAN parsing and packaging function design is performed through Simulink modeling, which is used for the input and output functions of the Electronic Control Unit (ECU) to reduce the load rate of the ECU.
[0099] In addition, the optimal distribution is used through DBC modeling in Matlab-based Simulink software to improve the software running speed and reduce the ECU task timing deviation while determining the optimal preset load rate, ensuring stable ECU operation.
[0100] It should be understood that the specific features, operations, and details described hereinabove with respect to the method of the present application may also be similarly applied to the apparatus and system of the present application, or vice versa. In addition, each step of the method of the present application described above may be performed by a corresponding component or unit of the apparatus or system of the present application.
[0101] It should be understood that the various modules / units of the apparatus of the present application may be implemented in whole or in part by software, hardware, firmware, or a combination thereof. Each of the modules / units may be embedded in a processor of a computer device in the form of hardware or firmware or may be independent of the processor, or may be stored in a memory of a computer device in the form of software for the processor to call to execute the operations of the modules / units. Each of the modules / units may be implemented as an independent component or module, or two or more modules / units may be implemented as a single component or module.
[0102] In one embodiment, a computer device is provided, comprising a memory and a processor, wherein the memory stores computer instructions executable by the processor, and when executed by the processor, the computer instructions instruct the processor to perform the steps of the method of the present application. The computer device can be broadly defined as a server, a terminal, or any other electronic device having the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, a memory, a network interface, a communication interface, etc. connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and an internal memory. An operating system, a computer program, etc. may be stored in or on the non-volatile storage medium. The internal memory can provide an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface and the communication interface of the computer device can be used to connect and communicate with external devices via a network.
[0103] The present application can be implemented as a computer-readable storage medium having a computer program stored thereon, which causes the steps of the method of the present application to be performed when executed by a processor. In one embodiment, the computer program is distributed on a plurality of computer devices or processors coupled to a network so that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, can be performed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations can be performed by one or more computer devices or processors, and one or more other method steps / operations can be performed by one or more other computer devices or processors. One or more computer devices or processors can perform a single method step / operation, or perform two or more method steps / operations.
[0104] It will be understood by those skilled in the art that the steps of the method of the present application can be performed by instructing relevant hardware such as a computer device or a processor through a computer program, and the computer program can be stored in a non-transitory computer-readable storage medium. When the computer program is executed, the steps of Example 1 and Example 2 of the present application are executed. Depending on the circumstances, any reference to memory, storage, database or other media herein may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state disk, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0105] The various technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification as long as such combination does not conflict.
[0106] Although the present application has been described in conjunction with the embodiments, it should be understood by those skilled in the art that the above description and the accompanying drawings are merely exemplary and non-restrictive, and the present application is not limited to the disclosed embodiments. Various modifications and variations are possible without departing from the spirit of the present application.
Claims
1. A CAN parsing and packaging method based on Simulink, characterized in that: The method comprises: Count the number of CAN messages; The number of CAN messages is distributed and divided to obtain the distribution results; Implement the distribution result through Simulink model construction and generate test code, and test it through the electronic control unit ECU to generate a first test result; Determining whether the first test result meets a preset condition; If the preset conditions are not met, return to the step of distributing and dividing the number of CAN messages to obtain the distribution results, generate a second test result, and until the second test result meets the preset conditions, build a model for CAN parsing and packaging through Simulink.
2. The method for CAN parsing and packaging based on Simulink according to claim 1, characterized in that: The method further comprises: When the first test result meets the preset conditions, the CAN parsing and packaging model is built through Simulink.
3. The method for CAN parsing and packaging based on Simulink according to claim 1, characterized in that: The counting of the number of CAN messages includes: The number of CAN messages is counted according to the preset CAN message period.
4. The method for CAN parsing and packaging based on Simulink according to claim 3, characterized in that: Before implementing the distribution result through a Simulink model and generating test code, and testing the result through an electronic control unit ECU to generate a first test result, the method further includes: Using Simulink to generate a model for parsing and packaging CAN messages according to the distribution results and the preset CAN message period, and to generate a test program; According to the test program, the steps of implementing the distribution result through a Simulink model and generating a test code are executed, and testing is performed through an electronic control unit ECU to generate a first test result.
5. The method for CAN parsing and packaging based on Simulink according to claim 1, characterized in that: The distribution of the number of CAN messages is divided to obtain a distribution result, including: The number of CAN messages is distributed and divided according to preset requirements to obtain the distribution results; Among them, the preset requirements are distribution division requirements, which include: the project requirements for input and output signals, segmentation according to the allowable initial deviation time of the signal, and the ECU task operation cycle, that is, the distribution division is within the allowable range of the project requirements.
6. The method for CAN parsing and packaging based on Simulink according to claim 5, characterized in that: The number of CAN messages is distributed and divided according to preset requirements to obtain distribution results, including: Divide the preset ECU operation cycle into segments to obtain segmented cycles; The number of CAN messages is distributed and divided according to the segment period to obtain the distribution result.
7. A CAN parsing and packaging device based on Simulink, characterized in that: The device comprises: Message quantity statistics module, used to count the number of CAN messages; The quantity distribution division module is used to distribute and divide the quantity of CAN messages to obtain the distribution results; A test module, configured to implement the distribution result through a Simulink model and generate test code, and perform the test through an ECU to generate a first test result; A judgment module, configured to judge whether the first test result meets a preset condition; The first parsing and packaging module is used to return to the step of distributing and dividing the number of CAN messages to obtain the distribution result when the preset conditions are not met, and generate a second test result. When the second test result meets the preset conditions, a CAN parsing and packaging model is built through Simulink.
8. The device for CAN parsing and packaging based on Simulink according to claim 7, characterized in that: The device further comprises: The second parsing and packaging module is used to build a CAN parsing and packaging model through Simulink when the first test result meets the preset conditions.
9. An electronic device, characterized in that: The electronic device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the Simulink-based CAN parsing and packaging method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the Simulink-based CAN parsing and packaging method according to any one of claims 1 to 6.
Citation Information
Patent Citations
CAN bus based controller network monitoring system and monitoring method
CN101572641A
Message input method and message output method
CN110113237A