An on-vehicle diagnostic system and method based on CAN communication and adjustable power supply
Through an on-board diagnostic system based on CAN communication and adjustable power supply, CAN message structure and semantic recognition under no protocol file conditions are realized. Combined with abnormal detection and power supply control, the diagnosis problems of the existing system in a multi-vehicle and multi-supplier environment are solved, and the universality and diagnostic capabilities of the system are improved.
Patent Information
- Application Number
- CN202510641546.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-05-19
AI Technical Summary
The existing on-board diagnostic systems are difficult to identify the CAN packet structure and semantics under the condition of no protocol files, lack the flexibility of abnormal detection and closed-loop control capabilities, and cannot meet the testing needs of multiple models and multiple suppliers.
The on-board diagnostic system based on CAN communication and adjustable power supply is adopted. Through the CAN communication acquisition module, data processing module, signal semantic recognition module, abnormal detection module and control instruction generation module, automatic identification of CAN message structure, semantic labeling and abnormal detection are realized, and real-time control is carried out through the adjustable power supply.
Under the condition of no protocol file, the automatic recognition of CAN packet structure and semantics is realized, the universality and intelligence of the system are enhanced, and the multi-dimensional abnormality detection capability is equipped with the closed-loop execution path of signal recognition-state judgment-power supply adjustment is built, which is suitable for multi-vehicle models and multi-platform environments.
Smart Images

