Load balancing method and device, electronic equipment and storage medium

By setting different scheduling delay compensation values ​​for the Lin channel of AUTOSAR at each scheduling point, the problem of ECU load imbalance is solved and the stability of Lin communication is improved.

CN119211239APending Publication Date: 2024-12-27BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310753403.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-25
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the Lin communication of AUTOSAR, the communication stability is affected because the ECU is load unbalanced during the scheduling cycle corresponding to different scheduling points.

Method used

By setting different scheduling delay compensation values ​​for different Lin channels in the scheduling cycle corresponding to each scheduling point, each Lin channel delays calling the main function at the scheduling point, thereby avoiding the ECU from executing the same task in different scheduling cycles and realizing load balanced.

Benefits of technology

It effectively avoids the load imbalance of the ECU in different scheduling cycles, and improves the stability of Lin communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211239A_ABST
    Figure CN119211239A_ABST
Patent Text Reader

Abstract

The invention provides a load balancing method and device, electronic equipment and a storage medium. The method comprises the following steps: respectively setting different scheduling delay compensation values for each Lin channel based on task information of different local internet Lin channels in a scheduling period corresponding to each scheduling point; and in response to a scheduling request corresponding to each Lin channel at each scheduling point, calling a main function of the corresponding Lin channel after the scheduling delay compensation value, so that the main function executes a task represented by the task information of the corresponding Lin channel in the scheduling period. According to the scheme provided by the invention, different scheduling delay compensation values are set for different Lin channels under each scheduling point, so that even if tasks of different Lin channels in a scheduling period corresponding to the scheduling points are possibly the same, the same task cannot be executed in the same scheduling period due to different scheduling delay compensation values. Therefore, the load balancing of the ECU is realized, and the stability of Lin communication is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of multi-channel load balancing based on local interconnect network (Lin) communication, and in particular to a load balancing method and device, an electronic device and a storage medium. Background Art

[0002] AUTOSAR (Automotive Open System Architecture) is a communication specification widely used in the automotive industry. It defines the communication methods and interfaces between various modules in the automotive system. LIN communication is a local area network communication technology that is widely used in automotive electronic systems to achieve communication between automotive modules.

[0003] In Lin communication based on AUTOSAR, the transmission of Lin messages plays a decisive role in the stability of Lin communication. With the development of the automobile industry, the communication control to improve the comfort of drivers and passengers is becoming more and more abundant, resulting in an increasing demand for the transmission of Lin messages, which in turn leads to an increasing number of Lin channels for transmitting Lin messages. Since Lin communication based on AUTOSAR adopts a single-host and multi-slave architecture, when the scheduling point of the basic software layer (Basic Software, BSW) of AUTOSAR arrives, the electronic control unit (Electronic Control Unit, ECU) may call the main function in different Lin channels to execute the tasks of the corresponding Lin channel within the scheduling cycle corresponding to the scheduling point.

[0004] However, this scheduling method may cause unbalanced ECU load. For example, if in a scheduling period corresponding to a scheduling point, the main functions of multiple different Lin channels are called to execute the same task, and the corresponding task has a huge amount of data, while in the scheduling period corresponding to the next scheduling point, the main functions of multiple different Lin channels are called to execute the same task, and the corresponding task has a small amount of data. In this case, the ECU load is too large or too small in the scheduling periods corresponding to different scheduling points, resulting in unbalanced load for ECUs with multiple different Lin channels in the scheduling periods corresponding to different scheduling points, thereby affecting the stability of communication. Summary of the invention

[0005] The present disclosure provides a load balancing method and device, an electronic device, and a storage medium.

[0006] According to a first aspect of the present disclosure, a load balancing method is provided, the method comprising:

[0007] Based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point, different scheduling delay compensation values ​​are set for each Lin channel; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period;

[0008] In response to the scheduling requests corresponding to the Lin channels at the scheduling points, the main function of the corresponding Lin channel is called after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

[0009] In some embodiments, the step of setting different scheduling delay compensation values ​​for each Lin channel based on task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point includes:

[0010] Obtaining task information of each Lin channel in a scheduling period corresponding to each scheduling point;

[0011] If the task information of each Lin channel in the scheduling period corresponding to each scheduling point is the same, a different scheduling delay compensation value is set for each Lin channel in different Lin channels.

[0012] In some embodiments, if the task information of each Lin channel in the scheduling period corresponding to each scheduling point is the same, setting a different scheduling delay compensation value for each Lin channel in different Lin channels includes:

