CAN bus waveform message analysis method, device, equipment and medium

By sending preset parameters to the oscilloscope and using the NumPy library for data processing and CAN protocol parsing, the compatibility and universality issues of CAN bus waveform message analysis equipment are solved, improving compatibility and anti-interference capabilities for different oscilloscope models and reducing equipment costs.

CN121397115APending Publication Date: 2026-01-23XIAN ACTIONPOWER ELECTRIC
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511280132.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Existing CAN bus waveform message analysis equipment suffers from high hardware costs, poor compatibility and scalability, and insufficient versatility.

Method used

By sending preset operating parameters to the oscilloscope, the NumPy library is used for data processing and CAN protocol parsing to realize waveform data storage, time-domain segmentation, noise reduction and layer-by-layer parsing. Error frames are filtered out by a five-complement strategy and parsing is performed based on the general CAN protocol.

Benefits of technology

It improves compatibility and anti-interference capabilities for different oscilloscope models, reduces equipment costs, is suitable for various CAN bus scenarios, and provides an efficient and low-cost end-to-end solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121397115A_ABST
    Figure CN121397115A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data analysis, and provides a CAN bus waveform message analysis method, device and equipment and a medium, and the method comprises the steps: issuing an operation instruction carrying a preset operation parameter to an oscilloscope; in response to waveform data fed back by the oscilloscope, storing the waveform data as a message file in a preset format; analyzing and converting the message file according to the data head structural body identified by the oscilloscope to obtain a message array; performing time domain segmentation, normalization processing and de-noising processing on the data in the message array by using a Numpy library to obtain a message signal; and performing error frame screening on the message signal by adopting a strategy of supplementing one after five, and performing layer-by-layer analysis on the screened message signal based on a CAN protocol structure to obtain message analysis content. According to the invention, through the software design of the whole process, a universal scheme is adopted from data acquisition, storage and analysis to signal processing and message generation, so that the analysis universality of the CAN bus waveform message is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data analysis technology, and more specifically, to a method, apparatus, device, and medium for analyzing CAN bus waveform messages. Background Technology

[0002] CAN (Controller Area Network) is a serial communication protocol for real-time applications. With its superior real-time performance, high reliability, flexibility and low cost, CAN communication is widely used in automotive, industrial control, aerospace and other fields. It has become an ISO international standard and has been recognized as one of the most promising fieldbuses.

[0003] With the continuous expansion of applications, a large number of products for sending, receiving, and parsing CAN messages have emerged. For example, oscilloscopes with CAN decoding capabilities are often used in related technologies to send, receive, and parse CAN messages. However, these products often vary in hardware cost and their ability to send, receive, and parse CAN bus messages. For instance, some existing products have insufficient data analysis capabilities and poor anti-interference capabilities, failing to communicate normally under slight environmental interference; others typically require specific vendor drivers to send, receive, and parse CAN messages, limiting product compatibility and scalability. Furthermore, the CAN decoding function provided by existing oscilloscopes usually requires the purchase of licensed software or additional CAN decoding module hardware in addition to the oscilloscope itself, resulting in poor versatility. Summary of the Invention

[0004] The problem addressed by this invention is how to improve the versatility of CAN bus waveform message analysis.

[0005] To address the aforementioned problems, this invention provides a method, apparatus, device, and medium for analyzing CAN bus waveform messages.

[0006] In a first aspect, the present invention provides a method for analyzing CAN bus waveform messages, including: A running command carrying preset operating parameters is sent to the oscilloscope, which is used to measure the differential signal of the CAN bus. In response to the waveform data fed back from the oscilloscope, the waveform data is stored as a message file in a preset format; The message file is parsed and converted based on the data header structure identified by the oscilloscope to obtain a message array; The NumPy library is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array to obtain the message signal; Error frames are filtered by using a five-complement strategy for message signals, and the filtered message signals are parsed layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0007] Optionally, in response to waveform data fed back by the oscilloscope, the waveform data is stored as a message file in a preset format, including: The oscilloscope-specified identifier is used to read the first byte of the waveform data stream using Python, confirming the start of data transmission. The total length of the data stream is obtained. The waveform data is received in blocks according to a preset fixed length, starting from the beginning of data transmission, until all the waveform data is read. The read waveform data blocks are sequentially written into a message file of a preset format until all waveform data is transmitted and stored. The message file of the preset format includes a binary file in wfm format.

[0008] Optionally, the message file is parsed and converted according to the data header structure identified by the oscilloscope to obtain a message array, including: Based on the data header structure, the data header of the message file is read in little-endian order to obtain the data attributes in each data header, and the data attributes are converted into Python variables; Read the subsequent data information of the message file according to the data type specified in the data header, and convert the data information format to decimal value; Based on the quantization relationship indicated by the oscilloscope, the decimal data information is converted into the actual acquired voltage value to obtain the message array.

[0009] Optionally, the NumPy library is used to perform time-domain segmentation, normalization, and denoising on the data in the message array to obtain the message signal, including: The data in the message array is divided into segments according to a preset number of data points and a preset inter-segment overlap rate to obtain segmented data segments; The NumPy library is used to perform a Discrete Fourier Transform on the segmented data to convert it into frequency domain data. The frequency domain data is then subjected to high-pass filtering, which includes setting frequency domain data with frequencies below a preset threshold to 0. Finally, the filtered frequency domain data is converted back to the time domain using an Inverse Discrete Fourier Transform to obtain the denoised time domain data. The time-domain data is normalized using the maximum and minimum value normalization method to obtain normalized data; Obtain the mean of the normalized data, and perform mean threshold segmentation on the normalized data based on the mean to obtain segmented data. The mean threshold segmentation includes retaining the original value of the normalized data that is greater than the mean, and replacing the normalized data that is less than or equal to the mean with the mean. The segmented data is binarized to obtain binarized logic levels; Morphological erosion operation is performed on the binarized logic level to obtain the message signal.

