Research on Vector Measurement and Power Calculation of Least Square Filter in Single Chip Microcomputer

Publisher:快乐之源Latest update time:2013-02-16 Source: dzscKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    A single-chip microcomputer is an integrated circuit chip that uses very large-scale integrated circuit technology to integrate a central processing unit CPU with data processing capabilities, random access memory RAM, read-only memory ROM, multiple I/O ports and interrupt systems, timers/counters and other functions (may also include display driver circuits, pulse width modulation circuits, analog multiplexers, A/D converters and other circuits) onto a small and complete computer system.

  At present, digital electrical measurement and protection devices based on single-chip microcomputers have become the mainstream form. Direct sampling of AC signals has also become a common method. Fast Fourier algorithm is the main algorithm, while the least squares algorithm has a large amount of calculation. Especially when the processing power of single-chip microcomputers is limited, it is difficult to ensure both real-time performance and calculation speed without careful design and program optimization.

  By reducing the number of sampling times, using a filter that fits four sampling points per week and a set of optimization measures, the algorithm's calculation speed is greatly improved, making it capable of real-time measurement of power frequency vectors, and thus can be used in multiple aspects such as overcurrent, quick disconnection, and directional protection. This paper analyzes the vector phase relationship in the filter and gives an example of two-wire power calculation based on this. This method has been verified by practical applications.

  1 Construction of Least Squares Filter

  According to the research results of literature [1-3], for each signal, the input voltage function can be expressed as:

  In general measurement and protection applications, only the fundamental wave component is of concern. To reduce the amount of calculation, the number of samplings should be minimized. According to the sampling theorem, the number of discrete samplings of a sine function is at least 3 times per cycle. For convenience, the number of samplings per cycle is set to 4, that is, the sampling period is 5ms. Then formula (1) can only contain DC and power frequency components. Expand the DC component according to the Taylor series and take the first two terms, then formula (1) becomes:

  

  Among them, P0 is the DC component value, P1 is the peak-to-peak value of the fundamental wave, and θ1 is the phase angle of the fundamental wave component relative to the zero point at the sampling time.

  If the last four consecutive sampling values ​​are used as samples, four sampling equations can be obtained. If P0, -P0λ, P1cos(θ1)P1sin(θ1) are used as unknown variables to be measured, the four sampling equations can be expressed as the following matrix:

  If we use A to represent the coefficient matrix, X to represent the unknown parameter vector, and U to represent the sample value, then:

  

  Where A-1 represents the inverse matrix of A, that is, the least squares filter of vector X. According to the literature [3], this filter is:

  therefore,

  In practical applications, in order to reduce the calculation error caused by the time delay caused by the sequential sampling of the single chip, the hardware circuit should have a synchronous sampling function. Its function is to keep all electrical signals separately at the sampling moment.

  2 Relationship of instantaneous phasors in digital filters

  If ua, ub, uc are used to represent the three-phase voltage phasors, Ua, Ub, Uc are used to represent their effective values, and the initial phase angles are θua, θub, θuc respectively; ia, ib, ic are used to represent the three-phase current phasors, Ia, Ib, Ic are used to represent their effective values, and the initial phase angles are θia, θib, θic respectively. Then equation (4) is the projection of the corresponding phasor on the X-axis, that is, the real part of the vector; equation (5) is the projection of the phasor on the Y-axis, that is, the imaginary part of the vector. θ1 in equations (4) and (5) is the phase angle of the above phasor relative to the initial moment of the 20ms time window. [page]

  FIG. 1 shows the phase relationship between the A-phase voltage and the A-phase current, and the others are similar.

  The phase relationship of the above phasors is the basis for further phasor operations.

  3 Two-wire power calculation

  At present, the power measurement of high-voltage lines generally adopts three-phase voltage and two sets of current, that is, the two-wire power meter method. The active power and reactive power of the line can be measured using equations (4), (5), (6), (7) and (10). The specific process is as follows:

  The two-wire system assumes that the three-phase current is balanced, that is:

  Among them, uab is the line voltage between phase A and phase B; ucb is the line voltage between phase C and phase B.

  Substituting the results of (6) and (7) into (14), (15) and (13), the active power of the three-phase balanced line can be measured.

  If the input voltage is phase voltage, then:

  After expanding the cosine function in the above formula, substitute the corresponding results of formulas (6) and (7) into it.

  The calculation of reactive power only requires replacing the cosine operation in equations (14), (15) and (16) with the corresponding sine operation.

  4 Optimization measures based on MCU application

  From the current market situation, although the performance of single-chip microcomputers is constantly improving, such as INTEL single-chip microcomputers from 8-bit, 16-bit to 32-bit, the products with the best performance are not really widely adopted. From the perspective of practical applications, sometimes we have to face a limited objective reality. For this application, the following measures can greatly improve the calculation speed of the program.

  4.1 Convert floating point operations to integer operations

  For equations (4) to (10), using C or PL/M high-level language for floating-point operations is convenient and accurate. However, compared with integer operations, floating-point operations are much slower. Therefore, in order to increase the calculation speed, integer operations should be used as much as possible. From the perspective of engineering practice, the result after A/D conversion is generally a double-byte integer, which can be directly operated with the least squares filter with a 10-bit magnification. Then equation (4) becomes:

  Equations (17) and (18) only have 6 4-byte long integer multiplications and 4 additions. Even for a 12-bit A/D, the calculation results of equations (17) and (18) will not overflow. Since the filter is an integer when it is expanded by 10 times, there is no rounding, so there is no additional error in the calculation process.

  4.2 Fast square root method

  From equations (4) to (10), it can be seen that equation (10) consumes the most time, that is, calculating the square root operation to obtain the peak-to-peak value of the fundamental wave.

  If the square root function provided by the standard floating point library is used directly, the 16MHz 80196KC requires about 3ms. If the integer table lookup method in reference [4] or the binary search method with an accuracy of 1% provided in reference [5] is used, the time required to find the root under the same conditions is generally between 100 and 300μs, and the calculation speed is increased by more than 10 times.

  The least squares filter with four sampling points per cycle proposed in this paper can realize real-time phasor measurement of power frequency signals in general single-chip microcomputers. After further optimization of the algorithm, it can make real-time reflection of multi-channel signals within a time window of one cycle, meeting the technical requirements of general protection. The algorithm can also realize other protection and measurement functions.

    References

   1 Yang Qixun. Fundamentals of Microcomputer Relay Protection. Beijing: Water Conservancy and Electric Power Press

   2 Ding Weidong. Error analysis of the constant least squares filter in real-time processing of power grid AC signals. Shandong Electric Power Technology, 1995; (2)

   3 Ding Weidong. Using the neuron digital interface to realize the identification of AC V/F signal characteristics (The Parallel Port of MC143120 and The Coeff-

   icient Identification of AC V/F Signal). Shandong Electric Power Technology, 1999; (6)

   4 Li Fuying. A new fast and accurate square root algorithm and program design. Electronic Technology Application, 1999; 25 (3)

   5 Huazhong University of Science and Technology. Engineering Mathematics·Algorithmic Language·Computational Methods. Beijing: Higher Education Press

   6 ROM datasheet http://www.dzsc.com/datasheet/ROM_1188413.html.

