Can bus message cycle adjustment method and system based on dynamic load balancing
By dividing the CAN bus network into message levels and defining partitions based on load rate and error count, and dynamically adjusting the message cycle, the problems of coarse adjustment granularity and insufficient stability are solved, load balancing and compatibility are achieved, and network performance is improved.
Patent Information
- Application Number
- PCT/CN2025/135252
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-09-30
- Filing Date
- 2025-11-15
- Publication Date
- 2026-02-12
AI Technical Summary
Existing CAN bus networks suffer from issues such as coarse adjustment granularity, insufficient stability, and limited compatibility in load balancing, especially in intelligent vehicle and industrial automation scenarios where it is difficult to achieve compatibility and stability for dynamically sensing network load and error states.
By dividing CAN message levels, setting adjustment cycle ranges and frequency modulation parameters, defining partitions based on load rate and error count, and employing step-by-step frequency reduction and preventative frequency reduction strategies, the message cycle is dynamically adjusted to achieve network load balancing.
It achieves accurate load detection and frequency modulation based on multi-dimensional indicators under the CAN/CAN FD standard, which improves network stability and compatibility, avoids network jitter and effectively utilizes bandwidth resources.
Smart Images

Figure CN2025135252_12022026_PF_FP_ABST
Abstract
Description
CAN bus message cycle adjustment method and system based on dynamic load balancing TECHNICAL FIELD
[0001] The present application relates to the field of CAN bus message cycle dynamic adjustment, and particularly to a CAN bus message cycle adjustment method and system based on dynamic load balancing. BACKGROUND
[0002] In recent years, some research attempts to optimize CAN network performance by dynamically adjusting the message cycle, but there are still the following shortcomings: (1) coarse adjustment granularity: only based on the single index of load rate to adjust the frequency, without combining error state or message priority classification control; (2) insufficient stability: transient load fluctuation easily causes frequent frequency adjustment, leading to network jitter; (3) limited compatibility: dependent on customized hardware or protocol modification, difficult to adapt to existing CAN nodes. With the increasing real-time requirements of intelligent vehicles and industrial automation scenarios on CAN bus, a lightweight and adaptive load balancing scheme is urgently needed, which can dynamically perceive network load and error state under the premise of compatible standard CAN / CAN FD protocol, and realize network load balancing through reasonable frequency adjustment strategy. SUMMARY
[0003] The present application solves the problems of coarse adjustment granularity, insufficient stability and limited compatibility in dynamic adjustment of message cycle, and proposes a CAN bus message cycle adjustment method and system based on dynamic load balancing.
[0004] To achieve the above purpose, the following technical scheme is proposed:
[0005] A CAN bus message cycle adjustment method based on dynamic load balancing, comprising the following steps:
[0006] S1, dividing a plurality of CAN message levels according to the CAN ID range;
[0007] S2, setting the adjustment cycle range and frequency adjustment parameters of each CAN message level;
[0008] S3, defining the network load by load rate size and error count, and setting the frequency adjustment measures of each partition;
[0009] S4, acquiring real-time load rate and error count, and judging whether the error count increment is out of limit or the load rate is greater than a, if yes, identifying as a high load area, and performing step-by-step frequency reduction from high to low according to CAN message level, if not, performing S5;
[0010] S5, judging whether the load rate is greater than b, if yes, identifying as a next high load area, and performing preventive frequency reduction, if not, performing S6;
[0011] S6, judging whether the load rate is greater than c, wherein a>b>c, if yes, determining that the frequency is not adjusted in the safe zone, if no, determining that the frequency is adjusted in the low load zone.
[0012] Preferably, the CAN message levels from high to low are highest priority, second highest priority, medium priority, low priority and lowest priority in turn, the period of the message of the highest priority is fixed, the adjustment period range of the second highest priority, medium priority, low priority and lowest priority includes minimum period and maximum period, and the frequency adjustment parameter of each CAN message level gradually increases from high to low according to the priority level.
[0013] Preferably, the definition of the network load according to the load rate and the error count includes: defining as high load zone when the load rate is greater than a or the error count increment is out of limit; defining as second highest load zone when the load rate is between a and b; defining as safe zone when the load rate is between b and c; and defining as low load zone when the load rate is lower than c, wherein a=70%, b=50% and c=20%.
[0014] Preferably, the step of gradually reducing the frequency according to the CAN message levels from high to low includes the following steps:
[0015] First level: directly suspending the sending of the message of the lowest priority level, if the load rate is still greater than a, performing the second level adjustment, otherwise, exiting the adjustment;
[0016] Second level: adjusting the period of the message of the low priority level according to the frequency adjustment parameter until the upper limit of the period of the message of the low priority level, if the load rate is still greater than a, performing the third level adjustment, otherwise, exiting the adjustment;
[0017] Third level: adjusting the period of the message of the medium priority level according to the frequency adjustment parameter until the upper limit of the period of the message of the medium priority level, if the load rate is still greater than a, performing the fourth level adjustment, otherwise, exiting the adjustment;
[0018] Fourth level: locking the periods of the messages of the priorities other than the highest priority at the corresponding maximum periods, if the load rate is less than d, exiting the adjustment, otherwise, continuously performing the fourth level adjustment, wherein d=a-e, e is the first hysteresis margin, wherein d=65% and e=5%.
[0019] Preferably, the fourth level further includes: reporting a system level alarm to prompt the root cause fault to be checked.
[0020] Preferably, the preventive frequency reduction comprises the following steps: reducing the low-priority messages and the lowest-priority messages in sequence until the maximum period corresponding to the priority messages, judging whether the load rate is less than f each time the frequency is reduced, if yes, reducing to the safe zone, if no, judging whether the load rate is greater than a, if yes, increasing to the high-load zone, if no, continuing to reduce the low-priority messages and the lowest-priority messages in sequence, f = b - g, g is the second hysteresis margin, wherein f = 45%, g = 5%.
[0021] Preferably, the process of each priority frequency reduction is as follows:
[0022] Calculating the normalized load deviation scale factor of the current load zone: obtaining the real-time load rate and the load rate upper limit of the current load zone, the normalized load deviation scale factor = (real-time load rate - load rate lower limit) / (load rate upper limit - load rate lower limit);
[0023] Calculating the frequency reduction weight = 1 + the frequency modulation parameter of the current priority message × the normalized load deviation scale factor of the current load zone;
[0024] The sending period of the current priority message after frequency reduction = the current sending period of the current priority message × the frequency reduction weight.
[0025] Preferably, the process of each priority frequency increase is as follows:
[0026] Calculating the normalized load deviation scale factor of the current load zone: obtaining the allowed load rate upper limit after frequency increase and the real-time load rate of the current load zone, the normalized load deviation scale factor = (allowed load rate upper limit - real-time load rate) / allowed load rate upper limit;
[0027] Calculating the frequency increase weight = 1 - (1 - the frequency modulation parameter of the current priority message) × the normalized load deviation scale factor of the current load zone;
[0028] The sending period of the current priority message after frequency increase = the current sending period of the current priority message × the frequency increase weight.
[0029] A CAN bus message period adjustment system based on dynamic load balancing, which adopts the above-mentioned CAN bus message period adjustment method based on dynamic load balancing, comprising:
[0030] A network load real-time detection module for real-time collection and analysis of the communication state of the CAN bus and quantification of the network load level;
[0031] The message cycle dynamic adjustment module performs priority level division and parameter configuration on the message, and defines network load by load rate and error count, formulates a partition frequency adjustment strategy according to real-time data provided by the network load real-time detection module, and dynamically adjusts the sending cycle of the message through an algorithm.
[0032] The message cycle adjustment execution module transmits the frequency adjustment result output by the message cycle dynamic adjustment module to each slave node, and supervises the execution state, and adds a feedback mechanism to realize closed-loop control.
[0033] The main controller is electrically connected with the network load real-time detection module, the message cycle dynamic adjustment module and the message cycle adjustment execution module.
[0034] The network load dynamic detection technology based on multiple dimensions breaks through the limitation of traditional single load rate detection, and fuses physical layer error state and protocol layer frame density, thereby providing accurate data basis for dynamic frequency adjustment. BRIEF DESCRIPTION OF DRAWINGS
[0035] Fig. 1 is a method flowchart of the present application;
[0036] Fig. 2 is a step-by-step frequency reduction flowchart of the present application;
[0037] Fig. 3 is a step-by-step frequency increase flowchart of the present application;
[0038] Fig. 4 is a system structure block diagram of the present application. DETAILED DESCRIPTION
[0039] Embodiment:
[0040] The embodiment provides a CAN bus message cycle adjustment method based on dynamic load balancing, referring to Fig. 1, including the following steps:
[0041] S1, a plurality of CAN message levels are divided according to the CAN ID range; the CAN message levels from high to low are highest priority, second highest priority, medium priority, low priority and lowest priority;
[0042] S2, set the adjustment cycle range and frequency adjustment parameters of each CAN message level; the cycle of the highest priority message is fixed, the adjustment cycle range of the second highest priority, medium priority, low priority and lowest priority includes the minimum cycle and the maximum cycle, and the frequency adjustment parameters of each CAN message level gradually increase from high to low according to the priority level, and the following parameters are configured for CAN messages of different priorities, referring to Table 1.
[0043] Table 1: Message level division and parameter definition table
[0044] There are 5 priority levels defined, 0 is the highest priority, 4 is the lowest priority, each priority level corresponds to a certain CAN ID range. The minimum period Tmin represents the upper limit of the message sending frequency of the corresponding CAN ID range under this priority level; the maximum period Tmax represents the lower limit of the message sending frequency of the corresponding CAN ID range under this priority level, and it is necessary to ensure that the frequency-adjusted message period cannot exceed the above maximum and maximum period. ω is the frequency adjustment coefficient, which controls the amplitude of the period adjustment each time. The smaller ω is, the smaller the allowed period adjustment amplitude each time, and the larger ω is, the larger the allowed period adjustment range each time. For high-priority messages, ω should be set smaller to ensure that the frequency reduction step of high-priority messages is limited; and for low-priority messages, ω should be set larger to enable low-priority messages to obtain a large frequency adjustment step.
[0045] S3, according to the load rate and the error count, the network load is divided into zones, and the frequency adjustment measures of each zone are set; the network load is divided into zones according to the load rate and the error count, which includes the following steps: when the load rate is higher than a or the error count increment is out of limit, it is defined as a high load zone; when the load rate is between a and b, it is defined as a second high load zone, when the load rate is between b and c, it is defined as a safe zone, and when the load rate is lower than c, it is defined as a low load zone, wherein a = 70%, b = 50%, c = 20%, and the load zone definition is shown in Table 2.
[0046] Table 2 Load zone definition
[0047] S4, obtain the real-time load rate and error count, judge whether the error count increment is out of limit or the load rate is greater than a, if yes, it is determined as a high load zone, and the CAN message is reduced in frequency from high to low, if not, S5 is performed;
[0048] Referring to FIG. 2, the CAN message is reduced in frequency from high to low, which specifically includes the following steps:
[0049] First level: directly suspend the sending of the lowest priority level message, if the load rate is still greater than a, the second level adjustment is performed, otherwise the adjustment is exited;
[0050] Second level: adjust the period of low priority message according to the frequency adjustment parameter until the upper limit of the period of low priority message, if the load rate is still greater than a, the third level adjustment is performed, otherwise the adjustment is exited;
[0051] Third level: adjust the period of medium priority message according to the frequency adjustment parameter until the upper limit of the period of medium priority message, if the load rate is still greater than a, the fourth level adjustment is performed, otherwise the adjustment is exited;
[0052] The fourth level: the packets of other priorities except the highest priority are respectively locked in the corresponding maximum period, and the system-level alarm is reported to prompt the root fault to be checked. If the load rate is less than d, the adjustment is exited, otherwise, the fourth level adjustment is continuously performed, wherein d=a-e, e is the first hysteresis margin, d=65%, and e=5%.
[0053] The process of reducing the frequency of each priority is as follows:
[0054] The normalized load deviation scale factor of the load partition is calculated: the load rate lower limit, the load rate upper limit and the real-time load rate of the load partition are obtained, and the normalized load deviation scale factor=(real-time load rate-load rate lower limit) / (load rate upper limit-load rate lower limit).
[0055] The frequency reduction weight is calculated=1+the frequency modulation parameter of the priority message in the place×the normalized load deviation scale factor of the load partition.
[0056] The sending period of the priority message in the place after frequency reduction=the current sending period of the priority message in the place×the frequency reduction weight.
[0057] The high load area: the system quickly releases bandwidth resources through the step-by-step frequency reduction and priority isolation strategy, ensures the real-time performance and reliability of high-priority messages, and prevents network paralysis. The high load area triggering condition: the measured load rate is greater than 70% for three times in succession, to avoid instantaneous peak false triggering. The high load area frequency reduction strategy: step-by-step frequency reduction, which specifically includes:
[0058] The first level: the sending of 4-lowest priority messages is directly suspended, and the bandwidth is immediately released. If the load rate is still greater than 70% after the first frequency modulation, the second frequency modulation is entered.
[0059] The second level: the period of 3-low priority messages is adjusted, and the adjustment formula is:
[0060] Wherein, T new(3) is the sending period of 3-level messages after frequency reduction, T current(3) is the current sending period of 3-level messages, ω3 is the frequency modulation coefficient of 3-level messages, Load current is the current real-time load rate, Load HH_LL is the load rate lower limit of the high load area (HH), Load HH_UL is the load rate upper limit (100%) of the high load area, and the expression (Load-Load HH_LL ) / (Load HH_UL -Load HH_LL ) is the normalized load deviation scale factor. The network load rate exceeding the high load area is normalized to the [0, 1] interval, and then multiplied by the frequency modulation coefficient to calculate the frequency reduction ratio. At the same time, it is necessary to ensure that the 3-level message period after frequency reduction is not higher than the maximum period Tmax(3) When 3-low priority message period T new(3) Frequency modulation reaches its maximum period T max(3) After that, the second level of frequency modulation ends, and if the load rate is still > 70% at the end, the third level of frequency modulation is entered.
[0061] Third level: adjust 2-medium priority message period, and the frequency modulation formula is:
[0062] Wherein, T new(2) is the 2-level message sending period after frequency reduction, T current(2) is the current 2-level message sending period, ω2 is the 2-level message frequency modulation coefficient, and the remaining parameters are as defined above. When 2-medium priority message period T new(2) Frequency modulation reaches its maximum period T max(2) After that, the third level of frequency modulation ends, and if the load rate is still > 70% at the end, the fourth level of frequency modulation is entered.
[0063] Fourth level: lock the message periods of priority levels 1-4 at the corresponding maximum periods T max : After triggering the fourth level of forced protection measures, report a system level alarm at the same time, prompting manual intervention to troubleshoot the root cause.
[0064] High load area exit condition: measured load rate < 65% after frequency reduction, and after exiting, enter the corresponding interval according to the current load rate.
[0065] S5, determine whether the load rate is greater than b, if yes, determine that it is the second high load area, and perform preventive frequency reduction, if not, perform S6;
[0066] The preventive frequency reduction comprises the following steps: sequentially reducing the low priority message and the lowest priority message until the maximum period of the corresponding priority message is reached, and determining whether the load rate is less than f after each frequency reduction, if yes, downgrading to the safe area, if not, determining whether the load rate is greater than a, if yes, upgrading to the high load area, if not, continuing to sequentially reduce the low priority message and the lowest priority message, f = b-g, and g is the second hysteresis margin, wherein f = 45%, and g = 5%.
[0067] Second high load area (H): in the second high load area, the low priority flow is actively optimized, and when the single detection load rate enters the range of 50% to 70%, preventive frequency reduction is performed, and only priority levels 3-low priority and 4-lowest priority are adjusted, and the frequency modulation formula is:
[0068] Wherein, T new(i) is the priority i-level message sending period after frequency reduction, T current(i) is the current priority i-level message sending period, ω iFor the frequency modulation coefficient of priority i-level messages, Load current The current real-time load rate, Load H_LL The lower limit of the load rate for the second highest load zone (H), Load H_UL The upper limit of the load rate for the second highest load zone, expressed as (Load-Load H_LL ) / (Load H_UL -Load H_LL The normalized load deviation scaling factor normalizes the portion of the network load rate exceeding the second-highest load range to the [0,1] interval, then multiplies it by the frequency modulation coefficient to calculate the down-rate. Simultaneously, it is necessary to ensure that the period of the down-rate i-th level message does not exceed its maximum period T. max(i) .
[0069] S6. Determine if the load rate is greater than c, where a>b>c. If yes, it is considered a safe zone and no frequency adjustment is needed. If no, it is considered a low load zone and frequency is increased in stages.
[0070] Referring to Figure 3, the graded frequency upsampling in the low-load region specifically includes the following steps:
[0071] S61, upsampling the frequency of messages of the second highest priority, medium priority, and low priority, and calculating the target period after a single upsampling;
[0072] S62, calculate the theoretical load increment after each priority message is frequency-upgraded;
[0073] S63, calculate the maximum allowable load rate increment;
[0074] S64, calculates the predicted load rate after frequency upsampling;
[0075] S65, Dynamic constraint on frequency increase: Determine whether the predicted load rate after frequency increase is less than or equal to the constraint threshold. If yes, proceed to S66. If no, reduce the frequency increase proportionally to ensure that the theoretical load rate increment after frequency increase does not exceed the maximum allowable load rate increment, and then proceed to S66.
[0076] S66: Increase the frequency level step by step according to the message priority from high to low. After each frequency increase, check the load rate. If the load rate after the frequency increase is greater than h, where h = bj and j is the third hysteresis margin, where h = 45% and j = 5%, then immediately roll back the frequency increase adjustment of this round. If the load rate after the frequency increase is greater than or equal to k, where k = 35%, then stop the frequency increase. If the load rate after the frequency increase is less than k, then execute the frequency increase of the next priority.
[0077] S67: After each priority message completes a full frequency increase, if the load rate after the frequency increase is less than k, repeat S61 to S66; otherwise, stop the frequency increase and enter the safe zone.
[0078] The process of frequency increase for each priority level is as follows:
[0079] Calculate the normalized load deviation scale factor of the current load partition: obtain the upper limit of the allowed load rate after frequency increase and the real-time load rate of the current load partition, and the normalized load deviation scale factor = (upper limit of allowed load rate - real-time load rate) / upper limit of allowed load rate;
[0080] Calculate the frequency increase weight = 1 - (1 - frequency modulation parameter of the current priority message) x normalized load deviation scale factor of the current load partition;
[0081] The sending period of the current priority message after frequency increase = current sending period of the current priority message x frequency increase weight.
[0082] Safety zone (S): the load rate enters the range of 20% to 50%, and all messages are sent according to the current period. If the calculated load rate > 55%, upgrade to the next high load zone; if the calculated load rate < 15%, downgrade to the low load zone.
[0083] Low load zone (L): the frequency increase strategy can improve the freshness of data and optimize bandwidth utilization by dynamically shortening the period of part of non-critical messages, and can shorten the abnormal detection delay. At the same time, in order to ensure that the load rate after frequency increase is still in the safety zone, it is necessary to dynamically predict the load change and limit the frequency increase amplitude during frequency modulation. The trigger condition of the low load zone is that the load rate is less than 20% for 3 times in a row to avoid short-term idle false triggering. The frequency increase strategy of the low load zone is dynamic prediction and hierarchical frequency increase.
[0084] The following are the specific implementation steps:
[0085] S61: Increase the frequency of 1, 2, and 3 priority messages, calculate the target period after single frequency increase, and the calculation formula is:
[0086] Where, T new(i) is the frequency increase target period of priority i level message, T current(i) is the sending period of the current priority i level message, ω i is the frequency modulation coefficient of priority i level message, Load S_MID is the upper limit of the allowed load rate after frequency increase, and the load rate median point (a / 2 = 35%) of the safety zone is selected as its value, Load current is the current real-time load rate. At the same time, it is necessary to ensure that the message period after frequency increase is not less than its minimum period T min(i) . 4 - The lowest priority message does not participate in frequency increase and maintains the original period.
[0087] S62: Introduce a frequency increase amplitude prediction model to calculate the theoretical load increment ΔLoad of each priority message after frequency increase:
[0088] Where, BitsPerFramei BitRate new(i) is the period of the i-priority message after frequency increasing, T current(i) is the current period of the i-priority message, BitRate is the baud rate of CAN bus, and TimeWindow is the load statistics window (unit: s).
[0089] S63: Calculate the maximum allowed load rate increment ΔLoad max : ΔLoad max = Load S_MID - Load current ;
[0090] wherein, ΔLoad max is the maximum allowed load rate increment, Load S_MID is the upper limit of the allowed load rate after frequency increasing, and the load rate median point (35%) of the safety zone is selected as its value, Load current is the current real-time load rate.
[0091] S64: Calculate the predicted load rate Load predict after frequency increasing: Load predict = Load current + ΔLoad;
[0092] wherein, Load predict is the predicted load rate after frequency increasing, Load current is the current load rate, and ΔLoad is the theoretical load increment calculated in step S2.
[0093] S65: Perform dynamic constraint of the frequency increasing amplitude. If Load predict ≤ constraint threshold, the constraint threshold = 35%, the frequency increasing is allowed according to the formula of S1; if Load predict > 35%, the frequency increasing amplitude needs to be reduced in proportion, and the period of the message after the reduction of the frequency increasing amplitude satisfies: T new(i) < T cut(i) < T current(i) ;
[0094] wherein, T new(i) is the target period of the i-priority message after frequency increasing calculated in step S1, T cut(i) is the transmission period of the i-priority message after the reduction of the frequency increasing amplitude, and T current(i) is the original period of the i-priority message.
[0095] The calculation formula of the reduction proportion factor is:
[0096] wherein, K cut(i) is the frequency amplitude reduction factor of priority i message, ω i is the frequency modulation coefficient of priority i message, and the formula is Theoretical load increment after reducing the frequency amplitude is ensured not to exceed ΔLoad max .
[0097] The message period calculation formula after reducing the frequency amplitude is: T cut(i) = T current(i) -k cut(i) ×(T current(i) -T new(i) );
[0098] wherein, T cut(i) is the sending period of priority i message after reducing the frequency amplitude, T current(i) is the current period of priority i message, and T new(i) is the target frequency of priority i message calculated in S1.
[0099] S66: The frequency is increased step by step according to the message priority from high to low, and the load rate is detected in real time after each frequency increase. If the load rate after frequency increase > 45%, a 5% hysteresis buffer is reserved to prevent instantaneous exceeding of the upper limit of the safety zone, then immediately back to the current frequency adjustment; if the load rate after frequency increase ≥ 35%, stop increasing the frequency; if the load rate after frequency increase < 35%, execute the next level of frequency increase.
[0100] S67: After each priority message completes a complete frequency increase, if the load rate is still < 35%, repeat steps S61-S66. The low load area exit condition is: the load rate measured after frequency increase ≥ 35%, stop frequency increase and enter the safety zone.
[0101] A CAN bus message period adjustment system based on dynamic load balancing, which adopts the above-mentioned CAN bus message period adjustment method based on dynamic load balancing, and with reference to FIG. 4, comprises:
[0102] A network load real-time detection module, which is responsible for real-time collection and analysis of the communication state of the CAN bus, quantifies the network load level, and specifically comprises a bus load rate calculation unit for calculating the bus load rate in a unit time window, an error state monitoring unit for calculating the error count increment in a unit time, and a frame density statistical unit for counting the number of frames received in a unit time;
[0103] A main controller, which is electrically connected with the network load real-time detection module, the message period dynamic adjustment module, and the message period adjustment execution module.
[0104] The message cycle dynamic adjustment module divides the messages into priority levels and configures parameters, and defines network load partitions according to load rate and error count, formulates partition frequency adjustment strategies according to real-time data provided by the network load real-time detection module, and dynamically adjusts the sending cycle of the messages through an algorithm;
[0105] The message cycle adjustment execution module transmits the frequency adjustment result output by the message cycle dynamic adjustment module to each slave node, supervises the execution state, and realizes closed-loop control through a feedback mechanism, and specifically includes an instruction packaging and broadcasting unit, an instruction analysis and execution unit, and an execution state monitoring and feedback unit.
[0106] The message cycle adjustment execution module transmits the frequency adjustment result output by the dynamic adjustment module to each slave node safely and reliably, supervises the execution state, and ensures that the entire CAN network strategy is synchronized. At the same time, a feedback mechanism is added to realize closed-loop control, avoiding deviations between expected results and actual execution. The following is the specific composition and implementation method of the module, which specifically includes:
[0107] The instruction packaging and broadcasting unit: based on a custom protocol, the master node packages and sends the frequency adjustment result of the dynamic adjustment module to each slave node in the network, as shown in Table 3, the instruction format of the frequency adjustment message is as follows:
[0108] [Instruction type] [Target node address] [Target message type] [New cycle value] [Effective time offset] [CRC8];
[0109] Table 3 Frequency Adjustment Instruction Format Table
[0110] The instruction analysis and execution unit: each slave node in the network is responsible for receiving and verifying the frequency adjustment instruction, and updating the local message sending cycle according to the instruction content, to ensure the accuracy and timeliness of the adjustment action.
[0111] The execution state monitoring and feedback unit: the master controller tracks the instruction execution result in real time, forms a closed-loop control through a feedback mechanism, and ensures the consistency and reliability of the network frequency adjustment strategy.
[0112] For each slave node in the network, the instruction execution result needs to be fed back to the master node. If the frequency adjustment is successful, the feedback success state and the actual effective cycle value are fed back, and if the frequency adjustment fails, the reason for the failure is fed back.
[0113] The master controller monitors the feedback state of the slave node in real time. If a NACK is received, the frequency adjustment instruction is regenerated and retransmitted. If the slave node does not feedback within a timeout period, the slave node is marked as "offline" and an alarm is triggered.
[0114] According to the feedback state of each node, the main control calculates the instruction delivery rate and the execution success rate, and monitors the health state of the node. In addition, the main control node stores the frequency modulation instruction and feedback data into the local history log, which can support fault backtracking.
[0115] The system also sets a cooperative monitoring node as a special hardware node independent of the master-slave controller, which provides network state monitoring and coordination functions with a global perspective. The independent hardware node is deployed for load analysis, and broadcasts the global load state through a custom protocol and provides load prediction suggestions to the main control, assisting the main control node in decision-making. When the main control fails, the cooperative monitoring node can temporarily take over the load regulation task.
Claims
1. A CAN bus message cycle adjustment method based on dynamic load balancing, characterized in that, The method comprises the following steps: S1, dividing CAN message levels according to CAN ID range; S2, setting the adjustment period range and frequency modulation parameter of each CAN message level; S3, defining network load partition according to load rate and error count, and setting frequency modulation measures of each partition; S4, obtaining real-time load rate and error count, judging whether the error count increment is out of limit or the load rate is greater than a, if yes, identifying as high load area, and gradually reducing frequency from high to low CAN message level, if no, proceeding to S5; S5, judging whether the load rate is greater than b, if yes, identifying as next high load area, and proceeding to preventive frequency reduction, if no, proceeding to S6; S6, judging whether the load rate is greater than c, if yes, identifying as safe area without frequency modulation, if no, identifying as low load area and proceeding to hierarchical frequency increase, wherein a > b > c.
2. The CAN bus message period adjustment method based on dynamic load balancing according to claim 1, characterized in that, The CAN message levels from high to low are highest priority, next high priority, medium priority, low priority and lowest priority in turn, the period of the message with the highest priority is fixed, the adjustment period range of the message with the next high priority, medium priority, low priority and lowest priority comprises minimum period and maximum period, and the frequency modulation parameter of each CAN message level gradually increases from high to low priority.
3. The CAN bus message cycle adjustment method based on dynamic load balancing according to claim 1, characterized in that, The network load partition definition according to load rate and error count comprises: defining as high load area when the load rate is greater than a or the error count increment is out of limit; defining as next high load area when the load rate is between a and b; defining as safe area when the load rate is between b and c; and defining as low load area when the load rate is lower than c.
4. The CAN bus message period adjustment method based on dynamic load balancing according to claim 2, characterized in that, The gradually reducing frequency from high to low CAN message level comprises the following steps: First level: directly suspending the transmission of the message with the lowest priority, if the load rate is still greater than a, proceeding to second level adjustment, otherwise, exiting the adjustment; Second level: adjusting the period of the message with low priority according to the frequency modulation parameter until the upper limit of the period of the message with low priority, if the load rate is still greater than a, proceeding to third level adjustment, otherwise, exiting the adjustment; Third level: adjusting the period of the message with medium priority according to the frequency modulation parameter until the upper limit of the period of the message with medium priority, if the load rate is still greater than a, proceeding to fourth level adjustment, otherwise, exiting the adjustment; Fourth level: locking the period of the message with other priorities except the highest priority at the corresponding maximum period, if the load rate is less than d, exiting the adjustment, otherwise, continuously proceeding to fourth level adjustment, wherein d = a - e, and e is the first hysteresis allowance.
5. The CAN bus message cycle adjustment method based on dynamic load balancing according to claim 4, characterized in that, The fourth level further comprises: reporting system level alarm and prompting to check the root fault.
6. The CAN bus message cycle adjustment method based on dynamic load balancing according to claim 2, characterized in that, The preventive frequency reduction comprises the following steps: gradually reducing the frequency of the message with low priority and the message with the lowest priority until the maximum period of the corresponding priority message, judging whether the load rate is less than f after each frequency reduction, if yes, reducing to the safe area, if no, judging whether the load rate is greater than a, if yes, increasing to the high load area, if no, continuously gradually reducing the frequency of the message with low priority and the message with the lowest priority, wherein f = b - g, and g is the second hysteresis allowance.
7. The method of claim 4-6, wherein, The process of reducing the frequency of each priority is as follows: Calculating the normalized load deviation scale factor of the current load partition: obtaining the lower limit of load rate, the upper limit of load rate and the real-time load rate of the current load partition, the normalized load deviation scale factor=(real-time load rate-load rate lower limit) / (load rate upper limit-load rate lower limit); Calculating the frequency reduction weight=1+frequency modulation parameter of the current priority message×normalized load deviation scale factor of the current load partition; The sending period of the current priority message after frequency reduction=current sending period of the current priority message×frequency reduction weight.
8. The CAN bus message cycle adjustment method based on dynamic load balancing according to any one of claims 4-6, characterized in that, The frequency increasing process of each priority is as follows: Calculating the normalized load deviation scale factor of the current load partition: obtaining the allowed upper limit of load rate after frequency increasing and the real-time load rate of the current load partition, the normalized load deviation scale factor=(allowed upper limit of load rate-real-time load rate) / allowed upper limit of load rate; Calculating the frequency increasing weight=1-(1-frequency modulation parameter of the current priority message)×normalized load deviation scale factor of the current load partition; The sending period of the current priority message after frequency increasing=current sending period of the current priority message×frequency increasing weight.
9. A CAN bus message cycle adjustment system based on dynamic load balancing, adopting the CAN bus message cycle adjustment method based on dynamic load balancing according to claim 1, characterized in that, It comprises: A network load real-time detection module, which is used for collecting and analyzing the communication state of the CAN bus in real time and quantifying the network load level; A message cycle dynamic adjustment module, which is used for dividing the message into priority levels and configuring parameters, defining the network load by load rate and error count, formulating a frequency modulation strategy according to the real-time data provided by the network load real-time detection module, and dynamically adjusting the sending period of the message through an algorithm; A message cycle adjustment execution module, which is used for transmitting the frequency modulation result output by the message cycle dynamic adjustment module to each slave node, supervising the execution state and adding a feedback mechanism to realize closed-loop control; A main controller, which is electrically connected with the network load real-time detection module, the message cycle dynamic adjustment module and the message cycle adjustment execution module.