Nitrogen-oxygen sensor protocol self-adaptive detection equipment and method based on machine learning

The nitrogen and oxygen sensor detection device, which utilizes machine learning and dynamic pin state control, solves the problems of low protocol matching accuracy and cumbersome operation in existing technologies. It achieves efficient and reliable nitrogen and oxygen sensor detection and supports flexible adaptation and data parsing for multiple sensor models.

CN121397018APending Publication Date: 2026-01-23JIANGSU XINHONG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing nitrogen and oxygen sensor detection equipment suffers from low matching accuracy, low automation of the detection process, and poor system adaptability due to differences in protocols among different manufacturers and models, overlapping of multiple protocols, insufficient dynamic detection capabilities, and cumbersome operation.

Method used

A three-layer cascaded decision architecture based on machine learning is used for protocol matching. Combined with a dual-channel controllable switch and a controllable power supply module, the sensor pin status and power-on/off timing are dynamically adjusted. The baud rate is identified through a high-speed sampler to achieve adaptive protocol identification and data parsing.

Benefits of technology

It achieves high accuracy (>95%), good real-time performance, and strong adaptability in nitrogen and oxygen sensor protocol matching, supports flexible detection of multiple sensor models, reduces operational complexity, improves detection efficiency and reliability, and has comprehensive data parsing capabilities and intelligent protocol adaptation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121397018A_ABST
    Figure CN121397018A_ABST
Patent Text Reader

Abstract

The invention discloses a nitrogen-oxygen sensor protocol adaptive detection device and method based on machine learning, and relates to the technical field of vehicle emission control. The equipment comprises an upper computer, a CAN (Controller Area Network) communication module, IO (Input / Output) equipment and a controllable power supply module, according to the method, precise matching of protocols is achieved through a three-layer cascade decision-making architecture based on a random forest classifier, stable communication is established in combination with automatic baud rate detection, and distinguishing detection and initialization of front and rear nitrogen oxygen sensors are achieved through dynamic pin state control and power-on and power-off management. And meanwhile, the system has comprehensive data extraction, real-time display and fault diagnosis optimization functions. The method solves the problems of low protocol matching accuracy, insufficient dynamic detection capability, incomplete data extraction, tedious operation, poor system adaptability and the like in the prior art, and has the advantages of high accuracy, strong adaptive capability, high automation degree, good compatibility and the like.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of vehicle emission control, and particularly refers to a nitrogen oxygen sensor protocol adaptive detection device and method based on machine learning. BACKGROUND

[0002] With the increasingly stringent vehicle emission standards and the continuous enhancement of environmental protection awareness, nitrogen oxygen sensors, as important components in emission control systems, have been widely used in internal combustion engine vehicles. The nitrogen oxygen sensor detection technology on the market at present mostly relies on CAN bus diagnostic equipment based on the foundation. These devices obtain working data (such as nitrogen oxygen concentration, dew point data, etc.) and specific information (such as OE number) for matching specific models by analyzing the communication protocol of the sensor.

[0003] However, the prior art and products have many defects in actual application:

[0004] 1. Protocol complexity and diversity: The protocols of nitrogen oxygen sensors of different manufacturers and models differ significantly, including the diversity of basic parameters such as baud rate, frame ID, frame interval, and the inconsistency of data type support, making it difficult for detection equipment to cope with the diversity of protocols.

[0005] 2. Multiple protocol overlap problem: Some frame IDs may correspond to multiple protocols or vehicle models, but the existing technology relies on static rule matching and cannot effectively identify protocol overlap, resulting in low matching accuracy.

[0006] 3. Insufficient dynamic detection capability: Some sensors need to be switched by pin state (grounded or suspended) or powered on and off to distinguish different functions or implement detection initialization, but the current equipment lacks these functions and the detection coverage is limited.

[0007] 4. Complicated operation: Most devices require users to manually input sensor model, vehicle configuration and other information to match the protocol library, which requires high user expertise and is prone to errors. SUMMARY

[0008] The present application aims to solve the problems of low protocol matching accuracy, insufficient dynamic detection integrity, incomplete protocol data extraction, low detection process automation degree and poor system adaptability in the prior art.

[0009] To solve the above technical problems, the technical solution provided by the present application is:

[0010] A nitrogen oxygen sensor protocol adaptive method based on machine learning, comprising the following steps:

