Method for calculating frame collision rate of frames on CAN bus and method for minimizing CAN bus resources

By employing the Erlang B formula to calculate frame collision rates and optimizing CAN bus resources, the method addresses inefficiencies in existing technologies, achieving accurate collision rate calculations and optimal resource allocation.

JP2025518593AActive Publication Date: 2025-06-17SHENZHEN POWEROAK NEWENER CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2024569455
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-05-24
Filing Date
2023-05-19
Publication Date
2025-06-17
Estimated Expiration
2043-05-19

AI Technical Summary

Technical Problem

Existing technologies lack a method to accurately calculate the frame collision rate on a CAN bus and optimize bus resources, leading to inefficiencies and resource wastage.

Method used

A method using the Erlang B formula in queuing theory to calculate the frame collision rate based on CAN bus communication rate, frame transmission frequency, and frame length, while optimizing bus resources by adjusting the communication rate.

Benefits of technology

This approach allows for accurate calculation of frame collision rates and optimal allocation of CAN bus resources, reducing the likelihood of frame collisions and minimizing resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025518593000001_ABST
    Figure 2025518593000001_ABST
Patent Text Reader

Abstract

The present invention provides a method for calculating the frame collision rate of frames on a CAN bus and a method for minimizing CAN bus resources. The method for minimizing CAN bus resources includes: S1, setting an initial CAN bus communication rate; S2, calculating the frame collision rate of frames of each priority that operate systematically on the CAN bus based on the Erlang B formula in queuing theory at the preset rate in step S1; S3, determining whether the frame collision rate of frames of each priority calculated in step S2 exceeds the upper limit of the allowable frame collision rate for frames of that priority. If it exceeds the upper limit, increase the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle. If it does not exceed the upper limit, decrease the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle; S4, outputting the minimum communication rate corresponding to not exceeding the upper limit of the allowable frame collision rate for frames of each priority to complete the optimization. The present invention provides an algorithm for the frame collision rate, and further calculates the required minimum bus resources from the upper limit of the frame collision rate of frames of each priority to optimize the resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data transmission technology, and more particularly to a method for calculating the frame collision rate of frames on a CAN bus and a method for minimizing CAN bus resources.

Background Art

[0002] In the automotive industry, various electronic control systems have been developed in response to requirements for safety, comfort, convenience, low power consumption, and low cost. Since the data types and reliability requirements for communication between these systems are different, they are often composed of multiple buses, and accordingly, the number of harnesses also increases. To meet the needs of "reducing the number of harnesses" and "performing high-speed communication of a large amount of data via multiple LANs", the Bosch Group, a German electric commercial company, developed a CAN communication protocol for automobiles in 1986.

[0003] Regarding CAN, its full name is Controller Area Network. It is a data protocol bus proposed by the German Bosch Group in 1985 and is now widely used in the field of distributed real-time control such as automotive electronics and industrial automation. Compared with general communication buses, CAN bus data communication has high reliability, real-time performance, and flexibility. Due to its excellent performance and unique design, the CAN bus is being increasingly emphasized. It is most widely used in the automotive field, and several well-known automotive manufacturers around the world have adopted the CAN bus to realize data communication between the vehicle internal control system and various detection and execution means. At the same time, due to the characteristics of the CAN bus itself, its application scope is no longer limited to the automotive industry and is developing in fields such as automatic control, aerospace, navigation, process industry, machinery industry, textile machinery, agricultural machinery, robots, NC machine tools, medical devices, and sensors. It is regarded as a computer LAN in the automation field. Its emergence provides strong technical support for distributed control systems to achieve reliable real-time data communication between nodes. CAN has already become an international standard and is regarded as one of the most promising field buses.

[0004] The data segment of the CAN bus frame allows a maximum of 8 bytes, adopts a short frame structure, has a short transmission time, and a low probability of being interfered with. However, as the bus load rate increases, frame collision events on the bus are inevitable. To improve reliability, when developing product protocols using the CAN bus, it is common to prevent frame collision events by transmitting periodic frames or adding random waiting times to the frames to be transmitted. However, doing so will undoubtedly reduce communication efficiency and cause waste of communication resources.

[0005] Note that the information disclosed in the above Background Art section is only for understanding the background of the present application, and thus may include information that does not constitute the prior art known to those skilled in the art.

Summary of the Invention

[0006] An object of the present invention is to overcome the drawbacks that the prior art cannot calculate the frame collision rate and further optimize the bus resources, and to provide a method for calculating the frame collision rate of frames on a CAN bus and a method for minimizing CAN bus resources.

