CAN message priority dynamic arbitration method and system based on event triggering

By dynamically adjusting the priority of CAN messages through event triggering and token bucket mechanism, the problem of untimely transmission of critical messages in CAN bus under high load and interference environment is solved, realizing timely transmission of critical messages under high load and improving system stability, adapting to multiple working conditions.

CN121727889APending Publication Date: 2026-03-24JIANGSU ADVANCED CONSTR MASCH INNOVATION CENT LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511946684.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing CAN bus communication technology struggles to ensure timely transmission of critical messages under high load and severe electromagnetic interference environments, leading to increased latency, decreased system stability, and an inability to meet the millisecond-level response time requirements for safety-critical messages. Furthermore, the existing AUTOSAR architecture fails to provide a solution for dynamically adjusting message priority and bandwidth allocation.

Method used

An event-triggered dynamic arbitration method for CAN message priorities is adopted. By acquiring discrete sampling signals and status register values ​​of the CAN nodes of engineering vehicles, message data records with event semantics and dynamic priority labels are constructed. Combined with a three-state machine and token bucket mechanism, the priority queue and bandwidth allocation are dynamically adjusted to ensure the timely transmission of critical messages.

Benefits of technology

In high-load and interference environments, it ensures the timely transmission of safety-critical messages, reduces latency jitter, improves system stability and bandwidth utilization, is compatible with AUTOSAR systems, and supports rapid adaptation to multiple operating conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121727889A_ABST
    Figure CN121727889A_ABST
Patent Text Reader

Abstract

The invention discloses a CAN message priority dynamic arbitration method and system based on event triggering, and the method comprises the steps: obtaining a discrete sampling signal of a CAN node of an engineering vehicle and a state register value of a CAN controller, converting the discrete sampling signal into a working condition data sequence, and obtaining a bus load rate through the state register value; obtaining an event state sequence according to the working condition data sequence; all CAN messages to be sent are constructed into a message data record, and the message data record with event semantics and dynamic priority labels is obtained according to the protocol data unit and the event state sequence; and according to the bus load rate and the event state sequence, sending a message data record with event semantics and dynamic priority annotations by adopting a token bucket mechanism through a three-level priority queue linked with a three-state state machine. According to the invention, the security key message in the system can still be transmitted in time under high load, and the bandwidth occupation and delay jitter caused by the low-priority message are avoided at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a dynamic arbitration method and system for CAN message priority based on event triggering, belonging to the field of communication scheduling technology. Background Technology

[0002] With the widespread adoption of electronic control systems (ECUs) and CAN bus technology, the electrification and intelligentization of construction machinery vehicles are gradually advancing. The data communication network in control systems is expanding from a single control system to a multi-system network. Currently, most construction machinery control systems rely on the ISO 11898 standard CAN bus or CAN FD bus for communication. These control systems typically consist of dozens of ECUs, with complex topologies, numerous nodes, and long wiring harnesses, usually ranging from 30 to 50 meters. Due to the long wiring harnesses, complex circuits, and electromagnetic interference (EMI), the system faces problems such as increased bit error rate and increased message retransmission. Under high load or busy communication scenarios (e.g., bus utilization ≥70%), current CAN bus scheduling methods often cannot ensure the timely transmission of critical messages, leading to increased latency, decreased system stability, and impacting control accuracy and safety.

[0003] Currently, existing CAN bus communication technologies, especially in the control systems of engineering machinery, employ static ID arbitration and fixed-period transmission for message scheduling. While these technologies can ensure a certain level of communication stability, they struggle to dynamically adjust bandwidth and priority under high load conditions. Furthermore, the latency and jitter of control messages are not effectively controlled, failing to meet the millisecond-level response time requirements of some safety-critical messages (such as braking, hydraulic depressurization, and attitude monitoring).

[0004] Furthermore, AUTOSAR (Automotive Open System Architecture) provides a standardized software architecture widely used in vehicle electronic control systems. The PduR (Protocol Data Unit Router) and CanIf (CAN Interface) layers in AUTOSAR are used to manage and route CAN data packets. However, the current AUTOSAR architecture does not consider dynamically adjusting packet priority and bandwidth allocation under high load and frequent events, nor does it provide an event-triggered scheduling mechanism.

[0005] Therefore, the technical problem that urgently needs to be solved by those skilled in the art is how to provide an event-triggered dynamic priority scheduling mechanism that can ensure the latency and stability of critical messages and improve the bandwidth utilization of the system under high load and severe interference conditions. Summary of the Invention

[0006] Objective: To overcome the shortcomings of existing technologies, this invention provides a dynamic arbitration method and system for CAN message priority based on event triggering.

[0007] Technical solution: To solve the above technical problems, the technical solution adopted by the present invention is as follows:

[0008] Firstly, a dynamic arbitration method for CAN message priority based on event triggering, specifically including:

[0009] Step 1: Obtain the discrete sampling signal of the CAN node of the engineering vehicle and the status register value of the CAN controller. Convert the discrete sampling signal into a working condition data sequence. Obtain the bus load rate through the status register value. Obtain the event status sequence based on the working condition data sequence.

[0010] Step 2: Construct all CAN messages to be sent into message data records. Based on the protocol data units and event state sequences, obtain message data records with event semantics and dynamic priority annotations.

[0011] Step 3: Based on the bus load rate and event state sequence, the message data records with event semantics and dynamic priority labels are sent using a token bucket mechanism through a three-level priority queue linked with the three-state machine.

[0012] Optionally, it also includes: Step 4, calculating the worst-case response time of each CAN message iteratively, and dynamically configuring message data recording based on the worst-case response time.

[0013] Optionally, step 1 specifically includes:

[0014] Step S101: Obtain the discrete sampling signal of the CAN node of the engineering vehicle and the status register value of the CAN controller, convert the discrete sampling signal into a working condition data sequence, and obtain the bus load rate through the status register value.

[0015] Step S102: For each type of event, a corresponding operator is predefined. The sliding time window and high and low threshold hysteresis rules are applied to the working condition data sequence through the operator to perform state processing on the original numerical data and obtain the event state sequence.

[0016] Optionally, step 2 specifically includes:

[0017] Step S201: For each PDU in the CAN message to be sent, fill the fields in the message data record through table lookup and conversion operations. The fields include: basic data field, service semantic field and scheduling control field.

[0018] Step S202: Based on the pre-established "Event-Message Association Table", query the event set corresponding to the current message data record, and read the status value of the event under the current time index from the event status sequence.

