WO2023226905A1 - Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 - Google Patents
Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 Download PDFInfo
- Publication number
- WO2023226905A1 WO2023226905A1 PCT/CN2023/095374 CN2023095374W WO2023226905A1 WO 2023226905 A1 WO2023226905 A1 WO 2023226905A1 CN 2023095374 W CN2023095374 W CN 2023095374W WO 2023226905 A1 WO2023226905 A1 WO 2023226905A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- priority
- bus
- frame
- rate
- frames
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 53
- 238000004364 calculation method Methods 0.000 title claims abstract description 34
- 238000004891 communication Methods 0.000 claims abstract description 113
- 238000005457 optimization Methods 0.000 claims abstract description 7
- 230000003247 decreasing effect Effects 0.000 claims abstract description 3
- 238000004590 computer program Methods 0.000 claims description 15
- 230000001186 cumulative effect Effects 0.000 claims description 12
- 238000003860 storage Methods 0.000 claims description 7
- 238000004422 calculation algorithm Methods 0.000 abstract description 5
- 238000013461 design Methods 0.000 description 24
- 230000005540 biological transmission Effects 0.000 description 14
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000001960 triggered effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 239000000463 material Substances 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 238000006467 substitution reaction Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000737 periodic effect Effects 0.000 description 2
- 238000013468 resource allocation Methods 0.000 description 2
- WHXSMMKQMYFTQS-UHFFFAOYSA-N Lithium Chemical compound [Li] WHXSMMKQMYFTQS-UHFFFAOYSA-N 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001066 destructive effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000004146 energy storage Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 229910052744 lithium Inorganic materials 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004753 textile Substances 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40169—Flexible bus arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0823—Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0823—Errors, e.g. transmission errors
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
- H04L2012/40215—Controller Area Network CAN
Definitions
- the invention relates to the field of data transmission technology, and in particular to a method for calculating the frame collision rate of frames on a CAN bus and a method for minimizing CAN bus resources.
- CAN Controller Area Network
- German Bosch Company in 1985. It is currently widely used in distributed real-time control fields such as automotive electronics and industrial automation. Compared with general communication buses, CAN bus data communication has outstanding reliability, real-time performance and flexibility. Due to its good performance and unique design, CAN bus has attracted more and more attention. It is the most widely used in the automotive field. Some well-known automobile manufacturers in the world have adopted CAN bus to realize data communication between the automobile's internal control system and various detection and actuating agencies.
- CAN bus due to the characteristics of the CAN bus itself, its application scope is no longer limited to the automotive industry, but also to automatic control, aerospace, navigation, process industry, machinery industry, textile machinery, agricultural machinery, robots, CNC machine tools, medical equipment and With the development of sensors and other fields, it is known as the computer local area network in the field of automation. Its emergence provides strong technical support for distributed control systems to achieve real-time and reliable data communication between nodes. CAN has formed an international standard and has been recognized as one of the most promising fieldbuses.
- the data segment of the CAN bus frame allows up to 8 bytes, using a short frame structure, with short transmission time and low probability of interference.
- frame collisions on the bus are inevitable.
- periodic frames are often sent or a random wait is added to the frame to be sent. time to prevent frame collision events, but this undoubtedly reduces communication efficiency and causes a waste of communication resources.
- the purpose of the present invention is to overcome the shortcomings of the existing technology that the frame collision rate cannot be calculated and thus cannot optimize bus resources, and to provide a method for calculating the frame collision rate of frames on the CAN bus and a method for minimizing CAN bus resources.
- a method for calculating the frame collision rate of frames on the CAN bus According to the CAN bus communication rate, frame sending frequency and frame length, the frame collision rate is calculated based on the Erlang B formula in queuing theory.
- the frames on the CAN bus include multiple priorities, and the frame collision rate of each priority frame is calculated according to the priority order from high to low, where the frame collision rate of the highest priority frame directly uses Erlang The B formula is calculated; the frame collision rate of the remaining priority frames is calculated using the Erlang B formula combined with the cumulative traffic load and overflow traffic load of the priority.
- the frame collision rate Bp[i] of frames of each priority is calculated as follows:
- the number of priorities planned to run on the CAN bus is p;
- A_L[i] represents the overflow traffic load of higher priority that overflows to priority i.
- the traffic load of priority i relative to the CAN bus A[i], the cumulative traffic load of priority i L_S[i], the overflow traffic load of higher priorities towards priority i A_L[i] The calculations are as follows:
- L[i] and S[i] respectively represent the sending frequency and frame length of priority i frames
- B represents the current CAN bus communication rate
- a method for minimizing CAN bus resources includes the following steps:
- step S2 calculate the frame collision rate of each priority frame planned to run on the CAN bus based on the ErlangB formula in queuing theory;
- step S3 Determine whether the frame collision rate of each priority frame calculated in step S2 exceeds the upper limit of the allowed frame collision rate of frames of this priority level; if it exceeds, increase the CAN bus communication rate in step S1 and enter step S2 to continue the cycle. ;like If it is not exceeded, then lower the CAN bus communication rate in step S1 and enter step S2 to continue the cycle;
- step S1 a fixed value is given as the initial CAN bus communication rate.
- step S1 the initial CAN bus communication rate is calculated through the following formula:
- B_x is the initial CAN bus communication rate
- L[0], S[0], and Bp_T[0] respectively represent the sending frequency, frame length, and the upper limit of the allowed frame collision rate of the highest priority frame.
- step S2 includes: under the CAN bus communication rate of step S1, based on the Erlang B formula in queuing theory, and calculating the frame collision rate of frames of each priority according to the priority order from high to low; Among them, the frame collision rate of the highest priority frame is directly calculated using the Erlang B formula, and the frame collision rate of the remaining priority frames is calculated using the Erlang B formula combined with the cumulative traffic load and overflow traffic load of the frame of that priority. calculate.
- the frame collision rate Bp[i] of frames of each priority is calculated as follows:
- the number of priorities planned to run on the CAN bus is p;
- A_L[i] represents the overflow traffic load of higher priority that overflows to priority i.
- A[i] is calculated as:
- L[i] and S[i] respectively represent the sending frequency and frame length of priority i frames
- B represents the current CAN bus communication rate
- L_S[i] is calculated as:
- the calculation method of A_L[i] is:
- the method of increasing or decreasing the CAN bus communication rate in step S3 is stepwise and/or binary search.
- the present invention also provides a computer-readable storage medium on which a computer program is stored.
- the computer program When the computer program is executed by a processor, it can realize the aforementioned method of minimizing CAN bus resources.
- the present invention provides a set of algorithms for calculating the frame collision rate based on the Erlang B formula in queuing theory.
- the bus resources are optimized to find out the situation when the transmission frequency and frame length are fixed. Under this condition, the minimum bus resources required to ensure that the frame collision rate does not exceed the upper limit of the allowed frame collision rate, thereby achieving optimal configuration of bus resources.
- a lower CAN bus communication rate means lower bus bandwidth and less requirements on devices. At the same time, the probability of electromagnetic interference generated by other devices will also be reduced, and communication reliability will be increased.
- the present invention accurately calculates the minimum required bus resources (communication rate) based on the transmission frequency of frames of each priority and the preset upper limit of the frame collision rate of each priority, so as to achieve the purpose of flexible resource configuration and optimized resource use.
- the invention is applied in the development stage of products using the CAN communication bus, and relates to a design method of the CAN bus, especially for improving design efficiency and optimizing bus resources when the bus load is large and multi-priority frames are transmitted simultaneously. Utilization allows CAN bus users to optimize the configuration of bus resources during the development stage according to different usage scenarios and save CAN bus resources.
- Figure 1 is a flow chart of a method for minimizing CAN bus resources in an embodiment of the present invention
- Figure 2 is a flow chart of a method for calculating the frame collision rate of frames of each priority in an embodiment of the present invention
- Figure 3 is a flow chart of a method for calculating the minimum required communication rate of the CAN bus in the embodiment of the present invention.
- first and second are used for descriptive purposes only and shall not be understood as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Therefore, features defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present invention, “multiple” The meaning is two or more, unless otherwise expressly and specifically limited.
- the configuration of the CAN bus resources must first be planned.
- the CAN bus is generally The load factor is set below 30%.
- the load rate can be calculated simply by the number of nodes connected to the bus, the sending frequency of each node and the frame length.
- the CAN bus introduces a priority mechanism. Each priority competes for the transmission resources of the bus through a non-destructive arbitration mechanism.
- the CAN bus protocol currently supports up to 8 priorities. The protocol defines the priority of the flag bit with the smaller value. The higher the level, that is, 0x00 has the highest priority, and 0x07 has the lowest priority.
- the high-priority frame automatically obtains the transmission resources, and the low-priority frame exits arbitration.
- Low-priority frames are retransmitted according to the automatic retransmission mechanism, and the frames are retransmitted after the bus resources are idle.
- a frame collision event occurs.
- designers may pay special attention to the frame collision rate of frames of a certain priority.
- the frame collision rate of frames of different priorities is a non-linear relationship and cannot be obtained through simple calculations.
- the present invention provides an optimized design method for the CAN bus.
- an algorithm is provided that can accurately calculate the collision rate of frames of each priority.
- This algorithm uses the Erlang B formula in queuing theory and can accurately calculate the collision rate of frames of each priority in order from high to low.
- Frame rate in turn, the resource configuration of the CAN bus can be optimized to minimize the bus resources. Specifically: Calculate the frame collision rate of frames of each priority under a given bus communication rate and frame transmission frequency, and then compare it with the preset upper limit of the allowed frame collision rate of frames of each priority. If any exceeds If the upper limit of frame rate collision is allowed, increase the bus bandwidth (i.e.
- the bus bandwidth (communication rate) is the minimum bus bandwidth that does not exceed the upper limit of the allowed frame rate when the transmission frequency and frame length are fixed to achieve optimization of bus resources.
- this embodiment uses the following formula to calculate the initial communication rate of the CAN bus:
- B_x is the initial CAN bus communication rate
- L[0], S[0], and Bp_T[0] respectively represent the highest priority.
- the frame collision rate of frames of each priority can be calculated, as shown in Figure 2.
- the specific process is as follows: Under the CAN bus communication rate of step S1 , based on the Erlang B formula in queuing theory, calculate the frame collision rate of each priority frame planned to run on the CAN bus. Among them, the frame collision rate of the highest priority frame is directly calculated using the Erlang B formula, and the rest are given priority. The frame collision rate of a priority level is calculated using the Erlang B formula combined with the cumulative traffic load and overflow traffic load of the priority level.
- This application applies the Erlang B formula to the CAN bus to calculate the frame collision rate.
- the frame collision rate Bp[i] of frames of each priority i is calculated as follows:
- the number of priorities planned to run on the CAN bus is p;
- A[i] represents priority i.
- A_L[i] represents the overflow traffic load of higher priority that overflows to priority i, where, Traffic load refers to the ratio of the traffic summary of each priority to the transmission rate of the CAN bus.
- L[i] and S[i] respectively represent the sending frequency and frame length of frames with priority i
- B represents the current CAN bus communication rate.
- the calculation method of cumulative traffic load L_S[i] is:
- step S3 Determine whether the frame collision rate of each priority frame calculated in step S2 exceeds the upper limit of the allowed frame collision rate of frames of that priority; if it exceeds, increase the CAN bus communication rate in step S1 and proceed to step S2 to continue. Loop; if it is not exceeded, lower the CAN bus communication rate in step S1 and enter step S2 to continue the loop;
- the way to increase/decrease the CAN bus communication rate can be step-by-step, and the fixed step size can be adjusted according to the actual situation, for example, the fixed step size is 100bit/s or 1000bit/s to increase/decrease it. Communication rate (i.e. bus bandwidth).
- a smaller fixed step size will give more accurate results, but will increase the number of iterations of the calculation and the calculation time.
- a larger fixed step size will reduce the accuracy of the calculation results, but increase the calculation speed. Choosing a more appropriate fixed step size depends on the designer's past experience.
- binary search may also be used to increase/decrease the CAN bus communication rate. For example: through two or more cycles, obtain a larger and a smaller bus communication rate; at the smaller communication rate (Data1), the frame collision rate of all priority frames does not exceed the priority level. The upper limit of the frame collision rate of frames; at a larger communication rate (Data2), the frame collision rate of at least one priority frame exceeds the upper limit of the frame collision rate of frames of this priority level. Then the communication rate Data3 of the next cycle can be searched by binary search between [Data1, Data2]; if under the communication rate Data3, the frame collision rate of all priority frames does not exceed the frame collision rate of the priority frame.
- the communication rate Data4 of the next cycle performs a binary search between [Data1, Data3]; if at the communication rate Data3, the collision rate of at least one priority frame exceeds the collision rate of the priority frame If the upper limit of the frame rate is reached, then the communication rate Data4 of the next cycle will perform a binary search between [Data3, Data2].
- the minimum communication rate that does not exceed the upper limit of the frame collision rate of frames of each priority is found.
- using binary search can reduce the amount of calculation and greatly speed up the calculation in some cases.
- the method of increasing/lowering the CAN bus communication rate can also combine stepwise and binary searches.
- inverter Inverter
- IoT communication module Inverter
- Pack battery packs
- the priority of sending frames is set as follows: If it is an alarm information frame or an event-triggered query information frame, the frame The length is set to 128 bits (bit) and set to high priority (0X02). If it is a periodic broadcast data frame, the frame length is set to 256 bits (bit) and set to low priority (0X06).
- the design index for the frame collision rate of high-priority frames is ⁇ 3%, and the design index of the frame-collision rate of low-priority frames is ⁇ 10%.
- Table 1 below shows the content type, sending frequency and frame length of the data sent by the inverter module (Inverter) to the CAN bus:
- Table 2 below shows the content type, sending frequency, and frame length of data sent by the IoT communication module to the CAN bus:
- Table 3 below shows the content type, sending frequency, and frame length of the data sent by the battery pack module (Pack) to the CAN bus:
- This embodiment has only two priorities, 0X02 and 0X06, where 0X02 is a high priority and 0X06 is a low priority.
- the traffic summary of each priority is calculated as follows:
- B_x is the initial CAN bus communication rate
- L[0], S[0], and Bp_T[0] respectively represent the highest priority sending frequency, frame length, and the upper limit of the allowed frame collision rate.
- This embodiment has only two priorities, 0X02 and 0X06, where 0X02 is a high priority and 0X06 is a low priority. Therefore, this embodiment uses the design index of the high priority 0X02 frame collision rate ⁇ 3% to calculate the initial communication rate.
- the frame collision rate Bp[i] of frame i of each priority is calculated as follows:
- the number of priorities planned to run on the CAN bus is p;
- A_L[i] represents the overflow traffic load of higher priority that overflows to priority i.
- the traffic load refers to the ratio of the traffic summary of each priority to the transmission rate of the CAN bus.
- Event-triggered sending refers to sending according to the user's instructions.
- the frequency of sending is completely determined by the user and is random. There may be no query instructions at all in a day (24 hours), or there may be multiple query instructions in a certain period of time (within 10 minutes). The more query instructions, the greater the load flow.
- the high-priority traffic summary is calculated when the load flow is the largest. The situation with the largest load flow can be regarded as the worst (or most extreme) situation.
- step S3 Determine whether the frame collision rate of each priority frame calculated in step S2 exceeds the upper limit of the allowed frame collision rate of frames of this priority level; if it exceeds, increase the CAN bus communication rate in step S1 and enter step S2 to continue the cycle. ; If it is not exceeded, lower the CAN bus communication rate in step S1 and enter step S2 to continue the cycle.
- the method of increasing/lowering the CAN bus communication rate can be step-by-step, such as a fixed step size of 100 bit/s or 1000 bit/s; it can also be a binary search, or a combination of step and binary search .
- step S1 the CAN bus communication rate in step S1 is set to 202380.8bit/s. Turn it down and set it to 200kbit/s.
- high priority does not meet the design indicators
- low priority meets the design indicators
- the overall design indicators still do not meet the design indicators. Therefore, select a value between [200000bit/s, 202380.8bit/s] and calculate again. For example, use After binary search, 201190.4 bit/s was selected for calculation. After calculation, it was found that the high priority still did not meet the design specifications.
- the communication rate is based on 1000bit/s as the minimum unit, so the minimum communication rate of 202380.8bit/s is output as 203kbit/s.
- the frame collision rate of a specific priority is calculated.
- the frame collision rate of the highest priority frame is directly calculated using the Erlang B formula.
- the frame collision rate of the other priority frames is calculated directly.
- the frame collision rate is calculated using the Erlang B formula combined with the cumulative traffic load and overflow traffic load of the priority, and the frame collision rates of the two priorities are calculated respectively, as shown in Table 6 below:
- the frame collision rate of high priority 0 (0x02) frames needs to be controlled below 3%, and the frame collision rate of low priority 1 (0x06) frames needs to be controlled below 10%.
- the above results meet the design indicators, but The value is too high and does not meet the minimum communication rate requirements of the output CAN bus. Re-select the CAN bus communication rate value to 150kbit/s.
- the CAN bus communication rate is adjusted again. It can be searched using the binary method, and 200kbit/s between [150kbit/s, 250kbit/s] is selected to recalculate.
- the two priorities are
- the collision frame rate of level is the same as Table 4.
- the frame collision rate of high-priority frames is 3.03%, which does not meet the design indicators.
- the frame collision rate of low-priority frames is 8.70%, which meets the design indicators.
- the overall design index is still not met, so the minimum communication rate that meets the design index can still be found by continuously using the binary search method.
- the minimum CAN bus resources that meet the design specifications can be obtained, as shown in Table 5 above.
- the required communication rate of the CAN bus is 202380.8bit/s. The purpose of minimizing CAN bus resources is achieved.
- This invention uses the Erlang B formula in queuing theory, based on the data of fixed transmission frequency, frame length and given communication rate, in order from high to low priority, to accurately calculate the frame collision rate of frames of each priority. , Then compare it with the preset upper limit of the allowed frame rate to determine whether it exceeds the upper limit of the allowed frame rate. If it exceeds, continue to increase the communication rate (i.e. bus bandwidth); if it does not exceed, then reduce the communication rate; and then return The frame collision rate is recalculated until the minimum communication rate corresponding to the upper limit of the collision frame rate allowed for frames of each priority is obtained, thereby calculating the minimum CAN bus communication rate and realizing resource allocation optimization of the CAN bus. From the embodiment 2, it can be seen that using the calculation formula provided by the present invention to calculate the initial communication rate can greatly reduce the calculation amount and improve the calculation efficiency.
- embodiments of the present invention may be provided as methods, systems, or computer program products.
- the present invention can also provide a readable storage medium on which a computer program is stored.
- the steps of the method for minimizing CAN bus resources in the aforementioned embodiments can be implemented.
- the invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects.
- the invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
- These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
- the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
- Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Small-Scale Networks (AREA)
Abstract
本发明提供一种CAN总线上帧的撞帧率计算方法及CAN总线资源最小化的方法,CAN总线资源最小化的方法包括:S1、设置一初始的CAN总线通信速率;S2、在步骤S1的预设速率下,基于排队论中的Erlang B公式计算CAN总线上计划运行的各优先级的帧的撞帧率;S3、判断步骤S2计算出的各优先级的帧的撞帧率是否超出该优先级的帧允许的撞帧率上限;若超出,则调高步骤S1的CAN总线通信速率并进入步骤S2继续循环;若未超出,则调低步骤S1的CAN总线通信速率并进入步骤S2继续循环;S4、将不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率进行输出以完成优化。本发明提供了一套撞帧率的算法,进而根据各优先级帧的撞帧率上限计算出所需最小的总线资源,优化资源。
Description
本发明涉及数据传输技术领域,尤其是涉及一种CAN总线上帧的撞帧率计算方法及CAN总线资源最小化的方法。
在汽车产业中,出于对安全性、舒适性、方便性、低功耗、低成本的要求,各种各样的电子控制系统被开发了出来。由于这些系统之间通信所用的数据类型及对可靠性的要求不尽相同,由多条总线构成的情况很多,线束的数量也随之增加。为适应"减少线束的数量"、"通过多个LAN,进行大量数据的高速通信"的需要,1986年德国电气商博世公司开发出面向汽车的CAN通信协议。
CAN全称为Controller Area Network(控制器区域网络),是1985年由德国博世公司提出的一种数据协议总线,目前被广泛地运用在汽车电子,工业自动化等分布式实时控制领域。与一般的通信总线相比,CAN总线的数据通信具有突出的可靠性、实时性和灵活性。由于其良好的性能及独特的设计,CAN总线越来越受到人们的重视。它在汽车领域上的应用是最广泛的,世界上一些著名的汽车制造厂商都采用了CAN总线来实现汽车内部控制系统与各检测和执行机构间的数据通信。同时,由于CAN总线本身的特点,其应用范围已不再局限于汽车行业,而向自动控制、航空航天、航海、过程工业、机械工业、纺织机械、农用机械、机器人、数控机床、医疗器械及传感器等领域发展,被誉为自动化领域的计算机局域网。它的出现为分布式控制系统实现各节点之间实时、可靠的数据通信提供了强有力的技术支持。CAN已经形成国际标准,并已被公认为几种最有前途的现场总线之一。
CAN总线帧的数据段最多允许8个字节,采用短帧结构,传输时间短,受干扰概率低。但随着总线的负载率增加,总线上发生撞帧的事件不可避免,为了增强可靠性,利用CAN总线开发产品协议时,往往会采用发送周期性帧或者给将要发送的帧加上一个随机等待时间以防止撞帧事件,但这样无疑就降低了通信效率,造成了通信资源的浪费。
需要说明的是,在上述背景技术部分公开的信息仅用于对本申请的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。
发明内容
本发明的目的在于克服现有技术无法计算撞帧率,进而无法优化总线资源的缺点,提供一种CAN总线上帧的撞帧率的计算方法以及CAN总线资源最小化的方法。
为实现上述目的,本发明采用以下技术方案:
一种CAN总线上帧的撞帧率的计算方法,根据CAN总线通信速率、帧的发送频率和帧长,基于排队论中的Erlang B公式计算获得帧的撞帧率。
在一些实施例中,CAN总线上的帧包括多个优先级,依据从高到低的优先级顺序计算各优先级帧的撞帧率,其中,最高优先级的帧的撞帧率直接采用Erlang B公式进行计算;其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的累积流量负载和溢出流量负载进行计算。
在一些实施例中,各优先级的帧的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级数目为p;A[i]表示优先级i相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载。
在一些实施例中,优先级i相对于CAN总线的流量负载A[i],优先级i的累积流量负载L_S[i],更高优先级向优先级i溢出的溢出流量负载A_L[i]分别计算如下:
其中,L[i]、S[i]分别表示优先级i的帧的发送频率和帧长,B代表当前的CAN总线通信速率。
一种CAN总线资源最小化的方法,包括如下步骤:
S1、设置一初始的CAN总线通信速率;
S2、在步骤S1的CAN总线通信速率下,基于排队论中的ErlangB公式计算CAN总线上计划运行的各优先级的帧的撞帧率;
S3、判断步骤S2计算出的各优先级的帧的撞帧率是否超出该优先级的帧允许的撞帧率上限;若超出,则调高步骤S1的CAN总线通信速率并进入步骤S2继续循环;若
未超出,则调低步骤S1的CAN总线通信速率并进入步骤S2继续循环;
S4、将不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率进行输出以完成优化。
在一些实施例中,步骤S1中,通过给定一个固定值作为初始的CAN总线通信速率。
在一些实施例中,步骤S1中,通过如下公式计算出初始的CAN总线通信速率:
其中,B_x为初始的CAN总线通信速率,L[0]、S[0]、Bp_T[0]分别代表最高优先级的帧的发送频率、帧长、允许的撞帧率上限。
在一些实施例中,步骤S2包括:在步骤S1的CAN总线通信速率下,基于排队论中的Erlang B公式,并依据从高到低的优先级次序计算各优先级的帧的撞帧率;其中,最高优先级的帧的撞帧率直接采进用Erlang B公式行计算,其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的帧的累积流量负载和溢出流量负载进行计算。
在一些实施例中,各优先级的帧的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级数目为p;A[i]表示优先级i相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载。
在一些实施例中,A[i]的计算方法为:
其中,L[i]、S[i]分别表示优先级i的帧的发送频率和帧长,B代表当前的CAN总线通信速率。
在一些实施例中,L_S[i]的计算方法为:
在一些实施例中,A_L[i]的计算方法为:
在一些实施例中,步骤S3中调高或调低CAN总线通信速率的方式是步进式和/或二分法查找。
本发明还提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时能实现前述的CAN总线资源最小化的方法。
与现有技术相比,本发明的技术方案具有如下有益效果:
现有技术中没有具体的撞帧率的算法,无法得知在特定情况下(包括CAN总线通信速率、各优先级的帧的发送频率、各优先级的帧长、优先级数目)的撞帧率是多少,也就无法去进行总线资源的最小化。本发明提供了一套基于排队论中的Erlang B公式计算撞帧率的算法,并在计算出撞帧率的基础上,对总线资源进行优化,可以寻找出在发送频率和帧长固定的情况下,满足撞帧率不超出允许撞帧率上限所需的最小总线资源,从而实现总线资源的优化配置。
较低的CAN总线通信速率即意味着较低的总线带宽,对器件的要求小,同时被其他器件产生的电磁干扰的几率也会减小,通信可靠性增加。本发明根据各优先级的帧的发送频率以及各优先级的帧撞帧率的预设上限准确计算出所需最小的总线资源(通信速率),达到灵活资源配置,优化资源使用的目的。
本发明应用在采用CAN通信总线的产品的开发阶段,涉及一种CAN总线的设计方法,特别是针对总线负载大、涉及多优先级的帧同时传输的情况下,提高设计效率和优化总线资源的利用率,让CAN总线的使用者根据不同的使用场景,在开发阶段就能实现总线资源的优化配置,节省CAN总线资源。
图1是本发明实施例中的CAN总线资源最小化的方法流程图;
图2是本发明实施例中的各优先级的帧的撞帧率计算方法流程图;
图3是本发明实施例中的CAN总线最低所需通信速率计算方法流程图。
以下对本发明的实施方式做详细说明。应该强调的是,下述说明仅仅是示例性的,而不是为了限制本发明的范围及其应用。
术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多该特征。在本发明实施例的描述中,“多个”的
含义是两个或两个以上,除非另有明确具体的限定。
在运用CAN总线设计开发产品时,首先要对CAN总线资源的配置进行规划,目前设计人员多参考过往积累的经验值,比如为了减小总线上的撞帧事件发生的几率,一般将CAN总线的负载率定在30%以下。负载率可以通过连接总线的节点数,各节点的发送频率以及帧长简单计算求得。CAN总线引入优先级机制,各优先级通过非破坏性的仲裁机制来竞争使用总线的传输资源,CAN总线协议目前最高可以支持8个优先级,协议定义了标志位数值越小的位拥有的优先级越高,即0x00拥有最高的优先级,而0x07的优先级最低,如果发生高低优先级同时向总线传输数据时,高优先级的帧自动获得传输资源,而低优先级的帧退出仲裁,低优先级的帧根据自动重传机制,待总线资源空闲时间再重发帧。如此一来,对于低优先级的帧来说,就发生了撞帧事件。在特定业务场景下,设计人员有可能会特别关注某一优先级的帧的撞帧率,但不同优先级的帧的撞帧率是非线性关系,无法通过简单计算求得。
鉴于目前在CAN总线开发阶段的资源配置规划的难点,本发明提供一种面向CAN总线的优化设计方法。先提供一种可以准确计算各优先级的帧撞帧率的算法,该算法运用排队论中的Erlang B公式,依照优先级由高到低的次序,可以准确计算出各个优先级的帧的撞帧率;进而可以进行CAN总线的资源配置优化,使总线资源最小化。具体为:在给定的总线通信速率和帧发送频率下计算出各个优先级的帧的撞帧率,然后再与预设的各优先级的帧的允许撞帧率上限进行比较,如果有超出允许撞帧率上限的情况,则调高总线带宽(即提高通信速率);如未超出允许撞帧率上限的情况,则调低通信速率;接着在新的通信速率下继续计算各优先级的帧的撞帧率,并与允许撞帧率上限进行比较,如此循环直至计算出的各优先级的帧的撞帧率都不会超出相应的允许撞帧率上限的最小通信速率,此时的总线带宽(通信速率)就是在发送频率和帧长固定的情况下、满足不超过允许撞帧率上限的最低总线带宽,实现总线资源的优化。
如图1、图3所示,本发明实施例CAN总线资源最小化的方法的具体步骤如下:
S1、设置一初始的CAN总线通信速率。
给定一个较小或较大的CAN总线的初始通信速率B_x,该固定值可以从0开始取值,然后通过循环判断去计算满足条件的最小通信速率的方式,但是这种方法计算量大且计算速度慢,为了减小计算量并提高计算效率,本实施例使用如下公式计算得出CAN总线的初始通信速率:
其中,B_x为初始的CAN总线通信速率,L[0]、S[0]、Bp_T[0]分别代表最高优先
级的帧的发送频率、帧长、允许的撞帧率上限。
S2、在CAN总线通信速率和各优先级传输流量固定的情况下,可计算获取各优先级的帧的撞帧率,如图2所示,具体过程如下:在步骤S1的CAN总线通信速率下,基于排队论中的Erlang B公式计算CAN总线上计划运行的各优先级的帧的撞帧率,其中,最高优先级的帧的撞帧率直接采进用Erlang B公式行计算,其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的累积流量负载和溢出流量负载进行计算。
通常Erlang B公式需要知道三个参数,即帧到达率λ,服务速率μ(1/μ即为服务所需时间),以及服务器数量k,即:Bp=Erlang B(A,k)。其中,A=λ/μ,k为服务器数量。本申请将Erlang B公式应用于CAN总线中计算撞帧率时,因所有的优先级的帧都在一条CAN总线上运行,所以将服务器数量k归一化处理,即把CAN总线视作1个服务器,k=1;L为某优先级的发送频率,对应于Erlang B公式中的λ,S为某优先级帧的帧长,B表示当前CAN总线的通信速率,则S/B即为CAN总线传输某优先级一帧所需的时间,对应于ErlangB公式中的1/μ。因此Erlang B公式可以改写为:
各优先级i的帧的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级的数目为p;A[i]表示优先级i的帧相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的帧的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载,其中,流量负载指的是各优先级的流量汇总与CAN总线的传输速率的比值。
其中A[i]的计算方法为:
其中,L[i]、S[i]分别表示优先级i的帧的发送频率和帧长,B代表当前的CAN总线通信速率,累积流量负载L_S[i]的计算方法为:
溢出流量负载A_L[i]的计算方法为:
S3、判断步骤S2计算出的各优先级的帧的撞帧率是否超出该优先级的帧允许的撞帧率上限;若有超出,则调高步骤S1的CAN总线通信速率并进入步骤S2继续循环;若未超出,则调低步骤S1的CAN总线通信速率并进入步骤S2继续循环;
其中,调高/调低CAN总线通信速率的方式可以是步进式,其固定步长可以根据实际情况进行调整,例如以固定的步长为100bit/s或1000bit/s来调高/调低通信速率(即总线带宽)。较小的固定步长会得到更精确的结果,但会增加计算的迭代次数和计算时间。反之,较大的固定步长会减小计算结果的精度,但会提高计算速度。选择一个较合适的固定步长需要依赖于设计人员的过往积累经验。
在另一些实施方式中,调高/调低CAN总线通信速率的方式还可以采用二分法查找。例如:通过两次或两次以上循环,获取一个较大和一个较小的总线通信速率;在较小的通信速率(Data1)下,所有优先级的帧的撞帧率均未超出该优先级的帧的撞帧率上限;在较大的通信速率(Data2)下,有至少一个优先级的帧的撞帧率超出该优先级的帧的撞帧率上限。则下一个循环的通信速率Data3可以在[Data1,Data2]之间进行二分法查找;若在通信速率Data3下,所有优先级的帧的撞帧率均未超出该优先级的帧的撞帧率上限,则再下一个循环的通信速率Data4在[Data1,Data3]之间进行二分法查找;若在通信速率Data3下,至少有一个优先级的帧的撞帧率超出该优先级的帧的撞帧率上限,则再下一个循环的通信速率Data4在[Data3,Data2]之间进行二分法查找。通过如上的循环直至找出不超出各优先级的帧的撞帧率上限的最小通信速率。相较于步进式,利用二分法查找在有些情况下可以减少计算量并大大加快计算速度。
在另一些实施例方式中,调高/调低CAN总线通信速率的方式还可以将步进式和二分法查找结合在一起。
S4、将不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率进行输出以完成优化。
实施例1:
在一个锂电储能产品中,有一个逆变器(Inverter),一个IoT通信模块和四个电池包(Pack)通过CAN总线连接在一起。这三种设备周期性或不定期(通过事件触发)向CAN总线发送数据。
发送帧的优先级设置如下:如果是告警信息帧或者是事件触发的查询信息帧,帧
长设为128比特(bit),设为高优先级(0X02),如果是周期性的广播数据帧,帧长设为256比特(bit),设为低优先级(0X06)。高优先级的帧撞帧率的设计指标是≤3%,低优先级的帧撞帧率的设计指标是≤10%。
下表1给出了逆变器模块(Inverter)向CAN总线发送数据的内容种类,发送频率,帧长:
表1
下表2给出了IoT通信模块向CAN总线发送数据的内容种类,发送频率,帧长:
表2
下表3给出了电池包模块(Pack)向CAN总线发送数据的内容种类,发送频率,帧长:
表3
下面基于前述表格给出的数据,给出本发明实施例的实施方法:
本实施例只有两个优先级0X02和0X06,其中0X02为高优先级,0X06为低优先级,各优先级的流量汇总计算如下:
高优先级:128×(1+0.4+2+2+1+1+1+2.5+3×4+5×4+1.5×4)=128×48.9=6259.2bit/s
低优先级:256×(1+1+2+2+2+2.5+2+1+2.5+2×4)=256×24=6144bit/s
S1、设置一初始的CAN总线通信速率,即给定一个较小/较大的CAN总线的初始通信速率B_x,该固定值可以从0开始取值,然后通过循环判断去计算满足条件的最小通信速率的方式,但是这种方法计算量大且计算速度慢,为了减小计算量并提高计算效率,本实施例使用如下公式计算得出CAN总线的初始通信速率:
其中,B_x为初始的CAN总线通信速率,L[0]、S[0]、Bp_T[0]分别代表最高优先级的发送频率、帧长、允许的撞帧率上限。
本实施例只有两个优先级0X02和0X06,其中0X02为高优先级,0X06为低优先级,故本实施例采用高优先级0X02帧撞帧率的设计指标≤3%来计算初始通信速率。
S2、在CAN总线通信速率和各优先级传输流量固定的情况下,可计算获取各优先级的撞帧率。各优先级的帧i的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级数目为p;A[i]表示优先级i相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载。其中,流量负载指的是各优先级的流量汇总与CAN总线的传输速率的比值。
事件触发式发送,是指根据用户的指令发送,用户在某一时刻点击了查询指令,通过CAN总线发送用户发送的查询信息帧。发送频率完全由用户决定,是随机的,有可能一天(24小时)之内完全没有查询指令,也有可能某一时间段(10分钟内)有多条查询指令。查询指令越多,负载流量越大。把随机触发的信息帧视为周期性发送,那么高优先级的流量汇总就是在负载流量最大的情况下计算得出,负载流量最大的情况可视为最坏(或者最极端)的情况。在计算高优先级的流量汇总时,假设在最坏的情况下,则高优先级的流量汇总计算如下:
128×(1+0.4+2+2+1+1+1+2.5+3×4+5×4+1.5×4)=128×
48.9=6259.2bit/s
128×(1+0.4+2+2+1+1+1+2.5+3×4+5×4+1.5×4)=128×
48.9=6259.2bit/s
低优先级(0X06)的流量汇总计算如下:
256×(1+1+2+2+2+2.5+2+1+2.5+2×4)=256×24=6144bit/s
256×(1+1+2+2+2+2.5+2+1+2.5+2×4)=256×24=6144bit/s
撞帧率Bp[i]的计算公式中,各优先级的流量负载A[i]的计算公式如下:
在本实施例中,首先B采用步骤S1所计算出来的初始通信速率202380.8bit/s,则各优先级的帧的流量负载计算如下:
A[0]=6259.2/202380.8=0.0309278
A[1]=6144/202380.8=0.0303586
A[0]=6259.2/202380.8=0.0309278
A[1]=6144/202380.8=0.0303586
对于高优先级的帧的撞帧率,其直接利用Erlang B公式计算如下:
对于其他优先级的帧的撞帧率,还需要先计算获得累积流量负载和溢出流量负载,其计算公式以及具体计算结果如下。
累积流量负载L_S[i]的计算公式如下:
则
溢出流量负载A_L[i]的计算公式如下:
则
最后计算获得低优先级的撞帧率为:
S3、判断步骤S2计算出的各优先级的帧的撞帧率是否超出该优先级的帧允许的撞帧率上限;若超出,则调高步骤S1的CAN总线通信速率并进入步骤S2继续循环;若未超出,则调低步骤S1的CAN总线通信速率并进入步骤S2继续循环。
调高/调低CAN总线通信速率的方式可以是步进式,如固定的步长为100bit/s或1000bit/s;也可以为二分法查找,也可以为步进式与二分法查找的结合。
在本实施例中,Bp[0]=3%,Bp[1]=8.7%,未超出允许的撞帧率3%,10%,所以将步骤S1中的CAN总线通信速率202380.8bit/s再调低,设200kbit/s。
按照通信速率200kbit/s,计算获得的两种优先级的撞帧率如下表4:
表4通信速率为200kbit/s时两种优先级的撞帧率
根据设计指标,高优先级不满足设计指标,低优先级满级设计指标,总体仍不满足设计指标,故在[200000bit/s,202380.8bit/s]之间选择一个数值再次进行计算,如采用二分法查找,选择201190.4bit/s进行计算,计算后发现高优先级仍不满足设计指标。
最后通过不断循环查找,经过计算可以得到满足设计指标的最小通信速率为202380.8bit/s,在该通信速率下两种优先级的撞帧率如下表5:
表5最小通信速率下两种优先级的撞帧率
S4、将不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率进行输出以完成优化。
通常通信速率是以1000bit/s为最小单位,故将最小通信速率202380.8bit/s以203kbit/s进行输出。
实施例2
本实施例其他条件与实施例1相同,不同的是将CAN总线的初始通信速率设为250kbit/s。
在CAN总线通信速率和各优先级传输流量固定的情况下,计算获取特定优先级的撞帧率,最高优先级的帧的撞帧率直接采用Erlang B公式行计算,其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的累积流量负载和溢出流量负载进行计算,分别计算出两种优先级的撞帧率,如下表6所示:
表6通信速率为250kbit/s时两种优先级的撞帧率
根据设计指标,高优先级0(0x02)的帧的撞帧率需要控制在3%以下,低优先级1(0x06)的帧的撞帧率需要控制在10%以下,上述结果满足设计指标但是取值过高不满足输出CAN总线的最小通信速率的要求,重新取CAN总线通信速率值为150kbit/s。
CAN总线速率值为150kbit/s时,两种优先级的撞帧率如下表7所示:
表7通信速率为100kbit/s时两种优先级的撞帧率
根据设计指标,显然上述结果不满足设计指标,故再次调整CAN总线通信速率,其可以采用二分法查找,选择[150kbit/s,250kbit/s]之间的200kbit/s重新进行计算,两种优先级的撞帧率同表4。
根据设计指标,高优先级的帧的撞帧率为3.03%,其不满足设计指标,低优先级的帧的撞帧率为8.70%,其满级设计指标。总体仍不满足设计指标,故仍可以通过不断采用二分法查找,寻找出满足设计指标的最小通信速率。
最后经过计算可以得到满足设计指标的最小CAN总线资源,如上表5。此时所需CAN总线的通信速率为202380.8bit/s。达到了最小化CAN总线资源的目的。
本发明运用排队论中的Erlang B公式,基于固定的发送频率、帧长和给定的通信速率这些数据,依照优先级由高到低的次序,准确计算出各个优先级的帧的撞帧率,
再与预设的允许撞帧率上限作比较,判断是否超出允许的撞帧率上限,如果有超出,则继续增加通信速率(即总线带宽);如未超出,则调低通信速率;再返回重新计算撞帧率,直至获取不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率,从而计算出最小CAN总线的通信速率,实现了CAN总线的资源配置优化,从实施例2中可看出使用本发明提供的计算公式计算初始通信速率可以大大减小计算量并提高计算效率。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。比如,本发明还可提供一种可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时能实现前述实施例的CAN总线资源最小化的方法的步骤。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上内容是结合具体/优选的实施方式对本发明所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,其还可以对这些已描述的实施方式做出若干替代或变型,而这些替代或变型方式都应当视为属于本发明的保护范围。在本说明书的描述中,参考术语“一种实施例”、“一些实施例”、“优选实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材
料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。尽管已经详细描述了本发明的实施例及其优点,但应当理解,在不脱离专利申请的保护范围的情况下,可以在本文中进行各种改变、替换和变更。
Claims (13)
- 一种CAN总线上帧的撞帧率计算方法,其特征在于,根据CAN总线通信速率、帧的发送频率和帧长,基于排队论中的Erlang B公式计算获得帧的撞帧率。
- 如权利要求1所述的CAN总线上帧的撞帧率计算方法,其特征在于,CAN总线上的帧包括多个优先级,依据从高到低的优先级顺序计算各优先级帧的撞帧率,其中,最高优先级的帧的撞帧率直接采用Erlang B公式进行计算;其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的累积流量负载和溢出流量负载进行计算。
- 如权利要求2所述的CAN总线上帧的撞帧率计算方法,其特征在于,各优先级的帧的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级数目为p;A[i]表示优先级i相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载。 - 如权利要求3所述的CAN总线上帧的撞帧率计算方法,其特征在于,优先级i相对于CAN总线的流量负载A[i],优先级i的累积流量负载L_S[i],更高优先级向优先级i溢出的溢出流量负载A_L[i]分别计算如下:
其中,L[i]、S[i]分别表示优先级i的帧的发送频率和帧长,B代表当前的CAN总线通信速率。 - 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时能实现权利要求1-4任一项所述的CAN总线上帧的撞帧率计算方法的步骤。
- 一种CAN总线资源最小化的方法,其特征在于,包括如下步骤:S1、设置一初始的CAN总线通信速率;S2、在步骤S1的CAN总线通信速率下,基于排队论中的Erlang B公式计算CAN总线上计划运行的各优先级的帧的撞帧率;S3、判断步骤S2计算出的各优先级的帧的撞帧率是否超出该优先级的帧允许的撞帧率上限;若超出,则调高步骤S1的CAN总线通信速率并进入步骤S2继续循环;若未超出,则调低步骤S1的CAN总线通信速率并进入步骤S2继续循环;S4、将不超出各优先级的帧允许的撞帧率上限所对应的最小通信速率进行输出以完成优化。
- 如权利要求6所述的CAN总线资源最小化的方法,其特征在于,步骤S1中,通过给定一个固定值作为初始的CAN总线通信速率。
- 如权利要求6所述的CAN总线资源最小化的方法,其特征在于,步骤S1中,通过如下公式计算出初始的CAN总线通信速率:
其中,B_x为初始的CAN总线通信速率,L[0]、S[0]、Bp_T[0]分别代表最高优先级的帧的发送频率、帧长、允许的撞帧率上限。 - 如权利要求6所述的CAN总线资源最小化的方法,其特征在于,步骤S2包括:在步骤S1的CAN总线通信速率下,基于排队论中的Erlang B公式,并依据从高到低的优先级次序计算各优先级的帧的撞帧率;其中,最高优先级的帧的撞帧率直接采用Erlang B公式进行计算,其余各优先级的帧的撞帧率利用Erlang B公式结合该优先级的累积流量负载和溢出流量负载进行计算。
- 如权利要求9所述的CAN总线资源最小化的方法,其特征在于,各优先级的帧的撞帧率Bp[i]计算如下:
其中,i=0代表最高优先级,i=1,2,…,p-1代表其余依次降低的优先级,CAN总线上计划运行的优先级数目为p;A[i]表示优先级i相对于CAN总线的流量负载,k=1,L_S[i]表示优先级i的累积流量负载,A_L[i]表示更高优先级向优先级i溢出的溢出流量负载。 - 如权利要求10所述的CAN总线资源最小化的方法,其特征在于,优先级i相对于CAN总线的流量负载A[i],优先级i的累积流量负载L_S[i],更高优先级向优 先级i溢出的溢出流量负载A_L[i]分别计算如下:
其中,L[i]、S[i]分别表示优先级i的帧的发送频率和帧长,B代表当前的CAN总线通信速率。 - 如权利要求6所述的CAN总线资源最小化的方法,其特征在于,步骤S3中调高或调低CAN总线通信速率的方式是步进式和/或二分法查找。
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时能实现权利要求6-12任一项所述的CAN总线资源最小化的方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210567859.5A CN114650195B (zh) | 2022-05-24 | 2022-05-24 | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 |
CN202210567859.5 | 2022-05-24 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023226905A1 true WO2023226905A1 (zh) | 2023-11-30 |
Family
ID=81996880
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/095374 WO2023226905A1 (zh) | 2022-05-24 | 2023-05-19 | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114650195B (zh) |
WO (1) | WO2023226905A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114650195B (zh) * | 2022-05-24 | 2022-07-29 | 深圳市德兰明海科技有限公司 | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040068556A1 (en) * | 2002-09-25 | 2004-04-08 | Sbc Properties, L.P. | Traffic modeling for packet data communications system dimensioning |
CN103327511A (zh) * | 2012-03-22 | 2013-09-25 | 电信科学技术研究院 | 一种确定业务容量的方法和设备 |
CN103823780A (zh) * | 2014-03-03 | 2014-05-28 | 东南大学 | 一种实时现场总线控制调度方法 |
CN105205536A (zh) * | 2015-11-06 | 2015-12-30 | 天津津航计算技术研究所 | 基于混合遗传算法的1553b总线消息传输优化方法 |
CN105429837A (zh) * | 2015-12-25 | 2016-03-23 | 中国铁道科学研究院 | Mvb总线中继器 |
CN107645455A (zh) * | 2017-09-12 | 2018-01-30 | 天津津航计算技术研究所 | 一种can总线的消息传输调度方法 |
CN114650195A (zh) * | 2022-05-24 | 2022-06-21 | 深圳市德兰明海科技有限公司 | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 |
CN114726726A (zh) * | 2022-05-24 | 2022-07-08 | 深圳市德兰明海科技有限公司 | 一种提高can总线通信效率的方法 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2000022846A1 (en) * | 1998-10-15 | 2000-04-20 | Airnet Communications Corporation | Broadband base station architecture for advanced resource management |
US8538449B2 (en) * | 2006-12-29 | 2013-09-17 | At&T Intellectual Property Ii, L.P. | Method and apparatus for allocating bandwidth for a network |
-
2022
- 2022-05-24 CN CN202210567859.5A patent/CN114650195B/zh active Active
-
2023
- 2023-05-19 WO PCT/CN2023/095374 patent/WO2023226905A1/zh unknown
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040068556A1 (en) * | 2002-09-25 | 2004-04-08 | Sbc Properties, L.P. | Traffic modeling for packet data communications system dimensioning |
CN103327511A (zh) * | 2012-03-22 | 2013-09-25 | 电信科学技术研究院 | 一种确定业务容量的方法和设备 |
CN103823780A (zh) * | 2014-03-03 | 2014-05-28 | 东南大学 | 一种实时现场总线控制调度方法 |
CN105205536A (zh) * | 2015-11-06 | 2015-12-30 | 天津津航计算技术研究所 | 基于混合遗传算法的1553b总线消息传输优化方法 |
CN105429837A (zh) * | 2015-12-25 | 2016-03-23 | 中国铁道科学研究院 | Mvb总线中继器 |
CN107645455A (zh) * | 2017-09-12 | 2018-01-30 | 天津津航计算技术研究所 | 一种can总线的消息传输调度方法 |
CN114650195A (zh) * | 2022-05-24 | 2022-06-21 | 深圳市德兰明海科技有限公司 | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 |
CN114726726A (zh) * | 2022-05-24 | 2022-07-08 | 深圳市德兰明海科技有限公司 | 一种提高can总线通信效率的方法 |
Non-Patent Citations (2)
Title |
---|
"Doctoral Dissertations", 1 November 2012, JILIN UNIVERSITY, China, article WANG WEI: "Research and Implementation of Scheme for Resource Allocation Based on Voice Prioirty Strategy under the GSM/EGPRS Network", pages: 1 - 62, XP009550634 * |
俞云奎 等 (YU, YUNKUI ET AL.): "舰船光纤局域网信息碰撞检测与最优配置研究 (Non-official translation: Ship Fiber Local Area Network Information Collision Detection and Optimal Configuration Research)", 1996年中国控制会议论文集 (NON-OFFICIAL TRANSLATION: 1996 CHINESE CONTROL CONFERENCE PROCEEDINGS), 30 September 1996 (1996-09-30) * |
Also Published As
Publication number | Publication date |
---|---|
CN114650195B (zh) | 2022-07-29 |
CN114650195A (zh) | 2022-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110758289B (zh) | 一种包括车载以太网的车内混合网络的睡眠与唤醒方法 | |
WO2023226905A1 (zh) | Can总线上帧的撞帧率计算方法及can总线资源最小化的方法 | |
WO2020119322A1 (zh) | 一种异步无线唤醒方法及设备 | |
CN114138373B (zh) | 一种基于强化学习的边缘计算任务卸载方法 | |
CN103873387A (zh) | 一种面向工业以太网的确定性通信调度方法 | |
CN210839611U (zh) | 一种包括车载以太网的车内混合网络的睡眠与唤醒装置 | |
CN114726726B (zh) | 一种提高can总线通信效率的方法 | |
CN110602798B (zh) | Lte网络机器通信随机接入最优参数分布式确定方法 | |
Joshi et al. | The multi-domain frame packing problem for CAN-FD | |
CN114185674A (zh) | 一种cpu任务实时调度方法、装置、设备及存储介质 | |
KR20100020253A (ko) | 차량 네트워크에서의 메시지 전송 상태 진단 장치 | |
CN109714804A (zh) | 基于相对剩余能量和sep协议的簇头选举算法 | |
CN111405678B (zh) | 一种基于虚拟载波侦听和优先级调度的csma-ca方法 | |
CN103581048B (zh) | 一种电力通信网络的分布式资源过载控制方法 | |
CN103257942B (zh) | 一种片上系统共享总线请求处理的方法及装置 | |
CN109121219A (zh) | 调度请求的发送方法及装置、存储介质、终端 | |
CN112963251A (zh) | 一种发动机转矩与转速的协调控制方法 | |
CN117544426B (zh) | 一种核安全级网关数据传输优先级处理方法、系统及设备 | |
CN112671512A (zh) | Can报文的发送方法、控制单元、can节点及其网络 | |
CN113934531A (zh) | 一种高吞吐量流处理方法及装置 | |
CN108768780B (zh) | 一种用于车载网络通信保障的动态时间环建立方法 | |
CN103873386A (zh) | 管理网络传输顺序的方法 | |
CN106879054A (zh) | 一种无线数据传输能耗优化方法 | |
CN118233241A (zh) | 一种载波监听总线的冲突协调仲裁方法、设备和介质 | |
CN117395204A (zh) | 一种数据整形通信方法及相关装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23810976 Country of ref document: EP Kind code of ref document: A1 |