[0011] After the system is started, the data in the sensor communication initialization stage is collected by a high-speed sampler, the CAN differential signal is analyzed based on the bit timing sampling method, the level jump points in the 32-bit time after SOF are recorded, the minimum time interval is calculated to identify the baud rate, and the communication stability is verified through an adaptive sampling window mechanism. When the effective frame rate within 100 ms exceeds 90% and the CRC correctness rate is greater than 95%, it is confirmed that the communication is established.

[0012] A pre-trained random forest classifier is started, and a three-level cascade decision architecture is used for protocol matching: the first level filters the protocol family based on the baud rate and CAN frame ID range; the second level calculates the mean and variance of the frame interval, extracts the data field byte distribution rule and key bit change mode, and scores the statistical features through the random forest algorithm; the third level cross-verification combined with the vehicle OE number information is set, and the confidence threshold is greater than 0.85. When there are multiple candidate protocols, a weighted voting mechanism is used to determine the optimal matching result, with a baud rate weight of 0.2, a frame feature weight of 0.5, and an OE number weight of 0.3.

[0013] The state of the sensor pin is dynamically adjusted through a double-path controllable switch, supporting three state switches of strong pull-down, high resistance and weak pull-up, and combined with a controllable power module to realize the power-on and power-off timing control. Based on the feature classification model, the sensor response characteristics are analyzed to complete the initialization.

[0014] The sensor communication data is parsed, and real-time data and stored data are extracted, which are displayed in real time by the host computer. At the same time, the communication quality is monitored, and when more than 3 consecutive frames of data loss, data anomaly or protocol matching confidence is detected below the threshold, the fault diagnosis process is triggered, and the feature weight is dynamically adjusted, the matching rule is updated and the detection timing is optimized.

[0015] Preferably, the training of the random forest classifier is based on the communication data of at least 50 nitrogen oxide sensors, each sensor collects no less than 6000 valid data, and 5-fold cross-validation is used to ensure that the model accuracy is above 95%.

[0016] Preferably, the sampling rate of the high-speed sampler is 80MHz, and the communication data in the communication initialization stage is sampled at 8-10 times the baud rate for 200ms.

[0017] Preferably, the third level cross-validation performs multi-round voting decision through cumulative feature data of more than 300 frames.

[0018] Preferably, the real-time data includes nitrogen oxide concentration, oxygen concentration and heating rate, and the stored data includes production date, cumulative working time and calibration parameters.

[0019] Preferably, the report generated by the fault diagnosis process contains fault type, occurrence time, impact range and optimization suggestions, including adjusting the baud rate configuration, re-executing the initialization process.

[0020] Preferably, in the protocol matching process, the system supports dynamic updating of the protocol feature library, and realizes adaptive identification of new sensors through continuous accumulation of protocol features of new sensors.

[0021] A machine learning-based nitrogen-oxygen sensor protocol adaptive detection device, comprising a host computer, a CAN communication module, an IO device and a controllable power supply module;

[0022] The host computer is connected with the CAN communication module, the IO device and the controllable power supply module respectively, for realizing system control and management, protocol matching engine function, data processing and display;

[0023] The CAN communication module is connected with the host computer and the nitrogen-oxygen sensor respectively, for data acquisition and transmission and baud rate management;

[0024] The IO device is connected with the host computer, the controllable power supply module and the nitrogen-oxygen sensor respectively, for dynamically managing the pin state of the sensor;

[0025] The controllable power supply module is connected with the host computer, the IO device and the nitrogen-oxygen sensor respectively, for providing stable adjustable voltage output for the nitrogen-oxygen sensor and realizing power-on and power-off operations.

[0026] Preferably, the IO device adopts a double-controllable switch for pin control, supporting three pin states of strong pull-down, high resistance and weak pull-up.

[0027] Preferably, the controllable power supply module can provide 0-40V adjustable voltage output, and in the power-on and power-off timing control process, whether the sensor enters a normal working state is judged by monitoring the frame ID change when the sensor starts.

[0028] After adopting the above structure and method, the application has the following advantages:

[0029] Automatic protocol matching based on machine learning: adopting a random forest classifier, multi-dimensional feature analysis, with high accuracy (>95%), good real-time performance (<100ms), strong adaptive ability and other advantages, which can better adapt to new protocol matching.

