CAN bus in the intelligent power distribution system

Introduction
Currently, most of the computer room power distribution system using UPS, ensure reliable power supply room. UPS systems are used for each channel current automatic air circuit breakers for overcurrent protection, such protection is effective, but not intelligent, can not be set, not alarm, and no power supply and fault alarm information records, and high reliability of the requirements is not consistent with the need and demand for further reform. This article is the development of intelligent computer room power distribution system iPDS (Intelligent Power Distribution System) satisfy the above requirements, has two major characteristics of intelligence and humanity. The system uses interactive CAN bus data transfer, good to meet system reliability, real-time and cost requirements.

System Design
The intelligent system power supply from various quarters on the engine room current, leakage current, zero ground voltage, automatic air breaker status information such as real-time monitoring, display, real-time alarm, detailed records and other functions, and can be flexible based on user requirements configuration of monitoring information from various quarters. You can check room separate ways on the display power usage, early detection and eliminate hidden dangers, real-time fault, and further improve the system reliability.
The system consists of data processing units, data acquisition node, LED display node, touch screen etc., of the specific system architecture shown in Figure 1.

CAN bus in the intelligent power distribution system

Figure 1 Intelligent Distribution System Chart
Complexity of the system structure, perfect function, touch screen via RS-485 and the data processing unit connected to the data processing unit, data acquisition node and nodes are mounted LED display on the CAN bus, the components of different functions:
1. Data processing unit has two CPU, MCU AT89C58 and P87C591, both through the dual port RAM for data exchange, which AT89C58 and the touch screen through the RS-485 communication, dealing with touch screen display and setting information, P87C591 CAN bus address mutual information.
2. Touch screen is the system's main interface used to set the system configuration information, displays the current separate ways in the current, leakage current, voltage and zero-in automatic air circuit breaker status, etc., and can view the history of police records.
3. Data Acquisition Node collection separate ways analog and switch information transmitted through the CAN bus for data processing unit.
4. LED display shows the current separate ways the major nodes of analog and switch the alarm information to facilitate users to view, make the system more humane.
CAN bus hardware design
P87C591 Introduction
In the system, manufactured by Philips P87C591 microcontroller, which is a high-performance 8-bit microcontroller with on-chip CAN controller, which greatly simplifies the hardware design improves the stability of CAN interfaces.
P87C591 uses a powerful 80C51 instruction set and integrated SJA1000 CAN controller PeliCAN function.
P87C591 CAN node connected to the circuit design is relatively simple, the required external components plus two capacitors is only a crystal oscillator driver chip, a connection to the reset pin of the resistors, capacitors. Using on-chip power-on reset circuit and a transceiver to connect to the CAN bus P87C591.
CAN bus communication process and the allocation of identifiers
The system requirements for real-time high volume data transmission, data collection node information collection should be fast to load the data processing unit for timely processing, data processing unit Jiang settings on the touch screen real-time transmission of information to the data acquisition unit; data processing unit processed the information collected, will the current system state in a timely manner in the LED display on the displayed nodes, and command relay.
The CAN bus system using CAN2.0B communication protocol, a standard frame format, the 11 identifiers to distinguish between nodes on the CAN bus. CAN bus data processing unit is the most important nodes, control of the bus data transfer and processing, the highest priority, followed by data collection node, which is the source of data, real-time acquisition Biography
Delivery of data, is again LED display node.
Taking into account the expansion of the system problem, set aside part of the identifier, according to the user requirements can be increased, decreased data acquisition node and LED display nodes, without affecting the priority of the system design.
CAN Bus Software
Data processing unit is the highest priority on the CAN bus nodes, control the whole process of data transmission on the bus, its software design includes two parts, namely, application layer protocol communications network and the function realization of the process and coding.
Functional analysis and system initialization software design
P87C591 completed for data processing and transmission, through the CAN bus data acquisition node collection to receive from various quarters to the analog and switch information, collated by the agreement to the dual-port RAM in the storage and processing results to the LED display according to the node send a message. Dual-port RAM in the main program query the data collection node settings, real-time data acquisition Jiedian send a message to, with and Fasongyuancheng frame, Qingqiumoni and switch information of the transmission, 这样 avoid multiple data collection nodes Tong Shi Shang Mass collection of information, effectively preventing the overflow and data loss to receive, information received from various quarters after the acquisition, processing and storage to the dual-port RAM, and send to the LED nodes.
In program design, system design initialization procedure is a very important part of the work, it is the premise of the system can work properly. Therefore, the initialization design is a key process in the system initialize the dual port RAM to be initialized, open the watchdog, set the interrupt priority, initialize CAN controller and the I / O port, open The total interruption operations to ensure the stability of the system to work properly.
CAN Communication Program
CAN communication software mainly consists of the following components: initialization, receiving and processing, sending processing, interrupt handling and error handling. This article focuses on initializing, sending, receiving and processing routines and error handling.
Initialization subroutine
CAN controller initialization, including the mode of operation, acceptance filters, bus timing and interrupt settings. Acceptance filter setting determines the information received in this node format. Timer used to set the CAN bus baud rate of data transmission, the baud rate of each node on the bus must be consistent, otherwise it will cause data transmission errors.
Send process
Subroutine is responsible for node to send packets to send. The user simply sends the data to be transmitted into a specific format, a combination of packets sent into the CAN controller buffer, and then you can start sending commands. Information from the CAN controller is sent to the CAN bus is done automatically by the CAN controller. The system uses the query sent.
Receiving process
Subroutine is responsible for receiving node to receive packets, and other conditions of treatment, such as on the bus off, error alarm, receive overflow handling the situation. Information from the CAN bus to CAN CAN controller buffer is done automatically. Receiving program simply read from the receive buffer to receive the information you can. Taking into account the requirements of real-time, using interrupt shown in Figure 2.
Error Handling
In the CAN initialization, open the wrong alarm interrupt enable and bus error interrupt is enabled when the error counter (send error counter and receive error counters in any of them) count more than 96, indicating the bus was seriously disturbed, resulting in Error warning interrupt; when sending an error counter exceeds 255, the node into the bus off, CAN controller will set the reset mode bit to 1 (current) and generates an error warning and bus error interrupt. Error alarm is cleared of all wrong interrupt counter value, to maintain the operation of CAN, but it has limitations: clear the error counter is simply reset the error counters and can not fundamentally eliminate the source of error; due to an error alarm interrupt conditions resulting from the error counter is over 96, while the bus closed interrupt conditions generated by sending the error counter exceeds 255, therefore, send an error counter error alarm caused the bus error interrupt can be masked interrupt. System error alarm response may be due to disruption caused the total system can not produce bus close to CAN bus has been in a precarious state.
To avoid this, only open bus error interrupt enable, so that the bus where a serious error, bus error interrupt can be generated immediately, so that errors are a timely manner. Bus error interrupt handling is reset the node, re-initialize the CAN controller, so you can eliminate the error, give a good initial state node. As the CAN bus error between the two transmission line contacts are also easily lead to CAN bus off, so that nodes do not work, check status register in the main program in the current CAN bus status, time reset the node to node to work.
Meanwhile, in order to more easily visualize the CAN bus, working condition, designed a light, when the bus normally send and receive messages, the indicator light flashes, once the CAN bus off, the node does not participate in bus activity, the indicator no longer flashes (this bright light or long long time off), when the bus error can not be reset when the node address, you can view the status indicator (long light or long off), in a timely manner for non-maintenance repair work nodes.

Conclusion
Using CAN bus technology to build intelligent power distribution system to improve the system stability and real-time, system low price, easy installation and maintenance, has a good upgrade, expand capacity. The system has been successfully fitted to the economic, trade, stock trading room in the industry, reliable operation, to achieve the design objectives.

Declined comment