Abstract: A least squares filter with four-point sampling per week is provided. Through optimization algorithms such as integer transformation and table lookup root finding, fast measurement of phasors can be achieved in a single-chip microcomputer. The phase relationship of the phasors in the filter is analyzed, and the calculation method of the two-wire power is provided.
Keywords: least squares filter vector microcontroller power
At present, digital electrical measurement and protection devices based on microcontrollers have become the mainstream form. Direct sampling of AC signals has also become a common method. The fast Fourier algorithm is the main algorithm, and the least squares algorithm requires a large amount of calculation. Especially when the processing power of the microcontroller is limited, it is necessary to ensure both real-time performance and calculation speed without careful design and calculation. Program optimization makes it difficult to ensure the unification of the two.
By reducing the number of sampling times, using a fitting filter that filters four sampling points every week, and a set of optimization measures, the calculation speed of this algorithm is greatly improved, and it is capable of real-time measurement of power frequency vectors, so it can be used for overcurrent, rapid interruption, Directional protection and many other aspects. This article analyzes the vector phase relationship in the filter and gives an example of two-wire power calculation based on this. This method has been tested in practical applications.
1 Construction of least square filter
According to the research results in literature [1~3], for each signal, the input voltage function can be expressed as:
P0——DC component value
Pk——The amplitude of the Kth harmonic component K=1,…,N
θk ——The relative starting phase angle of the Kth harmonic K=1,…,N
ω ——Fundamental angular frequency, ω=2πf, f=50Hz
λ ——constant, equal to the DC component attenuation time constant
In general measurement and protection applications, only the fundamental wave component is of concern. To reduce the amount of computation, the number of samples should be minimized. According to the sampling theorem, the number of discrete sampling times for a sine function is at least 3 times per wave. For convenience, the number of sampling times per week is set to 4, that is, the sampling period is 5ms. Then only DC and power frequency components can be included in formula (1). Expand the DC component according to Taylor series and take the first two terms, then equation (1) becomes:
u(t)=P0-P0 λt+P1sin(ωt)cos(θ1)+P1cos(ωt)sin(θ1) (2)
Among them, P0 is the DC component value, P1 is the peak-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. For example, if P0, -P0 λ and P1cos( θ1)P1sin(θ1) are used as unknown variables to be measured, the four sampling equations can be expressed as the following matrix:
X=A -1U (3)
Where A-1 represents the inverse matrix of A, that is, the least square filter of the vector X. According to the literature [3], this filter is:
P1cos( θ1)= ∑A-1[3][I]U[I] I=1,4 (4)
P1sin( θ1)= ∑A-1[4][I]U[I] I=1,4 (5)
cos( θ1)=P1cos(θ1)/P1 (6)
sin(θ1)=P1sin(θ1)/P1 (7)
P0= ∑A-1[1][I]U[I] I=1,4 (8)
P0 λ= ∑A-1[2][I]U[I] I=1,4 (9)
2 Relationship between instantaneous phasors in digital filters
If ua, ub, and uc are used to represent the three-phase voltage phasors respectively, Ua, Ub, and Uc represent their effective values, the initial phase angles are represented by θua , θub , and θuc respectively ; ia, ib, and ic are used to represent the three-phase current phasors respectively. , Ia, Ib, and Ic represent their effective values, and the initial phase angles are θia , θib , and θ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 corresponding phasor on the Y-axis, that is, the imaginary part of the vector, (4) and (5) θ1 in the formula is the phase angle of the above phasor relative to the beginning of the 20ms time window.
Figure 1 shows the phase relationship between phase A voltage and phase A current, and the others are similar.
The phase relationship of the above phasors is the basis for further operations of the phasors.
3 Two-wire power calculation
At present, the power measurement of high-voltage lines generally uses three-phase voltage and two sets of current, that is, the two-wire power meter method. Line active power and reactive power can be measured using equations (4), (5), (6), (7) and (10). The specific process is as follows:
The forward drop of the two-wire system assumes that the three-phase current is balanced, that is:
ia+ib+ic=0 (11)
If there is no B-phase current transformer, then B-phase current:
ib=-(ia+ic) (12)
The active power of the line is:
P=Pa+Pb+Pc=ua×ia+ub×ib+uc×ic
=ua×ia-ub×(ia+ic)+uc×ic
=uab×ia+ucb×ic
=Uab×Ia×cos( θuab-θia)+Ucb×Ic×cos(θucb-θic) (13)
According to the trigonometric function formula:
cos( θuab-θia)=con(θuab)×cos(θia)+sin(θuab)×sin(θia) (14)
cos(θucb-θic)=cos(θucb)×cos(θic)+sin(θucb)×sin(θic) (15)
Among them, uab is the line voltage between phase A and phase B; ucb is the line voltage between phase C and phase B.
Combine the results of equations (6) and (7) with equations (14), (15) and (13) to measure the active power of the three-phase balanced line.
If the input voltage is phase voltage, then:
P=Pa+Pb+Pc=ua×ia+ub×ib+uc×ic
=ua×ia-ub×(ia+ic)+uc×ic
=Ua×Ia×cos( θua-θia)-Ub×Ia×cos(θub-θia)
-Ub×Ic×cos(θub-θic)+Uc×Ic×cos(θuc-θic) (16)
After expanding the cosine function in the above formula, then substitute the corresponding results in formulas (6) and (7) respectively.
The calculation of reactive power only requires changing the cosine operation in equations (14), (15) and (16) to the corresponding sine operation.
4 Optimization measures based on microcontroller applications
Judging from the current market situation, although the performance of microcontrollers is constantly improving, such as INTEL microcontrollers continue to introduce new ones from 8-bit, 16-bit to 32-bit, the products that are truly widely adopted are not the products with the best performance. From a practical application point of view, sometimes a restricted objective reality must be faced. For this application, the calculation speed of the program can be greatly improved by adopting the following measures.
4.1 Convert floating point operations to integer operations
For equations (4) to (10), it is convenient and highly accurate to use C or PL/M high-level language to perform floating-point operations. But compared to integer operations, floating point operations are much slower. Therefore, in order to improve calculation speed, integer operations should be used as much as possible. From an engineering practical point of view, the result after A/D conversion is generally a double-byte integer, which can be directly operated with a 10-bit amplified least squares filter, then equation (4) becomes:
X[3]=5×U[2]-10×U[3]+5×U[4] (17)
(5) The formula becomes:
X[4]=5×U[1]-10×U[2]+5×U[3] (18)
Equations (17) and (18) only have 6 multiplications and 4 additions of 4-byte long integers. Even for 12-bit A/D, the calculation results of equations (17) and (18) will not overflow. Since the filter is an integer when expanded by 10 times, there is no rounding, so there is no additional error in the calculation process.
4.2 Quick square root method
Judging from equations (4) to (10), equation (10) takes the most time, that is, finding the square root operation to obtain the peak-to-peak value of the fundamental wave.
If you directly use the square root function provided by the standard floating point library, the 16MHz 80196KC takes about 3ms. If the integer look-up table method in literature [4] is used, or the bisection method with an accuracy of 1% provided in literature [5], 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 10 times. above.
The least square filter with 4 sampling points per wave proposed in this article can realize real-time phasor measurement of power frequency signals in a general microcontroller. After the algorithm is further optimized, it can reflect multi-channel signals in real time within a cycle time window, meeting the technical requirements of general protection. The algorithm also enables other protection and measurement functions.
Previous article:Low voltage, time adjustable voice recording/playback circuit ISD1810
Next article:Using ISD devices to realize segmented recording and random combination playback of live speech
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 100W24v output board, change to 12V output
- How to copy the files used in the compiler and IDE installation directory to the project folder when creating a new CCS project
- Idle series--DIY an Openmv4R
- 【NUCLEO-L552ZE Review】1. Unboxing
- MicroPython Hands-on (17) - Touch pins on the control board
- Development History and Trends of Passive Radar
- ESP32-S2 development pitfalls (5) -- Using USB-CDC to simulate touch cursor control littlevgl
- [Gizwits Gokit3 Review] +WIFI network configuration data transmission
- 2022 New Year Matter Developer Training Sharing
- [Repost] Types and applications of ESD protection devices