Search

CN-116614198-B - CAN network load balancing method, device, equipment and medium

CN116614198BCN 116614198 BCN116614198 BCN 116614198BCN-116614198-B

Abstract

The application discloses a CAN network load balancing method, a device, equipment and a medium, which relate to the technical field of communication and are applied to a master ECU node, and the method comprises the steps that after power-on, a time stamp of a local clock is sent to each slave ECU node at intervals of preset time so that each slave ECU node synchronizes the local clock based on the time stamp; acquiring a transmitting load reported by each slave ECU node after synchronizing a local clock, and planning a transmitting time point of each slave ECU node based on the transmitting load to obtain a time schedule; and sending the time schedule to each slave ECU node so that each slave ECU node CAN send the CAN message at the target time point specified by the time schedule according to the local clock. According to the method and the device for transmitting the CAN message, the master ECU node CAN uniformly schedule the time for transmitting the CAN message from the slave ECU node according to the transmission load of the slave ECU node, so that the load peak value of the CAN bus is reduced, and the stability and the instantaneity of signal transmission are ensured.

Inventors

  • HAN LELE
  • TAO XIAORONG
  • LU YUKUN

Assignees

  • 知行汽车科技(苏州)股份有限公司

Dates

Publication Date
20260505
Application Date
20230630

Claims (9)

  1. 1. The CAN network load balancing method is characterized by being applied to a main ECU node and comprising the following steps: After power-on, sending a time stamp of a local clock to each slave ECU node at preset time intervals so that each slave ECU node synchronizes the local clock based on the time stamp; Acquiring a transmitting load reported by each slave ECU node after synchronizing a local clock, and planning a transmitting time point of each slave ECU node based on the transmitting load to obtain a time schedule; Transmitting the time schedule to each slave ECU node so that each slave ECU node transmits CAN messages at a target time point specified by the time schedule according to a local clock; wherein the planning, based on the transmission load, the transmission time point of each slave ECU node to obtain a time schedule includes: Determining a first time window which can be allocated currently and a second time window to be reserved based on the preset time interval, wherein the total time length of the first time window and the second time window is equal to the time length of the preset time interval; Planning the transmission time point of each slave ECU node in the first time window based on the transmission load and by utilizing a preset balancing algorithm to obtain a time schedule; The step of sending the time schedule to each slave ECU node so that each slave ECU node sends a CAN message at a target time point specified by the time schedule according to a local clock, and the step of: When any load rebalancing request sent by the slave ECU node is obtained, the sending time point of the slave ECU node is planned again in the second time window by utilizing the preset balancing algorithm based on the current sending load carried in the load rebalancing request to obtain an updated time schedule, and the updated time schedule is sent to the slave ECU node so that the slave ECU node sends CAN messages at the time point specified by the updated time schedule according to a local clock.
  2. 2. The CAN network load balancing method of claim 1, wherein the sending the time stamp of the local clock to each of the slave ECU nodes at every preset time interval so that each of the slave ECU nodes synchronizes the local clock based on the time stamp comprises: And sending the time stamp of the local clock to each slave ECU node at preset time intervals so that each slave ECU node synchronizes the local clock based on the time stamp and the time stamp propagation time.
  3. 3. The CAN network load balancing method of claim 1, wherein the obtaining the transmission load reported by each slave ECU node after synchronizing the local clock includes: After synchronizing the local clock through each slave ECU node, determining a transmission load according to the cycle frequency of the self-transmitted CAN message, the data length and the transmission rate of the CAN message; And acquiring the sending load reported by each ECU node.
  4. 4. The CAN network load balancing method of claim 1, further comprising: judging whether a preset load balancing condition is met currently, if yes, updating the preset time interval, and sending the time stamp of the local clock to each slave ECU node according to the updated time interval, wherein the updated time interval is larger than the preset time interval.
  5. 5. The CAN network load balancing method is characterized by being applied to any one slave ECU node and comprising the following steps: after power-on, acquiring a time stamp sent by a main ECU node at intervals of preset time, and synchronizing a local clock based on the time stamp; After synchronizing a local clock, reporting a local transmission load to the master ECU node so that the master ECU node plans the transmission time point of each slave ECU node based on the transmission load to obtain a time schedule; Acquiring the time schedule transmitted by the main ECU node, and transmitting a CAN message at a target time point specified by the time schedule according to a local clock; the master ECU node plans a transmission time point of each slave ECU node based on the transmission load to obtain a time schedule, and the method comprises the following steps: Determining a first time window and a second time window to be reserved which can be allocated currently by the master ECU node based on the preset time interval, and planning the sending time point of each slave ECU node in the first time window by using a preset balancing algorithm based on the sending load to obtain a time schedule; after the CAN message is sent according to the local clock at the target time point specified by the time schedule, the method further comprises the following steps: When a preset condition is met, a load rebalancing request carrying a local current sending load is sent to the main ECU node, so that the main ECU node utilizes the preset balancing algorithm to plan the sending time point of the auxiliary ECU node again in the second time window to obtain an updated time schedule; and acquiring the updated time schedule transmitted by the main ECU node, and transmitting a CAN message at a time point specified by the updated time schedule according to a local clock.
  6. 6. The CAN network load balancing method of claim 5, wherein the sending CAN messages according to the local clock at a target point in time specified by the time schedule further comprises: Detecting an actual sending time point of a local sending CAN message, and acquiring time deviation between the actual sending time point and the target time point; And judging whether the time deviation exceeds a preset deviation threshold, if so, sending a load rebalancing request carrying a local current sending load to the main ECU node so that the main ECU node reprofils the sending time point based on the load rebalancing request.
  7. 7. A CAN network load balancing device, applied to a main ECU node, comprising: The time synchronization module is used for sending the time stamp of the local clock to each slave ECU node at preset time intervals after power-on, so that each slave ECU node synchronizes the local clock based on the time stamp; The schedule obtaining module is used for obtaining the sending load reported by each slave ECU node after synchronizing the local clock, and planning the sending time point of each slave ECU node based on the sending load so as to obtain a time schedule; The message sending module is used for sending the time schedule to each slave ECU node so that each slave ECU node CAN send CAN messages at a target time point specified by the time schedule according to a local clock; The schedule obtaining module is specifically configured to: Determining a first time window which can be allocated currently and a second time window to be reserved based on the preset time interval, wherein the total time length of the first time window and the second time window is equal to the time length of the preset time interval; Planning the transmission time point of each slave ECU node in the first time window based on the transmission load and by utilizing a preset balancing algorithm to obtain a time schedule; And the device is further used for re-planning the sending time point of the slave ECU node in the second time window by utilizing the preset balancing algorithm based on the current sending load carried in the load re-balancing request when any load re-balancing request sent by the slave ECU node is obtained after each slave ECU node sends the CAN message at the target time point specified by the time schedule according to the local clock so as to obtain an updated time schedule, and sending the updated time schedule to the slave ECU node so that the slave ECU node sends the CAN message at the time point specified by the updated time schedule according to the local clock.
  8. 8. An electronic device, comprising: A memory for storing a computer program; Processor for executing the computer program to implement the steps of the CAN network load balancing method according to any one of claims 1 to 4.
  9. 9. A computer-readable storage medium, characterized in that it stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the CAN network load balancing method according to any one of claims 1 to 4.