Keywords:MCU Reference address:Research on Vector Measurement and Power Calculation of Least Square Filter in Single Chip Microcomputer

Previous article:Analysis of Bit Synchronization Extraction in Digital Communication Systems Based on Single Chip Microcomputer
Next article:Introduction to Practical and Fast Division of MCU Floating Point Numbers

Recommended ReadingLatest update time:2024-11-16 15:39

Small RTOS51 realizes the design of temperature controller based on 8-bit microcontroller
At present, 8-bit single-chip microcomputers still occupy an important position in the field of measurement and control and the application of intelligent electronic products. The application of embedded real-time operating system (ERTOS) will greatly facilitate the software development of 8-bit single-chip microcomput
[Microcontroller]
DTMF Signal Decoding Using AT89S52 Single Chip Microcomputer
DTMF signals were first used in telephone dialing systems, and are also widely used in frequency-coded remote control systems and data coding transmission. Most of the current DTMF decoders use general-purpose integrated devices (single-tone decoding circuits and combinational gate circuits) or special DTMF signal d
[Microcontroller]
DTMF Signal Decoding Using AT89S52 Single Chip Microcomputer
What does the MCU do before running to main()?
Many ARM engineers take it for granted that when they download and debug their own applications using the AK100Pro emulator, the MCU's PC pointer must stay at the entry of the main() function. But in fact, the MCU does a lot of things before running to main(). Here is an example of a Keil project for LPC1700. After
[Microcontroller]
Detailed explanation of the microcontroller timer interrupt principle and C language code
I used ARM7 before, and I don't know much about single-chip microcomputers. But a project needs to use 51, so I tried to use 51 but still feel a little confused. After adjusting this code today, I have some experience with 51 timer interrupts, and I would like to share it with you. No more nonsense, here is the code.
[Microcontroller]
Remote medical monitoring system based on single chip microcomputer and FPGA
1. Design Purpose   With the rapid development of electronic information, remote medical monitoring technology has gradually become a hot topic in the medical field in recent years. Remote monitoring of important life parameters has brought convenience to the elderly and infirm, and has also made great contributions
[Analog Electronics]
Remote medical monitoring system based on single chip microcomputer and FPGA
STC89C52 series MCU internal resources - interrupt system
Interrupts are set up to enable the microcontroller to process random external or internal events in real time. The existence of the interrupt function greatly improves the microcontroller's ability to handle external or internal events. It is also one of the most important functions of the microcontroller, and we mus
[Microcontroller]
STC89C52 series MCU internal resources - interrupt system
MCS-51 MCU timer/counter concept very good register relationship diagram
1. Concept of timer/counter of MCS-51 microcontroller The timer and counter in the microcontroller are actually the same physical electronic component, but the counter records what happens outside the microcontroller (receives external pulses), while the timer is a very stable counter provided by the microcontroller
[Microcontroller]
MCS-51 MCU timer/counter concept very good register relationship diagram
Design of automatic horn tone player based on AT89C51 microcontroller
1 Introduction The daily routine of institutions and colleges requires timing and beep prompts. The author uses AT89C51 microcontroller and LM386 audio power amplifier to form an automatic timing and beep player. It is low cost, effective and worthy of promotion. 2 Main features and pin functions of AT89C51 AT89
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号