A CAN routing function implementation method, system, device and storage medium
By establishing and managing CAN routing tables and automatically generating routing codes, the problem of rewriting codes in the existing technology every time is solved, improving development efficiency and reducing errors.
Patent Information
- Application Number
- CN202310042122.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-13
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2043-01-13
AI Technical Summary
In the prior art, in order to implement different CAN routing functions, code rewriting is required each time, resulting in increased workload and handwritten code is prone to errors.
By establishing a routing table, it stores it in a preset path, and the routing table includes at least message routing information, sending parameter information, receiving parameter information, and target CAN network information. Call the routing table based on the preset path, obtain the corresponding information, and convert it into routing code. Then, the basic code and routing code are obtained, combined according to preset encoding rules, and the target code is generated to implement the CAN routing function.
This enables the change of routing tables without manually rewriting code, improves development efficiency and reduces the possibility of encoding errors.
Smart Images

Figure CN116155794B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of automobile gateways, and in particular relates to a method, system, device and storage medium for realizing a CAN routing function. Background Art
[0002] CAN is the abbreviation of Controller Area Network (CAN), and the CAN bus protocol has become the standard bus for automotive computer control systems and embedded industrial control LANs. It also has a J1939 protocol designed for large trucks and heavy machinery vehicles with CAN as the underlying protocol.
[0003] In the automotive field, common CAN networks include PCAN (powertrain CAN), CCAN (chassis control CAN), BCAN (body control CAN) and TCAN (remote control CAN). CAN gateway is a common core component of current automobiles. As a central node, CAN gateway is connected to all the above CAN networks. As a communication hub for multiple ECUs on a car, its main function is to be responsible for the message routing of the multi-channel CAN network in the topology diagram, so that each ECU on the multi-channel CAN network can communicate effectively. Among them, there are three common message routings: direct message routing, modified period message routing and signal routing. Different car models will provide different CAN routing table requirements, and the routing table contains direct message routing, modified period message routing and signal routing.
[0004] At present, in order to realize the solution of CAN routing function, it is usually necessary to implement it according to the routing table and hand-written code. However, for different CAN routing tables and different CAN routing functions, the code needs to be rewritten each time, which increases the workload. At the same time, hand-written code is prone to errors. Summary of the invention
[0005] Based on this, the embodiments of the present invention provide a CAN routing function implementation method, system, device and storage medium, aiming to solve the problem in the prior art that in order to implement different CAN routing functions, the code needs to be rewritten each time, resulting in increased workload, and at the same time, handwritten code is prone to errors.
[0006] A first aspect of an embodiment of the present invention provides a method for implementing a CAN routing function, the method comprising:
[0007] Establishing a routing table and storing the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information;
[0008] According to the preset path, calling the routing table, and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table;
[0009] Convert the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into corresponding routing codes;
[0010] The basic code and the routing code are obtained, and the basic code and the routing code are combined according to a preset coding rule to generate a target code, and the target code is used to be transmitted to the CAN routing software to realize the corresponding CAN routing function.
[0011] Further, the steps of establishing a routing table and storing the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information, include:
[0012] Obtain a blank table, and divide the blank table into four areas according to the columns of the blank table, namely, a message area, a sending area, a receiving area and a target CAN area, wherein the message area, the sending area, the receiving area and the target CAN area are used to store the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information respectively;
[0013] According to the rows of the blank table, the message area, the sending area, the receiving area and the target CAN area are respectively divided into at least a first area and a second area, wherein the first area includes a plurality of parameter name grids, and the parameter name grids are used to store parameter names of various information, and the second area includes a plurality of information entry grids, and the information entry grids are used to store parameter data corresponding to the parameter names;
[0014] According to the CAN routing function requirements, the target parameter data is filled in the information entry grid in the second area to complete the establishment of the routing table.
[0015] Further, the step of calling the routing table according to the preset path and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table includes:
[0016] Obtain the first row and column number of the parameter name grid in the routing table, and the second row and column number of the information entry grid in the routing table, and establish a mapping relationship between the first row and column number and the second row and column number, wherein the mapping relationship is used to output the corresponding first row and column number when the second row and column number is obtained.
[0017] Further, the step of calling the routing table according to the preset path and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table includes:
[0018] The second row and column numbers of all the information entry grids in the routing table are obtained, and the information entry grids with the same row number in all the second row and column numbers are combined to obtain each task group.
[0019] Sequentially obtain the second row and column numbers of the targets in each of the task groups, and match the corresponding first row and column numbers of the targets according to the mapping relationship;
[0020] According to the target first row and column number and the target second row and column number, the corresponding parameter name and the target parameter data are obtained, wherein the parameter name and the target parameter data include the corresponding message routing information, the sending parameter information, the receiving parameter information and the target CAN network information.
[0021] Further, the step of converting the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into corresponding routing codes includes:
[0022] Obtaining a preset code template, and determining a preset fill-in position in the preset code template;
[0023] The parameter name and the target parameter data are obtained, the parameter name is matched with the corresponding preset fill-in position, and the target parameter data corresponding to the parameter name is filled into the preset code template to obtain the routing code.
[0024] Furthermore, the step of obtaining the second row and column numbers of all the information entry grids in the routing table, and combining the information entry grids with the same row number among all the second row and column numbers to obtain each task group includes:
[0025] Acquire each of the first areas and determine a target first area;
[0026] Determining a target parameter name format according to the target first area;
[0027] According to the target parameter name grid, determine the target information entry grid, and obtain the first parameter data corresponding to the target information entry grid;
[0028] Acquire the target information entry grid having the same first parameter data, and determine the corresponding target row and column numbers;
[0029] The task groups are sorted according to the target row and column numbers.
[0030] Furthermore, the message routing information is composed of direct message routing sub-information, modified period message routing sub-information and signal routing sub-information.
[0031] A second aspect of an embodiment of the present invention provides a CAN routing function implementation system, the system comprising:
[0032] A routing table establishment module, used to establish a routing table and store the routing table to a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information;
[0033] An information acquisition module, used to call the routing table according to the preset path, and obtain the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table;
[0034] A conversion module, used to convert the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into a corresponding routing code;
[0035] The target code generation module is used to obtain the basic code and the routing code, and combine the basic code and the routing code according to the preset coding rules to generate the target code, and the target code is used to be transmitted to the CAN routing software to realize the corresponding CAN routing function.
[0036] A third aspect of an embodiment of the present invention provides a computer-readable storage medium, including:
[0037] The readable storage medium stores one or more programs, which, when executed by the processor, implement the CAN routing function implementation method of the first aspect.
[0038] A fourth aspect of an embodiment of the present invention provides an electronic device, the electronic device comprising a memory and a processor, wherein:
[0039] The memory is used to store computer programs;
[0040] When the processor is used to execute the computer program stored in the memory, the CAN routing function implementation method of the first aspect is implemented.
[0041] The present invention proposes a method and system for realizing a CAN routing function. A routing table is established and stored in a preset path. The routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information. According to the preset path, the routing table is called, and the message routing information, sending parameter information, receiving parameter information and target CAN network information in the routing table are obtained. The message routing information, sending parameter information, receiving parameter information and target CAN network information are converted into corresponding routing codes. Basic codes and routing codes are obtained, and the basic codes and routing codes are combined according to preset coding rules to generate target codes. The target codes are used to be transmitted to CAN routing software to realize the corresponding CAN routing function. Specifically, after the CAN gateway routing function is realized for the first time, when there is a need to change the routing table again, there is no need to manually write codes, which can greatly improve development efficiency and is not prone to errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a flow chart of a method for implementing a CAN routing function provided by the first embodiment of the present invention;
[0043] Figure 2 It is a structural diagram of a system for realizing a CAN routing function provided by a second embodiment of the present invention;
[0044] Figure 3 It is a structural block diagram of an electronic device provided by the third embodiment of the present invention.
[0045] The following specific implementation manner will be further described in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0046] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0047] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0049] Embodiment 1
[0050] See also Figure 1 , Figure 1 The CAN routing function implementation method provided by the first embodiment of the present invention is shown, and the method specifically includes steps S01 to S04.
[0051] Step S01, establishing a routing table, and storing the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information, and target CAN network information.
[0052] In this embodiment, the routing table requirements are organized into a table in a specific format, such as an Excel table. Specifically, a blank Excel table is first obtained, and the blank table is divided into four areas according to the columns of the blank table, namely, a message area, a sending area, a receiving area, and a target CAN area. For example, columns A and B in the blank table are message areas, columns C to T in the blank table are sending areas, columns U to AM in the blank table are receiving areas, and columns AN to AQ in the blank table are target CAN areas. The message area, the sending area, the receiving area, and the target CAN area are respectively represented by For storing message routing information, sending parameter information, receiving parameter information and target CAN network information, wherein the message routing information is composed of direct message routing sub-information, modified period message routing sub-information and signal routing sub-information, and the direct message routing sub-information, modified period message routing sub-information and signal routing sub-information all have their corresponding sending parameter information, receiving parameter information and target CAN network information. Specifically, according to the sub-information of the message routing information, the sending parameter information, the receiving parameter information and the destination to which the sub-information is to be finally transmitted during the transmission of the sub-information, i.e., the target CAN network information, are determined.
[0053] Furthermore, according to the rows of the blank table, the message area, the sending area, the receiving area and the target CAN area are respectively divided into at least a first area and a second area, the first area includes a plurality of parameter name grids, the parameter name grids are used to store the parameter names of each information, the second area includes a plurality of information entry grids, the information entry grids are used to store the parameter data corresponding to the parameter names, for example, the message area, the sending area, the receiving area and the first area of the target CAN area are located in rows 1 to 4 of the blank table, wherein various parameter names can be added to the parameter name grids in rows 1 to 4 according to user needs, including English abbreviations, Chinese explanations, etc., in addition, starting from row 5 of the blank table, there are the second areas of the message area, the sending area, the receiving area and the target CAN area.
[0054] After the first area and the second area are determined, the user fills in the target parameter data in the information entry grid in the second area according to the CAN routing function requirements to complete the establishment of the routing table.
[0055] Step S02: calling the routing table according to the preset path, and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table.
[0056] It should be noted that before calling the routing table and obtaining the information therein, a mapping relationship needs to be established. Specifically, the first row and column number of the parameter name grid in the routing table and the second row and column number of the information entry grid in the routing table are obtained, and a mapping relationship between the first row and column number and the second row and column number is established. The mapping relationship is used to output the corresponding first row and column number when the second row and column number is obtained. It can be understood that, for example, the first row and column number of the parameter name grid in the routing table is 1A to 4A, and the information entry grids after 5A can be mapped with 1A to 4A respectively. When the parameter data in the information entry grid after 5A is obtained, the parameter name of the parameter name grid in the first row and column number 1A to 4A corresponding to the parameter data can be obtained.
[0057] In this embodiment, the parameter names in the message routing information may be Signal Name and RoutingType, the parameter data corresponding to the Signal Name may be EMS_EngSpeed, EMS_AirCompressorStatus, EMS_BrkPedalStasus, etc., the parameter data of the Routing Type may be Message, Cycle Message, and Signal, the parameter names in the sending parameter information may be Subnet, ECU, Msg Name, Msg Type, Msg FDF, MsgID, Msg Length[Byte], Send Type, etc., the parameter names in the receiving parameter information may be Msg Name, MsgFDF, MsgID, Msg Length[Byte], Send Type, etc., and the parameter names in the target CAN network information may be PCAN, CCAN, BCAN, and TCAN.
[0058] After the mapping relationship is established, the second row and column numbers of all information entry grids in the routing table are obtained, and the information entry grids with the same row number in all the second row and column numbers are combined to obtain each task group. It can be understood that a row in the second area of the routing table corresponds to a task group. A task group can realize a CAN routing function, and a task group contains message routing information, sending parameter information, receiving parameter information and target CAN network information. Then the target second row and column numbers in each task group are obtained in turn, and the corresponding target first row and column numbers are matched according to the mapping relationship. According to the target first row and column number and the target second row and column number, the corresponding parameter name and target parameter data are obtained, wherein the parameter name and target parameter data contain the corresponding message routing information, sending parameter information, receiving parameter information and target CAN network information.
[0059] In addition, after obtaining each task group, in order to make the execution of the task group more coherent rather than jumpy, specifically, each first area is obtained, and the target first area is determined. For example, in the first areas corresponding to the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information, the first area corresponding to the sending parameter information is determined as the target first area, and then based on the target first area, the target parameter name grid is determined, for example, the parameter name grid corresponding to the data source bus is determined as the target parameter name grid, and then the target information entry grid is determined based on the target parameter name grid, and the first parameter data corresponding to the target information entry grid is obtained.
[0060] Furthermore, a target information entry grid with the same first parameter data is obtained, and the corresponding target row and column numbers are determined. Then, the task group is sorted according to the target row and column numbers. It can be understood that the target parameter name grid is the data source bus, and the first parameter data that can be entered in the target information entry grid corresponding to the data source bus is PCAN, CCAN, BCAN and TCAN. The target information entry grid which is also PCAN is obtained, and the target row and column numbers are determined. According to the row numbers of the target row and column numbers, the target information entry grids are sorted in order from small to large. Since the target information entry grid sends changes, other information entry grids in the same row as the target information entry grid also follow the changes, thereby completing the sorting of the task group.
[0061] Step S03, converting the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into corresponding routing codes.
[0062] Specifically, a preset code template is obtained, wherein the preset code template can be written in Python language, allows reading and parsing of the CAN routing table, and generates CAN routing table related code. After obtaining the preset code template, the preset fill-in position in the preset code template is determined, and then the parameter name and the target parameter data corresponding to the parameter name are obtained, the parameter name and the corresponding preset fill-in position are matched one by one, and the target parameter data corresponding to the parameter name is filled into the preset code template to obtain the routing code, wherein a row in the second area in the routing table corresponds to a routing code.
[0063] Step S04, obtaining the basic code and the routing code, and combining the basic code and the routing code according to a preset coding rule to generate a target code, and the target code is used to be transmitted to the CAN routing software to implement the corresponding CAN routing function.
[0064] Among them, the basic code is the code that implements the complete CAN routing function and is used to drive the normal operation of the software.
[0065] In summary, the CAN routing function implementation method provided in the first embodiment of the present invention is to establish a routing table and store the routing table to a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information; according to the preset path, the routing table is called, and the message routing information, sending parameter information, receiving parameter information and target CAN network information in the routing table are obtained; the message routing information, sending parameter information, receiving parameter information and target CAN network information are converted into corresponding routing codes; the basic code and the routing code are obtained, and the basic code and the routing code are combined according to preset coding rules to generate a target code, and the target code is used to be transmitted to the CAN routing software to implement the corresponding CAN routing function. Specifically, after the CAN gateway routing function is implemented for the first time, when there is a need to change the routing table again, there is no need to manually write code, which can greatly improve development efficiency and is not prone to errors.
[0066] Embodiment 2
[0067] See also Figure 2 , Figure 2 2 is a block diagram of a CAN routing function implementation system provided by the second embodiment of the present invention. The CAN routing function implementation system 200 comprises: a routing table establishment module 21, an information acquisition module 22, a conversion module 23 and a target code generation module 24, wherein:
[0068] A routing table establishment module 21 is used to establish a routing table and store the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information;
[0069] An information acquisition module 22, used to call the routing table according to the preset path, and obtain the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table;
[0070] A conversion module 23, used to convert the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into a corresponding routing code;
[0071] The target code generation module 24 is used to obtain the basic code and the routing code, and combine the basic code and the routing code according to a preset coding rule to generate a target code, and the target code is used to be transmitted to the CAN routing software to realize the corresponding CAN routing function.
[0072] Furthermore, in other embodiments of the present invention, the routing table establishing module 21 includes:
[0073] A first division unit is used to obtain a blank table, and divide the blank table into four areas according to the columns of the blank table, namely a message area, a sending area, a receiving area and a target CAN area, wherein the message area, the sending area, the receiving area and the target CAN area are used to store the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information respectively;
[0074] a second division unit, for dividing the message area, the sending area, the receiving area and the target CAN area into at least a first area and a second area according to the rows of the blank table, wherein the first area includes a plurality of parameter name grids, the parameter name grids are used to store parameter names of various information, and the second area includes a plurality of information entry grids, the information entry grids are used to store parameter data corresponding to the parameter names;
[0075] The input unit is used to fill in the target parameter data in the information input grid in the second area according to the CAN routing function requirements to complete the establishment of the routing table.
[0076] Furthermore, in other embodiments of the present invention, the CAN routing function implementation system 200 further includes:
[0077] A mapping relationship establishment module is used to obtain the first row and column number of the parameter name grid in the routing table, and the second row and column number of the information entry grid in the routing table, and establish a mapping relationship between the first row and column number and the second row and column number. The mapping relationship is used to output the corresponding first row and column number when the second row and column number is obtained.
[0078] Furthermore, in other embodiments of the present invention, the information acquisition module 22 includes:
[0079] The combining unit is used to obtain the second row and column numbers of all the information entry grids in the routing table, and combine the information entry grids with the same row number in all the second row and column numbers to obtain each task group.
[0080] A first matching unit, used for sequentially acquiring the second row and column numbers of the targets in each of the task groups, and matching the corresponding first row and column numbers of the targets according to the mapping relationship;
[0081] The first acquisition unit is used to acquire the corresponding parameter name and the target parameter data according to the target first row and column number and the target second row and column number, wherein the parameter name and the target parameter data include the corresponding message routing information, the sending parameter information, the receiving parameter information and the target CAN network information.
[0082] Furthermore, in other embodiments of the present invention, the conversion module 23 includes:
[0083] A preset filling position determining unit, used to obtain a preset code template and determine a preset filling position in the preset code template;
[0084] The second matching unit is used to obtain the parameter name and the target parameter data, match the parameter name with the corresponding preset filling position, and fill the target parameter data corresponding to the parameter name into the preset code template to obtain the routing code.
[0085] Furthermore, in other embodiments of the present invention, the information acquisition module 22 further includes:
[0086] a target first region determining unit, configured to obtain each of the first regions and determine a target first region;
[0087] a target parameter name format determining unit, configured to determine a target parameter name format according to the target first area;
[0088] A second acquisition unit, configured to determine a target information entry grid according to the target parameter name grid, and acquire first parameter data corresponding to the target information entry grid;
[0089] A target row and column number determination unit, used to obtain the target information entry grid having the same first parameter data and determine the corresponding target row and column number;
[0090] A sorting unit is used to sort the task groups according to the target row and column numbers.
[0091] Embodiment 3
[0092] Another aspect of the present invention provides an electronic device, see Figure 3 , shown is a structural block diagram of an electronic device in the third embodiment of the present invention, including a memory 20, a processor 10, and a computer program 30 stored in the memory and executable on the processor. When the processor 10 executes the computer program 30, the CAN routing function implementation method as described above is implemented.
[0093] In some embodiments, the processor 10 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 20, such as executing access restriction programs.
[0094] The memory 20 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 20 may be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the memory 20 may also be an external storage device of an electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 20 may also include both an internal storage unit of the electronic device and an external storage device. The memory 20 may be used not only to store application software and various types of data of the electronic device, but also to temporarily store data that has been output or is to be output.
[0095] It should be pointed out that Figure 3 The structure shown does not constitute a limitation on the electronic device. In other embodiments, the electronic device may include fewer or more components than those shown in the figure, or combine certain components, or arrange the components differently.
[0096] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for realizing the CAN routing function as described above is implemented.
[0097] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0098] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0099] It should be understood that the various parts of the present invention can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data state, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0100] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0101] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the attached claims.
Claims
1. A method for implementing a CAN routing function, characterized in that: The method comprises: Establishing a routing table and storing the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information; According to the preset path, calling the routing table, and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table; Convert the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into corresponding routing codes; The basic code and the routing code are obtained, and the basic code and the routing code are combined according to a preset coding rule to generate a target code, and the target code is used to be transmitted to the CAN routing software to realize the corresponding CAN routing function.
2. The method for implementing the CAN routing function according to claim 1, characterized in that: The steps of establishing a routing table and storing the routing table in a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information, include: Obtain a blank table, and divide the blank table into four areas according to the columns of the blank table, namely, a message area, a sending area, a receiving area and a target CAN area, wherein the message area, the sending area, the receiving area and the target CAN area are used to store the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information respectively; According to the rows of the blank table, the message area, the sending area, the receiving area and the target CAN area are respectively divided into at least a first area and a second area, wherein the first area includes a plurality of parameter name grids, and the parameter name grids are used to store parameter names of various information, and the second area includes a plurality of information entry grids, and the information entry grids are used to store parameter data corresponding to the parameter names; According to the CAN routing function requirements, the target parameter data is filled in the information entry grid in the second area to complete the establishment of the routing table.
3. The method for implementing the CAN routing function according to claim 2, characterized in that: The step of calling the routing table according to the preset path and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table includes: Obtain the first row and column number of the parameter name grid in the routing table, and the second row and column number of the information entry grid in the routing table, and establish a mapping relationship between the first row and column number and the second row and column number, wherein the mapping relationship is used to output the corresponding first row and column number when the second row and column number is obtained.
4. The method for implementing the CAN routing function according to claim 3, characterized in that: The step of calling the routing table according to the preset path and obtaining the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table includes: Obtaining the second row and column numbers of all the information entry grids in the routing table, and combining the information entry grids with the same row number among all the second row and column numbers to obtain task groups; Sequentially obtain the second row and column numbers of the targets in each of the task groups, and match the corresponding first row and column numbers of the targets according to the mapping relationship; According to the target first row and column number and the target second row and column number, the corresponding parameter name and the target parameter data are obtained, wherein the parameter name and the target parameter data include the corresponding message routing information, the sending parameter information, the receiving parameter information and the target CAN network information.
5. The method for implementing the CAN routing function according to claim 4, characterized in that: The step of converting the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into corresponding routing codes comprises: Obtaining a preset code template, and determining a preset fill-in position in the preset code template; The parameter name and the target parameter data are obtained, the parameter name is matched with the corresponding preset fill-in position, and the target parameter data corresponding to the parameter name is filled into the preset code template to obtain the routing code.
6. The method for implementing the CAN routing function according to claim 5, characterized in that: The step of obtaining the second row and column numbers of all the information entry grids in the routing table, and combining the information entry grids with the same row number among all the second row and column numbers to obtain each task group includes: Acquire each of the first areas and determine a target first area; Determining a target parameter name format according to the target first area; According to the target parameter name grid, determine the target information entry grid, and obtain the first parameter data corresponding to the target information entry grid; Acquire the target information entry grid having the same first parameter data, and determine the corresponding target row and column numbers; The task groups are sorted according to the target row and column numbers.
7. The method for implementing the CAN routing function according to claim 6, characterized in that: The message routing information is composed of direct message routing sub-information, modified period message routing sub-information and signal routing sub-information.
8. A CAN routing function implementation system, characterized in that: The system comprises: A routing table establishment module, used to establish a routing table and store the routing table to a preset path, wherein the routing table at least includes message routing information, sending parameter information, receiving parameter information and target CAN network information; An information acquisition module, used to call the routing table according to the preset path, and obtain the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information in the routing table; A conversion module, used to convert the message routing information, the sending parameter information, the receiving parameter information and the target CAN network information into a corresponding routing code; The target code generation module is used to obtain the basic code and the routing code, and combine the basic code and the routing code according to the preset coding rules to generate the target code, and the target code is used to be transmitted to the CAN routing software to realize the corresponding CAN routing function.
9. A computer-readable storage medium, characterized in that: include: The readable storage medium stores one or more programs, which, when executed by a processor, implement the CAN routing function implementation method as described in any one of claims 1-7.
10. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein: The memory is used to store computer programs; When the processor is used to execute the computer program stored in the memory, it implements the CAN routing function implementation method described in any one of claims 1-7.
Citation Information
Patent Citations
Message forwarding method and device
CN112272144A
Data message forwarding method, network node, system and storage medium
CN113746750A