Figure CN120161820B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle electronic diagnosis, and in particular to a vehicle-mounted diagnosis system and method based on CAN communication and an adjustable power supply. Background Art
[0002] With the development of intelligent connected vehicles, autonomous driving, and electric vehicles, high-speed communication between electronic control units (ECUs) within a vehicle via the CAN (Controller Area Network) bus has become the mainstream architecture. CAN-based in-vehicle communication, with its clear structure and stable transmission, plays a vital role in applications such as vehicle status monitoring, fault diagnosis, and test verification. Engineers often analyze the signal fields in CAN messages to understand the operating status and interaction behavior of various ECUs, assisting in functional verification and troubleshooting.
[0003] In existing technologies, parsing CAN communication messages typically relies on manufacturer-provided DBC protocol files to capture information such as message structure, signal boundaries, and semantic tags. However, in application scenarios such as actual testing, reverse engineering, and cross-vehicle platform development, the following issues often arise: First, a lack of protocol file support prevents the correct identification of message field structures; second, even if the structure is available, its signal semantics are difficult to discern, making it difficult to meet the flexible testing requirements of multiple models and suppliers; third, current anomaly detection is mostly based on threshold rules, which cannot capture abnormal patterns at the temporal behavioral level; and fourth, most existing diagnostic systems remain at the data collection and analysis level, lacking a proactive response mechanism to abnormal conditions, making closed-loop control difficult.
[0004] Therefore, there is an urgent need for an on-board diagnostic system that can complete CAN message structure recognition and semantic inference without protocol files, realize anomaly detection based on signal behavior prediction, and link with an adjustable power supply for real-time control response, so as to improve the versatility, intelligence and diagnostic closed-loop capabilities in complex vehicle environments. Summary of the Invention
[0005] The purpose of the present invention is to provide an on-board diagnostic system and method based on CAN communication and adjustable power supply, which are used to identify the CAN message structure and semantics without a protocol file, identify abnormal conditions based on behavioral characteristics, and drive the adjustable power supply for closed-loop response control, so as to solve the problems of existing diagnostic systems such as strong structural dependence, undistinguishable semantics, limited abnormal judgment and lack of linkage response.
[0006] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0007] In one aspect, the present invention provides an on-board diagnostic system based on CAN communication and an adjustable power supply, comprising:
[0008] A CAN communication acquisition module, used to establish a communication connection with the vehicle electronic control unit and acquire CAN message data including timestamp information;
[0009] A data processing module, used to parse the CAN message data, identify one or more signal fields in the message, and perform byte order identification and sign bit identification on each signal field to obtain structured signal values;
[0010] A signal semantics recognition module, used to align the structured signal values with reference data to determine the semantic tags of the structured signal values, where the reference data is vehicle status information obtained through the OBD-II interface, vehicle sensors or manual input;
[0011] An anomaly detection module, used to build a prediction model based on the structured signal values and time information, compare the prediction results with the actual signal behavior, determine whether there is an anomaly, and output an anomaly flag;
[0012] A control instruction generation module, used to generate control instructions according to the anomaly flag, where the control instructions include control commands for setting power supply parameters;
[0013] An adjustable power supply device module, used to adjust the output voltage and current parameters according to the control instructions and control the power supply status of the vehicle electronic control unit.
[0014] A further improvement of the present invention lies in that the CAN communication acquisition module includes:
[0015] A multi-channel synchronous acquisition unit, used to receive messages from multiple CAN communication channels in parallel, and perform time alignment processing on the time information of each channel message based on a unified hardware clock to form a raw message sequence with a unified time reference;
[0016] An acquisition consistency verification unit, used to perform acquisition quality detection on the message sequence, including judging whether there are message losses, repetitions, abnormal field lengths or timestamp mutations, and generating an acquisition consistency identifier for each message, which is used to provide to the anomaly detection module as a basis for judging data validity.
[0017] A further improvement of the present invention lies in that the data processing module includes:
[0018] A byte feature extraction unit, used to extract the following features for each byte position in the acquired CAN message sequence Extract the following features:
[0019] Byte flip rate , the expression is:
[0020] ;
[0021] Average byte value , the expression is:
[0022] ;
[0023] Different value ratio , the expression is:
[0024] ;
[0025] in: Indicates the The first The field value in bytes, is the total number of messages, is the logical indicator function; Indicates the The number of different values that a byte has in all messages;
[0026] A byte clustering unit is used to input the feature vector composed of the above three types of features into a density-based spatial clustering algorithm for cluster analysis to identify candidate signal field boundaries. The algorithm uses Euclidean distance as a similarity metric, and the cluster radius and minimum number of samples are preset system parameters;
[0027] The field output unit is used to output the field boundaries in the clustering results as structured field information.
[0028] A further improvement of the present invention is that the data processing module includes:
[0029] Bit-level entropy analysis unit, used to perform sliding window entropy value calculation in the CAN message data field, the window is a sliding window with a length of 8 bits and a step size of 1 bit , the entropy calculation formula is:
[0030] ;
[0031] in: Indicates bit value The probability of occurrence within a window, where the window step is 1 bit;
[0032] The entropy difference determination unit is used to calculate the entropy difference between adjacent sliding windows. The calculation formula is:
[0033] ;
[0034] When the entropy difference Greater than the preset threshold When , determine the window starting index is the candidate signal field boundary position;
[0035] A field combination verification unit is configured to perform position matching verification on the candidate field boundaries identified by the entropy difference determination unit and the field boundaries identified by the clustering algorithm. If the two boundary positions are the same or the distance therebetween is less than a preset tolerance value, it is determined as a valid signal field boundary;
[0036] A field output unit is configured to output the valid field boundary information confirmed by the field combination verification unit, including the start byte index and the end byte index of the field.
[0037] A further improvement of the present invention lies in that the signal semantic recognition module includes:
[0038] A status data normalization processing unit is configured to collect a reference status data sequence during the running of the vehicle, align the reference status data with the structured signal value sequence in terms of dimension, and achieve the consistency of the sequence length through resampling, linear interpolation or time synchronization;
[0039] A sequence matching and recognition unit is configured to use the structured signal value sequence as an input, perform one-to-one matching with the reference status data sequence, construct a double-sequence difference degree matrix, and search for the matching path with the minimum cost in the two-dimensional index space based on the cumulative difference cost of the matrix elements. The matching path represents the optimal reference label correspondence relationship of the structured signal value in the time dimension;
[0040] A label output unit is configured to label the structured signal fields as dynamic class, status class or verification class semantic labels respectively according to the category information corresponding to the reference data samples in the matching path, and output them as the signal semantic recognition result.
[0041] A further improvement of the present invention lies in that the anomaly detection module includes:
[0042] A structure rule matching unit is configured to compare the structured signal value with the reference numerical value range corresponding to the semantic label. If the current signal value exceeds the preset minimum and maximum value ranges, it is determined as a structure anomaly, and a structure anomaly flag is output;
[0043] A time deviation detection unit is configured to obtain the difference between the current actual acquisition time and the predicted acquisition time of the structured signal value. If the time difference exceeds the preset tolerance threshold range, it is determined as a time anomaly, and a time anomaly flag is output;
[0044] A combined anomaly determination unit is configured to receive the structure anomaly flag and the time anomaly flag. If both are established at the same moment, an anomaly determination signal for indicating a high-level anomaly state is output.
[0045] A further improvement of the present invention lies in that the anomaly detection module further includes a prediction model module, and the prediction model module includes:
[0046] A period normalization unit, which is used to calculate the time interval between any current message and the previous message based on the CAN message timestamp data collected historically, and divide the time interval by the average period value corresponding to the message identifier to obtain a normalized period value;
[0047] A prediction model training unit, which is used to construct a recurrent neural network model containing two layers of long short-term memory neural units, and train the normalized period sequence. The training objective is to minimize the mean square error between the predicted time output by the model and the actual acquisition time;
[0048] A time judgment interval generation unit, which is used to determine an acceptable time interval within which the actual acquisition time should be based on the output result of the prediction model and the historical prediction error range; when the actual acquisition time of the current message exceeds this time interval, a prediction anomaly flag is generated to indicate the existing time behavior anomaly.
[0049] A further improvement of the present invention lies in that the control instruction generation module includes:
[0050] A mapping unit, which is used to call the corresponding control instruction template according to the anomaly level flag output by the anomaly detection module, and the template is preset with an instruction structure for power supply control;
[0051] A parameter injection unit, which is used to write the current control parameters into the control instruction template, and the control parameters include the target voltage value, the target current value and the continuous execution time;
[0052] An instruction encapsulation unit, which is used to encapsulate the instruction template injected with control parameters according to the preset serial communication protocol, and output the encapsulated control instruction data packet to the adjustable power supply device interface to control the voltage and current output behavior.
[0053] A further improvement of the present invention lies in that the adjustable power supply device includes:
[0054] A serial port communication unit, which is used to receive the control instruction data packet from the control instruction generation module based on the serial port protocol, and the protocol is MODBUSRTU or an equivalent communication protocol;
[0055] A control instruction parsing unit, which is used to parse the control instruction data packet, extract the set parameter information, and control the power supply module to adjust the output voltage to the target voltage, the output current to the target current, and maintain the output duration;
[0056] A status feedback unit, which is used to periodically read the current output status parameters during the power supply control process, including the real-time output voltage, current and working status identifier, and feedback the status parameters through the serial port communication unit for subsequent control judgment.
[0057] On the other hand, the present invention provides a vehicle diagnostic method based on CAN communication and an adjustable power supply, which is applied to the vehicle diagnostic system based on CAN communication and an adjustable power supply as described above, and includes the following steps:
[0058] Step 1: Establish a CAN communication connection, and collect CAN message data containing timestamp information through a CAN communication acquisition module;
[0059] Step 2: Parse the CAN message data through a data processing module, identify one or more signal fields in the message, and perform byte order identification and sign bit identification on each signal field to obtain a structured signal value;
[0060] Step 3: Through a signal semantics recognition module, align the structured signal value with reference data obtained through an OBD-II interface, vehicle sensors, or manual input, and determine the semantic label of the structured signal value based on the comparison result;
[0061] Step 4: Through an anomaly detection module, construct a prediction model based on the structured signal value and its corresponding timestamp information, and compare the prediction result with the actual signal behavior to determine whether there is an anomaly and output an anomaly flag;
[0062] Step 5: Through a control instruction generation module, generate a control instruction according to the anomaly flag, and the control instruction includes power supply parameters such as a target voltage value, a target current value, and a continuous execution time;
[0063] Step 6: Receive and execute the control instruction through an adjustable power supply device, and adjust the output voltage and current parameters to control the power supply state of the vehicle electronic control unit.
[0064] Compared with the prior art, the beneficial effects of the present invention are as follows: Without a protocol file, the present invention can automatically identify the message structure and field boundaries based on the collected CAN message data, and is applicable to the general diagnostic requirements in scenarios where multiple vehicle models and multiple protocols cannot be obtained; Through matching and analysis with reference state data, semantic annotation of structured signal values is realized, which can assist in identifying the physical meaning corresponding to signal fields and enhance the data interpretation ability of the system; The system integrates rule detection and time prediction methods, can comprehensively judge structural anomalies, time deviations, and behavioral anomalies, and improves the ability to identify abnormal signal states; Combining the generation of control instructions with the linkage of adjustable power supply devices, power supply parameter control based on diagnostic results can be realized, and a closed-loop execution path of signal recognition - state judgment - power supply adjustment is constructed; The system module is clearly divided, the interface definition is clear, it can be applied to various software and hardware platform deployments, and has good engineering feasibility and test adaptability. Description of the Drawings
[0065] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. Among them:
[0066] Figure 1 It is the system modular diagram of the present invention;
[0067] Figure 2 It is the method flow diagram of the present invention. Specific embodiments
[0068] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions of the embodiments of the present invention in conjunction with the drawings of the embodiments of the present invention. Obviously, the described embodiments are some, rather than all, of the embodiments of the present invention. Based on the described embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present invention.
[0069] This embodiment provides an on-vehicle diagnostic system and method based on CAN communication and an adjustable power supply. The system can automatically complete CAN message structure analysis, signal semantic recognition, anomaly detection, and response control without relying on a CAN protocol database (such as a DBC file), and is applicable to application scenarios such as in-service testing of vehicle electronic control units (ECUs), anomaly behavior recognition, and fault injection response.
[0070] As Figure 1 shown, it is an embodiment of the present invention. This embodiment provides an on-vehicle diagnostic system based on CAN communication and an adjustable power supply, including:
[0071] (1) CAN communication acquisition module
[0072] The CAN communication acquisition module is used to establish a CAN communication connection with the vehicle electronic control unit (ECU), collect the message data on the vehicle internal CAN bus, and attach an accurate timestamp to each message to achieve multi-channel synchronization and subsequent data parsing. The composition of this module is as follows:
[0073] Multi-channel synchronous acquisition unit
[0074] This unit is responsible for receiving messages from multiple CAN communication channels in parallel and adapting to multiple network segments such as the vehicle controller, powertrain system, and chassis control.
[0075] To achieve time consistency among channels, this unit assigns timestamps to all messages based on a unified hardware clock, thus forming a sequence of raw messages with a unified time reference.
[0076] The accuracy of the message timestamp can be better than 1 ms;
[0077] Supports channel expansion, such as interfaces like CAN0 / CAN1 / CANFD, etc.;
[0078] Optionally supports a synchronous trigger mechanism to start acquisition driven by an external signal.
[0079] This mechanism ensures that the data collected from all channels has a unified time reference, supporting subsequent time modeling of message behavior and extraction of timing features.
[0080] Acquisition Consistency Verification Unit
[0081] This unit is used to perform quality detection on the collected message sequence, specifically including:
[0082] Message integrity judgment: Detect whether there are missing or duplicate messages;
[0083] Field anomaly detection: Identify problems such as abnormal field lengths and illegal identifiers;
[0084] Timestamp jump detection: Analyze the time continuity of messages and judge whether there are abnormal mutations;
[0085] Consistency flag generation: According to the verification results, attach an acquisition consistency flag to each message for data validity screening.
[0086] The consistency flag will be used as an auxiliary basis for signal credibility judgment in the subsequent anomaly detection module. For example, it filters out abnormal messages caused by communication jitter or interruption, improving diagnostic accuracy.
[0087] Implementation Basis and Software and Hardware Environment
[0088] This module can be deployed in the upper computer test platform. For example, use the TSMaster tool to configure the acquisition channels and timestamp functions, and connect to the vehicle network through USB-CAN or PCIe-CAN interfaces. It can also be integrated into a dedicated diagnostic device as a front-end acquisition subsystem.
[0089] (2) Data Processing Module
[0090] The data processing module is used to convert the message data obtained by the CAN communication acquisition module into structured signal values and identify the valid field boundaries in the messages. To adapt to the situation where there is no DBC protocol file in practice, this module realizes field parsing through a dual-path structure extraction mechanism, that is:
[0091] Byte feature clustering path;
[0092] Bit-level entropy value analysis path;
[0093] The two paths independently identify the field boundaries and improve the recognition accuracy through result fusion.
[0094] 1. Byte feature clustering path
[0095] This path identifies the structural features of the signal fields in the CAN message based on statistical features and clustering algorithms.
[0096] 1.1 Byte feature extraction unit
[0097] This unit is used to extract three types of feature values for each byte position in the CAN message and is defined as follows:
[0098] Byte flip rate , the expression is: reflecting the bit volatility at this position:
[0099] ;
[0100] Average byte value , the expression is: reflecting the numerical level:
[0101] ;
[0102] Ratio of different values , the expression is: reflecting the variation range:
[0103] ;
[0104] Where: represents the field value of the th byte in the th CAN message, is the total number of messages, is the logical indicator function; represents the number of different values that the th byte appears in all messages;
[0105] 1.2 Byte clustering unit
[0106] Combine the above three feature values to form a feature vector and input it into a density clustering algorithm (such as DBSCAN). The specific implementation is as follows:
[0107] Distance metric: Euclidean distance;
[0108] Similarity judgment: Based on a preset clustering radius and minimum number of samples;
[0109] Output result: Identify the boundaries of the clustering intervals as candidate field boundaries.
[0110] 1.3 Field output unit
[0111] Output the boundary indexes of each clustering section in the clustering result as the start and end positions of the structured field, as the preliminary field recognition result.
[0112] 2. Bit-level entropy value analysis path
[0113] This path analyzes the change trend of each bit in the CAN message based on the information entropy principle, and is used to assist in identifying the signal field boundary.
[0114] 2.1 Bit-level entropy analysis unit
[0115] Perform a bit-level sliding window operation on the CAN message data:
[0116] Window length: 8 bits;
[0117] Step size: 1 bit;
[0118] Entropy value calculation formula:
[0119] ;
[0120] Where: Represents the probability of the bit value Appearing within the window, and the window step size is 1 bit;
[0121] 2.2 Entropy difference determination unit
[0122] Used to detect the change amplitude between adjacent windows:
[0123] The entropy difference value is defined as:
[0124] ;
[0125] When the entropy difference Is greater than the preset threshold Determine the start index of the window As the candidate signal field boundary position;
[0126] 3. Field boundary fusion verification mechanism
[0127] 3.1 Field joint verification unit
[0128] Match the field boundaries identified by clustering with the entropy difference mutation points. If their positions are close, it is determined as a valid field boundary.
[0129] 3.2 Field output unit
[0130] Output the valid field boundary information confirmed through joint verification, including the start and end byte indexes of the field, and provide it to the subsequent module as structured field information.
[0131] Module output result
[0132] Field position (start byte, end byte);
[0133] Structured signal value corresponding to each field;
[0134] Basic attributes of each field (byte order, signed / unsigned flag, etc.).
[0135] In this embodiment, the module effectively improves the field recognition ability of the system under the condition of lack of protocol support by introducing a dual-path mechanism of statistical clustering + information entropy analysis, and is applicable to the CAN message structure analysis tasks of different vehicle models and different supplier ECUs, with strong engineering adaptability and technical expandability.
[0136] (3) Signal semantic recognition module
[0137] This module is used to identify the semantic types (such as dynamic type, status type, verification type) of structured signal fields according to the vehicle operation state data, and realize the automatic meaning classification of unknown CAN signals. The module consists of the following sub-units:
[0138] Status data normalization processing unit
[0139] Collect the reference status data sequence during vehicle operation (such as engine speed, vehicle speed, gear obtained through OBD-II, etc.);
[0140] Perform time synchronization, resampling or linear interpolation processing on the reference data to ensure that it is aligned with the structured signal value sequence in the time dimension and has the same data length;
[0141] Support the diversity of reference data sources and have strong versatility.
[0142] Sequence matching and recognition unit
[0143] Based on the structured signal value sequence, construct a double-sequence difference degree matrix between it and the reference status data;
[0144] Use the cumulative cost minimum path algorithm (such as DTW) to search for the minimum cost matching path in the two-dimensional index space;
[0145] The matching path can represent the most similar alignment relationship of the signal with the reference status in the time dimension.
[0146] Label output unit
[0147] According to the labels of the reference status samples in the matching path, the structured signal fields are labeled into the following three categories:
[0148] Dynamic category (such as engine speed);
[0149] Status category (such as gear position, switch);
[0150] Verification category (such as CRC field);
[0151] The output result is referenced by the anomaly detection module.
[0152] (4)Anomaly detection module
[0153] This module is used to judge whether the signal shows abnormal behavior based on the signal result after semantic recognition, and then serves as the basis for the system response decision. Its composition is as follows:
[0154] Structure rule matching unit
[0155] For each structured signal value, compare it according to the reference numerical range corresponding to its semantic label;
[0156] If the signal value is less than the minimum value or greater than the maximum value, it is regarded as a structural anomaly;
[0157] Output the structural anomaly flag.
[0158] Time deviation detection unit
[0159] Obtain the acquisition time of the current message;
[0160] Compare it with the expected sampling time of the corresponding message identifier;
[0161] If the time difference exceeds the tolerance threshold preset by the system, it is marked as a time anomaly.
[0162] Joint anomaly determination unit
[0163] If the structural anomaly flag and the time anomaly flag appear simultaneously at the same sampling moment, the system determines it as a high-level anomaly state;
[0164] This state will trigger a key control response.
[0165] Prediction model module
[0166] To improve the intelligence of time behavior recognition, the system further introduces a periodic prediction model:
[0167] Period normalization unit
[0168] For any current message, calculate the time interval between it and the previous message;
[0169] Divide the interval by the average period of the message identifier to obtain a sequence of normalized period values.
[0170] Prediction model training unit
[0171] Construct a recurrent neural network containing two layers of LSTM (Long Short-Term Memory) neural units;
[0172] Use the sequence of normalized period values as input to predict the next cycle sampling time;
[0173] The training objective of the model is to minimize the mean square error between the actual sampling time and the predicted value.
[0174] Time judgment interval generation unit
[0175] Generate an acceptable sampling time interval based on the model output and historical error fluctuations;
[0176] If the current sampling time exceeds this interval, generate a prediction anomaly flag.
[0177] (5) Control instruction generation module
[0178] This module is used to automatically generate control instructions according to the anomaly level, and drive an external adjustable power supply to intervene in the power supply state of the ECU.
[0179] The module includes:
[0180] Mapping unit
[0181] Receive the anomaly level flag (such as level one, level two, level three) from the anomaly detection module;
[0182] Call the corresponding control strategy template, which presets the instruction structure and placeholder fields.
[0183] Parameter injection unit
[0184] Fill in the control parameters such as the target voltage value, current value, and duration into the template;
[0185] Support dynamic configuration of control strategies and adaptive calculation of parameters (such as control modes of boosting, power-off, and bucking fluctuations).
[0186] Instruction encapsulation unit
[0187] [[ID=5,4]]Encapsulate the control template after parameter injection into a serial port protocol data packet;
[0188] Support common protocol formats such as MODBUSRTU and SCPI;
[0189] Output the encapsulated instructions to the adjustable power supply device through the serial port.
[0190] (6) Adjustable power supply device
[0191] This module is the power supply actuator of the system, which changes the power supply parameters for the vehicle-mounted electronic control unit according to the received control instructions.
[0192] The module includes:
[0193] Serial communication unit
[0194] Used to receive control instruction data packets;
[0195] Supports MODBUSRTU, SCPI or user-defined protocols;
[0196] The communication baud rate and check format are configurable.
[0197] Control instruction parsing unit
[0198] Parse the voltage, current, and time parameters in the data packet;
[0199] The control power output module adjusts the voltage to the set value, stably outputs the current, and maintains the set duration.
[0200] Status feedback unit
[0201] Periodically read the current power output parameters, including real-time voltage, current, overload status, etc.;
[0202] Feed back the status parameters to the host computer through the serial port to achieve a closed loop of power supply control.
[0203] As Figure 2 shown, this is another embodiment of the present invention. This embodiment provides a vehicle diagnosis method based on CAN communication and adjustable power supply, which applies a vehicle diagnosis system based on CAN communication and adjustable power supply as described above. It is characterized by including the following steps:
[0204] Step 1: Establish a CAN communication connection, and collect CAN message data containing timestamp information through the CAN communication acquisition module;
[0205] Step 2: Parse the CAN message data through the data processing module, identify one or more signal fields in the message, and perform byte order identification and sign bit identification on each signal field to obtain structured signal values;
[0206] Step 3: Through the signal semantic recognition module, align the structured signal values with the reference data obtained through the OBD-II interface, vehicle sensors, or manual input, and determine the semantic tags of the structured signal values based on the comparison results;
[0207] Step 4: Through the anomaly detection module, construct a prediction model based on the structured signal values and their corresponding timestamp information, and compare the prediction results with the actual signal behavior to determine whether there is an anomaly and output an anomaly flag;
[0208] Step 5: Through the control instruction generation module, generate control instructions according to the anomaly flag. The control instructions include power supply parameters such as target voltage value, target current value, and continuous execution time;
[0209] Step 6: Receive and execute the control instructions through the adjustable power supply device to adjust the output voltage and current parameters to control the power supply state of the in-vehicle electronic control unit.
[0210] This method provides a complete technical path from signal structure recognition, semantic understanding, anomaly recognition to power supply intervention control, and constructs a closed-loop process of CAN diagnosis data-driven + abnormal behavior trigger + power supply control response. This method is applicable to the following typical application scenarios:
[0211] CAN signal recognition and monitoring under the condition of no DBC protocol;
[0212] ECU operation behavior stability analysis and automatic anomaly recognition;
[0213] Power disturbance injection test and fault simulation verification;
[0214] Intelligent driving system status confirmation and failure response control.
[0215] The method process has strong module independence and system integration, and is applicable to various automotive electronics development and verification scenarios such as software platform deployment, hardware-in-the-loop simulation (HIL), and bench test systems.
[0216] In summary, the present invention realizes the full-process diagnostic control ability of the in-vehicle electronic control unit by constructing a multi-module collaborative system including CAN communication acquisition, data structured processing, semantic recognition, anomaly detection, control instruction generation, and adjustable power supply response. This system can complete the structure recognition and semantic judgment of CAN signals under the condition of no protocol, has multi-dimensional anomaly detection ability, and can automatically drive the power supply device to perform closed-loop power supply regulation according to the diagnostic results, breaking through the limitations of existing in-vehicle diagnostic technologies in terms of structure dependence, behavior recognition, and linkage control. The whole system has the characteristics of flexible architecture, high functional integration, and strong engineering adaptability, and is applicable to the in-vehicle electronic control unit debugging and verification, fault simulation testing, and system robustness evaluation in multi-vehicle and multi-platform environments, and has broad application prospects and promotion value.
[0217] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0218] Any process or method description shown in the flowchart or described in other ways herein can be understood as representing a module, segment, or part of code including one or more executable instructions for implementing a specific logical function or process. And the scope of the preferred embodiments of the present application includes additional implementations, where the functions may be executed in a substantially simultaneous manner or in a reverse order according to the functions involved, without being in the order shown or discussed.
[0219] As described above, the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of various changes or substitutions, and these should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An on-vehicle diagnostic system based on CAN communication and an adjustable power supply, characterized in that, The system includes: A CAN communication acquisition module, which is used to establish a communication connection with an in-vehicle electronic control unit and acquire CAN message data including timestamp information; A data processing module, which is used to parse the CAN message data, identify one or more signal fields in the message, and perform byte order identification and sign bit identification on each signal field to obtain structured signal values; A signal semantics recognition module, which is used to align the structured signal values with reference data to determine the semantic tags of the structured signal values. The reference data is vehicle status information obtained through an OBD-II interface, in-vehicle sensors or manual input; An anomaly detection module, which is used to construct a prediction model based on the structured signal values and time information, compare the prediction result with the actual signal behavior, determine whether there is an anomaly, and output an anomaly level flag; A control instruction generation module, which is used to generate control instructions according to the anomaly level flag. The control instructions include control commands for setting power supply parameters; An adjustable power supply device module, which is used to adjust the output voltage and current parameters according to the control instructions and control the power supply status of the in-vehicle electronic control unit.
2. The on-vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that, The CAN communication acquisition module includes: A multi-channel synchronous acquisition unit, which is used to receive messages from multiple CAN communication channels in parallel, and perform time alignment processing on the time information of each channel message based on a unified hardware clock to form an original message sequence with a unified time reference; An acquisition consistency verification unit, which is used to perform acquisition quality detection on the message sequence, including determining whether there are message losses, repetitions, abnormal field lengths or timestamp mutations, and generating an acquisition consistency identifier for each message, which is used to provide to the anomaly detection module as a basis for data validity judgment.
3. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, wherein, The data processing module includes: Byte feature extraction unit, used to extract features for each byte position in the collected CAN message sequence as follows: Byte flip rate , the expression is: ; Average byte value , the expression is: ; Different value ratios , the expression is: ; Wherein: represents the th field value of the th byte in the th CAN message, is the total number of messages, is the logical indication function; represents the number of different values that the th byte appears in all messages; A byte clustering unit, which is used to input the feature vectors composed of the above three types of features into a density-based spatial clustering algorithm for clustering analysis to identify candidate boundaries of signal fields. The algorithm uses the Euclidean distance as the similarity metric, and the clustering radius and minimum sample number are preset system parameters; A field output unit, which is used to output the field boundaries in the clustering result as structured field information.
4. The in-vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 3, characterized in that, The data processing module includes: Bit-level entropy analysis unit, used to perform sliding window entropy value calculation in the CAN message data field, where the window is a sliding window with a length of 8 bits and a step size of 1 bit , and the entropy value calculation formula is: ; Wherein: represents the bit value appearance probability within the window, and the window step size is 1 bit; An entropy difference determination unit, which is used to calculate the entropy difference between adjacent sliding windows. The calculation formula is: ; When the entropy difference is greater than a preset threshold , the starting index of the determination window is the boundary position of the candidate signal field; A field joint verification unit, which is used to perform position matching verification on the candidate field boundaries identified by the entropy difference determination unit and the field boundaries identified by the clustering algorithm. If the two boundary positions are the same or the distance between them is less than a preset tolerance value, it is determined as a valid signal field boundary; A field output unit, which is used to output the valid field boundary information confirmed by the field joint verification unit, including the start byte index and end byte index of the field.
5. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that, The signal semantics recognition module includes: A state data normalization processing unit, which is used to collect a reference state data sequence during vehicle operation, align the reference state data sequence with the structured signal value sequence in dimension, and achieve sequence length consistency through resampling, linear interpolation or time synchronization; A sequence matching and recognition unit, which takes a structured signal value sequence as input, performs one-to-one matching with a reference state data sequence, constructs a two-sequence difference degree matrix, and searches for the matching path with the minimum cost in a two-dimensional index space based on the cumulative difference cost of matrix elements. The matching path represents the optimal reference label correspondence of the structured signal value in the time dimension; A label output unit, which, according to the category information corresponding to the reference data samples in the matching path, marks the structured signal fields as dynamic class, state class, or check class semantic labels respectively, and outputs them as the signal semantic recognition result.
6. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that, The anomaly detection module includes: A structure rule matching unit, which compares the structured signal value with the reference numerical value range of the corresponding semantic label. If the current signal value exceeds its preset minimum and maximum value ranges, it is determined as a structure anomaly and a structure anomaly flag is output; A time deviation detection unit, which obtains the difference between the current actual acquisition time and the predicted acquisition time of the structured signal value. If the time difference exceeds the preset tolerance threshold range, it is determined as a time anomaly and a time anomaly flag is output; A combined anomaly determination unit, which receives the structure anomaly flag and the time anomaly flag. If both are established at the same moment, it outputs an anomaly determination signal for indicating a high-level anomaly state.
7. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that The anomaly detection module further includes a prediction model module, and the prediction model module includes: A period normalization unit, which calculates the time interval between any current message and the previous message based on the historical CAN message timestamp data, and divides the time interval by the average period value corresponding to the message identifier to obtain a normalized period value; A prediction model training unit, which constructs a recurrent neural network model containing two layers of long short-term memory neural units, and trains the normalized period sequence. The training objective is to minimize the mean square error between the predicted time output by the model and the actual acquisition time; A time judgment interval generation unit, which determines a segment of acceptable time interval within which the actual acquisition time should be based on the output result of the prediction model and the historical prediction error range; when the actual acquisition time of the current message exceeds this time interval, a prediction anomaly flag is generated to indicate the existing time behavior anomaly.
8. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that The control instruction generation module includes: A mapping unit, which calls the corresponding control instruction template according to the anomaly level flag output by the anomaly detection module, and the template is preset with an instruction structure for power supply control; A parameter injection unit, which writes the current control parameters into the control instruction template, and the control parameters include the target voltage value, the target current value, and the continuous execution time; An instruction encapsulation unit, which encapsulates the instruction template injected with control parameters according to a preset serial communication protocol, and outputs the encapsulated control instruction data packet to the adjustable power supply device interface for controlling the voltage and current output behavior.
9. The vehicle diagnostic system based on CAN communication and adjustable power supply according to claim 1, characterized in that, The adjustable power supply device includes: A serial communication unit, which receives the control instruction data packet from the control instruction generation module based on the serial port protocol, and the protocol is MODBUSRTU or an equivalent communication protocol; A control instruction parsing unit for parsing the control instruction data packet, extracting set parameter information, and controlling the power supply module to adjust the output voltage to the target voltage, the output current to the target current, and maintain the output duration; A status feedback unit for periodically reading the current output status parameters during the power supply control process, including the real-time output voltage, current, and working status identifier, and feeding back the status parameters via the serial communication unit for subsequent control judgment.
10. A vehicle diagnosis method based on CAN communication and adjustable power supply, which is applied to a vehicle diagnosis system based on CAN communication and adjustable power supply according to any one of claims 1-9, characterized in that, The method includes the following steps: Step 1: Establish a CAN communication connection, and collect CAN message data containing timestamp information through the CAN communication acquisition module; Step 2: Parse the CAN message data through the data processing module, identify one or more signal fields in the message, and perform byte order identification and sign bit identification on each signal field to obtain structured signal values; Step 3: Through the signal semantics recognition module, align the structured signal values with the reference data obtained through the OBD-II interface, in-vehicle sensors, or manual input, and determine the semantic tags of the structured signal values based on the comparison results; Step 4: Through the anomaly detection module, build a prediction model based on the structured signal values and their corresponding timestamp information, and compare the prediction results with the actual signal behavior to determine whether there is an anomaly and output an anomaly level flag; Step 5: Through the control instruction generation module, generate control instructions according to the anomaly level flag, where the control instructions include the target voltage value, target current value, and continuous execution time; Step 6: Receive and execute the control instructions through the adjustable power supply device to adjust the output voltage and current parameters to control the power supply status of the in-vehicle electronic control unit.
Citation Information
Patent Citations
Automatic industrial control protocol reverse system and method based on global voting expert algorithm
CN119105384A
Power system protocol analysis method and system based on association rule analysis and sequence comparison
CN119150845A