[0019] In step S203, if at least one associated event is active, the control unit updates the corresponding fields of the current message data record to obtain a message data record with event semantics and dynamic priority annotations.

[0020] Optionally, the basic data fields include, but are not limited to: message identifier CanId, data length Dlc, data area Data, channel number Channel, and timestamp TimeStamp.

[0021] The business semantic fields include, but are not limited to: source module identifier SrcModule, message class MsgClass, nominal period Cycle, and maximum allowable delay Deadline.

[0022] The scheduling control fields include, but are not limited to: scheduling priority PrioLevel, queue identifier QueueId, event tag EventTag, token cost TokenCost, and worst-case response time upper bound WcrtBound.

[0023] Optionally, step S203 specifically includes:

[0024] If at least one associated event is active, update the EventTag field in the scheduling control field from 0 to 1, upgrade the PriorLevel field from a regular level to an event level, and rewrite the Deadline field if necessary.

[0025] If all associated event states are inactive, keep EventTag at 0, and keep the PrioriLevel and Deadline fields unchanged.

[0026] Optionally, step 3 specifically includes:

[0027] Step S301: A three-state state machine is pre-set. The three-state state machine takes the event state sequence and bus load rate as input, and the state field of the three-state state machine switches between three values: NORMAL, EVENT_BOOST, and RECOVER.

[0028] Step S302: Based on the message data record and the state field of the current three-state machine, perform queue classification and buffer data structure writing on the message data record.

[0029] Step S303: The message data records entering the corresponding buffers of each priority queue are scheduled and sent by hardware using the token bucket mechanism.

[0030] Optionally, step S301 specifically includes:

[0031] When at least one event is detected to change from an inactive state to an active state, the state field is updated from NORMAL to EVENT_BOOST.

[0032] When all event states return to inactive and the bus load rate remains below the intermediate threshold for a period of time, the status field is updated from EVENT_BOOST to RECOVER.

[0033] When the bus load rate remains below the threshold level and exceeds the recovery time, the status field is updated back to NORMAL by RECOVER.

[0034] Optionally, step S302 specifically includes:

[0035] A high-priority queue (Queue_H), a medium-priority queue (Queue_M), and a low-priority queue (Queue_L) are pre-defined, along with three sets of buffers and management data.

[0036] When the status field is NORMAL, the message data record is inserted into the buffer of the corresponding priority queue according to the configuration value of Priority in the message data record, and the corresponding management data is obtained.

[0037] When the status field is EVENT_BOOST, the message data record with EventTag=1 is redirected and written, inserted into the high-priority queue Queue_H, and then inserted into the buffer of the corresponding priority queue to obtain the corresponding management data; the message data record with EventTag=0 remains unchanged in its original queue.

[0038] When the status field is RECOVER, according to the preset batch migration strategy, the previously marked and promoted message data records are migrated from the buffer corresponding to Queue_H back to the original priority queue in batches from the data structure level, and the scheduling parameters of the priority queue are restored to the nominal value.

[0039] Optionally, step S303 specifically includes:

[0040] Using the message data records in the priority queue as input data, the system selects the message data records that can be sent according to the token bucket mechanism, and calls the CanIf_Transmit interface to write the selection result into the transmit buffer register of the CAN controller module.

[0041] After the physical layer transmission and ID arbitration are completed according to the CAN protocol, the status register updates the status bits.

[0042] The status bits of the status register are read periodically, the results are mapped back to the fields of the corresponding message data record, and the statistics fields of the message data record are updated.

[0043] Optionally, the token bucket mechanism specifically includes:

[0044] Initialize the queue management data corresponding to the high-priority queue Queue_H, the medium-priority queue Queue_M, and the low-priority queue Queue_L.

[0045] Create a set of token bucket status data for each priority queue, including: bucket capacity B_H, B_M, B_L, token generation rate R_H, R_M, R_L, and current token count Token_H, Token_M, Token_L.

[0046] Configure a periodic task as the scheduling heartbeat to periodically update the token bucket status data.

[0047] Here, let the heartbeat period be Δt. Whenever the heartbeat period event task is triggered, the priority queue set {QueueH, QueueM, QueueL} is traversed sequentially, and the new token count is calculated for each priority queue j:

[0048] Token_j = min(B_j, Token_j + R_j·Δt)

[0049] Where: j represents H, M or L.

[0050] The priority queue set is polled in the order of high priority first, medium priority second, and low priority last. For the currently selected queue j, the queue data structure is first checked to see if it is empty: if there is no message data record in the buffer, the internal polling pointer is updated and the next priority queue is switched; if the queue is not empty, a message data record is read from the head position of the priority queue, and the Dlc field and necessary header overhead in the message data record are calculated to obtain the token cost value TokenCost corresponding to the message data record under the current configuration.

[0051] Perform a comparison and update operation on the message data record at the head of the queue and the Token_j data of the current queue j. When the condition Token_j≥TokenCost is true, the message data record is dequeued from the priority queue data structure, the underlying CanIf_Transmit interface is called to trigger transmission, and at the same time, the value Token_j=Token_j−TokenCost is updated, and the transmission result is written into the count and timestamp data;

[0052] When Token_j < TokenCost, the message data record remains at the head of the queue, and the waiting time or number of times not served is incremented in the corresponding statistics, waiting for the next cycle to be re-evaluated.

[0053] Optionally, it also includes: when the number of messages continuously sent from the high-priority queue exceeds a preset threshold, or the waiting time statistics or cumulative number of unserved messages in the low-priority queue exceeds a preset threshold, checking the relationship between the TokenCost_L of the head message data record of the low-priority queue Queue_L and the current Token_L: if there is at least one message in the low-priority queue and Token_L≥TokenCost_L, then the message in the low-priority queue is forcibly selected for sending in the current period, and the relevant hunger detection counter and waiting time statistics are reset after sending.

[0054] Optionally, it also includes: constructing a time series of bus load rate based on raw data from the CAN controller, and adaptively adjusting the token generation rate parameter data.

[0055] Within the sliding time window, the raw data of the CAN controller is accumulated and normalized to calculate the bus load rate within the current window. When the bus load rate data is continuously higher than the upper threshold U_high for a period of time, the R_L parameter of the low priority queue is reduced or even temporarily set to zero, and the R_H parameter is appropriately increased as needed.

[0056] When the bus load rate data drops below the lower threshold U_low and remains below the preset recovery time, the R_L parameter of the low priority queue is gradually restored to its nominal value according to the preset step size.

[0057] Optionally, step 4 specifically includes:

