A method and system for adjusting CAN bus message period based on dynamic load balancing
By dividing the CAN bus network into message levels and setting adjustment cycles, and combining load rate and error count for partitioned frequency modulation, the bandwidth waste and real-time risk of the CAN bus network are solved, dynamic load balancing and real-time guarantee of critical messages are achieved, and the stability and compatibility of the system are improved.
Patent Information
- Application Number
- CN202511419746.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-09-30
AI Technical Summary
Traditional CAN bus networks suffer from bandwidth waste, real-time risks, lack of dynamic adaptability, and erroneous adjustments, among other unresolved issues, including coarse adjustment granularity, insufficient stability, and limited compatibility in existing technologies.
By dividing CAN message levels, setting adjustment cycle ranges and frequency modulation parameters, defining partitions based on load rate and error count, and employing strategies of gradual frequency reduction, preventative frequency reduction, and graded frequency increase, dynamic load balancing is achieved.
It achieves dynamic perception of network load and error status while being compatible with standard CAN/CAN FD protocols, balances network reliability and bandwidth efficiency, ensures the real-time performance of critical messages and flexible adjustment of non-critical messages, and improves system robustness and compatibility.
Smart Images

Figure CN120896946B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of CAN bus message cycle dynamic adjustment, and in particular to a CAN bus message cycle adjustment method and system based on dynamic load balancing. BACKGROUND
[0002] Traditional CAN bus networks generally adopt a fixed message cycle strategy, which has the following limitations:
[0003] 1. Bandwidth waste: Non-critical data is still sent at a fixed cycle when the network is idle, occupying bandwidth resources redundantly;
[0004] 2. Real-time risk: Low-priority messages continuously occupy the bus under high load, exacerbating network congestion and causing critical messages to be delayed or even lost;
[0005] 3. Lack of dynamic adaptability: Relies on manual preset cycles and cannot automatically optimize network performance according to real-time load (such as sudden traffic and node errors);
[0006] 4. Error propagation risk: When the CAN bus error counter (REC / TEC) abnormally increases, there is a lack of active load shedding mechanism, which may cause nodes to go offline or the entire network to fail.
[0007] In recent years, some research has attempted to optimize CAN network performance by dynamically adjusting message cycles, but still has the following shortcomings: (1) Coarse adjustment granularity: only based on a single load rate indicator to adjust the frequency, without considering error state or message priority classification control; (2) Insufficient stability: transient load fluctuations can easily cause frequent frequency adjustments, leading to network jitter; (3) Limited compatibility: relies on custom hardware or protocol modification, making it difficult to adapt to existing CAN nodes. With the increasing real-time requirements of intelligent vehicles and industrial automation scenarios for CAN bus, there is an urgent need for a lightweight, adaptive load balancing solution that can dynamically sense network load and error state while maintaining compatibility with standard CAN / CAN FD protocols and achieving network load balancing through reasonable frequency adjustment strategies. SUMMARY
[0008] The present application solves the problems of coarse adjustment granularity, insufficient stability, and limited compatibility in dynamic message cycle adjustment, and proposes a CAN bus message cycle adjustment method and system based on dynamic load balancing, which can dynamically sense network load and error state and achieve network load balancing through reasonable frequency adjustment strategies.
[0009] To achieve the above purpose, the following technical solutions are proposed:
[0010] A CAN bus message cycle adjustment method based on dynamic load balancing, comprising the following steps:
[0011] S1, divide several CAN message levels according to CAN ID range;
[0012] S2, set the adjustment cycle range and frequency modulation parameter of each CAN message level;
[0013] S3, define the network load by load rate size and error count, and set the frequency modulation measures of each partition;
[0014] S4, obtain 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, determine as high load area, and gradually reduce the frequency of CAN message level from high to low, if not, proceed to S5;
[0015] S5, judge whether the load rate is greater than b, if yes, determine as next high load area, and proceed to preventive frequency reduction, if not, proceed to S6;
[0016] S6, judge whether the load rate is greater than c, wherein a>b>c, if yes, determine as safe area without frequency modulation, if not, determine as low load area and proceed to graded frequency increase.
[0017] The application realizes the real-time guarantee of key message and the flexible adjustment of non-key message by the differentiated configuration of priority and frequency modulation parameter, balances the network reliability and bandwidth efficiency, realizes the adjustment and control of load fluctuation by partition strategy and frequency modulation strategy, so as to achieve the goal of load balancing, and guarantees the differentiated service quality of different priority messages.
[0018] As preferred, the CAN message levels from high to low are highest priority, next high priority, medium priority, low priority and lowest priority in turn, the cycle of the message of highest priority is fixed, the adjustment cycle range of next high priority, medium priority, low priority and lowest priority includes minimum cycle and maximum cycle, and the frequency modulation parameter of each CAN message level gradually increases from high to low according to priority level.
[0019] The application defines five priority levels, 0-4, wherein 0 is the highest priority and 4 is the lowest priority, each of which corresponds to a determined CAN ID range. The minimum period Tmin represents the upper limit of the message sending frequency in the CAN ID range under the priority level; the maximum period Tmax represents the lower limit of the message sending frequency in the CAN ID range under the priority level, and the frequency-adjusted message period needs to be ensured not to exceed the maximum and maximum period. Among them, the message period of 0-highest priority is fixed and is not allowed to be frequency-adjusted; the maximum period of the message of 4-lowest priority can be ∞, i.e., the sending is suspended. ω is a frequency-adjusting coefficient, which controls the amplitude of the period adjustment each time. The smaller ω is, the smaller the allowed period adjustment amplitude each time is, and the larger ω is, the larger the allowed period adjustment range each time is. For the message of high priority level, the ω value should be set smaller to ensure that the frequency reduction step of the high priority message is limited; and for the message of low priority level, the ω value should be set larger to enable the low priority message to obtain a large frequency adjustment step.
[0020] As preferred, the step of defining the network load according to the load rate and the error count includes the following steps: defining as a high load area when the load rate is higher than a or the error count increment exceeds the limit; defining as a second high load area when the load rate is between a and b, defining as a safe area when the load rate is between b and c, and defining as a low load area when the load rate is lower than c, wherein a=70%, b=50%, and c=20%.
[0021] As preferred, the step of frequency-reducing the CAN message level from high to low in stages specifically includes the following steps:
[0022] The first stage: directly suspending the sending of the message of the lowest priority level, and if the load rate is still greater than a, performing the second stage adjustment, otherwise, exiting the adjustment;
[0023] The second stage: adjusting the period of the low priority message according to the frequency-adjusting parameter until the upper limit of the period of the low priority message, and if the load rate is still greater than a, performing the third stage adjustment, otherwise, exiting the adjustment;
[0024] The third stage: adjusting the period of the medium priority message according to the frequency-adjusting parameter until the upper limit of the period of the medium priority message, and if the load rate is still greater than a, performing the fourth stage adjustment, otherwise, exiting the adjustment;
[0025] The fourth stage: locking the periods of the messages of the priorities other than the highest priority at the corresponding maximum periods, and if the load rate is less than d, exiting the adjustment, otherwise, continuously performing the fourth stage adjustment, wherein d=a-e, and e is the first hysteresis margin, wherein d=65% and e=5%.
[0026] As preferred, the fourth stage further includes the following step: reporting a system-level alarm to prompt the root fault to be checked.
[0027] As preferred, the preventive frequency reduction comprises the following steps: reducing the low priority messages and the lowest priority messages one by one until the maximum period corresponding to the priority messages, each time after the frequency reduction, judging whether the load rate is less than f, 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 one by one, f = b - g, g is the second hysteresis margin, wherein f = 45%, g = 5%.
[0028] As preferred, the hierarchical frequency increase in the low load zone comprises the following steps:
[0029] S61, increasing the frequency of the messages of the second high priority, the medium priority and the low priority, and calculating the target period after single frequency increase;
[0030] S62, calculating the theoretical load increment after the frequency increase of the messages of each priority;
[0031] S63, calculating the maximum allowed load rate increment;
[0032] S64, calculating the predicted load rate after the frequency increase;
[0033] S65, performing dynamic constraint of the frequency increase amplitude: judging whether the predicted load rate after the frequency increase is less than or equal to the constraint threshold, if yes, performing S66, if no, reducing the frequency increase amplitude in proportion, ensuring that the theoretical load rate increment after the frequency increase does not exceed the maximum allowed load rate increment, and then performing S66;
[0034] S66, increasing the frequency of the messages of each priority one by one from high to low, detecting the load rate after each frequency increase, if the load rate after the frequency increase is greater than h, h = b - j, j is the third hysteresis margin, wherein h = 45%, j = 5%, then immediately returning to the frequency increase adjustment of this round; if the load rate after the frequency increase is greater than or equal to k, wherein k = 35%, then stopping the frequency increase; if the load rate after the frequency increase is less than k, then performing the frequency increase of the next priority;
[0035] S67, after the messages of each priority complete a complete frequency increase, if the load rate after the frequency increase is less than k, repeatedly performing S61 to S66, otherwise, stopping the frequency increase and entering the safe zone.
[0036] As preferred, the process of the frequency reduction of each priority is as follows:
[0037] calculating the normalized load deviation proportion factor of the load partition: obtaining the load rate lower limit, the load rate upper limit and the real-time load rate of the load partition, the normalized load deviation proportion factor = (real-time load rate - load rate lower limit) / (load rate upper limit - load rate lower limit);
[0038] The down frequency weight is calculated as 1 + the frequency modulation parameter of the current priority message multiplied by the normalized load deviation scale factor of the current load partition.
[0039] The down frequency current priority message sending period is calculated as the current down frequency current priority message sending period multiplied by the down frequency weight.
[0040] As preferred, the frequency up of each priority is as follows:
[0041] The normalized load deviation scale factor of the current load partition is calculated as the up frequency allowed load rate upper limit and the real-time load rate of the current load partition, and the normalized load deviation scale factor is (allowed load rate upper limit - real-time load rate) / allowed load rate upper limit.
[0042] The up frequency weight is calculated as 1 - (1 - the frequency modulation parameter of the current priority message) multiplied by the normalized load deviation scale factor of the current load partition.
[0043] The up frequency current priority message sending period is calculated as the current up frequency current priority message sending period multiplied by the up frequency weight.
[0044] A CAN bus message cycle adjustment system based on dynamic load balancing adopts the above-mentioned CAN bus message cycle adjustment method based on dynamic load balancing, and comprises:
[0045] A network load real-time detection module is responsible for real-time collection and analysis of CAN bus communication states, quantification of network load levels, and specifically comprises a bus load rate calculation unit for calculating bus load rates in a unit time window, an error state monitoring unit for calculating error count increments in a unit time, and a frame density statistical unit for counting frame numbers received in a unit time.
[0046] A message cycle dynamic adjustment module divides and configures priority levels of messages, defines network load partitions according to load rates and error counts, formulates partition frequency modulation strategies according to real-time data provided by the network load detection module, and dynamically adjusts the sending period of the message through an algorithm.
[0047] A message cycle adjustment execution module transmits the frequency modulation results output by the message cycle dynamic adjustment module to each slave node, supervises the execution state, and realizes closed-loop control by adding a feedback mechanism, and specifically comprises an instruction packaging and broadcasting unit, an instruction analysis and execution unit, and an execution state monitoring and feedback unit.
[0048] A master 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.
[0049] The application breaks through the limitation of traditional single load rate detection, fuses physical layer error state and protocol layer frame density, and provides accurate data basis for dynamic frequency adjustment.
[0050] The application designs a special frequency adjustment instruction format, realizes network strategy synchronization and execution state monitoring through instruction encapsulation broadcast, slave node end analysis execution and feedback mechanism, ensures reliable execution of the frequency adjustment instruction based on the feedback closed loop control, supports single point / broadcast mode and fault node detection, improves system robustness and compatibility, and is suitable for standard CAN / CAN FD protocol.
[0051] The application has the beneficial effects that:
[0052] 1. Network load dynamic detection technology based on multi-dimensional index: through a bus load rate calculation unit, an error state monitoring unit and a frame density statistical unit, bus utilization rate, error counter increment (ΔREC / ΔTEC) and frame type distribution are collected in real time, and a multi-dimensional detection system including load rate, error state and frame density is constructed. The application breaks through the limitation of traditional single load rate detection, fuses physical layer error state (such as abnormal growth of TEC / REC) and protocol layer frame density, and provides accurate data basis for dynamic frequency adjustment;
[0053] 2. Priority grading and parameter predefinition mechanism: CAN messages are divided into 5 priority levels (0-4 levels), and minimum period (Tmin), maximum period (Tmax) and frequency adjustment coefficient (ω) are predefined. The period of the highest priority (0 level) is fixed, the period of the lowest priority (4 level) supports suspension of sending (Tmax=∞), and the value of ω increases with the decrease of the priority to control the adjustment amplitude. Through the differential configuration of priority and frequency adjustment parameters, the real-time guarantee of key messages (such as emergency fault alarm) and the flexible adjustment of non-key messages (such as debugging information) are realized, and the network reliability and bandwidth efficiency are balanced.
[0054] 3. Load partition and frequency grading strategy: According to the load rate (20%, 50%, 70% as the threshold), it is divided into low load area (L), safe area (S), high load area (H), and high load area (HH), combined with error state (such as error count increment over limit) to trigger the corresponding strategy: high load area (HH): step-down frequency (first suspend the lowest priority message, then adjust the low / medium priority period according to ω, and lock the maximum period until the maximum period is forced); High load area (H): preventive frequency reduction (only adjust low / lowest priority message to avoid entering HH area); Safe area (S): do not trigger any frequency adjustment (focus on state monitoring and trend prediction to provide buffer space for potential load fluctuations); Low load area (L): dynamic frequency increase (frequency increase from high to low according to priority, introduce load prediction model to constrain the frequency increase amplitude to avoid exceeding the upper limit of the safe area); Through the partition strategy and frequency adjustment formula (including the normalized load deviation factor), the load fluctuation is adjusted and controlled to achieve the goal of load balancing, while ensuring the differentiated quality of service of different priority messages; The hysteresis control is introduced to avoid frequent frequency adjustment caused by instantaneous fluctuations;
[0055] 4. Closed-loop control and cooperative execution mechanism: Design a special frequency adjustment instruction format (including target node ID, target message type, new period value, effective time offset, CRC check), broadcast through instruction encapsulation, slave node end analysis and execution (including whitelist check, boundary clamping) and feedback mechanism (ACK / NACK frame format), realize the whole network strategy synchronization and execution state monitoring. The closed-loop control based on feedback ensures the reliable execution of the frequency adjustment instruction, supports single point / broadcast mode and fault node detection (such as timeout marking offline, safe mode switching), improves the system robustness and compatibility, and adapts to standard CAN / CAN FD protocol. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 The method flowchart of the present application;
[0057] Figure 2 The step-down frequency flowchart of the present application;
[0058] Figure 3 The step-up frequency flowchart of the present application;
[0059] Figure 4 The system structure block diagram of the present application. DETAILED DESCRIPTION Example 1:
[0060] This embodiment proposes a CAN bus message period adjustment method based on dynamic load balancing, referring to Figure 1 , comprising the following steps:
[0061] S1, divide several CAN message levels according to CAN ID range; the CAN message levels from high to low are highest priority, second highest priority, medium priority, low priority and lowest priority in turn;
[0062] S2, set the adjustment cycle range and frequency modulation parameter 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 minimum cycle and maximum cycle, and the frequency modulation parameter of each CAN message level gradually increases from high to low priority level, and the following parameters are configured for CAN messages of different priority levels, as shown in Table 1.
[0063] Table 1: Message level division and parameter definition table
[0064] Priority Level CAN ID Range Minimum period (T min )]]> maximum period (T max )]]> Frequency Modulation Coefficient ω 0 - Highest Priority (ID min(0) ,ID max(0) )]]> [TECHNICAL FIELD] (0) ]] [TECHNICAL FIELD] (0) ]] - 1 - High Priority (ID min(1) ,ID max(1) )]]> [CAT min(1) ]]> [CAT max(1) ]]> [CDATA[ω1]] 2 - Medium Priority (ID min(2) ,ID max(2) )]]> [CAT min(2) ]]> [CAT max(2) ]]> [CDATA[ω2]] 3 - Low Priority (ID min(3) ,ID max(3) )]]> [CAT T min(3) ]]> [TECHNICAL FIELD] max(3) ]] [omega] 3 4 - Lowest Priority (ID min(4) ,ID max(4) )]]> [CAT min(4) ]]> ∞ [["ω4"]]
[0065] Five priority levels are defined, 0 is the highest priority, 4 is the lowest priority, and each priority level corresponds to a certain CAN ID range. The minimum cycle Tmin represents the upper limit of the message sending frequency of the corresponding CAN ID range under this priority level; the maximum cycle Tmax represents the lower limit of the message sending frequency of the corresponding CAN ID range under this priority level, and it is required to ensure that the frequency-modulated message cycle cannot exceed the above maximum and maximum cycle. Among them, the message cycle of 0-highest priority is fixed and does not allow frequency modulation; the maximum cycle of 4-lowest priority message can be ∞, that is, the sending is suspended.
[0066] ω is the frequency modulation coefficient, which controls the amplitude of the message sending cycle adjustment each time. The smaller ω is, the smaller the allowed cycle adjustment amplitude each time, and the larger ω is, the larger the allowed cycle adjustment range each time. For messages with high priority levels, ω value should be set smaller to ensure that the frequency reduction step of high priority messages is limited; and for messages with low priority levels, ω value should be set larger to enable low priority messages to obtain a large frequency modulation step.
[0067] S3, define network load partition according to load rate and error count, and set frequency modulation measures for each partition; the definition of network load partition according to load rate and error count includes the following steps: define as high load area when load rate is higher than a or error count increment is out of limit; define as second highest load area when load rate is between a and b, define as safe area when load rate is between b and c, and define as low load area when load rate is lower than c, wherein a=70%, b=50%, and c=20%.
[0068] The network load is divided into four intervals according to the load rate and error rate: high load area (load rate higher than 70% / error count increment over limit), secondary high load area (load rate between 50% and 70%), safe area (load rate between 20% and 50%), and low load area (load rate lower than 20%). Corresponding frequency modulation strategies are formulated for each load area. Refer to Table 2 for the definition of load partition.
[0069] Table 2 Definition of load partition
[0070] Load Area Load Rate Range Frequency Modulation Strategy Core Target High Load Area (HH) > 70% or Error Count Increment Overrun Step-down Frequency (Suspend Low Priority Message) Fast Congestion Relief, Ensure Real-time of Critical Message Second High Load Area (H) 50%~70% Weighted Frequency Reduction (Only Adjust Low / Medium Priority Message) Preventive Load Reduction, Avoid Entering High Load Safety Area (S) 20%~50% Maintain Current Cycle, Do Not Trigger Frequency Modulation Keep Stable Operation Low Load Area (L) <20% Weighted Frequency Increase (Improve Non-critical Message Update Rate) Improve Data Real-time, Optimize Bandwidth Utilization
[0071] S4, obtain real-time load rate and error count, determine whether there is error count increment over limit or load rate greater than a, if yes, determine as high load area, and perform step-by-step frequency reduction from high to low CAN message level, if not, perform S5;
[0072] Reference Figure 2 , the step-by-step frequency reduction from high to low CAN message level specifically includes the following steps:
[0073] First level: directly suspend the transmission of the lowest priority level message, if the load rate is still greater than a, perform second level adjustment, otherwise exit the adjustment;
[0074] Second level: adjust the low priority message period according to the frequency modulation parameter until the upper limit of the low priority message period, if the load rate is still greater than a, perform third level adjustment, otherwise exit the adjustment;
[0075] Third level: adjust the medium priority message period according to the frequency modulation parameter until the upper limit of the medium priority message period, if the load rate is still greater than a, perform fourth level adjustment, otherwise exit the adjustment;
[0076] Fourth level: lock the message period of other priorities except the highest priority at the corresponding maximum period, report a system level alarm, prompt to troubleshoot the root cause, if the load rate is less than d, exit the adjustment, otherwise, continue fourth level adjustment, where d=a-e, e is the first hysteresis margin, where d=65%, e=5%.
[0077] The process of reducing the frequency of each priority is as follows:
[0078] Calculate the normalized load deviation proportion factor of the current load partition: obtain the load rate lower limit, load rate upper limit and real-time load rate of the current load partition, and the normalized load deviation proportion factor=(real-time load rate-load rate lower limit) / (load rate upper limit-load rate lower limit);
[0079] Calculate the frequency reduction weight=1+frequency modulation parameter of the current priority message×normalized load deviation proportion factor of the current load partition;
[0080] The priority message sending period after frequency reduction = the current priority message sending period × the frequency reduction weight.
[0081] High load area (Load > 70% or error count increment over limit): In the high load area (load rate > 70%), the bus bandwidth is close to saturation, there is a serious congestion risk or even message loss, and the number of error frames increases significantly. The system releases bandwidth resources quickly through step-by-step frequency reduction and priority isolation strategy to ensure the real-time performance and reliability of high-priority messages and prevent network paralysis. High load area trigger condition: measured load rate > 70% for 3 consecutive times to avoid false triggering due to transient spikes. High load area frequency reduction strategy: step-by-step frequency reduction, which specifically includes:
[0082] First level: directly suspend the sending of 4-lowest priority messages, immediately release bandwidth, and if the load rate is still > 70% after the first frequency adjustment, proceed to the second frequency adjustment.
[0083] Second level: adjust the 3-low priority message period, the adjustment formula is:
[0084] ;
[0085] Where T new(3) is the 3-low message sending period after frequency reduction, T current(3) is the current 3-low message sending period, ω3 is the 3-low message frequency adjustment coefficient, Load current is the current real-time load rate, Load HH_LL is the lower limit of the high load area (HH) load rate, Load HH_UL is the upper limit of the high load area load rate (100%), and the expression (Load-Load HH_LL ) / (Load HH_UL -Load HH_LL ) is the normalized load deviation ratio factor, which normalizes the network load rate from the excess part of the high load area to the [0,1] interval, and then multiplies the frequency adjustment coefficient to calculate the frequency reduction ratio. At the same time, it is necessary to ensure that the 3-low message period after frequency reduction is not higher than its maximum period T max(3) . When the 3-low priority message period T new(3) is adjusted to its maximum period T max(3) , the second frequency adjustment ends, and if the load rate is still > 70% at the end, proceed to the third frequency adjustment.
[0086] Third level: adjust the 2-medium priority message period, the frequency adjustment formula is:
[0087] ;
[0088] Where T new(2) is the 2-medium message sending period after frequency reduction, T current(2)is the current 2-level packet sending period, ω2 is the 2-level packet frequency modulation coefficient, and the remaining parameters are as explained above. When the 2-level priority packet period T new(2) reaches its maximum period T max(2) , 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.
[0089] Fourth level (forced protection): The periods of priority 1-4 level packets are locked at the corresponding maximum periods T max : After triggering the fourth level of forced protection measures, a system level alarm is reported at the same time to prompt manual intervention to troubleshoot the root cause.
[0090] High load area exit condition: After frequency reduction, the calculated load rate < 65% (5% hysteresis margin), after exiting, enter the corresponding interval according to the current load rate.
[0091] S5, determine whether the load rate is greater than b, if so, determine that it is the second high load area, and perform preventive frequency reduction, if not, perform S6;
[0092] The preventive frequency reduction includes the following steps: sequentially reducing the low priority packets and the lowest priority packets until the maximum period of the corresponding priority packet is reached, and after each frequency reduction, determining whether the load rate is less than f, if so, downgrading to the safe area, if not, determining whether the load rate is greater than a, if so, upgrading to the high load area, if not, continuing to sequentially reduce the low priority packets and the lowest priority packets, f = b - g, and g is the second hysteresis margin, wherein f = 45%, and g = 5%.
[0093] Second high load area (H, Load ∈ 50%-70%): In the second high load area (H), the low priority traffic is actively optimized, and only the low priority packets and the lowest priority packets are reduced by a limited amplitude, which can prevent potential congestion risks and avoid the system entering a high load or even a down state due to sudden traffic, and also maximizes the bandwidth reserved for important packets. The second high load area triggering condition: the single detection load rate enters the range of 50%-70% (allowing rapid response to potential risks). The second high load area frequency reduction strategy: preventive frequency reduction, and the specific implementation steps are as follows: the priority 2 and above packets do not participate in frequency modulation, and only the priority 3-low priority and 4-lowest priority packets are adjusted, and the frequency modulation formula is:
[0094] ;
[0095] Wherein, T new(i) is the priority i-level packet sending period after frequency reduction, T current(i) is the current priority i-level packet sending period, ω i is the priority i-level packet frequency modulation coefficient, Load current is the current real-time load rate, and LoadH_LL Load H_UL is the lower limit of the load rate of the second highest load area, expression (Load H_LL ) / (Load H_UL -Load H_LL ) is a normalized load deviation scale factor, which normalizes the network load rate exceeding the second highest load area to the interval [0, 1], and then multiplies the frequency modulation coefficient to calculate the frequency reduction ratio, while ensuring that the i-level message period after frequency reduction is not higher than the maximum period T max(i) .
[0096] Second highest load area exit condition: measured load rate after frequency reduction < 45%, downgraded to the safety area (5% hysteresis margin); measured load rate > 70%, upgraded to the high load area.
[0097] S6, determine whether the load rate is greater than c, where a > b > c, if yes, determine that the safety area does not modulate the frequency, if not, determine that the low load area is frequency graded.
[0098] Reference Figure 3 , the low load area frequency grading specifically includes the following steps:
[0099] S61, frequency up of the messages of the second highest priority, medium priority and low priority, and calculation of the target period after single frequency up;
[0100] S62, calculation of the theoretical load increment after frequency up of each priority message;
[0101] S63, calculation of the maximum allowed load rate increment;
[0102] S64, calculation of the predicted load rate after frequency up;
[0103] S65, dynamic constraint of frequency up amplitude: determine whether the predicted load rate after frequency up is less than or equal to the constraint threshold, if yes, proceed to S66, if not, reduce the frequency up amplitude in proportion to ensure that the theoretical load rate increment after frequency up does not exceed the maximum allowed load rate increment, and then proceed to S66;
[0104] S66, frequency up step by step from high to low according to the message priority, detect the load rate after each frequency up, if the load rate after frequency up is greater than h, h = b-j, j is the third hysteresis margin, where h = 45%, j = 5%, then immediately back to the current frequency up adjustment; if the load rate after frequency up is greater than or equal to k, where k = 35%, then stop frequency up; if the load rate after frequency up is less than k, then execute the frequency up of the next priority;
[0105] S67, after a complete frequency up of each priority message, if the load rate after frequency up is less than k, repeat S61 to S66, otherwise, stop frequency up and enter the safety area.
[0106] The process of each priority frequency increase is as follows:
[0107] Calculate the normalized load deviation scale factor of the current load partition: obtain the allowed load rate upper limit and real-time load rate after frequency increase of the current load partition, and the normalized load deviation scale factor = (allowed load rate upper limit - real-time load rate) / allowed load rate upper limit;
[0108] Calculate the frequency increase weight = 1 - (1 - frequency adjustment parameter of the current priority message) x normalized load deviation scale factor of the current load partition;
[0109] The sending period of the current priority message after frequency increase = current sending period of the current priority message x frequency increase weight.
[0110] Safety zone (S, Load ∈ 20%~50%): In the safety zone (load rate 20%~50%), the network is in a stable running state, and the bandwidth utilization and data real-time performance are balanced. The system maintains the current message period and does not trigger any frequency adjustment operation, and focuses on state monitoring and trend prediction to provide buffer space for potential load fluctuations. Safety zone trigger condition: load rate enters the range of 20%~50%. Safety zone without frequency adjustment operation: all messages are sent according to the current period; safety zone exit condition: 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 (5% hysteresis margin).
[0111] Low load zone (L, Load < 20%): In the low load state of the CAN network (load rate < 20%), the fixed message period will cause insufficient bandwidth utilization and decreased data real-time performance. The frequency increase strategy can improve the freshness of data and optimize bandwidth utilization by dynamically shortening the period of some 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 (S), it is necessary to dynamically predict the load change and limit the frequency increase amplitude during the frequency adjustment process. Low load zone trigger condition: load rate < 20% for 3 times in a row to avoid false triggering due to temporary idleness; low load zone frequency increase strategy: dynamic prediction, hierarchical frequency increase.
[0112] The following are the specific implementation steps:
[0113] S61: Increase the frequency of 1, 2, and 3 priority messages, calculate the target period after single frequency increase, and the calculation formula is:
[0114] ;
[0115] 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, and ω iLoad S_MID is the upper limit of the allowed load rate after frequency conversion, and the median point of the load rate in the safety zone (a / 2=35%) 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 period of the message after frequency conversion is not less than its minimum period T min(i) . 4- The lowest priority message does not participate in frequency conversion, and the original period is maintained.
[0116] S62: Introduce a frequency conversion amplitude prediction model to calculate the theoretical load increment ΔLoad of each priority message after frequency conversion:
[0117] ;
[0118] where BitsPerFrame i is the single frame bit number of priority i-level message, ΣBitsPerFramei represents the total bit number of all i-level priority messages, T new(i) is the period of priority i-level message after frequency conversion, T current(i) is the current period of priority i-level message, BitRate is the CAN bus baud rate, and TimeWindow is the load statistical window (unit s).
[0119] S63: Calculate the maximum allowed load rate increment ΔLoad max :
[0120] ;
[0121] where ΔLoad max is the maximum allowed load rate increment, Load S_MID is the upper limit of the allowed load rate after frequency conversion, and the median point of the load rate in the safety zone (35%) is selected as its value, Load current is the current real-time load rate.
[0122] S64: Calculate the predicted load rate Load predict after frequency conversion:
[0123] ;
[0124] where Load predict is the predicted load rate after frequency conversion, Load current is the current load rate, and ΔLoad is the theoretical load increment calculated in step S2.
[0125] S65: Dynamic constraint of frequency conversion amplitude, if Load predict ≤ constraint threshold, constraint threshold=35%, frequency conversion is allowed according to the formula of S1; if Load predict> 35%, the frequency increasing amplitude needs to be reduced in proportion, and the message period after the reduction of the frequency increasing amplitude meets:
[0126] ;
[0127] wherein, T new(i) is the frequency increasing target period of the priority i level message calculated in the step S1, T cut(i) is the sending period of the priority i level message after the reduction of the frequency increasing amplitude, and T current(i) is the original period of the priority i level message.
[0128] ;
[0129] The calculation formula of the reduction proportion factor is:
[0130] ;
[0131] wherein, K cut(i) is the frequency increasing amplitude reduction proportion factor of the priority i level message, and ω i is the frequency modulation coefficient of the priority i level message, and the formula ensures that the theoretical load increment after the reduction of the frequency increasing amplitude does not exceed ΔLoad max .
[0132] The calculation formula of the message period after the reduction of the frequency increasing amplitude is:
[0133] ;
[0134] wherein, T cut(i) is the sending period of the priority i level message after the reduction of the frequency increasing amplitude, T current(i) is the current period of the priority i level message, and T new(i) is the frequency increasing target period of the priority i level message calculated in the step S1.
[0135] S66: The messages are increased in frequency level by level according to the message priority from high to low, and the load rate is detected in real time after each frequency increasing. If the load rate after the frequency increasing > 45%, the hysteresis allowance of 5% is buffered to prevent the instantaneous exceeding of the upper limit of the safety zone, the current frequency increasing adjustment is immediately returned; if the load rate after the frequency increasing ≥ 35%, the frequency increasing is stopped; if the load rate after the frequency increasing < 35%, the next level of frequency increasing is executed.
[0136] S67: After the complete frequency increasing of each priority message is completed, if the load rate is still < 35%, the steps S61-S66 are repeated. The low load zone exit condition: the load rate after the frequency increasing ≥ 35%, the frequency increasing is stopped and the safety zone is entered.
[0137] The application discloses a CAN bus message period adjustment system based on dynamic load balancing, adopts a CAN bus message period adjustment method based on dynamic load balancing, and refers to Figure 4 , and comprises the following:
[0138] A network load real-time detection module is responsible for collecting and analyzing the communication state of the CAN bus in real time, quantifying 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.
[0139] A main controller is electrically connected with the network load real-time detection module, the message period dynamic adjustment module and the message period adjustment execution module.
[0140] The message period dynamic adjustment module performs priority level division and parameter configuration on the message, defines the network load by size and error count, formulates a frequency adjustment strategy according to the real-time data provided by the network load detection module, and dynamically adjusts the sending period of the message through an algorithm.
[0141] The message period adjustment execution module transmits the frequency adjustment result output by the message period dynamic adjustment module to each slave node, supervises the execution state, adds a feedback mechanism to realize closed-loop control, and specifically comprises an instruction packaging and broadcasting unit, an instruction analysis and execution unit and an execution state monitoring and feedback unit.
[0142] The message period adjustment execution module safely and reliably transmits the frequency adjustment result output by the dynamic adjustment module to each slave node, supervises the execution state, ensures the synchronization of the whole CAN network strategy, adds a feedback mechanism to realize closed-loop control, and avoids the deviation between the expected result and the actual execution. The following is the specific composition and implementation method of the module, which specifically comprises the following:
[0143] The instruction packaging and broadcasting unit is based on a self-defined protocol, the main control encapsulates and packages the frequency adjustment result of the dynamic adjustment module, and sends the result to each slave node in the network, as shown in Table 3, and the instruction format of the frequency adjustment message is as follows:
[0144] [Instruction type] [Target node address] [Target message type] [New period value] [Effective time offset] [CRC8];
[0145] Table 3 Frequency adjustment instruction format table
[0146] Content Length Explanation Instruction Type 1 Byte 0x01 = Cycle Adjustment 0x02 = Priority Switch 0x03 = Restore Default Target Node Address 1 Byte Unique Identification of Target Node, Avoid Instruction Mis-reception; Support Broadcast Mode, Adjust All Nodes at the Same Time. Target Message Type 1 Byte Specify Specific Message Type in Target Node to be Adjusted New Cycle Value 2 Bytes New Sending Cycle of Target Message, Unit: ms Effective Time Offset 2 Bytes Indicate Delayed Effective Time from Instruction Reception Time, Unit: ms, 0 = Immediate Effect CRC8 1 Byte Verify the first 7 bytes of frequency modulation instruction data
[0147] Instruction analysis and execution unit: each slave node in the network is responsible for receiving and checking the frequency adjustment instruction, and updating the local message sending period according to the instruction content to ensure the accuracy and timeliness of the adjustment action.
[0148] (1) Instruction receiving and filtering: the slave node listens to the CAN bus and captures the message with the ID of the frequency adjustment instruction. Check the target node address field in the instruction. If it is a broadcast address, all nodes process the instruction; if it is a single-point address, only the matching node processes it.
[0149] (2) Data verification: the slave node calculates the CRC8 value of the first 7 bytes of the frequency adjustment instruction frame and compares it with the last byte of the instruction. If they do not match, the instruction is discarded.
[0150] (3) Message matching and parameter checking: the slave node queries the local frequency-adjustable message whitelist (preconfigured or dynamically registered) according to the target message type, and verifies whether the new period value of the instruction is within the range of Tmin / Tmax. If it is out of range, it is automatically clamped to the boundary value.
[0151] (4) Execute frequency adjustment: if the effective time offset is 0, immediately switch to the new period; if the effective time offset is greater than 0, start a timer and set the timer value to the effective time offset. After the timer expires, switch to the new period.
[0152] (5) Abnormal handling: if the target message type does not exist, record error logs and reply negative response (NACK); if frequency adjustment fails for 3 consecutive times, switch to safe mode (send with fixed period).
[0153] Execution state monitoring and feedback unit: the master controller tracks the instruction execution results in real time, forms a closed-loop control through the feedback mechanism, and ensures the consistency and reliability of the network frequency adjustment strategy.
[0154] (1) Feedback protocol design: 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 successful state and the actual effective period value are fed back. If the frequency adjustment fails, the reason for the failure is fed back. Refer to Table 4 for the ACK / NACK frame format:
[0155] [Original instruction type] [execution status] [current period value] [CRC8];
[0156] Table 4 ACK / NACK frame format
[0157] Content Length Explanation Original Instruction Type 1 Byte Consistent with Received Instruction Execution Status 1 Byte 0x00 = Success, 0x01 = Invalid Message Type, 0x02 = Cycle Out of Bounds, 0x03 = CRC Error Effective Cycle Value 2 Bytes Actual Effective Cycle CRC8 1 Byte Verify the first 4 bytes of data
[0158] (2) Monitoring and closed-loop control strategy: the master controller monitors the feedback state of the slave node in real time. If a NACK is received, a frequency adjustment instruction is generated again (such as changing the message type) and re-sent. If the slave node does not feedback within a certain time, the slave node is marked as "offline" and an alarm is triggered.
[0159] According to the feedback state of each node, the master controls the instruction delivery rate and the execution success rate, and monitors the health state of the node. In addition, the master node stores the frequency modulation instruction and feedback data into the local history log, which can support fault backtracking.
[0160] 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 from a global perspective. The independent hardware node is deployed for load analysis, and broadcasts the global load state and provides load prediction suggestions to the master through a custom protocol to assist the master node in decision-making. When the master fails, the cooperative monitoring node can temporarily take over the load adjustment task. Embodiment 2
[0161] This embodiment details the specific implementation method of the application in the battery management system (BMS) master-slave architecture based on embodiment 1.
[0162] In this embodiment, the BMS system is composed of 1 master controller (Master) and N=10 slave controllers (Slave). The slave controller is responsible for collecting battery cell voltage, temperature and other data, and periodically reporting to the master controller through the CAN bus. The master controller monitors the CAN bus load in real time, dynamically adjusts the slave controller message sending period, and realizes network load balancing. The hardware configuration of this embodiment is as follows:
[0163] The master controller (Master) hardware core chip uses NXP S32K14x series (integrated CAN FD controller, supports dual-channel CAN bus, main frequency 120MHz); the CAN transceiver uses TJA1043 (supports CAN FD, maximum transmission rate 5Mbps); the auxiliary module adds external SRAM (1MB) for storing historical load data and adjusting strategy parameters.
[0164] The slave controller (Slave) hardware core chip uses STMicroelectronics STM32G473 (integrated CAN2.0B controller, main frequency 170MHz); the battery sampling circuit: LTC6813-1 (supports 12-channel voltage / temperature acquisition, SPI interface communication with MCU); CAN transceiver: TJA1050 (standard CAN transceiver, rate 1Mbps). The CAN network topology uses linear topology, the terminal resistance is 120Ω, and the baud rate is set to 500kbps (standard frame format).
[0165] The software implementation of this embodiment is as follows: for different types of CAN messages in the communication process of the BMS master-slave controller, the priority level, CAN ID range, minimum period T min , maximum period Tmax The value of the frequency modulation coefficient ω parameter is referred to Table 5.
[0166] Table 5. Priority level, CAN ID range and frequency modulation period range
[0167] Priority Level CAN ID Range minimum period (T min )]]> maximum period (T max )]]> Frequency Modulation Coefficient ω Application Message Example 0 - Highest Priority 0x000 ~ 0x0FF 20 ms 20 ms - Emergency Fault Alarm 1 - High Priority 0x100 ~ 0x1FF 20 ms 100 ms 0.1 Real-time Control Instruction 2 - Medium Priority 0x200 ~ 0x3FF 100 ms 500 ms 0.4 Battery Parameter Information 3 - Low Priority 0x400 ~ 0x5FF 500 ms 1000 ms 0.8 Historical Data Log 4 - Lowest Priority 0x600 ~ 0x7FF 1000 ms ∞ 1.0 Debugging Print Information
[0168] In this embodiment, the parameters of each level are specifically described by taking a certain BMS application message as an example. For example, the emergency fault alarm (ID=0x0**, where ** is the slave address, ranging from 0x01 to 0x0A) is set as the 0-highest priority level message, and the period is fixed at 20 ms, which is not allowed to be frequency modulated.
[0169] The real-time control instruction (ID=0x1**) is set as the 1-high priority level message, the period T=50 ms, the frequency modulation range is [20 ms, 100 ms], the frequency modulation coefficient is set to 0.1, and the frequency modulation step is limited to be small.
[0170] The battery parameter information (such as battery voltage information, ID=0x2**) is set as the 2-medium priority level message, the period T=200 ms, the frequency modulation range is [100 ms, 500 ms], and the frequency modulation coefficient is set to 0.4.
[0171] The historical data log information (ID=0x5**) is set as the 3-low priority level message, the period T=500 ms, the frequency modulation range is [500 ms, 1000 ms], and the frequency modulation coefficient is set to 0.8, so that a large frequency modulation step can be obtained.
[0172] The mode printing information (ID=0x7**) is set as the 4-lowest priority level message, the period T=1000 ms, the frequency modulation range is [1000 ms, ∞), the maximum period T max =∞ represents stop sending, and the frequency modulation coefficient is set to 1.0, so that a maximum frequency modulation step can be obtained.
[0173] Then, the network load is divided into four intervals according to the load rate and the error rate: high load area (load rate higher than 70% / error count increment over limit), secondary high load area (load rate between 50% and 70%), safe area (load rate between 20% and 50%), and low load area (load rate lower than 20%). Corresponding frequency modulation strategies are developed for each load area. The load partition definition is shown in Table 2.
[0174] After the priority level parameters of all BMS messages are predefined and the load partition is defined, the partition frequency modulation strategy is executed according to the load rate and error count calculated by the network load real-time detection module.
[0175] As a scene of the embodiment of the present application, the network load module calculates and outputs a load rate of 80%, 80%>70%, which belongs to the high load area (HH), triggers the step-down frequency reduction strategy of the high load area, and the specific frequency adjustment process is as follows:
[0176] First level: directly suspend the sending of 4-lowest priority level packets, and immediately release the bandwidth. The network module recalculates the load rate to 78%, which is still higher than the lower limit 70% of the high load area, so it enters the second level of frequency adjustment;
[0177] Second level: adjust the 3-low priority level packet period.
[0178] In this embodiment, taking the historical data log information (ID=0x5**) as an example, its initial period T current(3) =700ms, and the frequency adjustment formula is:
[0179]
[0180] According to the above formula, the new period of the historical data log information packet after the first frequency adjustment is:
[0181]
[0182] The new packet period after the first frequency adjustment is adjusted to 850ms, and the load rate obtained by the network load real-time detection module is reduced to 75%, which does not meet the high load area exit condition, and the frequency adjustment of the packet continues:
[0183]
[0184] The new packet period after the second frequency adjustment is adjusted to 825ms, and the load rate is recalculated to 73%>65%, and the frequency adjustment of the packet continues:
[0185]
[0186] After 3 frequency adjustments, the period of the historical data log information packet reaches the maximum value 1000ms of the 3-low priority level packet period, and the load rate is 72% at this time, which still does not meet the high load area exit condition, so it enters the third level of frequency adjustment.
[0187] Third level: adjust the 2-medium priority level packet period.
[0188] In this embodiment, taking the battery parameter information (ID=0x2**) as an example, its initial period T current(2) =400ms, and the frequency adjustment formula is:
[0189]
[0190] The new cycle and corresponding real-time load rate of the battery parameter information message after each frequency adjustment are calculated according to the above formula as follows:
[0191] Load current =72%;
[0192] Load current =72%;
[0193] ...
[0194] Load current =71%;
[0195] Load current =71%;
[0196] After 10 frequency adjustments, the battery parameter information message period reached the maximum value of 500ms for the 2-medium priority level message period. At this time, the calculated load rate was 71% > 70%, which still did not meet the exit condition for the high load area. Therefore, it entered the fourth level of frequency adjustment.
[0197] Level 4 (Mandatory Protection): Locks the message period of priority levels 1 to 4 to the corresponding maximum period T. max :
[0198] ;
[0199] In this embodiment, the message period of the real-time control command (priority 1) is forcibly locked. Battery parameter information (priority 2) message cycle Historical data log message cycle (priority 3) The message cycle of debug print information (priority 4) .
[0200] After the fourth level of frequency adjustment, the load rate calculated by the real-time network load monitoring module dropped to 65%, successfully exiting the high-load zone. Furthermore, after triggering the fourth level of mandatory protection measures, the main controller simultaneously reported a system-level alarm, prompting manual intervention to investigate the root cause of the fault.
[0201] The above embodiments illustrate the specific frequency reduction strategy when the initial network load rate is in the high load zone. As another specific implementation scenario of the present invention, the load rate calculated and output by the network load module is 15%. 15% < 20%, which belongs to the low load zone (L), triggering the frequency increase strategy in the low load zone. The specific frequency adjustment process is as follows:
[0202] S1: The priority messages of 1, 2, and 3 are upgraded in frequency, and the target period after single frequency upgrade is calculated according to the following formula:
[0203] ;
[0204] In this embodiment, the single frequency upgrade target period of real-time control instructions (1-high priority), battery parameter information (2-medium priority), and historical data logs (3-low priority) is calculated respectively as:
[0205] ;
[0206] ;
[0207] ;
[0208] S2: Introduce a frequency upgrade amplitude prediction model to calculate the theoretical load increment ΔLoad of each priority message after frequency upgrade calc :
[0209] ;
[0210] In this embodiment, the BMS message is a standard frame of 8-byte data segment, so the single frame bit number BitsPerFrame i =108. According to the message level division and parameter definition table and the number of controlled units, the total bit number of priority i-level message can be calculated in sequence. The CAN bus baud rate BitRate=250Kbps, and the load statistical window is set to 1s. The specific parameters are substituted into the frequency upgrade amplitude prediction model to calculate the theoretical load increment ΔLoad calc =21%.
[0211] S3: Calculate the maximum allowed load rate increment ΔLoad max :
[0212] ;
[0213] S4: Calculate the predicted load rate Load predict and the maximum allowed load rate increment ΔLoad max :
[0214] ;
[0215] S5: Dynamic constraint of frequency upgrade amplitude. Since Load predict >Load S_MID (35%), the frequency upgrade amplitude needs to be reduced in proportion. Taking the real-time control instruction (ID=0x100) as an example, the reduction ratio factor is calculated as:
[0216] ;
[0217] The packet period after reducing the frequency increase amplitude is calculated:
[0218] ;
[0219] It can be seen that the period after reducing the frequency increase amplitude meets the condition of , and T cut(2) = 173 ms and T cut(3) = 500 ms can be calculated in the same way.
[0220] S6: The frequency is increased step by step according to the packet priority from high to low, and the load rate is detected in real time after each frequency increase. In this embodiment, the frequency increase of the real-time control instruction (1-high priority) packet is performed first, and the load rate increases to 18%<35% after the frequency increase. Then the frequency increase of the battery parameter information (2-medium priority) packet is performed, and the load rate increases to 21<35% after the frequency increase. Then the frequency increase of the historical data log (3-low priority) packet is performed. Since the original period of the historical data log packet is already the minimum period of the 3-low priority packet, i.e., T current(3) =T min(3) , the frequency increase is not performed, and the load rate is maintained at 21% after the last frequency increase.
[0221] S7: After completing a complete frequency increase, the load rate is measured to be 21%, which is still less than 35%, so the steps S1-S6 are repeated until the load rate does not meet the frequency increase condition.
[0222] The specific implementation of the above frequency adjustment strategy needs to be realized through a packet period adjustment execution module. The packet period adjustment execution module safely and reliably transmits the frequency adjustment result output by the dynamic adjustment module to each slave node, supervises the execution state, and ensures the synchronization of the entire CAN network strategy. At the same time, a feedback mechanism is added to realize closed-loop control, avoiding the deviation between the expected result and the actual execution.
[0223] The frequency reduction operation of the battery parameter information packet in the above scenario one is taken as an example for specific description:
[0224] It is known that the initial period T current(2) = 400 ms of the battery parameter information (ID=0x2**) packet, and the expected period T new(2) = 410 ms after the first frequency reduction calculation, so the master controller needs to adjust the battery parameter information packet period of all slaves (0x01~0x0A) to 410 ms.
[0225] S1: Instruction encapsulation. The master controller encapsulates and packages the frequency adjustment result of the dynamic adjustment module, and sends it to each slave node of the network. The encapsulated frequency adjustment instruction is as follows:
[0226]
[01] [FF]
[01] [019A]
[0000] [0E];
[0227] Wherein: instruction type = 0x01, representing period adjustment; target node address = 0xFF, broadcast mode, representing simultaneous adjustment of all slaves (0x01~0x0A) of the bus; target message type = 0x01, 0x01 representing battery parameter information type message in this example; new period value = 0x019A = 410 ms; effective time offset = 0x0000, indicating immediate effectiveness after receiving the instruction, no delay; CRC8 = 0x0E, 7 bytes before verification.
[0228] S2: slave node receives instruction and executes. The slave listens and captures the broadcast frequency adjustment instruction, calculates the CRC8 value of the first 7 bytes of the frequency adjustment instruction, and successfully matches the last byte 0x0E of the instruction. Confirm that the target message type 0x01 exists in the local frequency-adjustable message whitelist, and that the new period 410 ms is within the (Tmin, Tmax) range of the message. Update the period of the battery parameter information message to 410 ms. Since the effective time offset = 0, immediately execute the frequency reduction and switch to the new period value.
[0229] S3: execute state monitoring and feedback. The slave node feeds back the instruction execution result to the master controller node, and the returned ACK frame is as follows:
[0230] [0x01][0x00][019A][CC];
[0231] Wherein: original instruction type = 0x01, consistent with the received instruction, representing period adjustment; execution status = 0x00, representing successful frequency adjustment; current period value, 0x019A = 410 ms; CRC8 = 0xCC, 4 bytes before verification.
[0232] The master controller monitors the feedback state of the slave node in real time, and calculates the instruction delivery rate and execution success rate, and monitors the node health status. In addition, the master controller stores the frequency adjustment instruction and feedback data into the local historical log, which can support fault backtracking.
[0233] The above are preferred embodiments of the present application, and are not intended to limit the protection scope of the present application, therefore: any equivalent changes made according to the structure, shape, principle of the present application shall be covered within the protection scope of the present application.
Claims
1. A method for adjusting the CAN bus message period based on dynamic load balancing, characterized in that, Includes the following steps: S1, divides CAN message levels into several categories based on the CAN ID range; The CAN message levels, from highest to lowest, are: highest priority, second highest priority, medium priority, low priority, and lowest priority. S2, set the adjustment period range and frequency modulation parameters for each CAN message level. The period of the highest priority message is fixed. The adjustment period range of the second highest priority, medium priority, low priority and lowest priority includes the minimum period and the maximum period. The frequency modulation parameters of each CAN message level gradually increase from high to low according to the priority level. S3 defines network load partitions based on load rate and error count, and sets frequency adjustment measures for each partition; S4: Obtain real-time load rate and error count, and determine whether the error count increment exceeds the limit or the load rate is greater than a. If so, identify it as a high load area and reduce the frequency step by step according to the CAN message level from high to low. If not, proceed to S5. The step-by-step frequency reduction based on CAN message level from high to low specifically includes the following steps: Level 1: Directly suspend the transmission of the lowest priority level messages. If the load rate is still greater than 'a', proceed to Level 2 adjustment; otherwise, exit the adjustment process. Level 2: Adjust the low-priority message period according to the frequency modulation parameters until the upper limit of the low-priority message period is reached. If the load rate is still greater than a, proceed to Level 3 adjustment; otherwise, exit the adjustment. Level 3: Adjust the medium-priority message period according to the frequency modulation parameters until the upper limit of the medium-priority message period is reached. If the load rate is still greater than a, proceed to Level 4 adjustment; otherwise, exit the adjustment. Level 4: The message periods of all priorities except the highest priority are locked at their corresponding maximum periods. If the load rate is less than d, the adjustment is exited; otherwise, Level 4 adjustment continues, where d = ae and e is the first hysteresis margin. S5, determine if the load rate is greater than b. If yes, identify it as the second highest load area and perform preventative frequency reduction. If not, proceed to S6. S6, determine whether the load rate is greater than c, where a>b>c. If yes, it is considered a safe zone and no frequency adjustment is performed; otherwise, it is considered a low load zone and the frequency is increased in stages. The frequency reduction process for each priority level is as follows: Calculate the normalized load deviation ratio factor for the load partition: obtain the lower limit of the load rate, the upper limit of the load rate, and the real-time load rate of the load partition. Normalized load deviation ratio factor = (real-time load rate - lower limit of load rate) / (upper limit of load rate - lower limit of load rate). Calculate the frequency reduction weight = 1 + the frequency modulation parameter of the priority message × the normalized load deviation ratio factor of the load partition. The transmission cycle of the priority message after frequency reduction = the transmission cycle of the current priority message × the frequency reduction weight.
2. The method for adjusting the CAN bus message period based on dynamic load balancing according to claim 1, characterized in that, The method of defining network load partitioning based on load rate and error count includes the following steps: a load rate higher than a or an error count increment exceeding the limit is defined as a high load zone; a load rate between a and b is defined as a second-highest load zone; a load rate between b and c is defined as a safe zone; and a load rate lower than c is defined as a low load zone.
3. The method for adjusting the CAN bus message period based on dynamic load balancing according to claim 1, characterized in that, The fourth level also includes the following steps: reporting system-level alarms and prompting investigation of the root cause of the fault.
4. The method for adjusting the CAN bus message period based on dynamic load balancing according to claim 1, characterized in that, The preventive frequency reduction includes the following steps: successively reducing the frequency of low-priority and lowest-priority packets until it reaches the maximum period of the corresponding priority packets. After each frequency reduction, it is determined whether the load rate is less than f. If so, it is downgraded to the safe zone. If not, it is determined whether the load rate is greater than a. If so, it is upgraded to the high-load zone. If not, it continues to successively reduce the frequency of low-priority and lowest-priority packets. f=bg, where g is the second hysteresis margin.
5. The method for adjusting the CAN bus message period based on dynamic load balancing according to claim 1, characterized in that, The graded frequency upsampling in the low-load region specifically includes the following steps: 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; S62, calculate the theoretical load increment after each priority message is frequency-upgraded; S63, calculate the maximum allowable load rate increment; S64, calculates the predicted load rate after frequency upsampling; 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. S66, according to the message priority from high to low, the frequency is increased step by step. After each frequency increase, the load rate is checked. If the load rate after the frequency increase is greater than h, h=bj, j is the third hysteresis margin, then the frequency increase adjustment of this round is immediately rolled back; if the load rate after the frequency increase is greater than or equal to k, then the frequency increase is stopped; if the load rate after the frequency increase is less than k, then the frequency increase of the next priority is executed. 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.
6. A method for adjusting the CAN bus message period based on dynamic load balancing according to any one of claims 3-5, characterized in that, The process of frequency increase for each priority level is as follows: Calculate the normalized load deviation ratio factor for the load partition: obtain the upper limit of the allowed load rate and the real-time load rate after frequency boosting for the load partition. Normalized load deviation ratio factor = (upper limit of allowed load rate - real-time load rate) / upper limit of allowed load rate. Calculate the upsampling weight = 1 - (1 - frequency modulation parameter of the priority message) × normalized load deviation ratio factor of the load partition. The transmission cycle of the priority message after frequency increase = the transmission cycle of the current priority message × the frequency increase weight.
7. A CAN bus message period adjustment system based on dynamic load balancing, employing the CAN bus message period adjustment method based on dynamic load balancing as described in claim 1, characterized in that, include: The real-time network load detection module is responsible for collecting and analyzing the communication status of the CAN bus in real time and quantifying the network load level. Specifically, it includes a bus load rate calculation unit for calculating the bus load rate within a unit time window, an error status monitoring unit for calculating the error count increment within a unit time, and a frame density statistics unit for counting the number of frames received within a unit time. The message cycle dynamic adjustment module prioritizes and configures parameters for messages, defines network load partitions based on load rate and error count, formulates partition frequency adjustment strategies based on real-time data provided by the network load detection module, and dynamically adjusts the message sending cycle through algorithms. The message cycle adjustment execution module transmits the frequency modulation result output by the message cycle dynamic adjustment module to each slave node, monitors the execution status, and incorporates a feedback mechanism to achieve closed-loop control. Specifically, it includes an instruction encapsulation and broadcasting unit, an instruction parsing and execution unit, and an execution status monitoring and feedback unit. The main controller is electrically connected to the network load real-time detection module, the message cycle dynamic adjustment module, and the message cycle adjustment execution module.
Citation Information
Patent Citations
Engineering machinery and network optimization method and device thereof
CN112769714A