Signal fluctuation detection method and device, computer device and storage medium
By calculating the mean of the target voltage sequence of the signal, the high and low level values of the signal fluctuation are determined, which solves the problem of inaccurate signal detection in traditional methods and achieves higher accuracy and versatility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN SHUMA ELECTRONICS TECH
- Filing Date
- 2022-11-15
- Publication Date
- 2026-04-28
AI Technical Summary
Traditional signal fluctuation detection methods cannot accurately obtain the high and low level values of a signal, especially when there are level standard deviations between CAN transceivers from different manufacturers, resulting in inaccurate data.
By acquiring the target voltage sequence of the signal, the mean of the continuous target voltage values is calculated, the maximum mean and the minimum mean are determined, and when the fluctuation detection passes, these are used as the high-level and low-level values of the signal fluctuation, respectively.
It improves the accuracy of signal fluctuation detection, reduces measurement and fluctuation errors, and is compatible with transceivers from different manufacturers when the signal type and actual level standard of the transceiver are unknown, thus improving the versatility of signal fluctuation detection.
Smart Images

Figure CN115712016B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for detecting signal fluctuations. Background Technology
[0002] CAN (Controller Area Network) bus is a commonly used differential serial bus, which has subcategories such as high-speed and low-speed.
[0003] According to the CAN protocol, when the high-speed CAN bus is in "dominant" mode, CANH is 3.5V and CANL is 1.5V; when the high-speed CAN bus is in "recessive" mode, CANH is 2.5V and CANL is 2.5V.
[0004] According to the CAN protocol, when the low-speed CAN bus is in "dominant" mode, CANH is 3.6V and CANL is 1.4V; when the low-speed CAN bus is in "recessive" mode, CANH is 0V and CANL is 5.0V.
[0005] Furthermore, CAN transceivers are difficult to completely and strictly adhere to protocol standards; the actual supported voltage levels often deviate slightly between different manufacturers' CAN transceivers. The traditional method determines the high and low voltage levels (e.g., 3.5V and 1.5V) by reading the signal voltage and judging which ranges it falls within according to the protocol. However, this traditional method suffers from inaccurate data. Summary of the Invention
[0006] Therefore, it is necessary to provide a signal fluctuation detection method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems, which can improve the accuracy of the obtained high-level and low-level fluctuation values.
[0007] A method for detecting signal fluctuations, the method comprising:
[0008] Acquire the target voltage sequence of the signal; the target voltage sequence contains continuous target voltage values within the transition edge range;
[0009] The average value of consecutive target voltage values in the target voltage sequence is calculated to obtain multiple voltage average values;
[0010] From the multiple voltage averages, determine the maximum average and the minimum average;
[0011] When the target voltage sequence is determined to pass the volatility detection, the maximum mean value is taken as the high-level volatility value of the signal, and the minimum mean value is taken as the low-level volatility value of the signal.
[0012] A signal fluctuation detection device, the device comprising:
[0013] A target voltage sequence acquisition module is used to acquire the target voltage sequence of a signal; the target voltage sequence includes continuous target voltage values within the transition edge range;
[0014] The mean calculation module is used to calculate the mean of continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values.
[0015] The mean value determination module is used to determine the maximum mean and the minimum mean from the multiple voltage mean values;
[0016] A volatility detection module is used to, when determining that the target voltage sequence has passed volatility detection, take the maximum average value as the high-level volatility value of the signal and the minimum average value as the low-level volatility value of the signal.
[0017] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of various signal fluctuation detection method embodiments.
[0018] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of embodiments of various signal fluctuation detection methods.
[0019] The aforementioned signal fluctuation detection methods, devices, computer equipment, and storage media require the detection of actual high and low level fluctuations because the signal is not necessarily generated strictly according to the high and low level values required by the protocol. By acquiring continuous target voltage values within the transition edge range, the high and low level values of the signal can be guaranteed. Since pulse sequences or noise may exist in the target voltage sequence, affecting fluctuation measurement, the average of continuous target voltage values is calculated to obtain multiple voltage averages. The maximum and minimum averages are then determined, and fluctuation detection is performed on the target voltage sequence. The maximum and minimum averages are used as the high and low level values of the signal, respectively. Averaging reduces most of the measurement and fluctuation errors, and by selecting the sequence that passes the fluctuation detection, the actual high and low level values of a segment of the signal can be accurately obtained. Attached Figure Description
[0020] Figure 1 This is an application environment diagram of the signal fluctuation detection method in one embodiment;
[0021] Figure 2 This is a flowchart illustrating a signal fluctuation detection method in one embodiment;
[0022] Figure 3This is a waveform diagram of a binarized sequence in one embodiment;
[0023] Figure 4 This is a waveform diagram of a signal in one embodiment;
[0024] Figure 5 This is a waveform diagram of the signal in another embodiment;
[0025] Figure 6 This is a flowchart illustrating a signal fluctuation detection method in another embodiment;
[0026] Figure 7 This is a structural block diagram of a signal fluctuation detection device in one embodiment;
[0027] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0028] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0030] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly. The connection can be a direct connection or an indirect connection.
[0031] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.
[0032] The terms "first," "second," etc., used in this application may be used herein to describe various data, but such data are not limited by these terms. These terms are only used to distinguish one data point from another. For example, without departing from the scope of this application, a first value may be referred to as a second value, and similarly, a second value may be referred to as a first value. Both the first value and the second value are values, but they are not the same value.
[0033] It is understood that the term "connection" in the following embodiments should be understood as "electrical connection," "communication connection," etc., if the connected circuits, modules, units, etc., have electrical signal or data transmission with each other.
[0034] The signal fluctuation detection method provided in this application can be applied to, for example... Figure 1 In the application environment. Figure 1 This is an application environment diagram of the signal fluctuation detection method in one embodiment. The computer device 110 can be, but is not limited to, various FPGA (Field Programmable Gate Array) personal computers, laptops, smartphones, tablets, and portable wearable devices.
[0035] In one embodiment, such as Figure 2 The diagram shown is a flowchart of a signal fluctuation detection method in one embodiment, including:
[0036] Step 202: Obtain the target voltage sequence of the signal; the target voltage sequence contains continuous target voltage values within the transition edge range.
[0037] Specifically, the signal can be a signal with a relatively clear transition edge. For example, the signal can be a square wave, trapezoidal wave, etc. The signal can be an analog signal. A transition edge refers to the boundary between one state and another. A transition edge can be a rising edge, a falling edge, or both. The voltage value difference between the two sides of the transition edge is relatively large. The continuous target voltage values within the transition edge range must at least include the voltage at the edge of the transition edge, and may also include the voltages before and after the edge. The target voltage sequence is a digital voltage sequence. For example, the target voltage sequence can be represented as "3.6 / 3.5 / 3.26 / 3.67 / 3.28 / 1.56 / 1.37 / 1.50…", etc. "Continuous" means arranged in chronological order.
[0038] Specifically, the computer device samples the signal to obtain a voltage sequence. The computer device can determine that a transition edge has been detected when the difference between two consecutive voltage values exceeds a threshold set by the threshold. Alternatively, the computer device can compare the signal average within one symbol period with the signal average within the next symbol period; if the difference is large, a transition edge is detected. The computer device then extracts a target voltage sequence containing consecutive target voltage values within the transition edge range.
[0039] Step 204: Calculate the average value of the continuous target voltage values in the target voltage sequence to obtain multiple voltage average values.
[0040] Specifically, the computer equipment can group consecutive target voltage values in a target sequence, calculate the average of each group, and obtain multiple voltage averages. "Multiple" means at least two.
[0041] Step 206: Determine the maximum and minimum average values from multiple voltage average values.
[0042] Step 208: When it is determined that the target voltage sequence has passed the fluctuation detection, the maximum mean value is taken as the high level value of the fluctuation of the signal, and the minimum mean value is taken as the low level value of the fluctuation of the signal.
[0043] Volatility detection is used to detect whether the target voltage sequence fluctuates excessively or contains noise. Volatility detection is based on the mean square error of each segment of the signal. Large fluctuations indicate that the maximum and minimum mean values cannot accurately represent the high and low level fluctuations of the signal. The high level fluctuation value refers to the actual high voltage level represented by the signal during fluctuation. The low level fluctuation value refers to the actual low voltage level represented by the signal during fluctuation.
[0044] Specifically, the computer equipment can perform fluctuation detection on the target voltage sequence. When the target voltage sequence passes the fluctuation detection, the maximum average value is taken as the high level value of the signal fluctuation, and the minimum average value is taken as the low level value of the signal fluctuation.
[0045] Computer equipment can determine a signal segmentation threshold based on the high and low level fluctuations, and then binarize the signal based on this threshold to obtain a digital signal. This method reduces errors and makes the resulting digital signal more accurate.
[0046] Optionally, the signal in this embodiment can be a signal generated by a differential bus. Correspondingly, the target voltage sequence can be a target differential voltage sequence. The differential bus can be a CAN (Controller Area Network) bus, a UART (Universal Asynchronous Receiver / Transmitter) bus, an SPI (Serial Peripheral Interface) bus, an IIC (Inter-Integrated Circuit) bus, etc. Differential voltage refers to the voltage difference between buses. Therefore, the obtained maximum and minimum average values are the maximum and minimum average values of the differential voltage. Similarly, the maximum and minimum average values of the differential voltage can also be obtained.
[0047] The aforementioned signal fluctuation detection method requires detecting the actual high and low level values of the fluctuations because the signal is not necessarily generated strictly according to the high and low level values required by the protocol. By acquiring continuous target voltage values within the transition edge range, the high and low level values of the signal can be guaranteed. Since pulse sequences or noise may exist in the target voltage sequence, affecting fluctuation measurement, the average of continuous target voltage values is calculated to obtain multiple voltage averages. The maximum and minimum averages are then determined, and fluctuation detection is performed on the target voltage sequence. The maximum and minimum averages are used as the high and low level values of the signal, respectively. Averaging reduces most of the measurement and fluctuation errors, and selecting sequences that pass fluctuation detection allows for accurate determination of the actual high and low level values of a signal fluctuation segment. Furthermore, this embodiment of the application can use a single hardware set to be compatible with various transceivers even when the signal type and the actual level standard of the transceiver are unknown, improving the versatility of the signal fluctuation detection method.
[0048] In one embodiment, determining that a target voltage sequence passes volatility detection includes:
[0049] The average of the maximum and minimum means is used to obtain a reference mean.
[0050] The target voltage sequence is binarized based on the reference mean to obtain a binarized voltage sequence;
[0051] When the binarized voltage sequence is determined to pass the volatility detection, the target voltage sequence is determined to pass the volatility detection.
[0052] Binarization is used to process a voltage sequence into a sequence with only two values. The binarized voltage sequence is ordered and contains only two values.
[0053] In this binary voltage sequence, there are only two values: a first value and a second value. One of the first and second values can be 1, and the other can be 0.
[0054] Specifically, the computer equipment averages the maximum and minimum mean values to obtain a reference mean. When the target voltage value is greater than the reference mean, a first value, such as 1, is obtained; when the target voltage value is less than or equal to the reference mean, a second value, such as 0, is obtained. It can be understood that 0 and 1 can be configured according to requirements, and vice versa. When no pulse sequence exists in the binarized voltage sequence, meaning the binarized voltage sequence passes the fluctuation detection, the computer equipment determines that the target voltage sequence has passed the fluctuation detection.
[0055] In this embodiment, the target voltage sequence contains a large number of values. The target voltage sequence is binarized based on the reference mean to obtain a binarized voltage sequence. Fluctuation detection is then performed on the binarized voltage sequence. Since there are fewer types of values, the computational load of fluctuation detection can be reduced and the computational speed can be improved.
[0056] In one embodiment, determining that a binarized voltage sequence passes volatility detection includes:
[0057] Identify groups of consecutive identical values in a binarized voltage sequence;
[0058] When the number of identical values in a continuous group of identical values is greater than or equal to a preset number, the binarized voltage sequence is determined to have passed the fluctuation detection.
[0059] Specifically, a group of consecutive identical values consists of values that are consecutive and identical in chronological order. The preset number can be configured as needed. For example, if the binarized voltage sequence is "1111110000001111111", then there are three groups of consecutive identical values: "111111", "000000", and "1111111". If the preset number is set to 5, then the number of identical values in "111111", "000000", and "1111111" are 6, 6, and 7 respectively, thus the binarized voltage sequence passes the fluctuation detection.
[0060] In this embodiment, when the number of identical values in a continuous group of identical values in the binarized voltage sequence is greater than or equal to a preset number, it is determined that the binarized voltage sequence has passed the fluctuation detection, and the voltage sequence without noise signals or other errors can be screened out, thereby making the obtained high-level fluctuation value and low-level fluctuation value more accurate.
[0061] In one embodiment, the signal fluctuation detection method further includes: when the number of identical values in a continuous group of identical values is less than a preset number, taking the continuous group of identical values with the number of identical values less than the preset number as a pulse sequence;
[0062] The value corresponding to the pulse sequence in the target voltage sequence will be replaced with the corresponding value. Then, the process will return to the step of calculating the average value of the continuous target voltage values in the target voltage sequence to obtain multiple voltage average values.
[0063] Specifically, when the number of identical values in a consecutive group of identical values is less than a preset number, it indicates that the error of that consecutive group of identical values is large, possibly representing a pulse. Therefore, the computer device treats consecutive groups of identical values with a number less than the preset number as pulse sequences. The computer device replaces the value corresponding to this pulse sequence in the target voltage sequence with the corresponding value. When a value in the pulse sequence represents a value less than the reference average, the corresponding value can be a value greater than the reference average. For example, if the binarized voltage sequence is "000001100000", and the binarized voltage sequence has a corresponding target voltage sequence with a pulse sequence of "11", where 1 represents greater than the reference average (2.5), then the target voltage value corresponding to "11" could be "1.9 / 1.8". The computer device then updates the target voltage sequence and returns to execution, replacing the value corresponding to the pulse sequence in the target voltage sequence with the corresponding value.
[0064] In this embodiment, since groups with fewer identical values may be error pulses caused by noise or excessive fluctuations, continuous groups with fewer than a preset number of identical values are taken as pulse sequences, and the values corresponding to the pulse sequences in the target voltage sequence are replaced with the corresponding values, which can remove error values in the target voltage sequence; return to the step of calculating the average of continuous target voltage values in the target voltage sequence to obtain multiple voltage values, redetermine the maximum and minimum average values, and re-execute the fluctuation detection to remove errors, re-detect whether the target voltage sequence meets the conditions, and obtain more accurate high-level and low-level fluctuation values.
[0065] In one embodiment, replacing the value corresponding to the pulse sequence in the target voltage sequence with the corresponding value includes:
[0066] When the pulse sequence represents the first value, the target voltage value corresponding to the pulse sequence in the target voltage sequence will be replaced with the minimum mean; the target voltage value corresponding to the first value is greater than the reference mean.
[0067] When the pulse sequence represents the second value, the target voltage value corresponding to the pulse sequence in the target voltage sequence will be replaced with the maximum mean; the target voltage value corresponding to the second value is less than the reference mean.
[0068] Specifically, in this embodiment, we take a first value of 1, indicating that the target voltage value corresponding to the first value is greater than the reference average, and a second value of 0, indicating that the target reference voltage corresponding to the second value is less than the reference average, as an example. When the pulse sequence represents 1, the computer device replaces the target voltage value corresponding to 1 with the minimum average. When the pulse sequence represents 0, the computer device replaces the target voltage value corresponding to 0 with the maximum average.
[0069] like Figure 3 The image shown is a waveform diagram of a binarized sequence in one embodiment. Figure 3 The target voltage sequence contains a series of 0 pulses between multiple 1s, even though these 0 pulses should have been 1s. Therefore, the computer replaces the target voltage value corresponding to the 0 pulses in the target voltage sequence with the maximum mean.
[0070] In this embodiment, when the pulse sequence represents a first value greater than the reference mean, it indicates that the values adjacent to the pulse sequence are all second values. Therefore, the pulse sequence is an error sequence and should be the second value. Thus, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the minimum mean. When the pulse sequence represents a second value less than the reference mean, it indicates that the values adjacent to the pulse sequence are all first values. Therefore, the pulse sequence is an error sequence and should be the first value. Thus, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the second mean. This can reduce the error of the target voltage sequence, thereby improving the accuracy of the obtained high-level and low-level fluctuation values.
[0071] In one embodiment, obtaining the target voltage sequence of a signal includes: sampling the signal to obtain a continuous voltage sequence; and determining the target voltage sequence from the voltage sequence based on a transition edge rule.
[0072] Specifically, computer equipment samples the signal using an ADC based on the sampling rate to obtain a time-ordered voltage sequence. The sampling rate can be greater than the signal's maximum baud rate. For example, the supported CAN bus can have a maximum baud rate of 500 kHz (kilohertz), although the actual baud rate is unknown, and the sampling rate can be, but is not limited to, 5 MHz (megahertz).
[0073] Computer devices can determine that a transition edge has been detected when the difference between two consecutive voltage values exceeds a threshold set by the computer. Alternatively, the computer device can compare the average signal value within one symbol period with the average signal value within the next symbol period; if the difference is large, a transition edge has been detected.
[0074] In this embodiment, the signal is sampled to obtain a continuous voltage sequence. Based on the transition edge rule, the target voltage sequence is determined from the voltage sequence, and high-level and low-level values can be obtained, thereby accurately obtaining the final fluctuating high-level and fluctuating low-level values.
[0075] In one embodiment, determining a target voltage sequence from a voltage sequence based on a transition edge rule includes:
[0076] The voltage sequence is divided into at least three groups, including a first voltage group, a second voltage group, and a third voltage group;
[0077] Calculate the average voltage values of the first voltage group, the second voltage group, and the third voltage group respectively to obtain the average voltage values of the first voltage group, the second voltage group, and the third voltage group.
[0078] When any difference between any pairwise of the first voltage mean, the second voltage mean, and the third voltage mean satisfies the difference condition, the voltage sequence is taken as the target voltage sequence.
[0079] The first, second, and third voltage groups consist of consecutive voltage values arranged in chronological order. The total number of voltage values in the first, second, and third voltage groups may be less than the number of voltage values in the voltage sequence.
[0080] Specifically, the computer device divides the voltage sequence into at least three groups: a first voltage group, a second voltage group, and a third voltage group. The computer device calculates the average voltage of the first voltage group to obtain the first voltage average. The computer device calculates the average voltage of the second voltage group to obtain the second voltage average. The computer device calculates the average voltage of the third voltage group to obtain the third voltage average. When any difference between any pairwise average voltage of the first, second, and third voltage groups satisfies a difference condition, the voltage sequence is selected as the target voltage sequence. The difference can be an absolute value, in which case the corresponding difference condition is that it is greater than a difference threshold. The difference can also be the average voltage of a later time period minus the average voltage of an earlier time period; when the absolute value of any difference is large, that voltage sequence is selected as the target voltage sequence.
[0081] For example, a voltage sequence contains the latest 50 consecutive voltage values, denoted as Rsft = data0~data49. The average values of three groups A, B, and C are calculated in real time: A = mean (data10~data19), B = mean (data20~data29), and C = mean (data30~data39). It is then determined whether A / B / C satisfy the rising edge rule (i.e., BA > ΔV or CA > ΔV, where ΔV is a specified difference threshold, such as 1.0V). If Rsft satisfies the rising edge rule, its value is copied to the register set to obtain the target voltage sequence RI.
[0082] like Figure 4 The image shown is a waveform diagram of a signal in one embodiment. If the sampled voltage sequence is... Figure 4In the sequence B, since the mean of sequence B is small, subtracting the mean A from the mean B alone cannot exceed the difference threshold, making it impossible to detect a rising edge in the voltage sequence. Therefore, this embodiment detects rising edges by using three sets of average values. If the difference between the mean C and the mean A exceeds the difference threshold, the voltage sequence contains a rising edge, effectively avoiding the detection of rising edges. Figure 4 The voltage sequence that appears cannot detect a transition edge.
[0083] In this embodiment, the computer device can add a voltage group preceding and following the first, second, and third voltage groups to the target voltage sequence. That is, the target voltage sequence includes a voltage group preceding the first voltage group, the first voltage group, the second voltage group, the third voltage group, and a voltage group following the third voltage group. For example... Figure 5 The image shown is a waveform diagram of a signal in another embodiment. When the waveform appears... Figure 5 In cases where only ABC are available, it is impossible to obtain a complete high-level voltage and a complete low-level voltage. When the signal is a non-return-to-zero (NRZ) code signal, regardless of the order of the NRZ codes, a complete high-level and a complete low-level can be obtained from all five voltage values, further improving the accuracy of fluctuating high-level and low-level values.
[0084] In this embodiment, the voltage sequence is divided into at least three groups, including a first voltage group, a second voltage group, and a third voltage group. The average values of the first, second, and third voltages are calculated. When any difference between any pair of the average values of the first, second, and third voltages satisfies the difference condition, the voltage sequence is used as the target voltage sequence. This ensures that the target voltage sequence contains transition edges and that the high and low level values of the signal can be obtained.
[0085] In one embodiment, averaging consecutive target voltage values in a target voltage sequence to obtain multiple voltage averages includes: grouping multiple consecutive target voltage values in the target voltage sequence to determine a moving average of the target voltage sequence to obtain multiple voltage averages.
[0086] The moving average is the average of multiple consecutive M terms from a time series with N terms.
[0087] For example, if the target voltage sequence contains 50 target voltage values, then the computer device calculates the average value by taking 10 consecutive samples as a group, and calculates a total of 41 voltage average values according to the moving average rule.
[0088] In this embodiment, multiple consecutive target voltage values in the target voltage sequence are grouped together to determine the moving average of the target voltage sequence, thereby obtaining multiple voltage averages. This allows for the calculation of the maximum number of averages, resulting in more accurate determination of the maximum and minimum averages.
[0089] In one embodiment, a signal fluctuation detection method is proposed, illustrated using an application to a CAN bus, with the transition edge being a rising edge, a first value of 1, and a second value of 0. Figure 6 The diagram shown is a flowchart of a signal fluctuation detection method in another embodiment.
[0090] The differential voltage signal on CANH / CANL is converted into a digital value by an analog-to-digital converter (ADC) and sent to a digital circuit for processing to obtain a voltage sequence.
[0091] The highest known supported CAN bus baud rate is 500kHz, but the actual baud rate is unknown; the ADC sampling rate is fixed at 5MHz.
[0092] The specific steps are as follows:
[0093] 1. A shift register group Rsft is used to buffer the latest 50 consecutive sampled voltage values (i.e., voltage sequence), denoted as Rsft = data0~data49.
[0094] 2. Perform rising edge rule detection on Rsft: Calculate the average values of three groups A / B / C in real time, where A=mean (data10~data19), B=mean (data20~data29), and C=mean (data30~data39); determine whether A / B / C satisfy the rising edge rule (i.e., B>A+ΔV or C>A+ΔV, where ΔV is the specified rising edge threshold, such as 1.0V).
[0095] 3. Update RI: If Rsft satisfies the rising edge rule, then the value of Rsft is copied to register group RI. Rsft is continuously updated regardless of whether it satisfies the rising edge rule or not.
[0096] 4. Perform moving average filtering on RI: Calculate the average value for each group of 10 consecutive samples, resulting in 41 average values. Select the largest average value and denote it as MAX, and select the smallest average value and denote it as MIN.
[0097] 5. Binarization and updating RI_s: Using VTH=(MAX+MIN) / 2 as the threshold voltage (i.e., the reference mean), the 50 sampled voltage values in RI are binarized to obtain a binary sequence consisting of 50 0s and 1s, denoted as RI_s. Values higher than VTH are denoted as 1, and values lower than VTH are denoted as 0.
[0098] 6. Check if the RI_s sequence passes the volatility test, i.e., whether there is a pulse sequence. A pulse sequence is a continuous sequence of 0s or 1s with a length of less than 5 points.
[0099] 6.1 If the volatility detection is deemed to have passed, i.e. there is no pulse sequence, proceed to step 7.
[0100] 6.2 If a 0 pulse exists, replace the sampled voltage value in RI corresponding to the 0 pulse with MAX. If a 1 pulse exists, replace the sampled voltage value in RI corresponding to the 1 pulse with MIN. Then, perform rising edge rule detection on the values in RI.
[0101] 6.2.1 If RI does not meet the rising edge rule, the volatility detection is deemed to have failed, and step 8 is executed.
[0102] 6.2.2 If RI satisfies the rising edge rule, then execute steps 4 to 6 again. If there is no pulse sequence in the RI_s sequence, then the volatility detection is deemed to have passed, and step 7 is executed; if there is still a pulse sequence in the RI_s sequence, then the volatility detection is deemed to have failed, and step 8 is executed.
[0103] 7. Set MAX to the high-level fluctuation value and MIN to the low-level fluctuation value.
[0104] 8. End.
[0105] This embodiment provides a method for detecting CAN bus signal fluctuations using waveform analysis. By analyzing the CAN bus signal voltage value output by the analog-to-digital converter, the high and low voltage values during CAN bus signal fluctuations are accurately measured. Even when the CAN type and the actual voltage level standard of the transceiver are unknown, this method is compatible with CAN transceivers from different manufacturers and can measure the actual differential voltage values under various conditions.
[0106] In one embodiment, a signal fluctuation detection method includes:
[0107] Step (a1): Sample the signal to obtain a continuous voltage sequence.
[0108] Step (a2) divides the voltage sequence into at least three groups, including a first voltage group, a second voltage group, and a third voltage group.
[0109] Step (a3): Calculate the average voltage values of the first voltage group, the second voltage group, and the third voltage group respectively to obtain the average voltage values of the first voltage group, the second voltage group, and the third voltage group.
[0110] Step (a4): When any difference between any pairwise of the first voltage average, the second voltage average, and the third voltage average satisfies the difference condition, the voltage sequence is taken as the target voltage sequence; the target voltage sequence contains continuous target voltage values within the transition edge range.
[0111] Step (a5): Group multiple consecutive target voltage values in the target voltage sequence and determine the moving average of the target voltage sequence to obtain multiple voltage averages.
[0112] Step (a6): Determine the maximum and minimum average values from the multiple voltage average values.
[0113] Step (a7): Average the maximum and minimum means to obtain the reference mean.
[0114] Step (a8): The target voltage sequence is binarized based on the reference mean to obtain a binarized voltage sequence.
[0115] Step (a9) identifies the group of consecutive identical values in the binarized voltage sequence.
[0116] Step (a10): When the number of identical values in a continuous group of identical values is greater than or equal to a preset number, the maximum average value is taken as the high-level fluctuation value of the signal, and the minimum average value is taken as the low-level fluctuation value of the signal.
[0117] Step (a11): When the number of identical values in a group of consecutive identical values is less than a preset number, the group of consecutive identical values with the number of identical values less than the preset number is taken as a pulse sequence.
[0118] Step (a12): When the pulse sequence represents the first value, the target voltage value corresponding to the pulse sequence in the target voltage sequence will be replaced with the minimum mean; the target voltage value corresponding to the first value is greater than the reference mean.
[0119] Step (a13): When the pulse sequence represents the second value, the target voltage value corresponding to the pulse sequence in the target voltage sequence will be replaced with the maximum mean. If the target voltage value corresponding to the second value is less than the reference mean, the process will return to the step of calculating the mean of the continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values.
[0120] In this embodiment, since the signal is not necessarily generated strictly according to the high and low level values required by the protocol, it is necessary to detect the actual fluctuating high and low level values. By acquiring continuous target voltage values within the transition edge range, the high and low level values of the signal can be guaranteed. Since there may be pulse sequences or noise in the target voltage sequence, which may affect the fluctuation measurement, a moving average is calculated for the continuous target voltage values to obtain multiple voltage averages. Then, the maximum and minimum averages are determined, and fluctuation detection is performed on the target voltage sequence. The maximum and minimum averages are used as the high and low level values of the signal, respectively. By calculating the averages, most of the measurement and fluctuation errors are reduced. Furthermore, by selecting the sequence that passes the fluctuation detection, the actual high and low level values of a segment of the signal can be accurately obtained. At the same time, this embodiment can use a single hardware to be compatible with various transceivers when the signal type and the actual level standard of the transceiver are unknown, thus improving the versatility of the signal fluctuation detection method.
[0121] It should be understood that, although the above Figure 2 and Figure 6 In the flowchart, the steps are shown sequentially according to the arrows, and the steps (a1) to (a13) are shown sequentially according to their numbers. However, these steps are not necessarily executed in the order indicated by the arrows or numbers. Unless otherwise specified in this document, there is no strict order requirement for the execution of these steps; they can be executed in other orders. Figure 2 and Figure 6 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0122] In one embodiment, such as Figure 7 The diagram shown is a structural block diagram of a signal fluctuation detection device in one embodiment. Figure 7 A signal fluctuation detection device is provided. This device can be a software module, a hardware module, or a combination of both as part of a computer device. Specifically, the device includes: a target voltage sequence acquisition module 702, a mean calculation module 704, a mean determination module 706, and a fluctuation detection module 708, wherein:
[0123] The target voltage sequence acquisition module 702 is used to acquire the target voltage sequence of the signal; the target voltage sequence contains continuous target voltage values within the transition edge range;
[0124] The mean value calculation module 704 is used to calculate the mean of continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values;
[0125] The mean value determination module 706 is used to determine the maximum mean and the minimum mean from multiple voltage mean values;
[0126] The volatility detection module 708 is used to take the maximum average value as the high-level value of the signal volatility and the minimum average value as the low-level value of the signal volatility when it is determined that the target voltage sequence has passed the volatility detection.
[0127] The aforementioned signal fluctuation detection device, since the signal is not necessarily generated strictly according to the high and low level values required by the protocol, needs to detect the actual fluctuating high and low level values. By acquiring continuous target voltage values within the transition edge range, the high and low level values of the signal can be guaranteed. Since there may be pulse sequences or noise in the target voltage sequence, affecting fluctuation measurement, the average of continuous target voltage values is calculated to obtain multiple voltage averages. Then, the maximum and minimum average values are determined, and fluctuation detection is performed on the target voltage sequence. The maximum and minimum average values are used as the high and low level values of the signal, respectively. By calculating the average, most of the measurement and fluctuation errors are reduced. Furthermore, by selecting the sequence that passes the fluctuation detection, the actual high and low level values of a segment of the signal can be accurately obtained. Simultaneously, this embodiment of the application can use a single hardware to be compatible with various transceivers even when the signal type and the actual level standard of the transceiver are unknown, improving the versatility of the signal fluctuation detection method.
[0128] In one embodiment, the volatility detection module 708 is used to: average the maximum mean and the minimum mean to obtain a reference mean; binarize the target voltage sequence based on the reference mean to obtain a binarized voltage sequence; and determine that the target voltage sequence passes the volatility detection when the binarized voltage sequence passes the volatility detection.
[0129] In this embodiment, the target voltage sequence contains a large number of values. The target voltage sequence is binarized based on the reference mean to obtain a binarized voltage sequence. Fluctuation detection is then performed on the binarized voltage sequence. Since there are fewer types of values, the computational load of fluctuation detection can be reduced and the computational speed can be improved.
[0130] In one embodiment, the volatility detection module 708 is used to: determine a group of consecutive identical values in a binary voltage sequence; and determine that the binary voltage sequence passes volatility detection when the number of identical values in the group of consecutive identical values is greater than or equal to a preset number.
[0131] In this embodiment, when the number of identical values in a continuous group of identical values in the binarized voltage sequence is greater than or equal to a preset number, it is determined that the binarized voltage sequence has passed the fluctuation detection, and the voltage sequence without noise signals or other errors can be screened out, thereby making the obtained high-level fluctuation value and low-level fluctuation value more accurate.
[0132] In one embodiment, the volatility detection module 708 is used to: when the number of identical values in a continuous group of identical values is less than a preset number, treat the continuous group of identical values with the number of identical values less than a preset number as a pulse sequence; replace the value corresponding to the pulse sequence in the target voltage sequence with the corresponding value; the mean calculation module 704 is used to calculate the mean of the continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values, and then calculate the mean of the continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values.
[0133] In this embodiment, since groups with fewer identical values may be error pulses caused by noise or excessive fluctuations, continuous groups with fewer than a preset number of identical values are taken as pulse sequences, and the values corresponding to the pulse sequences in the target voltage sequence are replaced with the corresponding values, which can remove error values in the target voltage sequence; return to the step of calculating the average of continuous target voltage values in the target voltage sequence to obtain multiple voltage values, redetermine the maximum and minimum average values, and re-execute the fluctuation detection to remove errors, re-detect whether the target voltage sequence meets the conditions, and obtain more accurate high-level and low-level fluctuation values.
[0134] In one embodiment, the volatility detection module 708 is configured to: when the pulse sequence represents a first value, replace the target voltage value corresponding to the pulse sequence in the target voltage sequence with the minimum mean; the target voltage value corresponding to the first value is greater than the reference mean;
[0135] When the pulse sequence represents the second value, the target voltage value corresponding to the pulse sequence in the target voltage sequence will be replaced with the maximum mean; the target voltage value corresponding to the second value is less than the reference mean.
[0136] In this embodiment, when the pulse sequence represents a first value greater than the reference mean, it indicates that the values adjacent to the pulse sequence are all second values. Therefore, the pulse sequence is an error sequence and should be the second value. Thus, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the minimum mean. When the pulse sequence represents a second value less than the reference mean, it indicates that the values adjacent to the pulse sequence are all first values. Therefore, the pulse sequence is an error sequence and should be the first value. Thus, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the second mean. This can reduce the error of the target voltage sequence, thereby improving the accuracy of the obtained high-level and low-level fluctuation values.
[0137] In one embodiment, the target voltage sequence acquisition module 702 is configured to: sample the signal to obtain a continuous voltage sequence; and determine the target voltage sequence from the voltage sequence based on the transition edge rule.
[0138] In this embodiment, the signal is sampled to obtain a continuous voltage sequence. Based on the transition edge rule, the target voltage sequence is determined from the voltage sequence, and high-level and low-level values can be obtained, thereby accurately obtaining the final fluctuating high-level and fluctuating low-level values.
[0139] In one embodiment, the target voltage sequence acquisition module 702 is used to: divide the voltage sequence into at least three groups, including a first voltage group, a second voltage group and a third voltage group;
[0140] Calculate the average voltage values of the first voltage group, the second voltage group, and the third voltage group respectively to obtain the average voltage values of the first voltage group, the second voltage group, and the third voltage group.
[0141] When any difference between any pairwise of the first voltage mean, the second voltage mean, and the third voltage mean satisfies the difference condition, the voltage sequence is taken as the target voltage sequence.
[0142] In this embodiment, the voltage sequence is divided into at least three groups, including a first voltage group, a second voltage group, and a third voltage group. The average values of the first, second, and third voltages are calculated. When any difference between any pair of the average values of the first, second, and third voltages satisfies the difference condition, the voltage sequence is used as the target voltage sequence. This ensures that the target voltage sequence contains transition edges and that the high and low level values of the signal can be obtained.
[0143] In one embodiment, the mean calculation module 704 is used to: determine the moving average of the target voltage sequence by grouping multiple consecutive target voltage values in the target voltage sequence, and obtain multiple voltage averages.
[0144] In this embodiment, multiple consecutive target voltage values in the target voltage sequence are grouped together to determine the moving average of the target voltage sequence, thereby obtaining multiple voltage averages. This allows for the calculation of the maximum number of averages, resulting in more accurate determination of the maximum and minimum averages.
[0145] Specific limitations regarding the signal fluctuation detection device can be found in the limitations of the signal fluctuation detection method described above, and will not be repeated here. Each module in the aforementioned signal fluctuation detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0146] In one embodiment, a computer device is provided, which may be a terminal device, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a signal fluctuation detection method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0147] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0148] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method embodiments.
[0149] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method embodiments.
[0150] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.
[0151] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes described in the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0152] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for detecting signal fluctuations, characterized in that, The method includes: Acquire the target voltage sequence of the signal; the target voltage sequence contains continuous target voltage values within the transition edge range; The average value of consecutive target voltage values in the target voltage sequence is calculated to obtain multiple voltage average values; From the multiple voltage averages, determine the maximum average and the minimum average; When the target voltage sequence is determined to pass the volatility detection, the maximum mean value is taken as the high-level volatility value of the signal, and the minimum mean value is taken as the low-level volatility value of the signal.
2. The method according to claim 1, characterized in that, Determining that the target voltage sequence passes volatility detection includes: The reference mean is obtained by averaging the maximum mean and the minimum mean. The target voltage sequence is binarized based on the reference mean to obtain a binarized voltage sequence; When it is determined that the binarized voltage sequence passes the volatility detection, it is determined that the target voltage sequence passes the volatility detection.
3. The method according to claim 2, characterized in that, Determining that the binarized voltage sequence passes the volatility detection includes: Identify groups of consecutive identical values in the binarized voltage sequence; When the number of identical values in the consecutive identical value groups is greater than or equal to a preset number, the binarized voltage sequence is determined to have passed the fluctuation detection.
4. The method according to claim 3, characterized in that, The method further includes: When the number of identical values in the consecutive identical value group is less than the preset number, the consecutive identical value group with the number of identical values less than the preset number is regarded as a pulse sequence; Replace the target voltage value corresponding to the pulse sequence in the target voltage sequence with the corresponding value, and return to the step of calculating the average of the continuous target voltage values in the target voltage sequence to obtain multiple voltage averages.
5. The method according to claim 4, characterized in that, The step of replacing the value corresponding to the pulse sequence in the target voltage sequence with the corresponding value includes: When the pulse sequence represents a first value, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the minimum mean; the target voltage value corresponding to the first value is greater than the reference mean. When the pulse sequence represents the second value, the target voltage value corresponding to the pulse sequence in the target voltage sequence is replaced with the maximum mean; the target voltage value corresponding to the second value is less than the reference mean.
6. The method according to claim 1, characterized in that, The target voltage sequence of the acquired signal includes: The signal is sampled to obtain a continuous voltage sequence; The target voltage sequence is determined from the voltage sequence based on the edge-jumping rule.
7. The method according to claim 6, characterized in that, The determination of the target voltage sequence from the voltage sequence based on the transition edge rule includes: The voltage sequence is divided into at least three groups, including a first voltage group, a second voltage group, and a third voltage group; The average voltage values of the first voltage group, the second voltage group, and the third voltage group are calculated respectively to obtain the first average voltage value, the second average voltage value, and the third average voltage value; When any difference between the first average voltage value, the second average voltage value, and the third average voltage value satisfies the difference condition, the voltage sequence is taken as the target voltage sequence.
8. The method according to any one of claims 1 to 7, characterized in that, The step of averaging consecutive target voltage values in the target voltage sequence to obtain multiple voltage averages includes: By grouping multiple consecutive target voltage values in the target voltage sequence, a moving average of the target voltage sequence is determined to obtain multiple voltage averages.
9. A signal fluctuation detection device, characterized in that, The device includes: A target voltage sequence acquisition module is used to acquire the target voltage sequence of a signal; the target voltage sequence includes continuous target voltage values within the transition edge range; The mean calculation module is used to calculate the mean of continuous target voltage values in the target voltage sequence to obtain multiple voltage mean values. The mean value determination module is used to determine the maximum mean and the minimum mean from the multiple voltage mean values; A volatility detection module is used to, when determining that the target voltage sequence has passed volatility detection, take the maximum average value as the high-level volatility value of the signal and the minimum average value as the low-level volatility value of the signal.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and apparatus for detecting OBD interface bus type
CN108156055A
ECU identification method based on CAN signal characteristics and storage medium
CN113627215A