Design and Implementation of Rapid Prototype of Vehicle CAN Bus Network

1 Introduction

This article refers to the address: http://

With the increasing number of controlled nodes and control complexity in the vehicle network, in order to meet the control requirements and reduce the development cost of the control system, automotive manufacturers and automotive design units are increasingly demanding automotive embedded software development tools. . At present, there are some software development technologies and software development tools for this application field, such as rapid prototyping-based software design technology and MATLAB/Simulink, dSPACE development tools. Rapid prototyping-based software design technology refers to software designers who describe software functions by creating and maintaining functional models of embedded software, and implement software development methods for rapid generation of lower-level machine code using automatic code generation technology for microprocessors. Using this technology can improve the development efficiency of embedded software and reduce development costs.

However, current software development tools focus on the execution efficiency and performance of single electronic control unit (ECU) modeling and verification software in a single ECU environment; support for control strategy robustness and feature analysis in network scenarios is limited. On the other hand, network protocol simulation and analysis tools, such as OPNET, can provide analysis of protocol performance in network scenarios [6], but since the simulation code developed on OPNET cannot be directly ported to the controller, development work cannot be easily implemented. Reuse for the target system.

If we are aiming at the application scenario of the CAN bus network for the vehicle, the combination of the embedded software design based on rapid prototyping and the analysis based on the network simulation can realize the rapid prototyping of the CAN bus network for the vehicle. In the early stage of design, the virtual hardware defined by the model is used to replace the actual hardware that is not designed or has too high cost, and the initial system design analysis is performed; when the corresponding hardware is in place, the virtual hardware is replaced, and the model code is converted into the target-oriented system. The code performs a verification analysis closer to the actual system; finally, when all the actual control software, controller hardware and controlled hardware are completed, the integrated system-wide real-time simulation is performed. This solves the problem of developing models and performing simulation verification using tools that are independent of each other.

This paper provides a system for designing, simulating and analyzing the CAN bus network of the vehicle through the design of the rapid prototype of the CAN bus network for the vehicle. The system uses the virtual hardware method to construct a typical vehicle environment in Simulink. The related controller model and controlled object model, as well as the CAN card simulation program TH-CAN-Vcard and the CAN bus analysis tool TH-CAN_Scope in the Windows environment, realize the CAN bus network environment for the CAN CAN bus network scene. The organic combination of control strategy simulation analysis and control code generation.

2 system design and implementation

2.1 Characteristics Analysis of Vehicle CAN Bus Network

The CAN bus is a serial communication bus. Bus arbitration and control using carrier sense multiple access with collision detection (ie CSMA/CD). In order to standardize the performance of the vehicle CAN bus in the network scenario, the ISO and the American Society of Automotive Engineers SAE have established relevant international standards for the reference environment for CAN communication diagnosis. These standards define benchmarking requirements from different levels depending on the hierarchical structure of the CAN protocol. For example: SAE J2012 and ISO/DIS 15031-6 correspond to the definition of application layer fault diagnosis; [3] [7] ISO/DIS15765-2 corresponds to the network layer communication protocol, which provides long by defining the unacknowledged segment data transfer protocol (USDT). Message data segmentation/reassembly, data transfer with flow control, and timeout processing control of messages between onboard control units and off-board test tools. [2]

On the other hand, various automobile manufacturers have also developed their own corporate standards based on these international standards to regulate the products of ECU product suppliers. For example, the DaimlerChrysler-Benz Group's CAN communication standard software model is divided into two parts: vehicle diagnosis related modules and modules not related to vehicle diagnosis. The vehicle diagnosis related modules are further divided into a diagnostic protocol service (KWP2000) and a network transmission protocol service (ISO-15765-2), which respectively correspond to functional descriptions of application layer services and network layer services, and define relevant reference environment parameters and test messages. sequence. [2]