[0007] To achieve the above object, the present invention adopts the following technical solutions.

[0008] A method for calculating the frame collision rate of frames on a CAN bus, which is obtained by calculating the frame collision rate of frames based on the Erlang B formula in queuing theory from the CAN bus communication rate, the frame transmission frequency, and the frame length.

[0009] In some embodiments, frames on the CAN bus have multiple priorities, and the frame collision rate of frames of each priority is calculated in descending order of priority. Here, the frame collision rate of the frame with the highest priority is directly calculated using the Erlang B formula, and the frame collision rate of frames of each remaining priority is calculated by a combination of the Erlang B formula, the cumulative traffic load of the priority, and the overflow traffic load.

[0010] In some embodiments, the frame collision rate Bp[i] of frames of each priority is calculated as follows. JPEG2025518593000002.jpg24128Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities that decrease sequentially, the number of priorities operating systematically on the CAN bus is p, A[i] represents the traffic load of priority i on the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of priority i, and A_L[i] represents the overflow traffic load where higher priorities overflow to priority i.

[0011] In some embodiments, the traffic load A[i] of priority i for the CAN bus, the cumulative traffic load L_S[i] of priority i, and the overflow traffic load A_L[i] where a higher priority overflows to priority i are calculated as follows, respectively. JPEG2025518593000003.jpg48126 Here, L[i] and S[i] represent the transmission frequency and frame length of the frame of priority i, respectively, and B represents the current CAN bus communication rate.

[0012] The following steps, namely, S1. Set the initial CAN bus communication rate. S2. Calculate the frame collision rate of each priority frame that operates periodically on the CAN bus based on the Erlang B formula in queuing theory at the CAN bus communication rate of step S1. S3. Determine whether the frame collision rate of each priority frame calculated in step S2 exceeds the upper limit of the frame collision rate allowed for the frame of that priority. If it exceeds the upper limit, increase the CAN bus communication rate of step S1 and proceed to step S2 to continue the cycle. If it does not exceed the upper limit, decrease the CAN bus communication rate of step S1 and proceed to step S2 to continue the cycle. S4. Output the minimum communication rate corresponding to not exceeding the upper limit of the frame collision rate allowed for each priority frame to complete the optimization, including a method for minimizing CAN bus resources.

[0013] In some embodiments, in step S1, a fixed value is given as the initial CAN bus communication rate.

[0014] In some embodiments, in step S1, the initial CAN bus communication rate is calculated by the following formula. JPEG2025518593000004.jpg1051 Here, B_x is the initial CAN bus communication rate, and L[0], S[0], and Bp_T[0] represent the transmission frequency, frame length, and upper limit of the allowable frame collision rate of the frame with the highest priority, respectively.

[0015] In some embodiments, step S2 includes calculating the frame collision rate of frames of each priority in descending order of priority based on the Erlang B formula in queuing theory at the CAN bus communication rate of step S1. Here, the frame collision rate of the frame with the highest priority is calculated directly using the Erlang B formula, and the frame collision rate of frames of each remaining priority is calculated by combining the Erlang B formula with the cumulative traffic load and overflow traffic load of the frames of that priority.

[0016] In some embodiments, the frame collision rate Bp[i] of frames of each priority is calculated as follows. JPEG2025518593000005.jpg24128 Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities that decrease sequentially, the number of priorities operating periodically on the CAN bus is p, A[i] represents the traffic load of priority i for the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of priority i, and A_L[i] represents the overflow traffic load where higher priorities overflow to priority i.

[0017] In some embodiments, the calculation method of A[i] is as follows. JPEG2025518593000006.jpg927 Here, L[i] and S[i] represent the transmission frequency and frame length of frames of priority i, respectively, and B represents the current CAN bus communication rate.

[0018] In some embodiments, the calculation method of L_S[i] is as follows. JPEG2025518593000007.jpg1181

[0019] In some embodiments, the calculation method of A_L[i] is as follows. JPEG2025518593000008.jpg11123

[0020] In some embodiments, the method of increasing or decreasing the CAN bus communication rate in step S3 is a step method and / or a binary search.

[0021] The present invention further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the method for minimizing the CAN bus resources can be realized.

[0022] Compared with the prior art, the technical solution of the present invention has the following beneficial effects.

