Current location - Education and Training Encyclopedia - Graduation thesis - Ask for an electronic circuit design paper ~ ~ ~
Ask for an electronic circuit design paper ~ ~ ~
Design and Implementation of Electronic Multifunctional Watt-hour Meter

This paper expounds the design method, technical key of hardware design and software design flow of electronic multifunctional watt-hour meter. Taking uPD78F0338 single chip microcomputer of NEC Company as an example, a three-phase four-wire electronic multifunctional watt-hour meter with four rates, six load curves and two sets of rate structures is realized.

Electronic multifunctional watt-hour meter is mainly aimed at industrial users of three-phase electricity in domestic market. With the deepening of power industry reform, the demand for multi-functional watt-hour meters for industrial three-phase electricity consumption has greatly increased. At present, there are few kinds of multifunctional instruments in China, with high price and imperfect functions. They are often developed only for the specific requirements of some regions, lacking universality, and some products can not fully meet the requirements of national standards. The electronic multifunctional watt-hour meter introduced in this paper is designed to meet this market demand.

This is an intelligent high-tech electric energy metering product, which can simultaneously measure positive/negative reactive energy, positive/negative reactive energy and four-quadrant reactive energy. It also has many functions, such as multi-rate control, load curve recording, recording of voltage loss, overvoltage and frequency overrun of each phase, data LCD display and so on. The master station can read meter, set and read meter through RS-485 bus or hand-held infrared meter reader.

Software codes are all written in C/C++ language, which has high coding efficiency, good maintainability, convenient modular design, and functional modules can be easily cut according to user requirements. Moreover, the code has been optimized, and the size and execution efficiency of the generated target code are almost the same as those of the assembly code. The technical indicators of this product completely meet GB/T/KOOC-0/72/KOOC-0/5-/KOOC-0/998/KOOC-0/and Class 2 Static AC Active Power Meter, DL/T6/KOOC-0/4-/KOOC-0/997 Multifunctional Electric Energy Meter.

Overall structure and hardware design of multifunctional watt-hour meter

Integral structure of multifunctional table

The MCU main controller is the core of the hardware of the electronic multifunctional watt-hour meter, which is responsible for key input scanning, working state detection, reading, calculation and storage of metering data, field configuration of electric meter parameters and communication control with the outside world. Its main functional units include MCU main controller unit, electric quantity measurement module, infrared and RS-485 communication module, electric meter calibration module, EEPROM storage array and so on. Other auxiliary modules mainly include: clock calendar circuit, abnormal alarm circuit, key input circuit, reset and watchdog circuit, switching power supply module and standby battery circuit, large screen LCD module and LED display module. The overall structural block diagram of the multifunctional table is shown in figure 1.

High performance main controller unit

The main controller adopts uPD78P0338, a high-grade product in 8-bit single chip microcomputer of NEC Company. The single chip microcomputer adopts 120 pin QFP package, integrates 60KBFlash, asynchronous communication serial port, 40x4 LCD driver, bus clock up to 10MHz and 10 channel of 10 bit ADC, and can be programmed in the system through a simple interface, which greatly facilitates online debugging and software upgrade. And it supports advanced languages, which well meets the functional requirements of multi-function table, such as multi-task, large amount of data, complex algorithm and so on.

Serial port multiplex communication unit

The communication circuit module mainly includes TSOPl838 infrared receiver, infrared emitting diode, carrier circuit, MAX487 special 485 transceiver circuit, driving/switching diode and other components.

In order to facilitate users' meter reading, two serial meter reading methods, infrared local meter reading and RS-485 centralized meter reading, are designed for this electric energy meter. Because uPD78F0338 has only one serial port, serial port multiplexing technology is adopted in the design of communication circuit. The complementary switch consists of 90 12, 90 14 and several resistors, and the switch between infrared and RS-485 communication modes is controlled through an I/O port of the single chip microcomputer, as shown in Figure 2.

High-precision electric quantity metering module

