Method, electronic device and computer program product for determining gateway node

By dynamically determining the gateway node in the vehicle network, the communication instability caused by the independent management of the DoIP gateway node is resolved, achieving a more efficient and reliable communication connection and improving network resource utilization.

CN121644446APending Publication Date: 2026-03-10BOSCH AUTOMOTIVE PRODUCTS (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, the DoIP gateway node in the vehicle network independently manages the sub-network, which leads to the inability to connect to external devices when the sub-network fails, affecting communication stability and reliability.

Method used

By performing gateway arbitration among nodes within the network, the most suitable gateway node is dynamically determined. The arbitration is conducted using node information, and the most suitable node is selected as the gateway node to forward messages.

Benefits of technology

It improves the efficiency, stability and reliability of communication connections, maximizes the use of network resources, flexibly responds to faults and special situations, and ensures the stability and high performance of the communication network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644446A_ABST
    Figure CN121644446A_ABST
Patent Text Reader

Abstract

The invention relates to the field of communication, in particular to a method for determining a gateway node, electronic equipment and a computer program product. The method is executed by a first node in a first local network in the network, and comprises the following steps: establishing a communication connection with external equipment based on a target protocol; sending a gateway arbitration message associated with the first node, wherein the gateway arbitration message associated with the first node comprises node information of the first node; in response to receiving a gateway arbitration message associated with a second node in the first local network, determining a first arbitration result based on the node information of the first node and the node information of the second node, the gateway arbitration message associated with the second node including the node information of the second node; and determining, based at least on the first arbitration result, the first node as a gateway node or a non-gateway node, the gateway node configured to forward a message between the external device and at least one node within the corresponding local network based on the target protocol.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of communication, and in particular, to a method for determining a gateway node, an electronic device and a computer program product. BACKGROUND

[0002] For a network such as an in-vehicle network, there can be a plurality of electronic devices inside the network, which can be interconnected and communicated based on one or more protocols. When it is needed to access one or more electronic devices inside the network through an external device, for example, when it is needed to test, repair, upgrade software, etc. of the electronic devices, a connection can be established between the external device and the one or more electronic devices to be accessed, and a communication interaction can be performed. To improve the interaction efficiency and guarantee the communication security, the information interaction between the external device and the one or more electronic devices inside the network can be implemented by means of a gateway supporting a target protocol. In this case, the performance of the gateway will greatly affect the efficiency, stability and reliability of the information interaction. SUMMARY

[0003] Therefore, the present disclosure provides a method for determining a gateway node, an electronic device and a computer program product, which can solve or at least alleviate the above problems.

[0004] According to an aspect of the present disclosure, a method for determining a gateway node is provided, the method is performed by a first node in a first local network in a network, wherein the network comprises at least one local network, and the method comprises: establishing a communication connection with an external device based on a target protocol; sending a gateway arbitration message associated with the first node, wherein the gateway arbitration message associated with the first node comprises node information of the first node; in response to receiving a gateway arbitration message associated with a second node in the first local network, determining a first arbitration result based on the node information of the first node and the node information of the second node, wherein the gateway arbitration message associated with the second node comprises node information of the second node; and determining the first node as a gateway node or a non-gateway node based on at least the first arbitration result, wherein the gateway node is configured to forward a message between the external device and at least one node in a corresponding local network based on the target protocol.

[0005] According to another aspect of the present disclosure, an electronic device is provided, comprising: a memory configured to store computer executable instructions; and a processor configured to execute the method according to the foregoing aspect when the computer executable instructions are executed by the processor.

[0006] According to still another aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, which implement the steps of the method according to the foregoing aspect when executed by a processor.

[0007] The method for determining gateway nodes provided in this disclosure allows for gateway arbitration among multiple nodes within the network to be performed when establishing a communication connection with an external device, based on node information. One or more nodes, most suitable for acting as gateways, are then selected based on the arbitration results to serve as the gateway nodes for each local network. This enables dynamic determination of gateway nodes based on node information (such as node attributes or status), which helps improve the performance of the determined gateway nodes, thereby facilitating higher-performance communication connections, improving the efficiency, stability, and reliability of information exchange, and maximizing the utilization of resources across all nodes within the network.

[0008] These and other aspects of this disclosure will be apparent from the embodiments described below, and will be elucidated with reference to the embodiments described below. Attached Figure Description

[0009] Further details, features, and advantages of this disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0010] Figure 1 A schematic diagram of the architecture of the DoIP protocol in related technologies is shown;

[0011] Figure 2 An example flowchart illustrating a method for determining a gateway node according to some embodiments of the present disclosure is shown schematically;

[0012] Figure 3A , 3B 3C exemplarily illustrates a schematic diagram of a gateway arbitration process according to some embodiments of the present disclosure;

[0013] Figure 4 This schematically illustrates an example flowchart of a gateway determination scheme performed at a node according to some embodiments of the present disclosure;

[0014] Figure 5 An exemplary block diagram of an electronic device according to some embodiments of the present disclosure is illustrated schematically;

[0015] Figure 6 An example architecture diagram of a node according to some embodiments of this disclosure is illustrated schematically. Detailed Implementation