[0023] In the prior art, there is no specific algorithm for the frame collision rate, and it is impossible to know how much the frame collision rate is in a specific case (including the CAN bus communication rate, the transmission frequency of frames of each priority, the frame length of frames of each priority, and the number of priorities), so the minimization of bus resources cannot be achieved. The present invention provides an algorithm for calculating the frame collision rate based on the Erlang B formula in the queuing theory, and after calculating the frame collision rate, optimizes the bus resources, and when the transmission frequency and the frame length are fixed, can find the required minimum bus resources that satisfy that the frame collision rate does not exceed the upper limit of the allowable frame collision rate, thereby realizing the optimal allocation of bus resources.

[0024] The fact that the CAN bus communication rate is relatively low means that the bus bandwidth is relatively low, the requirements for components are small, and at the same time the probability of being affected by electromagnetic interference from other components is reduced, increasing the reliability of communication. The present invention accurately calculates the required minimum bus resources (communication rate) from the preset upper limits of the transmission frequencies of frames of each priority and the frame collision rates of frames of each priority, and achieves the goals of flexible resource allocation and optimization of resource use.

[0025] The present invention is applied to the development stage of products adopting a CAN communication bus, relates to a design method of the CAN bus, and in particular, when the bus load is large and frames of multiple priorities are transmitted simultaneously, it improves the design efficiency and optimizes the utilization rate of bus resources, enabling the CAN bus user to realize the optimal allocation of bus resources in the development stage according to different usage scenarios, and saving CAN bus resources.

Brief Description of the Drawings

[0026]

Figure 1

Figure 2

Figure 3

Modes for Carrying Out the Invention

[0027] Hereinafter, embodiments of the present invention will be described in detail. It is emphasized that the following description is merely exemplary and does not limit the scope of the present invention and its application.

[0028] The terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly referring to the number of technical features indicated. Thus, the features limited by "first" and "second" may explicitly or implicitly include one or more of such features. In the description of embodiments of the present invention, the meaning of "a plurality of" means two or more unless otherwise clearly and specifically limited.

[0029] When designing and developing a product using a CAN bus, first, it is necessary to plan the arrangement of CAN bus resources. Currently, designers often refer to the empirical values accumulated in the past. For example, in order to reduce the probability of frame collision events occurring on the bus, generally, the load rate of the CAN bus is set to 30% or less. The load rate can be obtained by simply calculating from the number of nodes connected to the bus, the transmission frequency of each node, and the frame length. A priority mechanism is introduced into the CAN bus. Each priority competes for the use of the bus transmission resources through a non-destructive arbitration mechanism. The CAN bus protocol can currently support up to 8 priorities. The protocol defines that the smaller the value of the bit flag bit, the higher the priority of the bit. That is, 0x00 has the highest priority, and the priority of 0x07 is the lowest. When frames with high and low priorities transmit data to the bus at the same time, the high-priority frame automatically acquires the transmission resources, and the low-priority frame exits from the arbitration. The low-priority frame retransmits the frame again during the idle time of the bus resources through the automatic retransmission mechanism. In this way, frame collision events occur for low-priority frames. In a specific business scenario, the designer may pay particular attention to the frame collision rate of frames with a certain priority. However, the frame collision rates of frames with different priorities are in a non-linear relationship and cannot be obtained by simple calculation.

[0030] Considering the difficulties of resource allocation planning in the current development stage of the CAN bus, the present invention provides an optimization design method for the CAN bus. First, an algorithm is provided that can accurately calculate the frame collision rate of frames with each priority. Using the Erlang B formula in queuing theory, this algorithm can accurately calculate the frame collision rate of frames with each priority in descending order of priority, and further optimize the resource allocation of the CAN bus to minimize bus resources. Specifically, calculate the frame collision rate of frames with each priority at a given bus communication rate and frame transmission frequency, and then compare it with the upper limit of the allowable frame collision rate of frames with each preset priority. If it may exceed the upper limit of the allowable frame collision rate, increase the bus bandwidth (i.e., increase the communication rate). If it does not exceed the upper limit of the allowable frame collision rate, lower the communication rate. Then continue to calculate the frame collision rate of frames with each priority at the new communication rate, compare it with the upper limit of the allowable frame collision rate, and perform such a cycle until the minimum communication rate is obtained where the calculated frame collision rate of frames with each priority does not exceed the corresponding upper limit of the allowable frame collision rate. At this time, the bus bandwidth (communication rate) is the lowest bus bandwidth that satisfies not exceeding the upper limit of the allowable frame collision rate when the transmission frequency and frame length are fixed, realizing the optimization of bus resources.

[0031] As shown in FIGS. 1 and 3, the specific steps of the method for minimizing CAN bus resources according to the embodiment of the present invention are as follows.

[0032] S1. Set the initial CAN bus communication rate.