[0030] Dynamic detection function enhancement: through pin dynamic control and controllable power supply module, supporting sensor pin state control and power-on and power-off operations, ensuring the continuity and integrity of the detection process, suitable for complex application scenarios.

[0031] Comprehensive data analysis capabilities: not only supports real-time running data extraction, but also can read historical data, providing comprehensive support for sensor performance monitoring and life evaluation.

[0032] Intelligent protocol adaptation: Establish a dynamically optimized protocol matching model, support automatic updating of protocol library, improve the intelligence and scalability of the device.

[0033] Automated process design: No need for user to manually input information, greatly reducing human intervention, reducing operation complexity, improving detection efficiency and reliability.

[0034] High compatibility and offline capability: The device can complete protocol analysis and data extraction without networking, and is suitable for a variety of models and brands of nitrogen oxygen sensors, with wide application range.

[0035] Real-time data display: Real-time display of relevant information through the host computer, providing an intuitive and clear data interface for quick access to test results.

[0036] The above summary is only for the purpose of the description and is not intended to limit in any way. In addition to the above described illustrative aspects, embodiments and features, further aspects, embodiments and features of the present application will be readily apparent to those skilled in the art by reference to the drawings and the following detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without any creative labor.

[0038] Figure 1 is the workflow diagram of the present application;

[0039] Figure 2 is the method flowchart of the present application;

[0040] Figure 3 is the framework diagram of three-level decision of the present application;

[0041] Figure 4 is the structural schematic diagram of the present application. DETAILED DESCRIPTION

[0042] Reference will now be made in detail to the specific embodiments of the application. While the application will be described in conjunction with these specific embodiments, it will be understood that it is not intended to limit the application to these specific embodiments. On the contrary, it is intended to cover alternatives, modifications, and equivalents, which can be included within the spirit and scope of the application as defined by the claims. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. The present application can be practiced without some or all of these specific details. In other instances, well known process operations have not been described in detail in order not to unnecessarily obscure the present application.

[0043] As used in this description and the following claims, the singular "a," "an" and "the" include plural referents unless the context clearly dictates otherwise. All technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs unless otherwise specifically defined.

[0044] The application will be further described below in conjunction with the entire text.

[0045] The accompanying drawings are incorporated in and constitute a part of this specification. Figures 1-3 A machine learning-based nitrogen-oxygen sensor protocol adaptive method, comprising the following steps:

[0046] After the system is started, the data in the sensor communication initialization stage is collected by a high-speed sampler, the CAN differential signal is analyzed based on the bit timing sampling method, the level jump points within 32 bits of time after SOF are recorded, the minimum time interval is calculated to identify the baud rate, and the communication stability is verified through the adaptive sampling window mechanism. When the effective frame rate within 100 ms exceeds 90% and the CRC correct rate is greater than 95%, it is confirmed that the communication is established;

[0047] The pre-trained random forest classifier is started, and a three-level cascade decision architecture is used for protocol matching: the first level filters the protocol family based on the baud rate and CAN frame ID range; the second level calculates the mean and variance of the frame interval, extracts the data domain byte distribution rule and key bit change mode, and scores the statistical features through the random forest algorithm; the third level cross- validates combined with the vehicle OE number information, sets the confidence threshold > 0.85, when there are multiple candidate protocols, uses the weighted voting mechanism of baud rate weight 0.2, frame feature weight 0.5, and OE number weight 0.3 to determine the optimal matching result;

[0048] The state of the sensor pin is dynamically adjusted through a double-path controllable switch, supporting three state switching of strong pull-down, high resistance state and weak pull-up, and combining with the controllable power module to realize the power-on and power-off timing control, based on the feature classification model to analyze the sensor response characteristics to complete the initialization;

[0049] The communication data of the sensor is analyzed to extract real-time data and storage data, which are displayed in real time by the host computer. At the same time, the communication quality is monitored. When it is detected that more than 3 frames of data are lost, data is abnormal, or the protocol matching confidence is lower than the threshold, the fault diagnosis process is triggered, and the feature weight is dynamically adjusted, the matching rule is updated, and the detection timing is optimized.

[0050] The training of the random forest classifier is based on the communication data of at least 50 nitrogen-oxygen sensors, each sensor collects no less than 6000 frames of valid data, and 5-fold cross-validation is used to ensure that the model accuracy is more than 95%.

[0051] The sampling rate of the high-speed sampler is 80MHz, and in the communication initialization stage, 200ms of communication data is sampled at 8-10 times the baud rate.