[0016] As mentioned earlier, the performance of the gateway significantly impacts the overall performance of information interaction. Taking in-vehicle networks as an example, multiple ECUs (Electronic Control Units) can exist within an in-vehicle network. These ECUs can communicate using one or more protocols, such as CAN (Controller Area Network), LIN (Local Interconnect Network), and FlexRay. In related technologies, vehicle diagnostics and ECU software updates can be performed using methods such as DoCAN (Diagnostic over CAN). However, these methods generally require specific test benches and equipment, and the process is cumbersome and slow. To address these shortcomings, the DoIP (Diagnostic communication over Internet Protocol) protocol was proposed. The DoIP protocol allows vehicle diagnostics and ECU software updates to be performed over IP networks (such as Ethernet), helping to simplify the operation process and improve operational efficiency.

[0017] Figure 1 A schematic diagram of the DoIP protocol architecture in related technologies is shown. The DoIP protocol allows the use of gateways; therefore, in principle, all ECUs in a vehicle connected via a classic bus system or network can be made available without individual connections. The gateway can act as an intermediary, forwarding requests from external devices (such as testers) to ECUs in the internal network and routing them back to the external device when a response from the corresponding ECU is available. Furthermore, the DoIP protocol adds logical addresses to the ECUs to uniquely identify each ECU, allowing external devices to more flexibly process diagnostic or software update operations for multiple ECUs in parallel without waiting for sequential responses. Figure 1As shown, in the vehicle's internal network 110, there are DoIP gateways 111-1 to 111-w, DoIP nodes 112-1 to 112-y, non-DoIP nodes 113-1 to 113-x, and ECUs 114-11 to 114-1u and ECUs 114-21 to 114-2v. DoIP gateways 111-1 to 111-w are DoIP nodes connected to both the IP-based network 130 and the non-IP-based network, enabling message routing between the tester 121 in the external network 120 and other ECUs in the internal network 110. In real-world applications, multiple DoIP gateways can be configured. DoIP gateway 111-1 is a DoIP edge node gateway, connected to the external device 121 via activation line 150, used to transmit all messages between the tester 121 and the ECUs in the internal network 110. DoIP nodes 112-1 to 112-y are DoIP-enabled nodes connected to the IP-based network 130, while non-DoIP nodes 113-1 to 113-x are DoIP-unenabled nodes connected to the IP-based network 130. ECUs 114-11 to 114-1u and ECUs 114-21 to 114-2v are ECUs connected to a non-IP-based network, where ECUs 114-11 to 114-1u are connected to a first subnetwork, and ECUs 114-21 to 114-2v are connected to a second subnetwork. The first and second subnetworks can be networks based on EAN, LIN, FlexRay, or other protocols. In the external network 120, besides the tester 121, there may be other network nodes 122-1 to 122-z connected to the IP-based network 140. In the above description, each of w, x, y, z, u, and v is a positive zero integer.

[0018] like Figure 1 As shown, each DoIP gateway can be configured for seamless interconnection between Ethernet-based diagnostic protocols and traditional automotive network protocols (such as LIN, CAN, FlexRay, etc.). When the DoIP gateway is connected to an external network (such as the Internet), it can manage the interconnection between the internal and external networks. Therefore, the DoIP gateway is a key component for interconnecting automotive systems with devices such as testers and other consumer electronics. However, by Figure 1As shown in the architecture, each DoIP gateway manages an independent subnetwork. If the DoIP gateway in a subnetwork fails, diagnostics and software updates for that subnetwork will be impossible. Even if other nodes in that subnetwork are functioning normally, they will still be unable to connect to external testing equipment. Once this type of problem occurs, remote upgrades and diagnostics will be impossible, requiring on-site troubleshooting. This negatively impacts the stability and reliability of the vehicle network's connection to external devices based on the DoIP protocol and adds extra on-site intervention.

[0019] To address the aforementioned issues, this disclosure proposes a scheme for dynamically determining the gateway. This scheme can be applied to the aforementioned vehicular networks, as well as other similar networks, such as those within buildings, ships, aircraft, or other transportation vehicles. These networks may contain devices interconnected based on different protocols, and some may connect to external devices (such as devices performing testing, diagnostics, or upgrades) based on a specific protocol. For ease of understanding, some of the following embodiments are described using a vehicular network as an example. However, it should be understood that the gateway determination scheme provided by this disclosure can be applied to any suitable network, such as other networks formed based on star topologies or other network types.

[0020] Figure 2 An example flowchart of a method 200 for determining a gateway node according to some embodiments of the present disclosure is illustrated schematically. Method 200 can be performed by a first node within a first local network in a network, wherein the network may include at least one local network. Exemplarily, the network may be, for example, the vehicular network described above, such as... Figure 1 The vehicle's internal network 110 shown can be configured such that nodes 114-11 to 114-1u and 111-1 constitute one local network, nodes 114-21 to 114-2v and 111-w constitute another local network, or nodes 114-11 to 114-1u and 111-1 and nodes 114-21 to 114-2v and 111-w can also be considered a local network, or all nodes in the internal network 110, or all nodes except the DoIP edge node gateway 111-1, can be considered a local network. In other words, a local network can be a subset of the network, or it can be the network itself. In various embodiments of this disclosure, local networks can be defined according to the needs of specific application scenarios, and this disclosure does not specifically limit the number and specific division method of local networks within the network. For example, the first node can be any node capable of connecting to external devices based on the target protocol, such as... Figure 1Any of the nodes shown that can implement DoIP, such as any one of 111-1 to 111-w and 112-1 to 112-y. Figure 2 As shown, method 200 may include steps 210 to 240, as detailed below.