[0013] Obtain the number of scheduling cycles required for the Lin channel to transmit a message;

[0014] A non-negative integer multiple of the product value of the number of the scheduling cycles and the scheduling cycle is set as a scheduling delay compensation value corresponding to each Lin channel in different Lin channels.

[0015] In some embodiments, in response to each Lin channel before the scheduling request corresponding to each scheduling point, the method according to the first aspect of the present disclosure further includes:

[0016] Based on the processing cycle required for the Lin channel to transmit a message, determine the Lin channel with the shortest processing cycle as the reference Lin channel;

[0017] Based on the processing cycles of the reference Lin channel and other Lin channels, a corresponding number of delayed calls is set for each of the other Lin channels; wherein the other Lin channels are the Lin channels other than the reference Lin channel in each of the Lin channels;

[0018] Correspondingly,

[0019] The responding to the scheduling request corresponding to each Lin channel at each scheduling point, calling the main function of the corresponding Lin channel after the scheduling delay compensation value, includes:

[0020] In response to the scheduling request corresponding to the reference Lin channel at each scheduling point, after the scheduling delay compensation value corresponding to the reference Lin channel, the main function of the reference Lin channel is called;

[0021] In response to the scheduling requests corresponding to the other Lin channels at the scheduling points, when the number of times the main function of the benchmark Lin channel is called reaches the number of delay calls corresponding to any Lin channel in the other Lin channels, the main function of the corresponding Lin channel is called after the scheduling delay compensation value.

[0022] In some embodiments, before the processing cycle required for transmitting a message based on the Lin channel, the method further includes:

[0023] Obtain the message information corresponding to each of the Lin channels;

[0024] The duration of each Lin channel transmitting a message corresponding to its message information is determined to be a processing period required for the Lin channel to transmit a message.

[0025] According to a second aspect of the present disclosure, a load balancing device is provided, including:

[0026] A scheduling delay compensation value setting unit, used to set different scheduling delay compensation values ​​for each Lin channel based on task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period;

[0027] A main function calling unit is used to respond to the scheduling requests corresponding to each Lin channel at each scheduling point, and call the main function of the corresponding Lin channel after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

[0028] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0029] at least one processor architecture; and

[0030] a memory communicatively connected to the at least one processor architecture; wherein,

[0031] The memory stores instructions that can be executed by the at least one processor architecture, and the instructions are executed by the at least one processor architecture so that the at least one processor architecture can perform the method described in the first aspect.

[0032] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0033] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method described in the first aspect when executed by a processor architecture.

[0034] According to a sixth aspect of the present disclosure, a vehicle is provided, the vehicle comprising one of the device described in the second aspect, the electronic device described in the third aspect, the storage medium described in the fourth aspect, or the computer program product described in the fifth aspect.

[0035] The present disclosure provides a load balancing method, device, electronic device and storage medium. The method includes: based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point, setting different scheduling delay compensation values ​​for each Lin channel; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period; in response to the scheduling request corresponding to each Lin channel at each scheduling point, calling the main function of the corresponding Lin channel after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel in the scheduling period.

[0036] According to the scheme disclosed in the present invention, since different scheduling delay compensation values ​​are set for different Lin channels in the scheduling period corresponding to each scheduling point, when the scheduling point comes, even if the tasks of different Lin channels in the scheduling period corresponding to the scheduling point may be the same, due to the different scheduling delay compensation values, the main functions of different Lin channels are called at different times, so different Lin channels will not execute the same task at the same time in the scheduling period corresponding to each scheduling point. This avoids the situation where the ECU load is unbalanced in different scheduling periods due to the execution of multiple identical tasks by different Lin channels in the same scheduling period, thereby achieving ECU load balancing and improving the stability of Lin communication.

[0037] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0039] Figure 1 A flowchart of the BSW Task of AUTOSAR provided in the embodiment of the present disclosure;

[0040] Figure 2 A schematic diagram of the principle of sending messages through multiple Lin channels before optimization provided in an embodiment of the present disclosure;

[0041] Figure 3 A flow chart of a load balancing method provided in an embodiment of the present disclosure;

[0042] Figure 4 A schematic diagram of the principle of sending messages through multiple Lin channels after optimization provided in an embodiment of the present disclosure;

[0043] Figure 5 A schematic diagram of the structure of a load balancing device provided in an embodiment of the present disclosure;