[0033] Give an initial communication rate B_x of the CAN bus that is relatively small or relatively large. This fixed value can take values from 0, and it is a method of calculating the minimum communication rate that satisfies the conditions through cycle judgment. However, since this method has a large amount of calculation and a slow calculation speed, in order to reduce the amount of calculation and improve the calculation efficiency, this embodiment calculates and obtains the initial communication rate of the CAN bus using the following formula. JPEG2025518593000009.jpg1051 Here, B_x is the initial CAN bus communication rate, and L[0], S[0], and Bp_T[0] represent the transmission frequency, frame length, and upper limit of the allowable frame collision rate of the frame with the highest priority, respectively.

[0034] S2. When the CAN bus communication rate and the transmission traffic of each priority are fixed, the frame collision rate of the frames of each priority can be calculated and obtained. As shown in FIG. 2, the specific process is as follows: At the CAN bus communication rate of step S1, based on the Erlang B formula in the queuing theory, calculate the frame collision rate of the frames of each priority operating regularly on the CAN bus. Here, the frame collision rate of the frame with the highest priority is directly calculated using the Erlang B formula, and the frame collision rate of the frames of each remaining priority is calculated by combining the Erlang B formula with the cumulative traffic load and overflow traffic load of the priority.

[0035] Generally, for the Erlang B formula, it is necessary to know three parameters, namely the frame arrival rate λ, the service rate μ (1 / μ is the time required for service), and the number of servers k. That is, Bp = Erlang B(A,k). Here, A = λ / μ and k is the number of servers. In this application, when applying the Erlang B formula to calculate the frame collision rate on the CAN bus, since the frames of all priorities operate on one CAN bus, the number of servers k is normalized, that is, the CAN bus is regarded as one server and k = 1. L is the transmission frequency of a certain priority and corresponds to λ in the Erlang B formula. S is the frame length of the frames of a certain priority, and B represents the current CAN bus communication rate. Then, S / B is the time required for the CAN bus to transmit one frame of a certain priority and corresponds to 1 / μ in the Erlang B formula. Therefore, the Erlang B formula can be JPEG2025518593000010.jpg1040 rewritten as.

[0036] The frame collision rate Bp[i] of frames with each priority i is calculated as follows. JPEG2025518593000011.jpg24128Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities that decrease sequentially, the number of priorities operating systematically on the CAN bus is p, A[i] represents the traffic load of frames with priority i for the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of frames with priority i, A_L[i] represents the overflow traffic load where higher priorities overflow to priority i. Here, the traffic load means the ratio of the sum of the traffic of each priority to the transmission rate of the CAN bus.

[0037] Here, the calculation method of A[i] is as follows. JPEG2025518593000012.jpg927Here, L[i], S[i] represent the transmission frequency and frame length of frames with priority i respectively, B represents the current CAN bus communication rate, and the calculation method of the cumulative traffic load L_S[i] is as follows. JPEG2025518593000013.jpg1179The calculation method of the overflow traffic load A_L[i] is as follows. JPEG2025518593000014.jpg11120

[0038] S3. Determine whether the frame collision rate of frames with each priority calculated in step S2 exceeds the upper limit of the allowable frame collision rate for frames with that priority. If it exceeds the upper limit, increase the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle. If it does not exceed the upper limit, decrease the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle.

[0039] Here, the method of increasing / decreasing the CAN bus communication rate may be a step method, and the fixed step size thereof can be adjusted according to the actual situation. For example, the communication rate (i.e., bus bandwidth) is increased / decreased with a fixed step size of 100 bit / s or 1000 bit / s. A relatively small fixed step size can obtain more accurate results but increases the number of calculation iterations and calculation time. Conversely, a relatively large fixed step size reduces the accuracy of the calculation results but improves the calculation speed. Selecting a relatively appropriate fixed step size needs to depend on the accumulation of the designer's past experience.

[0040] In some other embodiments, the method of increasing / decreasing the CAN bus communication rate may adopt a binary search. For example, through two or more cycles, a relatively large bus communication rate and a relatively small bus communication rate are obtained. At the relatively small communication rate (Data1), the frame collision rate of all priority frames does not exceed the upper limit of the frame collision rate of the frames of the corresponding priority. At the relatively large communication rate (Data2), the frame collision rate of at least one priority frame exceeds the upper limit of the frame collision rate of the frames of the corresponding priority. Then, the communication rate Data3 of the next cycle can perform a binary search between [Data1, Data2]. If the frame collision rate of all priority frames at the communication rate Data3 does not exceed the upper limit of the frame collision rate of the frames of the corresponding priority, the communication rate Data4 of the next cycle performs a binary search between [Data1, Data3]. If the frame collision rate of at least one priority frame at the communication rate Data3 exceeds the upper limit of the frame collision rate of the frames of the corresponding priority, the communication rate Data4 of the next cycle performs a binary search between [Data3, Data2]. The above cycles are performed until the minimum communication rate that does not exceed the upper limit of the frame collision rate of each priority frame is found. Compared with the step method, using binary search can, in some cases, reduce the calculation amount and significantly increase the calculation speed.

