Design of a high-speed CAN network data analysis system for a four-wheel independent drive electric vehicle
2026-04-06 08:39:55··#1
Abstract: This paper designs a data analysis system for a high-speed CAN network of a four-wheel independent drive electric vehicle based on the Kvaser Leaf Professional series CAN bus analysis tool. The paper introduces the control strategy of the four-wheel independent drive electric vehicle and its CAN network design, and elaborates on the design of the CAN data analysis system. Keywords: Kvaser Leaf Professional tool; four-wheel independent drive electric vehicle; CAN network; CAN data analysis system With the development of electric vehicles, CAN bus communication technology is increasingly widely used. It can facilitate the implementation of four-wheel independent drive control in pure electric vehicles, as well as active safety systems such as anti-lock braking system (ABS) and electronic stability device (ESP). When designing a CAN bus communication system, the problem of CAN data diagnosis and analysis is always present; without solving this problem, the design cannot be completed. This paper develops a data analysis system on a PC using the Kvaser Leaf Professional HS USB_CAN tool and the Visual Basic environment, and implements CAN communication between this analysis system and the motor control board of the four-wheel independent drive electric vehicle. By diagnosing and analyzing the CAN bus data, the design of the CAN bus system can be better completed. Electric Vehicle Control Strategy The distributed four-wheel electronic differential system used in the electric vehicle physical model consists of three parts: a central controller, four electric wheel controllers, and a CAN bus network. Its layout on the electric vehicle physical model is shown in Figure 1. Figure 1: Layout of the distributed four-wheel electronic differential system on the vehicle body. In this distributed system, the electronic differential algorithm based on independent four-wheel control is divided into two parts: a vehicle differential algorithm and a speed control algorithm. The speed control algorithm targets the speed of each electric wheel. The central controller and the four electric wheel controllers are connected via a CAN bus to form a real-time control network. During the system control process, the central controller obtains the vehicle steering angle signal from the steering sensor and the vehicle speed setting signal from the throttle handle through A/D sampling. After processing by the vehicle differential algorithm, it obtains the current appropriate speed of each of the four wheels and uses this result as the speed control setting value for the corresponding wheel at the current moment, sending it to the corresponding electric wheel controller via the CAN bus. The four wheel controllers use the speed setting value received from the CAN bus as the control target and use the electric speed control algorithm to control their respective electric wheels, ensuring that the actual speed of each electric wheel meets the requirements of the vehicle differential algorithm in real time, thereby achieving smooth steering of the electric vehicle. Electric Vehicle CAN Control Network Through the CAN bus, the central controller of this four-wheel drive electric vehicle transmits setpoints such as wheel speed to the controllers of each wheel. Simultaneously, each motor controller feeds back information such as actual rotational speed to the central controller via the CAN bus. The topology of the CAN network is shown in Figure 2. Figure 2 CAN Control Network Topology The entire network contains five CAN nodes: four electric wheel motor controllers (a, b, c, d) and one electric vehicle central controller (e). When designing the application layer protocol, a reasonable bus arbitration priority order must be arranged for the bus messages according to the actual application to improve the real-time performance of CAN communication. In this application scenario, downlink data, i.e., the control commands sent by the central controller to each electric wheel motor controller, has a higher priority than uplink data, i.e., the feedback information from each electric wheel motor controller. Furthermore, the instructions sent by the central controller to the four wheel controllers must be synchronized to provide a reliable basis for subsequent control. Considering the above factors, this paper designs the CAN data message ID system as shown in Table 1. Figure 3 Central Controller CAN Message Data Domain Structure Motor controllers a, b, c, and d control the left front wheel, right front wheel, left rear wheel, and right rear wheel of the electric vehicle, respectively. The data field structure of the CAN message sent by the central controller is shown in Figure 3. CAN data with IDs 0x010 and 0x020 sent by the central controller represent the setpoints for speed and torque. The corresponding actual values are analog quantities, represented by 16-bit finite-precision fixed-point numbers. The high 9 bits represent integers, and the low 7 bits represent decimals, i.e., fixed-point numbers in 9Q7 format. For the CAN data with ID 0x00F sent by the central controller, the command sent to each motor controller is also 16-bit data, with the low 8 bits representing the braking command and the high 8 bits representing the control mode selection command. The data field structure of the CAN message that the four motor controllers send current status information back to the central controller is shown in Figure 4. Figure 4: Motor Control Feedback Status Information Structure. There are two triggering methods for CAN bus messages: event-triggered and time-triggered. The former is suitable for sending discretely changing switching state quantities, such as braking commands and control mode selection commands; the latter is suitable for sending continuously changing analog quantities, such as speed setpoints and torque setpoints. Since this control system uses both types of bus information, a combination of event-triggered and time-triggered methods is employed for transmission . Kvaser Leaf Professional is a single-channel USB interface for CAN and LIN. This device provides the possibility of easily connecting several interfaces to a PC, allowing multiple Kvaser Leaf devices to be connected to the same USB hub without additional connections. Furthermore, it features excellent EMC (Electro Magnetic Compatibility) performance and plug-and-play functionality. Simultaneously, since multiple devices can be connected to a single USB hub, each device can be powered by the hub, resulting in very low power consumption. Kvaser provides a rich library of functions, allowing users to flexibly process CAN bus data according to their needs. PC-based CAN Data Analysis System Design This data analysis system dynamically displays commands issued by the central controller and the current operating information of each motor based on the CAN communication data between the central controller and the four motor controllers of the electric wheel independent drive vehicle. It can also display the speed change curves of each motor and has data saving capabilities for offline analysis. This system is designed and developed using Visual Basic and utilizes the CWGraph control from Measurement Studio software to display the rotational speed curves. CAN communication between the PC and the control board is achieved through Kvaser Leaf Professional HS. Motor operation data is saved via VB programming connected to a Microsoft Access database. Thus, the system consists of a main window and five sub-windows displaying the motor rotational speed curves, as shown in Figure 5. Figure 5: Window Structure Diagram. Here, the main window is the startup window. Sub-windows A, B, C, D, and E are not displayed when the main window is started. The corresponding buttons on the main window control the startup and shutdown of the sub-windows, i.e., displaying and closing the rotational speed curves of each wheel. During system operation, the main window starts first. By clicking the corresponding buttons on the main window, CAN communication with each control board can be easily established. CAN messages are received between the main control board and the motor control board, processed by the internal data processing functions, and then displayed in the corresponding display areas. After normal CAN communication, the five display areas will dynamically update and display the corresponding information according to the messages on the CAN bus. When data saving is required, clicking the Data_Record button will bring up a window to select a database. After selecting an existing database, the motor's status data will be saved in the selected database. Data saving can be stopped at any time. It's important to note that the saved motor operation status data is the data received after clicking the Data_Record button and selecting the database; data received before this is not saved. In other words, if you want to save data from the entire motor operation process, you must click the Data_Record button and select the database before the motor starts running. To exit the interface, first disconnect the CAN bus by clicking the Disconnect button. Then click the Quit button to exit the interface normally. This system design uses the ADO (ActiveX Data Object) object model in VB to connect to a Microsoft Access database for data saving. By creating a series of tables in a database, data can be easily saved in the corresponding tables. For example, in this design, a separate table was created for each of the four motors to store their operating status information, including speed, torque, battery voltage, and control mode. Offline data analysis and processing can be easily performed using the data processing functions of Access databases. To facilitate system use by different users, a dialog box is provided before data saving, allowing users to select an existing database and customize the data saving path. Conclusion In terms of software, MeasurementStudio provides powerful controls in the VB environment; in terms of hardware, tools such as Kvaser Leaf Professional HS and Peak_CAN are available, making the implementation of this system easier and more effective than conventional design methods. Online debugging has proven that this system can effectively analyze and process data from the CAN bus. References: 1. Tan Haoqiang. Visual BASIC Programming [M]. Tsinghua University Press, 2004. 2. Song Guangqun. VB Programming [M]. University of Science and Technology Press, 2006. 3. Kvaser AB. Kvaser Leaf User Guide [M] 2006. 4. Shi Jiugen, Zhang Peiren, et al. CAN Fieldbus System Design Technology [M]. Beijing: National Defense Industry Press, 2004.