[0044] Figure 6 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0045] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0046] Before introducing the load balancing method, device, electronic device, and storage medium provided by the embodiments of the present disclosure, the technical terms appearing in the present disclosure are explained as follows.

[0047] Scheduling point: In AUTOSAR, a scheduling point refers to In the BSW layer of AUTOSAR, the node where the BSW Task is triggered. When the BSWTask is triggered, the main function is called to execute the corresponding Task.

[0048] Scheduling period: In AUTOSAR, the scheduling cycle refers to In the BSW layer of AUTOSAR, when a BSW Task is triggered, it is the duration used to call the main function.

[0049] Processing cycle: In AUTOSAR, the processing cycle refers to the time required to send a message.

[0050] The load balancing method, device, electronic device, and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0051] AUTOSAR is a communication specification widely used in the automotive industry, which defines the communication methods and interfaces between various modules in the automotive system. Lin communication is a local area interconnection network communication technology, which is widely used in automotive electronic systems to achieve communication between automotive modules.

[0052] Lin communication is a low-cost serial communication network defined for automotive distributed electronic systems. It is a supplement to other automotive multi-channel networks such as the Controller Area Network (CAN). It is suitable for applications that do not have high requirements on network bandwidth, performance or fault tolerance, such as reading lights, windows, wipers, etc. that improve the comfort of drivers and passengers.

[0053] In Lin communication, the periodic sending of Lin messages is realized through the scheduling table, and the Lin scheduling table exists in the LinIf module. When the LinIf module calls the scheduling table periodically, it implements the trigger transmission of the protocol data unit (Pdu) through the callback function callback, that is, it obtains the service data unit (Sdu) data upward, and then calls Lin_SendFrame to send the message.

[0054] like Figure 1 As shown in the figure, the LinIf module implements the periodic transmission of Lin messages in the Lin scheduling table through the BSW layer task Task, and all messages are completed by the BSW Task calling the Pdu Router module's PduR_TriggerTransmit callback function to obtain Sdu data. The LinIf module calls the PduR_LinIfTriggerTransmit function to obtain Pdu data, and calls Lin_SendFrame to send data. If the data acquisition fails, the Lin message will not be sent. Secondly, the LinIf module calls the Lin_GetStatus function to obtain the driver status. If the driver status is correct, it reports the transmission result to the upper layer.

[0055] In summary, taking the sending of Lin messages as an example, the sending of Lin messages mainly goes through the following four stages:

[0056] 1. Get data from the upper layer; specifically,

[0057] Based on the LIN message sending tasks corresponding to different LIN channels in the scheduling table, the LinIf module calls the Mainfunction of the corresponding Lin channel. Specifically, it calls the PduR_LinIfTriggerTransmit function in the corresponding Lin channel to obtain data from the upper layer.

[0058] 2. Send a message; specifically,

[0059] After obtaining data from the upper layer, the LinIf module calls the Lin_SendFrame function in the corresponding Lin channel to send data;

[0060] 3. Get the drive status; specifically,

[0061] After sending the data, the LinIf module calls the Lin_GetStatus function in the corresponding Lin channel to obtain the driver status of the corresponding device;

[0062] 4. Report the transmission results to the upper layer. Specifically,

[0063] The LinIf module reports the transmission result to the upper layer based on the driving status of the corresponding device of the corresponding channel.

[0064] In the above process, multiple Lin messages in the scheduling table usually transmit data through different Lin channels. In the BSW layer of AUTOSAR, when the BSW Task is triggered at the scheduling point, such as when the PduR_LinIfTriggerTransmit function is triggered, the data acquisition operation of one Lin channel will be executed first according to the priority, and then the data acquisition operation of another LIN channel will be executed.

[0065] With the development of the automobile industry, the communication control to improve the comfort of drivers and passengers is becoming more and more abundant, resulting in an increasing demand for the transmission of Lin messages, which in turn leads to an increasing number of Lin channels for transmitting Lin messages. Since the Lin communication based on AUTOSAR adopts a single-master and multi-slave architecture, when the scheduling point of the BSW layer of AUTOSAR comes, the ECU may call the main function of each Lin channel in different Lin channels to execute the task represented by the task information of the corresponding Lin channel in the scheduling period corresponding to the scheduling point.