These standards provide a detailed definition of the content of the CAN bus-based diagnostic service in the vehicle environment, the logical relationship between the sequence of network transmission messages, and the delay requirements. According to these requirements, a CAN bus network rapid prototyping is provided to truly simulate the message sequence and data stream with a given feature, and the reproduction of possible interference and error signals is the core technical work of this design. The result of this work can provide an analysis function of the relationship between network traffic, network efficiency and network response, and simulate and verify the robustness and real-time performance of the ECU control code in the automotive CAN network environment.

2.2 Structure and implementation of rapid prototyping system

The rapid prototyping system has three types of nodes: an actual CAN node with a physical CAN hardware interface, a virtual CAN node composed of a TH-CAN-Vcard and a Simulink model, and a monitoring node running a TH-CAN-Scope analysis tool. When designing a simulation experiment, the number of nodes is not limited and is only affected by the addressing scheme of the specific CAN application layer. The first type of node is the CAN node we usually use. Here we focus on the implementation of the latter two types of nodes.

2.2.1 Virtual CAN node

The virtual CAN node is composed of TH-CAN-Vcard and Simulink model, and the node implementation is shown in Figure 1. When the physical CAN card does not exist, the virtual hardware technology is adopted, and the virtual CAN channel provided by the CAN card driver library is selected, and the developed VCANCtrl control object is instantiated into a COM server (COM Server) to establish a COM server and MATLAB in a single machine. The connection between the model (as a COM client). The process of virtually receiving/sending CAN messages to the CAN bus provides basic CAN communication test functions for models built under Simulink.

When the physical CAN card is present, the target CAN channel in the model can be directly modified, so that the model in MATLAB has the function of communicating with other physical CAN nodes. At this time, multiple models and multiple ECU hardware on different PCs are available. The controller code on the CAN can establish a vehicle CAN network simulation analysis environment through the CAN bus.

Figure 1 Implementation of virtual CAN node

TH-CAN-Vcard is a CAN card emulation program developed in Windows environment using Visual Studio .NET and KVASER CAN card driver library. We developed the VCANCtrl control object through ActiveX technology and implemented the following internal functions in VCANCtrl:

VCAN_Read message receiving function; the entry parameter is the CAN channel handle, the return parameter is the ID of the CAN message in the receive buffer, the data packet, the length, the identifier and the timestamp.

VCAN_Write message sending function; the entry parameter is the CAN channel handle, and the ID, data packet, length and identifier of the CAN message to be sent.

VCAN_Start CAN card initialization function; the entry parameters are the selected CAN channel number, baud rate, channel open mode, sync mode and sync segment, and CAN controller operating mode.

VCAN_Close CAN card close function; the entry parameter is the handle returned when the CAN card is successfully initialized.

2.2.2 Monitoring node

The monitoring node is a node that performs CAN bus message sequence monitoring and control, and runs the TH-CAN-Scope - CAN message simulation analysis tool. TH-CAN-Scope is a tool for simulating CAN message sequences and performing simulation result recording analysis. It is an application developed under Windows using KVASER's CANLIB SDK.

TH-CAN-Scope's CAN message processing functions include: creating/editing message stream sequences, CAN communication management, CAN message sequence tracking, console human-machine interface, and database maintenance for message sequence management. The creation/editing of message flow sequences, CAN message sequence tracking, console human interface, and message sequence management related to database operations use user threads. CAN communication management requires high real-time performance, using independent worker threads, and two threads communicate with each other by using the message processing mechanism under Windows.

In addition, the analysis functions provided by TH-CAN-Scope include: online display of CAN messages, on-line statistics of CAN bus usage, recording of CAN messages on the bus, and active transmission/repetition of CAN disturbance messages. And the CAN message collected in a period of time is recorded in the database, which can perform more detailed and in-depth performance analysis. By using the CAN message editing tool, the monitoring node can be specified to be triggered at the time (send a certain / certain time in the specified relative time) The group CAN message) and the event trigger (send a specified CAN message sequence or a specified CAN message sequence when a certain CAN message is received) send a trigger message to examine the performance of the CAN bus.

