Share this

Locomotive Real-time Monitoring System Based on CAN Bus

2026-04-06 04:47:53 · · #1
1. Introduction Traditional locomotive monitoring devices transfer data recorded during locomotive operation to a ground-based secondary development platform for data analysis and fault diagnosis. However, this method lacks real-time performance and cannot monitor the locomotive's operational status in real time. With the development of railway informatization and digitalization, there is a growing demand for online real-time locomotive monitoring and condition-based locomotive maintenance. In recent years, the maturity and continuous development of domestic fieldbus technology, along with the maturity of GPRS (General Packet Radio Service) wireless data transmission, have made real-time monitoring of locomotives and rolling stock possible. Therefore, based on practical experience, this paper introduces a locomotive real-time monitoring system based on the CAN (Controller Area Network) bus. The system uses GPRS short message service to achieve real-time communication between the onboard data acquisition module and the ground monitoring system, enabling the ground monitoring center to monitor the train's operational status in real time. The CAN bus is one of many fieldbus standards, offering advantages such as ease of use, reliable performance, and good system scalability. CAN bus effectively supports serial communication networks for distributed or real-time control. It employs short message frames and MAC (Media Access Control) methods such as GSMA/CD-AMP (Carrier Sense Multiple Access with Information Priority and Collision Detection), and is widely used in industrial automation. It is particularly suitable for systems used for optimization, analysis, and maintenance. Research on CAN bus applications began in China in the 1990s, and CAN bus technology is now applied in many fields. 2. Basic Principles Figure 1 shows the structure of a locomotive monitoring system. It includes three data acquisition modules, one storage and transmission module, and a ground monitoring system (the ground system portion is not shown in the figure). The data acquisition modules are responsible for acquiring important analog data such as traction motor armature voltage, armature current, and excitation current; the switching states of various fan contactors; and digital encoding of basic locomotive information (including locomotive speed, locomotive position, locomotive number, etc.). The storage and transmission module coordinates the work of each data acquisition module, sending the acquired data to the ground monitoring system via GPRS. The ground system consists of a PC and modules such as a GPRS wireless antenna. It sends commands to the onboard system via the GPRS antenna, instructing the onboard modules to operate according to ground requirements. The ground system also receives and stores field data sent from the transmitting module, transmitting and receiving data in the GPRS short message service format. The ground system software is written in Visual C++. The software uses a user-friendly human-machine interface to display, track, and monitor the train's operating status in real time, enabling real-time online fault detection and diagnosis of the locomotive. When a locomotive malfunctions, it can also provide timely operating suggestions to the driver. During locomotive depot maintenance, the system also provides maintenance guidance. Due to space limitations, this paper will focus on the onboard components. 3 Hardware Structure Design This system is a controller area network (CAN) built according to CAN 2.0b. The bus controller uses the CAN controller built into the Philips P87C591 microcontroller. The P8XC591 is a single-chip 8-bit high-performance microcontroller with an on-chip CAN controller, employing the powerful 80C51 instruction set and successfully incorporating the Pelican functionality of the SJA1000 semiconductor CAN controller. The CAN bus driver uses the PCA82C250, which is compatible with the SJA1000 CAN controller. The lower-level and upper-level computers communicate bidirectionally via shielded twisted-pair cables (CANH and CANL). A 100Ω to 120Ω resistor is required across the bus termination to suppress signal reflection and ensure communication reliability. Twisted-pair cables connect the various module nodes, forming a multi-master control local area network. To enhance the anti-interference capability of the CAN bus nodes, the RXDC and TXDC pins of the P87C591 are connected to the 82C250 via a high-speed optocoupler 6N173, ensuring electrical isolation between the CAN nodes on the bus. The two power supplies used in the optocoupler circuit must be completely isolated. Figure 2 shows the interface circuit diagram between each node and the CAN bus. [align=center] Figure 2 CAN bus interface circuit diagram[/align] The main functions of the analog signal acquisition unit can be divided into a microprocessor and its control section, a CAN communication interface section, a multi-channel analog input selection switch, and an analog-to-digital converter chip. Analog signals are directly introduced from the locomotive's microcontroller cabinet, where they are conditioned to a level suitable for A/D conversion. The sampling and quantization of the analog signals are performed by an ADS774. The ADS774 is a 12-bit successive approximation parallel A/D converter manufactured by Burr-Brown, with a typical conversion time of 8.5μs. An MCP506A is selected as the 16-channel signal switching switch, performing time-division multiplexing of the 16 analog signal sampling and A/D conversion. The signals acquired by the switch quantity acquisition unit all originate from the locomotive's electrical control cabinet. The acquisition board must employ opto-isolation to enhance anti-interference capabilities and achieve electrical isolation from the sampling circuit. The system uses two 8255A chips to expand the P0 ports for sampling 48 switch signals. The A, B, and C ports of the two 8255A chips are set to mode 0 and input mode, respectively. The four modules have basically similar structures and will not be described in detail here. The storage and transmission module consists of flash memory, a DS12887 clock chip with power-off protection, and a GPRS antenna. Flash memory, with its ability to retain data even after power failure, serves as a black box for storing locomotive data. The GPRS antenna and microcontroller are connected via RS-232, and the microcontroller uses the serial port for reading and writing to receive and transmit data with the China Mobile network. A 64kb HM6264 RAM is used to store relevant control information and serves as a data exchange area with the China Mobile network and the storage and transmission module. 4 System Software Design 4.1 CAN Initialization Subroutine The initialization of the CAN controller is a crucial part of the system design. It is a prerequisite for the normal operation of the CAN bus and affects the entire vehicle system's functionality. Initialization is both a key focus and a challenge. CAN communication initialization includes setting the operating mode, the acceptance filter, and the bus timer. The acceptance filter setting determines the format of the information received by the node; the timer setting determines the CAN bus data transmission baud rate. The 80C51 CPU interface connects the Pelican to the internal bus of the P87C591 microcontroller, allowing quick access to the Pelican registers and RAM area through five special function registers: CANADR, CANAT, CANMOD, CANSTA, and CANCON. Initializing the CAN register essentially involves reading and writing to the five special function registers mentioned above. The following is the initialization subroutine code written in C. void init_can(void) { canmod=0x01; // Set the CAN controller to reset mode to start initialization p1m2=p1m2|0x02; // p1m2.1='1', p1m1.1='0' (default) canadr=btr0; // btr0 and btr1 are programmed to 125kbit/s@12MHz candat=0x45; canadr=btr1; // tseg1=12, tseg2=3, sjw=2 candat=0x2b; // sample=1->sample point~81% canadr=acr10; // Set the address to acceptance code register 0 (bank1) candat=0x40; // Acceptance filter code canadt=0xe0; // Acceptance filter code canadr=amr10; // Set the address to acceptance mask register 0 (bank1) candat=0x00; //bank1: Acceptance mask 0 candat=0x0f; //bank1: Acceptance mask 1 (unrelated) candat=0xff; //bank1: Acceptance mask 2 (unrelated) candat=0xff; //bank1: Acceptance mask 3 (unrelated) canadr=acfmod; //Set the address to the ACF mode register candat=0x55; //Single acceptance filter uses 11-bit ID (SFF) canadr=acfprio; //Set the address to the ACF priority register candat=0xff; //All filters are high priority canadr=acfen; //Set the address to the ACF enable register candat=0x01; //Enable the acceptance filter of bank1 canmod=0x00; //Select the operation mode and exit the CAN controller reset mode} 4.2 CAN receive and transmit subroutine CAN bus communication uses a single filter standard frame: using a complete identification code including the RTR bit and the first two data bytes for acceptance filtering (see CAN initialization program code for filter settings). A standard frame consists of 13 bytes, including: a 3-byte frame header (synchronization word) to ensure the receiver can correctly locate the header each time; a one-byte command/data identifier, which serves as the packet code's identification information (including data type, instruction type, etc.) in this system, thus separating commands and data for easier differentiation and processing by the receiver; the next 7 bytes contain the specific data or instructions within the CAN data packet; and the last 2 bytes are reserved in the standard frame. Each module decomposes and judges the data packet based on its identifier. Each module stores the data in its corresponding buffer according to the packet code's identification number. After all the data sent by the source node has been correctly received, they are all sent to a shared buffer so that the control processing subroutine can perform control processing based on the received data. The following is the basic code of a CAN receiving program written in C language. void rec_can(void) // Receive subroutine { uchar length; // CAN data length code uchar i; bit ff; // ff=0 (standard CAN frame); ff=1 (extended CAN frame) while (rbs==0) ​​rbs=0; // Check if rbs is 1. If not, it means there is no readable data in rbf. canadr=rbf; // Address points to the CAN receive buffer address receivemessage[0]=candat; // Read and save frame information bytes ff=receivemessage[0]&0x80; // Retrieve frame format length=receivemessage[0]&0x0f; // Retrieve frame length dlc if (length>0x08) length=0x08; receivemessage[1]=candat; // Read and save RX identification code 1 receivemessage[2]=candat; // Read and save RX identification code 2 if (ff) {receivemessage[3]=canandat;receivemessage[4]=canandat;} for (i=0;i;i++) {if (ff) receivemessage[i+5]=canandat; else receivemessage[i+3]=canandat; //standard frame} cancon=0x04; //release receive buffer} The sending program of the CAN controller is also the basic program for inter-module communication. The following is the sending subroutine for CAN node communication. void send_can(void) //sending subroutine {uchar i; if (tbs==1) //sending buffer status = released? {canadr=tbf; //address points to 591tx buffer, candat=message[0]; //write tx frame information canandat=message[1]; //write tx identification code 1 candat=message[2]; //write tx identification code 2 for (i=0;i<8;i++) // Write data bytes {candat = message[i+3];} cancon = 0x01; // Set send request bit } else {//p8xc591 send buffer not released, run other programs} } 4.3 The system software structure consists of a storage and transmission module and three data acquisition modules operating according to the following protocol: The digital acquisition unit receives basic locomotive information via an RS485 bus. RS485 bus data is transmitted in 40-byte packets, with the first byte being the node address, the last byte a checksum, and the middle 38 bytes containing the basic locomotive information. The digital acquisition unit unpacks the data packets, extracts basic information such as the current locomotive speed, position, locomotive number, and track status, and sends the data to the storage and transmission module in CAN standard frame format. The storage and transmission module waits for and receives data from the digital acquisition unit, then sends data acquisition commands to the other modules, receiving the data acquisition results from each module by changing the filtering parameters during operation. The received data is stored in flash memory according to the format agreed upon with the ground monitoring system, and finally written to the serial port, transmitting the acquired data to the ground monitoring system via a GPRS antenna. When the ground system receives data from the onboard system, it sends an acknowledgment frame to the onboard system. Figure 3 shows the basic workflow diagram of the storage and transmission module. The analog quantity acquisition module and the digital quantity acquisition module have similar workflows. After the analog quantity unit is initialized, it waits for the A/D conversion instruction sent by the storage and transmission module, and then starts the 16-channel A/D conversion in sequence. After the conversion is completed, the 16-channel A/D conversion results are packaged and sent to the storage and transmission module in the CAN standard frame format. After the digital quantity acquisition unit is initialized, it waits for the data acquisition request instruction from the host computer, reads the 48-channel relay on/off signals, and after the conversion is completed, packages the data in the CAN standard frame format and sends it to the storage and transmission module. 5 Conclusion The system has been tested in the laboratory and has stable performance and strong anti-interference ability, which fully demonstrates the superiority of the CAN bus. The system is currently installed and running on the vehicle and has achieved the following good benefits: [align=center] Figure 3 Storage and transmission module program flow[/align] (1) Real-time monitoring of locomotive operation status to ensure train operation safety. The operation data generated by the locomotive at any time and any place can be monitored by the ground monitoring system; the on-board storage and transmission unit sends the operation data to the ground monitoring system in real time. When the locomotive malfunctions, the system can provide the locomotive and electrical departments with raw analysis data in a timely manner. (2) Equipping the system reduced the workload of the transfer personnel, improved production efficiency, and saved labor.
Read next

CATDOLL Dolly Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22