Summary of the invention
The objective of the invention is to propose the digital measuring method of a kind of frequency and phase place, this method also will be based on phase-locked principle design, but wish to overcome the deficiency of the phase-lock technique of above-mentioned traditional survey frequency and phase place, make measuring system can make full use of the information that AC signal wave form varies itself is comprised, the quick lock in measured signal, and rely on signal zero crossing no longer merely and calculate phase place, from improving phase measurement accuracy in essence.In addition, this method will design based on digital signal processing method, control thereby be improved on measuring accuracy and measuring speed and be easy to.At last, this method will help adopting easily the software based on little process chip to be realized.
The frequency that the present invention proposes and the digital measuring method of phase place may further comprise the steps:
1, the ac input signal u (t) that needs survey frequency and phase place is carried out first group of sampling pre-service and second group of sampling pre-service simultaneously, obtain discrete signal u respectively
1(n) and u
2(n).If the upper frequency limit of the tested AC signal u (t) of input is f
Max, lower-frequency limit is f
Min, aforesaid two groups of sampling preprocessing process should be selected identical sample frequency, if sample frequency is made as F
s, F then
sShould be greater than 3f
MaxIn addition, these two groups sampling preprocessing process also should satisfy following condition:
The tested AC signal of supposing input is u (t)=U
mSin (2 π ft+ θ), wherein f is the frequency of this AC signal, and satisfies f
Min<f<f
Max, θ is the initial phase of this AC signal, then u (t) through first group the sampling pre-service after, gained signal u
1(n) should have following form:
And signal u (t) through second group the sampling pre-service after, gained signal u
2(n) should have following form:
Gain function k wherein
1(f), gain function k
2(f), phase shift function #
1(f), phase shift function #
2(f) all be a function relevant, and satisfy following constraint with frequency input signal f:
Following formula is to f
Min<f<f
MaxSet up, and under the situation that satisfies the measuring accuracy requirement, can there be certain error in above-mentioned equation.
2, the discrete digital signal u that above-mentioned the 1st step is obtained
1(n) and u
2(n) be combined into the coordinate (u of the some A in the Cartesian coordinates that initial point is O
2(n), u
1(n)), then thus obtained vector
With the angle of transverse axis positive dirction will be in order to as by phase-locked bit data α
0(n).
3, with above-mentioned the 2nd the step obtain by phase-locked bit data α
0(n) with feed back from output frequency f (n) and handle through integration and following the 7th step phase hit adjustment after pll phase data α ' (n) get poorly, obtain phase error Δ α (n).
4, the phase error Δ α (n) that above-mentioned the 3rd step is obtained handles through loop filtering, thereby obtains the frequency f (n) of measured signal; In the above-mentioned loop filtering processing procedure, its complex frequency domain transfer function H
LP(s) form is:
Make the transport function of measuring process simultaneously
Stable, and make
Has the low-pass filtering performance, H ' cut-off frequecy of passband f (s)
LFLower limit f less than the locked signal frequency
Min
5, the pll phase data α ' that the frequency f (n) of above-mentioned the 4th measured signal that obtains of step and following the 7th step are obtained (n) carries out integration according to following formula and adds up:
Obtain intermediate phase data α
1(n).
6, to above-mentioned the 2nd the step obtain by phase-locked bit data α
0(n) carry out the quadrant transition detection, obtain transition detection data J (n).The judgment threshold constant of this transition detection is made as J
TH, data J
THShould satisfy
Constraint, so transition detection data J (n) with by phase-locked position α
0(n) relation can be according to following formulate:
7, the intermediate phase data α that above-mentioned the 5th step is obtained
1(n) and above-mentioned the 6th transition detection data J (n) addition that obtains of step, promptly α ' (n)=α
1(n)+and J (n), thus obtain in order to be input to pll phase data α ' that above-mentioned the 3rd step handle to constitute phase-locked loop (n).
8, the intermediate phase data α that above-mentioned the 6th step is obtained
1(n) carry out phase compensation and data adjustment and handle, be i.e. α (n)=α
1(n)-θ
1(f (n))+K2 π, wherein, function #
1(f) be first group of phase shift function that the sampling pre-service produces input signal in above-mentioned the 1st step, K is an adjustment coefficient, and its value satisfies the integer of 0≤α (n)<2 π for making α (n), and the data α that obtains at last (n) is exactly the signal phase of required measurement.
The frequency that the present invention proposes and the digital measuring method of phase place, on basic structure, still utilized principle of PLL, Phase Tracking characteristic by feedback control loop, the 4th pacing in the foregoing invention step measures the frequency of signal, measures the current phase place of signal in last the 8th step of foregoing invention step.But the inventive method no longer adopts the preprocess method of zero passage shaping to input signal, but directly AC signal is sampled, and obtains two signal u of 90 ° of phase phasic differences by two groups of pre-service
1(n) and u
2(n), calculate by phase-locked bit data α based on these two signal magnitude then
0(n).Like this, can make full use of the phase information that signal waveform itself comprises, and can upgrade by phase-locked bit data, thereby improve the analysis precision that phase place is differentiated, also can improve the speed of phase locked track simultaneously, reduce Measuring Time according to sample rate.In addition, the phase place of the inventive method differentiates that link is by to by phase-locked position α
0(n) and pll phase α ' (n) get that poor mode obtains.So when basicly stable, pll phase can approach by phase-locked position with the zero-mean deviation when phase-locked, this has just fundamentally overcome and has calculated phase place according to zero crossing merely, seriously is subjected to the deficiency of noise, makes phase measurement accuracy improve greatly.Should also be noted that the inventive method at last in the 1st step the treatment step to signal sampling, other processing links can adopt the software mode design to realize.Speed, precision and the stability of controlling whole measuring process by adjustment design parameter and data precision are to be relatively easy to, and can realize this measuring process based on various little process chip easily.
Specific implementation method
First embodiment of the digital measuring method of frequency of the present invention and phase place is used for the ac voltage signal about 50Hz is carried out the measurement of frequency and phase place, and the theory diagram of its realization as shown in Figure 2.Concrete treatment step is as follows:
1, to need survey frequency and phase place, the AC signal u (t) of frequency in 45~65Hz scope, at first with sample frequency F
s=1000Hz carries out analog to digital conversion to signal u (t), and further discrete data is carried out first group of phase-shift filtering F1 and handle, and obtains signal u
1(n), thus finish first group the sampling pre-service; With same sample frequency F
s=1000Hz carries out analog to digital conversion to signal u (t), and further discrete data is carried out second group of phase-shift filtering F2 and handle, and obtains signal u
2(n), thus finish second group the sampling pre-service.
Above-mentioned first group of low-pass digital filter that phase-shift filtering F1 is an infinite-duration impulse response IIR type, its frequency domain transport property H
F1(e
J ω) have a following form:
Concrete coefficient is as follows:
B1=[-0.081603248,-0.6662151,2.0287446,-1.3020016]
A1=[1.3020016,-2.0287446,0.6662151,0.081603248]
According to the digital filtering design theory as can be known, digital filtering F1 is a cause and effect, promptly is attainable.And further analyze as can be known that this Filtering Processing is stable.
Above-mentioned second group of low-pass digital filter that phase-shift filtering F2 also is an infinite-duration impulse response IIR type, its frequency domain transport property H
F2(e
J ω) have a following form:
Concrete coefficient is as follows:
B2=[-0.37078953,1.2327431,-0.94007795]
A2=[0.94007795,-1.2327431,0.37078953]
According to the digital filtering design theory as can be known, digital filtering F2 also is a cause and effect, promptly is attainable.And further analyze as can be known that this Filtering Processing is stable.
These two groups of digital filterings amplitude gain in 45~65Hz scope all is 1, and its phase-shift characterisitc differs 90 °.If have sinusoidal ac signal u (t)=sin that an amplitude is 1, frequency is 50Hz (2 π * 50 * t) (volt), to u (t) according to sampling rate F
sThe signal that=1000Hz carries out after the analog to digital conversion is u (n), through obtaining output signal u after aforementioned first group of sampling pre-service
1(n), simultaneously through obtaining output signal u after aforementioned second group of sampling pre-service
2(n), u (n), the u in the 100th to 150 sampled point scope then
1(n) and u
2(n) actual waveform curve as shown in Figure 3, wherein u (n), u
1(n) and u
2(n) u, u1 and u2 in the curve difference corresponding diagram 3.As can be seen from the figure, u on phase relation
2(n) the just in time leading u of signal
1(n) signal is 90 °.
2, the discrete digital signal u that above-mentioned the 1st step is obtained
1(n) and u
2(n) be combined as the coordinate (u of the some A in the Cartesian coordinates that initial point is O
2(n), u
1(n)), then thus obtained vector
With the angle of transverse axis positive dirction will be in order to as by phase-locked bit data α
0(n).Get among the embodiment-π≤α
0(n)<and π, then this processing procedure also can be calculated according to following formula:
3, with above-mentioned the 2nd the step obtain by phase-locked bit data α
0(n) with feed back from output frequency f (n) and handle through integration and the phase hit adjustment in following the 7th step after the pll phase data α ' that obtains (n) get poorly, obtain phase error Δ α (n), computing formula is:
Δα(n)=α
0(n)-α′(n)
4, the Δ α (n) that above-mentioned the 3rd step is obtained handles through loop filtering, obtains the frequency f (n) of locked signal.Can realize this loop filtering processing with reference to the theory structure of Fig. 4.Detailed process is: phase error Δ α (n) obtains y through after the integral element
1(n); Simultaneously, phase error Δ α (n) also obtains y through the proportional delay link
2(n); To y
1(n) and y
2(n) sue for peace and obtain y (n), be i.e. y (n)=y
1(n)+y
2(n); Y (n) needing to obtain the signal frequency f (n) of measurement again through first order inertial loop.
Wherein, the computing formula of integral element is:
y
1(n)=y
1(n-1)+0.0362666 Δ α (n) thus, the complex frequency domain transport function form of integral element can approximate expression be:
The computing formula of proportional delay link is:
y
2(n)=0.804868y
2(n-1)+0.708540 the complex frequency domain transport function of Δ α (n) proportional delay link is approximately:
The computing formula of inertial element is:
The complex frequency domain transport function formal approximation of f (n)=0.932642f (n-1)+0.067358y (n) inertial element is:
So, the complex frequency domain transfer function H of whole loop filtering processing section
LP(s) form is:
So, have:
The transport property of the phase-locked system that calculates thus, is:
Four limits of H (s) are successively :-251.334 ,-25.1324 and-19.1008 ± j16.3345.According to control theory as can be known, this phase-locked system H (s) is stable.So, transfer function H ' (s) be:
H ' amplitude-versus-frequency curve (s) as shown in Figure 5, its horizontal ordinate is a logarithmic coordinate system.By H ' amplitude versus frequency characte (s) as seen, H ' (s) has a low-frequency filter characteristics, greater than H ' amplitude versus frequency characte (s) after the 20Hz just drop to-below the 35dB.
5, the pll phase data α ' that the frequency f (n) of above-mentioned the 4th measured signal that obtains of step and following the 7th step are obtained (n) carries out integration according to following formula and adds up:
α
1(n)=α ' (n-1)+0.002 π f (n) obtain intermediate phase data α
1(n).
6, to above-mentioned the 2nd the step obtain by phase-locked bit data α
0(n) carry out the quadrant transition detection, obtain transition detection data J (n).The judgment threshold constant of setting transition detection is J
TH=4, because f
MaxSo=65Hz is data J
THSatisfy
The computing formula of transition detection data J (n) is:
7, the intermediate phase data α that above-mentioned the 5th step is obtained
1(n) and above-mentioned the 6th transition detection data J (n) addition that obtains of step, promptly α ' (n)=α
1(n)+and J (n), thus obtain in order to be input to pll phase data α ' that above-mentioned the 3rd step constitutes phase-locked loop (n).
8, the intermediate phase data α that above-mentioned the 6th step is obtained
1(n) carrying out phase compensation and data adjustment handles.In above-mentioned the 1st step, first group of sampling pre-service can be calculated (unit: radian) with following approximate formula to the phase shift function that input signal produces
θ
1(f)=0.822384-0.0574974·f+0.000256414·f
2
(45≤f≤65) so, the tested phase place of output (unit: radian) be:
α (n)=α
1(n)-θ
1(f (n))+K2 π wherein, K is one and adjusts coefficient that its value satisfies the integer of 0≤α (n)<2 π for making α (n).
Adopt first embodiment of the invention one input signal to be carried out the measurement of frequency and phase place.Input signal was that a frequency is that 50Hz, fundamental voltage amplitude are 1 volt sinusoidal ac signal u (t) in 0~1 second, and after one second, the frequency hopping of this input signal is to 55Hz, and its fundamental voltage amplitude still is 1 volt.In addition, this signal includes 2~20 times harmonic wave and noise all the time in 0~2 second, and the amplitude of second harmonic reaches 0.2 volt.The embodiment of the invention to the frequency-tracking curve of input signal as shown in Figure 6, locked through 0.4 second temporal frequency in 0~2 second substantially.After the locking, the frequency data f (n) of output still has certain fluctuation, and this is because harmonic wave and caused by noise.But by the amplitude that fluctuates as seen: this measuring system has had stronger inhibiting effect to harmonic wave and noise.In addition, Fig. 7 has provided the Phase Tracking curve of embodiment in 0~0.4 second time period; Fig. 8 has provided the Phase Tracking curve of embodiment in 1~1.4 second time period.
Second embodiment of the digital measuring method of frequency of the present invention and phase place is used for measuring the frequency and the phase place of A phase voltage signal at three phase network.
The A phase voltage of supposing three phase network is:
u
A(t)=U
mSin (2 π ft+ ) wherein is the initial phase of A phase voltage.Then the voltage of B phase, C phase is respectively:
u
B(t)=U
msin(2πft-120°+)
u
C(t)=U
mSin (2 π ft+120 °+) CB line voltage is:
u
CB(t)=u
C(t)-u
B(t)
As seen, CB line voltage signal u
CB(t) leading A phase voltage signal u
A(t) phase place is 90 °.
Go on foot in the processing in the 1st of second embodiment of the invention, at first A phase voltage u importing
A(t) with frequency F
s=1000Hz samples, and directly obtains first group of sampling pre-service output:
Second group of sampling pre-service then utilized the phase-shift characterisitc of electrical network to three-phase voltage itself.Concrete steps are: at first to C phase, the B line voltage between mutually according to frequency F
s=1000Hz samples, and obtains signal u
CB(n), calculate according to following formula then:
The 2nd~7 step subsequently is identical with first embodiment, repeats no more.In the 8th step of second embodiment, the phase shift function of being got is θ
1(f)=0, then according to formula α (n)=α
1(n)-θ
1(f (n))+K2 π calculates the phase place of the A phase voltage signal of being surveyed.By frequency and the phase place of measuring the A phase voltage, also just can further obtain mains frequency and B, C phase place mutually.