A method, system, and vehicle for detecting message cycle in a CAN FD network.

By employing a dynamic threshold adaptive mechanism and an anomaly counter in the CAN FD network, the problems of poor adaptability and high false alarm rate of the fixed threshold method in message period detection are solved, achieving sensitive detection of gradual faults and a low false alarm rate.

CN123123201APending Publication Date: 2026-11-17CHERY AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610964405.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing CAN FD network message period detection methods, the fixed threshold method cannot adapt to network jitter under different operating conditions, resulting in a high false alarm rate and the inability to identify gradual faults.

Method used

A dynamic threshold adaptive mechanism based on historical data is adopted. By calculating the real-time period, average value and dispersion of the message ID, a dynamic threshold range is generated. Combined with an anomaly counter and an online adaptive learning mechanism, message period anomalies are determined.

Benefits of technology

It achieves high accuracy and low false alarm rate in message cycle detection under different operating conditions, can identify gradual faults, avoid false alarms caused by occasional disturbances, and track the slow changing trend of message cycle in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123201A_ABST
    Figure CN123123201A_ABST
Patent Text Reader

Abstract

This invention proposes a message period detection method, system, and vehicle for CAN FD networks, belonging to the field of automotive electronic network communication technology. The method includes: monitoring and capturing CAN FD messages of the vehicle system, recording the message ID and timestamp of the CAN FD messages; calculating the real-time period corresponding to the message ID; storing the real-time period in a historical period queue corresponding to the message ID; calculating the average value and dispersion based on the historical period queue, and generating a dynamic threshold range; determining whether the real-time period is within the dynamic threshold range; if the real-time period exceeds the dynamic threshold range, incrementing the anomaly counter corresponding to the message ID; if the real-time period is within the dynamic threshold range, resetting the anomaly counter; and when the anomaly counter reaches a preset condition, determining that the period corresponding to the message ID is abnormal and reporting it. This invention reduces the false alarm rate and improves the sensitivity of gradual fault detection through adaptive adjustment of the dynamic threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automotive electronic network communication technology, and particularly relates to a message cycle detection method, system and vehicle for CAN FD network. Background Technology

[0002] With the increasing electrification and intelligence of automobiles, the number of electronic control units (ECUs) inside vehicles is growing daily. CAN FD bus, due to its higher communication speed and greater data load capacity, has become the mainstream technology for next-generation vehicle network architecture. Each ECU node in the network sends messages according to a preset cycle. The stability of this message cycle is a key indicator for assessing network health and normal node function. Abnormal cycles are often early signs of ECU software failure, hardware aging, or network overload.

[0003] Existing message cycle detection methods mostly employ a fixed threshold method, which involves pre-setting a fixed cycle range and comparing the measured cycle with this range. However, this method cannot detect subtle anomalies caused by network jitter under different operating conditions, nor can it identify gradual faults. Summary of the Invention

[0004] To overcome the shortcomings of the prior art, this invention proposes a message cycle detection method, system, and vehicle for CAN FD networks, in order to solve the technical problems of poor adaptability, high false alarm rate, and inability to identify gradual faults in the fixed threshold method of the prior art.

[0005] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions: In a first aspect, the present invention discloses a message periodicity detection method for a CAN FD network, comprising: Listen to and capture CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD message; Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; store the real-time period in the historical period queue corresponding to the message ID; The average value and dispersion are calculated based on the historical periodic queue, and a dynamic threshold range is generated; it is determined whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, the anomaly counter corresponding to the message ID is incremented; if the real-time period is within the dynamic threshold range, the anomaly counter is reset. When the anomaly counter reaches a preset condition, the periodic anomaly corresponding to the message ID is determined and reported.

[0006] A further technical solution, specifically the dynamic threshold range: Using the standard deviation as the degree of dispersion, a dynamic threshold range is generated based on the standard deviation and the arithmetic mean. Alternatively, an improved dynamic threshold generation method based on fusion index weighted moving average and quantile dispersion estimation can be used to generate the dynamic threshold range.

[0007] A further technical solution is that the dynamic threshold range generated based on the standard deviation and arithmetic mean is: [μ-kσ,μ+kσ], where k is the standard deviation multiplier, μ is the arithmetic mean, and σ is the standard deviation.

[0008] A further technical solution is that the improved dynamic threshold generation method generates a dynamic threshold range of: [μ] t -γ·σ_mad1,μ t +γ·σ_mad2], where γ is the expansion coefficient, μ t Let σ_mad1 be the P1 percentile and σ_mad2 be the P2 percentile.

[0009] A further technical solution employs an exponentially weighted moving average to calculate the dynamic mean, and the update formula for the dynamic mean is as follows:

[0010] Where, μ t μ is the mean of the EWMA at the current time. t-1 The dynamic mean of the previous time step; α is the smoothing factor, and T_current is the real-time periodic value; The period dispersion is estimated by using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted to obtain the P1 percentile and P2 percentile as the dispersion.

[0011] A further technical solution, when the anomaly counter reaches a preset condition, determines and reports the periodic anomaly corresponding to the message ID, further includes: The over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0012] Secondly, this invention discloses a message periodicity detection system for a CAN FD network, comprising: The message capture module is configured to: listen for and capture CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD message; The data processing module is configured to: calculate the real-time period corresponding to the message ID, wherein the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; and store the real-time period in the historical period queue corresponding to the message ID. The threshold generation module is configured to: calculate the average value and dispersion based on the historical periodic queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range; if the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID; if the real-time period is within the dynamic threshold range, reset the anomaly counter. The anomaly determination module is configured to: determine the periodic anomaly corresponding to the message ID and report it when the anomaly counter reaches a preset condition.

[0013] Thirdly, the present invention discloses a vehicle including a memory and a processor, as well as computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, complete the steps of the above-described CAN FD network message period detection method.

[0014] Fourthly, the present invention discloses a computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of the above-described CAN FD network message period detection method.

[0015] Fifthly, the present invention discloses a computer program product comprising executable instructions stored in a computer-readable storage medium; wherein, when the vehicle's processor reads and executes the executable instructions from the computer-readable storage medium, it completes the steps of the above-mentioned CAN FD network message period detection method.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention utilizes a dynamic threshold adaptive mechanism based on historical data statistical characteristics to automatically learn the normal fluctuation range of the message cycle. The statistical center parameter tracks the central trend of the cycle to adapt to the normal drift of the cycle caused by changes in node hardware characteristics or working environment, while the statistical dispersion parameter quantifies the degree of fluctuation of the cycle to adapt to changes in network operating status. This overcomes the poor adaptability of the existing fixed threshold method and maintains high accuracy and low false alarm rate under different operating conditions.

[0017] This invention, through the design of anomaly counting logic, determines and reports periodic anomalies only when the anomaly counter reaches a preset condition. This effectively filters out transient overshoots caused by occasional disturbances while maintaining sensitive detection of genuine, persistent anomalies, thus overcoming the high false alarm rate of existing fixed threshold methods. This mechanism avoids false alarms caused by occasional interference and can promptly detect persistent faults.