[0010] Optionally, an error frame filtering strategy of padding every five frames is used to filter the message signal, and the filtered message signal is parsed layer by layer based on the CAN protocol structure to obtain the message parsing content, including: Traverse the message signal, calculate the length of each logic bit in the message signal according to the preset operating parameters, and determine the logic level of the logic bit based on the length data. When the number of "1"s in the length data is greater than or equal to half of the length data, the logic level is dominant and the corresponding logic value is set to 0. When the number of "1"s in the length data is less than half of the length data, the logic level is recessive and the corresponding logic value is set to 1. Based on the strategy of adding one every five, the five most recently read logical values ​​are stored in a pre-created parsing queue. If five consecutive identical logical values ​​appear in the parsing queue and the next logical value is the same as that in the parsing queue, it is determined to be an error frame and parsing is abandoned. If no five consecutive identical logical values ​​appear in the parsing queue, the logical bit is discarded and the parsing queue is cleared to continue reading the logical value of the next logical bit until the error frame filtering of the entire message signal is completed. Starting with the first dominant level as the frame start bit, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content.

[0011] Optionally, starting with the first dominant level as the frame start, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content, including: Read the logical value of the first preset number of bits after the start bit of the frame as the basic ID segment, and obtain the ID segment information based on the logical value of the next bit and the basic ID segment; Read the logic value of the second preset number of bits to obtain the control segment data, and obtain the data length code of the control segment data; Read the message signal corresponding to the number of bytes according to the data length code to obtain the data segment content; Cyclic redundancy check (CRC) is used to verify each logical value in the message signal to obtain the verification result; Read the end segment information containing the CRC separator, acknowledgment bit, and ACK separator; The message parsing content is obtained based on the ID segment information, data segment content, verification result, and end segment information.

[0012] Optionally, a running command carrying preset operating parameters is sent to the oscilloscope, including: Establish communication with the oscilloscope via Socket and send run commands to the oscilloscope; Based on the running command, configure the oscilloscope's operating parameters according to the preset operating parameters, which include sampling rate, time base, channel probe attenuation ratio, vertical scaling, and vertical offset. The sampling rate is set based on the Nyquist sampling theorem. After the oscilloscope finishes recording waveform data, a storage command is sent to the oscilloscope.

[0013] Secondly, the present invention provides a CAN bus waveform message analysis device, comprising: The instruction module is used to send operation instructions carrying preset operating parameters to the oscilloscope, which is used to measure the differential signals of the CAN bus. The storage module is used to store waveform data in a preset format in response to waveform data fed back from the oscilloscope. The conversion module is used to parse and convert the message file according to the data header structure identified by the oscilloscope, and obtain the message array; The preprocessing module is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array using the NumPy library to obtain the message signal; The parsing module is used to filter error frames in the message signal using a five-complement strategy, and to parse the filtered message signal layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0014] Thirdly, the present invention provides an electronic device, including a memory and a processor; Memory, used to store computer programs; A processor, used to implement, when executing a computer program, the CAN bus waveform message analysis method as described in the first aspect.

[0015] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the CAN bus waveform message analysis method as described in the first aspect.

[0016] The beneficial effects of the CAN bus waveform message analysis method of this invention are as follows: By presetting operating parameters (such as sampling rate, time base, etc.), it can flexibly adapt to different models of general-purpose oscilloscopes without relying on dedicated hardware or drivers from specific manufacturers, solving the problem of limited compatibility and scalability of existing products. At the same time, reasonable parameter settings lay the foundation for subsequent anti-interference processing, improving adaptability to complex environments. Waveform data is stored as message files in a pre-formatted format. A unified pre-formatted format (such as WFM format) breaks down the barriers between different oscilloscope data formats, avoiding analysis limitations caused by data format incompatibility, enhancing the universality of data processing, and eliminating the need to develop additional adapter modules for specific oscilloscopes. By identifying the data header structure identified by the oscilloscope, binary files from different manufacturers' oscilloscopes can be accurately parsed, converting the raw data into standardized message arrays, providing a data foundation for subsequent unified processing, and further improving compatibility with different devices. The NumPy library's generalized data processing capabilities avoid dependence on specific vendor drivers. Time-domain segmentation efficiently processes large amounts of data, avoiding excessive memory usage. Normalization eliminates signal amplitude deviations and improves data consistency. Noise reduction (such as Fourier transform filtering and erosion operations) effectively reduces electromagnetic noise interference, improves anti-interference capabilities, and provides high-quality message signals for subsequent parsing. Error frame filtering and protocol parsing are implemented through pure software algorithms, significantly reducing equipment costs compared to the additional purchase of CAN decoding licenses or hardware modules for oscilloscopes in related technologies. Furthermore, the parsing logic based on the universal CAN protocol is applicable to various CAN bus scenarios, further enhancing the method's versatility and universality. This invention, through a fully software-based design, adopts a generalized solution from data acquisition, storage, and parsing to signal processing and message generation, completely breaking the dependence of existing technologies on dedicated hardware, specific drivers, or additional licenses. It not only reduces equipment procurement and maintenance costs, but also significantly improves the compatibility, anti-interference capability and scalability of CAN bus waveform message analysis. It can be adapted to different models of general-purpose oscilloscopes and various CAN bus scenarios, providing a universal, efficient and low-cost end-to-end solution for fields such as vehicle network diagnostics and industrial bus monitoring, effectively solving the problem of insufficient universality of existing technologies. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the CAN bus waveform message analysis method according to an embodiment of the present invention. Figure 2 This is an example of a CAN bus waveform message parsing waveform diagram according to an embodiment of the present invention; Figure 3 This is a second example of a CAN bus waveform message parsing waveform diagram according to an embodiment of the present invention; Figure 4 Example 3 of the CAN bus waveform message parsing waveform diagram in this embodiment of the invention; Figure 5 Example 4 of the CAN bus waveform message parsing waveform diagram in this embodiment of the invention; Figure 6 Example 5 of the CAN bus waveform message parsing waveform diagram in this embodiment of the invention; Figure 7 Example six of the CAN bus waveform message parsing waveform diagrams in this embodiment of the invention; Figure 8 Example 7 of the CAN bus waveform message parsing waveform diagram in this embodiment of the invention; Figure 9 This is a schematic diagram of the CAN bus waveform message analysis device according to an embodiment of the present invention; Figure 10 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0018] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.