[0021] In step 210, a communication connection can be established with an external device based on a target protocol. Optionally, the external device can be a device used for testing, diagnosing, and upgrading nodes within the network. The target protocol can be a communication protocol supported by the external device and at least some nodes within the network. The communication connection can be wired or wireless, and can be direct or indirect. An indirect connection can be, for example, a connection established via one or more intermediate devices. In some embodiments of this disclosure, establishing a communication connection with an external device can be understood as a process of establishing a physical link, configuring addresses, etc., to enable communication between the first node and the external device or to prepare for subsequent communication. Taking the DoIP protocol as an example, a DoIP node in the vehicle's internal network can perform steps such as physical link detection, IP configuration, and sending declaration information (such as information related to the configured IP address, node identifier, vehicle identifier, etc.) to the external device to establish a communication connection. Here, the external device can be a test device connected to the vehicle, and the connection can refer to a wired or wireless connection.

[0022] In step 220, a gateway arbitration message associated with the first node can be sent, wherein the gateway arbitration message associated with the first node may include node information of the first node. For example, the gateway arbitration message may be sent based on a target protocol, or it may be sent based on other protocols supported by the nodes within the network. Optionally, the node information of the first node may include information related to the location and network status of the first node, which can be used to determine whether the first node is suitable to act as a gateway node. Optionally, the gateway arbitration message may be sent via broadcast or other appropriate means.

[0023] In step 230, in response to receiving a gateway arbitration message associated with a second node within the first local network, a first arbitration result can be determined based on the node information of the first node and the node information of the second node. The gateway arbitration message associated with the second node may include the node information of the second node. Exemplarily, similar to the first node, other nodes in the network supporting the target protocol can also perform steps 210 and 220 above and send gateway arbitration messages associated with their respective nodes. At the first node, upon receiving a gateway arbitration message from another node (such as the second node mentioned above), arbitration can be performed based on the node information of two or more nodes according to a preset algorithm or rules, such as comparing the advantages and disadvantages of the two or more nodes to generate an arbitration result. A similar process can also occur at other nodes in the network supporting the target protocol.

[0024] For example, different local networks can be identified by including the identifier of the local network in the gateway arbitration message. For instance, the network ID (e.g., NetId) of each local network can be set according to its position order within the network, allowing each node to determine whether the node corresponding to the received gateway arbitration message is in the same local network as itself. If they are in the same local network, the arbitration operation in step 230 can be performed; if they are not in the same local network, the arbitration operation in step 230 can be skipped, and the node can continue to wait to receive other gateway arbitration messages. Thus, arbitration can be performed only within the same local network, ultimately identifying a gateway node within each local network.

[0025] In step 240, the first node can be determined as a gateway node or a non-gateway node based at least on the first arbitration result, wherein the gateway node is configured to forward messages between the external device and at least one node in the corresponding local network based on the target protocol. For example, the first arbitration result can indicate which of the first and second nodes is more suitable as a gateway node, or indicate whether the first node is superior or inferior to the second node. If the first arbitration result indicates that the first node is more suitable as a gateway node or indicates that the first node is superior or at least not inferior to the second node, the first node can be temporarily determined as a gateway node, or it can continue to receive gateway arbitration messages from other nodes and perform arbitration; if the first arbitration result indicates that the second node is more suitable as a gateway node or the first node is inferior to the second node, i.e., there is a node more suitable as a gateway than the first node, the first node can be determined as a non-gateway node, or the arbitration result can be recorded and other operations can be performed, etc. The corresponding gateway node should be understood as the local network in which the node is located. For example, if the first node is determined as a gateway node, it can forward messages between the external device and at least one node in the first local network, wherein the at least one node may include nodes that support or do not support the target protocol. Forwarding messages between an external device and at least one node in the corresponding local network based on the target protocol should be understood as follows: a message from an external device to a node in the corresponding local network can be received based on the target protocol, and the message can be forwarded to that node based on the protocol supported by that node; and a message from a node in the corresponding local network can be received based on the protocol supported by that node, and the message can be forwarded to the external device based on the target protocol.

[0026] Method 200 allows for the dynamic determination of a gateway node based on node information from various nodes within the local area network (LAN). Through the aforementioned arbitration process, one or more nodes best suited to serve as the gateway can be selected from among multiple nodes. Taking the aforementioned in-vehicle network as an example, with technological advancements, such as the development of MCUs (Microcontroller Units), in addition to traditional ECUs, other nodes with higher performance have emerged among the nodes connected to the DoIP gateway. Furthermore, the performance of some DoIP nodes has significantly improved compared to before. These nodes can effectively also function as gateways. Method 200 allows for more efficient utilization of the performance of these nodes, maximizing the use of resources from various nodes within the LAN, while simultaneously improving the performance of the determined gateway node. This results in higher-performance communication connections and enhances the efficiency, stability, and reliability of information exchange.

