Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, an object of the present invention is to provide a CAN protocol generation method, which CAN shorten the development period and reduce errors caused by manual protocol modification.
Another object of the present invention is to provide a CAN protocol generation apparatus.
In order to achieve the above object, an embodiment of the present invention provides a method for generating a CAN protocol, including the following steps: reading a target requirement file; generating a signal demand list file according to the target demand file; comparing and analyzing the signal demand list file based on a preset model to obtain a distribution strategy for a plurality of controller signals; and generating a CAN protocol according to the distribution strategy.
According to the CAN protocol generation method, the number matching requirement list files are compared and analyzed, so that the distribution strategies of the signals of the controllers are obtained, the CAN protocol is generated according to the distribution strategies, the protocol generation time is shortened at the initial stage of protocol formulation, the development period is shortened, errors caused by manual protocol change are reduced in the development process, errors caused by multiple modifications are avoided, the safety of a vehicle is improved, and the reliability of the vehicle is better guaranteed.
Further, in an embodiment of the present invention, the signal requirement list file includes safety definition information corresponding to a plurality of controller signals, and the comparing and analyzing the signal requirement list file based on a preset model to obtain an allocation policy for the plurality of controller signals includes: analyzing the safety definition information respectively corresponding to the plurality of controller signals according to a preset model to obtain the distribution priorities of the plurality of control signals; determining target distribution addresses of the control signals according to distribution files of ID address fields of controllers corresponding to the control signals; and generating the distribution strategies of the plurality of controller signals according to the target distribution addresses and the distribution priorities of the plurality of control signals.
Further, in an embodiment of the present invention, the signal requirement list file includes message periods corresponding to a plurality of controller signals, and the comparing and analyzing the signal requirement list file based on a preset model to obtain an allocation policy for the plurality of controller signals further includes: and generating the distribution strategies of the plurality of controller signals according to the target distribution addresses, the distribution priorities and the message periods of the plurality of control signals.
Further, in an embodiment of the present invention, the method further includes: and outputting the CAN protocol.
Further, in an embodiment of the present invention, the method further includes: receiving a modification instruction of the signal requirement list file; and modifying the signal demand list file according to the modification instruction, and regenerating a CAN protocol according to the modified signal demand list file.
In order to achieve the above object, an embodiment of another aspect of the present invention provides a CAN protocol generating apparatus, including: the reading module is used for reading the target requirement file; the first generation module is used for generating a signal demand list file according to the target demand file; the acquisition module is used for comparing and analyzing the signal demand list file based on a preset model so as to obtain a distribution strategy for a plurality of controller signals; and the second generation module is used for generating the CAN protocol according to the distribution strategy.
The CAN protocol generation device provided by the embodiment of the invention obtains the distribution strategies of a plurality of controller signals by comparing and analyzing the number-checking requirement list files, and then generates the CAN protocol according to the distribution strategies, thereby not only shortening the time for generating the protocol and shortening the development period at the initial stage of protocol formulation, but also reducing errors caused by manual protocol change in the development process, avoiding errors caused by multiple modifications, improving the safety of vehicles and better ensuring the reliability of the vehicles.
Further, in an embodiment of the present invention, the signal requirement list file includes security definition information corresponding to a plurality of controller signals, respectively, and the obtaining module further includes: the analysis unit is used for analyzing the safety definition information respectively corresponding to the plurality of controller signals according to a preset model to obtain the distribution priorities of the plurality of control signals; the determining unit is used for determining target distribution addresses of the control signals according to distribution files of ID address fields of controllers corresponding to the control signals; a first generating unit, configured to generate an allocation policy of the plurality of controller signals according to target allocation addresses and allocation priorities of the plurality of control signals.
Further, in an embodiment of the present invention, the signal requirement list file includes message periods corresponding to a plurality of controller signals, respectively, and the obtaining module further includes: and the second generating unit is used for generating the distribution strategies of the plurality of controller signals according to the target distribution addresses, the distribution priorities and the message periods of the plurality of control signals.
Further, in an embodiment of the present invention, the apparatus further includes: the receiving module is used for receiving a modification instruction of the signal demand list file; and the modification module is used for modifying the signal demand list file according to the modification instruction and regenerating the CAN protocol according to the modified signal demand list file.
In order to achieve the above object, according to another embodiment of the present invention, a vehicle is provided, which includes the above CAN protocol automatic generation apparatus.
According to the vehicle provided by the embodiment of the invention, the number-checking requirement list file is compared and analyzed, so that the distribution strategy of a plurality of controller signals is obtained, and the CAN protocol is generated according to the distribution strategy, so that the protocol generation time is shortened and the development period is shortened at the initial stage of protocol formulation, errors caused by manual protocol change are reduced in the development process, the errors caused by multiple modifications are avoided, the safety of the vehicle is improved, and the reliability of the vehicle is better ensured.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
A CAN protocol generation method, an apparatus, and a vehicle having the same according to embodiments of the present invention will be described below with reference to the accompanying drawings, and first, the CAN protocol generation method according to embodiments of the present invention will be described with reference to the accompanying drawings.
Fig. 1 is a flowchart of a CAN protocol generation method according to an embodiment of the present invention.
As shown in fig. 1, the CAN protocol generating method includes the following steps:
in step S101, the target demand file is read.
As shown in fig. 2, the target requirement file may be obtained after the vehicle function requirement definition, the bus architecture definition, and the ID and source address allocation of each controller are performed, and in the early development process, the priority of the signal is reasonably allocated by accurately defining the security and other aspects of each signal.
In step S102, a signal demand list file is generated from the target demand file.
After the signal requirement list is generated, as shown in fig. 2, the EXCEL file may be converted into a Visual Studio database file, and the Visual Studio database file may be converted into an MATLAB database file, so that comparison and allocation of the model-based signal definitions may be performed.
For example, by applying a Visual Studio tool, programming interface programs of a main program and an EXCEL program through a C # language, so that related data input in an early stage can generate an EXCEL related file, and by applying the Visual Studio tool, programming the main program through the C # language, so that requirements in the EXCEL can be defined and imported into the main program, and thus, logical judgment is performed on related input contents as protection time of recovery operation, so as to increase the safety of vehicle operation
In step S103, the signal requirement list file is compared and analyzed based on a preset model to obtain an allocation strategy for a plurality of controller signals.
It should be noted that the preset model can be set according to actual situations.
In an embodiment of the present invention, the signal requirement list file may include security definition information corresponding to the plurality of controller signals, and the comparing and analyzing of the signal requirement list file based on the preset model to obtain the allocation policy for the plurality of controller signals includes: analyzing safety definition information respectively corresponding to the plurality of controller signals according to a preset model to obtain distribution priorities of the plurality of control signals; determining target distribution addresses of the control signals according to distribution files of ID address fields of controllers corresponding to the control signals; and generating an allocation strategy of the plurality of controller signals according to the target allocation addresses and the allocation priorities of the plurality of control signals.
Further, in an embodiment of the present invention, the signal requirement list file may include message periods corresponding to the plurality of controller signals, respectively, and the signal requirement list file is compared and analyzed based on a preset model to obtain an allocation policy for the plurality of controller signals, and the method further includes: and generating an allocation strategy of a plurality of controller signals according to the target allocation addresses, the allocation priorities and the message periods of the plurality of control signals.
That is, according to the existing allocation of controller ID address field, the period and ID of each packet are reasonably allocated in combination with the priority of each controller signal.
In step S104, a CAN protocol is generated according to the allocation policy.
That is, input contents are compared through MATLAB, so that after the signal requirement definitions are compared, reasonable signal arrangement is generated, if MATLAB and C # interface programs are utilized, the comparison programs are introduced into a main program, and therefore related functions are achieved, the development period is shortened, and errors caused by manual protocol change are reduced.
Further, in an embodiment of the present invention, as shown in fig. 2, the generating method of the embodiment of the present invention further includes: and outputting the CAN protocol, namely issuing the protocol.
In addition, in an embodiment of the present invention, the generation method of the embodiment of the present invention further includes: receiving a modification instruction of a signal demand list file; and modifying the signal demand list file according to the modification instruction, and regenerating the CAN protocol according to the modified signal demand list file.
That is to say, as shown in fig. 2, after the relevant protocol is generated after data processing, it is further determined whether modification is needed, so that when the previous modification is input, the method of the embodiment of the present invention can automatically generate the version management log, and automatically change all relevant contents of the protocol, thereby better ensuring the reliability of the vehicle.
In the embodiment of the invention, the embodiment of the invention CAN convert each database and compare and arrange the signal requirements, which requires professional knowledge and experience of the CAN protocol, thereby shortening the starting period, and reducing the errors caused by manual operation and the time required by test to a certain extent
Fig. 3 is a schematic diagram of protocol generation according to one embodiment of the present invention. As shown in fig. 3, it can be roughly divided into seven parts: the system comprises a main program, a signal requirement comparison program, an MATLAB and Visual Studio interface program, a conference generation program, an Excel and Visual Studio interface program, a signal requirement and controller ID distribution table and a whole vehicle protocol. The signal requirement comparison program is core content, has higher requirements on experience of bus engineers and related professional knowledge, needs a lot of data and calculation for support, and can optimize the program according to judgment and analysis of the engineers after the initial protocol automatic generation, so that the time for compiling and modifying the protocol can be greatly shortened after certain optimization.
According to the CAN protocol generation method provided by the embodiment of the invention, the distribution strategies of a plurality of controller signals are obtained by comparing and analyzing the number-matching demand list files, the CAN protocol is generated according to the distribution strategies, and interfaces among different software are realized through the signal demand comparison program, so that data CAN be directly imported and generated.
Next, a CAN protocol generation apparatus proposed according to an embodiment of the present invention is described with reference to the drawings.
Fig. 4 is a schematic structural diagram of a CAN protocol generation apparatus according to an embodiment of the present invention.
As shown in fig. 4, the CAN protocol generation apparatus 10 includes: a reading module 100, a first generating module 200, an obtaining module 300 and a second generating module 400.
The reading module 100 is configured to read a target requirement file. The first generating module 200 is configured to generate a signal requirement list file according to the target requirement file. The obtaining module 300 is configured to compare and analyze the signal requirement list file based on a preset model to obtain a distribution strategy for a plurality of controller signals. The second generating module 400 is configured to generate a CAN protocol according to an allocation policy. The generation device 10 of the embodiment of the invention can shorten the time for generating the protocol, avoid errors caused by multiple modifications and improve the safety of the vehicle.
Further, in one embodiment of the present invention, as shown in FIG. 5. The signal requirement list file may include security definition information corresponding to a plurality of controller signals, respectively, and the obtaining module 300 further includes: an analyzing unit 301, a determining unit 302 and a first generating unit 303.
The analysis unit 301 is configured to analyze the safety definition information corresponding to the plurality of controller signals respectively based on a preset model, so as to obtain the distribution priorities of the plurality of control signals. The determining unit 302 is configured to determine target allocation addresses of the plurality of control signals according to the allocation files of the ID address fields of the controllers corresponding to the plurality of control signals. The first generating unit 303 is configured to generate an allocation policy for the plurality of controller signals according to target allocation addresses and allocation priorities of the plurality of control signals.
Further, in an embodiment of the present invention, as shown in fig. 5, the signal requirement list file may include message periods corresponding to a plurality of controller signals, and the obtaining module 300 further includes: a second generation unit 304. The second generating unit 304 is configured to generate an allocation policy of the plurality of controller signals according to the target allocation addresses, the allocation priorities, and the packet periods of the plurality of control signals.
Further, in an embodiment of the present invention, the generation apparatus 10 of the embodiment of the present invention further includes: a publish module (not specifically identified in the figure). The release module is used for outputting a CAN protocol.
Further, in an embodiment of the present invention, the generation apparatus 10 of the embodiment of the present invention further includes: a receiving module (not specifically identified in the figures) and a modifying module (not specifically identified in the figures).
The receiving module is used for receiving a modification instruction of the signal requirement list file. The modification module is used for modifying the signal demand list file according to the modification instruction and regenerating the CAN protocol according to the modified signal demand list file.
It should be noted that the foregoing explanation on the embodiment of the CAN protocol generation method is also applicable to the CAN protocol generation apparatus of this embodiment, and details are not described here.
According to the CAN protocol generation device provided by the embodiment of the invention, the distribution strategies of a plurality of controller signals are obtained through comparison and analysis of the number matching demand list files, the CAN protocol is generated according to the distribution strategies, and interfaces among different software are realized through a signal demand comparison program, so that data CAN be directly imported and generated.
In addition, the embodiment of the invention also provides a vehicle, and the vehicle comprises the CAN protocol generating device. This vehicle CAN compare the analysis through number demand tabulation file, thereby obtain the distribution strategy to a plurality of controller signals, and then generate the CAN agreement according to the distribution strategy, compare the procedure through the signal demand, realize the interface between the different software, make data CAN directly be leading-in and generate, not only at the initial stage that the agreement was formulated, shorten the time that the agreement generated, development cycle has been shortened, and in the development process, the mistake that brings because of artifical change agreement has been reduced, avoid modifying the mistake that brings many times, the security of vehicle has been promoted, guarantee the reliability of vehicle better, and the method is easy to realize and has wide practicality.
In the description of the present invention, it is to be understood that the terms "central," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," "circumferential," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the invention and to simplify the description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be considered limiting of the invention.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.