[0019] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0020] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to"; the term "based on" means "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; and the term "optionally" means "optional embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first," "second," etc., mentioned in this invention are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0021] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0022] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0023] like Figure 1 As shown in the figure, an embodiment of the present invention provides a CAN bus waveform message analysis method, including: Step S1: Send a running command carrying preset operating parameters to the oscilloscope. The oscilloscope is used to measure the differential signal of the CAN bus.

[0024] Specifically, the operation commands can include start operation commands, stop commands, and store commands. The start operation command indicates that the oscilloscope is starting to acquire ripple information, the stop command indicates that the oscilloscope is stopping acquiring ripple information, and the store command indicates that the acquired ripple information is stored. The preset operation parameters are the parameter values ​​necessary for the oscilloscope to operate, such as sampling rate, channel vertical scaling, and vertical offset, providing basic operating data for the oscilloscope.

[0025] Optionally, a running command carrying preset operating parameters is sent to the oscilloscope, including: Establish communication with the oscilloscope via Socket and send run commands to the oscilloscope; Based on the running command, configure the oscilloscope's operating parameters according to the preset operating parameters, which include sampling rate, time base, channel probe attenuation ratio, vertical scaling, and vertical offset. The sampling rate is set based on the Nyquist sampling theorem. After the oscilloscope finishes recording waveform data, a storage command is sent to the oscilloscope.

[0026] Specifically, the CAN bus waveform message analysis method in this embodiment is based on a CAN bus waveform message analysis system, which includes a host computer (such as an industrial control computer) and an oscilloscope. The entire process of this solution is implemented using the Python programming language. The host computer communicates with the oscilloscope via a Socket in Python and sends operating commands carrying preset operating parameters, i.e., SCPI commands (Standard Commands for Programmable Instruments), to the oscilloscope. The preset operating parameters configure the oscilloscope's operating parameters, completing the oscilloscope setup. These preset operating parameters include the sampling rate, oscilloscope time base, channel probe attenuation ratio, channel vertical scaling, and vertical offset. The sampling rate needs to be set according to the baud rate of the CAN message, or by default, data acquisition is performed according to the oscilloscope's maximum sampling rate. In this embodiment, based on the Nyquist sampling theorem, the sampling bit length is calculated according to the signal baud rate and the sampling rate. That is, the sampling frequency should be at least twice the original signal frequency. For example, if the original signal frequency is 250kbps, the oscilloscope sampling frequency should be set to 1MHz.

[0027] The host computer determines whether recording is complete by repeatedly querying the oscilloscope's status register. For example, it sends an inquiry command every 100ms. If it returns "1" (indicating that acquisition is complete), it stops querying and sends a storage command. The oscilloscope transmits the acquired waveform data to the host computer via a socket, and the host computer records this information for subsequent data parsing.

[0028] Step S2: In response to the waveform data fed back by the oscilloscope, store the waveform data as a message file in a preset format.

[0029] Specifically, in response to the waveform data fed back by the oscilloscope, the waveform data can be organized and stored using a preset format, that is, the waveform data is converted into a format that is easy to parse to obtain a message file. The preset format is usually a WFM format file.

[0030] Optionally, in response to waveform data fed back by the oscilloscope, the waveform data is stored as a message file in a preset format, including: The oscilloscope-specified identifier is used to read the first byte of the waveform data stream using Python, confirming the start of data transmission. The total length of the data stream is obtained. The waveform data is received in blocks according to a preset fixed length, starting from the beginning of data transmission, until all the waveform data is read. The read waveform data blocks are sequentially written into a message file of a preset format until all waveform data is transmitted and stored. The message file of the preset format includes a binary file in wfm format.

[0031] Specifically, the host computer sends a storage command to the oscilloscope via a socket. The oscilloscope transmits the waveform data displayed on the screen to the host computer via the socket. Python receives the data stream transmitted via the socket and writes it to a file in a preset format, such as wfm format, for storage. The process involves first reading the first byte of the data stream, usually an identifier specified by the oscilloscope manufacturer. After reading this identifier, the transmission begins with the first byte of the data stream. The length of the transmitted data stream is then read, and the data stream is divided into blocks according to a preset fixed length (e.g., processing 1,000,000 data points in a single reception). Each time, a preset fixed length of data is received from the socket and written to the open wfm file until the entire transmitted data stream length is read. The read information is then stored in a created file in a preset format, such as a wfm binary file, resulting in a message file. This block-based reception mechanism avoids memory overflow caused by loading large amounts of data at once. The fixed-length block design facilitates parallel processing via multi-threading (e.g., a separate thread is responsible for verifying the integrity of each data block), improving data reception efficiency, adapting to memory processing capabilities and transmission efficiency, and preventing memory overflow or transmission interruption due to excessive data volume.

[0032] Step S3: Parse and convert the message file according to the data header structure identified by the oscilloscope to obtain the message array.

[0033] Specifically, as a binary storage medium (such as WFM format), the data of a message file exists in the form of a byte sequence (including non-signal data such as file headers and check bits), which cannot be directly called by the vector operation interface of the NumPy library. Therefore, it is necessary to convert the original binary data into physical quantities in floating-point format (such as time unit μs, voltage unit V, etc.) by parsing and converting the message array (such as a two-dimensional array containing timestamps and voltage values), and the data structure conforms to the NumPy operation specifications to facilitate subsequent processing.