[0027] In some embodiments, it can also be detected whether the gateway arbitration message associated with the first node was successfully sent, that is, whether step 220 was successfully executed. In response to the failure to successfully send the message and the initial arbitration time not being reached, the gateway arbitration message associated with the first node can be resent. After resending, it can be detected again whether it was successful, and based on the detection result, it can be determined whether retransmission is necessary. This process continues until the gateway arbitration message associated with the first node is successfully sent or the initial arbitration time is reached. This allows for remediation when the gateway arbitration message is not successfully sent due to factors such as poor node status or other reasons, preventing temporary node status issues from preventing the node from successfully participating in the arbitration process. This helps ensure the fairness and reliability of the arbitration process and helps to more accurately determine the most suitable gateway node. Furthermore, in some embodiments, once it is detected that the gateway arbitration message associated with the first node has been successfully sent, this detection and retransmission action can be stopped, and subsequent arbitration procedures can continue, saving network processes and improving overall efficiency. In other words, during the initial arbitration period, each node is allowed, and only allowed, to successfully send a fixed number of gateway arbitration messages (unless, due to special circumstances, some nodes fail to send gateway arbitration messages successfully throughout the initial arbitration period). This ensures that each node sends the same number of gateway arbitration messages after power-on, thereby guaranteeing fair participation in the gateway arbitration process. Optionally, depending on the actual application scenario, the fixed number can be 1 or other positive integers. For example, the initial arbitration time can be set according to configuration parameters and can be adjustable; the entire arbitration process should end within this time period. For instance, the timing of the initial arbitration time can begin after the network completes physical link establishment, address configuration, and other operations. During this initial arbitration period, each node can send gateway arbitration messages and participate in the gateway arbitration process according to the methods described in some embodiments of this disclosure. After the initial arbitration time ends, each node can perform corresponding functions according to its role (gateway or non-gateway) determined during the gateway arbitration process.

[0028] In some embodiments, the node information of the first and second nodes may include at least one of the following attribute values: the identifier of the local network in which the node is located, the node type, the distance between the node and the edge gateway node in the local area network, the network congestion level at the node, the node's preset priority, and the combined distance between the node and other nodes in the local area network. For example, the node information of each node may include the listed attribute values ​​in the order listed above. Exemplarily, the identifier of the local network in which the node is located may be the ID of the local network mentioned in the preceding embodiments or other identifier data. Optionally, when there is only one local network in the network, or when the network is not further divided into local networks, the attribute value regarding the local network identifier may not be set. The node type may refer to the type of node device, such as what function it is designed to perform, for example, the node type may indicate whether the node is a gateway node or a non-gateway node. The distance between the node and the edge gateway node may be a physical distance, or may be measured by the number of nodes in between or in other ways, wherein the edge gateway node may refer to a node that includes a communication interface between the local area network and external devices, such as Figure 1 The DoIP edge node gateway 111-1 shown includes an interface connected to an external device 121 via an activation line 150. The network congestion level at a node can be measured and determined by throughput, latency, etc. Optionally, the network congestion level can be described as the presence of network congestion, divided into one of several preset levels, or characterized by the aforementioned throughput, latency, etc. The preset priority of a node can be a pre-set priority for acting as a gateway node. Optionally, the preset priority can be pre-determined for each node based on its location, performance, etc. The comprehensive distance between a node and other nodes in the local area network can optionally be determined based on the sum, average, or weighted average of the distances between the node and all other nodes in the local area network, or it can be determined based on other rules. These attribute values ​​can more accurately reflect the current comprehensive performance conditions of a node, thereby more accurately reflecting its suitability as a gateway node. Furthermore, in some embodiments, the node information may also include coefficients corresponding to each attribute value in the node information. These coefficients can control the weight of different attribute values ​​in determining the arbitration result, helping to improve the accuracy of the arbitration result.

[0029] For example, each node supporting the target protocol can maintain a matrix that includes the aforementioned attribute values ​​and coefficients for each attribute value to indicate the node's priority as a gateway node. During the aforementioned arbitration process, a first arbitration result can be determined based on the data in the matrices maintained by each node to determine the actual priority of each node as a gateway node. Further exemplarily, the determination of the first arbitration result can be based on a preset algorithm, such as a pre-defined Best Gateway Selection Algorithm (BGSA), which can comprehensively compare the advantages and disadvantages of two or more nodes based on the attribute values ​​and coefficients in their matrices to determine the most suitable node for gateway status. For example, when using the BGSA algorithm, firstly, a weighted sum of at least some attribute values ​​in the corresponding matrix can be calculated for each node, that is, each attribute value in at least some of the attribute values ​​is multiplied by its corresponding coefficient and all products are summed to obtain a score corresponding to each node. Then, the scores can be compared to determine which node is more suitable as a gateway. For example, the node with the higher score can be identified as the more suitable node as a gateway. Alternatively, before calculating the weighted sum, some of the attribute values ​​and / or coefficients can be preprocessed, and the weighted sum can be calculated based on the preprocessed attribute values ​​and coefficients. Or, other mechanisms can be used to determine the score corresponding to each node based on the attribute values ​​and coefficients. Further exemplarily, if nodes with the same score exist, a more suitable node can be selected as the gateway based on one or more attribute values ​​or other conditions. For example, the node types of nodes with the same score can be examined, and nodes with the gateway node type can be prioritized as more suitable gateway nodes. When the node types are also the same, one node can be selected based on its logical address; for example, the node with the smaller logical address can be prioritized as more suitable gateway node. As further exemplarily, since arbitration is performed only for nodes in the same local network in step 230, the attribute of the identifier of the local network in which the node is located and its coefficient may not be included when calculating the weighted sum. Alternatively, the attribute may be included normally, but since nodes in the same local network may have the same score on the attribute (when the coefficients of each node for the attribute are the same), the attribute will not affect the first arbitration result.