[0058] Step S401: Establish a communication and scheduling model for each CAN message. The communication and scheduling model includes: identifier CanId, period Cycle, data length Dlc, expected maximum delay Deadline, initial priority, queue mapping relationship, and initial token bucket parameters.

[0059] Step S402: The upper bound of the response time WcrtBound_i of the i-th state field of the target CAN message in the worst case is obtained by iterative calculation from the time of preparation to the time of actual transmission completion.

[0060] Step S403: Compare WcrtBound_i and Deadline_i of the i-th status field of the target CAN message. If all target CAN messages satisfy WcrtBound_i not greater than Deadline_i, the current communication and scheduling model is considered feasible; if at least one target CAN message has WcrtBound_i of the i-th status field exceeding the time limit, the communication and scheduling model of the relevant CAN messages needs to be adjusted until the schedulability requirement is met or the preset iteration limit is reached.

[0061] Step S404: The final configuration result of the communication and scheduling model is solidified into configuration data recognizable by the CAN controller and downloaded to the control unit of each CAN node. During operation, when constructing message data records, the configuration result of the corresponding message is read from the configuration data and written to the corresponding field.

[0062] Optionally, it also includes: step S405, sampling and statistically analyzing the actual response time of CAN messages during runtime, and when it is found that the deviation from the design target is long-term or the network structure changes beyond the threshold, reporting the statistical results to the development tool through the network interface, triggering the re-execution of steps S401-S404.

[0063] In a second aspect, a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an event-triggered dynamic arbitration method for CAN message priorities as described in any of the first aspects.

[0064] Thirdly, a computer device comprising:

[0065] Memory is used to store instructions.

[0066] A processor is configured to execute the instructions, causing the computer device to perform operations of an event-triggered dynamic arbitration method for CAN message priorities as described in any of the first aspects.

[0067] Beneficial Effects: This invention provides a dynamic arbitration method and system for CAN message priority based on event triggering. Through event triggering, token bucket mechanism, and three-band queue scheduling, it ensures that security-critical messages in the system can be transmitted in a timely manner even under high load, while avoiding low-priority messages consuming bandwidth and causing latency jitter. Compared with existing technologies, its advantages are as follows:

[0068] 1. An event-triggered dynamic scheduling mechanism for CAN messages in engineering machinery provides an event-triggered dynamic priority adjustment mechanism to ensure that safety-critical messages can be transmitted with priority under high load and interference environments, thus meeting real-time requirements.

[0069] 2. The system and method include an event triggering mechanism and a bandwidth allocation module. The system automatically increases the priority of critical messages based on event triggering and allocates bandwidth reasonably through a token bucket mechanism and a three-band priority queue to ensure the latency and stability of critical messages.

[0070] 3. Dynamic bandwidth reallocation and latency guarantee under high load: Under high load, the system dynamically adjusts bandwidth and priority through token bucket and WCRT (Worst Case Response Time) analysis to ensure that all packets meet latency requirements, especially security-critical packets.

[0071] 4. Compatible with existing AUTOSAR systems: The scheduling mechanism of this invention is compatible with the existing AUTOSAR Classic system, achieving zero-intrusive integration and reducing integration complexity and risk.

[0072] 5. Supports rapid adaptation to multiple working conditions. Through configurable parameter tables, the system can quickly adapt to different vehicle models and working environments, exhibiting strong adaptability and scalability. Attached Figure Description

[0073] Figure 1 This is a flowchart illustrating a dynamic arbitration method for CAN message priority based on event triggering according to the present invention. Detailed Implementation

[0074] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.

[0075] The present invention will be further described below with reference to specific embodiments.

[0076] Example 1:

[0077] This embodiment introduces a dynamic arbitration method for CAN message priority based on event triggering, such as... Figure 1 As shown, it specifically includes:

[0078] Step 1: Periodically collect sensor signals (such as brake pressure and vehicle speed) and CAN controller status register values ​​(such as transmission error count) from the engineering vehicle. Preprocess the sensor signals and CAN controller status register values ​​to obtain a structured operating condition data sequence and the current bus load rate (U_bus). Use a predefined event detection operator (applying a sliding time window and threshold hysteresis rules) to perform state processing on the operating condition data sequence, converting continuous numerical data into a discrete event state sequence (EventStream) to accurately describe the activation and deactivation of critical events such as "emergency braking".

[0079] Step 2: Perform unified data modeling on all CAN messages to be sent, mapping Protocol Data Units (PDUs) from different upper-layer modules to message data records (MsgRec) in the internal standard format. The message data record (MsgRec) includes basic fields such as identifier and data length, and also integrates business semantics (such as message type, maximum allowable latency) and scheduling control fields (such as dynamic priority, event flags, token consumption, and latency upper bound obtained through offline worst-case response time analysis). Based on the "Event-Message Association Table" and real-time event status, MsgRec is dynamically semantically labeled and prioritized. When an associated event is activated, the priority of the corresponding CAN message is increased to ensure its timeliness.

[0080] Step 3: Pre-configure a three-level priority queue (high, medium, low) linked to the tri-state machine (NORMAL, EVENT_BOOST, RECOVER). Based on the dynamic priority of the message data record (MsgRec) and the current system state, allocate the message data record (MsgRec) to the corresponding data structure of the three-level priority queue. It operates based on a token bucket mechanism: it replenishes tokens to each queue at fixed intervals and strictly checks queues according to priority order. Only when the token consumption required by the message at the head of the queue is not greater than the number of tokens in the current bucket will the message data record be removed from the queue and sent, while deducting the corresponding tokens. This mechanism effectively limits the bandwidth consumption of non-critical messages and reserves channels for critical messages. Furthermore, by monitoring the bus load (U_bus) and queue starvation status, it dynamically adjusts the token generation rate or implements starvation protection scheduling, thereby achieving proactive bandwidth management and load adaptation at the data link layer above the link layer ID arbitration.

[0081] Step 4: By iteratively calculating the upper bound of the worst-case response time for each CAN message and ensuring that the upper bound does not exceed the preset time limit, the scheduling configurations such as queue mapping, priority settings, and token bucket parameters are verified and optimized. These offline analysis results are solidified into runtime configuration data to guide online scheduling decisions. This also includes real-time monitoring of the actual response time of messages and bus status, forming a complete closed loop of "monitoring-analysis-configuration-scheduling," thereby significantly improving the real-time performance of critical messages under complex high-load environments and the stability of the entire network system without changing the inherent identifier ID of the CAN message.