[0034] Optionally, the message file is parsed and converted according to the data header structure identified by the oscilloscope to obtain a message array, including: Based on the data header structure, the data header of the message file is read in little-endian order to obtain the data attributes in each data header, and the data attributes are converted into Python variables; Read the subsequent data information of the message file according to the data type specified in the data header, and convert the data information format to decimal value; Based on the quantization relationship indicated by the oscilloscope, the decimal data information is converted into the actual acquired voltage value to obtain the message array.

[0035] Specifically, the data header structure and little-endian order are specified by the oscilloscope manufacturer and can be obtained when communication between the host computer and the oscilloscope is established. Based on the data header structure provided by the oscilloscope manufacturer, the message file is read byte-by-byte according to little-endian order to obtain the data attributes of the data header. These attributes include type, length, etc., and are converted into Python variables according to the corresponding byte length. After the data header is read, the remaining portion is considered the data itself. According to the data type provided in the data header (in the experiment, the oscilloscope returned a little-endian signed short integer, 2 bytes in length), the corresponding number of bytes in the message file are read each time, and the binary data is converted into decimal values. The quantization relationship identified by the oscilloscope manufacturer is obtained, and this decimal data is converted into the actual acquired value (e.g., voltage value, directly reflecting the voltage change of the CANH and CANL differential signals acquired by the oscilloscope) and stored in an array, resulting in the message array of the CAN bus recorded by the oscilloscope.

[0036] Step S4: Use the Numpy library to perform time-domain segmentation, normalization, and noise reduction on the data in the message array to obtain the message signal.

[0037] Specifically, the NumPy library in Python is used to preprocess the message array, that is, to perform bitwise AND segmentation, normalization and noise reduction on the data in the message array, so as to improve the purity of the message signal and improve the parsing accuracy.

[0038] Optionally, the NumPy library is used to perform time-domain segmentation, normalization, and denoising on the data in the message array to obtain the message signal, including: The data in the message array is divided into segments according to a preset number of data points and a preset inter-segment overlap rate to obtain segmented data segments.

[0039] Specifically, the data points in the read message array are time-domain segmented according to a preset number of data points and a preset inter-segment overlap rate to obtain segmented data segments. For example, if the preset number is 1,000,000 and the preset inter-segment overlap rate is 1%, then 1,000,000 data points are taken, denoted as... ,in The overlap rate is 1%, meaning that 10,000 data points are overlapped each time to prevent two consecutive data segments from separating a message. A single processing run of 1,000,000 data points prevents excessive memory usage and slow computation caused by excessively long data lengths that would require the algorithm to traverse all data points.

[0040] The NumPy library is used to perform a Discrete Fourier Transform on the segmented data to convert it into frequency domain data. The frequency domain data is then subjected to a high-pass filter, which includes setting frequency domain data with frequencies below a preset threshold to 0. Finally, the filtered frequency domain data is converted back to the time domain using an Inverse Discrete Fourier Transform to obtain the denoised time domain data.

[0041] Specifically, with the time axis as the horizontal axis and the corresponding signal value (such as voltage value) as the vertical axis, the discrete Fourier transform of the segmented data is performed using NumPy's FFT library, as expressed by formula (1): (1) , Among them, a n W represents the segmented data, where W represents the signal value at time n. N kn Let represent the relevant parameters in the Discrete Fourier Transform, i represent the imaginary unit, e represent the natural constant, N represent the total time length of the segmented data, and k represent different frequencies. Transforming the segmented data to the frequency domain yields its frequency domain data A at different frequencies. K .

[0042] The FFT transformation does not change the data length, so the data length is still 1,000,000 in the frequency domain. The frequency domain data is a complex number, and the horizontal axis of the transformed frequency domain data is the frequency, and the vertical axis is the amplitude of that frequency.