2.3 System Implementation Technology

2.3.1 Implementation of MATLAB external program interface

TH-CAN-Vcard provides CAN communication function for the controller model and controlled model under MATLAB, and adopts COM technology. Compared with the external communication method of Matlab implemented by DDE technology [4], the performance of COM technology is better. In the test made by Emanuele Ruffaldi et al., the performance of COM is improved by 10 times compared with DDE, and the read performance is improved. More than 30 times [5]; In addition, MATHWORKS does not continue to develop the DDE interface, and it is recommended to use the COM interface.

For specific use, first we construct the VCAN sending module and the VCAN receiving module in Simulink, use the actxcontrol command in the M language to instantiate the VCANCtrl COM object, obtain its handle, and then call the corresponding object in the COM object through this instantiation handle. The VCAN_Write and VCAN_Read functions implement CAN communication support for the control model in Matlab, which is equivalent to a device with a handle in use.

2.3.2 Implementation of data stream simulation and node synchronization

In order to generate the specified CAN message sequence on the CAN bus, we define the required message sequence through TH-CAN-Scope, and then define the response operation to the CAN message on the bus by combining time trigger and event trigger. The corresponding control logic is implemented by the Simulink model. So the actual control strategy is similar to that distributed in each CAN node.

Synchronization between nodes means that all CAN nodes on the bus should be able to simultaneously generate their own specified message sequence at a certain time. The use of the TH-CAN-Scope broadcast to send a custom CAN synchronization to send messages, start the timer of each node, can achieve a certain degree of precision node synchronization.

2.3.3 Implementation of CAN bus performance analysis

In the performance analysis of the CAN bus, we realized the following analysis functions: to examine the impact of the bus load (including the number of nodes, the amount of information of each node and the bus speed set by each node); to examine the impact of the node priority strategy; The impact of the policy (such as the node with excessive transmission and reception error rate should actively exit the CAN bus network); and the real-time performance of the CAN network, including the size range of the network packet message delay and the change of the packet message delay. The delay size describes the static characteristics of the packet delay, and the delay variation describes the dynamic characteristics of the packet delay.

3 system function test and analysis

In order to verify the rapid prototyping system support for virtual hardware and actual hardware hybrid simulation under multi-ECU, we designed the system function test experimental platform shown in Figure 2: ECU-A and ECU-B are two independent hardware ECUs. The TH-ECU2003 controller developed by the laboratory; ECU-C and ECU-D are two independent control models developed in Simulink. The software simulation CAN card function is realized by the VCAN transmission module and the VCAN receiving module, which is virtual hardware. In the test, by filtering the received CAN message at each node, the control communication flow is as shown in Fig. 2, namely ECU-A -> ECU-B -> ECU-C -> ECD-D -> ECU-A. This verifies all scenarios under the hybrid simulation of virtual hardware and actual hardware.

Figure 2 Experimental platform for functional testing of rapid prototyping systems

In the experiment, TH-CAN-Scope was used as the monitoring software, and the data on the CAN bus was collected for 5s, and the time delay mean and standard variance of more than 2000 CAN message messages between nodes were analyzed. The delay includes the processing delay of the node and the transmission delay between the nodes. The analysis results are shown in Table 1. The experiment proves that normal communication can be performed between any two nodes in the system to meet the test requirements and verify the effectiveness of the system design. .

Table 1 Delay analysis of CAN message packets in the experiment

4 Conclusion

In this paper, the existing ECU software development tools focus on single ECU modeling and the development code in the existing network simulation tools reuse the difficult problems on the target system, and design and implement the CAN CAN network rapid prototyping system. Finally, the effectiveness of the rapid prototyping system design is verified by the simulation environment composed of the THECU-2003 hardware platform and the control model under Simulink.

Hyundai Car Dvd

Screen with GPS,Touch Screen with GPS,Touch Screen

Car Camera,Car Monitor,Rear View System Co., Ltd. , http://www.nscardvds.com

Posted on