[0030] In some embodiments, step 240 may include: in response to a first arbitration result indicating that the first node is more suitable as a gateway node than the second node, and the initial arbitration time has not been reached, waiting to receive other gateway arbitration messages; and in response to a first arbitration result indicating that the first node is more suitable as a gateway node than the second node, and the initial arbitration time has been reached, determining the first node as the gateway node. Exemplarily, during the initial arbitration time, each node may receive gateway arbitration messages from other nodes and determine the arbitration result based on a preset algorithm (such as the BGSA algorithm described above). If the arbitration result indicates that the current node is more suitable as a gateway node (e.g., BGSA WIN), it may continue to wait for gateway arbitration messages from other nodes. If no other node more suitable as a gateway node is encountered until the end of the initial arbitration time, the arbitration is considered successful, and the current node will be determined as the gateway node. Through the above arbitration logic, it is possible to ensure that at least one direct or indirect arbitration is performed between each node and all other nodes or at least most of the nodes, thereby more accurately determining the most suitable gateway node. Furthermore, by setting the initial arbitration time appropriately, the sufficiency of arbitration between nodes can be ensured, thereby determining the most suitable gateway node. At the same time, the total duration of the arbitration process can be limited to avoid affecting the overall communication efficiency due to excessively long arbitration times.

[0031] For example, Figure 3A An example architecture diagram of a communication network is shown, including an external device 310, an edge gateway node 320, nodes 331-337 implementing a target protocol, and nodes 341, 342, and 351 based on other protocols. Exemplarily, the target protocol could be the DoIP protocol, nodes 341 and 342 could be CAN-based nodes, and node 351 could be a LIN-based node. When nodes 331-337 join the network, i.e., after a proposed connection is made with external device 310, method 200 can be executed at each node according to the various embodiments described above, and one or more gateway nodes can be identified. Exemplarily, as... Figure 3B As shown, two gateway nodes 361 and 362 can be identified. These two nodes may have an advantage in one or more of the following factors: distance to the edge gateway node, preset priority, and overall distance to other nodes. Subsequently, the two gateway nodes 361 and 362 can each be responsible for information exchange between nodes within their respective subnetworks and external devices 310, enabling external devices 310, such as testers, to access every node in the local area network through the edge gateway node 320 and the identified gateway nodes 361 and 362.

[0032] In some embodiments, after a first node is determined to be a gateway node, a gateway synchronization message associated with the first node can be broadcast periodically. This gateway synchronization message may include node information of the first node. For example, the gateway synchronization message may be broadcast based on a target protocol, or it may be broadcast based on other protocols supported by nodes within the local area network. By periodically broadcasting gateway synchronization messages, the current status of the gateway node can be notified to other nodes within the local area network (and, optionally, external devices) in real time. This allows other nodes to determine in real time whether the current gateway node is available and whether it needs to be replaced, which helps to promptly detect gateway failures or other special situations and facilitates timely and adaptive handling of related situations, thereby improving the stability and reliability of the overall communication network. For example, similar to the aforementioned gateway arbitration message, the gateway synchronization message may also include node information of the corresponding node, and this node information may include one or more of the attribute values ​​mentioned in the preceding embodiments, the coefficients of the attribute values, and / or other additional information, which will not be elaborated further here.

[0033] Furthermore, exemplarily, after the first node is determined to be a gateway node, it can also receive gateway synchronization messages from other gateway nodes, synchronize the recorded data of each gateway based on the received messages, and perform other related operations. In this case, although the first node is a gateway node, the operations it performs on gateway synchronization messages from other gateways can be consistent with the operations of non-gateway nodes described in the following embodiments, and therefore will not be elaborated further here.

[0034] In some embodiments, after a first node is determined to be a gateway node, in response to receiving a gateway arbitration message associated with a third node, the first node can be changed from a gateway node to a non-gateway node, and the gateway information can be updated based on the node information of the third node. The gateway arbitration message associated with the third node may include the node information of the third node. For example, after the first node periodically broadcasts gateway synchronization messages, other nodes can compare their own performance with that of the first node based on the received gateway synchronization messages, and send a gateway arbitration message when they determine that they are more suitable to be a gateway node. This process will be detailed in the embodiments below and will not be elaborated upon here. When the first node, acting as a gateway node, receives such a gateway arbitration message from other nodes, it can know that there is a node more suitable to act as a gateway than itself, and that this node will replace it as the new gateway node. Therefore, at this time, the first node can change itself to a non-gateway node and update the gateway information, recording the other node as the new gateway node. In this disclosure, updating gateway information can be understood as creating, modifying, or adding information related to the gateway node. Optionally, the aforementioned third node may be another node within the first local network. Alternatively, in some cases, such as when all nodes within the first local network are in poor condition, the aforementioned third node may also be a node within another local network, such as a gateway node or a non-gateway node within another local network.

[0035] In some embodiments, step 240 may include: in response to a first arbitration result indicating that a second node is more suitable as a gateway node than a first node, the first node may be determined as a non-gateway node. Exemplarily, during the arbitration process in which the first node participates, if arbitration fails or is unsuccessful, such as encountering another node more suitable as a gateway node, the first node can immediately withdraw from the arbitration process, and can be directly determined as a non-gateway node. This design of immediately withdrawing from the arbitration process upon failure helps reduce redundant communication and computation, thereby improving arbitration efficiency and reducing communication resource consumption.