Description

CAN network load balancing method, device, equipment and medium Technical Field The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a medium for load balancing of a CAN network. Background CAN (Controller Area Network, the controller area network) is one of the most widely used fieldbuses at present. The current CAN NM (Network Management, i.e., grid management) CAN implement CAN ordered sleep wakeup, and CAN keep the bus silent when there is no communication demand. The CAN bus is shared by a plurality of nodes, and as the number of nodes on the bus increases or the amount of data sent by the nodes increases, the bus load will increase, possibly resulting in an increase in the delay of data transmission. In addition, when a plurality of nodes transmit data at the same time, a collision may occur, that is, the plurality of nodes access the bus at the same time, resulting in data collision, and although the CAN bus employs a collision detection and retransmission mechanism, the collision may cause an increase in transmission delay. CAN bus uses an identifier-based priority mechanism to handle the case where multiple nodes send data simultaneously, higher priority frames will get earlier access on the bus, while lower priority frames need to wait. If the priority in the design is set unreasonably, when the CAN network has a sending peak value in the running process, the CAN message with low priority may have serious periodic fluctuation due to arbitration failure, so that frames with higher real-time requirements are delayed greatly, and the real-time performance of signal transmission is affected. In summary, how to implement load balancing on the CAN bus to ensure real-time performance and stability of signal transmission is a problem to be solved at present. Disclosure of Invention Therefore, the invention aims to provide a CAN network load balancing method, a device, equipment and a medium, which CAN realize load balancing on a CAN bus so as to ensure the real-time performance and stability of signal transmission. The specific scheme is as follows: In a first aspect, the application discloses a method for balancing load of a CAN network, which is applied to a main ECU node and comprises the following steps: After power-on, sending a time stamp of a local clock to each slave ECU node at preset time intervals so that each slave ECU node synchronizes the local clock based on the time stamp; Acquiring a transmitting load reported by each slave ECU node after synchronizing a local clock, and planning a transmitting time point of each slave ECU node based on the transmitting load to obtain a time schedule; Transmitting the time schedule to each slave ECU node so that each slave ECU node transmits CAN messages at a target time point specified by the time schedule according to a local clock; wherein the planning, based on the transmission load, the transmission time point of each slave ECU node to obtain a time schedule includes: Determining a first time window which can be allocated currently and a second time window to be reserved based on the preset time interval; And planning the transmission time point of each slave ECU node in the first time window based on the transmission load and by utilizing a preset balancing algorithm so as to obtain a time schedule. Optionally, the sending the timestamp of the local clock to each slave ECU node at preset time intervals, so that each slave ECU node synchronizes the local clock based on the timestamp, includes: And sending the time stamp of the local clock to each slave ECU node at preset time intervals so that each slave ECU node synchronizes the local clock based on the time stamp and the time stamp propagation time. Optionally, the obtaining the sending load reported by each slave ECU node after synchronizing the local clock includes: After synchronizing the local clock through each slave ECU node, determining a transmission load according to the cycle frequency of the self-transmitted CAN message, the data length and the transmission rate of the CAN message; And acquiring the sending load reported by each ECU node. Optionally, the method for balancing the load of the CAN network further includes: judging whether a preset load balancing condition is met currently, if yes, updating the preset time interval, and sending the time stamp of the local clock to each slave ECU node according to the updated time interval, wherein the updated time interval is larger than the preset time interval. Optionally, the sending the time schedule to each slave ECU node, so that each slave ECU node sends a CAN message according to a local clock at a target time point specified by the time schedule, and further includes: When any load rebalancing request sent by the slave ECU node is obtained, re-planning the sending time point of the slave ECU node in the second time window by utilizing the preset balanc