[0052] The third layer cross-validation is a multi-round voting decision based on the accumulation of more than 300 frames of feature data.

[0053] The real-time data includes nitrogen and oxygen concentrations, oxygen concentration, and heating rate, and the storage data includes production date, cumulative working time, and calibration parameters.

[0054] The report generated by the fault diagnosis process contains fault type, occurrence time, impact range and optimization suggestions, including adjusting the baud rate configuration and re-executing the initialization process.

[0055] During the protocol matching process, the system supports dynamic updating of the protocol feature library, and realizes adaptive identification of new sensors by continuously accumulating protocol features of new sensors.

[0056] As shown in Figure 4 , a nitrogen-oxygen sensor protocol adaptive detection device based on machine learning includes a host computer, a CAN communication module, an IO device, and a controllable power supply module;

[0057] The host computer is connected with the CAN communication module, the IO device and the controllable power supply module, respectively, for system control and management, protocol matching engine function, data processing and display;

[0058] The CAN communication module is connected with the host computer and the nitrogen-oxygen sensor, respectively, for data acquisition and transmission and baud rate management;

[0059] The IO device is connected with the host computer, the controllable power supply module and the nitrogen-oxygen sensor, respectively, for dynamic management of the pin state of the sensor;

[0060] The controllable power supply module is connected with the host computer, the IO device and the nitrogen-oxygen sensor, respectively, for providing stable adjustable voltage output for the nitrogen-oxygen sensor and realizing power-on and power-off operations.

[0061] IO device adopts double controllable switch to control pin, supports three pin states of strong pull-down, high resistance state and weak pull-up.

[0062] The controllable power module can provide 0-40V adjustable voltage output, and in the up and down power sequence control process, whether the sensor enters the normal working state is judged by monitoring the frame ID change when starting.

[0063] The application is implemented in detail, and the modules of the device are described as follows:

[0064] The host computer: the functions include system control and management, controlling the overall detection process through a friendly user interface, managing the device operation parameter configuration and coordinating the working state of each module; protocol matching engine, integrating the protocol matching algorithm based on machine learning, dynamically maintaining and updating the protocol feature library, executing feature extraction and classification decision, and generating protocol analysis rules; data processing and display, real-time analysis and display of sensor data, management of historical data storage and query, generation of detection report, and execution of fault diagnosis analysis. The input includes user operation instructions and analysis data and running state transmitted by the CAN communication module, IO device and controllable power module. The output includes instructions sent to each module and analysis results displayed on the user interface. The CAN communication module is connected with the host computer through USB-A, and the IO device and the controllable power module are connected through the RS485 interface.

[0065] CAN communication module: the function is data acquisition and transmission, real-time acquisition of sensor raw data and data frame buffer processing; baud rate management, setting communication baud rate according to host computer instruction, monitoring communication quality state. The input includes the instruction issued by the host computer and the CAN message data sent by the sensor. The output is the raw message data and communication state information transmitted to the host computer. The CAN communication module is connected with the host computer through USB-A, and connected with the sensor through CAN bus.

[0066] IO device: the function is to dynamically manage the pin state of the sensor, realize programmable pin switching time sequence, and ensure the accuracy of signal control; as a control module, ensure accurate signal acquisition of the sensor in different detection modes. The input is the switching instruction sent by the host computer. The output is the electrical connection state of the sensor pin. The IO device is connected with the host computer through the RS485 interface, directly connected with the controllable power module through the internal bus, and connected with the sensor through the standard adapter harness.

[0067] Controllable power module: the function is to provide 0-40V adjustable voltage output, to provide stable power-on and power-off operation for nitrogen oxygen sensor, to ensure correct collection of message information and start and stop of sensor and the like. Input is voltage control, power-on and power-off control instruction sent by host computer. Output is stable adjustable DC voltage output and multi-path independent power supply capability. It is connected with host computer through RS485 interface, connected with IO device through internal bus, and connected with sensor through standard adapter harness.

[0068] The method of the application is shown in detail as follows: Figure 1 and Figure 2