[0036] In some embodiments, after a first node is determined to be a non-gateway node, in response to receiving a gateway synchronization message associated with a fourth node, a second arbitration result can be determined based on the node information of the first node and the node information of the fourth node, wherein the gateway synchronization message associated with the fourth node may include the node information of the fourth node; subsequently, based on the second arbitration result, the first node can be changed from a non-gateway node to a gateway node, or the first node can remain a non-gateway node. Optionally, the fourth node can be a gateway node within a first local network or other local networks. In other words, each node can receive gateway synchronization messages from gateway nodes of all local networks. As described in the preceding embodiments, gateway nodes can periodically broadcast gateway synchronization messages. After receiving such a gateway synchronization message, the first node, which is a non-gateway node, can arbitrate based on its node information to determine which of itself and the gateway node is more suitable to be a gateway node. The rules or algorithms for arbitration performed here may be consistent with or different from the rules or algorithms for arbitration performed in step 230 as described in the preceding embodiments.

[0037] In some embodiments, a second arbitration result can be determined based on information related to the local network to which the node is located and other node information, wherein the weight of information related to the local network to which the node is located in the second arbitration result may be higher than at least some of the information in the other node information. Optionally, the arbitration in the above embodiments can be performed based on the BGSA algorithm mentioned in the foregoing embodiments or other algorithms. Exemplarily, when determining the second arbitration result based on the node information of each node, the distance between the local network to which the node is located and the local network to which the gateway involved in the gateway synchronization message is located can be considered. For example, for nodes with smaller distances, when calculating the weighted sum based on various node information, a higher value or weight coefficient can be assigned to the value related to the local network to which the node is located; or, for example, the score determined for each node can be adjusted based on this distance, wherein for nodes with smaller distances, a higher coefficient can be multiplied on the score; and so on. Optionally, when the local network determines the ID based on location relationship, the above distance can be measured based on ID difference, or the above distance can be measured in other ways. In addition, the above measurement of the distance between the two can also include the case of simply measuring whether the two are consistent, wherein non-consistency can be regarded as corresponding to a larger distance than consistency. In summary, various algorithmic designs can be used to enhance the influence of the local network in which a node resides on the second arbitration result. This allows for priority replacement of the gateway node within the same local network when the gateway node fails or deteriorates in state. Furthermore, nodes from other local networks should only act as the gateway node when the states of all nodes within the same local network are in very poor condition. As a result, each local network can operate stably and relatively independently under normal conditions, while also enabling cross-local network rescue in extreme abnormal situations, thereby further improving network stability and flexibility.

[0038] For example, in response to the second arbitration result indicating that the fourth node is more suitable as a gateway node than the first node, the first node can remain a non-gateway node. Optionally, gateway information can be updated based on gateway synchronization messages associated with the fourth node, such as updating the gateway status based on node information in the synchronization message. In response to the second arbitration result indicating that the first node is more suitable as a gateway node than the fourth node, the first node can be changed from a non-gateway node to a gateway node, and a gateway arbitration message associated with the first node can be sent to notify the fourth node and other nodes (and, optionally, external devices) that the first node has replaced the fourth node as the new gateway node. The gateway arbitration message associated with the first node sent at this time can have the same or similar format as the gateway arbitration message sent in step 220.

[0039] Through the above process, dynamic replacement of gateway nodes can be achieved. This replacement may occur for a period of time after the start of communication based on the target protocol. Since the time at which different nodes join the communication connection with external devices may differ, and some nodes may have unstable states, one or more gateway node replacements are likely to occur as time progresses and the states of each node gradually stabilize. This replacement may also occur when the state of a gateway node declines or the state of a non-gateway node improves due to certain factors, or when a gateway node is unable to send gateway synchronization messages due to a fault. For example, after a first node is determined to be a non-gateway node, in response to not receiving a gateway synchronization message within a preset time interval, the first node can be changed from a non-gateway node to a gateway node, and a gateway arbitration message associated with the first node can be sent. Optionally, the preset time interval can be pre-set, for example, it can be set to be slightly longer than the broadcast period of the gateway synchronization message. Each time a gateway synchronization message is received, the relevant timer can be reset. If a gateway synchronization message is not received within the timeout period, it can be considered that the gateway node has failed, and gateway replacement can be implemented by sending a gateway arbitration message.

[0040] Continue to refer to Figure 3B Suppose that as time goes on, gateway node 362 fails, and other nodes will no longer be able to receive gateway synchronization messages from it. At this point, each node can attempt to become the new gateway node by sending gateway arbitration messages. This can be considered equivalent to a new arbitration process. During this process, one or more gateway changes may occur. Subsequently, the system can return to stability. In some examples, such as... Figure 3C As shown, due to the advantages of gateway node 361 in terms of performance, network status, location, and preset priority, according to the arbitration algorithm described in the previous embodiments, it may replace the role of the failed gateway node 361 and be responsible for information interaction between nodes in the two sub-networks and external devices. Alternatively, in some examples, if one of nodes 336 and 337 has sufficient performance, it may also replace the role of the failed gateway node 361.

[0041] Through this dynamic switching of gateways, gateway nodes are no longer fixed but dynamic, which helps to respond more flexibly to fault conditions and other special situations. This makes the entire communication network more stable and ensures it always operates at its best, while maximizing the utilization of each node's resources. Furthermore, under normal operating conditions, if the state of each node remains stable, gateway switching will not occur, and the roles of gateway nodes and non-gateway nodes will remain stable. Therefore, the solution proposed in this disclosure, apart from resolving faults or other unexpected situations, will not adversely affect normal operating conditions.