[0018] This invention can track the slow changing trend of the message cycle in real time, and the statistical center parameters can be automatically updated with the gradual changing trend of the cycle, thereby overcoming the defect that the existing fixed threshold method cannot identify gradual faults and has higher detection sensitivity for fault types with slow changing cycles.

[0019] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0020] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0021] Figure 1 This is a flowchart of the message period detection method for CAN FD network described in Embodiment 1 of the present invention.

[0022] Figure 2 This is a diagram illustrating the effect of the dynamic threshold described in Embodiment 1 of the present invention.

[0023] Figure 3 This is a block diagram of the message period detection system for the CAN FD network described in Embodiment 1 of the present invention. Detailed Implementation

[0024] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0025] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations of the present invention.

[0026] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0027] The fixed-threshold message periodicity detection method used in CAN FD networks has significant drawbacks, as detailed below: First, it has poor adaptability. The fixed tolerance is difficult to adapt to network jitter under different operating conditions. When the network load is light, it may be too lenient and fail to detect minor anomalies. When the network load is heavy, it may be too strict and generate a large number of false alarms.

[0028] Secondly, the false alarm rate is high. Due to factors such as temperature changes and power fluctuations, the crystal oscillator frequency of the ECU will drift slightly, resulting in slow and slight changes in the message cycle during long-term operation. The fixed threshold method cannot learn this normal drift, thus misjudging it as abnormal.

[0029] Furthermore, it cannot identify gradual faults, and the fixed threshold method is difficult to detect fault types with slow periodic changes in a timely manner.

[0030] Therefore, a message periodicity detection method that can adapt to changes in network state, accurately distinguish between normal jitter and real anomalies, and has a low false alarm rate is needed.

[0031] Example 1 In one or more embodiments, a message period detection method for a CAN FD network is disclosed, such as... Figure 1 As shown, it includes the following steps: Step S100: The system starts up and initializes the historical periodic queues and thresholds for each message ID.

[0032] In this embodiment, when the system starts up, a fixed threshold [T_nominal-ΔT, T_nominal+ΔT] is used as the initial threshold, where T_nominal is the nominal period corresponding to the message ID, and ΔT is a fixed tolerance, which is 3% to 10% of the nominal period T_nominal, preferably 5%. As the FIFO historical period queue is filled, it gradually transitions to the dynamic threshold range.

[0033] Step S101: Listen to and capture the CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD messages.

[0034] Specifically, the hardware CAN FD controller is responsible for the transmission and reception of messages at the physical layer and data link layer, as well as the recording of timestamps, thereby capturing each frame of messages from the bus.

[0035] It should be understood that the CAN FD network bus is the communication medium for the entire vehicle network.

[0036] Step S102: Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; store the real-time period in the FIFO historical period queue corresponding to the message ID.

[0037] Step S1021: Calculate the real-time period.

[0038] For the current message ID, subtract the timestamp of the last time the message with that ID was received from the current timestamp to obtain the real-time period value T_current.

[0039] Step S1022: Update the historical periodic queue.

[0040] Store the real-time periodic value T_current into the historical periodic queue (FIFO) corresponding to this ID.

[0041] In this embodiment, the length of the historical periodic queue is 50 to 200.

[0042] Step S103: Calculate the average value and standard deviation based on the FIFO historical period queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID. If the real-time period is within the dynamic threshold range, reset the anomaly counter.

[0043] Step S1031: Calculate the dynamic threshold: Based on the historical periodic queue, calculate the average value and dispersion, and generate the dynamic threshold range.

[0044] As one implementation method, the average value μ is the arithmetic mean, calculated using the following formula:

[0045] Where T represents all period values ​​in the historical period queue; N represents the length of the historical period queue.

[0046] Using standard deviation as the dispersion, the formula for calculating the standard deviation σ is:

[0047] The dynamic threshold range is [μ-kσ,μ+kσ], where k is the standard deviation multiplier, preferably ranging from 2 to 5.

[0048] like Figure 2As shown, if a fault in an ECU causes significant fluctuations in the cycle, resulting in a potentially abnormal cycle, the fixed threshold method will immediately trigger an alarm, indicating a possible accidental strong network interference. The dynamic threshold method, however, will record this exceedance, but if the subsequent message cycle returns to normal, it will not immediately trigger an alarm due to its continuous / cumulative judgment logic, thus avoiding false alarms caused by a single sudden interference. If the ECU fault persists and the cycle stabilizes within the potentially abnormal cycle, the dynamic threshold method, after several learning iterations, will gradually converge its mean towards the potentially abnormal cycle, and the threshold range will adjust accordingly. However, if the fault cycle becomes extremely unstable, such as a sharp increase in the standard deviation σ, even if the mean value does not change significantly, the dynamic threshold range will narrow or remain stable, thus enabling sensitive detection of this instability.

[0049] As another implementation method, an improved dynamic threshold generation method using fusion exponentially weighted moving average (EWMA) and quantile dispersion estimation is used to generate the dynamic threshold range.

[0050] The dynamic mean μ is calculated using an exponentially weighted moving average. t The dynamic mean μ t The update formula is:

[0051] Where, μ t μ is the mean of the EWMA at the current time. t-1 α is the dynamic mean of the previous moment; α is the smoothing factor, with a value range of 0 < α < 1, and an optimal range of 0.05 to 0.3. The smoothing factor α is used to adjust the weight of recent data in the calculation of the dynamic mean. The larger the value of α, the higher the weight of recent data, and the faster the mean responds to periodic changes, but the weaker the ability to suppress occasional fluctuations. The smaller the value of α, the higher the weight of historical data, and the smoother and more stable the mean, but there is a lag in tracking periodic trend changes.

[0052] When using the exponentially weighted moving average method, only the dynamic mean of the previous time step needs to be stored, without the need to store the complete historical queue, and the computational complexity is O(1).

[0053] The period dispersion is estimated using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted, and the P1 percentile σ_mad1 and the P2 percentile σ_mad2 are calculated, where the P1 percentile is the lower quantile (preferably P1=10) and the P2 percentile is the upper quantile (preferably P2=90).

[0054] By combining the above dynamic mean and dispersion, the dynamic threshold range is constructed as: [μ t -γ·σ_mad1,μ t+γ·σ_mad2], where γ is the expansion coefficient.

[0055] The advantages of using the quantile method in this embodiment are: firstly, it has natural robustness to abnormal historical periods in the queue, because the impact of extreme values ​​on percentiles depends only on their ranking rather than their numerical value, and will not widen the threshold range due to a single historical outlier; secondly, it does not require assuming that the periodic data follows a normal distribution, and is equally applicable to skewed or multimodal distributions that may occur in actual vehicle networks.

[0056] Furthermore, a lightweight online adaptive learning mechanism is introduced to dynamically adjust the smoothing factor α and coefficient γ based on the actual anomaly detection feedback during system operation, thereby continuously optimizing the threshold generation parameters.

