Summary of the invention
The objective of the invention is to propose a kind of hilbert filter that is used for electric energy metrical, utilize the every function of very lagre scale integrated circuit (VLSIC) Hilbert (Hilbert) filter, the silicon area that hilbert filter is taken is little, to reduce the silicon chip cost of Hilbert (Hilbert) filter.
The hilbert filter that is used for electric energy metrical that the present invention proposes comprises:
The input port selector is used to receive electric current and voltage signal from electrical network, and will walk abreast the input electric current and voltage signal data flow be converted to serial data stream, described input port selector is connected with data selector;
Data selector is used for the control timing according to controller, to selecting from the serial electric current of input port selector and voltage signal and from the multiplication accumulation result of parallel multiplication, selection result is input in the memory;
Address generator is used for according to controller decoding generation memory read/write operation address;
Controller, be used for calculating sequential according to each second order joint of hilbert filter, produce the control timing of data selector, address generator, input port selector, output port selector, parallel multiplication and coefficient generator respectively, described controller is connected with coefficient generator with data selector, address generator, input port selector, output port selector, parallel multiplication respectively;
Memory is used to store the intermediate data that hilbert filter calculates;
Output port selector is used for the electric current and the voltage signal of reception memorizer output, and electric current and the voltage signal that receives is converted into parallel electric current and the back output of voltage data stream;
Parallel multiplication is used for that the data of memory output are carried out multiplication and adds up and obtain the multiplication accumulation result after the operation, and exports accumulation result to data selector, and parallel multiplication is connected with coefficient generator with memory respectively;
Coefficient generator is used for the coefficient according to each second order joint of the timing sequence generating filter of controller, and exports this coefficient to parallel multiplication.
Parallel multiplication in the above-mentioned filter comprises:
Multiplier is used to receive the data input of described memory and the filter coefficient that described coefficient generator produces, and obtains product signal after it is multiplied each other, and multiplier is connected with adder;
Adder is used for the data of register and the product signal of above-mentioned multiplier output are added up the output cumulative signal;
Register is used for the cumulative signal of above-mentioned adder output is deposited, and for the accumulation calculating of adder next time provides input, register is connected with adder.
Address generator in the above-mentioned filter comprises:
The sampled point counter is used for the sampling number that calculating filter calculates;
Adder is used for the value addition with the control signal of the value of sample counter and controller input, produces the memory read/write operation address, and adder is connected with described memory with described controller respectively.
Controller in the above-mentioned filter comprises:
Cycle counter is used for the counting step that filter is carried out is counted, and cycle counter is connected with decoder;
Decoder is decoded as control signal to described input port selector, data selector, address generator, parallel multiplication, coefficient generator with the output of cycle counter.
The hilbert filter that is used for electric energy metrical that the present invention proposes, its advantage is: the silicon area of use is less, has therefore reduced the cost that Hilbert (Hilbert) filter adopts very lagre scale integrated circuit (VLSIC) to realize.Filter is less to the access times of memory when handling a sampled point, has therefore improved the throughput of data.
Embodiment
The hilbert filter that is used for electric energy metrical that the present invention proposes, its structured flowchart comprises as shown in Figure 1:
The input port selector is used to receive electric current and voltage signal from electrical network, and will walk abreast the input electric current and voltage signal data flow be converted to serial data stream, described input port selector is connected with data selector;
Data selector is used for the control timing according to controller, to selecting from the serial electric current of input port selector and voltage signal and from the multiplication accumulation result of parallel multiplication, selection result is input in the memory;
Address generator is used for according to controller decoding generation memory read/write operation address;
Controller, be used for calculating sequential according to each second order joint of hilbert filter, produce the control timing of data selector, address generator, input port selector, output port selector, parallel multiplication and coefficient generator respectively, described controller is connected with coefficient generator with data selector, address generator, input port selector, output port selector, parallel multiplication respectively;
Memory is used to store the intermediate data that hilbert filter calculates;
Output port selector is used for the electric current and the voltage signal of reception memorizer output, and electric current and the voltage signal that receives is converted into parallel electric current and the back output of voltage data stream;
Parallel multiplication is used for that the data of memory output are carried out multiplication and adds up and obtain the multiplication accumulation result after the operation, and exports accumulation result to data selector, and parallel multiplication is connected with coefficient generator with memory respectively;
Coefficient generator is used for the coefficient according to each second order joint of the timing sequence generating filter of controller, and exports this coefficient to parallel multiplication.
Below in conjunction with accompanying drawing, introduce content of the present invention in detail:
The filter as shown in Figure 1 that the present invention proposes, input port selector wherein is used to receive electric current and voltage signal from electrical network, and the electric current and the voltage signal data flow of the input that will walk abreast are converted to serial data stream.
Output port selector wherein is used for the electric current and the voltage signal of reception memorizer output, and electric current and the voltage signal that receives is converted into parallel electric current and the back output of voltage data stream.
Data selector wherein is used for the control timing according to controller, to selecting from the serial electric current of input port selector and voltage signal and from the multiplication accumulation result of parallel multiplication, selection result is input in the memory.
Parallel multiplication wherein is used for that the data of memory output are carried out multiplication and adds up and obtain the multiplication accumulation result after the operation, and exports accumulation result to data selector.The structure of parallel multiplication comprises as shown in Figure 2: multiplier, be used to receive the data input of described memory and the filter coefficient that described coefficient generator produces, and after being multiplied each other, it obtains product signal, and multiplier is connected with adder; Adder is used for the data of register and the product signal of above-mentioned multiplier output are added up the output cumulative signal; Register is used for the cumulative signal of above-mentioned adder output is deposited, and for the accumulation calculating of adder next time provides input, register is connected with adder.The calculating of a second order joint in finishing filter, when beginning a second order joint calculating, the parallel multiplication zero clearing is from the data of memory output and the multiplication of coefficient generator generation, the product accumulation that same second order joint produces adds up and sends back in the memory.The following y of the method for accumulator computes (n)=a
0X (n)+a
1X (n-1)+a
2X (n-2)-b
1Y (n-1)-b
2Y (n-2), a
0, a
1, a
2, b
1, b
2Coefficient for the second order joint.X (n), x (n-1), x (n-2) are the input data of continuous 3 sampled points.Y (n), y (n-1), y (n-2) are the input data of continuous 3 sampled points.
Address generator wherein is used for according to controller decoding generation memory read/write operation address.Address generator is made of sampled point counter and adder.Its structure comprises as shown in Figure 3: the sampled point counter is used for the sampling number that calculating filter calculates; Adder is used for the value addition with the control signal of the value of sample counter and controller input, produces the memory read/write operation address, and adder is connected with described memory with described controller respectively.The sampled point counter is used for the sampling number that calculating filter calculates.Adder is used for the value addition with the control signal of the value of sample counter and controller input, produces the memory read/write operation address.For same filter, sampled point of every processing, processing method according to routine, carry out the lot of data move operation, adopt sampled point counter accumulative total 1, replace the memory cell mileage, reduced number of times memory access according to the operation of moving, reduce power consumption, improved the speed of system works.Control signal is imported by controller, and the second order address offset that joint calculates is provided.If in memory, the storage order of data is according to x (n), x (n-1), and x (n-2), y (n-1), y (n-2) arranges.Sampling number of the every processing of filter, the sampled point counter subtracts 1., address offset be x (n): 0, x (n-1): 1, x (n-2): 2, y (n-1): 3, y (n-2): 4, y (n): 2.If in memory, the storage order of data is according to y (n-2), y (n-1), and x (n-2), x (n-1), x (n) arranges sampling number of the every processing of filter, and the sampled point counter adds 1., address offset be x (n): 4, x (n-1): 3, x (n-2): 2, y (n-1): 1, y (n-2): 0, y (n): 2., x (n-2) is identical with y (n) address, and second order joint result calculated y (n) covers the data x (n-2) that is rejected in the filtering calculating, saves the quantity of memory cell.
Coefficient generator wherein is used to produce the coefficient of each second order joint of filter.Decomposition obtains the coefficient of coefficient generator to Hilbert (Hilbert) filter.Adopt IIR (IIR filter) digital filter to realize Hilbert (Hilbert) filter of high-order, than adopting FIR (finite impulse response filter) digital filter to compare, implementation complexity is little.The method that adopts the second order joint to decompose is decomposed the structure of iir filter, and this processing method realizes comparing with direct iir filter, has improved stability of filter, has reduced quantizing noise.The coefficient of second order joint is packed in the described coefficient generator, finish the calculating of second order joint by the very lagre scale integrated circuit (VLSIC) implement device of described Hilbert (Hilbert) filter.
Controller wherein, its structure comprises as shown in Figure 4: cycle counter, be used for the counting step that filter is carried out is counted, cycle counter is connected with decoder; Decoder is decoded as control signal to described input port selector, data selector, address generator, parallel multiplication, coefficient generator with the output of cycle counter.Controller is used for the calculating sequential according to each second order joint of hilbert filter, produces the control timing of data selector, address generator, input port selector, output port selector, parallel multiplication and coefficient generator respectively.Controller has cycle counter, and decoder two parts constitute.Cycle counter is used for the counting step that filter is carried out is counted, cycle counter zero clearing after the data processing of a sampled point finishes.Decoder is decoded as control signal to described input port selector, data selector, address generator, parallel multiplication, coefficient generator with the output of cycle counter.Decoder can be realized by Digital Logical Circuits, also can adopt read-only memory to realize.
The data generating principle of above-mentioned controller is as shown in Figure 5:
The first step, the switch data selector is written to the electric current of input port input and voltage data and obtains x in the memory
1(n).
Second step sent reset signal to parallel multiplication, began the calculating of the 1st second order joint.
In the 3rd step, read memory x in order
1(n), x
1(n-1), x
1(n-2), y
1(n-1), y
1(n-2), be sent to the parallel multiplication data input pin successively.When the parallel multiplication data were imported in proper order, coefficient generator produced the coefficient a of corresponding first second order joint
10, a
11, a
12,-b
11,-b
12Be sent to the filter coefficient of parallel multiplication successively.
The 4th step is by the output y as a result that obtains of five multiply operations and the operation that adds up for four times
1(n)=a
10x
1(n)+a
11x
1(n-1)+a
12x
1(n-2)-b
11y
1(n-1)-b
12y
1(n-2), this result writes back in the memory, covers x
1(n-2) position.A second order joint calculation process illustrates in Fig. 5.
The 5th step sent reset signal to parallel multiplication, began the calculating of the 2nd second order joint.Identical with first second order joint calculation process, at last the result is write back in the register.The input of the 2nd second order joint is exactly the output of the 1st second order joint, x
2(n)=y
1(n), x
2(n-1)=y
1(n-1), x
2(n-2)=y
1(n-2).
In the 6th step, finish the calculating of whole second order joints according to the method in the 5th step.
In the 7th step, the result that last second order is saved is converted into parallel data output by output port.
Enumerate the design process that a device that is used for the three-phase electric energy reactive measurement illustrates the very lagre scale integrated circuit (VLSIC) implement device of Hilbert (Hilbert) filter below;
Shown in Figure 6 is Hilbert (Hilbert) the algorithm filter figure of three-phase electric energy reactive measurement device, A, and B, the every voltage and current of C three-phase enters the bank of filters of a pair of Hilbert (Hilbert) filter respectively.Fig. 7 is the bank of filters of a pair of Hilbert (Hilbert) filter, the bank of filters of a pair of Hilbert (Hilbert) filter is made of two iir filters, the differential seat angle to electric current and voltage phase shift in the bandwidth range of design is 90 degree to electric current and voltage for two iir filters, gains to be constant 1.The document IIRDiscrete-Time Hilbert Transformers that the method for designing of this bank of filters can be delivered referring to RASHD ANSARI (adopting the method for IIR filter design hilbert filter), as shown in Figure 7.
Iir filter can be decomposed into second order assistant warden connection and form, and as shown in Figure 8, is convenient to implement of hardware system.
Each second order joint has the computation structure of standard, and as shown in Figure 9, the calculating formula of a basic second order joint is y (n)=a
0X (n)+a
1X (n-1)+a
2X (n-2)-b
1Y (n-1)-b
2Y (n-2), a
0, a
1, a
2, b
1, b
2Be the coefficient of second order joint, x (n), x (n-1), x (n-2) they are the input data of continuous 3 sampled points, y (n), y (n-1), y (n-2) they are the input data of continuous 3 sampled points.
Each basic second order joint can be finished by multiply-accumulator, when second order joint of every beginning calculates, and the accumulator zero clearing.Among Fig. 5 data according to illustrated sequence arrangement in memory, calculating formula according to the second order joint calculates y (n), then y (n) is as a result directly covered x (n-2), y (n) provides input for the calculating of next second order joint, and x (n-2) data can not calculated by next step again and use.First second order joint is mended into new sampled value x (n+1) by input unit in the position that the earlier data of x (n) is upgraded, and has formed new data sequence, calculates the second order joint next time and can continue this sequence is carried out iteration.The storage operation address moves forward a sampled point.The formation of storage operation address as shown in Figure 3, by the results added of sampled point counter and control signal, sampled point counter of every processing just subtracts 1, and the storage operation address just constantly before pushes away like this, replace common shifting function in the Design of Filter, reduced visit memory.System has only adopted 1 multiply-accumulator, and has simple data path, can realize Hilbert (Hilbert) filter under less silicon area.