[0042] In some embodiments, after the first node is determined to be a non-gateway node, in response to receiving a gateway arbitration message associated with the fifth node, the gateway information can be updated based on the node information of the fifth node. The gateway arbitration message associated with the fifth node may include the node information of the fifth node. For example, for each non-gateway node, under normal operating conditions, if it receives a gateway arbitration message from another node, it can know that the gateway node has been replaced by that other node. Therefore, the gateway information can be updated based on the node information of that other node. Through the gateway information update operations mentioned here and in the preceding embodiments, real-time gateway information can be maintained at each node, ensuring the stability of the entire communication network.

[0043] It should be understood that the first, second, third, fourth, and fifth nodes mentioned in the above embodiments are merely for ease of description and do not imply any ordering relationship between these nodes, nor do they imply that these nodes are different nodes. Depending on the actual application scenario, some of the nodes mentioned may be the same node.

[0044] To further facilitate understanding, Figure 4 An example flowchart illustrating a gateway determination scheme performed at each node according to at least some embodiments of the above embodiments is shown. Figure 4 As shown, in steps S1 and S2, the physical link can be detected and the IP address configured to establish a communication connection with external devices. Subsequently, a gateway arbitration message can be sent, and in step S3, it is checked whether the gateway arbitration message was successfully sent. If unsuccessful, step S4 is executed to resend the gateway arbitration message. If successful, step S5 is executed to determine whether gateway arbitration messages from other nodes have been received. If gateway arbitration messages from other nodes are received, step S6 is executed, and arbitration is performed based on BGSA or other preset algorithms to determine which node is more suitable as the gateway node. If the current node wins the arbitration, step S7 continues; otherwise, if failure occurs, the arbitration process is terminated, and the node is directly determined as a non-gateway node. In step S7, it is determined whether the initial arbitration time has been reached. If not, the node continues to wait for gateway arbitration messages from other nodes; if the time has been reached, the arbitration process ends, and the current node is determined as a non-gateway node.

[0045] After the arbitration process is completed, each node can perform either the gateway node function (S8) or the non-gateway node function (S11) according to its assigned role. As a gateway node, in addition to performing message forwarding and other functions specified by the target protocol, it also needs to periodically broadcast gateway synchronization messages in step S10 to notify other nodes of its current status. During this period, in step S9, it also needs to determine whether a gateway arbitration message has been received from another node. If not, it continues to perform the gateway node function; if received, it can be known that a node with a better status has emerged and a gateway change has occurred. At this time, the current node can change to a non-gateway node and continue to perform the non-gateway node function (S11). As a non-gateway node, in step S12, it can determine whether a gateway arbitration message has been received. If received, it can be known that a gateway change has occurred, and in step S13, it synchronously updates the recorded gateway information based on the message content. If not received, it determines whether a gateway synchronization message has been received in step S14. Step S14 can be executed periodically. If a gateway synchronization message is received, arbitration is performed at step S15 based on BGSA or other preset algorithms to determine whether the current node is more suitable to act as the gateway node. If so, a gateway arbitration message is sent at step S16 to notify other nodes that it will replace the current gateway node as the new gateway node. If not, the non-gateway node functions can continue to be performed. If a gateway synchronization message is not received normally, for example, if a gateway synchronization message is not received within the time period specified by preset parameters, it can be considered that the gateway node has failed. Therefore, a gateway arbitration message is sent directly at step S16 to notify other nodes that it will replace the current gateway node as the new gateway node.

[0046] This disclosure also provides an electronic device, Figure 5 An exemplary block diagram of an electronic device 500 according to some embodiments of the present disclosure is illustrated, wherein the electronic device may serve as a node within a local area network as described in the foregoing embodiments. Figure 5 As shown, the electronic device 500 may include a memory 510 and a processor 520, wherein the memory may store computer-executable instructions, and the processor may execute the computer-executable instructions to perform the method 200 according to any of the above embodiments.

[0047] For example, electronic devices can be implemented as various types of devices, such as in-vehicle devices. Continuing with the DoIP protocol as an example, under the AUTOSAR (AUTomotive Open System Architecture) architecture, Figure 6 An example architecture 600 of a node is schematically illustrated according to some embodiments of this disclosure. For example... Figure 6As shown, architecture 600 may include a DoIP node / gateway module 610, an interface module 620, and a driver module 630. DoIP node / gateway module 610 may include a DoIP function module 611, which may contain a DoIP node function module 6111 and a DoIP gateway function module 6112. Furthermore, DoIP module 611 can activate either the DoIP node function module 6111 or the DoIP gateway function module 6112 according to method 200. In addition, DoIP node / gateway module 610 may also include a DCM (Diagnostic Communication Manager) module 612, a PDU Router (Protocol Data Units Router) module 613, a SoAd (Socket Adapter) module 614, a TCP / IP (Transmission Control Protocol / Internet Protocol) module 615, and a CanTp (CAN Transport Layer) module 616, etc., to support various functions of the DoIP protocol. Interface module 620 may include EthIf (Ethernet interface) module 621, CANIf (CAN interface) module 622, LinIf (LIN interface) module 623, etc., to realize communication connections with nodes or devices using different protocols. Correspondingly, driver module 630 may include Eth driver module 631, CAN driver module 632, Lin driver module 633, etc.

[0048] This disclosure also provides a computer program product or computer program including computer-executable instructions that can be stored in a computer-readable storage medium. A processor of a computing device can read the computer-executable instructions from the computer-readable storage medium and execute the computer-executable instructions, causing the computing device to perform the method for determining a gateway node provided in the various embodiments described above. The computer-readable storage medium may be, for example, RAM, ROM, EEPROM, flash memory, CD-ROM, DVD, or other memory.