[0057] The specific implementation of online adaptive learning is as follows: First, maintain a sliding statistical window of length M, preferably M=200 frames. Then, estimate the number of false alarms F within the statistical window. fp That is, the number of frames that are within the threshold range but are subsequently identified as abnormal; and the estimated number of missed detections F. fn This refers to the number of frames that exceeded the threshold range but were subsequently confirmed as normal. Based on F... fp and F fn Update the parameters according to the following rules: If F fp / M exceeds the upper limit threshold for false alarm rate θ fp θ is preferred fp =0.5%, indicating that the current threshold range is too narrow. The system should appropriately increase the value of γ, γ = γ + Δγ, Δγ = 0.05, and at the same time appropriately decrease the value of α, α = α × 0.95, so as to make the mean smoother and the threshold range moderately expanded. If F fn If / M exceeds the upper limit threshold θfn of the false negative rate, preferably θfn=0.1%, it indicates that the current threshold range is too wide. The system should appropriately reduce the value of γ, γ = γ - Δγ, Δγ=0.05, and at the same time appropriately increase the value of α, α = α / 0.95, so that the mean response is more sensitive and the threshold range is moderately narrowed.

[0058] After parameter adjustment, the value of α is always constrained within the range of [0.05, 0.3], and the value of γ is always constrained within the range of [0.3, 2.0], to prevent the parameters from drifting to unreasonable ranges.

[0059] The above quantile dispersion estimation improves threshold stability when there are a few outliers in the historical queue. After continuous operation, the online adaptive learning mechanism further reduces the overall false alarm rate compared to the fixed-parameter scheme. The improved dynamic threshold generation scheme achieves significant improvements in response speed, robustness, and long-term adaptive capability.

[0060] Step S1032: Periodic anomaly determination: Determine whether T_current is within the dynamic threshold range. If it exceeds the threshold, proceed with the anomaly counting logic; otherwise, reset the anomaly count.

[0061] Step S104: When the anomaly counter reaches the preset condition, determine the periodic anomaly corresponding to the message ID and report it.

[0062] In this embodiment, the preset condition is that the dynamic threshold range is exceeded N times consecutively, where N is 1 to 10.

[0063] As an example, a diagnostic report is generated. When the abnormal count exceeds the limit three times consecutively, it is determined to be a periodic abnormality, which is recorded and reported. The diagnostic report is then output to the on-board diagnostic instrument or cloud monitoring platform through the diagnostic interface.

[0064] As one implementation method, the over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0065] Specifically, the over-limit amplitude Δ is calculated, whereby the over-limit amplitude is:

[0066] Where μ is the average value of the historical periodic queue, and σ is the standard deviation of the historical periodic queue.

[0067] Based on the range of the over-limit amplitude Δ, the anomaly is divided into three levels: when Δ is less than 2, it is judged as a mild anomaly; when Δ is greater than or equal to 2 and less than 3, it is judged as a moderate anomaly; when Δ is greater than or equal to 3, it is judged as a severe anomaly.

[0068] Different anomaly counting thresholds are used for different anomaly levels. The anomaly counting threshold for mild anomalies is 5 times, that is, when the anomaly exceeds the dynamic threshold range 5 times consecutively, it is determined to be a periodic anomaly; the anomaly counting threshold for moderate anomalies is 4 times, that is, when the anomaly exceeds the dynamic threshold range 4 times consecutively, it is determined to be a periodic anomaly; and the anomaly counting threshold for severe anomalies is 3 times, that is, when the anomaly exceeds the dynamic threshold range 3 times, it is determined to be a periodic anomaly.

[0069] Furthermore, the diagnostic report includes the abnormal message ID, the timestamp of the abnormality, the real-time period, the dynamic threshold range, the count value of the abnormality counter, and the abnormality level.

[0070] The above steps are repeated to process the next frame of the message.

[0071] Example 2 In one or more embodiments, a message period detection system for a CAN FD network is disclosed, such as... Figure 3 As shown, it specifically includes: The message capture module 201 is configured to: listen for and capture CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD message; Data processing module 202 is configured to: calculate the real-time period corresponding to the message ID, wherein the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; and store the real-time period in the historical period queue corresponding to the message ID. The threshold generation module 203 is configured to: calculate the average value and dispersion based on the historical periodic queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range; if the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID; if the real-time period is within the dynamic threshold range, reset the anomaly counter. The anomaly determination module 204 is configured to: determine the periodic anomaly corresponding to the message ID and report it when the anomaly counter reaches a preset condition.

[0072] Specifically, the message capture module 201 listens for and captures the CAN FD messages of the vehicle system, and records the message ID and timestamp of the CAN FD messages.

[0073] Specifically, the hardware CAN FD controller is responsible for the transmission and reception of messages at the physical layer and data link layer, as well as the recording of timestamps, thereby capturing each frame of messages from the bus.

[0074] It should be understood that the CAN FD network bus is the communication medium for the entire vehicle network.

[0075] In the data processing module 202, the real-time period corresponding to the message ID is calculated, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; the real-time period is then stored in the FIFO historical period queue corresponding to the message ID. Specifically, this includes: Calculate the real-time cycle.

[0076] For the current message ID, subtract the timestamp of the last time the message with that ID was received from the current timestamp to obtain the real-time period value T_current.

[0077] Update the historical periodic queue.

[0078] Store the real-time periodic value T_current into the historical periodic queue (FIFO) corresponding to this ID.

[0079] In this embodiment, the length of the historical periodic queue is 50 to 200.

[0080] In the threshold generation module 203, the average value and standard deviation are calculated based on the FIFO historical period queue, and a dynamic threshold range is generated; it is determined whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, the anomaly counter corresponding to the message ID is incremented; if the real-time period is within the dynamic threshold range, the anomaly counter is reset.

[0081] Calculate dynamic thresholds: Based on historical periodic queues, calculate the average value and dispersion, and generate a dynamic threshold range.

[0082] As one implementation method, the average value μ is the arithmetic mean, calculated using the following formula:

[0083] Where T represents all period values ​​in the historical period queue; N represents the length of the historical period queue.

[0084] Using standard deviation as the dispersion, the formula for calculating the standard deviation σ is:

[0085] The dynamic threshold range is [μ-kσ,μ+kσ], where k is the standard deviation multiplier, preferably ranging from 2 to 5.

[0086] If an ECU malfunction causes significant fluctuations in the cycle, resulting in a potentially abnormal cycle, a fixed threshold method would immediately trigger an alarm, indicating a possible accidental strong network interference. A dynamic threshold method, however, would record this exceedance, but if the subsequent message cycle returns to normal, it will not immediately trigger an alarm due to its continuous / cumulative judgment logic, thus avoiding false alarms caused by a single sudden interference. If the ECU malfunction persists and the cycle stabilizes within the potentially abnormal cycle, the dynamic threshold method, after several learning iterations, will gradually converge its mean towards the potentially abnormal cycle, and the threshold range will adjust accordingly. However, if the fault cycle becomes extremely unstable, such as with a sharp increase in the standard deviation σ, even if the mean value does not change significantly, the dynamic threshold range will narrow or remain stable, thus enabling sensitive detection of this instability.

[0087] As another implementation method, an improved dynamic threshold generation method using fusion exponentially weighted moving average (EWMA) and quantile dispersion estimation is used to generate the dynamic threshold range.

