Communication traffic balancing method, communication component, computer communication system, vehicle and storage medium
By generating a schedule to reasonably arrange the sending time of communication messages, the problem of clustering and loss of communication messages in the computer communication system is solved, and communication load balancing and system stability are achieved.
Patent Information
- Application Number
- CN202211600112.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-13
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-12-13
AI Technical Summary
Without reasonable scheduling of computer communication systems, it is easy to cause short-term communication messages to crowd, and in extreme cases it may even lead to the loss of sent communication messages.
By obtaining the communication configuration table, a scheduling table is generated. The scheduling table includes the message offset of each communication message, so as to reasonably arrange the sending time of each communication message and avoid the clustering of communication messages.
It achieves communication load balancing, avoids the loss of communication messages, and ensures the stability and reliability of the system.
Smart Images

Figure CN116132368B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication traffic balancing method, a communication component, a computer communication system, a vehicle and a storage medium. Background Art
[0002] In related technologies, in order to meet the needs of control and information transmission, computer communication systems often need to establish communications with external related systems and devices to achieve the purpose of sending and receiving control instructions. In actual application, a single embedded system or device (such as an automotive electronic control unit - ECU) often needs to deploy multiple functions or algorithms, and the above functions and algorithms are mostly asynchronous and periodic, and generate a large number of control instructions (communication messages) of different types and different sending cycles. Since the above control instructions need to be sent to the outside asynchronously and periodically, it is easy to cause a short-term communication message clustering phenomenon if it is not properly scheduled, and in extreme cases, it may even cause the loss of the sent communication messages. Summary of the invention
[0003] The present application provides a communication traffic balancing method, a communication component, a computer communication system, a vehicle and a storage medium to solve the problem that a computer communication system often needs to establish communication with external associated systems and devices to achieve the purpose of sending and receiving control instructions, and needs to send them to the outside asynchronously and periodically. If they are not properly scheduled, it is easy to cause a short-term clustering of communication messages, and in extreme cases, it may even cause the loss of sent communication messages.
[0004] The first aspect of the present application provides a communication traffic balancing method, comprising the following steps: obtaining a communication configuration table, the communication configuration table including a basic period of the computer communication system and a message period of each communication message, wherein the message period of the communication message is a sending period of the communication message; generating a scheduling table according to the communication configuration table, the scheduling table including a message offset of each communication message, wherein the message offset of the communication message is the number of basic periods required to be offset by the communication message after the message period is reached; and periodically encapsulating the communication message according to the scheduling table and sending the communication message to an associated system.
[0005] According to the above technical means, the message offset of each communication message can be determined through the scheduling table, so that the sending time of each communication message can be reasonably arranged to avoid the phenomenon of communication message crowding, balance the communication load and avoid communication message loss.
[0006] Further, in certain embodiments, generating a scheduling table according to the communication configuration table includes: traversing the communication configuration table; obtaining the current message period of the current communication message from the communication configuration table; determining the number of communication messages whose message period is currently counted as the current message period in the process of traversing the communication configuration table as the current statistical quantity; calculating the ratio of the current message period to the basic period as the current message interval; calculating the remainder of dividing the current statistical quantity and the current message interval as the current message bias; and writing the current message interval and the current message bias into the scheduling table.
[0007] Furthermore, the communication traffic balancing method also includes: traversing the scheduling table to perform load detection; judging whether there is an overload according to the load detection result; and issuing an alarm in the event of an overload.
[0008] Furthermore, traversing the scheduling table to perform load detection includes: calculating the number of sent messages in each of the basic cycles within a characteristic period, the characteristic period being the least common multiple of all the message periods; judging whether there is an overload based on the load detection result includes: determining that there is an overload when the number of sent messages is greater than the system throughput; and determining that there is no overload when the number of sent messages is less than the system throughput.
[0009] Further, the scheduling table includes the message interval of each of the communication messages, and the calculation of the number of sent messages in each basic period within a characteristic period includes: judging whether the remainder of the first sequence number of the current basic period divided by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic period is the sequence number of the current basic period within the characteristic period; when the remainder of the first sequence number of the current basic period divided by the message interval of the current communication message is the message offset of the current communication message, the number of sent messages is cumulatively added by 1; and traversing all the communication messages to determine the number of sent messages.
[0010] Furthermore, traversing the scheduling table to perform load detection includes: calculating the sending flow of each of the basic cycles within a characteristic period, the characteristic period being the least common multiple of the message period; judging whether there is an overload based on the load detection result includes: determining that there is an overload when the sending flow is greater than the communication bandwidth; and determining that there is no overload when the sending flow is less than the communication bandwidth.
[0011] Furthermore, the scheduling table includes the message interval and message size of each of the communication messages, and the calculation of the sending flow of each of the basic cycles within a characteristic period includes: judging whether the remainder of dividing the first sequence number of the current basic cycle by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic period; when the remainder of dividing the first sequence number of the current basic cycle by the message interval of the current communication message is the message offset of the current communication message, the message size of the current communication message is accumulated and added to the sending flow; and traversing all the communication messages to determine the sending flow.
[0012] Further, the scheduling table includes the message interval of each of the communication messages, and the periodic encapsulation of the communication messages according to the scheduling table and sending the communication messages to the associated system includes: judging whether the remainder of the second sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, wherein the second sequence number of the current basic cycle is the sequence number of the current basic cycle during the communication message sending process; in the case that the remainder of the second sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, encapsulating and sending the current communication message; in the case that all messages in the scheduling table are scanned and all messages that need to be sent are sent within the current basic cycle, waiting for one basic cycle and entering the next basic cycle.
[0013] The second aspect of the present application provides a communication component for a computer communication system. The communication component is used to: obtain a communication configuration table, the communication configuration table includes the basic cycle of the computer communication system and the message cycle of each communication message, wherein the message cycle of the communication message is the sending cycle of the communication message; generate a scheduling table according to the communication configuration table, the scheduling table includes the message offset of each communication message, wherein the message offset of the communication message is the number of basic cycles required for the communication message to be offset after the message cycle is reached; periodically encapsulate the communication message according to the scheduling table and send the communication message to the associated system.
[0014] A third aspect of the present application provides a computer communication system, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the communication traffic balancing method described in the above embodiment.
[0015] A fourth aspect of the present application provides a vehicle, which includes the computer communication system described in the above embodiment.
[0016] The fifth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement the communication traffic balancing method as described in the above embodiment.
[0017] Therefore, the present application has at least the following beneficial effects: the message bias of each communication message can be determined through the scheduling table, so that the sending time of each communication message can be reasonably arranged, the phenomenon of communication message crowding can be avoided, the communication load can be balanced, and the loss of communication messages can be avoided.
[0018] This solves the technical problem that, without reasonable scheduling, communication messages may easily be crowded in a short period of time, and in extreme cases, even the communication messages sent may be lost.
[0019] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0021] Figures 1 to 16 A flow chart of a communication traffic balancing method provided according to an embodiment of the present application;
[0022] Fig.17 is a schematic diagram of the structure of a computer communication system according to an embodiment of the present application;
[0023] Fig.18 It is a schematic diagram of the structure of a vehicle according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0025] In related technologies, in order to meet the needs of control and information transmission, computer communication systems often need to establish communications with external related systems and devices to achieve the purpose of sending and receiving control instructions. In actual application, a single computer communication system or device (such as an automotive electronic control unit ECU) often needs to deploy multiple functions or algorithms, and most of the above functions and algorithms are asynchronous and periodic, and generate a large number of control instructions (communication messages) of different types and different sending cycles.
[0026] Since the above communication messages need to be sent to the outside asynchronously and periodically, if they are not properly scheduled, it is easy to cause a short-term clustering of communication messages, and in extreme cases, even cause the loss of sent communication messages. For fields such as energy, transportation, security, industrial robots, etc. involving the safety of public life and property, the above problems are unacceptable, so it is necessary to take corresponding measures to prevent them.
[0027] Please refer to the accompanying drawings to describe the communication traffic balancing method, communication component, computer communication system, vehicle and storage medium of the embodiment of the present application. In view of the above-mentioned problem that it is easy to cause a short-term communication message clustering phenomenon without reasonable scheduling, and even cause the loss of sent communication messages in extreme cases, the present application provides a communication traffic balancing method, in which the message bias of each communication message is determined by a scheduling table, so that the sending time of each communication message can be reasonably arranged. As a result, the problems of short-term communication message clustering phenomenon, communication message loss, etc. are solved.
[0028] Specifically, Figure 1 A flow chart of a communication traffic balancing method provided in an embodiment of the present application.
[0029] See also Figure 1 , the communication traffic balancing method comprises the following steps:
[0030] Step S01: Acquire a communication configuration table, the communication configuration table including a basic cycle of a computer communication system and a message cycle of each communication message, wherein the message cycle of a communication message is a sending cycle of the communication message;
[0031] Step S02: Generate a scheduling table according to the communication configuration table, the scheduling table including the message offset of each communication message, wherein the message offset of the communication message is the number of basic cycles required to be offset after the communication message reaches the message cycle;
[0032] Step S03: periodically encapsulate communication messages according to the scheduling table and send the communication messages to the associated system.
[0033] The present application discloses a communication component, and the communication flow balancing method of the implementation mode of the present application can be implemented by the communication component of the implementation mode of the present application. That is to say, the communication component is used to: obtain a communication configuration table, the communication configuration table includes the basic cycle of the computer communication system and the message cycle of each communication message, wherein the message cycle of the communication message is the sending cycle of the communication message; generate a scheduling table according to the communication configuration table, the scheduling table includes the message offset of each communication message, wherein the message offset of the communication message is the number of basic cycles required for the communication message to be offset after the message cycle is reached; periodically encapsulate the communication message according to the scheduling table and send the communication message to the associated system.
[0034] The communication traffic balancing method and communication component of the implementation mode of the present application determine the message bias of each communication message through a scheduling table, so as to reasonably arrange the sending time of each communication message, avoid the phenomenon of communication message crowding, balance the communication load, and avoid the loss of communication messages.
[0035] See also Figure 2 In some implementations, a communication configuration table may be obtained. The communication configuration table may be obtained by parsing a configuration file and generating a communication configuration table, and then generating a scheduling table based on multiple information in the communication configuration table. The communication configuration table includes but is not limited to the basic cycle of the computer communication system and the message cycle of each communication message. The basic cycle can be expressed as T basic Indicates that T basic It can be a common divisor of all message cycles, such as the greatest common divisor, 1 / 2 of the greatest common divisor, 1 / 4 of the greatest common divisor, etc. The computer communication system will use this as a cycle to periodically scan the communication schedule and send the communication messages that need to be sent. The message cycle can be expressed as T tx Indicates that T tx The sending cycle of each communication message.
[0036] In some implementations, the communication configuration table also includes configuration items such as the communication message identifier, physical destination address, logical destination address, message size, system throughput, communication bandwidth, etc. It is worth mentioning that system performance parameters such as system throughput and communication bandwidth can be used to implement the load warning function.
[0037] It should be noted that the number of communication messages in the configuration file, the above-mentioned configuration items of each communication message, and the system performance parameters are strongly related to the specific application project requirements and the system's underlying software and hardware performance. Therefore, the configuration file can be generated by the application developer based on the actual project requirements.
[0038] In this way, application developers generate configuration files, and applications can transmit data from multiple applications to the communication component, which can configure parsing, schedule table generation, sending schedules, and load warnings. The communication message is then transmitted to the associated system through the network, which includes but is not limited to Ethernet, Controller Area Network (CAN), and Local Interconnect Network (LIN). For details on the composition of computer communication systems and their external connections, please refer to Figure 3 , the computer communication system 200 of the present application may be an embedded system.
[0039] Then, a scheduling table is generated based on the multiple information in the communication configuration table, and the scheduling table includes the message offset of each communication message. The message offset can be expressed by P offset Indicates that Poffset The number of basic cycles required to offset each communication message after the message cycle arrives. Finally, the communication message can be periodically encapsulated according to the scheduling table and sent to the associated system. In this way, the phenomenon of communication message clustering can be avoided, the communication load is balanced, and the loss of communication messages can be avoided.
[0040] It is worth mentioning that in related technologies, in order to meet the timeliness and security requirements of the control system, most of the upper-level applications and algorithms run periodically with time as the trigger condition. Therefore, they will also periodically generate various control instructions and package them into communication messages of a certain format and send them to external related systems. Usually, the upper-level applications and algorithms run asynchronously, and the operation cycles are different. If the sending of the communication messages they generate is not reasonably scheduled, the number of messages sent by the system at the lowest common multiple of all message cycles will reach a peak, and the number of communication messages required to be sent by the system at other times may be much lower than this. With the increase of system integrated functions, the amount of communication messages at peak times is most likely to exceed the system's throughput capacity and cause some communication messages to be lost.
[0041] In short, the uncontrolled asynchronous and periodic transmission of communication messages will cause load imbalance in the system, which can easily lead to the loss of communication messages and affect the system control function, which is unacceptable for embedded systems.
[0042] Please refer to Table 1 and Figure 4 Table 1 shows the distribution of communication messages sent by the ECU at each moment, taking the deployment of an automotive electronic control unit (SWC) as an example in the related art. Figure 4 It is a schematic diagram of communication load distribution in related technologies. Figure 4 It can be seen that the system load reaches the maximum at n*100ms (n is a non-negative integer), and the load is the smallest at n*100+10ms, n*100+30ms, n*100+70ms, n*100+90ms, etc., and the system load fluctuates greatly between peak and trough periods, resulting in load imbalance.
[0043] Table 1
[0044] Serial number SWC Name Operation cycle (milliseconds) Number of communication messages 1 SWC1 10 1 2 SWC2 20 2 3 SWC3 50 4 4 SWC4 100 3
[0045] In one embodiment, the communication traffic balancing method of the embodiment of the present application can be applied to Ethernet. Therefore, the specific communication configuration table can be found in Table 2 below.
[0046] Table 2
[0047]
[0048] It can be seen from Table 2 above that the basic period is 10 ms. Table 2 includes 10 communication messages, each of which has a corresponding communication message identifier. Among them, the message period of the communication message with the communication message identifier 1001 is 10, the message period of the communication message with the communication message identifier 1101 is 20, the message period of the communication message with the communication message identifier 1102 is 20, the message period of the communication message with the communication message identifier 1201 is 50, the message period of the communication message with the communication message identifier 1202 is 50, the message period of the communication message with the communication message identifier 1205 is 50, the message period of the communication message with the communication message identifier 1204 is 50, the message period of the communication message with the communication message identifier 1301 is 100, the message period of the communication message with the communication message identifier 1302 is 100, and the message period of the communication message with the communication message identifier 1303 is 100.
[0049] Each communication message has a corresponding communication message identifier, and a scheduling table can be generated according to the communication configuration table, the scheduling table including the message offset of each communication message. The specific scheduling table can be found in Table 3 below.
[0050] Table 3
[0051] Communication message identification Belonging to SWC Message cycle (ms) Message interval Message offset P1(1001) SWC1 10 1 0 P2(1101) SWC2 20 2 0 P3(1102) SWC2 20 2 1 P4(1201) SWC3 50 5 0 P5(1202) SWC3 50 5 1 P6(1203) SWC3 50 5 2 P7(1204) SWC3 50 5 3 P8(1301) SWC4 100 10 0 P9(1302) SWC4 100 10 1 P10(1303) SWC4 100 10 2
[0052] As can be seen from Table 3 above, Table 3 includes 10 communication messages and message offsets of 10 communication messages. Among them, the communication message with the communication message identifier 1001 can be P1, and the message offset of P1 is 0; the communication message with the communication message identifier 1101 can be P2, and the message offset of P2 is 0; the communication message with the communication message identifier 1102 can be P3, and the message offset of P3 is 1; the communication message with the communication message identifier 1201 can be P4, and the message offset of P4 is 0; the communication message with the communication message identifier 1202 can be P5, and the message offset of P5 is 1 ; The communication message with the communication message identifier 1205 can be P6, and the message bias of P6 is 2; the communication message with the communication message identifier 1204 can be P7, and the message bias of P7 is 3; the communication message with the communication message identifier 1301 can be P8, and the message bias of P8 is 0; the communication message with the communication message identifier 1302 can be P9, and the message bias of P9 is 1; the communication message with the communication message identifier 1303 can be P10, and the message bias of P10 is 2.
[0053] The message bias of each communication message can be determined according to the scheduling table in Table 3. For example, the message bias of P1 (1001) is determined to be 0, the message bias of P2 (1101) is determined to be 0, the message bias of communication message P3 (1102) is determined to be 1, and so on. In this way, the sending time of each communication message can be reasonably arranged to avoid the phenomenon of communication message crowding, balance the communication load, and avoid the loss of communication messages.
[0054] Please also read Figure 4 and 5 It can be understood that after using the communication traffic balancing method of the embodiment of the present application, the distribution of the communication messages sent by the ECU at each moment is as follows: Figure 5 As shown, the load peak and load valley are 4 and 2 respectively, and no load balancing is performed (such as Figure 4 As shown in Figure 2, the load peak and load valley are 10 and 1 respectively, and the optimization effect is more obvious.
[0055] See also Figure 6 In some embodiments, step S02 includes:
[0056] Step S021: traverse the communication configuration table;
[0057] Step S022: obtaining the current message period of the current communication message from the communication configuration table;
[0058] Step S023: determining the number of communication messages whose message period is currently counted in the process of traversing the communication configuration table as the current statistical number;
[0059] Step S024: Calculate the ratio of the current message period to the basic period as the current message interval;
[0060] Step S025: Calculate the remainder of the current statistical quantity divided by the current message interval as the current message offset;
[0061] Step S026: Write the current message interval and the current message offset into the scheduling table.
[0062] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is, the communication component is used to: traverse the communication configuration table; obtain the current message period of the current communication message from the communication configuration table; determine the number of communication messages whose message period is currently counted as the current message period in the process of traversing the communication configuration table as the current statistical quantity; calculate the ratio of the current message period to the basic period as the current message interval; calculate the remainder of the current statistical quantity and the current message interval as the current message offset; write the current message interval and the current message offset into the scheduling table.
[0063] Please also read Figure 7 And Table 2, Table 2 is a communication configuration table, and the current message period of the current communication message can be obtained in Table 2. In one embodiment, the communication message identified as P6 (1203) in Table 2 is used as the current communication message. The message period of the communication message identified as P6 (1203) is the current message period. It can be known that the current message period is 50 and the basic period is 10ms. The ratio of the current message period and the basic period is calculated as the current message interval, and the current message interval is 5. In the process of traversing the communication configuration table, for example, the message period of the communication message identified as P4 (1201) and P5 (1202) is the same as P6 (1203), so the current statistical quantity is calculated to be 2. The remainder of dividing the current statistical quantity of 2 by the current message interval of 5 is 2, and 2 is the current message offset. In this way, the current message interval 5 and the current message offset 2 of the communication message with the communication message identifier P6 (1203) can be written into the scheduling table.
[0064] The communication configuration table can be traversed to calculate the message interval and message offset of each communication message, so that the sending time of each communication message can be reasonably arranged to avoid the phenomenon of communication message crowding, balance the communication load, and avoid communication message loss.
[0065] The above embodiments are combined with Figure 7 It can be seen that the communication message with the communication message identifier P6 (1203) is the current communication message, that is, Figure 7 In the i-th communication message, i is equal to 6. interval is the current message interval, where P interval =T tx / T basic The current message interval is the number of basic cycles required for each communication message to be sent twice, and is also the number of basic cycles that can be evenly divided into by the communication messages of the same period in each message period. offset is the message offset, the number of basic cycles required for each communication message to be offset after the message cycle arrives, P offse t∈[0, 1, 2, …, P interval -1].
[0066] It can be understood that i is the index of the message configuration item in the configuration table (for example, in P6, i=6), C txi The message period currently counted during the configuration table traversal is T txi The number of communication messages, expressed as C txi %P interval As the message offset P of the i-th message offset .
[0067] Please also read Figure 2 and Figure 8 In some implementations, the communication traffic balancing method further includes:
[0068] Step S04: traverse the scheduling table to perform load detection;
[0069] Step S05: judging whether there is overload according to the load detection result;
[0070] Step S06: In the event of overload, an alarm is issued.
[0071] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is, the communication component is used to: traverse the scheduling table to perform load detection; determine whether there is an overload according to the load detection result; and issue an alarm in the case of overload.
[0072] In one embodiment, the configuration file may include system performance parameters such as system throughput and communication bandwidth, parse the configuration file and generate a communication configuration table, and then generate a scheduling table based on the communication configuration table. In this way, the number of communication messages and the sending flow can be obtained by traversing the scheduling table, and then load detection can be performed. The load detection result can be used to determine whether there is an overload, and an alarm can be issued if there is an overload. In this way, the load early warning function can be realized.
[0073] Please also read Fig. 9 and Fig.10 In some embodiments, step S04 includes:
[0074] Step S041: Calculate the number of sent messages in each basic period within a characteristic period, where the characteristic period is the least common multiple of the message periods;
[0075] Step S05 includes:
[0076] Step S051: when the number of sent messages is greater than the system throughput, it is determined that there is an overload;
[0077] Step S052: When the number of sent messages is less than the system throughput, it is determined that there is no overload.
[0078] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is, the communication component is used to: calculate the number of sent messages in each basic period within a characteristic period, the characteristic period being the lowest common multiple of the message period; when the number of sent messages is greater than the system throughput, determine that there is an overload; when the number of sent messages is less than the system throughput, determine that there is no overload.
[0079] In one embodiment, a characteristic period can be 0-100ms, and the basic period is 10ms. Figure 5, the number of sent messages in the first basic cycle is 4. The characteristic cycle can be understood as the lowest common multiple of all message cycles. When the number of sent messages is greater than the system throughput, it is determined that there is an overload. The system throughput can be a preset value of the number of communication messages preset in advance, that is, when the number of sent messages is greater than the preset value, it is determined that there is an overload and an alarm is issued. When the number of sent messages is less than the preset value, it is determined that there is no overload.
[0080] See also Fig.10 , i is the serial number of the basic period within the characteristic period, L pkgi is the number of messages that need to be sent in the i-th basic cycle, L flowi is the sending traffic of the ith basic cycle.
[0081] See also Fig.11 and Fig.12 In some implementations, the scheduling table includes message intervals of each communication message, and step S041 includes:
[0082] Step S0411: determining whether the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle;
[0083] Step S0412: when the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, the number of sent messages is cumulatively increased by 1;
[0084] Step S0413: traverse all communication messages to determine the number of sent messages.
[0085] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is to say, the communication component is used to: determine whether the remainder of the first sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle; when the remainder of the first sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, the number of sent messages is cumulatively added by 1; and traverse all communication messages to determine the number of sent messages.
[0086] In one embodiment, the current basic cycle can be understood as the basic cycle for which the number of messages to be sent is to be determined. When the current basic cycle is the first basic cycle, the first sequence number may be 0; when the current basic cycle is the second basic cycle, the first sequence number may be 1; when the current basic cycle is the third basic cycle, the first sequence number may be 2; when the current basic cycle is the fourth basic cycle, the first sequence number may be 3; when the current basic cycle is the fifth basic cycle, the first sequence number may be 4.
[0087] It is determined whether a remainder obtained by dividing the first sequence number of the current basic cycle by the message interval of the current communication message is a message offset of the current communication message.
[0088] For example: the current basic cycle is the 6th basic cycle, the first sequence number can be 5, and the current communication message can be a communication message with a communication message identifier of P4 (1201). The ratio of the current message cycle to the basic cycle is calculated as the message interval, so the current message cycle 50 is divided by the basic cycle 10, and the message interval is 5. The remainder of the first sequence number 5 divided by the message interval 5 of P4 (1201) is 0, and the message offset of P4 (1201) is 0. Obviously, the remainder is the message offset of the current communication message, and the number of sent messages is accumulated and added by 1. In this way, all communication messages are traversed to determine the number of messages sent in the current basic cycle.
[0089] For another example: the current basic cycle is the fifth basic cycle, the first sequence number may be 4, and the current communication message may be a communication message with a communication message identifier of P6 (1203). The ratio of the current message cycle to the basic cycle is calculated as the message interval, so the current message cycle 50 is divided by the basic cycle 10, and the message interval is 5. The remainder of the first sequence number 4 divided by the message interval 5 of P6 (1203) is 4, and the message offset of P6 (1203) is 2. Obviously, the remainder is not the message offset of the current communication message, and it can be not counted. In this way, all communication messages are traversed to determine the number of messages sent in the current basic cycle.
[0090] See also Fig.12 , the number of messages sent in the i-th basic cycle is L pkgi , where i is the serial number of the basic period within the characteristic period, j is the message index in the scheduling table, P intervalj is the message interval of the jth message, P offsetj is the message offset of the jth message. pkgi , L flowi is the final calculated value.
[0091] Please also read Fig.10 and Fig.13 In some embodiments, step S04 includes:
[0092] Step S042: Calculate the sending flow of each basic period within a characteristic period, where the characteristic period is the least common multiple of the message period;
[0093] Step S05 includes:
[0094] Step S053: When the sending traffic is greater than the communication bandwidth, it is determined that there is an overload;
[0095] Step S054: When the sending traffic is less than the communication bandwidth, it is determined that there is no overload.
[0096] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is, the communication component is used to: calculate the sending flow of each basic cycle within a characteristic period, the characteristic period is the lowest common multiple of the message period; when the sending flow is greater than the communication bandwidth, determine that there is an overload; when the sending flow is less than the communication bandwidth, determine that there is no overload.
[0097] In one embodiment, a characteristic period can be 0-100ms, and the basic period is 10ms. Figure 5 , the number of sent messages in the first basic cycle is 4, and the sent communication messages are P1, P2, P4 and P8 respectively. The sending flow of each sent communication message can be understood as the message size of each sent communication message. The sending flow of the first basic cycle is 800 (100+100+200+400=800). The characteristic cycle can be understood as the lowest common multiple of all message cycles. When the sending flow is greater than the communication bandwidth, it is determined that there is an overload and an alarm is issued. When the sending flow is less than the communication bandwidth, it is determined that there is no overload.
[0098] See also Fig.14 In some implementations, the scheduling table includes the message interval and message size of each communication message, and step S042 includes:
[0099] Step S0421: determining whether the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle;
[0100] Step S0422: when the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, the message size of the current communication message is accumulated and increased to the sending flow;
[0101] Step S0423: Traverse all communication messages to determine the sending flow.
[0102] The communication flow balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is to say, the communication component is used to: determine whether the remainder of the first sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle; when the remainder of the first sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, the message size of the current communication message is accumulated and added to the sending flow; traverse all communication messages to determine the sending flow.
[0103] In one embodiment, the current basic cycle is the sixth basic cycle, the first sequence number may be 5, and the current communication message may be a communication message with a communication message identifier of P4 (1201). The ratio of the current message cycle to the basic cycle is calculated as the message interval, so that the current message cycle 50 is divided by the basic cycle 10, and the message interval is 5. The remainder of the first sequence number 5 divided by the message interval 5 of P4 (1201) is 0, and the message offset of P4 (1201) is 0. Obviously, the remainder is the message offset of the current communication message, and the message size of the current communication message is accumulated and added to the sending flow. In this way, all communication messages are traversed to determine the sending flow.
[0104] In another embodiment, the current basic cycle is the fifth basic cycle, the first sequence number may be 4, and the current communication message may be a communication message with a communication message identifier of P6 (1203). The ratio of the current message cycle to the basic cycle is calculated as the message interval, so that the current message cycle 50 is divided by the basic cycle 10, and the message interval is 5. The remainder of the first sequence number 4 divided by the message interval 5 of P6 (1203) is 4, and the message offset of P6 (1203) is 2. Obviously, the remainder is not the message offset of the current communication message, and the message size of the current communication message is not accumulated and added to the sending flow. In this way, all communication messages are traversed to determine the sending flow.
[0105] Please also read Fig.15 and Fig.16 In some implementations, the scheduling table includes message intervals of each communication message, and step S03 includes:
[0106] Step S031: determining whether the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the second sequence number of the current basic cycle is the sequence number of the current basic cycle during the communication message sending process;
[0107] Step S032: when the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, encapsulate and send the current communication message;
[0108] Step S033: After scanning all messages in the scheduling table and sending all messages that need to be sent within the current basic cycle, wait for one basic cycle and then enter the next basic cycle.
[0109] The communication traffic balancing method of the embodiment of the present application can be implemented by the communication component of the embodiment of the present application. That is to say, the communication component is used to: determine whether the remainder of the second sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, wherein the second sequence number of the current basic cycle is the sequence number of the current basic cycle during the communication message sending process; when the remainder of the second sequence number of the current basic cycle and the message interval of the current communication message is the message offset of the current communication message, encapsulate and send the current communication message; when the number of communication messages sent reaches the number of messages sent in the current basic cycle, wait for one basic cycle before entering the next basic cycle.
[0110] In one embodiment, the current basic cycle is the 101st basic cycle, and the second sequence number of the current basic cycle is the sequence number of the current basic cycle in the process of sending the communication message, and the second sequence number can be 100. The current communication message can be a communication message with a communication message identifier of P4 (1201). The ratio of the current message cycle and the basic cycle is calculated as the message interval, so that the current message cycle 50 is divided by the basic cycle 10, and the message interval is 5. The remainder of the second sequence number 100 divided by the message interval 5 of P4 (1201) is 0, and the message offset of P4 (1201) is 0. Obviously, the remainder is the message offset of the current communication message, and the current communication message can be encapsulated and sent. When the number of communication messages sent reaches the number of messages sent in the current basic cycle, wait for one basic cycle before entering the next basic cycle.
[0111] See also Fig.16 , the communication message is T basic The scheduling table is scanned periodically to filter and send the communication messages that need to be sent in the current basic cycle. Among them, i is the basic cycle counter, j is the table index of the scheduling table, and P intervalj is the message interval of the jth message, P offsetj is the message offset of the j-th message.
[0112] See also Fig.17 The present application also discloses a computer communication system 200, which includes a memory 220 and a processor 240. The memory 220 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 240, the processor 240 executes the above-mentioned communication traffic balancing method.
[0113] The computer communication system 200 of the implementation mode of the present application determines the message bias of each communication message through a scheduling table, so as to reasonably arrange the sending time of each communication message, avoid the phenomenon of communication message crowding, balance the communication load, and avoid the loss of communication messages.
[0114] It should be noted that the aforementioned explanations of the communication traffic balancing method and the communication component embodiment are also applicable to the computer communication system 200 of this embodiment and will not be repeated here.
[0115] See also Fig.18 The present application discloses a vehicle 1000 , which includes a computer communication system 200 .
[0116] The vehicle 1000 of the implementation mode of the present application determines the message bias of each communication message through a scheduling table, so that the sending time of each communication message can be reasonably arranged to avoid the phenomenon of communication message crowding, balance the communication load, and avoid the loss of communication messages.
[0117] It should be noted that the aforementioned explanations of the communication traffic balancing method and the communication component embodiment are also applicable to the vehicle 1000 of this embodiment and will not be repeated here.
[0118] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by the processor 240, the above communication traffic balancing method is implemented. For example, when the program is executed by the processor 240, the following communication traffic balancing method is implemented:
[0119] Step S01: Acquire a communication configuration table, the communication configuration table including a basic cycle of a computer communication system and a message cycle of each communication message, wherein the message cycle of a communication message is a sending cycle of the communication message;
[0120] Step S02: Generate a scheduling table according to the communication configuration table, the scheduling table including the message offset of each communication message, wherein the message offset of the communication message is the number of basic cycles required to be offset after the communication message reaches the message cycle;
[0121] Step S03: periodically encapsulate communication messages according to the scheduling table and send the communication messages to the associated system.
[0122] In this way, the message offset of each communication message can be determined through the scheduling table, so that the sending time of each communication message can be reasonably arranged to avoid the phenomenon of communication message crowding, balance the communication load, and avoid communication message loss.
[0123] It is worth mentioning that the memory 220 is used to store computer programs that can be run on the processor 240. The memory may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory. The processor 240 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0124] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0125] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0126] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0127] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0128] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0129] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A communication traffic balancing method for a computer communication system, characterized in that: The communication traffic balancing method comprises: Acquire a communication configuration table, wherein the communication configuration table includes a basic cycle of the computer communication system and a message cycle of each communication message, wherein the message cycle of the communication message is a sending cycle of the communication message; Generate a scheduling table according to the communication configuration table, the scheduling table including the message offset of each of the communication messages, wherein the message offset of the communication message is the number of basic cycles that the communication message needs to be offset after the message cycle is reached; periodically encapsulating the communication message according to the scheduling table and sending the communication message to an associated system; The generating a scheduling table according to the communication configuration table comprises: Traversing the communication configuration table; Obtaining a current message period of a current communication message from the communication configuration table; Determine the number of communication messages whose message period currently counted in the process of traversing the communication configuration table is the current message period as the current statistical quantity; Calculating a ratio of the current message period to the basic period as a current message interval; Calculate the remainder of the current statistical quantity divided by the current message interval as the current message offset; Writing the current message interval and the current message offset into the scheduling table; The scheduling table includes message intervals of each of the communication messages, and the periodically encapsulating the communication messages according to the scheduling table and sending the communication messages to the associated system includes: Determine whether the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the second sequence number of the current basic cycle is the sequence number of the current basic cycle during the communication message sending process; When the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, encapsulating and sending the current communication message; When all the messages in the scheduling table are scanned and all the messages that need to be sent are sent within the current basic cycle, the next basic cycle is entered after waiting for one basic cycle.
2. The communication traffic balancing method according to claim 1, characterized in that: The communication traffic balancing method also includes: Traversing the schedule table to perform load detection; Determine whether there is overload based on the load detection result; In the event of an overload, an alarm is issued.
3. The communication flow balancing method according to claim 2, characterized in that: The traversing the scheduling table to perform load detection includes: Calculate the number of sent messages in each basic period within a characteristic period, where the characteristic period is the least common multiple of the message periods; The determining whether there is an overload according to the load detection result includes: When the number of sent messages is greater than the system throughput, determining that an overload exists; When the number of sent messages is less than the system throughput, it is determined that there is no overload.
4. The communication flow balancing method according to claim 3, characterized in that: The scheduling table includes the message intervals of the communication messages, and the calculation of the number of sent messages in each basic period within a characteristic period includes: Determine whether the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle; In the case where the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, the number of sent messages is cumulatively increased by 1; All the communication messages are traversed to determine the number of sent messages.
5. The communication flow balancing method according to claim 2, characterized in that: The traversing the scheduling table to perform load detection includes: Calculate the sending flow of each basic period within a characteristic period, where the characteristic period is the least common multiple of all message periods; The determining whether there is an overload according to the load detection result includes: When the sending flow is greater than the communication bandwidth, determining that there is an overload; When the transmission flow is less than the communication bandwidth, it is determined that there is no overload.
6. The communication flow balancing method according to claim 5, characterized in that: The scheduling table includes the message interval and message size of each of the communication messages, and the calculation of the sending flow of each of the basic cycles within a characteristic cycle includes: Determine whether the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the first sequence number of the current basic cycle is the sequence number of the current basic cycle within the characteristic cycle; In the case where the remainder of the first sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, the message size of the current communication message is cumulatively increased to the sending flow; All the communication messages are traversed to determine the sending flow.
7. A communication component for a computer communication system, characterized in that: The communication component is used to: obtain a communication configuration table, the communication configuration table includes the basic cycle of the computer communication system and the message cycle of each communication message, wherein the message cycle of the communication message is the sending cycle of the communication message; generate a scheduling table according to the communication configuration table, the scheduling table includes the message offset of each communication message, wherein the message offset of the communication message is the number of basic cycles required for the communication message to be offset after the message cycle is reached; periodically encapsulate the communication message according to the scheduling table and send the communication message to the associated system; The generating a scheduling table according to the communication configuration table comprises: Traversing the communication configuration table; Obtaining a current message period of a current communication message from the communication configuration table; Determine the number of communication messages whose message period currently counted in the process of traversing the communication configuration table is the current message period as the current statistical quantity; Calculating a ratio of the current message period to the basic period as a current message interval; Calculate the remainder of the current statistical quantity divided by the current message interval as the current message offset; Writing the current message interval and the current message offset into the scheduling table; The scheduling table includes message intervals of each of the communication messages, and the periodically encapsulating the communication messages according to the scheduling table and sending the communication messages to the associated system includes: Determine whether the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, wherein the second sequence number of the current basic cycle is the sequence number of the current basic cycle during the communication message sending process; When the remainder of the second sequence number of the current basic cycle divided by the message interval of the current communication message is the message offset of the current communication message, encapsulating and sending the current communication message; When all the messages in the scheduling table are scanned and all the messages that need to be sent are sent within the current basic cycle, the next basic cycle is entered after waiting for one basic cycle.
8. A computer communication system, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the communication traffic balancing method described in any one of claims 1 to 6.
9. A vehicle, characterized in that: The vehicle includes the computer communication system of claim 8.
10. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the processor executes the communication traffic balancing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Time synchronization and scheduling method for vehicular Ethernet
CN108173614A
Method and device for scheduling network traffic
CN112751773A