[0043] High-pass filtering is applied to the frequency domain data, setting data with frequencies below a preset threshold, such as 800,000, to 0 (it should be noted that this value can effectively separate the message signal from noise and preserve the message's form as much as possible), as shown in formula (2). After high-pass filtering, inverse discrete Fourier transform (IFFT) is used to convert the filtered frequency domain data back to the time domain. The inverse discrete Fourier transform can be expressed as formula (3), which means that the message array is initially denoised, and the message signal is initially separated.

[0044] (2) , (3) , Among them, A' k This represents the data after high-pass filtering, a' n W represents the denoised time-domain data. N -kn These are the relevant parameters in the inverse discrete Fourier transform. For example... Figure 2As shown, ① is the waveform of the original message signal, and ② is the waveform of the denoised time-domain data. Enlarging the message waveform at this point, as shown... Figure 3 As shown, the waveform of the time-domain data can be observed. Figure 3 Waveform diagram of (②) and the original message signal ( Figure 3 The specific details of (①).

[0045] The time-domain data is normalized using the maximum and minimum value normalization method to obtain normalized data.

[0046] Specifically, the filtered data is normalized using the maximum-minimum normalization method, which involves subtracting the minimum value from the data value and dividing by the maximum value minus the minimum value, as shown in formula (4). It should be noted that the maximum-minimum normalization method is a linear transformation that does not alter the data's inherent shape. After calculation, the data is scaled to the 0-1 range, eliminating signal amplitude deviations caused by differences in oscilloscope range settings, probe attenuation ratios, etc.

[0047] (4) Where, min(·) and max(·) represent functions for calculating the maximum and minimum values ​​of the sequence, respectively, b n This represents normalized data, where 0 ≤ b n ≤1.

[0048] Obtain the mean of the normalized data, and then perform mean thresholding on the normalized data based on the mean to obtain segmented data. The mean thresholding process includes retaining the original value of normalized data that is greater than the mean, and replacing the normalized data that is less than or equal to the mean with the mean.

[0049] Specifically, in normalized data, the high level of the message signal is a sparse signal. Therefore, the mean of the data is selected for threshold segmentation, that is, adaptive threshold segmentation is performed on the normalized data. First, the mean of the normalized data is calculated. Second, when segmenting, the part greater than the mean of the data is retained as the original value, and the part less than or equal to the mean of the data is replaced with the mean of the data, as shown in formula (5). (5) Among them, b' n This indicates that the data has been split. For example... Figure 4 As shown, ① is the waveform of the original data, ② is the mean of the waveform, and ③ is the waveform of the segmented data.

[0050] The segmented data is binarized to obtain binary logic levels.

[0051] Specifically, the segmented data is binarized, which is also a threshold segmentation process. A preset segmentation threshold, such as 0.5, is selected as the threshold. The data greater than or equal to 0.5 is set to 1, and the data less than 0.5 is set to 0, as shown in formula (6), to obtain the binarized logic level, as shown in formula (6). Figure 5 As shown, ① is the waveform of the original data, ② is the waveform of the segmented data, and ③ is the waveform of the binarized logic level. Enlarging the message waveform at this point, as shown... Figure 6 As shown, we can observe the specific details of ① the waveform of the original data, ② the waveform of the segmented data, and ③ the waveform of the binarized logic level.

[0052] (6) Among them, c n It represents a binary logic level, where the data contains only two logic values: 0 or 1.

[0053] Morphological erosion operation is performed on the binarized logic level to obtain the message signal.

[0054] Specifically, the binarized logic levels after binarization still have some noise interference, such as... Figure 7 The magnified waveform of the binarized logic level shown indicates that only some of the bumps represent messages. Therefore, a calculation method similar to erosion in morphological processing is used to eliminate this type of noise. The bit length (bit) is calculated based on the oscilloscope's recording sampling rate and the CAN bus message baud rate. Bit length = sampling rate / baud rate. To ensure accuracy, for segments of data with a logic value of 1 in the binarized logic level (i.e., continuous 1s), a 20-bit-long left and right pane judgment is performed. Figure 7 As shown, ① is the waveform of the original data, ② is the waveform of the data before binarization, and ③ is the data after binarization. The part where the two middle sliding windows intersect is the part with the value 1 after binarization. If the sum of the values ​​in either the left or right sliding window (the number of 1s) is greater than 1 / 5 of the length of the selected window, then the cut data segment is considered to be retained; otherwise, the cut data segment is set to 0. The calculation is shown in formula (7).

[0055] (7) in, c n A neighborhood of length 20 bits, c' n Indicates a message signal. For example... Figure 8 As shown, ① is the waveform of the original data, ② is the waveform of the message signal, and ③ is an example of the enlarged form of the message signal waveform.

[0056] At this point, NumPy's data preprocessing is complete, resulting in a relatively clean CAN bus message signal. .

[0057] Step S5: Use the "padding every five" strategy to filter error frames in the message signal, and parse the filtered message signal layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0058] Optionally, an error frame filtering strategy of padding every five frames is used to filter the message signal, and the filtered message signal is parsed layer by layer based on the CAN protocol structure to obtain the message parsing content, including: Traverse the message signal, calculate the length of each logic bit in the message signal according to the preset operating parameters, and determine the logic level of the logic bit based on the length data. When the number of "1"s in the length data is greater than or equal to half of the length data, the logic level is dominant and the corresponding logic value is set to 0. When the number of "1"s in the length data is less than half of the length data, the logic level is recessive and the corresponding logic value is set to 1.

[0059] Based on the strategy of adding one every five, the five most recently read logical values ​​are stored in a pre-created parsing queue. If five consecutive identical logical values ​​appear in the parsing queue and the next logical value is the same as that in the parsing queue, it is determined to be an error frame and parsing is abandoned. If no five consecutive identical logical values ​​appear in the parsing queue, the logical bit is discarded and the parsing queue is cleared to continue reading the logical value of the next logical bit until the error frame filtering of the entire message signal is completed.

[0060] Specifically, based on the CAN message's "padding every five" strategy, a parsing queue is created to store the five most recently read logical values. If the parsing queue contains five consecutive identical logical values, such as five 0s or five 1s, the next logical value is expected to be different from the value in the queue. If the next logical value does not meet this expectation, the message signal is considered to have generated an error frame, and parsing of the current message signal is abandoned. If the expectation is met, the next logical value is discarded, the discard count is calculated, the parsing queue is cleared, and the process continues to read the next logical value and add it to the parsing queue until all message signals are parsed.

[0061] Starting with the first dominant level as the frame start bit, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content.

[0062] Optionally, starting with the first dominant level as the frame start, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content, including: The logic value of the first preset number of bits after the start bit of the frame is read as the basic ID segment, and the ID segment information is obtained based on the logic value of the next bit and the basic ID segment.

[0063] Specifically, starting with the first dominant level, i.e., logic value 0, as the frame begins, the first preset number of bits, such as 11 bits, is read as the basic message ID. Next, the next logic value, i.e., the 12th logic value, is read. If the logic value is 0, then the logic value is the RTR bit (Remote Transmission Request), and the frame message is a standard data frame. If the logic value is 1, then the frame message is an extended data frame (CANFD, Controller Area Network with Flexible Data Rate). The next logic value should still be 1, confirming that the frame message is an extended data frame. Then, 18 logic values ​​are read as the extended ID segment information. Next, the next logic value of 0 is read as the RTR bit, and the reading of the extended data frame ID segment information ends.

[0064] The control segment data is obtained by reading the logic value of the second preset number of bits, and the data length code of the control segment data is obtained.

[0065] Specifically, the control segment is analyzed next. The control segment of both the standard data frame and the extended data frame is a second preset number of bits, for example, 6 bits. The first two bits are IDE (Identifier Extension) and R0, which are reserved bits of the CAN protocol. Their logic value is dominant level by default, that is, logic value 0. The last four bits are DLC (Data Length Code), which is the data length code. From 0000 to 1000, it represents a length of 0 bytes to 8 bytes respectively. For CANFD, 1001-1111 correspond to 12, 16, 20, 24, 32, 48, and 64 bytes respectively.

[0066] The message signal corresponding to the data length code is read to obtain the data segment content.

[0067] Specifically, if the frame message is determined to be a CAN message, the data segment information is still read according to the previously determined number of bytes, i.e., bit length. If it is a CANFD, the data segment bit length should be recalculated according to the data segment baud rate set by CANFD, and the data segment information is read according to the data segment bit length until the number of bytes determined by DLC is read and the data segment content is obtained.

[0068] Cyclic redundancy check (CRC) is used to verify each logical value in the message signal to obtain the verification result.

[0069] Specifically, the next step is to read the Cyclic Redundancy Check (CRC) segment. All logical values ​​in the message signal are checked using CRC. For CAN standard frames, the padding bits are removed according to the "padding every five" strategy. 15 bytes are read, and CRC15 polynomial is used for CRC verification. However, the CRC segment for CANFD includes extended data frames. First, four bits are read. CANFD adds a count check to the first four bits of the CRC segment to verify the previously discarded padding bits. The CANFD CRC segment no longer uses the previous padding; instead, it uses fixed-bit padding, starting from the CRC segment position and filling with the opposite value of the previous bit every four bits. The CRC segment length is determined based on the data segment length. If the data segment length is less than or equal to 16 bytes, CRC17 is used, and 21 (17+4) bits are read. If the data segment length is greater than 16 bytes, CRC21 is used, and 26 (21+5) bits are read. This allows for verification of the preceding message signal. If the verification passes, continue parsing the end segment content. If the verification fails, the message signal will be determined as an invalid frame, the parsing process will terminate, and the parsed content of the message will not be output.

[0070] Read the end segment information containing the CRC separator, acknowledgment bit, and ACK separator.

[0071] Specifically, three logical values ​​are read to represent the CRC separator, the acknowledgment bit (ACK), and the ACK separator, respectively. Then, seven logical values ​​are read to indicate the end of message parsing, and the end segment information is obtained. It should be noted that if any six or more consecutive "logic 0" or "logic 1" bits appear, it is considered an error frame, the parsing process is terminated, and the parsed content of the message is not output.

[0072] The message parsing content is obtained based on the ID segment information, data segment content, verification result, and end segment information.

[0073] In this embodiment, by pre-setting operating parameters (such as sampling rate and time base), it can flexibly adapt to different models of general-purpose oscilloscopes without relying on dedicated hardware or drivers from specific manufacturers. This solves the problem of limited compatibility and scalability of existing products. Furthermore, reasonable parameter settings lay the foundation for subsequent anti-interference processing and improve adaptability to complex environments. Waveform data is stored as message files in a pre-formatted format. A unified pre-formatted format (such as WFM format) breaks down the barriers between different oscilloscope data formats, avoiding analysis limitations caused by data format incompatibility, enhancing the universality of data processing, and eliminating the need to develop additional adapter modules for specific oscilloscopes. By identifying the data header structure identified by the oscilloscope, binary files from different manufacturers' oscilloscopes can be accurately parsed, converting the raw data into standardized message arrays, providing a data foundation for subsequent unified processing, and further improving compatibility with different devices. The NumPy library's generalized data processing capabilities avoid dependence on specific vendor drivers. Time-domain segmentation efficiently processes large amounts of data, avoiding excessive memory usage. Normalization eliminates signal amplitude deviations and improves data consistency. Noise reduction (such as Fourier transform filtering and erosion operations) effectively reduces electromagnetic noise interference, improves anti-interference capabilities, and provides high-quality message signals for subsequent parsing. Error frame filtering and protocol parsing are implemented through pure software algorithms, significantly reducing equipment costs compared to the additional purchase of CAN decoding licenses or hardware modules for oscilloscopes in related technologies. Furthermore, the parsing logic based on the universal CAN protocol is applicable to various CAN bus scenarios, further enhancing the method's versatility and universality. This invention, through a fully software-based design, adopts a generalized solution from data acquisition, storage, and parsing to signal processing and message generation, completely breaking the dependence of existing technologies on dedicated hardware, specific drivers, or additional licenses. It not only reduces equipment procurement and maintenance costs, but also significantly improves the compatibility, anti-interference capability and scalability of CAN bus waveform message analysis. It can be adapted to different models of general-purpose oscilloscopes and various CAN bus scenarios, providing a universal, efficient and low-cost end-to-end solution for fields such as vehicle network diagnostics and industrial bus monitoring, effectively solving the problem of insufficient universality of existing technologies.

[0074] like Figure 9 As shown, an embodiment of the present invention provides a CAN bus waveform message analysis device 900, comprising: The instruction module 910 is used to send an operation instruction carrying preset operating parameters to the oscilloscope, which is used to measure the differential signal of the CAN bus. Storage module 920 is used to store waveform data in a preset format in response to waveform data fed back from the oscilloscope; The conversion module 930 is used to parse and convert the message file according to the data header structure identified by the oscilloscope to obtain a message array; The preprocessing module 940 is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array using the NumPy library to obtain the message signal; The parsing module 950 is used to filter error frames in the message signal using a five-complement strategy, and to parse the filtered message signal layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0075] Optionally, the storage module 920 is also used for: The oscilloscope-specified identifier is used to read the first byte of the waveform data stream using Python, confirming the start of data transmission. The total length of the data stream is obtained. The waveform data is received in blocks according to a preset fixed length, starting from the beginning of data transmission, until all the waveform data is read. The read waveform data blocks are sequentially written into a message file of a preset format until all waveform data is transmitted and stored. The message file of the preset format includes a binary file in wfm format.