[0088] The dynamic mean μ is calculated using an exponentially weighted moving average. t The dynamic mean μ t The update formula is:

[0089] Where, μ t μ is the mean of the EWMA at the current time. t-1 α is the dynamic mean of the previous moment; α is the smoothing factor, with a value range of 0 < α < 1, and an optimal range of 0.05 to 0.3. The smoothing factor α is used to adjust the weight of recent data in the calculation of the dynamic mean. The larger the value of α, the higher the weight of recent data, and the faster the mean responds to periodic changes, but the weaker the ability to suppress occasional fluctuations. The smaller the value of α, the higher the weight of historical data, and the smoother and more stable the mean, but there is a lag in tracking periodic trend changes.

[0090] When using the exponentially weighted moving average method, only the dynamic mean of the previous time step needs to be stored, without the need to store the complete historical queue, and the computational complexity is O(1).

[0091] The period dispersion is estimated using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted, and the P1 percentile σ_mad1 and the P2 percentile σ_mad2 are calculated, where the P1 percentile is the lower quantile (preferably P1=10) and the P2 percentile is the upper quantile (preferably P2=90).

[0092] By combining the above dynamic mean and dispersion, the dynamic threshold range is constructed as: [μ t -γ·σ_mad1,μ t +γ·σ_mad2], where γ is the expansion coefficient.

[0093] The advantages of using the quantile method in this embodiment are: firstly, it has natural robustness to abnormal historical periods in the queue, because the impact of extreme values ​​on percentiles depends only on their ranking rather than their numerical value, and will not widen the threshold range due to a single historical outlier; secondly, it does not require assuming that the periodic data follows a normal distribution, and is equally applicable to skewed or multimodal distributions that may occur in actual vehicle networks.

[0094] Furthermore, a lightweight online adaptive learning mechanism is introduced to dynamically adjust the smoothing factor α and coefficient γ based on the actual anomaly detection feedback during system operation, thereby continuously optimizing the threshold generation parameters.

[0095] The specific implementation of online adaptive learning is as follows: First, maintain a sliding statistical window of length M, preferably M=200 frames. Then, estimate the number of false alarms F within the statistical window. fpThat is, the number of frames that are within the threshold range but are subsequently identified as abnormal; and the estimated number of missed detections F. fn This refers to the number of frames that exceeded the threshold range but were subsequently confirmed as normal. Based on F... fp and F fn Update the parameters according to the following rules: If F fp / M exceeds the upper limit threshold for false alarm rate θ fp θ is preferred fp =0.5%, indicating that the current threshold range is too narrow. The system should appropriately increase the value of γ, γ = γ + Δγ, Δγ = 0.05, and at the same time appropriately decrease the value of α, α = α × 0.95, so as to make the mean smoother and the threshold range moderately expanded. If F fn If / M exceeds the upper limit threshold θfn of the false negative rate, preferably θfn=0.1%, it indicates that the current threshold range is too wide. The system should appropriately reduce the value of γ, γ = γ - Δγ, Δγ=0.05, and at the same time appropriately increase the value of α, α = α / 0.95, so that the mean response is more sensitive and the threshold range is moderately narrowed.

[0096] After parameter adjustment, the value of α is always constrained within the range of [0.05, 0.3], and the value of γ is always constrained within the range of [0.3, 2.0], to prevent the parameters from drifting to unreasonable ranges.

[0097] The above quantile dispersion estimation improves threshold stability when there are a few outliers in the historical queue. After continuous operation, the online adaptive learning mechanism further reduces the overall false alarm rate compared to the fixed-parameter scheme. The improved dynamic threshold generation scheme achieves significant improvements in response speed, robustness, and long-term adaptive capability.

[0098] Furthermore, it is determined whether T_current is within the dynamic threshold range. If it is exceeded, the exception counting logic is initiated; otherwise, the exception count is reset.

[0099] In the anomaly determination module 204, when the anomaly counter reaches a preset condition, the periodic anomaly corresponding to the message ID is determined and reported.

[0100] In this embodiment, the preset condition is that the dynamic threshold range is exceeded N times consecutively, where N is 1 to 10.

[0101] As an example, a diagnostic report is generated. When the abnormal count exceeds the limit three times consecutively, it is determined to be a periodic abnormality, which is recorded and reported. The diagnostic report is then output to the on-board diagnostic instrument or cloud monitoring platform through the diagnostic interface.

[0102] As one implementation method, the over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0103] Specifically, the over-limit amplitude Δ is calculated, whereby the over-limit amplitude is:

[0104] Where μ is the average value of the historical periodic queue, and σ is the standard deviation of the historical periodic queue.

[0105] Based on the range of the over-limit amplitude Δ, the anomaly is divided into three levels: when Δ is less than 2, it is judged as a mild anomaly; when Δ is greater than or equal to 2 and less than 3, it is judged as a moderate anomaly; when Δ is greater than or equal to 3, it is judged as a severe anomaly.

[0106] Different anomaly counting thresholds are used for different anomaly levels. The anomaly counting threshold for mild anomalies is 5 times, that is, when the anomaly exceeds the dynamic threshold range 5 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for moderate anomalies is 3 times, that is, when the anomaly exceeds the dynamic threshold range 3 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for severe anomalies is 1 time, that is, when the anomaly exceeds the dynamic threshold range 1 time, it is determined to be a periodic anomaly.

[0107] Furthermore, the diagnostic report includes the abnormal message ID, the timestamp of the abnormality, the real-time period, the dynamic threshold range, the count value of the abnormality counter, and the abnormality level.

[0108] The above module is executed repeatedly to process the next frame of the message.

[0109] Example 3 This embodiment provides a vehicle, including a memory and a processor, as well as computer instructions stored in the memory and running on the processor. When the computer instructions are executed by the processor, they complete the steps of a CAN FD network message period detection method, specifically: Step S301: Listen to and capture the CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD messages.

[0110] Specifically, the hardware CAN FD controller is responsible for the transmission and reception of messages at the physical layer and data link layer, as well as the recording of timestamps, thereby capturing each frame of messages from the bus.

[0111] It should be understood that the CAN FD network bus is the communication medium for the entire vehicle network.

[0112] Step S302: Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; store the real-time period in the FIFO historical period queue corresponding to the message ID.

[0113] Step S3021: Calculate the real-time period.

[0114] For the current message ID, subtract the timestamp of the last time the message with that ID was received from the current timestamp to obtain the real-time period value T_current.

[0115] Step S3022: Update the historical periodic queue.

[0116] Store the real-time periodic value T_current into the historical periodic queue (FIFO) corresponding to this ID.

[0117] In this embodiment, the length of the historical periodic queue is 50 to 200.

[0118] Step S303: Calculate the average value and standard deviation based on the FIFO historical period queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID. If the real-time period is within the dynamic threshold range, reset the anomaly counter.

[0119] Step S3031: Calculate the dynamic threshold: Based on the historical periodic queue, calculate the average value and dispersion, and generate the dynamic threshold range.

[0120] As one implementation method, the average value μ is the arithmetic mean, calculated using the following formula:

[0121] Where T represents all period values ​​in the historical period queue; N represents the length of the historical period queue.

[0122] Using standard deviation as the dispersion, the formula for calculating the standard deviation σ is:

[0123] The dynamic threshold range is [μ-kσ,μ+kσ], where k is the standard deviation multiplier, preferably ranging from 2 to 5.

[0124] If an ECU malfunction causes significant fluctuations in the cycle, resulting in a potentially abnormal cycle, a fixed threshold method would immediately trigger an alarm, indicating a possible accidental strong network interference. A dynamic threshold method, however, would record this exceedance, but if the subsequent message cycle returns to normal, it will not immediately trigger an alarm due to its continuous / cumulative judgment logic, thus avoiding false alarms caused by a single sudden interference. If the ECU malfunction persists and the cycle stabilizes within the potentially abnormal cycle, the dynamic threshold method, after several learning iterations, will gradually converge its mean towards the potentially abnormal cycle, and the threshold range will adjust accordingly. However, if the fault cycle becomes extremely unstable, such as with a sharp increase in the standard deviation σ, even if the mean value does not change significantly, the dynamic threshold range will narrow or remain stable, thus enabling sensitive detection of this instability.

[0125] As another implementation method, an improved dynamic threshold generation method using fusion exponentially weighted moving average (EWMA) and quantile dispersion estimation is used to generate the dynamic threshold range.

[0126] The dynamic mean μ is calculated using an exponentially weighted moving average. t The dynamic mean μ t The update formula is:

[0127] Where, μ t μ is the mean of the EWMA at the current time. t-1 α is the dynamic mean of the previous moment; α is the smoothing factor, with a value range of 0 < α < 1, and an optimal range of 0.05 to 0.3. The smoothing factor α is used to adjust the weight of recent data in the calculation of the dynamic mean. The larger the value of α, the higher the weight of recent data, and the faster the mean responds to periodic changes, but the weaker the ability to suppress occasional fluctuations. The smaller the value of α, the higher the weight of historical data, and the smoother and more stable the mean, but there is a lag in tracking periodic trend changes.

[0128] When using the exponentially weighted moving average method, only the dynamic mean of the previous time step needs to be stored, without the need to store the complete historical queue, and the computational complexity is O(1).

[0129] The period dispersion is estimated using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted, and the P1 percentile σ_mad1 and the P2 percentile σ_mad2 are calculated, where the P1 percentile is the lower quantile (preferably P1=10) and the P2 percentile is the upper quantile (preferably P2=90).

[0130] By combining the above dynamic mean and dispersion, the dynamic threshold range is constructed as: [μ t -γ·σ_mad1,μ t+γ·σ_mad2], where γ is the expansion coefficient.

[0131] The advantages of using the quantile method in this embodiment are: firstly, it has natural robustness to abnormal historical periods in the queue, because the impact of extreme values ​​on percentiles depends only on their ranking rather than their numerical value, and will not widen the threshold range due to a single historical outlier; secondly, it does not require assuming that the periodic data follows a normal distribution, and is equally applicable to skewed or multimodal distributions that may occur in actual vehicle networks.

[0132] Furthermore, a lightweight online adaptive learning mechanism is introduced to dynamically adjust the smoothing factor α and coefficient γ based on the actual anomaly detection feedback during system operation, thereby continuously optimizing the threshold generation parameters.

[0133] The specific implementation of online adaptive learning is as follows: First, maintain a sliding statistical window of length M, preferably M=200 frames. Then, estimate the number of false alarms F within the statistical window. fp That is, the number of frames that are within the threshold range but are subsequently identified as abnormal; and the estimated number of missed detections F. fn This refers to the number of frames that exceeded the threshold range but were subsequently confirmed as normal. Based on F... fp and F fn Update the parameters according to the following rules: If F fp / M exceeds the upper limit threshold for false alarm rate θ fp θ is preferred fp =0.5%, indicating that the current threshold range is too narrow. The system should appropriately increase the value of γ, γ = γ + Δγ, Δγ = 0.05, and at the same time appropriately decrease the value of α, α = α × 0.95, so as to make the mean smoother and the threshold range moderately expanded. If F fn If / M exceeds the upper limit threshold θfn of the false negative rate, preferably θfn=0.1%, it indicates that the current threshold range is too wide. The system should appropriately reduce the value of γ, γ = γ - Δγ, Δγ=0.05, and at the same time appropriately increase the value of α, α = α / 0.95, so that the mean response is more sensitive and the threshold range is moderately narrowed.

[0134] After parameter adjustment, the value of α is always constrained within the range of [0.05, 0.3], and the value of γ is always constrained within the range of [0.3, 2.0], to prevent the parameters from drifting to unreasonable ranges.

[0135] The above quantile dispersion estimation improves threshold stability when there are a few outliers in the historical queue. After continuous operation, the online adaptive learning mechanism further reduces the overall false alarm rate compared to the fixed-parameter scheme. The improved dynamic threshold generation scheme achieves significant improvements in response speed, robustness, and long-term adaptive capability.

[0136] Step S3032: Periodic Anomaly Detection: Determine whether T_current is within the dynamic threshold range. If it exceeds the threshold, proceed with the anomaly counting logic; otherwise, reset the anomaly count.

[0137] Step S304: When the anomaly counter reaches the preset condition, determine the periodic anomaly corresponding to the message ID and report it.

[0138] In this embodiment, the preset condition is that the dynamic threshold range is exceeded N times consecutively, where N is 1 to 10.

[0139] As an example, a diagnostic report is generated. When the abnormal count exceeds the limit three times consecutively, it is determined to be a periodic abnormality, which is recorded and reported. The diagnostic report is then output to the on-board diagnostic instrument or cloud monitoring platform through the diagnostic interface.

[0140] As one implementation method, the over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0141] Specifically, the over-limit amplitude Δ is calculated, whereby the over-limit amplitude is:

[0142] Where μ is the average value of the historical periodic queue, and σ is the standard deviation of the historical periodic queue.

[0143] Based on the range of the over-limit amplitude Δ, the anomaly is divided into three levels: when Δ is less than 2, it is judged as a mild anomaly; when Δ is greater than or equal to 2 and less than 3, it is judged as a moderate anomaly; when Δ is greater than or equal to 3, it is judged as a severe anomaly.

[0144] Different anomaly counting thresholds are used for different anomaly levels. The anomaly counting threshold for mild anomalies is 5 times, that is, when the anomaly exceeds the dynamic threshold range 5 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for moderate anomalies is 3 times, that is, when the anomaly exceeds the dynamic threshold range 3 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for severe anomalies is 1 time, that is, when the anomaly exceeds the dynamic threshold range 1 time, it is determined to be a periodic anomaly.

[0145] Furthermore, the diagnostic report includes the abnormal message ID, the timestamp of the abnormality, the real-time period, the dynamic threshold range, the count value of the abnormality counter, and the abnormality level.

[0146] The above steps are repeated to process the next frame of the message.

