An automatic switching communication method and system of electric control and BMS dual redundancy channels
Patent Information
- Application Number
- CN202611075531.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-30
AI Technical Summary
然而,现有双冗余通信方案通常仅在检测到主通信通道完全失效后才执行主备切换,通信状态判定方式较为单一,多依赖于心跳报文超时或总线关闭状态进行故障判断,难以及时、准确地反映通信链路的健康状态,容易出现误判或漏判现象
[0007]上述方法及系统所提供的一个方案中,通过构建主通信通道与备用通信通道,实现电控单元与BMS之间的双冗余通信架构,使通信链路具备物理独立性与路径冗余性。在单一通道发生断路、短路或总线异常时,系统仍可依赖另一通道维持基本通信能力,从而提升整体通信系统的抗单点故障能力与运行可靠性。对主通信通道与备用通信通道进行周期性通信数据采集,可实现通信链路运行状态的连续感知,使丢帧情况、传输延迟及校验错误等异常特征能够被实时捕获。通过周期化采样机制,提高通信质量评估的数据完整性与动态响应能力,为状态识别提供稳定数据基础。基于通信特征参数进行加权计算,可将多维异构通信指标统一映射为单一状态评估值,实现通信质量的量化表达。通过权重区分不同通信指标的重要性,使丢帧率与校验错误等关键因素对评估结果具有更高影响权重,从而提高评估结果的准确性与工程适用性。
Smart Images