[0066] Take the following example: Figure 2As shown, at the first scheduling point corresponding to the BSW Task, when the Mainfunction of the first Lin channel channel1 is called, data acquisition from the upper layer and data transmission are executed in the first scheduling cycle, and when the Mainfunction of the second Lin channel channel2 is called, data acquisition from the upper layer and data transmission are executed in the first scheduling cycle; at the second scheduling point, channel1 and channel2 are both in the state of waiting for data transmission in the second scheduling cycle, and there is no processing task; at the third scheduling point, when the Mainfunction of channel1 is called, the drive status is acquired and the transmission result is reported to the upper layer in the third scheduling cycle, and when the Mainfunction of channel2 is called, the drive status is acquired and the transmission result is reported to the upper layer in the third scheduling cycle.

[0067] In the above process, based on the communication rules of AUTOSAR, taking the first scheduling point as an example, when the Mainfunction of channel1 and channel2 in the first scheduling cycle is called, the tasks of obtaining and sending data from the upper layer are executed. If the amount of data obtained and sent from the upper layer is very large, then it will cause the corresponding ECU to process data under great pressure at the first scheduling point, while the ECU corresponding to the second scheduling point does not process data, that is, the load of the ECU corresponding to the second scheduling point and the first scheduling point is unbalanced, affecting the stability of communication.

[0068] In order to solve at least one of the above problems, the present disclosure provides a load balancing method. Figure 3 As shown, the load balancing method includes the following steps:

[0069] Step 301: Based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point, set different scheduling delay compensation values ​​for each Lin channel; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period;

[0070] There may be multiple scheduling points. Taking the first scheduling point as an example, when the first scheduling point arrives, each Lin channel will perform its own task within its scheduling period. However, the scheduling delay compensation value of each Lin channel is different. Therefore, the starting time of the scheduling period of each Lin channel is different.

[0071] Setting different scheduling delay compensation values ​​for each Lin channel means: for each scheduling point, a different scheduling delay compensation value is set for each Lin channel, so that when a scheduling request of the scheduling point is received, the scheduling delay compensation value is delayed for each Lin channel and then the main function of the corresponding Lin channel is called. For example, at the first scheduling point, the scheduling delay compensation values ​​of different Lin channels are different, and at the second scheduling point, the scheduling delay compensation values ​​of different Lin channels are also different. Of course, the scheduling delay compensation values ​​of the same Lin channel at different scheduling points may be the same, and the scheduling delay compensation values ​​of different Lin channels at different scheduling points may also be the same. For example, at the first scheduling point, the scheduling delay compensation value of a Lin channel may be the same as the scheduling delay compensation value of the same Lin channel at the second scheduling point or may be the same as the scheduling delay compensation value of another Lin channel. This is not limited by the present disclosure.

[0072] In one embodiment, if Figure 2 As shown:

[0073] Take two Lin channels as an example, channel 1 and channel 2 are used for sending the data of the first message and the second message in the scheduling table respectively; the data sending of the first message and the second message both follow the BSW layer protocol of AUTOSAR. That is, the sending of the first message and the second message both go through the following stages:

[0074] 1. Get data from the upper layer and send data;

[0075] 2. Wait for data to be sent;

[0076] 3. Get the drive status and confirm the result to the upper layer.

[0077] The above three stages are respectively the first scheduling point, the second scheduling point and the third scheduling point.

[0078] That is to say, in the first scheduling point, the first Task first calls the Mainfunction of channel1, specifically calls PduR_LinIfTriggerTransmit to obtain data from the upper layer, and then calls LinIf_SendFrame function to send data. When the data transmission of channel1 is completed, the first Task can call the Mainfunction of channel2 to obtain data from the upper layer and send data.

[0079] In the second scheduling point, channel 1 and channel 2 have no data processing tasks, and their role is to wait for data to be sent.

[0080] In the third scheduling point, the third Task first calls the main function of channel1 to obtain the driving status and confirm the sending result to the upper layer. When the confirmation of sending result to the upper layer of channel1 is completed, the third Task can call the main function of channel2 to obtain the driving status and confirm the sending result to the upper layer.

[0081] In the above process, if the amount of data obtained and sent from the upper layer is very large, then the corresponding ECU will be under great pressure to process data at the first scheduling point, while the ECU corresponding to the second scheduling point will not process data, that is, the load of the ECU corresponding to the second scheduling point and the first scheduling point is unbalanced, affecting the stability of communication. Therefore, it is necessary to decouple the tasks of different Lin channels in the same scheduling cycle so that when the main functions of different Lin channels are called, different tasks are executed in the same scheduling cycle.