[0147] Example 4 This embodiment provides a computer-readable storage medium for storing computer instructions. When executed by a processor, these computer instructions complete the steps of a message period detection method for a CAN FD network. Specifically: Step S401: Listen to and capture the CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD messages.

[0148] Specifically, the hardware CAN FD controller is responsible for the transmission and reception of messages at the physical layer and data link layer, as well as the recording of timestamps, thereby capturing each frame of messages from the bus.

[0149] It should be understood that the CAN FD network bus is the communication medium for the entire vehicle network.

[0150] Step S402: Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; store the real-time period in the FIFO historical period queue corresponding to the message ID.

[0151] Step S4021: Calculate the real-time period.

[0152] For the current message ID, subtract the timestamp of the last time the message with that ID was received from the current timestamp to obtain the real-time period value T_current.

[0153] Step S4022: Update the historical periodic queue.

[0154] Store the real-time periodic value T_current into the historical periodic queue (FIFO) corresponding to this ID.

[0155] In this embodiment, the length of the historical periodic queue is 50 to 200.

[0156] Step S403: Calculate the average value and standard deviation based on the FIFO historical period queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID. If the real-time period is within the dynamic threshold range, reset the anomaly counter.

[0157] Step S4031: Calculate the dynamic threshold: Based on the historical periodic queue, calculate the average value and dispersion, and generate the dynamic threshold range.

[0158] As one implementation method, the average value μ is the arithmetic mean, calculated using the following formula:

[0159] Where T represents all period values ​​in the historical period queue; N represents the length of the historical period queue.

[0160] Using standard deviation as the dispersion, the formula for calculating the standard deviation σ is:

[0161] The dynamic threshold range is [μ-kσ,μ+kσ], where k is the standard deviation multiplier, preferably ranging from 2 to 5.

[0162] If an ECU malfunction causes significant fluctuations in the cycle, resulting in a potentially abnormal cycle, a fixed threshold method would immediately trigger an alarm, indicating a possible accidental strong network interference. A dynamic threshold method, however, would record this exceedance, but if the subsequent message cycle returns to normal, it will not immediately trigger an alarm due to its continuous / cumulative judgment logic, thus avoiding false alarms caused by a single sudden interference. If the ECU malfunction persists and the cycle stabilizes within the potentially abnormal cycle, the dynamic threshold method, after several learning iterations, will gradually converge its mean towards the potentially abnormal cycle, and the threshold range will adjust accordingly. However, if the fault cycle becomes extremely unstable, such as with a sharp increase in the standard deviation σ, even if the mean value does not change significantly, the dynamic threshold range will narrow or remain stable, thus enabling sensitive detection of this instability.

[0163] As another implementation method, an improved dynamic threshold generation method using fusion exponentially weighted moving average (EWMA) and quantile dispersion estimation is used to generate the dynamic threshold range.

[0164] The dynamic mean μ is calculated using an exponentially weighted moving average. t The dynamic mean μ t The update formula is:

[0165] Where, μ t μ is the mean of the EWMA at the current time. t-1 α is the dynamic mean of the previous moment; α is the smoothing factor, with a value range of 0 < α < 1, and an optimal range of 0.05 to 0.3. The smoothing factor α is used to adjust the weight of recent data in the calculation of the dynamic mean. The larger the value of α, the higher the weight of recent data, and the faster the mean responds to periodic changes, but the weaker the ability to suppress occasional fluctuations. The smaller the value of α, the higher the weight of historical data, and the smoother and more stable the mean, but there is a lag in tracking periodic trend changes.

[0166] When using the exponentially weighted moving average method, only the dynamic mean of the previous time step needs to be stored, without the need to store the complete historical queue, and the computational complexity is O(1).

[0167] The period dispersion is estimated using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted, and the P1 percentile σ_mad1 and the P2 percentile σ_mad2 are calculated, where the P1 percentile is the lower quantile (preferably P1=10) and the P2 percentile is the upper quantile (preferably P2=90).

[0168] By combining the above dynamic mean and dispersion, the dynamic threshold range is constructed as: [μ t -γ·σ_mad1,μ t +γ·σ_mad2], where γ is the expansion coefficient.

[0169] The advantages of using the quantile method in this embodiment are: firstly, it has natural robustness to abnormal historical periods in the queue, because the impact of extreme values ​​on percentiles depends only on their ranking rather than their numerical value, and will not widen the threshold range due to a single historical outlier; secondly, it does not require assuming that the periodic data follows a normal distribution, and is equally applicable to skewed or multimodal distributions that may occur in actual vehicle networks.

[0170] Furthermore, a lightweight online adaptive learning mechanism is introduced to dynamically adjust the smoothing factor α and coefficient γ based on the actual anomaly detection feedback during system operation, thereby continuously optimizing the threshold generation parameters.

[0171] The specific implementation of online adaptive learning is as follows: First, maintain a sliding statistical window of length M, preferably M=200 frames. Then, estimate the number of false alarms F within the statistical window. fp That is, the number of frames that are within the threshold range but are subsequently identified as abnormal; and the estimated number of missed detections F. fn This refers to the number of frames that exceeded the threshold range but were subsequently confirmed as normal. Based on F... fp and F fn Update the parameters according to the following rules: If F fp / M exceeds the upper limit threshold for false alarm rate θ fp θ is preferred fp =0.5%, indicating that the current threshold range is too narrow. The system should appropriately increase the value of γ, γ = γ + Δγ, Δγ = 0.05, and at the same time appropriately decrease the value of α, α = α × 0.95, so as to make the mean smoother and the threshold range moderately expanded. If F fnIf / M exceeds the upper limit threshold θfn of the false negative rate, preferably θfn=0.1%, it indicates that the current threshold range is too wide. The system should appropriately reduce the value of γ, γ = γ - Δγ, Δγ=0.05, and at the same time appropriately increase the value of α, α = α / 0.95, so that the mean response is more sensitive and the threshold range is moderately narrowed.

[0172] After parameter adjustment, the value of α is always constrained within the range of [0.05, 0.3], and the value of γ is always constrained within the range of [0.3, 2.0], to prevent the parameters from drifting to unreasonable ranges.

[0173] The above quantile dispersion estimation improves threshold stability when there are a few outliers in the historical queue. After continuous operation, the online adaptive learning mechanism further reduces the overall false alarm rate compared to the fixed-parameter scheme. The improved dynamic threshold generation scheme achieves significant improvements in response speed, robustness, and long-term adaptive capability.

[0174] Step S4032: Periodic Anomaly Detection: Determine if T_current is within the dynamic threshold range. If it exceeds the threshold, proceed with the anomaly counting logic; otherwise, reset the anomaly count.

[0175] Step S404: When the anomaly counter reaches the preset condition, determine the periodic anomaly corresponding to the message ID and report it.

[0176] In this embodiment, the preset condition is that the dynamic threshold range is exceeded N times consecutively, where N is 1 to 10.

[0177] As an example, a diagnostic report is generated. When the abnormal count exceeds the limit three times consecutively, it is determined to be a periodic abnormality, which is recorded and reported. The diagnostic report is then output to the on-board diagnostic instrument or cloud monitoring platform through the diagnostic interface.