[0041] In some other embodiments, the method of increasing / decreasing the CAN bus communication rate can also combine the step method with binary search.

[0042] S4. Output the minimum communication rate corresponding to the situation where the upper limit of the frame collision rate allowed for frames of each priority is not exceeded, and complete the optimization.

[0043] Example 1: One lithium battery energy storage product has one inverter, and one IoT communication module and four battery packs are connected to the CAN bus. These three devices transmit data to the CAN bus periodically or irregularly (triggered by an event).

[0044] The settings for the priority of the transmission frame are as follows: for an alarm information frame or an inquiry information frame of an event trigger, the frame length is 128 bits (bit), and the high priority (0X02); for a periodic broadcast data frame, the frame length is 256 bits (bit), and the low priority (0X06). The design index of the frame collision rate for the high-priority frame is ≤3%, and the design index of the frame collision rate for the low-priority frame is ≤10%.

[0045] Table 1 below shows the types, transmission frequencies, and frame lengths of the content transmitted by the inverter module to the CAN bus.

[0046] Table 1 JPEG2025518593000015.jpg94146

[0047] Table 2 below shows the types, transmission frequencies, and frame lengths of the content transmitted by the IoT communication module to the CAN bus.

[0048] Table 2 JPEG2025518593000016.jpg15128

[0049] Table 3 below shows the types, transmission frequencies, and frame lengths of the content that the battery pack module (Pack) transmits data to the CAN bus.

[0050] Table 3 JPEG2025518593000017.jpg37131

[0051] The following provides an implementation method of an embodiment of the present invention based on the data shown in the above table.

[0052] In this embodiment, there are only two priorities, 0X02 and 0X06. Here, 0X02 is the high priority and 0X06 is the low priority. The total traffic of each priority is calculated as follows. High priority: JPEG2025518593000018.jpg5146bit / s Low priority: JPEG2025518593000019.jpg5128bit / s

[0053] S1. Set the initial CAN bus communication rate, that is, give a relatively small / relatively large initial communication rate B_x of the CAN bus. This fixed value can take values from 0, and it is a method of calculating the minimum communication rate that meets the conditions by cycle judgment. However, in this method, the calculation amount is large and the calculation speed is slow. Therefore, in order to reduce the calculation amount and improve the calculation efficiency, this embodiment calculates the initial communication rate of the CAN bus using the following formula. JPEG2025518593000020.jpg1051Here, B_x is the initial CAN bus communication rate, and L[0], S[0], Bp_T[0] represent the transmission frequency, frame length, and upper limit of the allowable frame collision rate of the highest priority, respectively.

[0054] In this embodiment, there are only two priorities, 0X02 and 0X06. Here, 0X02 is the high priority and 0X06 is the low priority. Therefore, this embodiment calculates the initial communication rate using the design index that the frame collision rate of the frame with high priority 0X02 ≤ 3%. JPEG2025518593000021.jpg34128

[0055] S2. When the CAN bus communication rate and the transmission traffic of each priority are fixed, the frame collision rate of each priority can be calculated and obtained. The frame collision rate Bp[i] of the frame i of each priority is calculated as follows. JPEG2025518593000022.jpg24128Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities that decrease sequentially, the number of priorities operating systematically on the CAN bus is p, A[i] represents the traffic load of priority i for the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of priority i, and A_L[i] represents the overflow traffic load where a higher priority overflows to priority i. Here, the traffic load means the ratio of the total traffic of each priority to the transmission rate of the CAN bus.

[0056] Transmission by the event trigger method is to transmit based on the user's command. When the user clicks the inquiry command at a certain time, the inquiry information frame sent by the user is transmitted by the CAN bus. The transmission frequency is completely determined by the user and is random. There may be no inquiry command within one day (24 hours), and there may be multiple inquiry commands in a certain time period (within 10 minutes). The more inquiry commands there are, the greater the load traffic. Considering the randomly triggered information frame as periodic transmission, the total high - priority traffic is calculated when the load traffic is the largest. The case where the load traffic is the largest can be regarded as the worst case (or the most extreme case). When calculating the total high - priority traffic, assuming the worst case, the total high - priority traffic is calculated as follows. JPEG2025518593000023.jpg 5146 bit / s