[0082] Furthermore, in step 1, this method can be executed by the control unit in the overall controller of the engineering machinery during operation. Taking "data flow and transformation between processing units" as the main thread, and without changing the CAN message identifier ID, it uniformly models and processes the sampling data, event data, message metadata, and scheduling control data related to the CAN message, thereby achieving dynamic management of message transmission timing and priority. Specifically, it includes:

[0083] In step S101, after the system completes basic initialization upon power-on, it periodically collects and preprocesses raw data related to the current CAN node's operating condition. On one hand, the control unit reads discrete sampled signals from the sensor acquisition module or the RTE interface (the communication interface in the automotive electronic software architecture), such as brake pressure, pedal switch, hydraulic valve opening, vehicle speed, and engine speed, and writes them into the corresponding signal buffer according to a preset sampling period. On the other hand, it reads status register values ​​such as transmit bit count, transmit error count, and bus idle count from the CAN controller module, accumulates and normalizes these raw hardware counts within a sliding time window, calculates the bus load U_bus within the current time window, and converts it into a load data sequence. This converts the discrete sampled signals into a structured operating condition data sequence.

[0084] In step S102, the control unit executes an event detection operator-based data processing method for the operating condition data sequence. Specifically, a corresponding operator is predefined for each type of safety-related event. This operator applies a sliding time window and high / low threshold hysteresis rules to the input signal sequence to perform state processing on the original numerical data, resulting in an event state sequence EventStream.

[0085] In one embodiment, for an emergency braking event, the control unit extracts N consecutive sampled values ​​within the current window from the braking pressure data stream and compares them with a high threshold P_high and a low threshold P_low. When the data within the window is consistently higher than P_high, the data state of the event is updated from "inactive" to "active." When the data is consistently lower than P_low and the time exceeds the clearing time T_clear, the state is restored to "inactive." After data processing by the event detection operator, the original continuous numerical data is converted into discrete event state data indexed by time, i.e., the event state sequence EventStream, which is used to uniformly describe the start and end of various events.

[0086] Furthermore, step 2 specifically includes:

[0087] Step S201: For each PDU in the CAN message, fill in each field in the message data record (MsgRec) through table lookup and conversion operations. Each field includes: basic data field, business semantic field, and scheduling control field.

[0088] The basic data fields include: message identifier CanId, data length Dlc, data area Data, channel number Channel, and timestamp TimeStamp.

[0089] The business semantic fields include: source module identifier SrcModule, message class MsgClass, nominal period Cycle, and maximum allowable delay Deadline, etc.

[0090] The scheduling control fields include: scheduling priority (PrioLevel), queue identifier (QueueId), event tag (EventTag), token cost (TokenCost), and worst-case response time upper bound (WcrtBound). These fields are used to organize previously scattered business messages into data records with a unified structure and complete fields, providing a data foundation for subsequent field-based association and scheduling calculations.

[0091] In step S202, the control unit first queries the event set corresponding to the current message data record (MsgRec) based on the pre-established "event-message association table", and reads the status value of the event under the current time index from the event status sequence EventStream.

[0092] In step S203, if at least one associated event is active, the control unit updates the corresponding field of the current message data record MsgRec to obtain a message data record with event semantics and dynamic priority annotation.

[0093] In one embodiment, if at least one associated event is active, the EventTag field in the scheduling control field is updated from 0 to 1, the PrioriLevel field is upgraded from a normal level to an event level, and the Deadline field is rewritten if necessary to reflect stricter latency requirements. If all associated events are inactive, the EventTag remains at 0, and the PrioriLevel and Deadline fields retain their configured values. Thus, MsgRec is transformed from a "normal message data record" to a "message data record with event semantics and dynamic priority annotations."

[0094] Furthermore, step 3 specifically includes:

[0095] Step S301: The control unit pre-sets a three-state state machine for pattern-level synthesis of the data processing results. The three-state state machine takes the event state sequence EventStream and the bus load rate U_bus as inputs, and its state fields switch between three values: NORMAL, EVENT_BOOST, and RECOVER.

[0096] When at least one critical event is detected to change from inactive to active, the status field is updated from NORMAL (normal) to EVENT_BOOST (event active).

[0097] When all event states return to inactive and the bus load rate U_bus remains below the intermediate threshold for a period of time, the status field is updated from EVENT_BOOST to RECOVER.

[0098] When the bus load rate U_bus continues to be below the threshold level and remains below the recovery time T_recover, the status field is updated back to NORMAL by RECOVER.

[0099] This is used to treat the status field as additional context data, which can be used together with the PrioLevel and EventTag of the message data record MsgRec in subsequent queue mapping and scheduling calculations, so that scheduling decisions are based on a unified data status rather than scattered logical conditions.

[0100] In step S302, the control unit performs queue classification and buffer data structure writing on the message data record based on the fields in the message data record MsgRe, such as MsgClass, PrioLevel, EventTag fields, and the state field of the current three-state machine.

[0101] The queue classification includes:

[0102] Three priority queues, Queue_H, Queue_M, and Queue_L, are pre-defined with high, medium, and low priorities, and three corresponding buffers and management pointers.

[0103] When the status field is NORMAL, the control unit inserts the message data record MsgRec into the buffer of the corresponding priority queue according to the configuration value of PrioroLevel, and obtains the corresponding management instruction.

[0104] When the status field is EVENT_BOOST, the control unit redirects the writing of message data record MsgRec with EventTag=1, inserts the message data record MsgRec into the high-priority queue Queue_H, and inserts it into the buffer of the corresponding priority queue to obtain the corresponding management instruction; the message data record MsgRec with EventTag=0 remains in its original queue.

[0105] When the status field is RECOVER, the control unit, according to a preset batch migration strategy, migrates the previously marked and promoted message data records MsgRec from the buffer corresponding to Queue_H back to the original priority queue in batches at the data structure level, while restoring the scheduling parameters of the priority queue to their nominal values. This is used to achieve dynamic reallocation of MsgRec between different priority queue data structures.

[0106] In step S303, the message data records MsgRec that enter the corresponding buffers of each priority queue are scheduled and sent by hardware using the token bucket mechanism.

[0107] The scheduler takes the message data record MsgRec of the priority queue as input data, selects the message data record MsgRec that can be sent according to the token bucket status (including the Token value and TokenCost field of each priority queue), and calls the CanIf_Transmit interface (the core interface function provided by the CAN interface (CanIf) module in the AUTOSAR architecture, used to initiate a CAN frame transmission request to upper layer modules (such as PduR, CanTp, etc.)) to write the selection result into the transmit buffer register of the CAN controller module.

[0108] After the CAN controller completes physical layer transmission and ID arbitration according to the CAN protocol, the status register will be updated with status bits such as transmission success, transmission failure, or arbitration delay.