Figure CN123020264A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle communication technology, and in particular to a communication method and system for automatic switching between dual redundant channels of electronic control and BMS. Background Technology
[0002] The electronic control unit (ECU) and the battery management system (BMS) mostly communicate via a single CAN bus. While the CAN bus offers advantages such as low cost, good real-time performance, and strong anti-interference capabilities, in actual operation, the communication link can still be affected by factors such as electromagnetic interference, aging wiring harnesses, loose connectors, transceiver failures, and short circuits or open circuits in the bus, leading to communication anomalies or even interruptions. If the ECU fails to obtain critical status information from the BMS in a timely manner, it may cause the vehicle to enter a reduced-power mode, falsely trigger high-voltage protection, and in severe cases, even cause the vehicle to lose its driving ability, affecting vehicle operational safety.
[0003] To improve communication reliability, some existing solutions employ a dual-CAN redundant communication structure, enhancing system fault tolerance by configuring a primary communication channel and a backup communication channel. However, existing dual-redundant communication solutions typically only perform primary / backup switching after detecting a complete failure of the primary communication channel. The communication status determination method is relatively simple, relying heavily on heartbeat message timeouts or bus shutdown states for fault diagnosis. This makes it difficult to reflect the health status of the communication link in a timely and accurate manner, easily leading to misjudgments or missed judgments. During primary / backup switching, the lack of effective data buffer management and communication data reconstruction mechanisms can easily result in message loss, out-of-order data, or duplicate reception, thus affecting data consistency between the electronic control unit and the BMS and reducing system operational stability. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention proposes a communication method and system for automatic switching between dual redundant channels of electronic control and BMS, thereby resolving at least one of the aforementioned technical problems.
[0005] In a first aspect, embodiments of this application provide a method for automatic switching communication between dual redundant channels of electronic control and BMS, comprising the following steps: A main communication channel and a backup communication channel are established between the electronic control unit and the BMS; periodic communication data are collected from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel; Based on the aforementioned communication characteristic parameters, a weighted calculation is performed on each communication channel to obtain the communication status evaluation value of the main communication channel and the backup communication channel. The communication status evaluation value of the main communication channel is compared with the preset evaluation threshold to determine the communication channel status. When the main communication channel is determined to be in a failed state, the control communication link is switched from the main communication channel to the backup communication channel, and the seamless switching is achieved based on the communication route pointer switching and receive buffer freezing mechanism. After the communication switch is completed, the data received through the backup communication channel is timestamped and the sequence consistency is checked in order to rebuild the communication data between the electronic control system and the BMS and restore the communication.
[0006] Secondly, embodiments of this application provide a communication system for automatic switching between dual redundant channels of electronic control and BMS, comprising: The acquisition unit is used to establish a main communication channel and a backup communication channel between the electronic control unit and the BMS; and to periodically acquire communication data from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel. The calculation unit is used to perform weighted calculations on each communication channel based on the communication characteristic parameters to obtain the communication status evaluation value of the main communication channel and the backup communication channel. The status determination unit is used to compare the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status. The switching unit is used to control the communication link to switch from the main communication channel to the backup communication channel when it is determined that the main communication channel is in a failed state. It achieves a smooth switching based on the communication route pointer switching and receive buffer freezing mechanism. The verification unit is used to perform timestamp alignment and sequence consistency verification on the data received by the backup communication channel after the communication switch is completed, so as to complete the reconstruction of the communication data between the electronic control and BMS and the communication recovery.
[0007] In one solution provided by the aforementioned method and system, a dual-redundant communication architecture is achieved between the electronic control unit (ECU) and the BMS by constructing a primary communication channel and a backup communication channel, enabling the communication link to possess physical independence and path redundancy. Even if a single channel experiences an open circuit, short circuit, or bus anomaly, the system can still rely on the other channel to maintain basic communication capabilities, thereby improving the overall communication system's resistance to single-point failures and operational reliability. Periodic acquisition of communication data from the primary and backup communication channels enables continuous perception of the communication link's operational status, allowing for the real-time capture of abnormal features such as frame loss, transmission delay, and checksum errors. The periodic sampling mechanism improves the data integrity and dynamic response capability of communication quality assessment, providing a stable data foundation for status identification. Weighted calculation based on communication characteristic parameters can uniformly map multi-dimensional heterogeneous communication indicators to a single status evaluation value, achieving a quantitative expression of communication quality. By differentiating the importance of different communication indicators through weights, key factors such as frame loss rate and checksum errors have a higher impact on the evaluation results, thereby improving the accuracy and engineering applicability of the evaluation results.
[0008] By comparing communication status assessment values with preset thresholds, the communication channel status is graded, enabling the communication system to have a structured identification capability for normal, degraded, and failed states. The dual-threshold judgment mechanism effectively suppresses misjudgments caused by transient fluctuations, improving the stability and reliability of communication status judgment. When the primary communication channel fails, a communication path is dynamically reconstructed through communication route pointer switching and receive buffer freezing mechanisms, avoiding data overwriting or out-of-order issues during the switching process and achieving a smooth switching of the communication link. This mechanism ensures the continuity of control command transmission and reduces the impact of communication interruptions on system control stability. Furthermore, through timestamp alignment and sequence consistency verification, the data of the backup communication channel is structurally reconstructed, effectively eliminating timing misalignments and data loss problems caused by communication switching. By combining the mirror data completion mechanism, the integrity and continuity of communication data are improved, ensuring the rapid recovery and stable operation of the communication closed loop between the electronic control unit and the BMS. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a schematic diagram of the system structure in one embodiment of the present invention; Figure 2 This is a flowchart illustrating an automatic switching communication method for dual redundant channels of electronic control and BMS in one embodiment of the present invention. Figure 3 This is a flowchart outlining the specific steps involved in weighted calculations of each communication channel based on the aforementioned communication characteristic parameters to obtain the communication status evaluation values for the main communication channel and the backup communication channel. Figure 4 This is a flowchart illustrating the specific steps involved in comparing the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status. Detailed Implementation
[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0012] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. It should also be understood that, as used in this specification and the appended claims, the term "and / or" refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0013] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0014] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0015] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0016] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0017] To address the problems mentioned above in the background art, this application proposes a communication method and system for automatic switching between dual redundant channels of electronic control and BMS. The automatic switching communication method for dual redundant channels of electronic control and BMS provided by this invention can be applied to applications such as... Figure 1 The system shown includes a client and a server.
[0018] In one embodiment, such as Figure 2 As shown, a method for automatic switching communication between dual redundant channels of electronic control and BMS is provided, which is applied to... Figure 1 Taking the system in the example, the following steps are included: A main communication channel and a backup communication channel are established between the electronic control unit and the BMS; periodic communication data are collected from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel; Based on the aforementioned communication characteristic parameters, a weighted calculation is performed on each communication channel to obtain the communication status evaluation value of the main communication channel and the backup communication channel. The communication status evaluation value of the main communication channel is compared with the preset evaluation threshold to determine the communication channel status. When the main communication channel is determined to be in a failed state, the control communication link is switched from the main communication channel to the backup communication channel, and the seamless switching is achieved based on the communication route pointer switching and receive buffer freezing mechanism. After the communication switch is completed, the data received through the backup communication channel is timestamped and the sequence consistency is checked in order to rebuild the communication data between the electronic control system and the BMS and restore the communication.
[0019] In this embodiment, the application is applied to a high-reliability communication scenario between the electronic control unit (ECU) and the battery management system (BMS) in the power system of a new energy commercial vehicle.
[0020] Independent main and backup communication channels are established between the electronic control unit (ECU) and the BMS. The main communication channel uses a first CAN bus controller (CAN Controller A) and its corresponding first differential signal transmission lines (CAN_H_A / CAN_L_A); the backup communication channel uses a second CAN bus controller (CAN Controller B) and its corresponding second differential signal transmission lines (CAN_H_B / CAN_L_B). The two controllers are connected to different bus nodes within the ECU, and their power supply circuits, ground loops, and terminating resistors (nominal value 120Ω) are completely isolated, with no shared nodes. The theoretical basis for this isolation design is that the differential transmission characteristics of the CAN bus determine that the dominant / recessive level on a single bus is determined by the terminating resistors at both ends of the bus. If the two channels share a power supply or ground, a short circuit in one channel will cause a voltage drop on the power supply side, thus affecting the normal operating voltage range of the other controller (typical operating voltage range 4.5V to 5.5V). By completely isolating the power supply and ground wires, it can be ensured that when a physical layer short circuit or open circuit fault occurs in any channel, the differential bus voltage of the other channel remains within the normal operating range, achieving true physical dual redundancy. The primary and backup channels are activated synchronously during the system power-on initialization phase, and the backup channel maintains a low-power monitoring state during the normal operation of the primary channel to reduce the overall power consumption of the system.
[0021] The system sets a fixed sampling period (20ms in this embodiment), and synchronously collects data on the main communication channel and the backup communication channel within each sampling period. The collected data includes five types of communication characteristic parameters: ① Message transmission timestamp, recording the actual transmission time of each message frame on the ECU side; ② Message reception timestamp, recording the actual arrival time of the corresponding message on the BMS side; ③ Message sequence number, extracted from the predefined sequence count field in the CAN message data field; ④ CRC check result, reading the pass / fail status bit of the CAN controller hardware CRC check register; ⑤ Message status, including the current cumulative value of the bus error counter (TEC / REC) and the bus offline status flag. All five types of parameters are collected directly from the CAN controller register inside the ECU, without the need for additional external sensors, and the acquisition delay does not exceed one CAN bit time (approximately 2μs at a 500kbps baud rate). The transmission delay of the current message can be calculated based on the difference between the message sending timestamp and the receiving timestamp; the number of lost frames can be calculated based on the difference in message sequence numbers within adjacent acquisition periods; and the CRC error rate can be calculated based on the cumulative statistics of CRC check results. Theoretically, these parameters correspond to the propagation delay characteristics, channel continuity characteristics, and signal integrity characteristics of the CAN bus, respectively. Together, these three constitute a complete feature space for channel quality assessment, providing a numerical basis for subsequent weighted fusion calculations.
[0022] The message transmission delay (obtained from the difference between the sending and receiving timestamps) is mapped to the [0,1] interval, with the mapping value set to zero when the delay exceeds 10ms and to 1 when the delay is 0ms, serving as the linear mapping boundary. The frame loss rate (obtained from the continuity of message sequence numbers) is linearly mapped with a mapping value of 1 when the frame loss rate is 0% and to zero when the frame loss rate is not less than 5%. The CRC check error rate is mapped with a mapping value of 1 when the error rate is 0% and to zero when the error rate is not less than 2%. The bus error counter (TEC / REC) is mapped with a mapping value of 1 when the count value is 0 and to zero when the count value reaches 127 (passive error threshold). The above four types of normalized sub-scores are weighted and summed according to preset weight coefficients, with the weight allocation as follows: frame loss rate sub-score weight 0.40, CRC check error rate sub-score weight 0.30, transmission delay sub-score weight 0.20, bus error counter sub-score weight 0.10, and the sum of the weight coefficients is 1.0. The weighted summation result is linearly scaled by multiplying by 100, and the output is a communication status evaluation value ranging from 0 to 100. The higher the evaluation value, the better the channel quality, thus realizing lossless fusion of multi-dimensional features into a single evaluation value.
[0023] The first preset evaluation threshold is set to 70, and the second preset evaluation threshold is set to 30. These two thresholds define three state intervals. When the communication status evaluation value of the main communication channel is not lower than 70, the channel is determined to be in a normal state, and the system maintains the current communication link unchanged and continues to perform periodic monitoring at a 20ms acquisition cycle. When the communication status evaluation value is lower than 70 but not lower than 30, the channel is determined to be in a degraded state, and the system sends a degrade warning signal to the upper-level application of the ECU. At the same time, the pre-activation process of the backup communication channel is started, and a handshake probe frame is sent to the backup channel to confirm that the backup channel is in a ready state. When the communication status evaluation value is lower than 30, the channel is determined to be in a failed state, and the communication link switching process is immediately triggered. The theoretical basis for the above three-level threshold division is as follows: In the research on the reliability of CAN bus communication, a frame loss rate exceeding 2% or a CRC error rate exceeding 1% can have a perceptible impact on the real-time control of the upper-layer application, and the corresponding evaluation value will fall below 70, triggering a degradation warning; while when the frame loss rate exceeds 5% or the bus enters a passive error state, the channel can no longer carry normal service messages, and the corresponding evaluation value will fall below 30, requiring immediate switching.
[0024] After determining that the main communication channel has failed, a seamless handover process based on communication route pointer switching and receive buffer freezing mechanisms is executed. The handover process is performed in the following three stages: The first stage is the freeze of the receive buffer. The system immediately freezes the receive buffer (Buffer_A) corresponding to the main communication channel, stops new data writing operations to the buffer, and at the same time retains the residual data packets that have been received but have not yet been read and processed by the upper layer application in the buffer. The sequence number and receive timestamp of each residual packet are recorded as the reference index for subsequent data connection.
[0025] The second stage is the routing pointer switching. The communication routing pointer is mapped from the main communication channel (CAN Controller A) to the backup communication channel (CAN Controller B). The pointer switching operation is completed within a single instruction cycle of the ECU's internal register write operation (approximately 10ns at a 100MHz main frequency). The switching process does not interrupt the operation of the ECU's message processing thread, achieving seamless connection of message transmission and reception paths.
[0026] The third stage is the migration of residual packets. After the routing pointer switch is completed, the residual data packets frozen in Buffer_A are sequentially written into the receive buffer (Buffer_B) corresponding to the backup communication channel according to the packet sequence number. This ensures that the packet sequence before and after the switch remains continuous on the backup channel side, eliminating data gaps caused by channel switching. The total switching time of the above three stages is controlled within the nominal transmission period of a single packet (20ms in this embodiment), and is transparent to the upper-layer applications of the ECU and BMS, achieving a seamless switching process.
[0027] After the communication link switch is completed, timestamp alignment and sequence consistency verification are performed on the data packets received by the backup communication channel in order to reconstruct the complete communication data stream and restore normal communication between the ECU and BMS.
[0028] The timestamp alignment process specifically involves extracting the received timestamp T_last of the last processed message frame before the main communication channel switchover and the received timestamp T_first of the first newly received message frame after the backup communication channel switchover is completed. The channel switching time offset ΔT = T_first - T_last is then calculated. The timestamps of all subsequent messages received through the backup channel are linearly compensated and corrected according to ΔT to ensure that the backup channel message timestamps are aligned with the system's unified clock reference (provided by the ECU's internal RTC with an accuracy of ±1ms), thereby generating a timestamp-aligned message sequence.
[0029] The sequence consistency verification process specifically involves checking the continuity of the sequence numbers of each message in the timestamp-aligned message sequence, comparing the difference between the current message sequence number and the previous message sequence number frame by frame, and determining that a missing message exists when the difference is greater than 1. For the detected missing messages, the mirror data in the Buffer_A frozen buffer area in step five is called to complete the data according to the sequence number index. If the corresponding sequence number of the message does not exist in the mirror data, a retransmission request frame is sent to the BMS side to request the BMS to retransmit the key status data (including core parameters such as battery SOC, SOH and single cell voltage) within the corresponding sequence number interval. After the data completion is completed, the repaired complete message sequence is re-injected into the data processing queue of the upper-layer application of the ECU, the communication data stream is rebuilt, and the normal closed-loop communication between the ECU and the BMS is restored. The entire recovery process takes no more than 3 acquisition cycles (i.e., 60ms).
[0030] In one embodiment, the periodic communication data acquisition specifically involves: setting a fixed sampling period, and collecting message sending timestamps, message receiving timestamps, message sequence numbers, CRC check results, and message status for the main communication channel and the backup communication channel, respectively, to obtain the communication characteristic parameters of each channel.
[0031] In this embodiment, a fixed sampling period of ten milliseconds is set. The timing trigger module inside the electronic control unit performs dual-channel synchronous acquisition periodically, ensuring that the main communication channel and the backup communication channel acquire data under a unified time reference. The sampling time deviation is controlled within the millisecond range to reduce the impact of asynchronous sampling on the consistency of feature data. Within each sampling period, message parsing processing is performed on the main and backup communication channels to obtain message sending and receiving time information. The sending time information comes from the timestamp at the message generation end, and the receiving time information comes from the hardware time recording module at the receiving end of the electronic control unit. The difference between the sending and receiving times characterizes the communication transmission delay characteristics, reflecting changes in the link's real-time performance. Message sequence numbers are extracted, and continuous sequence numbers are compared for integrity to identify missing and out-of-order messages. A fixed-length sliding statistical window is used to statistically analyze sequence changes over multiple consecutive sampling periods to enhance the ability to identify transient anomalies. Cyclic redundancy check (CRUD) results are parsed, and messages failing the check are marked as abnormal data and included in the error statistics to characterize the reliability level of the communication link. The message status field is parsed to distinguish communication status types such as normal reception, erroneous reception, timeout without response, and retransmission. A set of communication characteristic parameters is formed through the structured integration of time information, sequence information, checksum information, and status information. This parameter supports subsequent communication status assessment and redundancy switching control processes, and provides fundamental data support for the reliability of control command transmission in low-power, constant temperature and humidity control applications in explosion-proof storage compartments.
[0032] In one embodiment, such as Figure 3As shown, the specific steps for weighted calculation of each communication channel based on the communication characteristic parameters to obtain the communication status evaluation value of the main communication channel and the backup communication channel are as follows: For each of the communication feature parameters, a corresponding normalization mapping function is set to obtain multiple standardized feature values; The communication status evaluation values of the main communication channel and the backup communication channel are obtained by weighted fusion calculation of multiple standardized feature values.
[0033] In this embodiment, the standardization process for communication feature parameters is implemented based on a unified dimensional mapping mechanism. For different types of communication feature parameters, including transmission delay, frame loss, cyclic redundancy check (CRC) results, and message status, corresponding normalized mapping functions are constructed to convert the original discrete quantities into standardized feature values of a unified scale. Transmission delay parameters have their upper and lower boundaries determined based on historical statistical intervals, and an interval compression mapping method is used to map the actual delay to a continuous interval from zero to one hundred, where a smaller delay corresponds to a higher value. Frame loss rate and error rate parameters are normalized using a proportional mapping method, making them inversely related to communication quality. Message status parameters are assigned discrete values according to status levels, and then continuous mapping is performed to reduce the impact of sudden state changes on the overall evaluation. After standardization, multiple standardized feature values are fused. The fusion process is implemented using a weighted accumulation model, with each feature item configured with a corresponding weight coefficient. Frame loss rate and CRC error items have relatively high weights to reflect their dominant influence on communication reliability. The weight coefficients are preset based on system security level requirements and remain fixed during operation. The basic evaluation value of the communication state is obtained by summing the products of each standardized feature value and the weight coefficient.
[0034] In one embodiment, the weighted fusion calculation specifically involves: setting calculation weights for multiple standardized feature values, performing weighted summation, linearly scaling the weighted summation result, and outputting a communication status evaluation value.
[0035] In this embodiment, the weighted fusion calculation of multiple standardized feature values is implemented based on a multi-index comprehensive evaluation model. The standardized feature values are derived from the normalized results of communication transmission delay, frame loss rate, cyclic redundancy check error rate, and message status, all mapped to a unified evaluation scale range. For the different importance of different feature dimensions, corresponding calculation weights are set, with higher weights for communication transmission delay and cyclic redundancy check error rate to highlight the critical impact of communication real-time performance and reliability on system stability, followed by frame loss rate and message status. Each standardized feature value is multiplied by its corresponding weight, and all product results are accumulated to form the basic evaluation result of the communication status. This process is essentially a linear weighted summation model, its mathematical significance being to map multi-dimensional heterogeneous communication quality indicators to a single scalar evaluation space, thereby achieving a unified quantitative expression of different communication anomalies. Based on this, a linear scaling mechanism is introduced to proportionally map the weighted summation result according to a preset range, ensuring that the evaluation value is stably output within the standard evaluation range of zero to one hundred, avoiding distortion of the evaluation results due to excessive fluctuations in the original features. The linear scaling process is based on interval mapping theory. By setting upper and lower bounds corresponding to the theoretically optimal and worst communication states, intermediate calculation results are proportionally compressed or expanded, ensuring the final output value remains monotonic and comparable. This mechanism enhances the stability of evaluation values under different operating conditions, enabling communication quality evaluation results to have cross-cycle consistency.
[0036] In one embodiment, such as Figure 4 As shown, the step of comparing the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status specifically involves: Set a first preset evaluation threshold and a second preset evaluation threshold. The first preset evaluation threshold has a value range of 60 to 80, and the second preset evaluation threshold has a value range of 20 to 40. When the communication status evaluation value of the main communication channel is not lower than the first preset evaluation threshold, the communication channel is determined to be in normal status. When the communication status evaluation value of the main communication channel is lower than the first preset evaluation threshold and not lower than the second preset evaluation threshold, the communication channel is determined to be in a degraded state. When the communication status evaluation value of the main communication channel is lower than the second preset evaluation threshold, the communication channel is determined to be in a failed state.
[0037] In this embodiment, the process of comparing the communication status evaluation value of the main communication channel with the preset evaluation threshold is implemented based on a hierarchical judgment mechanism. The communication status evaluation value is obtained by pre-calculated weighted fusion, and its value range is uniformly mapped to 0 to 100, used to characterize the reliability level of the communication link. The preset evaluation threshold adopts a dual-threshold structure, including a first preset evaluation threshold and a second preset evaluation threshold. The first preset evaluation threshold ranges from 60 to 80, and the second preset evaluation threshold ranges from 20 to 40, used to construct a hierarchical evaluation system for communication status. During the judgment process, the evaluation value of the main communication channel in the current sampling period is compared with the first preset evaluation threshold. When the evaluation value is not lower than the first preset evaluation threshold, it indicates that the communication link is in a high-reliability operating range. At this time, the communication frame loss rate, transmission delay, and cyclic redundancy check error are all at low levels. The system determines that the communication channel is in a normal state and maintains continuous communication of the main communication channel. When the evaluation value is below the first preset evaluation threshold but not below the second preset evaluation threshold, the communication link is in the intermediate degradation range, corresponding to fluctuations in communication quality but not reaching the failure condition. At this time, the communication channel is determined to be in a degraded state and enters continuous monitoring mode, performing trend analysis on the subsequent 3 to 5 sampling periods to determine whether the communication quality continues to deteriorate. When the evaluation value is below the second preset evaluation threshold, the reliability of the communication link drops below the safe operating limit, corresponding to abnormal characteristics such as increased frame loss rate and frequent cyclic redundancy check errors. At this time, the communication channel is determined to be in a failure state, triggering the redundancy channel switching condition.
[0038] In one embodiment, the communication route pointer switching specifically involves: when the primary communication channel is detected to be faulty, freezing the receive buffer corresponding to the primary communication channel; mapping the communication route pointer from the primary communication channel to the backup communication channel; unfreezing the receive buffer corresponding to the backup communication channel, and allowing the backup communication channel to continue performing subsequent message sending and receiving operations.
[0039] In this embodiment, upon detecting a failure of the main communication channel, the system enters a communication route reconstruction process. The failure determination result of the main communication channel is output by the preceding communication status evaluation module. When the evaluation value is lower than the second preset evaluation threshold in the range of 20 to 40 and continues to meet the threshold for 3 sampling periods, a switching flag is triggered. This mechanism is used to avoid erroneous switching caused by transient communication jitter, thereby ensuring the stability and determinism of the switching action. A freeze operation is performed on the receive buffer corresponding to the main communication channel. The freeze operation is implemented based on a buffer locking mechanism, which stops writing new message data to the current buffer, retains only the message data structure that has been received but not yet processed, and performs status marking and sequence number fixation on it, thereby preventing data overwriting or out-of-order writing during channel switching. A communication route pointer remapping operation is performed, switching the logical route pointer that originally pointed to the main communication channel to the backup communication channel. This route pointer is used to control the logical binding relationship between the message receiving entry and the parsing entry. By modifying the pointer mapping relationship, the system communication entry is switched from the main channel to the backup channel, realizing the dynamic reconstruction of the communication path. The receive buffer corresponding to the backup communication channel is unfrozen, restoring its normal data writing capability, and the backup channel message receiving and parsing process is initiated. During this process, the backup communication channel continuously performs message receiving, timestamp recording, and sequence number parsing operations, thereby taking over all communication tasks of the original primary communication channel.
[0040] In one embodiment, the receive buffer freezing mechanism specifically involves: temporarily storing unprocessed data packets in the main communication channel during communication switching, and recording the packet sequence number and timestamp information of the data packets; after the communication route pointer switching is completed, writing the unprocessed data packets into the receive buffer area corresponding to the backup communication channel in sequence according to the packet sequence number.
[0041] In this embodiment, a freeze control is implemented on the main communication channel's receive buffer, a process based on buffer state locking and data temporary storage mechanisms. When the system detects that the main communication channel is in a failed state and meets the confirmation condition for three consecutive sampling cycles, the current write operation to the receive buffer is immediately interrupted, putting the buffer into a read-only state, prohibiting new packets from overwriting, and only allowing the retention of received but not yet processed data. The unprocessed data packets in the main communication channel buffer are extracted in a structured manner, including the packet sequence number and corresponding timestamp information. The packet sequence number describes the logical communication order, and the timestamp information characterizes the time consistency between packet generation and reception. By sequentially marking the sequence numbers, a temporary ordered data queue can be constructed to maintain the temporal continuity of communication data. After the communication routing pointer completes the switch from the main communication channel to the backup communication channel, the freeze state of the backup communication channel's receive buffer is lifted, allowing it to enter normal write mode. Subsequently, the unprocessed packet data temporarily stored during the freeze period is sorted in ascending order according to the packet sequence number and written sequentially to the corresponding buffer of the backup communication channel according to the sequence continuity rules, achieving smooth data migration.
[0042] In one embodiment, the step of performing timestamp alignment and sequence consistency verification on the data received through the backup communication channel to reconstruct and restore communication between the electronic control unit (ECU) and the BMS specifically includes: acquiring the sequence of data packets received through the backup communication channel; reordering the data packets according to their timestamps; performing sequence integrity verification based on the packet sequence number; when a missing packet is detected, using mirrored data from the buffer to complete the data; and reconstructing the communication data stream after data completion and restoring normal communication between the ECU and the BMS.
[0043] In this embodiment, the process of timestamp alignment and sequence consistency verification of data received through the backup communication channel is implemented based on a data reconstruction and consistency recovery mechanism. After taking over the communication task, the backup communication channel continuously receives message data at a fixed sampling period of ten milliseconds and initially stores the received messages in the order they enter the receive buffer, forming an original message sequence set. Each message carries sending and receiving time information for subsequent timing analysis and consistency judgment. A time axis reference system is established based on the receiving time information. The difference between the sending and receiving times of each message is calculated, and the messages are reordered according to the size of the time difference to ensure that the message sequence satisfies a monotonically increasing time relationship, thereby eliminating time misalignment problems caused by communication switching or link jitter. This process is implemented based on a time consistency constraint model to ensure the continuity of data in the time dimension. Sequence consistency verification is performed on the reordered message sequence, and data integrity is detected by the message sequence number continuity rule. When a break in the message sequence number is detected, it is determined as a missing message event, and the missing data recovery mechanism is triggered. Missing data is retrieved from the mirrored buffer retained during the freeze phase. This buffer stores message data that was not processed before the main communication channel switchover, and the missing data is supplemented according to the message sequence number matching rules. The communication data stream is reconstructed for all messages, restoring it to a continuous and ordered logical communication sequence, and then rewritten into the receiving and processing link of the backup communication channel. This reconstruction process ensures the consistency of control commands and status feedback data in terms of structure and timing, thereby restoring the normal communication loop between the electronic control unit and the BMS.
[0044] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0045] In one embodiment, a dual-redundant channel automatic switching communication system for electronic control and BMS is provided. This device corresponds one-to-one with the dual-redundant channel automatic switching communication method for electronic control and BMS described in the above embodiments. The device includes: The acquisition unit is used to establish a main communication channel and a backup communication channel between the electronic control unit and the BMS; and to periodically acquire communication data from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel. The calculation unit is used to perform weighted calculations on each communication channel based on the communication characteristic parameters to obtain the communication status evaluation value of the main communication channel and the backup communication channel. The status determination unit is used to compare the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status. The switching unit is used to control the communication link to switch from the main communication channel to the backup communication channel when it is determined that the main communication channel is in a failed state. It achieves a smooth switching based on the communication route pointer switching and receive buffer freezing mechanism. The verification unit is used to perform timestamp alignment and sequence consistency verification on the data received by the backup communication channel after the communication switch is completed, so as to complete the reconstruction of the communication data between the electronic control and BMS and the communication recovery.
[0046] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0047] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0048] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.
[0049] The aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), or field-programmable gate arrays (FPGAs). Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0050] The memory can be an internal storage unit of the computer device, such as a hard drive or RAM. The memory can also be an external storage device of the computer device, such as a plug-in hard drive, SmartMediaCard (SMC), SecureDigital (SD) card, or FlashCard. Furthermore, the memory can include both internal and external storage units of the computer device.
[0051] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0052] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0053] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0054] In the embodiments provided in this application, it should be understood that the disclosed apparatus / devices and methods can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0055] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0056] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for automatic switching communication between dual redundant channels of electronic control and BMS, characterized in that, Includes the following steps: A main communication channel and a backup communication channel are established between the electronic control unit and the BMS; periodic communication data are collected from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel; Based on the aforementioned communication characteristic parameters, a weighted calculation is performed on each communication channel to obtain the communication status evaluation value of the main communication channel and the backup communication channel. The communication status evaluation value of the main communication channel is compared with the preset evaluation threshold to determine the communication channel status; When the main communication channel is determined to be in a failed state, the control communication link is switched from the main communication channel to the backup communication channel, and the seamless switching is achieved based on the communication route pointer switching and receive buffer freezing mechanism. After the communication switch is completed, the data received through the backup communication channel is timestamped and the sequence consistency is checked in order to rebuild the communication data between the electronic control system and the BMS and restore the communication.
2. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The main communication channel uses a first CAN bus controller and its corresponding first differential signal transmission line; the backup communication channel uses a second CAN bus controller and its corresponding second differential signal transmission line; the first CAN bus controller and the second CAN bus controller are respectively mounted on different bus nodes inside the electronic control unit, and their power supply circuits, ground circuits and terminal matching resistors are isolated from each other, so that the normal operation of the other channel is not affected when a physical layer short circuit or open circuit fault occurs in any channel.
3. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The periodic communication data acquisition specifically involves: setting a fixed sampling period, and collecting message sending timestamps, message receiving timestamps, message sequence numbers, CRC check results, and message status for the main communication channel and the backup communication channel, respectively, to obtain the communication characteristic parameters of each channel.
4. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The specific steps for weighted calculation of each communication channel based on the communication characteristic parameters to obtain the communication status evaluation value of the main communication channel and the backup communication channel are as follows: For each of the communication feature parameters, a corresponding normalization mapping function is set to obtain multiple standardized feature values; By performing weighted fusion calculations on multiple standardized feature values, the communication status evaluation values of the main communication channel and the backup communication channel are obtained.
5. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 4, characterized in that, The weighted fusion calculation specifically involves: setting calculation weights for multiple standardized feature values, performing weighted summation, linearly scaling the weighted summation result, and outputting a communication status evaluation value.
6. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The step of comparing the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status specifically involves: Set a first preset evaluation threshold and a second preset evaluation threshold. The first preset evaluation threshold has a value range of 60 to 80, and the second preset evaluation threshold has a value range of 20 to 40. When the communication status evaluation value of the main communication channel is not lower than the first preset evaluation threshold, the communication channel is determined to be in normal status. When the communication status evaluation value of the main communication channel is lower than the first preset evaluation threshold and not lower than the second preset evaluation threshold, the communication channel is determined to be in a degraded state. When the communication status evaluation value of the main communication channel is lower than the second preset evaluation threshold, the communication channel is determined to be in a failed state.
7. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The communication route pointer switching is specifically as follows: when the failure of the main communication channel is detected, the receiving buffer corresponding to the main communication channel is frozen; the communication route pointer is mapped from the main communication channel to the backup communication channel; the frozen state of the receiving buffer corresponding to the backup communication channel is released, and the backup communication channel continues to perform subsequent message sending and receiving operations.
8. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 1, characterized in that, The receive buffer freezing mechanism specifically involves: temporarily storing unprocessed data packets in the main communication channel during communication switching, and recording the packet sequence number and timestamp information; after the communication route pointer switching is completed, writing the unprocessed data packets into the receive buffer area corresponding to the backup communication channel in sequence according to the packet sequence number.
9. The automatic switching communication method for dual redundant channels of electronic control and BMS according to claim 8, characterized in that, The process of performing timestamp alignment and sequence consistency verification on the data received through the backup communication channel to reconstruct and restore communication between the electronic control unit (ECU) and the BMS includes: acquiring the sequence of data packets received through the backup communication channel; reordering the data packets according to their timestamps; performing sequence integrity verification based on the packet sequence number; when a missing packet is detected, using mirrored data from the buffer to complete the data; and reconstructing the communication data stream after data completion and restoring normal communication between the ECU and the BMS.
10. A communication system with dual redundant channels for electronic control and BMS automatic switching, characterized in that, The steps for implementing the automatic switching communication method for dual redundant channels of electronic control and BMS as described in any one of claims 1 to 9 include: The acquisition unit is used to establish a main communication channel and a backup communication channel between the electronic control unit and the BMS; and to periodically acquire communication data from the main communication channel and the backup communication channel to obtain the communication characteristic parameters of each channel. The calculation unit is used to perform weighted calculations on each communication channel based on the communication characteristic parameters to obtain the communication status evaluation value of the main communication channel and the backup communication channel; The status determination unit is used to compare the communication status evaluation value of the main communication channel with a preset evaluation threshold to determine the communication channel status. The switching unit is used to control the communication link to switch from the main communication channel to the backup communication channel when it is determined that the main communication channel is in a failed state. It achieves a smooth switching based on the communication route pointer switching and receive buffer freezing mechanism. The verification unit is used to perform timestamp alignment and sequence consistency verification on the data received by the backup communication channel after the communication switch is completed, so as to complete the reconstruction of the communication data between the electronic control and BMS and the communication recovery.