[0069] (1) In the system starting stage, firstly, it is determined whether the message needs to be triggered, then 200ms of communication data is sampled at 8-10 times baud rate by a high-speed sampler, CAN differential signal is collected based on bit timing sampling method, and the level jump point in the 32-bit time after SOF is recorded, the minimum time interval is calculated to quickly identify the baud rate (such as 250kbps, 500kbps). Subsequently, the system automatically configures the communication controller parameters, and enables the adaptive sampling window mechanism to improve the detection reliability. In the listening mode, the system continuously monitors 50 frames of communication data, evaluates the effective frame rate, signal integrity and CRC check accuracy. When the effective frame rate is more than 90% and the CRC accuracy reaches 95%, it is confirmed that the communication is successfully established.

[0070] (2) After identifying the baud rate and establishing the basic communication, the feature extraction module based on the pre-trained random forest classifier (using not less than 6000 frames of training data for each sensor) is started. The first layer establishes a rapid screening rule based on the baud rate and CAN frame ID range, and classifies the to-be-identified protocol into possible protocol families; the second layer uses statistical features for fine matching, including calculating the mean and variance of the frame interval, extracting the byte distribution rule of the data field, and analyzing the change mode of the key bit; the third layer combines the vehicle OE number information for cross verification, and through the accumulation of more than 300 frames of feature data, multiple rounds of voting decision are made, and finally the matching result is output. For complex scenes with high feature overlap, the system sets a confidence threshold of 0.85 to ensure the reliability of the matching result.

[0071] (3) For sensor protocol matching under specific pin definition, the system realizes accurate control of sensor pins through a double-path controllable switch, supports three states of strong pull-down (ground), high resistance state (suspended) and weak pull-up (for detection). In the protocol matching process, the system increases the adaptive adjustment of the pin state, and simultaneously monitors the signal feedback in real time, to ensure accurate realization of the suspended and grounded states. In addition, the system also realizes accurate power-on and power-off timing control of the sensor through the controllable power module, and through monitoring the feature frame sequence (such as power-on frame ID change) in the starting process, the normal initialization of the sensor is ensured. ​

[0072] (4) The system monitors sensor operation data in real time during the matching process, continuously evaluates the communication quality through a rule engine. When detecting data loss for more than 3 consecutive frames, data values exceeding the preset range, or protocol matching confidence below the threshold, the system triggers a fault diagnosis process. The diagnosis module automatically adjusts feature extraction weights, updates protocol matching rules, and optimizes detection process timing by analyzing communication success rate, protocol matching time consumption, and system resource occupation. At the same time, the system generates a detailed fault diagnosis report containing fault type, occurrence time, impact range, and specific optimization suggestions such as adjusting baud rate configuration and re-executing initialization process, achieving adaptive optimization of the detection system.

[0073] The present application is based on machine learning-based protocol automatic matching and analysis: a random forest classifier is used as the core algorithm to achieve accurate protocol matching by analyzing baud rate range, CAN frame ID distribution, frame interval, OE number matching results, and data field content feature vector. The system establishes a standard protocol feature library based on communication data from more than 50 mainstream nitrogen oxygen sensors, collects not less than 6000 frames of valid data for each sensor for training, and uses 5-fold cross-validation to ensure that the model accuracy is above 95%. In practical applications, the system uses a three-layer cascaded decision architecture for protocol matching: the first layer establishes fast screening rules based on baud rate and CAN frame ID range to classify the protocol to be identified into possible protocol families; the second layer uses statistical features for fine matching, including calculating the mean and variance of the frame interval, extracting the byte distribution rule of the data field, analyzing the change pattern of the key bits, etc., and using the random forest algorithm to score these features; the third layer combines vehicle OE number information for cross-validation and sets a trust threshold (confidence > 0.85), when multiple candidate protocols with similar features appear, the optimal matching result is selected through a weighted voting mechanism (baud rate weight 0.2, frame feature weight 0.5, OE number weight 0.3) to ensure the reliability of the identification result.

[0074] Automatic baud rate detection and communication establishment: Automatic baud rate detection is to ensure seamless communication between the system and different types of sensors by collecting data features during the communication initialization stage in real time to quickly determine the baud rate type of the sensor (250kbps, 500kbps, etc.). An adaptive baud rate detection method based on bit timing sampling is used. The CAN differential signal is collected by a high-speed comparator, and a programmable gain amplifier is used for signal conditioning. The system uses a 80MHz sampling rate to record the level jump points within 32 bit times after detecting SOF, and calculates the minimum time interval to determine the baud rate. An adaptive sampling window mechanism is introduced to improve detection reliability. The system performs communication verification in listen mode, and confirms communication success when the effective frame rate exceeds 90% and the CRC correctness rate is greater than 95% within 100ms.

