Method and device for realizing message routing based on AUTOSAR
By configuring the signal routing method in the communication layer and changing the message period, the problem of inconsistent receiving and transmitting periods in message routing in the automotive CAN network is solved, which improves transmission efficiency and reliability and complies with the AUTOSAR specification.
Patent Information
- Application Number
- CN202410797090.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-06
AI Technical Summary
In the automotive CAN network, there is a problem of inconsistent cycles between the receiving end and the sending end in message routing, resulting in limited information transmission efficiency and reliability.
By configuring the signal routing mode in the communication layer and changing the message cycle to make it consistent with the sender's cycle, message routing is implemented in the interface layer and the problem of cycle inconsistency is solved.
It realizes the matching of the receiving end and sending end cycles in message routing, improves the efficiency and reliability of information transmission, and complies with the AUTOSAR specification.
Smart Images

Figure CN118612134A
Abstract
Description
Technical Field
[0001] The present invention relates to network communication technology, and in particular to a method and device for realizing message routing based on AUTOSAR. Background Art
[0002] In automobiles, CAN (Controller Area Network) is a bus technology used to achieve communication between various control units. It allows real-time and efficient data exchange between different control units to ensure coordinated operation between various vehicle systems. CAN network has the characteristics of high speed, high reliability, and multiple master stations, and is the preferred technology for automotive communication.
[0003] Routing usually refers to the process of selecting a path to transmit data from a source address to a destination address. In automotive CAN networks, routing refers more to how to ensure that information is transmitted between the correct control units, that is, the information distribution and delivery strategy.
[0004] In the CAN network, routing generally includes: signal routing and message routing. The main difference between the two is that in signal routing, it generally involves parsing the signal in the message and extracting the information that needs to be forwarded, and then repackaging only the signal that needs to be forwarded and sending it to the specified network again. In this routing method, the gateway needs to judge the content in the message and add or modify the value as needed. In message routing, the gateway does not process the received message and directly forwards it to the specified CAN network.
[0005] like Figure 1 As shown in FIG. 1 , it is a schematic diagram of an architecture of a method for implementing message routing based on AUTOSAR (AUTomotive Open System Architecture). Figure 1 As shown, in the AUTOSAR architecture, it includes: an interface layer 10 and a PDUR (Protocol Data Unit Router) layer 20. The interface layer 10 includes two CAN interfaces, namely CAN01 and CAN02. Figure 1In the structure, assuming that message XX_1 is set to use message routing, after message XX_1 is received by CAN01, it is routed to CAN02 via PDUR layer 20, and then sent out from CAN02. When message XX_1 is routed via PDUR layer 20, PDUR layer 20 does not process message XX_1 in any way but directly converts it to CAN02 and sends it out. Therefore, the period of CAN01 (receiving end) receiving the message is consistent with the period of CAN02 (sending end) sending the message, as shown in the figure, both are 20ms. In other words, in message routing, it is impossible to handle the situation where the periods of the sending end and the receiving end are inconsistent. Summary of the invention
[0006] An AUTOSAR-based method and device for implementing message routing in an embodiment of the present invention can solve the problem of inconsistent periods at both ends in message routing.
[0007] An AUTOSAR-based method for implementing message routing according to an embodiment of the present invention comprises: when a message is a message of a message routing type, and the periods of a receiving end and a sending end of the message in an interface layer are inconsistent, configuring the message to be routed from the receiving end to the sending end via a communication layer, wherein the period of the message at the receiving end is a first period, and the period of the message at the sending end is a second period; and configuring a source signal and a destination signal routed in a signal routing manner for the message in the communication layer, wherein in the signal routing, the contents of the source signal and the destination signal are consistent, and the sending period of the destination signal is the second period.
[0008] In some embodiments, the method further includes: when the message is a message routing type message and the periods of the message at the receiving end and the sending end in the interface layer are consistent, configuring the message to be routed from the receiving end to the sending end via the PDUR layer.
[0009] In some implementations, based on the CAN communication matrix table, it is determined whether the message is a message of the message routing type, and it is determined whether the periods of the receiving end and the sending end of the message in the interface layer are consistent.
[0010] An AUTOSAR-based method for implementing message routing according to an embodiment of the present invention includes: a communication layer receives a message from a receiving end in an interface layer, the message is a message of a message routing class, and the period of the message is a first period; and the communication layer routes the message to a sending end in the interface layer in a signal routing manner; in the signal routing, the content of the message remains unchanged, the period of the message is changed to a second period, and the second period is different from the first period.
[0011] In some embodiments, the step of the communication layer routing the message to the sending end in the interface layer in a signal routing manner includes: carrying the content of the message in a source signal; routing the content of the source signal to a destination signal in the signal routing manner, and the content of the source signal and the destination signal are the same; and transmitting the content of the destination signal from the communication layer to the sending end in the interface layer in the second period.
[0012] In some embodiments, the method further includes: when the source signal is updated by the content of the message, setting a preset flag bit to be valid; when the preset flag bit is valid, executing the step of transmitting the content in the destination signal from the communication layer to the sending end in the interface layer in the second period.
[0013] In some embodiments, the method further includes: in the communication layer, pre-configuring a source signal and a destination signal having the same attributes, and configuring a signal routing relationship between the source signal and the destination signal, in which the source signal and the destination signal remain the same, and the sending period of the destination signal is set to the second period.
[0014] An AUTOSAR-based device for implementing message routing according to an embodiment of the present invention comprises: an interface layer, a communication layer and a PDUR layer located between the interface layer and the communication layer; the interface layer comprises: a receiving end, for receiving a message and routing the message to the PDUR layer, the message being a message of a message routing type, and the period of the message at the receiving end being a first period; the PDUR layer, for routing the message to the communication layer; the communication layer, for receiving the message from the PDUR layer, and sending the message to a sending end in the interface layer via the PDUR layer in a signal routing manner, wherein the content of the message remains unchanged in the signal routing, and the message is sent to the sending end in a second period, which is different from the first period; the sending end in the interface layer sends the message in the second period.
[0015] A computer device / equipment / system according to an embodiment of the present invention includes a memory, a processor, and a computer program / instruction stored in the memory, wherein the processor executes the computer program / instruction to implement the steps of the method according to the embodiment of the present invention.
[0016] A computer-readable storage medium according to an embodiment of the present invention stores a computer program / instruction thereon, and when the computer program / instruction is executed by a processor, the steps of the method according to the embodiment of the present invention are implemented.
[0017] A computer program product according to an embodiment of the present invention includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method according to the embodiment of the present invention are implemented.
[0018] Beneficial effects of the embodiments of the present invention:
[0019] In an embodiment of the present invention, message routing messages are routed via the communication layer rather than the PDUR layer, and the message routing is processed in a signal routing manner at the communication layer to change the message period, so that the periods of the message at the receiving end and the sending end in the interface layer can be inconsistent, thereby solving the problem of inconsistent periods at both ends in message routing. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Other details and advantages of the present invention will become apparent from the detailed description provided below. It should be understood that the following drawings are merely illustrative and thus cannot be considered as limiting the present invention, and the following will be described in detail with reference to the drawings, wherein:
[0021] Figure 1 It is a schematic diagram of the architecture of the existing AUTOSAR-based message routing implementation method;
[0022] Figure 2 It is a schematic diagram of the architecture of the method for implementing message routing based on AUTOSAR according to an embodiment of the present invention;
[0023] Figure 3 It is a flow chart of a method for implementing message routing based on AUTOSAR according to an embodiment of the present invention;
[0024] Figure 4 It is a flowchart of a method for implementing message routing based on AUTOSAR according to another embodiment of the present invention;
[0025] Figure 5 yes Figure 4 Schematic diagram of the process of the embodiment of step S42;
[0026] Figure 6 It is a schematic diagram of the structure of an embodiment of a computer device capable of implementing message routing of the present invention. DETAILED DESCRIPTION
[0027] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer and more understandable, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.
[0028] In the description of the present invention, it is to be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be understood 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 one or more of the features. Moreover, the terms "first", "second", etc. are applicable to distinguishing similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0029] like Figure 2 FIG. 1 is a schematic diagram of an architecture of an implementation method of message routing based on AUTOSAR according to an embodiment of the present invention. The method can be applied to devices such as a central computing unit, a regional controller, and an ECU (electronic control unit) in a vehicle.
[0030] exist Figure 2 The architecture includes: an interface layer 10 at the bottom, a PDUR layer 20 at the middle and a communication (COM) layer 30 at the top.
[0031] The interface layer may be, for example, a CANIF (Can Interface) layer, which may include a receiving end 101 and a transmitting end 102. Both the receiving end 101 and the transmitting end 102 may be CAN interfaces. The messages referred to in this embodiment may all be CAN messages, and may be periodic CAN messages. The receiving end 101 may receive messages from other network nodes, and then route the messages to the corresponding transmitting end 102, and send the messages from the transmitting end 102 to other nodes in the network.
[0032] exist Figure 2 In the architecture, multiple routing modes such as signal routing and message routing can be supported. Generally, the routing path of signal routing is: receiving end 101->PDUR layer 20->communication layer 30->PDUR layer 20->sending end 102. The routing path of message routing is: receiving end 101->PDUR layer 20->sending end 102. However, for message routing with inconsistent periods on the receiving and sending sides, for example, Figure 2 In the example, the period of message XX_1 at the receiving end 101 is 20ms, and the period at the sending end 102 is 100ms. The periods at both ends are inconsistent. This embodiment can adopt the routing path of: receiving end 101->PDUR layer 20->communication layer 30->PDUR layer 20->sending end 102, and change the period of the message in the communication layer 30 to match the period of the sending end 102.
[0033] This approach not only complies with the AUTOSAR specification, but also solves the problem of how to support inconsistent periods at both ends of the message routing. Figures 3 to 5 The method flow shown is used to explain the solution of the embodiment of the present invention in more detail.
[0034] like Figure 3 FIG. 1 is a flow chart of an embodiment of a method for implementing message routing based on AUTOSAR of the present invention, which includes the following steps:
[0035] Step S30: Identify whether the message belongs to the message routing class. If yes, execute step S32.
[0036] Step S32: Identify whether the periods of the message at the receiving end and the sending end are consistent. If not, execute step S34; if consistent, execute step S36.
[0037] In step S30 and step S32, it can be determined based on the CAN communication matrix table whether the message is a message routing type message, and whether the periods of the receiving end and the sending end of the message in the interface layer are consistent.
[0038] Among them, the CAN communication matrix is a table used to describe the detailed information of CAN communication in the vehicle network, which generally includes a basic information part and a signal definition part. The basic information part generally summarizes the overall characteristics of the message, such as its name, ID (used to uniquely identify the message), type (whether it is periodic transmission, event triggering, or both), message period (sender's period, receiver's period), message length, routing type (message routing, signal routing), etc. The signal definition part describes each signal in the message in detail.
[0039] When it is determined based on the CAN communication matrix table that the message is a message routing type message and the periods of the sending end and the receiving end are inconsistent, the configuration can be performed in step S34 to support message routing with inconsistent periods at both ends.
[0040] Step S34: configure the message to be routed from the receiving end to the sending end via the communication layer, and configure the source signal and destination signal routed in the signal routing manner for the message in the communication layer, and in the signal routing, the contents of the source signal and the destination signal are consistent, and the sending period of the destination signal is equal to the period of the message at the sending end.
[0041] Combination Figure 2In step S34, the configuration can be made so that when the receiving end 101 receives the message XX_1, the message XX_1 is routed to the communication layer 30 via the PDRU layer 20, and after the communication layer 30 processes the message XX_1, it is routed to the sending end 102 via the PDUR layer 20, so that the message is routed via the communication layer 30 instead of being routed directly via the PDUR layer. Generally, the interface layer 10, the PDRU layer 20 and the communication layer 30 can be linked (referenced) to the same ECUC (ECU configuration), where the ECUC is similar to a shared variable. By linking this shared variable at each layer, the link between the interface layer, the PDRU layer and the communication layer can be opened to achieve transmission via the communication layer.
[0042] In addition, a source signal and a destination signal can be pre-set in the communication layer 30, and the signal routing relationship between the source signal and the destination signal can be configured. The source signal can be used to store the content of the message reported by the sending end 101, and then the content of the source signal is routed to the destination signal, and the destination signal is transmitted to the sending end 102 via the PDUR layer 20 at the cycle of the message at the sending end 102. Specifically, the configuration process can be implemented through the following process:
[0043] First, two signals with the same properties are added to the communication layer, as the source signal and the destination signal respectively.
[0044] For example, the structure of a source signal can be defined as:
[0045] Signal initial value: 00 00 00 00... When a message is received, the content of the message will replace the initial value and be mapped to the destination signal.
[0046] Byte order: OPAQUE (opaque).
[0047] Signal length: such as the length of message XX_1.
[0048] Signal array type: such as UINT8_N array.
[0049] The format and content of the destination signal are consistent with the source signal and will not be described in detail here.
[0050] When the content of the message is updated to the source signal and the destination signal, since the source signal and the destination signal include all the fields and content of the message, it can be considered that the source signal and the destination signal are the message.
[0051] Next, the static routing relationship between the source signal and the destination signal is configured through the ComGWMapping (communication gateway mapping) container to map the source signal to the destination signal. In the mapping of this embodiment, the source signal directly maps its content to the destination signal, and the mapping does not change the content of the message.
[0052] Next, configure a callout function on the source signal side. When the message XX_1 is received, a flag bit = TRUE is set in the callout function. In addition, set the Mainfunction period of the communication layer, for example, to 5ms, that is, scan the IPDU layer at 5ms intervals to receive the message XX_1 into the source signal. Figure 2 For example, the period of message XX_1 at the receiving end is 20ms, so it takes 4 scans to receive message XX_1.
[0053] Next, set the sending period of the destination signal to Figure 2 For example, the sending period of the destination signal can be set to 100ms. In addition, a callout function is also configured on the destination signal side, and only when the above flag is = TRUE, it is sent with a period of 100ms. In addition, the above flag will be set to FALSE when the message XX_1 is not received for more than 4 times the period (80ms).
[0054] Based on the above configuration, it is possible to process message routing in a signal routing manner at the communication layer to solve the problem of inconsistent periods at both ends of message routing.
[0055] Step S36: The configuration message is routed from the receiving end to the sending end via the PDUR layer.
[0056] The configuration method for implementing message routing via the PDUR layer is familiar to those skilled in the art and will not be described in detail here.
[0057] Through the configuration scheme of this embodiment, the problem of inconsistent periods at both ends in message routing can be solved without modifying the periods of the sending end and the receiving end, and the AUTOSAR specification is met.
[0058] like Figure 4 FIG. 1 is a flow chart of a method for implementing message routing based on AUTOSAR according to another embodiment of the present invention, which includes the following steps:
[0059] Step S40: the communication layer receives a message from the receiving end in the interface layer, the message is a message of the message routing type, and the period of the message (receiving end side) is the first period.
[0060] Step S42: the communication layer routes the message to the sending end in the interface layer in a signal routing manner, and in the signal routing, the content of the message remains unchanged, and the period of the message is changed to the second period.
[0061] The message referred to in this embodiment is a message routing message, and the periods of the message at the receiving end and the sending end of the interface layer are inconsistent. By routing the message to the communication layer and changing its period by signal routing at the communication layer, the message routing with inconsistent periods at both ends of the message is supported in a manner that complies with the AUTOSAR specification.
[0062] The above signal routing can be realized in the communication layer by presetting the source signal and the destination signal in the communication layer, such as Figure 5 FIG. 4 is a flow chart of an implementation of step S42, which includes:
[0063] Step S50: Carry the content of the message in the source signal, that is, receive (update) the content of the message into the source signal.
[0064] Step S52: Routing the content of the source signal to the destination signal in a signal routing manner, and the content of the source signal and the destination signal are the same, that is, the source signal and the destination signal are mapped in a one-to-one manner without making any changes to the signal content.
[0065] Step S54: The content of the destination signal is transmitted from the communication layer to the sending end in the interface layer according to the period of the message at the sending end in the interface layer, that is, the period of the message is changed to be consistent with the period required by the sending end.
[0066] In some embodiments, when the content of the message is received into (updated into) the source signal, a preset flag bit is set to valid. Only when the preset flag bit is valid is step S54 executed to avoid transmitting an invalid destination signal to the sending end in the interface layer.
[0067] In this embodiment, the source signal, the destination signal, the signal routing relationship, etc. can all be implemented through configuration. For example, before the method of this embodiment, Figure 3 The configuration method shown in the embodiment is configured, and then the method shown in this embodiment can be implemented based on the configuration.
[0068] In addition, the embodiment of the present invention further provides a computer device 6, including a memory 60, a processor 62 and a computer program / instruction stored in the memory 60, and the processor 62 executes the computer program / instruction to implement the method of the embodiment of the present invention.
[0069] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method of the embodiment of the present invention is implemented.
[0070] In addition, an embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the method of the embodiment of the present invention when executed by a processor.
[0071] The description of the above device, storage medium and program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device, storage medium and program product embodiments of this application, please refer to the description of the method embodiment of this application for understanding.
[0072] The processor may be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, a microprocessor, etc. It is understandable that the electronic device that implements the function of the processor may also be other, and the embodiments of the present application are not specifically limited.
[0073] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0074] It should be noted that the above description is only for example and not for limitation of the present invention. In other embodiments of the present invention, the method may have more, fewer or different steps, and the order, inclusion and function of each step may be different from that described and illustrated. For example, generally multiple steps can be combined into a single step, and a single step can also be divided into multiple steps. For those of ordinary skill in the art, without paying creative work, the sequential changes of each step are also within the scope of protection of the present invention.
[0075] The technical solution of the present invention, in essence or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor or a microcontroller to perform all or part of the steps of the method described in each embodiment of the present invention.
[0076] Those skilled in the art will appreciate that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed.
[0077] Although the present invention has been disclosed as above with preferred embodiments, the present invention is not limited thereto. Any changes and modifications made by any person skilled in the art without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention, and therefore the protection scope of the present invention should be subject to the scope defined by the claims.
Claims
1. A method for implementing message routing based on AUTOSAR, It is characterized in that include: When the message is a message of the message routing type, and the periods of the receiving end and the sending end of the message in the interface layer are inconsistent, the message is configured to be routed from the receiving end to the sending end via the communication layer, the period of the message at the receiving end is a first period, and the period of the message at the sending end is a second period; as well as In the communication layer, a source signal and a destination signal routed in a signal routing manner are configured for the message, and in the signal routing, the contents of the source signal and the destination signal are consistent, and the sending period of the destination signal is the second period.
2. The method for implementing message routing based on AUTOSAR as claimed in claim 1, It is characterized in that The method further comprises: When the message is a message routing type message, and the periods of the message at the receiving end and the sending end in the interface layer are consistent, the message is configured to be routed from the receiving end to the sending end via the PDUR layer.
3. The method for implementing message routing based on AUTOSAR as claimed in claim 1 or 2, It is characterized in that Based on the CAN communication matrix table, it is determined whether the message is a message of the message routing type, and it is determined whether the periods of the receiving end and the sending end of the message in the interface layer are consistent.
4. A method for implementing message routing based on AUTOSAR, It is characterized in that include: The communication layer receives a message from a receiving end in the interface layer, wherein the message is a message of a message routing type, and a period of the message is a first period; as well as The communication layer routes the message to the sending end in the interface layer in a signal routing manner; In the signal routing, the content of the message remains unchanged, and the period of the message is changed to a second period, which is different from the first period.
5. The method for implementing message routing based on AUTOSAR as claimed in claim 4, It is characterized in that The step of routing the message to the sending end in the interface layer in a signal routing manner by the communication layer includes: Carrying the content of the message in the source signal; Routing the content of the source signal to the destination signal in the signal routing manner, wherein the content of the source signal and the destination signal are the same; and In the second cycle, the content of the destination signal is transmitted from the communication layer to the sending end in the interface layer.
6. The method for implementing message routing based on AUTOSAR as claimed in claim 5, It is characterized in that The method further comprises: When the source signal is updated by the content of the message, a preset flag bit is set to be valid; When the preset flag is valid, the step of transmitting the content of the destination signal from the communication layer to the sending end in the interface layer in the second cycle is executed.
7. The method for implementing message routing based on AUTOSAR as claimed in claim 5, It is characterized in that The method further comprises: In the communication layer, a source signal and a destination signal having the same attributes are pre-configured, and a signal routing relationship between the source signal and the destination signal is configured. In the signal routing relationship, the source signal and the destination signal remain the same, and a sending period of the destination signal is set to the second period.
8. A device for implementing message routing based on AUTOSAR, It is characterized in that include: An interface layer, a communication layer, and a PDUR layer located between the interface layer and the communication layer; The interface layer includes: a receiving end, which is used to receive a message and route the message to the PDUR layer, wherein the message is a message of a message routing type, and the period of the message at the receiving end is a first period. The PDUR layer is used to route the message to the communication layer; The communication layer is used to receive the message from the PDUR layer, and send the message to the sending end in the interface layer through the PDUR layer in a signal routing manner, wherein the content of the message remains unchanged during the signal routing, and the message is sent to the sending end in a second period, and the second period is different from the first period; The sending end in the interface layer sends the message in the second period.
9. A computer device / apparatus / system comprising a memory, a processor and a computer program / instructions stored in the memory, It is characterized in that The processor executes the computer program / instructions to implement the steps of the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program / instructions stored thereon, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