[0049] Where applicable, the various embodiments provided by this application may be implemented using hardware, software, or a combination of hardware and software. Furthermore, where applicable, the order of the various steps described herein may be changed, combined into compound steps, and / or divided into sub-steps to provide the features described herein.

[0050] By studying the accompanying drawings, the disclosure, and the appended claims, those skilled in the art can understand and implement variations of the disclosed embodiments in practicing the claimed subject matter. In the claims, the word "comprising" does not exclude other elements or steps; expressions such as "first," "second," etc., are merely for descriptive purposes and do not indicate or imply any ordering, nor do they necessarily indicate different objects; and "a" or "an" does not exclude multiple. The mere fact that certain measures are recited in mutually different dependent claims does not imply that a combination of these measures cannot be used for profit.

Claims

1. A method for determining a gateway node, characterized by, The method is performed by a first node within a first local network in a network, wherein the network comprises at least one local network, and the method comprises: establishing a communication connection with an external device based on a target protocol; sending a gateway arbitration message associated with the first node, wherein the gateway arbitration message associated with the first node comprises node information of the first node; in response to receiving a gateway arbitration message associated with a second node within the first local network, determining a first arbitration result based on the node information of the first node and node information of the second node, wherein the gateway arbitration message associated with the second node comprises the node information of the second node; determining the first node as a gateway node or a non-gateway node based at least on the first arbitration result, wherein the gateway node is configured to forward a message between the external device and at least one node within a corresponding local network based on the target protocol.

2. The method of claim 1, wherein, The determining the first node as the gateway node or the non-gateway node based at least on the first arbitration result comprises: in response to the first arbitration result indicating that the first node is more suitable as the gateway node than the second node and an initial arbitration time has not been reached, waiting to receive other gateway arbitration messages; in response to the first arbitration result indicating that the first node is more suitable as the gateway node than the second node and the initial arbitration time has been reached, determining the first node as the gateway node.

3. The method of claim 2, further comprising: after the first node is determined as the gateway node, periodically broadcasting a gateway synchronization message associated with the first node, wherein the gateway synchronization message associated with the first node comprises the node information of the first node.

4. The method of claim 2, further comprising: after the first node is determined as the gateway node, in response to receiving a gateway arbitration message associated with a third node, changing the first node from the gateway node to a non-gateway node and updating gateway information based on node information of the third node, wherein the gateway arbitration message associated with the third node comprises the node information of the third node.

5. The method of claim 1, wherein, The determining the first node as the gateway node or the non-gateway node based at least on the first arbitration result comprises: in response to the first arbitration result indicating that the second node is more suitable as the gateway node than the first node, determining the first node as the non-gateway node.

6. The method of claim 5, further comprising: after the first node is determined as the non-gateway node, in response to receiving a gateway synchronization message associated with a fourth node, determining a second arbitration result based on the node information of the first node and node information of the fourth node, wherein the gateway synchronization message associated with the fourth node comprises the node information of the fourth node; based on the second arbitration result, changing the first node from the non-gateway node to the gateway node or keeping the first node as the non-gateway node.

7. The method of claim 6, wherein, The determining the second arbitration result based on the node information of the first node and the node information of the fourth node comprises: determining the second arbitration result according to information related to a local network in which the node is located and other node information, wherein a weight of the information related to the local network in which the node is located in the second arbitration result is higher than that of at least part of the other node information.

8. The method of claim 6, wherein, The changing the first node from the non-gateway node to the gateway node or keeping the first node as the non-gateway node based on the second arbitration result comprises: keeping the first node as the non-gateway node in response to the second arbitration result indicating that the fourth node is more suitable as the gateway node than the first node; changing the first node from the non-gateway node to the gateway node in response to the second arbitration result indicating that the first node is more suitable as the gateway node than the fourth node, and sending a gateway arbitration message associated with the first node.

9. The method of claim 5, further comprising: changing the first node from the non-gateway node to the gateway node in response to not receiving a gateway synchronization message within a preset time interval after the first node is determined as the non-gateway node, and sending a gateway arbitration message associated with the first node.

10. The method of claim 5, further comprising: updating gateway information based on node information of a fifth node in response to receiving a gateway arbitration message associated with the fifth node after the first node is determined as the non-gateway node, wherein the gateway arbitration message associated with the fifth node comprises the node information of the fifth node.

11. The method of claim 1, further comprising: sending the gateway arbitration message associated with the first node again in response to the gateway arbitration message associated with the first node not being successfully sent yet and an initial arbitration time not being reached.

12. The method of any one of claims 1 to 11, wherein, The node information comprises at least one of the following attribute values: an identifier of a local network in which the node is located; a node type; a distance between the node and an edge gateway node in the network, the edge gateway node comprising a communication interface between the network and the external device; a network congestion degree at the node; a preset priority of the node; a comprehensive distance between the node and other nodes in the network.

13. The method of claim 12, wherein, The node information further comprises a coefficient corresponding to each attribute value in the node information.

14. The method of any one of claims 1-11, wherein, The network is an internal network of a vehicle, the external device is a test device connected to the vehicle, and the target protocol is a DoIP protocol.

15. An electronic device, comprising: The electronic device comprises: a memory configured to store computer executable instructions; a processor configured to execute the method according to any one of claims 1 to 14 when the computer executable instructions are executed by the processor.

16. A computer program product, characterised in that, The computer program product comprises computer executable instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 14. The computer program product comprises computer executable instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 14.