[0057] The total flow rate of low priority (0X06) is calculated as follows. JPEG2025518593000024.jpg 5128 bit / s

[0058] In the calculation formula of the frame collision rate Bp[i], the calculation formula of the traffic load A[i] for each priority is as follows. JPEG2025518593000025.jpg 927

[0059] In this embodiment, first, B uses the initial communication rate of 202380.8 bit / s calculated in step S1, and then the traffic load of frames for each priority is calculated as follows. A[0] = 6259.2 / 202380.8 = 0.0309278 A[1] = 6144 / 202380.8 = 0.0303586

[0060] Regarding the frame collision rate of high-priority frames, it is directly calculated using the Erlang B formula as follows. JPEG2025518593000026.jpg 1066

[0061] Regarding the frame collision rate of frames with other priorities, it is necessary to first calculate the integrated traffic load and the overflow traffic load, and their calculation formulas and specific calculation results are as follows.

[0062] The calculation formula of the cumulative traffic load L_S[i] is as follows. JPEG2025518593000027.jpg 1179 Then, JPEG2025518593000028.jpg 7128.

[0063] The calculation formula of the overflow traffic load A_L[i] is as follows. JPEG2025518593000029.jpg11121 Then, JPEG2025518593000030.jpg7128 it is.

[0064] Finally, calculate the low - priority frame collision rate, and it is as follows. JPEG2025518593000031.jpg5180

[0065] S3. Determine whether the frame collision rate of each priority frame calculated in step S2 exceeds the upper limit of the allowable frame collision rate of the frame of that priority. If it exceeds the upper limit, increase the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle. If it does not exceed the upper limit, decrease the CAN bus communication rate in step S1 and proceed to step S2 to continue the cycle.

[0066] The method of increasing / decreasing the CAN bus communication rate may be a step - by - step method. For example, the fixed step size is 100 bit / s or 1000 bit / s, and the method may be a binary search or a combination of the step - by - step method and the binary search.

[0067] In this embodiment, Bp[0]=3% and Bp[1]=8.7%, and since it does not exceed the allowable frame collision rates of 3% and 10%, further decrease the CAN bus communication rate of 202380.8 bit / s in step S1 to 200 kbit / s.

[0068] The frame collision rates of the two priorities calculated at a communication rate of 200 kbit / s are as shown in Table 4 below.

[0069] Table 4 Frame collision rates of two priorities when the communication rate is 200 kbit / s JPEG2025518593000032.jpg15153

[0070] Based on the design indicators, the high priority does not meet the design indicators, the low priority meets the design indicators, and overall, the design indicators are still not met. Therefore, select a value between [200000 bit / s, 202380.8 bit / s] and recalculate. For example, use binary search to select 201190.4 bit / s for calculation. As a result of the calculation, it is found that the high priority still does not meet the design indicators.

[0071] Finally, by continuously circulating the search, the minimum communication rate that meets the design indicators is calculated to be 202380.8 bit / s. The frame collision rates of the two priorities at this communication rate are as follows in Table 5.

[0072] Table 5 Frame collision rates of two priorities at the minimum communication rate JPEG2025518593000033.jpg15153

[0073] S4. Output the minimum communication rate corresponding to not exceeding the upper limit of the allowable frame collision rate for each priority frame to complete the optimization.

[0074] Generally, the communication rate is in units of 1000 bit / s, so the minimum communication rate of 202380.8 bit / s is output as 203 kbit / s.

[0075] Example 2 Other conditions of this example are the same as those of Example 1, and the difference is that the initial communication rate of the CAN bus is set to 250 kbit / s.

[0076] When the CAN bus communication rate and the transmission flow rates of each priority are fixed, calculate and obtain the frame collision rate of a specific priority frame. Calculate the frame collision rate of the frame with the highest priority directly using the Erlang B formula, and calculate the frame collision rates of the frames of the remaining priorities using a combination of the Erlang B formula, the cumulative flow load of the priority, and the overflow flow load. Calculate the frame collision rates of the two priorities respectively and show them in Table 6 below.

[0077] Table 6 Frame collision rates of two priorities when the communication rate is 250 kbit / s JPEG2025518593000034.jpg15153

