Alternating current distortion coefficient detection improved algorithm
1. An improved algorithm for detecting AC distortion coefficients is characterized in that: defining the sum of the squared errors of the signal sample values and the fundamental component as a function of the amplitude and phase of the fundamental component:
the fundamental component should minimize this sum of squared errors, and the problem of solving the amplitude phase of the ac fundamental component can be transformed into the following optimization problem:
solving the optimization problem by adopting a simplex descent method, substituting the calculation (A, theta) into a formula (1) and a formula (2), and obtaining a fundamental wave signal value of each sampling pointAnd then calculate each sampling pointThen calculating U by formula (3)JJ。
2. The ac distortion coefficient detection improvement algorithm of claim 1, wherein: the optimization problem is solved by adopting a simplex descent method, and the solving process of calculating (A, theta) comprises the following steps:
1) calculating the initial value A of the amplitude of the AC fundamental wave signal0:
2) Tong (Chinese character of 'tong')Zero crossing method for calculating phase initial value theta of alternating current fundamental wave signal0I.e. finding the first sample point i from the sampled signal0To makeAnd isLet theta0=2πfΔti0;
3) Constructing three initial solutions, each being
The sum of the squares of the total sampling errors is taken as a function E (x) of x, x1、x2、x3Substituting into equation (4), calculating the corresponding error value E (x)1)、E(x2)、E(x3);
4) Selecting E (x)1)、E(x2)、E(x3) The solution corresponding to the maximum value and the solution corresponding to the minimum value are respectively marked as xmaxAnd xminThe remaining one is denoted as xnorm;
Computing centric solutionsxmaxRelative toHas a symmetry point ofWherein t is a real number;
5) let t equal to 1, calculate the symmetry pointAnd errorThe following is to be taken into account in step 5):
a) if it is notThe symmetry point is accepted and x is updated with itmaxI.e. by
b) If it is notLet t equal to 2, calculate the symmetry pointIf it is not Then orderOtherwise make
c) If it is notLet t equal to 0.5, calculate the symmetry pointIf it is notThen orderOtherwise, entering step e;
d) if it is notLet t equal to-0.5, calculate the symmetry pointIf it is notThen orderOtherwise, entering step e;
e) let xmaxAnd xnormTowards xminShrinking, i.e.Namely, it is
6) After completing the calculation and updating of step 5), if E (x)max)-E(xmin)<E, wherein the e is a calculation precision threshold value, stopping iterative calculation, and converting xminThe amplitude A and the phase theta in (1) are used as the solution of the optimization problem (5); otherwise, let x1=xmax,x2=xmax,x3=xnormAnd repeating the step 4);
7) substituting the calculated (A, theta) into formula (1) and formula (2) to obtain fundamental wave signal value of each sampling pointAnd then calculate each sampling pointThen calculating U by formula (3)JJAnd obtaining the alternating current distortion value.
Background
In an ideal situation, the alternating current contains only fundamental components at a fixed frequency, and its waveform should be a sine wave containing only one fixed fundamental frequency. However, in the process of power transmission and power use, electric equipment often introduces higher harmonic components, which causes the waveform of alternating current to change, namely alternating current distortion. The waveform change can reduce the power supply quality and influence the performance index of the electric equipment, so that the national military standard (GJB 181B-2012 and GJB 5189-. The existing standard algorithm for detecting the alternating current distortion is as follows:
sampling the AC signal to be tested according to a set sampling rate, and recording the sampled signal as uiA total of n sample values is obtained.
And on each sampling point, the true value of the alternating current fundamental component signal is as follows:
where Δ t is the sampling time interval, frequency f is a fixed known ac fundamental frequency, a is the ac fundamental component signal amplitude, and θ is the ac fundamental component signal phase. A and θ are unknown and need to be found from the raw sample data.
Calculating the AC distortion value at each sampling point
Calculating distortion value of AC signal
Where T is the total sample time and Δ T is the sample period time.
The core of the detection and calculation precision of the alternating current distortion value lies in accurately obtaining a fundamental component from an original sampling signal so as to accurately calculate a difference value u of each sampling pointJJiSum of alternating current distortion value UJJ. The frequency of the ac fundamental component is fixed and known, but its amplitude and phase are unknown, and need to be calculated from the original sampled signal. In the traditional method, the amplitude is usually calculated in a mean filtering mode and the like, and the phase is calculated through a zero crossing point, so that the calculation error of an alternating current fundamental wave signal is relatively large, and the detection of an alternating current distortion value is influenced.
Disclosure of Invention
The invention aims to solve the problems and provides a fundamental component calculation method based on nonlinear optimization, which can be used for more accurately fitting the amplitude and the phase of a fundamental component from original sampling data.
The invention relates to an improved algorithm for detecting an alternating current distortion coefficient, which is characterized in that: defining the sum of the squared errors of the signal sample values and the fundamental component as a function of the amplitude and phase of the fundamental component:
the fundamental component should minimize this sum of squared errors, and the problem of solving the amplitude phase of the ac fundamental component can be transformed into the following optimization problem:
solving the optimization problem by adopting a simplex descent method, substituting the calculation (A, theta) into a formula (1) and a formula (2), and obtaining a fundamental wave signal value of each sampling pointAnd then calculate each sampling pointThen calculating U by formula (3)JJ。
Further, according to the alternating current distortion coefficient detection improved algorithm, the optimization problem is solved by adopting a simplex descent method, and the solving process of calculating (A, theta) is as follows:
1) calculating the initial value A of the amplitude of the AC fundamental wave signal0:
2) By zero-crossing metersCalculating the initial value theta of the phase of the AC fundamental wave signal0I.e. finding the first sample point i from the sampled signal0To makeAnd isLet theta0=2πfΔti0;
3) Three initial solutions, x respectively, are constructed1=(A0,θ0),x2=(1.01A0,θ0),
The sum of the squares of the total sampling errors is taken as a function E (x) of x, x1、x2、x3Substituting into equation (4), calculating the corresponding error value E (x)1)、E(x2)、E(x3);
4) Selecting E (x)1)、E(x2)、E(x3) The solution corresponding to the maximum value and the solution corresponding to the minimum value are respectively marked as xmaxAnd xminThe remaining one is denoted as xnorm;
Computing centric solutionsxmaxRelative toHas a symmetry point ofWherein t is a real number;
5) let t equal to 1, calculate the symmetry pointAnd error
The following is to be taken into account in step 5):
f) if it is notThe symmetry point is accepted and x is updated with itmaxI.e. by
g) If it is notLet t equal to 2, calculate the symmetry pointIf it is not Then orderOtherwise make
h) If it is notLet t equal to 0.5, calculate the symmetry pointIf it is notThen orderOtherwise, entering step e;
i) if it is notLet t equal to-0.5, calculate the symmetry pointIf it is notThen orderOtherwise, entering step e;
j) let xmaxAnd xnormTowards xminShrinking, i.e.Namely, it is
6) After completing the calculation and updating of step 5), if E (x)max)-E(xmin)<E, wherein the e is a calculation precision threshold value, stopping iterative calculation, and converting xminThe amplitude A and the phase theta in (1) are used as the solution of the optimization problem (5);
otherwise, let x1=xmax,x2=xmax,x3=xnormAnd repeating the step 4);
7) substituting the calculated (A, theta) into formula (1) and formula (2) to obtain fundamental wave signal value of each sampling pointAnd then calculate each sampling pointThen calculated by formula 3)Calculate UJJAnd obtaining the alternating current distortion value.
The alternating current distortion coefficient detection improved algorithm is used for fitting and solving alternating current fundamental wave components from sampling data on the basis of nonlinear optimization, and then an alternating current distortion value is calculated on the basis. Because the fitting method of the alternating current fundamental component based on the nonlinear optimization has higher theoretical calculation precision, the method is an effective improved algorithm for the alternating current distortion value detection calculation method, and can calculate the alternating current distortion value more accurately, thereby improving the alternating current distortion detection accuracy.
Drawings
FIG. 1 is a schematic diagram of a simplex descent process according to the present invention; wherein a is xmaxIs updated tob is xmaxIs updated toc is xmaxIs updated tod is xmaxIs updated toe is xmax,xnormRespectively shrink intoAnd
fig. 2 is a schematic diagram of voltage sampling values according to an embodiment of the present invention.
Detailed Description
The invention discloses an alternating current distortion coefficient detection improved algorithm, which defines the sum of squares of errors of a signal sampling value and a fundamental component as a function of the amplitude and the phase of the fundamental component:
the fundamental component should minimize this sum of squared errors, and the problem of solving the amplitude phase of the ac fundamental component can be transformed into the following optimization problem:
solving the optimization problem by adopting a simplex descent method, wherein the solving process of calculating (A, theta) comprises the following steps:
1) calculating the initial value A of the amplitude of the AC fundamental wave signal0:
2) Calculating an initial value theta of the phase of the alternating-current fundamental wave signal by a zero-crossing method0I.e. finding the first sample point i from the sampled signal0To makeAnd isLet theta0=2πfΔti0;
3) Three initial solutions, x respectively, are constructed1=(A0,θ0),x2=(1.01A0,θ0),
The sum of the squares of the total sampling errors is taken as a function E (x) of x, x1、x2、x3Substituting into equation (4), calculating the corresponding error value E (x)1)、E(x2)、E(x3);
4) Selecting E (x)1)、E(x2)、E(x3) The solution corresponding to the maximum value and the solution corresponding to the minimum value are respectively marked as xmaxAnd xminThe remaining one is denoted as xnorm;
Computing centric solutionsxmaxRelative toHas a symmetry point ofWherein t is a real number;
5) let t equal to 1, calculate the symmetry pointAnd error
The following is to be taken into account in step 5):
k) if it is notThe symmetry point is accepted and x is updated with itmaxI.e. byAs shown in fig. 1 a;
l) ifLet t equal to 2, calculate the symmetry pointIf it is not Then orderAs shown in b of FIG. 1, otherwise, let
m) ifLet t equal to 0.5, calculate the symmetry pointIf it is notThen orderAs shown in c in fig. 1, otherwise, go to step e;
n) ifLet t equal to-0.5, calculate the symmetry pointIf it is notThen orderAs shown in d in fig. 1, otherwise, go to step e;
o) let xmaxAnd xnormTowards xminShrinking, i.e.Namely, it isAs shown in fig. 1 e;
6) after completing the calculation and updating of step 5), if E (x)max)-E(xmin)<E, wherein the e is a calculation precision threshold value, stopping iterative calculation, and converting xminThe amplitude A and the phase theta in (1) are used as the solution of the optimization problem (5);
otherwise, let x1=xmax,x2=xmax,x3=xnormAnd repeating the step 4);
7) substituting the calculated (A, theta) into formula (1) and formula (2) to obtain fundamental wave signal value of each sampling pointAnd then calculate each sampling pointThen calculating U by formula 3)JJAnd obtaining the alternating current distortion value.
In this embodiment, the alternating current to be measured is 400Hz airborne intermediate frequency alternating current, the amplitude is 115V, and white noise between-10V and 10V is superimposed. It is sampled for 1s at a 1MHz sampling rate, and the true phase of the fundamental component is 40 ° during the sampling process. The first two cycles of the ac signal are shown in fig. 2;
the calculation process of the alternating current distortion coefficient detection improved algorithm is as follows:
1) calculating an amplitude and phase initial value: calculating the initial value of the amplitude of the AC fundamental wave as A by the formula (6)0115.28. Calculating the initial value of the phase as theta by searching the first positive zero crossing point0=38.02。
2) Establishing an initial solution simplex: x is the number of1=(115.28,38.02),x2=(116.43,38.02),x3= (115.28,56.02)。
3) Calculate the error of each vertex of the simplex as E (x)1)=4543.55,E(x2)=4602.45, E(x3)=16556.01。
Due to x3With the largest error, the solution is calculated relative to (x)1+x2) Point of symmetry of/2. Let t equal to 1, the symmetry point isError isDue to the fact that Therefore, let t equal to-0.5, calculate the point of symmetry asError isDue to the fact thatAccept the solution, let x3=(115.56,47.02)。
4) Let e be 10-6. Due to E (x)3)-E(x1)>E, and therefore continue the iterative computation until the accuracy requirement is met. For this embodiment, after the iterative computation is finished, the computed amplitude a is 114.984, and the computed phase θ is 39.995, which is close to the true value.
5) The fundamental wave signal value of each sampling point is obtained by substituting (a, θ) ═ 114.984,39.995 into equations (1) and (2)And then calculate each sampling pointThen by the formula(3) Calculate UJJThe result is the ac distortion value of the ac signal in this example, 7.31.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种钳形电流表