[0082] In one embodiment, the scheduling delay compensation value refers to the time when the main function of the corresponding Lin channel is delayed in calling, and the scheduling delay compensation value is a non-negative integer multiple of the scheduling period, such as the scheduling delay compensation value of channel1 is 0 times the duration of the scheduling period, that is, 0, and the scheduling delay compensation value of channel2 is 1 times the duration of the scheduling period. It is understandable that the scheduling delay compensation value can also be other integer multiples of the duration of the scheduling period, which is not limited in the present disclosure.

[0083] Step 302: In response to the scheduling requests corresponding to the Lin channels at the scheduling points, the main function of the corresponding Lin channel is called after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

[0084] Therefore, based on the above description, in the first scheduling cycle corresponding to the first scheduling point, the main function scheduling point of channel1 is called when it arrives, and executes the task of obtaining and sending data from the upper layer, while the main function of channel2 is delayed by one scheduling cycle, that is, it is called in the second scheduling cycle, and executes the task of obtaining and sending data from the upper layer. Since there is no execution task in the second cycle of channel2, in this case, in the first scheduling cycle, ECU only executes the task of obtaining and sending data from the upper layer corresponding to channel1, and in the second cycle, ECU only executes the task of obtaining and sending data from the upper layer corresponding to channel2, which realizes the load balancing of ECU in different scheduling cycles and improves the stability of communication.

[0085] The following is an explanation using a specific application example.

[0086] like Figure 4 As shown: In this application example, the scheduling period is 5ms, the scheduling delay compensation value of channel1 is 0 times the duration of the scheduling period, that is, 0, and the scheduling delay compensation value of channel2 is 3 times the duration of the scheduling period, that is, 15ms.

[0087] In this application example, the scheduling delay compensation value indicates the delay call time of the main function corresponding to the Lin channel; for example, if the scheduling delay compensation value of channel1 is 0, it means that the first Task directly calls the main function of channel1 to perform operations of obtaining data from the upper layer and sending data. If the scheduling delay compensation value of channel2 is 15ms, it means that the first Task calls the main function of channel2 after 15ms to perform operations of obtaining data from the upper layer and sending data.

[0088] Based on the setting of the above scheduling delay compensation value, in the first scheduling point, the first Task only calls the main function of channel1, and calls the main function of channel2 after 15ms, which decouples the strong correlation between the tasks of different Lin channels in the same scheduling cycle, realizes the load balancing of the corresponding ECU, and improves the stability of communication.

[0089] In summary, according to the scheme disclosed in the present invention, each of the Lin channels will perform different tasks in the same scheduling cycle based on the scheduling delay compensation value set therein. That is, in the same scheduling cycle, the corresponding ECU only needs to perform the scheduling task of one Lin channel, thereby avoiding the occurrence of unbalanced loads of ECUs in different scheduling cycles due to the execution of the same task by different Lin channels in the same scheduling cycle, thereby achieving load balancing of ECUs in different scheduling cycles and improving the stability of Lin communication.

[0090] In one embodiment, based on the above description, to achieve load balancing when the ECU processes data in different scheduling cycles, it is only necessary to make the task information of different Lin channels different in the same scheduling cycle, so as to ensure that the amount of data processed by the ECU in different scheduling cycles is roughly the same.

[0091] Based on this, in one embodiment, based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point, different scheduling delay compensation values ​​are set for each Lin channel, including:

[0092] Obtain the task information of different Lin channels in the scheduling cycle corresponding to each scheduling point;

[0093] Among them, obtaining the task information of different Lin channels in the scheduling cycle corresponding to each scheduling point includes:

[0094] Based on the scheduling table, obtain the task information within the scheduling period corresponding to each scheduling point;

[0095] If the task information of different Lin channels in the scheduling period corresponding to each scheduling point is different, for example, the tasks of channel1 and channel2 are not both to send messages, then the task information of different Lin channels is different. Therefore, in the scheduling period corresponding to each scheduling point, the task information of different Lin channels is different.

[0096] If the task information of different Lin channels in the scheduling period corresponding to each scheduling point is the same, a different scheduling delay compensation value is set for each Lin channel in the different Lin channels.

[0097] In one embodiment, taking sending a message as an example, when sending a message, each of the Lin channels performs the task of sending the message in three scheduling periods, corresponding to three scheduling points respectively. If different Lin channels are to perform different scheduling tasks in the same scheduling period under the action of the scheduling delay compensation value, a scheduling delay compensation value needs to be set for each Lin channel based on the number of the scheduling periods and the time of one scheduling period.