[0109] The control unit periodically reads the status bits of the status register, maps the results back to the fields of the corresponding message data record MsgRec, updates the statistical fields of the message data record MsgRec such as the number of transmissions, the number of retransmissions, and the transmission delay, and uses them for subsequent bus load rate U_bus calculation and parameter adjustment closed loop of event status sequence / priority queue.

[0110] In one embodiment, when the control unit detects that the retransmission count field of a certain message data record MsgRec increases multiple times within a limited time window, or that the delay statistics field continuously exceeds a threshold, the message data record MsgRec is marked as abnormal at the data level. This can be done by incrementing its dedicated ErrorCounter field, temporarily increasing its Priority Level field value, or writing the corresponding fault information into the diagnostic message data structure, which is then packaged into a diagnostic frame and reported to the upper-level system by the diagnostic module. Through these data-level markings and reporting, the upper-level system can easily perform fault identification and protection strategy execution based on a unified data interface.

[0111] Furthermore, the token bucket mechanism includes:

[0112] Initialize the queue management data corresponding to the high-priority queue Queue_H, the medium-priority queue Queue_M, and the low-priority queue Queue_L, including: head and tail pointers, etc.

[0113] Create a set of token bucket state data for each priority queue, including: bucket capacity B_H (high-priority queue bucket capacity), B_M (medium-priority queue bucket capacity), B_L (low-priority queue bucket capacity), token generation rate R_H (high-priority queue generation rate), R_M (medium-priority queue generation rate), R_L (low-priority queue generation rate), and current token count Token_H (high-priority queue token count), Token_M (medium-priority queue token count), Token_L (low-priority queue token count). Store the token bucket state data in runtime memory in the form of a structure or table. This is used to calibrate the above parameters based on vehicle model, business scenario, and offline worst-case response time analysis results, and to configure the initial data for queues and token buckets.

[0114] The control unit is configured with a periodic task as a scheduling heartbeat to periodically update the token bucket status data.

[0115] Here, the heartbeat period is set to Δt (e.g., 1 ms or other suitable interval). Whenever the event task of this heartbeat period is triggered, the scheduler sequentially traverses the priority queue set {QueueH, QueueM, QueueL} and calculates the new token count for each priority queue j:

[0116] Token_j = min(B_j, Token_j + R_j·Δt)

[0117] Where: j represents H, M or L.

[0118] This calculation process maps continuous time progression to discrete token accumulation, ensuring that Token_j is always confined to the range [0, B_j]. The increment R_j·Δt reflects the average sending capacity of the corresponding queue over a long time scale. This is used for periodic numerical updates of the three sets of token bucket state data.

[0119] After the priority queue and token bucket status data are ready, the scheduler reads the message queue data in an ordered manner. The scheduler polls the priority queue set in the order of "high priority first, medium priority second, low priority last." For the currently selected queue j, it first checks if its queue data structure is empty: if there is no MsgRec data record in the buffer, it updates the internal polling pointer and switches to the next priority queue; if the queue is not empty, it reads a MsgRec from the head of the priority queue, calculates the Dlc field and necessary header overhead in the MsgRec to obtain the token cost value TokenCost corresponding to the MsgRec under the current configuration, which is used to approximately represent the bus bandwidth usage of the message. This is used to convert discrete information such as "whether there is a message in the queue" and "message length" into numerical TokenCost data for subsequent decision-making.

[0120] The control unit performs a comparison and update operation on the MsgRec at the head of the queue and the Token_j data of the current queue j. When the condition Token_j ≥ TokenCost is met, it means that the remaining bandwidth budget of the priority queue in this heartbeat cycle is sufficient to cover the message. The scheduler dequeues the MsgRec from the priority queue data structure, calls the underlying CanIf_Transmit interface to trigger transmission, and simultaneously performs a numerical update Token_j = Token_j − TokenCost, and writes the transmission result into the count and timestamp data maintained by the statistics module. When Token_j < TokenCost, it means that the number of tokens in the priority queue is insufficient in this time slice. In this embodiment, the MsgRec remains unchanged at the head of the queue, and only its waiting time or number of missed services fields are incremented in the corresponding statistics, waiting for the next cycle to re-determine. This is used to directly drive whether to send a message based on the comparison result of the "token count data and TokenCost data".

[0121] Furthermore, to prevent low-priority queues from being in a state of starvation for a long time, the control unit also maintains a set of statistics related to starvation detection, including: a counter for the number of consecutively successfully sent frames in the high-priority queue, and a field for the cumulative waiting time or cumulative number of unserved messages in the low-priority queue.

[0122] When the number of consecutive packets sent from the high-priority queue exceeds a preset threshold, or when the waiting time statistics or cumulative number of unserved events in the low-priority queue exceed a preset threshold T_starve, the control unit checks the relationship between the TokenCost_L of the head of the low-priority queue Queue_L and the current Token_L: If there is at least one packet in the low-priority queue and Token_L ≥ TokenCost_L, the scheduler will forcibly select the packet from that low-priority queue for transmission in the current period, and reset the relevant starvation detection counters and waiting time statistics after transmission. This is used to determine the "anti-starvation strategy" through these statistical fields and thresholds, specifically implementing the monitoring and correction of data counting and time accumulation.

[0123] Furthermore, it also includes: the control unit constructs the time series of bus load rate U_bus based on raw data such as bit count and idle count from the CAN controller module, and further adaptively adjusts the token generation rate parameter data.

[0124] The control unit performs accumulation and normalization operations on data such as bit count within the sliding time window to calculate U_bus in the current window. When the U_bus data is continuously higher than the upper threshold U_high for a period of time, the system considers the bus to be in a high-load state. By reducing or even temporarily setting the R_L parameter of the low-priority queue to zero, and appropriately increasing the R_H parameter as needed, the system lowers the token growth rate of the low-priority stream and increases the token growth rate of the key queue at the data level.

[0125] When the U_bus data drops below the lower threshold U_low and remains below the preset recovery time, the control unit gradually restores the parameters such as R_L of the low-priority queue to their nominal values ​​in preset steps to avoid large fluctuations in the token rate. This is used to form a load adaptive closed loop based on data feedback between the U_bus sequence and the {R_H, R_M, R_L} parameters.

[0126] Furthermore, step 4 can be executed by the development tool or host computer during the vehicle network development phase or controller software upgrade, or it can be triggered low-frequency in the background during operation to adapt to changes in message set or load characteristics. Specifically, it includes:

[0127] Step S401: Based on the vehicle network communication matrix, the developers establish a communication and scheduling model for each CAN message type. This communication and scheduling model includes: identifier CanId, cycle, data length Dlc, expected maximum delay Deadline, initial priority, queue mapping relationship, and initial token bucket parameters. The communication and scheduling model can be stored in the form of a table, configuration file, or ARXML file.

[0128] Step S402: Perform worst-case response time analysis for each CAN message type using real-time scheduling theory.

[0129] In this study, given the period, transmission time, and priority of other CAN messages, the upper bound of the response time WcrtBound_i for the target CAN message in the worst-case scenario, from preparation to actual completion of transmission, is obtained through iterative calculation. For scenarios with event enhancement and token bucket rate limiting, analysis can be performed under three states: NORMAL, EVENT_BOOST, and RECOVER, yielding multiple sets of WcrtBound values ​​to provide a basis for parameter calibration.

[0130] Step S403: Compare the WcrtBound_i and Deadline_i of the target CAN messages. If all target CAN messages satisfy WcrtBound_i not greater than Deadline_i, the current queue mapping and token bucket parameter configuration are considered feasible. If at least one target CAN message has a WcrtBound_i exceeding the time limit, the scheduling parameters of the relevant CAN messages need to be adjusted. For example, increase the priority of the queue where the message belongs, appropriately reduce the period or token generation rate of background messages in the shared queue, or reduce the number of non-critical messages on the same bus. This continues until the schedulability requirements are met or the preset iteration limit is reached.

[0131] Step S404: The final configuration results, including WcrtBound_i, queue mapping, and token bucket parameters, are solidified into configuration data recognizable by the controller and downloaded to the control unit of each CAN node. During operation, the control unit reads the WcrtBound and scheduling parameters of the corresponding message from the configuration data and writes them into the extended field when constructing MsgRec. This is used to ensure that the offline latency analysis results are directly reflected in the online message data processing and scheduling behavior.

[0132] Furthermore, it also includes: step S405, where the control unit samples and counts the actual response time of the message during operation. When it finds that the deviation from the design target is long-term or the network structure changes beyond the threshold (e.g., adding a controller or adding a large number of new messages), the statistical results are reported to the development tool through the network interface, triggering the re-execution of the above WCRT analysis process in steps S401-S404, which is used to realize the dynamic reconfiguration of the vehicle network.

[0133] Example 2:

[0134] This embodiment describes a computer-readable storage medium storing a computer program that, when executed by a processor, implements an event-triggered dynamic arbitration method for CAN message priority as described in any of Embodiment 1.

[0135] Example 3:

[0136] This embodiment describes a computer device, including:

[0137] Memory is used to store instructions.

[0138] A processor is configured to execute the instructions, causing the computer device to perform an operation of an event-triggered dynamic arbitration method for CAN message priorities as described in any of Embodiment 1.

[0139] Example 4:

[0140] This embodiment describes the implementation process of a dynamic arbitration method for CAN message priority based on event triggering. The execution subject of this invention includes the hardware architecture of various engineering machinery, wherein the hardware architecture includes: a control unit, a data acquisition module, a power supply module, a CAN controller module, and a CAN transceiver module.

[0141] The data acquisition module is used to collect signals from various sensors and provide them to the control unit.

[0142] The power module provides a stable power supply for the control unit and other modules.

[0143] The CAN controller module is used to perform CAN frame formatting, buffering, and hardware arbitration.

[0144] The CAN transceiver module is used to complete the transmission and reception of the CAN bus physical layer.

[0145] The control unit writes MsgRec into the transmit buffer of the CAN controller module. During message transmission, the CAN controller module can provide real-time feedback on transmission success, transmission failure, or arbitration status according to the CAN protocol. The control unit periodically reads relevant status registers to collect statistics on the transmission results and delays of each message, which are used to update data such as EventTag, PrioLevel, and U_bus to implement the aforementioned event scheduling and token bucket scheduling algorithms.

[0146] The following describes an embodiment of this method, which specifically includes:

[0147] S101: Periodic acquisition structures the original signal / bus count and outputs the operating condition signal sequence Signals[t] and bus load U_bus[t], which are used as inputs for event operators, the basis for value to state, and the load index to drive the rate adaptation {R_H,R_M,R_L}. Among them, periodic sampling (ms level) and sliding window update (ms~10ms).

[0148] S102: Convert the numerical signal into an event state sequence EventStream[t], which is used for event-message association and to update the EventTag / PrioLevel / Deadline of MsgRec.

[0149] S103: Standardize the upper-layer PDU into a schedulable MsgRec, where the unified message record MsgRec (including CanId / Dlc / Data / … / TokenCost / WcrtBound) is the unique fact carrier for carrying all metadata required for scheduling.

[0150] S104: Based on the EventStream, MsgRec is tagged with EventTag / PrioLevel / Deadline. The tagged MsgRec (dynamic priority and time limit) is used for queue classification (Queue_H / M / L) and drives the subsequent scheduling path.

[0151] S105: Dynamically add MsgRec to Queue_H / M / L to provide a pending object (queue head MsgRec) for "token judgment".

[0152] S106: Initialize Queue / TokenState(B,R,Token), used for the initial values ​​of the token and queue, determining the scheduling baseline.

[0153] S107: Accumulate Token_j by Δt to obtain the updated Token_j, which is the budget amount used for numerical comparison with TokenCost.

[0154] S108: Calculate the TokenCost of the head message, obtain the TokenCost of the head message, and compare it with Token_j → Send / Wait decision.

[0155] S109: Compare (Token_j vs TokenCost) to decide whether to send / wait and write back TxStats, obtain the sending result and statistics TxStats (succ / fail / arb_delay / wait), which are used to feed back load estimation, starvation protection and subsequent parameter callbacks.

[0156] S1010: Adaptively adjust {R_H,R_M,R_L}, which has a closed-loop effect on the subsequent token evolution and sending rhythm, and obtains the rate parameter RateParams (adaptively adjusted {R_H,R_M,R_L}), which is used to influence the subsequent token evolution (average rate and burst suppression).

[0157] S1011: The Config (WcrtBound, queue mapping, B / R, rules, version) produced by the offline / background WCRT process (S302–S308) is read by S103 / S105 / S106 / S107 to apply the offline WCRT conclusions to online fields and initial parameter values, forming a long-cycle closed loop of "offline constraints → online execution → statistical feedback → further analysis when necessary".