[0076] Optionally, the conversion module 930 is also used for: Based on the data header structure, the data header of the message file is read in little-endian order to obtain the data attributes in each data header, and the data attributes are converted into Python variables; Read the subsequent data information of the message file according to the data type specified in the data header, and convert the data information format to decimal value; Based on the quantization relationship indicated by the oscilloscope, the decimal data information is converted into the actual acquired voltage value to obtain the message array.

[0077] Optionally, the preprocessing module 940 is also used for: The data in the message array is divided into segments according to a preset number of data points and a preset inter-segment overlap rate to obtain segmented data segments; The NumPy library is used to perform a Discrete Fourier Transform on the segmented data to convert it into frequency domain data. High-pass filtering is then applied to the frequency domain data, which includes setting frequency domain data with frequencies below a preset threshold to 0. Finally, the filtered frequency domain data is converted back to the time domain using an Inverse Discrete Fourier Transform to obtain the denoised time domain data. The time-domain data is normalized using the maximum and minimum value normalization method to obtain normalized data; Obtain the mean of the normalized data, and perform mean threshold segmentation on the normalized data based on the mean to obtain segmented data. The mean threshold segmentation includes retaining the original value of the normalized data that is greater than the mean, and replacing the normalized data that is less than or equal to the mean with the mean. The segmented data is binarized to obtain binarized logic levels; Morphological erosion operation is performed on the binarized logic level to obtain the message signal.