[0075] Front and rear nitrogen oxygen sensor area distinction detection: The system dynamically manages the grounding or suspension state of the sensor pin through the IO device, controls the pin with a two-way controllable switch, supports three pin states of strong pull-down (grounding), high resistance state (suspension) and weak pull-up (for detection), realizes the distinction detection of front and rear nitrogen oxygen sensors. Combined with the dynamic feature classification analysis in the protocol matching process (such as frame ID distribution, OE number, etc.), the pin state of the sensor is dynamically adjusted by the system according to the actual detection requirements, and the change of frame data content and frame interval is comprehensively analyzed by the classification model to ensure the accuracy and comprehensiveness of the detection process.

[0076] Power management and sensor initialization: To solve the instability problem of the sensor in the heating start-up process, the application designs a power-on and power-off management module to accurately control the power supply of the sensor through a controllable power supply module. Combined with the initialization requirements in the protocol matching, the system dynamically adjusts the timing logic of power-on and power-off to ensure the synchronization of the reset process of the sensor and data acquisition. During the power-on and power-off operation process, the system monitors the response signal of the sensor (such as the change of frame ID at start-up) in real time, judges whether the sensor has entered the normal working state through the feature classification model, and optimizes the stability of the detection process.

[0077] Data extraction and real-time display: After completing the protocol matching, the system can parse and extract real-time data and stored data in sensor communication. Real-time data includes nitrogen and oxygen concentration, oxygen concentration and heating rate, and stored data includes production date, cumulative working time and calibration parameters. The system optimizes the data extraction process through the feature classification model to ensure the accuracy and integrity of data extraction. The host computer interface displays the protocol analysis results and sensor running status in real time, and supports historical data query, report export and abnormal prompt functions.

[0078] Fault diagnosis and optimization based on protocol matching: By combining the protocol matching results and real-time acquisition data, the rule engine is used to realize fault diagnosis, which can identify typical faults such as communication loss (more than 3 frames of continuous loss), data anomaly (out of standard range) and protocol matching failure, and generate specific fault diagnosis report. The system monitors the communication success rate, protocol matching time consumption and system resource occupation in real time, realizes dynamic adjustment of feature weight, update of protocol matching rule and optimization of detection process timing, and realizes adaptive optimization functions such as self-adaptive optimization.

[0079] The nitrogen oxygen sensor protocol detection device and method based on dynamic feature classification of the application overcome the shortcomings of existing detection devices in operation complexity, detection continuity, etc. through automatic protocol recognition and analysis, pin state control and controllable power management. The device realizes fast and accurate identification of nitrogen oxygen sensor protocol, supports flexible detection of multiple types of sensors, and has efficient and reliable detection capability.

[0080] Through the user of the present application without manually inputting complex vehicle configuration information, the operation steps and human errors are reduced, and the detection efficiency is improved. At the same time, the offline detection capability and multi-sensor support characteristics of the device enhance the applicability and reliability of the device, and adapt to the diversified needs of different types of nitrogen oxygen sensors.

[0081] The first layer performs rapid protocol family screening through baud rate and CAN frame ID range, the second layer performs fine matching using statistical characteristics such as mean variance of frame interval, byte distribution of data field, and key bit change pattern, the third layer combines OE number information for cross verification, and adopts a weighted voting mechanism with baud rate weight 0.2, frame feature weight 0.5, and OE number weight 0.3 to select the optimal matching result, wherein the confidence threshold is set to be greater than 0.85, and the adaptive optimization function of dynamically adjusting feature weight and updating protocol matching rules is provided.

[0082] Dynamic pin state control is combined with power-on and power-off management, and a two-way controllable switch is used to realize precise dynamic control of sensor pin state. Unlike traditional fixed state control, it can switch between strong pull-down (ground), high resistance state (suspended) and weak pull-up (detection) according to actual detection needs; at the same time, the controllable power module is innovatively deeply integrated with the protocol matching process, based on the real-time analysis of sensor response characteristics (frame ID change rule, data content feature, frame interval change) based on the feature classification model, the pin state switching strategy and power-on and power-off timing control are dynamically optimized, which significantly improves the message initialization efficiency.

