Development of engine simulation system based on SAE J1939 protocol

1 Introduction CAN bus occupies an important position in the automotive LAN with its excellent performance. IS011992, IS011783 and SAE J1939 are all automotive system communication protocols based on CAN bus. Among them, SAE J1939 has the best performance and is currently the most widely used communication protocol for large vehicles. Analyzing and researching SAE J1939 protocol is helpful to promote the application of CAN communication bus in domestic automobile communication, and is of great significance to the formulation of upper layer protocols. The system design is based on the understanding of the application layer of SAE J1939, using software programming to simulate the sending of engine information, thus providing a good test environment for the design of bus instrument hardware.

2 SAE J1939 protocol overview SAE J1939 standard is a vehicle network serial communication and control protocol with CAN bus as the core issued by the Society of Automotive Engineers (Societv of Auto-moTIve Engineers, referred to as SAE). Basically, the communication rate can be up to 250 Kb / s. It provides clear regulations on the address configuration, naming, communication method and message sending priority of the ECU inside the car, and details the ECU communication of various communities inside the car. The SAE J1939 application layer protocol describes in detail the parameters of the SAE J1939 network, including data length, data type, resolution, range, and reference labels, and assigns a number (SPN) to each parameter. A protocol data unit (ProtocolData Unit, PDU for short) is used to transmit information, and each PDU is equivalent to a frame of the CAN protocol. SAE J1939 is a transmission data protocol, and its functions are divided into two parts: data splitting and packaging and reassembly connection management. PDU is composed of 29-bit identifier and 0 ~ 8 bytes of data, as shown in Figure 1. SAE J1939 uses a 29-bit identifier (CAN extended frame) to provide a complete network definition. In Figure 1, the P bit determines the first 3 bits of the message priority; R is the reserved bit; DP is the data page bit: PF field identification 2 PDI format (PDU1, PDU2); replace the remote request bit SRR and identifier extension bit IDE, not included in the PDU; the PF value of the PS field determines whether it contains a target address (DA) or a group extension (GE) for the PDU format PF; SA is the source address.

SAE J1939 uses multiplexing technology to provide standardized high-speed network connections based on the CAN bus for various sensors, actuators and controllers of automobiles, thereby achieving high-speed data sharing between in-vehicle electronic devices and effectively reducing the number of electronic wiring harnesses , Improve the flexibility, reliability, maintainability and standardization of the vehicle's electronic control system to maximize the excellent performance of CAN.


3 System design scheme The engine simulation system transmits data to the bus instrument CAN interface card through the USB CAN-II intelligent interface, and the bus instrument responds to the simulation system through the USBCAN-â…¡ interface card, as shown in FIG. 2. The system is designed to be developed under the C # environment and runs on the Windows platform. The system is designed with main function modules such as engine parameter message, engine failure message, engine instrument test, etc., as well as single or multi-frame optional transmission methods. By calling the USBCAN-II interface card library port function, the CAN bus transmission is used to realize the communication between the upper computer and the lower computer, and simulate the sending of various engine parameters, such as coolant temperature, intake air temperature, oil pressure, etc. The instrument evaluates the error of the bus instrument stepper motor.

The USB CAN-II dual-channel intelligent CAN interface card has 2 CAN channels (car type). It uses a 16-bit microcontroller with powerful functions and supports plug and play. The 16-bit microcontroller on the board can control the sending and receiving tasks of the CAN controller. Even in the case of heavy bus load, it can still effectively support the filtering, preprocessing and storage of CAN messages with time stamps and CAN messages. Real-time transmission of text and other functions. The universal CAN-bus interface function library assisted by USB CAN-II can be invoked through programming, which can effectively support the application of CAN system based on PC. The program design flow chart is shown in Figure 3.

C # method of calling interface library functions: (1) put the library function file in the working directory; (2) declare using System. RunTIme. InteropServices; (3) Declare the data type of the ZLGCAN series interface card information; (4) Import, take the device function as an example, other function function references are similar. The function to open the device is:

4 Engine simulation system design The system is divided into engine parameter message, engine failure message and engine instrument test according to function. In order to facilitate the individual use of each functional interface, a composite interface is used. Its running interface is shown in Figure 4.

4.1 Engine parameter message sending module This module is a set of data for analog field test. According to the CAN communication specification of SAE J1939 for the Euro III engine applicable to the BOSCH high-pressure common rail system, the frame ID and the data word representing the engine parameter The position of the section corresponds, and the parameter value to be sent can be changed by modifying the relevant byte.
If you want to send a speed of 2 000 r / m, the data is in the 4th and 5th bytes of the message. The 4th and 5th bytes of the transmitted data are 2 000 / 0.125 = 16 000 converted into two bytes. Note that the high byte is placed in the 5th byte, and the low byte is placed in the 4th byte. Similarly, the lookup table can be used to calculate other engine parameters, such as lubricating oil pressure, coolant temperature, battery voltage, fuel oil level, ECU temperature, intake air temperature, oil pressure, throttle position, etc., corresponding to the frame ID and data. The position of the frame.
4.2 Engine failure message sending module When the engine fails, the data collected by the sensor is analyzed and processed by the EMR microcontroller to determine whether the collected data is within the normal range or valid. If the data is not within the normal range or is invalid, EMR will send a fault frame to the host computer, indicating that the element corresponding to the sensor is faulty. The bus instrument designed by this system has added the fault diagnosis function, which can display the fault type of the engine in real time by means of the liquid crystal display.
In terms of fault diagnosis, SAE J1939 defines 19 diagnostic messages (DiagnosTIc Message, DM for short). The fault message sending module mainly uses the DM1 (display current fault) function. The DM consists of a diagnostic trouble light code (2 bytes) and a diagnostic trouble code DTC (4 bytes). The length of the diagnosis fault code DTC is 4 bytes, including the suspect parameter code SPN (19 bits), the fault type code FMI (5 bits), the number of fault occurrences OC (7 bits), and the SPN conversion method CM (1 bit).
The system design defines more than 400 faults. The fault type codes FMI and SPN are combined to define. The definition follows the principle of one-to-one correspondence between the combination of SPN and FMI and the fault type.
4.3 Engine instrument test module The engine instrument test module compares the pointer running speed of the virtual instrument with the development instrument to test the stepper motor drive of the development instrument. Since only instrument data such as speedometer, oil pressure gauge, water temperature gauge, voltmeter, etc. are provided by the engine CAN bus, the test instrument can only simulate the driving of the stepper motors of these four dials. The test instrument uses the Dundas Instrument Wizard. The product fully supports Visual Studio 2005 features, including smart tags and advanced data binding. Dundas Instrument Wizard provides a rich material library. With this wizard, users can design the appearance of instrument controls and data indication methods used in various fields. Users only need to write the relevant instrument dynamic changes and response part of the code to achieve the virtual instrument function.

5 Conclusion Introduce the design of engine simulation system based on SAE J1939 protocol. The system has the function of engine working condition selection, connected with the bus instrument to be developed, and can simulate and output various working condition data of the engine. Once a message is selected, the engine parameters represented by the message are continuously sent to the bus interface of the bus instrument to be developed at the update rate specified in the message. Using this system design software to replace the real engine, it can randomly detect various engine operating conditions, and has the flexibility of artificial selection, and the selection range is larger than that of the real engine. The online simulation system is not restricted by the working environment and can be tested anytime and anywhere. The system is part of a set of engine test systems in the laboratory and can also be used in conjunction with teaching experiment courses. Through experiments, the functions of each part of the software run well, which has certain value for the development of bus instruments. With the continuous development of the CAN bus application field, the SAE J1939 protocol is bound to be widely used.

Road Light

Road Light,Double Arms Road Light,Off Road Lights,Round Road Light

Yangzhou Heli Photoelectric Co., Ltd. , https://www.heli-eee.com