[0158] The above steps constitute a closed-loop process with data processing as the main thread: converting field signals and bus status sampling data into event status data, standardizing service PDUs into MsgRec data records, semantically annotating and prioritizing MsgRec through event association and state machine fields, buffering and scheduling at the data structure level through multi-queue and token bucket mechanisms, and continuously updating U_bus and message statistics fields using transmission statistics. In this way, without changing the CAN message identifier ID, this embodiment achieves better latency protection for safety-critical messages at the data level by uniformly modeling, annotating, and dynamically updating various message-related data, while suppressing scheduling jitter caused by frequent data state flips at event boundaries, thereby improving the data processing efficiency and operational stability of the vehicle CAN network.

[0159] Within each scheduling cycle, the scheduler completes the aforementioned token count update, queue polling and TokenCost calculation, send / wait decision-making, and starvation protection processing. After adaptively adjusting the token rate parameter based on U_bus data, it updates the internal time index and polling pointer, awaiting the next scheduling heartbeat. Through this cyclical execution mechanism, the sending rate of message data streams with different priorities is continuously constrained and dynamically allocated bandwidth over time.

[0160] Compared to traditional CAN scheduling methods that rely solely on physical layer ID arbitration and lack explicit rate control data structures, this invention introduces a combination of "queue buffer data + token bucket status data + statistics and threshold data" at the software level. Without altering the message ID, this data processing method limits the average transmission rate of different service flows and suppresses burst traffic, resulting in a smoother bus load curve over time. Furthermore, it improves the response time distribution of critical messages at the data level, reduces latency jitter caused by bus contention, and enhances the overall stability of the vehicle's CAN network.

[0161] Through the aforementioned distributed adaptive scheduling mechanism, the vehicle CAN network can significantly reduce latency jitter caused by bus contention while maintaining the communication protocol and message set unchanged. It can also rationally distribute the message transmission time of different nodes, improve the timing accuracy of critical messages, and enhance the overall stability of the network.

[0162] In summary, this invention achieves dynamic optimization of the CAN network of construction machinery vehicles without changing the CAN message ID or adding additional control messages by adding an event awareness and token bucket scheduling mechanism between the CAN controller and the upper-layer application, and by introducing a configuration design process based on WCRT. This effectively reduces the probability of message arbitration, reduces latency fluctuations, and improves the real-time performance of critical messages and the overall stability of the network.

[0163] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0164] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0165] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0166] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0167] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A dynamic arbitration method for CAN message priority based on event triggering, characterized in that: Specifically, it includes: Step 1: Obtain the discrete sampling signals of the CAN nodes of the engineering vehicle and the status register values ​​of the CAN controller. Convert the discrete sampling signals into a working condition data sequence. Obtain the bus load rate through the status register values. Obtain the event status sequence based on the working condition data sequence. Step 2: Construct all CAN messages to be sent into message data records. Based on the protocol data units and event state sequences, obtain message data records with event semantics and dynamic priority annotations. Step 3: Based on the bus load rate and event state sequence, the message data records with event semantics and dynamic priority labels are sent using a token bucket mechanism through a three-level priority queue linked with the three-state machine.

2. The event-triggered dynamic arbitration method for CAN message priority according to claim 1, characterized in that: Also includes: Step 4: Iteratively calculate the worst-case response time for each CAN message and dynamically configure message data recording based on the worst-case response time.

3. The event-triggered dynamic arbitration method for CAN message priority according to claim 1, characterized in that: Step 1 specifically includes: Step S101: Obtain the discrete sampling signal of the CAN node of the engineering vehicle and the status register value of the CAN controller, convert the discrete sampling signal into a working condition data sequence, and obtain the bus load rate through the status register value; Step S102: For each type of event, a corresponding operator is predefined. The sliding time window and high and low threshold hysteresis rules are applied to the working condition data sequence through the operator to perform state processing on the original numerical data and obtain the event state sequence.

4. The event-triggered dynamic arbitration method for CAN message priority according to claim 1, characterized in that: Step 2 specifically includes: Step S201: For each PDU in the CAN message to be sent, fill the fields in the message data record through table lookup and conversion operations. The fields include: basic data field, service semantic field and scheduling control field. Step S202: Based on the pre-established "Event-Message Association Table", query the event set corresponding to the current message data record, and read the status value of the event under the current time index from the event status sequence; In step S203, if at least one associated event is active, the control unit updates the corresponding fields of the current message data record to obtain a message data record with event semantics and dynamic priority annotations.

5. The event-triggered dynamic arbitration method for CAN message priority according to claim 4, characterized in that: The basic data fields include, but are not limited to: message identifier CanId, data length Dlc, data area Data, channel number Channel, and timestamp TimeStamp; The business semantic fields include, but are not limited to: source module identifier SrcModule, message type MsgClass, nominal period Cycle, and maximum allowable delay Deadline; The scheduling control fields include, but are not limited to: scheduling priority PrioLevel, queue identifier QueueId, event tag EventTag, token cost TokenCost, and worst-case response time upper bound WcrtBound.

6. The event-triggered dynamic arbitration method for CAN message priority according to claim 4, characterized in that: Step S203 specifically includes: If at least one associated event is active, update the EventTag field in the scheduling control field from 0 to 1, upgrade the PriorLevel field from a regular level to an event level, and rewrite the Deadline field if necessary. If all associated event states are inactive, keep EventTag at 0, and keep the PrioriLevel and Deadline fields unchanged.

7. The event-triggered dynamic arbitration method for CAN message priority according to claim 1, characterized in that: Step 3 specifically includes: Step S301: A three-state state machine is pre-set. The three-state state machine takes the event state sequence and bus load rate as input, and the state field of the three-state state machine switches between three values: NORMAL, EVENT_BOOST and RECOVER. Step S302: Based on the message data record and the state field of the current three-state machine, perform queue classification and buffer data structure writing on the message data record; Step S303: The message data records entering the corresponding buffers of each priority queue are scheduled and sent by hardware using the token bucket mechanism.

8. The event-triggered dynamic arbitration method for CAN message priority according to claim 7, characterized in that: Step S301 specifically includes: When at least one event is detected to change from inactive to active, the state field is updated from NORMAL to EVENT_BOOST; When all event states return to inactive and the bus load rate remains below the intermediate threshold for a period of time, the status field is updated from EVENT_BOOST to RECOVER; When the bus load rate remains below the threshold level and exceeds the recovery time, the status field is updated back to NORMAL by RECOVER.