[0078] Optionally, the parsing module 950 is also used for: Traverse the message signal, calculate the length of each logic bit in the message signal according to the preset operating parameters, and determine the logic level of the logic bit based on the length data. When the number of "1"s in the length data is greater than or equal to half of the length data, the logic level is dominant and the corresponding logic value is set to 0. When the number of "1"s in the length data is less than half of the length data, the logic level is recessive and the corresponding logic value is set to 1. Based on the strategy of adding one every five, the five most recently read logical values ​​are stored in a pre-created parsing queue. If five consecutive identical logical values ​​appear in the parsing queue and the next logical value is the same as that in the parsing queue, it is determined to be an error frame and parsing is abandoned. If no five consecutive identical logical values ​​appear in the parsing queue, the logical bit is discarded and the parsing queue is cleared to continue reading the logical value of the next logical bit until the error frame filtering of the entire message signal is completed. Starting with the first dominant level as the frame start bit, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content.

[0079] Optionally, the parsing module 950 is also used for: Read the logical value of the first preset number of bits after the start bit of the frame as the basic ID segment, and obtain the ID segment information based on the logical value of the next bit and the basic ID segment; Read the logic value of the second preset number of bits to obtain the control segment data, and obtain the data length code of the control segment data; Read the message signal corresponding to the number of bytes according to the data length code to obtain the data segment content; Cyclic redundancy check (CRC) is used to verify each logical value in the message signal to obtain the verification result; Read the end segment information containing the CRC separator, acknowledgment bit, and ACK separator; The message parsing content is obtained based on the ID segment information, data segment content, verification result, and end segment information.

[0080] Optionally, the instruction module 9100 is also used for: Establish communication with the oscilloscope via Socket and send run commands to the oscilloscope; Based on the running command, configure the oscilloscope's operating parameters according to the preset operating parameters, which include sampling rate, time base, channel probe attenuation ratio, vertical scaling, and vertical offset. The sampling rate is set based on the Nyquist sampling theorem. After the oscilloscope finishes recording waveform data, a storage command is sent to the oscilloscope.

[0081] like Figure 10 As shown, an electronic device 1000 provided in this embodiment of the invention includes a memory 1100 and a processor 1200; the memory 1100 is used to store a computer program; the processor 1200 is used to implement the above-mentioned CAN bus waveform message analysis method when the computer program is executed.

[0082] Alternatively, an electronic device 1000 includes a memory 1100 and a processor 1200 coupled to the memory 1100; the memory 1100 is configured to store a computer program; the processor 1200 is configured to perform the following operations when the computer program is executed: A running command carrying preset operating parameters is sent to the oscilloscope, which is used to measure the differential signal of the CAN bus. In response to the waveform data fed back from the oscilloscope, the waveform data is stored as a message file in a preset format; The message file is parsed and converted based on the data header structure identified by the oscilloscope to obtain a message array; The NumPy library is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array to obtain the message signal; Error frames are filtered by using a five-complement strategy for message signals, and the filtered message signals are parsed layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0083] This invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-mentioned CAN bus waveform message analysis method.

[0084] Alternatively, a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the following operations: A running command carrying preset operating parameters is sent to the oscilloscope, which is used to measure the differential signal of the CAN bus. In response to the waveform data fed back from the oscilloscope, the waveform data is stored as a message file in a preset format; The message file is parsed and converted based on the data header structure identified by the oscilloscope to obtain a message array; The NumPy library is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array to obtain the message signal; Error frames are filtered by using a five-complement strategy for message signals, and the filtered message signals are parsed layer by layer based on the CAN protocol structure to obtain the message parsing content.

[0085] The present invention will now be described an electronic device 1000 that can serve as a server or client of the present invention, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 1000 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 1000 can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0086] Electronic device 1000 includes a computing unit that can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) or a computer program loaded from a storage unit into random access memory (RAM). The RAM may also store various programs and data required for device operation. The computing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0087] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. In this application, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention according to actual needs. Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.

[0088] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.

Claims

1. A method for analyzing CAN bus waveform messages, characterized in that, include: A running command carrying preset operating parameters is sent to an oscilloscope, which is used to measure the differential signal of the CAN bus; In response to the waveform data fed back by the oscilloscope, the waveform data is stored as a message file in a preset format; The message file is parsed and converted according to the data header structure identified by the oscilloscope to obtain a message array; The NumPy library is used to perform time-domain segmentation, normalization, and denoising on the data in the message array to obtain the message signal; Error frames are filtered by using a five-complement strategy on the message signal, and the filtered message signal is parsed layer by layer based on the CAN protocol structure to obtain the message parsing content.