[0098] Based on this, in one embodiment, if the task information of different Lin channels in the scheduling period corresponding to each scheduling point is the same, a different scheduling delay compensation value is set for each Lin channel in the different Lin channels, including:

[0099] Obtain the number of scheduling cycles required for the Lin channel to transmit a message;

[0100] A non-negative integer multiple of the product value of the number of the scheduling cycles and the scheduling cycle is set as a scheduling delay compensation value corresponding to each Lin channel in different Lin channels.

[0101] In one embodiment, if Figure 4As shown: When channel1 and channel2 perform a complete task of sending a message, three scheduling cycles are required, and each scheduling cycle corresponds to a duration of 5ms. Therefore, the scheduling delay compensation value of channel1 can be set to 0 or the scheduling delay compensation value of channel1 can be not set, and the scheduling delay compensation value of channel2 can be set to 15ms. Based on this, in the first scheduling cycle corresponding to the first scheduling point, the first Task calls the main function corresponding to channel1 to perform the task of obtaining data from the upper layer and sending data. Regardless of whether the execution is completed, under the effect of the scheduling delay compensation value, channel2 executes the first Task calling the main function corresponding to channel2 to perform the task of obtaining data from the upper layer and sending data after 15ms, that is, at the fourth scheduling point. Similarly, due to the periodic effect, the second Task calls the main function corresponding to channel2 to obtain the drive status and confirm the sending result to the upper layer. Since the scheduling delay compensation value of channel1 is 0, channel1 still does not process data in the second scheduling cycle corresponding to the second scheduling point. In the third scheduling period corresponding to the third scheduling point, the third Task calls the main function corresponding to channel1 to execute the task of obtaining the driving status and confirming the sending result to the upper layer. Due to the periodic effect, channel2 does not process data in the third scheduling period corresponding to the third scheduling point. Under the effect of the scheduling delay compensation value, channel2 executes the first Task to call the main function corresponding to channel2 to execute the task of obtaining data from the upper layer and sending data in the fourth scheduling period corresponding to the fourth scheduling point after 15ms.

[0102] Therefore, even if channel1 and channel2 have the same task at the first scheduling point, they will not execute the same task in the first scheduling cycle due to their different scheduling delay compensation values. This avoids the situation where different Lin channels execute multiple identical tasks with huge amounts of data in the same scheduling cycle, resulting in unbalanced ECU loads in different scheduling cycles, thereby achieving ECU load balancing and improving the stability of Lin communication.

[0103] In one embodiment, Figure 2 For example, if channel1 and channel2 have different execution times for sending messages, for example, channel1 only needs 10ms, while channel2 needs 50ms due to the huge amount of message data, then the data processing capacity of the ECU corresponding to channel1 is much lower than that of the ECU corresponding to channel2, which will also lead to load imbalance.

[0104] Based on this, in one embodiment, in response to each Lin channel before the scheduling request corresponding to each scheduling point, the load balancing method further includes:

[0105] Based on the processing cycle required for the Lin channel to transmit a message, determine the Lin channel with the shortest processing cycle as the reference Lin channel;

[0106] Based on the processing cycles of the reference Lin channel and other Lin channels, a corresponding number of delayed calls is set for each of the other Lin channels; wherein the other Lin channels are the Lin channels other than the reference Lin channel in each of the Lin channels;

[0107] Correspondingly,

[0108] The responding to the scheduling request corresponding to each Lin channel at each scheduling point, calling the main function of the corresponding Lin channel after the scheduling delay compensation value, includes:

[0109] In response to the scheduling request corresponding to the reference Lin channel at each scheduling point, after the scheduling delay compensation value corresponding to the reference Lin channel, the main function of the reference Lin channel is called;

[0110] In response to the scheduling requests corresponding to the other Lin channels at the scheduling points, when the number of times the main function of the benchmark Lin channel is called reaches the number of delay calls corresponding to any Lin channel in the other Lin channels, the main function of the corresponding Lin channel is called after the scheduling delay compensation value.

