Design of reactive power compensation control for CAN bus based on AT89C52

Publisher:数字翻飞Latest update time:2011-06-08 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

According to statistics, among the three parts of transmission lines, high-voltage distribution networks, and low-voltage users, the line loss of low-voltage users is the largest. Therefore, loss reduction and energy saving should be mainly carried out around low-voltage 380V users. For a long time, my country's low-voltage distribution network has a weak grid structure, low natural power factor, and complex structure, which reduces the economic benefits of the power grid. At present, the power sector generally adopts the method of on-site reactive power compensation to solve this problem. There are many kinds of low-voltage reactive power compensation devices currently put into use on the market, but most of the compensation units are basically directly driven by the CPU of the main controller. The number of lines corresponding to the number of capacitors in the system will be drawn from the CPU. There are many lines drawn from the reactive power compensator, and the transmission distance is also limited. This brings great inconvenience to installation, inspection, maintenance and expansion.

CAN (Controller Area Network) bus belongs to the category of field bus. It is a serial data communication protocol developed by Bosch in Germany in the early 1980s to solve the data exchange between numerous control and test instruments in modern automobiles. The CAN bus standard supports full-duplex communication, and the transmission medium uses twisted pair and optical fiber. The transmission rate can reach 1Mbps and the number of nodes can reach 110. Its biggest feature is that it abolishes the traditional station address coding and replaces it with coding the communication data block. It has strong fault tolerance and anti-interference ability, high transmission security, fast communication rate, transmission distance of up to 10KM, and good anti-electromagnetic interference ability, so it has extremely high application value in practical applications. We apply CAN bus technology to low-voltage reactive power compensation devices, which can achieve better reactive power compensation effects.

2 System Hardware Design

2.1 Overall structural design of system hardware

The overall structural design principle block diagram of the system hardware is shown in Figure 1. The control system consists of a data acquisition unit, a central microprocessor controller, a CAN bus communication and drive execution unit, an input keyboard, a display unit, and other components.

Figure 1 Overall hardware structure diagram

The working principle of the controller is: the current and voltage signals sent from the control field sensors CT and PT are converted into 0~2V, 0~5A signals after secondary conversion. These signals are then processed so that the input voltage and current signals meet the input requirements of the data acquisition and measurement chip SA9904B. SA9904B stores the measured three-phase power parameter related values ​​such as voltage, active energy, reactive energy, frequency, etc. in its internal register. The microprocessor controller uses the AT89C52 microcontroller. The 24-bit register inside SA9904B is accessed through the SPI interface. The data in the register can be calculated according to the corresponding formula to obtain the active power and reactive power of each phase, as well as the effective voltage and frequency of each phase. According to the preset control strategy, the switch module to be operated can be determined, and then the main controller sends the intelligent switching module to be operated and the switching action to be performed to the CAN bus in the form of a frame, and the corresponding intelligent switch module controls the switching of the capacitor.

2.2 Hardware Design of CAN Bus Node

The node is the basic unit of the CAN bus network. In this system, the main controller and the intelligent switching module can be regarded as a node of the CAN bus. Each bus node is composed of a microprocessor, a CAN controller, and a CAN driver. The nodes are connected through the bus. The wiring diagram is shown in Figure 2:


Figure 2 CAN node hardware structure diagram

The CAN communication interface uses the SJA1000 communication controller and 82C250 bus driver produced by PHILIPS. 82C250 is the interface between the CAN controller and the physical bus. It has a high speed and overheat protection. It can provide differential sending and receiving functions for the bus.

2.3 Communication circuit design

The CAN intelligent node structure consists of three parts: microcontroller, CAN controller, and CAN transceiver. The CAN transceiver is responsible for establishing the connection between the CAN controller and the physical bus, controlling the logic level signal from the CAN controller to the physical layer of the physical bus, and vice versa. The CAN controller and transceiver are respectively SJA1000 and PCA82C250 from PHILIPS. The microcontroller is responsible for receiving data from the CAN controller, then processing the data, and sending the processing results to other nodes in the network through the CAN controller and CAN transceiver. In order to enhance the anti-interference ability of the CAN bus node, the TX0 and RX0 of the SJA1000 are not directly connected to the TXD and RXD of the 82C250, but are connected to the 82C250 through the high-speed optical coupler 6N137, thereby realizing the electrical isolation between each CAN node on the bus.

2.4 Safety protection circuit design