[0083] Based on the multi-dimensional feature classification of random forest, a deep learning strategy for multi-dimensional feature fusion of nitrogen oxygen sensor multi-protocol is innovatively proposed, a protocol feature library is established using more than 50 nitrogen oxygen sensors, each with no less than 6000 frames of effective data, 5-fold cross-validation is used to ensure that the model accuracy is more than 95%, and multi-dimensional features such as baud rate range, CAN frame ID distribution, frame interval, OE number matching result and data field content feature vector are analyzed to realize accurate protocol matching. This method has significant adaptability and scalability, supports continuous accumulation and optimization of protocol features, and can quickly adapt to the protocol identification needs of new sensors.

[0084] Embodiment one: nitrogen oxygen sensor protocol matching detection based on random forest classifier.

[0085] This embodiment is aimed at a certain type of nitrogen oxygen sensor (suitable for diesel vehicle national six emission system), and demonstrates the protocol adaptive detection process of the present application:

[0086] Communication initialization: After the system starts, the CAN communication module collects the CAN differential signal of the sensor initialization stage for 200 ms through the 80 MHz high-speed sampler, records the level jump point within 32 bits of time after SOF, calculates the minimum time interval, and identifies the baud rate as 500 kbps. The adaptive sampling window mechanism is enabled, and 50 frames of data are monitored in the listening mode to confirm that the effective frame rate reaches 92% and the CRC accuracy is 96%, and the communication is successfully established.

[0087] Three-layer cascade protocol matching:

[0088] First layer: Based on the baud rate of 500 kbps and the CAN frame ID range (0x280-0x28F), quickly filter to the protocol family;

[0089] Second layer: Extract the mean (10 ms) and variance (2 ms) of the frame interval, the byte distribution of the data field (the 3rd byte is the high bit of the nitrogen oxygen concentration), and the key bit change pattern (the 5th bit is the state flag). The random forest classifier scores these features, and the matching degree reaches 0.92;

[0090] Third layer: Combined with the cross verification of the OE number returned by the sensor (such as "0281006951"), the confidence is 0.91 (> 0.85), and the matching protocol is confirmed by weighted voting (baud rate 0.2 + frame features 0.5 + OE number 0.3).

[0091] Data extraction and display: The host computer parses the real-time data (nitrogen oxygen concentration 350 ppm, heating rate 85%) and storage data (production date 2023-05-10, cumulative working time 1200 hours), and displays them in real time on the interface. The detection time is 85 ms, and the accuracy is 100%.

[0092] Example two: distinguishing detection of front and rear nitrogen oxygen sensors.

[0093] This example aims at distinguishing the front and rear nitrogen oxygen sensors of a certain vehicle model (the front sensor needs to be grounded to activate, and the rear sensor needs to be suspended to activate), and demonstrates the dynamic pin control and power management functions:

[0094] Dynamic switching of pin state: The IO device receives the instructions from the host computer, and through the double-way controllable switch, the sensor pin is first set to strong pull-down (grounded), triggering the front sensor response; after 10 seconds, it is switched to high resistance state (suspended), triggering the rear sensor response, and during this period, the CAN communication module continuously collects the frame data of the two sensors.

[0095] Power-on timing control: The controllable power module provides a 12V voltage, and during the power-on stage, it monitors the frame ID change (after the front sensor is powered on, the frame ID is switched from 0x300 to 0x301, and the rear sensor is switched from 0x302 to 0x303), confirming that the sensor initialization is complete.

[0096] Protocol matching and data integration: the system performs three levels of cascade matching on the front and rear sensors respectively, the front sensor matches the continent forward protocol (frame ID 0x301), the rear sensor matches the continent backward protocol (frame ID 0x303), and the host computer integrates the data of both (front nitrogen oxygen concentration 420ppm, rear nitrogen oxygen concentration 180ppm), completes the differentiated detection, and does not need manual intervention throughout.

[0097] The above describes the present application and its embodiments, which are not limited, and the shown in the full text is only one of the embodiments of the present application, and the actual structure is not limited thereto. In general, if a person skilled in the art is inspired thereby, without departing from the purpose of the present application, without creative design, similar structure and embodiments to the technical solution should belong to the protection scope of the present application.

Claims