[0111] In one embodiment, it is assumed that the processing cycle required for channel 1 to transmit a message is 10ms, while the processing cycle required for channel 2 to transmit a message is 50ms. At this time, channel 1 can be determined as the reference Lin channel, and the number of delayed calls corresponding to channel 2 is set to 5. That is, the main function corresponding to channel 2 is called once every 5 times the main function corresponding to channel 1 is called. Furthermore, it is ensured that within 50ms, the ECU has enough time to transmit a message corresponding to channel 2, avoiding the situation that within 10ms, the previous message of channel 2 has not been transmitted and the task of transmitting the next message has started again, further improving the stability of Lin communication.

[0112] In one embodiment, based on the above description, before the processing cycle required for transmitting a message based on the Lin channel, the method further includes:

[0113] Obtain the message information corresponding to each of the Lin channels;

[0114] The duration of each Lin channel transmitting a message corresponding to its message information is determined to be a processing period required for the Lin channel to transmit a message.

[0115] In summary, the solution provided by the present invention can obtain the processing cycle of the message corresponding to the Lin channel according to the message information corresponding to each Lin channel, and under the action of the delayed call times, control the moment when the Lin channel executes the task, so that the ECUs corresponding to different Lin channels can obtain sufficient processing time when transmitting messages, further improving the stability of Lin communication.

[0116] Corresponding to the above load balancing method, the present invention further provides a load balancing device. Since the device embodiment of the present invention corresponds to the above method embodiment, details not disclosed in the device embodiment can be referred to the above method embodiment, and will not be described in detail in the present invention.

[0117] like Figure 5 As shown, the load balancing device 500 includes:

[0118] The scheduling delay compensation value setting unit 501 is used to set different scheduling delay compensation values ​​for each Lin channel based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period;

[0119] The main function calling unit 502 is used to respond to the scheduling requests corresponding to each Lin channel at each scheduling point, and call the main function of the corresponding Lin channel after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

[0120] In one embodiment, the scheduling delay compensation value setting unit 501 is specifically used to:

[0121] Obtain the task information of different Lin channels in the scheduling cycle corresponding to each scheduling point;

[0122] If the task information of different Lin channels in the scheduling period corresponding to each scheduling point is the same, a different scheduling delay compensation value is set for each Lin channel in the different Lin channels.

[0123] In one embodiment, the scheduling delay compensation value setting unit 501 is specifically used to:

[0124] Obtain the number of scheduling cycles required for the Lin channel to transmit a message;

[0125] A non-negative integer multiple of the product value of the number of the scheduling cycles and the scheduling cycle is set as a scheduling delay compensation value corresponding to each Lin channel in different Lin channels.

[0126] In one embodiment, the load balancing device further includes a delay call times setting unit, which is used to determine the Lin channel with the shortest processing cycle as the reference Lin channel based on the processing cycle required for the Lin channel to transmit a message;

[0127] Based on the processing cycles of the reference Lin channel and other Lin channels, a corresponding number of delayed calls is set for each of the other Lin channels; wherein the other Lin channels are the Lin channels other than the reference Lin channel in each of the Lin channels;

[0128] Correspondingly,

[0129] The responding to the scheduling request corresponding to each Lin channel at each scheduling point, calling the main function of the corresponding Lin channel after the scheduling delay compensation value, includes:

[0130] In response to the scheduling request corresponding to the reference Lin channel at each scheduling point, after the scheduling delay compensation value corresponding to the reference Lin channel, the main function of the reference Lin channel is called;

[0131] In response to the scheduling requests corresponding to the other Lin channels at the scheduling points, when the number of times the main function of the benchmark Lin channel is called reaches the number of delay calls corresponding to any Lin channel in the other Lin channels, the main function of the corresponding Lin channel is called after the scheduling delay compensation value.

[0132] In one embodiment, the load balancing device further includes a processing cycle acquisition unit, which is used to obtain message information corresponding to each of the Lin channels; and determine the duration of each Lin channel transmitting a message corresponding to its message information as the processing cycle required for the Lin channel to transmit a message.

[0133] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principle is the same, which is not limited in this embodiment.

[0134] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a non-transitory computer-readable storage medium storing computer instructions, a computer program product, and a vehicle.

[0135] Specifically, an embodiment of the present disclosure provides an electronic device, including:

[0136] at least one processor architecture; and

[0137] a memory communicatively connected to the at least one processor architecture; wherein,

[0138] The memory stores instructions that can be executed by the at least one processor architecture, and the instructions are executed by the at least one processor architecture so that the at least one processor architecture can perform the steps of the load balancing method as described above.

[0139] An embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the steps of the aforementioned load balancing method.