9. A dynamic arbitration method for CAN message priority based on event triggering according to claim 7, characterized in that: Step S302 specifically includes: A high-priority queue (Queue_H), a medium-priority queue (Queue_M), and a low-priority queue (Queue_L) are pre-defined, and three sets of buffers and management data are corresponding to them. When the status field is NORMAL, the message data record is inserted into the buffer of the corresponding priority queue according to the configuration value of Priority in the message data record, and the corresponding management data is obtained. When the status field is EVENT_BOOST, the message data record with EventTag=1 is redirected and written, inserted into the high-priority queue Queue_H, and then inserted into the buffer of the corresponding priority queue to obtain the corresponding management data; the message data record with EventTag=0 remains in its original queue. When the status field is RECOVER, according to the preset batch migration strategy, the previously marked and promoted message data records are migrated from the buffer corresponding to Queue_H back to the original priority queue in batches from the data structure level, and the scheduling parameters of the priority queue are restored to the nominal value.

10. A dynamic arbitration method for CAN message priority based on event triggering according to claim 7, characterized in that: Step S303 specifically includes: Using the message data records in the priority queue as input data, the sendable message data records are selected according to the token bucket mechanism, and the CanIf_Transmit interface is called to write the selection result into the transmit buffer register of the CAN controller module. After the physical layer transmission and ID arbitration are completed according to the CAN protocol, the status register updates the status bits; The status bits of the status register are read periodically, the results are mapped back to the fields of the corresponding message data record, and the statistics fields of the message data record are updated.

11. A dynamic arbitration method for CAN message priority based on event triggering according to claim 10, characterized in that: The token bucket mechanism specifically includes: Initialize the queue management data corresponding to the high-priority queue Queue_H, the medium-priority queue Queue_M, and the low-priority queue Queue_L; Create a set of token bucket status data for each priority queue, including: bucket capacity B_H, B_M, B_L, token generation rate R_H, R_M, R_L, and current token count Token_H, Token_M, Token_L; Configure a periodic task as the scheduling heartbeat to periodically update the token bucket status data; Here, let the heartbeat period be Δt. Whenever the heartbeat period event task is triggered, the priority queue set {QueueH, QueueM, QueueL} is traversed sequentially, and the new token count is calculated for each priority queue j: Token_j = min(B_j, Token_j + R_j·Δt) Where: j represents H, M, or L; The priority queue set is polled in the order of high priority first, medium priority second, and low priority last. For the currently selected queue j, the queue data structure is first checked to see if it is empty: if there is no message data record in the buffer, the internal polling pointer is updated and the next priority queue is switched; if the queue is not empty, a message data record is read from the head position of the priority queue, and the Dlc field and necessary header overhead in the message data record are calculated to obtain the token cost value TokenCost corresponding to the message data record under the current configuration. Perform a comparison and update operation on the message data record at the head of the queue and the Token_j data of the current queue j; when the condition Token_j≥TokenCost is met, dequeue the message data record from the priority queue data structure, call the underlying CanIf_Transmit interface to trigger the transmission, and at the same time perform a numerical update Token_j=Token_j−TokenCost, and write the transmission result into the count and timestamp data; When Token_j < TokenCost, the message data record remains at the head of the queue, and the waiting time or number of times not served is incremented in the corresponding statistics, waiting for the next cycle to be re-evaluated.

12. The event-triggered dynamic arbitration method for CAN message priority according to claim 11, characterized in that: Also includes: When the number of messages sent continuously from the high-priority queue exceeds a preset threshold, or when the waiting time statistics or the cumulative number of unserved messages in the low-priority queue exceed a preset threshold, the relationship between the TokenCost_L of the message head data record of the low-priority queue Queue_L and the current Token_L is checked: if there is at least one message in the low-priority queue and Token_L≥TokenCost_L, then the message in the low-priority queue is forcibly selected for sending in the current period, and the relevant starvation detection counter and waiting time statistics are reset after sending.

13. A dynamic arbitration method for CAN message priority based on event triggering according to claim 11, characterized in that: Also includes: Based on raw data from the CAN controller, a time series of bus load rate is constructed, and the token generation rate parameter data is adaptively adjusted. Within the sliding time window, the raw data of the CAN controller is accumulated and normalized to calculate the bus load rate within the current window. When the bus load rate data is continuously higher than the upper threshold U_high for a period of time, the R_L parameter of the low priority queue is reduced or even temporarily set to zero, and the R_H parameter is appropriately increased as needed. When the bus load rate data drops below the lower threshold U_low and remains below the preset recovery time, the R_L parameter of the low priority queue is gradually restored to its nominal value according to the preset step size.

14. The event-triggered dynamic arbitration method for CAN message priority according to claim 2, characterized in that: Step 4 specifically includes: Step S401: Establish a communication and scheduling model for each CAN message. The communication and scheduling model includes: identifier CanId, period Cycle, data length Dlc, expected maximum delay Deadline, initial priority, queue mapping relationship, and initial token bucket parameters. Step S402: The upper bound of the response time WcrtBound_i of the i-th state field of the target CAN message in the worst case is obtained by iterative calculation from the time of preparation to the actual completion of transmission. Step S403: Compare WcrtBound_i and Deadline_i of the i-th status field of the target CAN message; if all target CAN messages satisfy WcrtBound_i not greater than Deadline_i, the current communication and scheduling model is considered feasible; if at least one target CAN message has WcrtBound_i of the i-th status field exceeding the time limit, the communication and scheduling model of the relevant CAN messages needs to be adjusted until the schedulability requirement is met or the preset iteration limit is reached. Step S404: The configuration result of the final communication and scheduling model is solidified into configuration data that can be recognized by the CAN controller and downloaded to the control unit of each CAN node; during operation, when constructing message data records, the configuration result of the corresponding message is read from the configuration data and written into the corresponding field.

15. A dynamic arbitration method for CAN message priority based on event triggering according to claim 14, characterized in that: Also includes: Step S405: During runtime, the actual response time of CAN messages is sampled and statistically analyzed. When it is found that the deviation from the design target is long-term or the network structure changes beyond the threshold, the statistical results are reported to the development tool through the network interface, triggering the re-execution of steps S401-S404.

16. A computer-readable storage medium, characterized in that: It stores a computer program that, when executed by a processor, implements a dynamic arbitration method for CAN message priority based on event triggering as described in any one of claims 1-15.

17. A computer device, characterized in that: include: Memory, used to store instructions; A processor is configured to execute the instructions, causing the computer device to perform the operation of an event-triggered dynamic arbitration method for CAN message priorities as described in any one of claims 1-15.

Citation Information

Cited By

  • Air-cooled refrigerator CAN bus multi-node instruction scheduling method and system

    CN122149147A

  • Air-cooled refrigerator CAN bus multi-node instruction scheduling method and system

    CN122149147B