The metering module consists of high-precision special electric energy metering chip SA9904, current transformer and other peripheral circuit components. SA9904 is a three-phase bidirectional power/electric energy metering chip produced by Sames Company, which can measure active/reactive power, voltage, frequency, abnormal phase sequence and so on. , and can independently measure the power consumption information of each phase, which conforms to the IEC 52 11036 standard and can meet the accuracy requirements of1AC watt-hour meter. Each data register has a precision of 24 bits. Therefore, it can better meet the requirements of multi-function instrument to measure various electrical data. The circuit diagram of SA9904 pin and its periphery is shown in Figure 3.

Among them, CLK, DO and DI form the interface with MCU controller, which is used to transmit control commands and measured electricity data, IIps, IIPt and IIPr are used for current sampling, and IVPl, IVP2 and IVP3 are used for voltage sampling.

Clock calendar module

The clock circuit adopts RTC-4553 real-time clock chip produced by EPSON Company. The 32.768kHz quartz crystal oscillator is integrated inside, which simplifies the peripheral circuit and can be set freely as needed to obtain higher frequency. At the same time, the clock and calendar counter are integrated, and the display mode of 24 hours or 12 hours can be selected. The clock can be adjusted every 30 seconds by the software, and the timing pulse output of 0. 1Hz or 1024Hz can be provided, so that the clock accuracy can be regularly checked outside the electric energy meter. The circuit diagram of RTC-4553 pin and its periphery is shown in Figure 4.

Among them, SCK, SIN and Sout interface with the main processor to send control instructions or transmit date and time data. The calendar clock module of the system uses batteries as backup power supply to ensure the accuracy of date and time when power is cut off.

Software design of multifunctional watt-hour meter

Data structure design

Multifunctional watt-hour meter involves a variety of data types. Bytes include single byte, double byte, three byte, four byte and six byte. According to the meaning, it includes time, time, voltage, current, active power, reactive power, active energy, reactive energy, frequency, power factor, threshold, status word, coefficient, table number, etc. Complex data types put forward higher requirements for the design of data structures. This implementation scheme solves this problem by adopting various data addressing methods and various types of memories.

Key points of data structure design

The data storage modes of the system are: internal ROM, RAM and external EEPROM.

Internal ROM is used to store a large number of constant tables, and RAM is used to store temporary variables and stacks. This scheme requires about 2.5KB of RAM, while serial EEPROM stores various user power data and table setting parameters, and exchanges data with CPU through 12C bus. According to the maximum requirement of design requirements, the electric energy meter needs about 250KB EEPROM. This scheme is composed of eight 256-bit EEPROM cascades.

Data addressing mode

There are two ways to access EEPROM data. Direct address access, reading and writing data directly through EEPROM address of data; Data ID addressing, reading and writing data through data encoding.

Design of communication port multiplexing function

Infrared communication and RS-485*** communicate through serial port (RxD/TxD). Since the serial communication starts from a low-level bit (0), the infrared receiver (separated from the 485 receiver by a transistor) is led to an interrupt pin INTP 1, through which it can be judged whether the serial data comes from infrared. When sending, send it in time and don't interfere with each other. Since the infrared communication and remote control receiver use the same receiving tube, when it is judged that infrared source is interrupted, the timer INTTM4 is started to detect the infrared receiver. If the pulse width is 9ms or 0.56ms, it is judged as infrared remote control, and the remote control code is detected according to the timing. Otherwise, it is judged that the serial port reception generated by infrared is interrupted, and the timing detection is closed.

The infrared 38.4kHz modulation signal is output by internal frequency division of CPU (P05/PCL). f = FX/27 = 4.9 152/ 128 = 38.4 khz .

Because there is an optional delay of 15 ~ 20 ms between infrared transmission bytes, 485 communication does not need delay. Data is transmitted in the transmission interruption, and the transmission interruption permission of infrared communication is closed immediately after the transmission operation, and the transmission interruption is allowed after the delay time expires.

Flow chart of multi-function table program

The main program flow of multi-function meter mainly includes initialization, data verification, load curve repair and transaction processing, and its flow chart is shown in Figure 5.

The daily transaction processing flow embodies most of the main functions of multi-functional meters, including rate processing, measurement data collection and processing, automatic meter reading, power pulse output, meter calibration module, power failure detection and processing module, etc. The flow chart is shown in Figure 6.