[0140] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements the steps of the aforementioned load balancing method when executed by a processor architecture.

[0141] An embodiment of the present disclosure provides a vehicle, which includes one of the aforementioned devices, electronic devices, storage media, or computer program products.

[0142] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, vehicle-mounted devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0143] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded from a storage unit 608 to a RAM (Random Access Memory) 603. In RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.

[0144] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 604, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0145] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor, digital signal processor architecture), and any appropriate processor architecture, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as a load balancing method. For example, in some embodiments, the load balancing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the aforementioned load balancing method in any other appropriate manner (for example, by means of firmware).

[0146] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system that includes at least one programmable processor architecture that may be a dedicated or general-purpose programmable processor architecture that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0147] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor architecture or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor architecture or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0148] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0150] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A load balancing method, characterized in that: include: Based on the task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point, different scheduling delay compensation values ​​are set for each Lin channel; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period; In response to the scheduling requests corresponding to the Lin channels at the scheduling points, the main function of the corresponding Lin channel is called after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

2. The method according to claim 1, characterized in that The method of setting different scheduling delay compensation values ​​for each Lin channel based on task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point includes: Obtaining task information of each Lin channel in a scheduling period corresponding to each scheduling point; If the task information of each Lin channel in the scheduling period corresponding to each scheduling point is the same, a different scheduling delay compensation value is set for each Lin channel in different Lin channels.

3. The method according to claim 2, characterized in that If the task information of each Lin channel in the scheduling period corresponding to each scheduling point is the same, setting a different scheduling delay compensation value for each Lin channel in different Lin channels includes: Obtain the number of scheduling cycles required for the Lin channel to transmit a message; A non-negative integer multiple of the product value of the number of the scheduling cycles and the scheduling cycle is set as a scheduling delay compensation value corresponding to each Lin channel in different Lin channels.

4. The method according to claim 1, characterized in that In response to each Lin channel before the scheduling request corresponding to each scheduling point, the method further includes: Based on the processing cycle required for the Lin channel to transmit a message, determine the Lin channel with the shortest processing cycle as the reference Lin channel; Based on the processing cycles of the reference Lin channel and other Lin channels, a corresponding number of delayed calls is set for each of the other Lin channels; wherein the other Lin channels are the Lin channels other than the reference Lin channel in each of the Lin channels; Correspondingly, The responding to the scheduling request corresponding to each Lin channel at each scheduling point, calling the main function of the corresponding Lin channel after the scheduling delay compensation value, includes: In response to the scheduling request corresponding to the reference Lin channel at each scheduling point, after the scheduling delay compensation value corresponding to the reference Lin channel, calling the main function of the reference Lin channel; In response to the scheduling requests corresponding to the other Lin channels at the scheduling points, when the number of times the main function of the benchmark Lin channel is called reaches the number of delay calls corresponding to any Lin channel in the other Lin channels, the main function of the corresponding Lin channel is called after the scheduling delay compensation value.

5. The method according to claim 4, characterized in that Before the processing cycle required for transmitting a message based on the Lin channel, the method further includes: Obtain the message information corresponding to each of the Lin channels; The duration of each Lin channel transmitting a message corresponding to its message information is determined to be a processing period required for the Lin channel to transmit a message.

6. A load balancing device, characterized in that: include: A scheduling delay compensation value setting unit, used to set different scheduling delay compensation values ​​for each Lin channel based on task information of different local area interconnection network Lin channels in the scheduling period corresponding to each scheduling point; wherein the duration of the scheduling delay compensation value is a non-negative integer multiple of the scheduling period; A main function calling unit is used to respond to the scheduling requests corresponding to each Lin channel at each scheduling point, and call the main function of the corresponding Lin channel after the scheduling delay compensation value, so that the main function executes the task represented by the task information of the corresponding Lin channel within the scheduling period.

7. An electronic device, characterized in that: include: at least one processor architecture; as well as a memory communicatively connected to the at least one processor architecture; wherein, The memory stores instructions that can be executed by the at least one processor architecture, and the instructions are executed by the at least one processor architecture to enable the at least one processor architecture to perform the method according to any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.

9. A computer program product, comprising a computer program, which implements the method of any one of claims 1 to 5 when executed by a processor architecture.

10. A vehicle, characterized in that: The vehicle comprises one of the apparatus of claim 6, the electronic device of claim 7, the storage medium of claim 8 or the computer program product of claim 9.