2. The CAN bus waveform message analysis method according to claim 1, characterized in that, The step of responding to the waveform data fed back by the oscilloscope and storing the waveform data as a message file in a preset format includes: The oscilloscope-specified identifier is used to read the first byte of the waveform data stream via Python to confirm the start of data transmission. The total length of the data stream is obtained, and the waveform data is received in blocks according to a preset fixed length, starting from the beginning of the data transmission, until all the waveform data is read. The read waveform data blocks are sequentially written into the message file of the preset format until all waveform data transmissions are completed and stored. The message file of the preset format includes a binary file in wfm format.

3. The CAN bus waveform message analysis method according to claim 1, characterized in that, The process of parsing and converting the message file based on the data header structure identified by the oscilloscope yields a message array, including: Based on the data header structure, the data header of the message file is read in little-endian order to obtain the data attributes in each data header, and the data attributes are converted into Python variables; Read the subsequent data information of the message file according to the data type specified in the data header, and convert the format of the data information into decimal values; Based on the quantization relationship identified by the oscilloscope, the decimal data information is converted into the actual acquired voltage value to obtain the message array.

4. The CAN bus waveform message analysis method according to claim 1, characterized in that, The process of using the NumPy library to perform time-domain segmentation, normalization, and denoising on the data in the message array to obtain the message signal includes: The data in the message array is divided into segments according to a preset number of data points and a preset inter-segment overlap rate to obtain segmented data segments; The segmented data is converted into frequency domain data by performing a Discrete Fourier Transform using the NumPy library. The frequency domain data is then subjected to high-pass filtering, which includes setting the frequency domain data with frequencies below a preset threshold to 0. Finally, the filtered frequency domain data is converted back to the time domain by an Inverse Discrete Fourier Transform to obtain the denoised time domain data. The time-domain data is normalized using the maximum and minimum value normalization method to obtain normalized data; Obtain the mean of the normalized data, and perform mean threshold segmentation on the normalized data based on the mean to obtain segmented data. The mean threshold segmentation includes retaining the original value of the normalized data that is greater than the mean, and replacing the normalized data that is less than or equal to the mean with the mean. The segmented data is binarized to obtain binarized logic levels; The message signal is obtained by performing morphological erosion operation on the binarized logic level.

5. The CAN bus waveform message analysis method according to claim 1, characterized in that, The message signal is subjected to error frame filtering using a five-padding-one strategy, and the filtered message signal is parsed layer by layer based on the CAN protocol structure to obtain the message parsing content, including: The message signal is traversed, and the length of each logic bit in the message signal is calculated according to the preset operating parameters. The logic level of the logic bit is determined based on the length data. When the number of "1"s in the length data is greater than or equal to half of the data size, the logic level is a dominant level and the corresponding logic value is set to 0. When the number of "1"s in the length data is less than half of the data size, the logic level is a recessive level and the corresponding logic value is set to 1. Based on the five-bit parsing strategy, the five most recently read logical values ​​are stored in a pre-created parsing queue. If five consecutive identical logical values ​​appear in the parsing queue and the next logical value is the same as that in the parsing queue, it is determined to be an error frame and parsing is abandoned. If no five consecutive identical logical values ​​appear in the parsing queue, the logical bit is discarded and the parsing queue is cleared to continue reading the logical value of the next logical bit until the error frame filtering of the entire message signal is completed. Starting with the first dominant level as the frame start bit, the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment are parsed according to the filtered message signals to obtain the message parsing content.

6. The CAN bus waveform message analysis method according to claim 5, characterized in that, The process begins with the first dominant level as the frame start, and parses the ID segment, control segment, data segment, cyclic redundancy check segment, and end segment according to the filtered message signals to obtain the message parsing content, including: Read the logical value of the first preset number of bits after the start bit of the frame as the basic ID segment, and obtain the ID segment information based on the logical value of the next bit and the basic ID segment; The control segment data is obtained by reading the logic value of the second preset number of bits, and the data length code of the control segment data is obtained. The message signal corresponding to the data length code is read to obtain the data segment content; The cyclic redundancy check method is used to check each of the logical values ​​in the message signal to obtain the check result; Read the end segment information containing the CRC separator, acknowledgment bit, and ACK separator; The message parsing content is obtained based on the ID segment information, the data segment content, the verification result, and the end segment information.

7. The CAN bus waveform message analysis method according to claim 1, characterized in that, The step of sending a running command carrying preset operating parameters to the oscilloscope includes: Communication is established with the oscilloscope via a Socket, and the running command is sent to the oscilloscope; Based on the running command, the operating parameters of the oscilloscope are configured according to the preset operating parameters, wherein the preset operating parameters include sampling rate, time base, channel probe attenuation ratio, vertical scaling and vertical offset, and the sampling rate is set based on the Nyquist sampling theorem; After the oscilloscope finishes recording the waveform data, a storage command is sent to the oscilloscope.

8. A CAN bus waveform message analysis device, characterized in that, include: The instruction module is used to send an operation instruction carrying preset operating parameters to the oscilloscope, which is used to measure the differential signal of the CAN bus. A storage module is used to store the waveform data fed back by the oscilloscope as a message file in a preset format in response to the waveform data. The conversion module is used to parse and convert the message file according to the data header structure identified by the oscilloscope to obtain a message array; The preprocessing module is used to perform time-domain segmentation, normalization, and noise reduction on the data in the message array using the NumPy library to obtain the message signal; The parsing module is used to perform error frame filtering on the message signal using a five-complement strategy, and to perform layer-by-layer parsing on the filtered message signal based on the CAN protocol structure to obtain the message parsing content.

9. An electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to implement the CAN bus waveform message analysis method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the CAN bus waveform message analysis method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Safety instrument system communication method and system based on redundant control bus

    CN121864528A

  • A safety instrumented system communication method and system based on redundant control bus

    CN121864528B