[0078] Based on the design indicators, it is necessary to control the frame collision rate of frames with high priority 0 (0x02) to 3% or less, and it is necessary to control the frame collision rate of frames with low priority 1 (0x06) to 10% or less. Although the above results meet the design indicators, the obtainable values are too high, so the requirement to output the minimum communication rate of the CAN bus is not satisfied. Therefore, a new value of the CAN bus communication rate is set to 150 kbit / s.

[0079] The frame collision rates of two priorities when the value of the CAN bus rate is 150 kbit / s are shown in Table 7 below.

[0080] Table 7 Frame collision rates of two priorities when the communication rate is 100 kbit / s JPEG2025518593000035.jpg15153

[0081] Based on the design indicators, it is obvious that the above results do not meet the design indicators. Therefore, the CAN bus communication rate is readjusted. By using binary search, 200 kbit / s between [150 kbit / s, 250 kbit / s] can be selected for recalculation, and the frame collision rates of two priorities are the same as those in Table 4.

[0082] Based on the design indicators, the frame collision rate of the high-priority frame is 3.03%, which does not meet the design indicators, and the frame collision rate of the low-priority frame is 8.70%, which meets the design indicators. Overall, the design indicators are still not met. Therefore, by continuously using binary search, the minimum communication rate that meets the design indicators can be found.

[0083] Finally, by calculation, the minimum CAN bus resources that meet the design indicators can be obtained, as shown in Table 5 above. The required communication rate of the CAN bus at this time is 202380.8 bit / s. The goal of minimizing CAN bus resources is achieved.

[0084] The present invention uses the Erlang B formula in queuing theory to accurately calculate the frame collision rate of frames of each priority in descending order of priority based on data such as a fixed transmission frequency, frame length, and a given communication rate, and then compares it with a preset upper limit of the allowable frame collision rate to determine whether it exceeds the upper limit of the allowable frame collision rate. If it exceeds the upper limit, the communication rate (i.e., bus bandwidth) is continuously increased. If it does not exceed the upper limit, the communication rate is decreased, and the process returns to the calculation of the frame collision rate to recalculate the frame collision rate until the minimum communication rate corresponding to not exceeding the upper limit of the allowable frame collision rate for frames of each priority is obtained. Thereby, the minimum CAN bus communication rate is calculated to achieve the optimization of CAN bus resource allocation. It has been found that using the calculation formula provided by the present invention from Example 2 to calculate the initial communication rate can significantly reduce the calculation amount and improve the calculation efficiency.

[0085] As will be understood by those skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. For example, the present invention can further provide a readable storage medium storing a computer program, which can implement the steps of the method for minimizing CAN bus resources of the above embodiments when the computer program is executed by a processor. Therefore, the present invention can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. And the present invention can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0086] The present invention will be described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that computer program commands can implement each flow and / or block in the flowchart and / or block diagram, as well as combinations of flows and / or blocks in the flowchart and / or block diagram. These computer program commands may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, whereby the commands executed by the processor of the computer or other programmable data processing device generate an apparatus for realizing the specified functions in one or more flows in the flowchart and / or one or more blocks in the block diagram.

[0087] These computer program commands may be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, whereby the commands stored in this computer-readable memory produce an article of manufacture including a command apparatus, and this command apparatus realizes the specified functions in one or more flows in a flowchart and / or in one or more blocks in a block diagram.

[0088] These computer program commands may also be loaded onto a computer or other programmable data processing device, whereby a series of operational steps are executed on the computer or other programmable data processing device to produce a process realized by the computer, and thus the commands executed on the computer or other programmable data processing device provide steps for realizing the specified functions in one or more flows in a flowchart and / or in one or more blocks in a block diagram.

[0089] The above content further elaborates on the present invention in more detail based on specific / preferred embodiments, and it should not be considered that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art to which the present invention pertains, it is also possible to make some alternatives or modifications to these described embodiments without departing from the design of the present invention, and these alternative or modified forms should be regarded as belonging to the protection scope of the present invention. In the description of this specification, descriptions related to reference terms such as "an embodiment", "some embodiments", "preferred embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials, or characteristics described based on this embodiment or example are included in at least one embodiment or example of the present invention. In this specification, exemplary expressions for the above terms do not necessarily have to be for the same embodiment or the same example. And the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more of the embodiments or examples. Without contradiction, those skilled in the art can integrate or combine different embodiments or examples, and the features of different embodiments or examples described in this specification. Although the embodiments of the present invention and their advantages have been described in detail, it should be understood that various changes, substitutions, and modifications can be made in this specification without departing from the protection scope of the patent application.

Claims