1. A machine learning based adaptive method for nitrogen oxide sensor protocol, characterized in that, The method comprises the following steps: After the system is started, the data in the sensor communication initialization stage is collected by a high-speed sampler, the CAN differential signal is analyzed based on the bit timing sampling method, the level jump points in the 32-bit time after SOF are recorded, the minimum time interval is calculated to identify the baud rate, and the communication stability is verified through an adaptive sampling window mechanism. When the effective frame rate within 100 ms exceeds 90% and the CRC correctness rate is greater than 95%, it is confirmed that the communication is established; A pre-trained random forest classifier is started, and a three-level cascade decision architecture is used for protocol matching: the first level filters the protocol family based on the baud rate and CAN frame ID range; the second level calculates the mean and variance of the frame interval, extracts the data field byte distribution rule and key bit change mode, and scores the statistical features through the random forest algorithm; the third level cross-verification combined with the vehicle OE number information is set, and the confidence threshold is greater than 0.

85. When there are multiple candidate protocols, a weighted voting mechanism with a baud rate weight of 0.2, a frame feature weight of 0.5, and an OE number weight of 0.3 is used to determine the optimal matching result; The state of the sensor pin is dynamically adjusted through a double-path controllable switch, supporting three state switches of strong pull-down, high resistance and weak pull-up, and the power-on and power-off timing control is realized through a controllable power module. Based on the characteristic classification model, the sensor response characteristics are analyzed to complete the initialization. The sensor communication data is parsed, real-time data and stored data are extracted, and real-time display is realized through the upper computer. At the same time, the communication quality is monitored. When more than 3 frames of data loss, data anomaly or protocol matching confidence is detected, the fault diagnosis process is triggered, the feature weight is dynamically adjusted, the matching rule is updated, and the detection timing is optimized.

2. The machine learning based adaptive method for N02sensor protocol according to claim 1, wherein: The training of the random forest classifier is based on the communication data of at least 50 types of nitrogen oxide sensors, each sensor collects not less than 6000 frames of effective data, and 5-fold cross-validation is used to ensure that the model accuracy is more than 95%.

3. The machine learning based adaptive N02sensor protocol method of claim 1, wherein: The sampling rate of the high-speed sampler is 80 MHz, and the communication data in the communication initialization stage is sampled at 8-10 times the baud rate for 200 ms.

4. The machine learning based adaptive method for N02sensor protocol according to claim 1, wherein: The third level cross-validation makes multi-round voting decisions by accumulating more than 300 frames of feature data.

5. The machine learning based adaptive N02sensor protocol method of claim 1, wherein: The real-time data includes nitrogen and oxygen concentrations and heating rate, and the stored data includes production date, cumulative working time and calibration parameters.

6. The machine learning based adaptive N02sensor protocol method of claim 1, wherein: The report generated by the fault diagnosis process contains fault type, occurrence time, influence range and optimization suggestion, and the optimization suggestion includes adjusting the baud rate configuration and re-executing the initialization process.

7. The machine learning based adaptive N02sensor protocol method of claim 1, wherein: In the protocol matching process, the system supports dynamic updating of the protocol feature library, and realizes adaptive identification of new sensors by continuously accumulating the protocol features of new sensors. 8.A machine learning based nitrogen-oxygen sensor protocol adaptive detection device, comprising: The system comprises an upper computer, a CAN communication module, an IO device and a controllable power module. The upper computer is connected with the CAN communication module, the IO device and the controllable power module, and is used for realizing system control and management, protocol matching engine function, data processing and display; The CAN communication module is connected with the upper computer and the nitrogen oxide sensor, and is used for data collection and transmission and baud rate management; The IO device is connected with the upper computer, the controllable power module and the nitrogen oxygen sensor respectively, and is used for dynamically managing the pin state of the sensor. The controllable power module is connected with the upper computer, the IO device and the nitrogen oxygen sensor respectively, and is used for providing stable adjustable voltage output for the nitrogen oxygen sensor, and realizing the power-on and power-off operation.

9. The machine learning based nitrogen-oxygen sensor protocol self-adaptive detection device according to claim 8, wherein: The IO device adopts a double-controllable switch to control the pin, and supports three pin states of strong pull-down, high resistance state and weak pull-up.

10. The machine learning based nitrogen-oxygen sensor protocol self-adaptive detection device of claim 8, wherein: The controllable power module can provide 0-40V adjustable voltage output, and in the power-on and power-off timing control process, whether the sensor enters the normal working state is judged by monitoring the frame ID change when the sensor starts.