[0178] As one implementation method, the over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0179] Specifically, the over-limit amplitude Δ is calculated, whereby the over-limit amplitude is:

[0180] Where μ is the average value of the historical periodic queue, and σ is the standard deviation of the historical periodic queue.

[0181] Based on the range of the over-limit amplitude Δ, the anomaly is divided into three levels: when Δ is less than 2, it is judged as a mild anomaly; when Δ is greater than or equal to 2 and less than 3, it is judged as a moderate anomaly; when Δ is greater than or equal to 3, it is judged as a severe anomaly.

[0182] Different anomaly counting thresholds are used for different anomaly levels. The anomaly counting threshold for mild anomalies is 5 times, that is, when the anomaly exceeds the dynamic threshold range 5 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for moderate anomalies is 3 times, that is, when the anomaly exceeds the dynamic threshold range 3 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for severe anomalies is 1 time, that is, when the anomaly exceeds the dynamic threshold range 1 time, it is determined to be a periodic anomaly.

[0183] Furthermore, the diagnostic report includes the abnormal message ID, the timestamp of the abnormality, the real-time period, the dynamic threshold range, the count value of the abnormality counter, and the abnormality level.

[0184] The above steps are repeated to process the next frame of the message.

[0185] Example 5 This embodiment provides a computer program product including executable instructions, which are computer instructions; the executable instructions are stored in a computer-readable storage medium. When the vehicle's processor reads the executable instructions from the computer-readable storage medium and executes the executable instructions, the steps of the CAN FD network message period detection method are completed, specifically: Step S501: Listen to and capture the CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD messages.

[0186] Specifically, the hardware CAN FD controller is responsible for the transmission and reception of messages at the physical layer and data link layer, as well as the recording of timestamps, thereby capturing each frame of messages from the bus.

[0187] It should be understood that the CAN FD network bus is the communication medium for the entire vehicle network.

[0188] Step S502: Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; store the real-time period in the FIFO historical period queue corresponding to the message ID.

[0189] Step S5021: Calculate the real-time period.

[0190] For the current message ID, subtract the timestamp of the last time the message with that ID was received from the current timestamp to obtain the real-time period value T_current.

[0191] Step S5022: Update the historical periodic queue.

[0192] Store the real-time periodic value T_current into the historical periodic queue (FIFO) corresponding to this ID.

[0193] In this embodiment, the length of the historical periodic queue is 50 to 200.

[0194] Step S503: Calculate the average value and standard deviation based on the FIFO historical period queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID. If the real-time period is within the dynamic threshold range, reset the anomaly counter.

[0195] Step S5031: Calculate the dynamic threshold: Based on the historical periodic queue, calculate the average value and dispersion, and generate the dynamic threshold range.

[0196] As one implementation method, the average value μ is the arithmetic mean, calculated using the following formula:

[0197] Where T represents all period values ​​in the historical period queue; N represents the length of the historical period queue.

[0198] Using standard deviation as the dispersion, the formula for calculating the standard deviation σ is:

[0199] The dynamic threshold range is [μ-kσ,μ+kσ], where k is the standard deviation multiplier, preferably ranging from 2 to 5.

[0200] If an ECU malfunction causes significant fluctuations in the cycle, resulting in a potentially abnormal cycle, a fixed threshold method would immediately trigger an alarm, indicating a possible accidental strong network interference. A dynamic threshold method, however, would record this exceedance, but if the subsequent message cycle returns to normal, it will not immediately trigger an alarm due to its continuous / cumulative judgment logic, thus avoiding false alarms caused by a single sudden interference. If the ECU malfunction persists and the cycle stabilizes within the potentially abnormal cycle, the dynamic threshold method, after several learning iterations, will gradually converge its mean towards the potentially abnormal cycle, and the threshold range will adjust accordingly. However, if the fault cycle becomes extremely unstable, such as with a sharp increase in the standard deviation σ, even if the mean value does not change significantly, the dynamic threshold range will narrow or remain stable, thus enabling sensitive detection of this instability.

[0201] As another implementation method, an improved dynamic threshold generation method using fusion exponentially weighted moving average (EWMA) and quantile dispersion estimation is used to generate the dynamic threshold range.

[0202] The dynamic mean μ is calculated using an exponentially weighted moving average. t The dynamic mean μ t The update formula is:

[0203] Where, μ t μ is the mean of the EWMA at the current time. t-1 α is the dynamic mean of the previous moment; α is the smoothing factor, with a value range of 0 < α < 1, and an optimal range of 0.05 to 0.3. The smoothing factor α is used to adjust the weight of recent data in the calculation of the dynamic mean. The larger the value of α, the higher the weight of recent data, and the faster the mean responds to periodic changes, but the weaker the ability to suppress occasional fluctuations. The smaller the value of α, the higher the weight of historical data, and the smoother and more stable the mean, but there is a lag in tracking periodic trend changes.

[0204] When using the exponentially weighted moving average method, only the dynamic mean of the previous time step needs to be stored, without the need to store the complete historical queue, and the computational complexity is O(1).

[0205] The period dispersion is estimated using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted, and the P1 percentile σ_mad1 and the P2 percentile σ_mad2 are calculated, where the P1 percentile is the lower quantile (preferably P1=10) and the P2 percentile is the upper quantile (preferably P2=90).

[0206] By combining the above dynamic mean and dispersion, the dynamic threshold range is constructed as: [μ t -γ·σ_mad1,μ t +γ·σ_mad2], where γ is the expansion coefficient.

[0207] The advantages of using the quantile method in this embodiment are: firstly, it has natural robustness to abnormal historical periods in the queue, because the impact of extreme values ​​on percentiles depends only on their ranking rather than their numerical value, and will not widen the threshold range due to a single historical outlier; secondly, it does not require assuming that the periodic data follows a normal distribution, and is equally applicable to skewed or multimodal distributions that may occur in actual vehicle networks.

[0208] Furthermore, a lightweight online adaptive learning mechanism is introduced to dynamically adjust the smoothing factor α and coefficient γ based on the actual anomaly detection feedback during system operation, thereby continuously optimizing the threshold generation parameters.

[0209] The specific implementation of online adaptive learning is as follows: First, maintain a sliding statistical window of length M, preferably M=200 frames. Then, estimate the number of false alarms F within the statistical window. fp That is, the number of frames that are within the threshold range but are subsequently identified as abnormal; and the estimated number of missed detections F. fn This refers to the number of frames that exceeded the threshold range but were subsequently confirmed as normal. Based on F... fp and Ffn Update the parameters according to the following rules: If F fp / M exceeds the upper limit threshold for false alarm rate θ fp θ is preferred fp =0.5%, indicating that the current threshold range is too narrow. The system should appropriately increase the value of γ, γ = γ + Δγ, Δγ = 0.05, and at the same time appropriately decrease the value of α, α = α × 0.95, so as to make the mean smoother and the threshold range moderately expanded. If F fn If / M exceeds the upper limit threshold θfn of the false negative rate, preferably θfn=0.1%, it indicates that the current threshold range is too wide. The system should appropriately reduce the value of γ, γ = γ - Δγ, Δγ=0.05, and at the same time appropriately increase the value of α, α = α / 0.95, so that the mean response is more sensitive and the threshold range is moderately narrowed.