During the operation of the single-chip microprocessor CPU, the program may "run away" or freeze due to external interference. When the CPU scans for longer than the normal period, the monitoring control timer needs to send a forced reset signal to pull the CPU back to the initial state and restore the system to normal. This design uses the new product X5045 programmable watchdog from XICOR, USA. When the system fails, as long as the scan cycle reaches the programmed timeout limit, or when the power supply voltage drops below the minimum conversion point, the chip RESET pin will immediately output a high-level reset signal, thereby avoiding the impact of system safety performance due to system failures, power on and off, instantaneous voltage instability and other factors.

2.5 Human-machine interface design

This device can be used to set control parameters through a combination of 4 buttons, such as voltage upper and lower limits, power factor upper and lower limits, current transformer ratio, etc. It can also be used to select manual operation mode or automatic operation mode. The LCD display uses RT12864, which can display 4 rows of Chinese characters. It is small, exquisite and beautiful. The LCD display module displays the three-phase real-time power factor when working, and can also display the three-phase real-time voltage, active power, reactive power and other parameters by turning the buttons.

3 Software Design

The modular software design is adopted to divide the software into several relatively independent functional modules, and arrange appropriate entry and exit parameters for each module, so that the modules can be connected to each other and combined flexibly and conveniently. The software of the intelligent sensor consists of data acquisition module, output control module, CAN bus communication module, etc. Each module coordinates work under the program scheduling of the monitoring system. The CAN bus communication module consists of three parts: initialization program, data sending program and receiving terminal program. Since the system can actively communicate with other nodes at any time, the communication program of each node is the same. The CAN interface module based on AT89C52 and SJA1000 establishes communication through the CAN bus. The application program of SJA1000 can be divided into initialization program, message sending program and message receiving program.

3.1 CAN controller SJA1000 initialization design

The node initialization mainly refers to the initialization of the microprocessor AT89C52 and the CAN controller SJA1000 after the system is powered on, in order to determine the working main frequency, baud rate and output characteristics. The initialization of AT89C52 can be combined with its monitoring tasks, mainly for interrupt enable and shield, interrupt priority, timer use and setting, etc. Since there is no microprocessor inside SJA1000, its initialization still needs to be programmed by AT89C52. The initialization program flow is shown in Figure 3.

Figure 3 Initialization program flow chart

The initialization of SJA1000 should be performed in reset mode, so in the SJA1000 initialization program, the working mode should be set to reset mode first, and then the acceptance filter mode, acceptance mask register (AMR) and acceptance code register (ACR), baud rate parameters and interrupt enable register (IER) should be set. The synchronization jump width and communication baud rate in the physical layer of the CAN protocol are determined by the contents of the timing registers BTR0 and BTR1. It should be pointed out that for all nodes in a system, the contents of these two registers must be the same, otherwise communication will not be possible. After the initialization setting is completed, the reset request position is set to "0", and SJA1000 can enter the working state and perform normal communication tasks.

3.2 CAN bus data sending and receiving program design

After initializing SJA1000 and establishing CAN bus communication, the module can send and receive CAN data packets through the CAN bus. The message is automatically sent by the CAN controller SJA1000 according to the CAN rules. The main controller must send the information to be sent to the SJA1000's send buffer and set the "send request flag" in the command register. The module actively sends data packets to the bus. If the transmission is unsuccessful once, it can be sent again.

The CAN controller SJA1000 automatically receives messages according to the rules, and the received messages are placed in the receive buffer. At this time, the receive buffer status flag RBS is set to 1, which means that there is a received message in the receive buffer. The main controller must save the message to the message buffer set by the program, release the receive buffer and respond to the message content. The receiving process can be performed through the interrupt request of SJA1000 or by querying the flag bit of SJA1000.

4 Conclusion

The communication design method introduced in this paper is applied to the online reactive power compensation control system of the power grid. It adopts a short frame structure, fast data transmission speed and low interference probability. When different detection device nodes transmit data at the same time, the node with high priority transmits first. It adopts a multi-master data transmission method. Any error in any node on the network will not affect the normal operation of other nodes. From the overall design, it can be seen that the outstanding advantage of the reactive power compensation device based on CAN bus is that it reduces the lead wires of the entire system, makes the equipment simple and easy to expand, and is also convenient for installation, inspection and maintenance.

The main innovation of this paper is to use CAN fieldbus technology for low-voltage power grid reactive dynamic compensation, and use standard protocol communication to expand the system's communication structure. The use of advanced bus technology makes the system structure simple and efficient, and any node error in the network will not affect the system, greatly improving the reliability and adaptability of the system.

Reference address:Design of reactive power compensation control for CAN bus based on AT89C52

Previous article:Design of wireless sensor network node based on CC1110
Next article:Application of TMS320VC5402 in Acceleration Wave Sensor

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号