1. Calculating the frame collision rate of frames on a CAN bus based on the Erlang B formula in queuing theory from the CAN bus communication rate, the transmission frequency of frames, and the frame length.

2. Frames on the CAN bus have multiple priorities, and the frame collision rate of frames with each priority is calculated in descending order of priority. Here, the frame collision rate of the frame with the highest priority is directly calculated using the Erlang B formula, and the frame collision rate of frames with each of the remaining priorities is calculated by combining the Erlang B formula with the cumulative traffic load and overflow traffic load of that priority.

3. The frame collision rate Bp[i] of frames with each priority is calculated as follows: Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities in descending order, the number of priorities operating regularly on the CAN bus is p, A[i] represents the traffic load of priority i for the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of priority i, and A_L[i] represents the overflow traffic load where higher priorities overflow to priority i.

4. The traffic load A[i] of priority i for the CAN bus, the cumulative traffic load L_S[i] of priority i, and the overflow traffic load A_L[i] where higher priorities overflow to priority i are calculated as follows: Here, L[i] and S[i] represent the transmission frequency and frame length of frames with priority i respectively, and B represents the current CAN bus communication rate.

5. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the method for calculating the frame collision rate on the CAN bus according to any one of claims 1 to 4 can be realized. A computer-readable storage medium characterized by this.

6. The following steps, namely, S1, setting an initial CAN bus communication rate; S2, calculating the frame collision rate of frames of each priority that operate periodically on the CAN bus based on the Erlang B formula in queuing theory at the CAN bus communication rate of step S1; S3, determining whether the frame collision rate of frames of each priority calculated in step S2 exceeds the upper limit of the allowable frame collision rate of frames of that priority. If it exceeds the upper limit, increase the CAN bus communication rate of step S1 and proceed to step S2 to continue the cycle. If it does not exceed the upper limit, decrease the CAN bus communication rate of step S1 and proceed to step S2 to continue the cycle; S4, outputting the minimum communication rate corresponding to not exceeding the upper limit of the allowable frame collision rate of frames of each priority to complete the optimization. A method for minimizing CAN bus resources characterized by including this.

7. In step S1, giving a fixed value as the initial CAN bus communication rate. A method for minimizing CAN bus resources according to claim 6, characterized by this.

8. In step S1, calculating the initial CAN bus communication rate according to the following formula: Here, B_x is the initial CAN bus communication rate, and L[0], S[0], and Bp_T[0] represent the transmission frequency, frame length, and upper limit of the allowable frame collision rate of the frame with the highest priority, respectively. A method for minimizing CAN bus resources according to claim 6, characterized by this.

9. Step S2 includes calculating the frame collision rate of frames of each priority in descending order of priority based on the Erlang B formula in queuing theory at the CAN bus communication rate in step S1. Here, the frame collision rate of the frame with the highest priority is directly calculated using the Erlang B formula, and the frame collision rate of frames of each remaining priority is calculated by a combination of the Erlang B formula, the cumulative traffic load of that priority, and the overflow traffic load. The method for minimizing CAN bus resources according to claim 6, characterized in that.

10. The frame collision rate Bp[i] of frames of each priority is calculated as follows: Here, i = 0 represents the highest priority, i = 1, 2,..., p - 1 represent the remaining priorities in decreasing order, the number of priorities operating regularly on the CAN bus is p, A[i] represents the traffic load of priority i for the CAN bus, k = 1, L_S[i] represents the cumulative traffic load of priority i, and A_L[i] represents the overflow traffic load where higher priorities overflow to priority i. The method for minimizing CAN bus resources according to claim 9, characterized in that.

11. The traffic load A[i] of priority i for the CAN bus, the cumulative traffic load L_S[i] of priority i, and the overflow traffic load A_L[i] where higher priorities overflow to priority i are calculated as follows, respectively: Here, L[i] and S[i] represent the transmission frequency and frame length of frames of priority i, respectively, and B represents the current CAN bus communication rate. The method for minimizing CAN bus resources according to claim 10, characterized in that.

12. The method of increasing or decreasing the CAN bus communication rate in step S3 is a step method and / or a binary search. The method for minimizing CAN bus resources according to claim 6, characterized in that.

13. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the method for minimizing CAN bus resources according to any one of claims 6 to 12 can be realized. A computer-readable storage medium characterized by this.

Citation Information

Patent Citations

  • CAN bus message transmission scheduling method

    CN107645455A

  • Engineering machinery and network optimization method and device thereof

    CN112769714A

  • Traffic modeling for packet data communications system dimensioning

    US20040068556A1