[0210] After parameter adjustment, the value of α is always constrained within the range of [0.05, 0.3], and the value of γ is always constrained within the range of [0.3, 2.0], to prevent the parameters from drifting to unreasonable ranges.

[0211] The above quantile dispersion estimation improves threshold stability when there are a few outliers in the historical queue. After continuous operation, the online adaptive learning mechanism further reduces the overall false alarm rate compared to the fixed-parameter scheme. The improved dynamic threshold generation scheme achieves significant improvements in response speed, robustness, and long-term adaptive capability.

[0212] Step S5032: Periodic anomaly determination: Determine whether T_current is within the dynamic threshold range. If it exceeds the threshold, proceed with the anomaly counting logic; otherwise, reset the anomaly count.

[0213] Step S504: When the anomaly counter reaches the preset condition, determine the periodic anomaly corresponding to the message ID and report it.

[0214] In this embodiment, the preset condition is that the dynamic threshold range is exceeded N times consecutively, where N is 1 to 10.

[0215] As an example, a diagnostic report is generated. When the abnormal count exceeds the limit three times consecutively, it is determined to be a periodic abnormality, which is recorded and reported. The diagnostic report is then output to the on-board diagnostic instrument or cloud monitoring platform through the diagnostic interface.

[0216] As one implementation method, the over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

[0217] Specifically, the over-limit amplitude Δ is calculated, whereby the over-limit amplitude is:

[0218] Where μ is the average value of the historical periodic queue, and σ is the standard deviation of the historical periodic queue.

[0219] Based on the range of the over-limit amplitude Δ, the anomaly is divided into three levels: when Δ is less than 2, it is judged as a mild anomaly; when Δ is greater than or equal to 2 and less than 3, it is judged as a moderate anomaly; when Δ is greater than or equal to 3, it is judged as a severe anomaly.

[0220] Different anomaly counting thresholds are used for different anomaly levels. The anomaly counting threshold for mild anomalies is 5 times, that is, when the anomaly exceeds the dynamic threshold range 5 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for moderate anomalies is 3 times, that is, when the anomaly exceeds the dynamic threshold range 3 times consecutively, it is determined to be a periodic anomaly. The anomaly counting threshold for severe anomalies is 1 time, that is, when the anomaly exceeds the dynamic threshold range 1 time, it is determined to be a periodic anomaly.

[0221] Furthermore, the diagnostic report includes the abnormal message ID, the timestamp of the abnormality, the real-time period, the dynamic threshold range, the count value of the abnormality counter, and the abnormality level.

[0222] The above steps are repeated to process the next frame of the message.

[0223] 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.

[0224] 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.

[0225] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment, whereby a series of operational steps are performed 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.

[0226] The steps and methods involved in Embodiments 2 to 5 above correspond to those in Embodiment 1. For detailed implementation methods, please refer to the relevant description section of Embodiment 1. The descriptions of each embodiment in the above embodiments have different emphases. Parts not described in detail in a certain embodiment can be referred to the relevant descriptions of other embodiments.

[0227] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

[0228] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for message cycle detection of a CAN FD network, characterized in that include: Listen to and capture CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD message; Calculate the real-time period corresponding to the message ID, where the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; Store the real-time period into the historical period queue corresponding to the message ID; The average value and dispersion are calculated based on the historical periodic queue, and a dynamic threshold range is generated; it is determined whether the real-time period is within the dynamic threshold range. If the real-time period exceeds the dynamic threshold range, the anomaly counter corresponding to the message ID is incremented; if the real-time period is within the dynamic threshold range, the anomaly counter is reset. When the anomaly counter reaches a preset condition, the periodic anomaly corresponding to the message ID is determined and reported.

2. The message cycle detection method of a CAN FD network according to claim 1, characterized in that, The dynamic threshold range specifically includes: Using the standard deviation as the degree of dispersion, a dynamic threshold range is generated based on the standard deviation and the arithmetic mean. Alternatively, an improved dynamic threshold generation method based on fusion index weighted moving average and quantile dispersion estimation can be used to generate the dynamic threshold range.

3. The method of claim 2, wherein the CAN FD network message cycle detection method is characterized by, The dynamic threshold range generated based on the standard deviation and arithmetic mean is: [μ-kσ,μ+kσ], where k is the standard deviation multiplier, μ is the arithmetic mean, and σ is the standard deviation.

4. The method of claim 2, wherein the CAN FD network message cycle is detected by: The improved dynamic threshold generation method generates a dynamic threshold range: [μ t - γ · σ_mad1, μ t + γ · σ_mad2], wherein γ is an expansion coefficient, μ t is the EWMA mean value at the current moment, σ_mad1 is the P1th percentile, and σ_mad2 is the P2th percentile.

5. The method of claim 4, wherein the CAN FD network message cycle detection method is characterized by, The dynamic mean is calculated using an exponentially weighted moving average, and the update formula for the dynamic mean is as follows: wherein μ t is the EWMA mean value at the current time; μ t-1 is the dynamic mean value at the previous time; a is the smoothing factor, and T_current is the real-time period value. The period dispersion is estimated by using a quantile method based on a historical period queue. Specifically, all period values ​​in the historical period queue are sorted to obtain the P1 percentile and P2 percentile as the dispersion.

6. The method of claim 1, wherein the CAN FD network message cycle detection method is characterized by, When the anomaly counter reaches a preset condition, the periodic anomaly corresponding to the message ID is determined and reported, and the method further includes: The over-limit amplitude is calculated based on the real-time period, and the anomaly is divided into multiple levels based on the over-limit amplitude. Different anomaly counting thresholds are used for different anomaly levels.

7. A message cycle detection system for a CAN FD network, characterized in that include: The message capture module is configured to: listen for and capture CAN FD messages of the vehicle system, and record the message ID and timestamp of the CAN FD message; The data processing module is configured to: calculate the real-time period corresponding to the message ID, wherein the real-time period is the current timestamp minus the timestamp of the last time the message corresponding to the message ID was received; and store the real-time period in the historical period queue corresponding to the message ID. The threshold generation module is configured to: calculate the average value and dispersion based on the historical periodic queue, and generate a dynamic threshold range; determine whether the real-time period is within the dynamic threshold range; if the real-time period exceeds the dynamic threshold range, increment the anomaly counter corresponding to the message ID; if the real-time period is within the dynamic threshold range, reset the anomaly counter. The anomaly determination module is configured to: determine the periodic anomaly corresponding to the message ID and report it when the anomaly counter reaches a preset condition.

8. A vehicle characterized by comprising: It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, perform the message period detection method for the CAN FD network as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, complete the message period detection method for the CAN FD network as described in any one of claims 1-6.

10. A computer program product comprising executable instructions stored in a computer readable storage medium; wherein, When the vehicle's processor reads executable instructions from a computer-readable storage medium and executes the executable instructions, it completes the message cycle detection method for the CAN FD network as described in any one of claims 1-6.