A Real-Time Smart Sensor for High-Resolution Frequency Estimation in Power Systems

Power quality monitoring is a theme in vogue and accurate frequency measurement of the power line is a major issue. This problem is particularly relevant for power generating systems since the generated signal must comply with restrictive standards. The novelty of this work is the development of a smart sensor for real-time high-resolution frequency measurement in accordance with international standards for power quality monitoring. The proposed smart sensor utilizes commercially available current clamp, hall-effect sensor or resistor as primary sensor. The signal processing is carried out through the chirp z-transform. Simulations and experimental results show the efficiency of the proposed smart sensor.

complexities in these methodologies difficult the real time and online frequency estimation in power systems, compromising the compliance of international standards. From the exposed above, it is evident the necessity for a frequency estimation methodology that combines real-time processing with high-resolution results. A promising approach to overcome the needs on performance and cost is the smart sensor, which utilizes a standard sensor and includes in its functionalities signal processing, communication, and integration capabilities. The term "smart sensor" is employed according to the functionality classification given by Rivera et al. [14], from the definitions of the Institute of Electrical and Electronics Engineers [15,16].
The novelty of this work is the development of a smart sensor for real-time high-resolution frequency measurement, in accordance with the international standard CEI/IEC 61000-4-30 [2] for power quality monitoring. The proposed smart sensor can utilize a commercially available current clamp, a hall-effect sensor or a resistor as primary sensor of the signal in which the frequency measurement is to be performed. Besides, the CZT that computes the power spectrum of the analyzed signal for the high-resolution frequency estimation is implemented into a low-cost field-programmable gate array (FPGA) with a processing time of 1.0078 s and readouts every 2 s. The CZT implemented algorithm is performed in the real domain, contrary to [12], to achieve the desired processing time. Several cases of study, including simulations and experimental results, are presented to show the effectiveness and performance of the proposed smart sensor. Figure 1 shows the block diagram of the proposed smart sensor for frequency monitoring. The system uses a standard primary sensor (current clamp, hall-effect sensor or resistor) to measure the signal under analysis. Signal conditioning is then applied. Afterwards, the sensed signal is converted to digital in the analog-to-digital converter (ADC). The quantized information is then processed utilizing the CZT for obtaining a high-resolution frequency spectrum. Finally, the resulting spectrum is analyzed in order to determine the component with the highest magnitude that provides the signal frequency with the required resolution for meeting the standard demands.

Chirp-Z Transform
The CZT X(k) of an N-point sequence x(n) for n = 0, 1, 2, …, N-1 is given by Equation (1). In Equation (1), X(k) allows computing the frequency contents of x(n), sampled at a frequency rate of f s , at a dense set of L frequencies in the range covered by the arc of the unit circle that begins at  0 = 2 f 0 and ends at  1 = 2 f 1 [17]: In Equation (1) the transformation kernel kn L Z is given by (2).
The transformation kernel kn L Z can be implemented as two discrete recursive functions described by Equations (3) and (4) for its real Z R and imaginary Z I components, respectively:

Power Spectrum Analysis
The power spectrum of the CZT X(k) is given by (5): From Equation (5), the minimum value of [X(k)] 2 at which the CZT converges, on the highresolution power spectrum, corresponds to the main frequency component of the discrete signal x(n).
The frequency resolution  f of the CZT power spectrum depends on the length of the analyzed unit circle arc, and the number of frequency elements covered in this length L, as given in Equation (6):

CZT Computation Unit
The operational architecture for the CZT computation unit of the proposed smart sensor is depicted in Figure 2. The transformation kernel block provides the real and imaginary components Z R and Z I of kn L Z implementing the recursive functions in Equations (3) and (4), respectively. The power spectrum magnitude [X(k)] 2 is obtained by adding the squared accumulation of Z R and Z I times the discrete input signal x(n). Finally, a magnitude comparison is carried out in order to identify the signal frequency with high resolution. The structure in Figure 2 for the CZT computation utilizes basic operations like addition, multiplications, and accumulations that provide an efficient architecture for hardware implementation.

Computational Complexity Comparison between CZT, FFT, and Zoom-FFT
In order to find an optimal algorithm that meets the international standard for frequency measurement [2], a computational complexity comparison between CZT, FFT, and Zoom-FFT, based on the number of operations, is developed in this section. The number of operations Op FFT for computing the FFT is given by Equation (7) [17]; whereas for computing the Zoom-FFT the number of operations Op ZFFT is given by Equation (8) [18]; finally the CZT requires Op CZT operations, as given by Equation (9) [17]. N is the data length for all algorithms, and L is the length of the interest region for the Zoom-FFT and the CZT: Table 1 summarizes the computational complexity and acquisition time T acq required for complying international standard of frequency measurement with a resolution of  f = 0.01 Hz. The resolution  f for the FFT and the Zoom-FFT is given by Equation (10) with a sampling rate set to f s = 655.36 Hz; whereas the resolution for the CZT is given by Equations (2) and (6) with a sampling rate set to f s = 512 Hz in order to meet the standard.
From Table 1 it can be seen that the CZT requires less operations for computation than FFT and Zoom-FFT, but the most restricting parameter is the acquisition time that according to the standard is 10 s. which is only met by CZT.

Simulation Results
The performance of the proposed smart sensor for real-time high-resolution frequency measurement is tested in this section. The simulation accuracy tests consist in feeding an artificially generated waveform into the proposed smart sensor for confirming its performance and compliance of the international standard CEI/IEC 61000-4-30 [2]. The tests carried out detect the frequency in high resolution of: a pure periodic signal, a periodic signal plus white noise, a main periodic signal with harmonic contamination, and a main periodic signal with harmonic contamination plus white noise.

Pure periodic signal
The analyzed pure periodic signal is described in Equation (11), with normalized amplitude, and frequency f = 60 Hz, as shown in Figure 3a. Analyzing the artificially generated pure periodic signal and utilizing the proposed smart sensor for high-resolution frequency estimation, the CZT power spectrum in Figure 3b is obtained, giving the frequency estimation result of 60.0000 Hz for x(t):

Periodic Signal with White-Noise Contamination
The periodic signal contaminated with white noise is described in Equation (12). The amplitude of the periodic signal is normalized, and it has a frequency f = 60 Hz, whereas three cases of severe white noise n(t) contamination are considered. The first case considers a normalized periodic signal with white noise contamination at 10% of its amplitude for a SNR = 17.0 dB, as shown in Figure 4a. The second case, shown in Figure 4b, analyzes a normalized periodic signal with white noise contamination at 20% of the signal amplitude for a SNR = 11.0 dB. Finally, the third case considers a white noise contamination at 30% of the periodic signal amplitude for a SNR = 7.4 dB, presented in Figure 4c. Table 2 shows the obtained result from the proposed smart-sensor frequency estimation for 40 runs of the periodic signal with added white noise.

Periodic Signal plus Harmonic Contamination
The harmonic contamination of the periodic signal is described in Equation (13). Three different cases of harmonic contamination are treated. The first case considers a periodic signal contaminated with its 2 nd harmonic, as depicted in Figure 5a. The second case analyzes the periodic signal plus its 3 rd harmonic, as shown in Figure 5b. The last case considers the contamination of the periodic signal with its 3 rd + 5 th harmonics, as presented in Figure 5c. The amplitude of the periodic signal is normalized and has a frequency f = 60 Hz, whereas the harmonic signals h(t) added to the periodic signal have an amplitude of 10% of the main periodic signal amplitude for a signal-to-harmonic ratio SHR = 20.0 dB. Table 3 shows the obtained result from the proposed smart-sensor frequency estimation for 40 runs of a periodic signal with harmonic contamination.

Periodic Signal plus White Noise and Harmonic Contamination
The white noise n(t) and harmonic h(t) contamination of a periodic signal is described in (14), where the amplitude of the periodic signal is normalized, and has a frequency f = 60 Hz, whereas the white noise signal n(t) added to the periodic signal have a maximum amplitude of 10% of the main periodic signal amplitude and three different cases of harmonic contamination are considered. The first case considers a periodic signal contaminated with its 2 nd harmonic, as depicted in Figure 6a. The second case analyzes the periodic signal plus its 3 rd harmonic, as shown in Figure 6b. The last case considers the contamination of the periodic signal with its 3 rd + 5 th harmonics, as presented in Figure 6c. Where the signal-to-harmonic-plus-noise ratio SHNR = 15.2 dB. Table 4 shows the obtained result from the proposed smart-sensor frequency estimation for 40 runs of a periodic signal with white noise plus harmonic contamination.   Figure 7 shows the effects of an instantaneous jump in the power line frequency over the proposed smart sensor readouts. The input signal was originally synthesized as a pure sinusoidal with a frequency of 60.0 Hz and at half of the measurement process the frequency was suddenly changed to 60.6 Hz, representing a 1% instantaneous jump. The international standard for frequency measurement [2], requires to give a readout every 10 s; the processing of the signal takes 1.0078 s and the instrument was set to provide a readout every 2 s. Figure 7a compares the input signal frequency against the smart-sensor readouts before and after the 1% frequency jump during the 10 s of the measurement required by the standard. Before the jump the frequency readout of the smart-sensor is 60.0 Hz as expected; during the jump, the readout is 60.18 Hz; once the signal frequency stabilizes, the readout is 60.6 Hz that corresponds to the magnitude of the jump. The final readout of the smart sensor follows the frequency change in the standard required time.

Experimental Results
This section presents the application of the proposed smart sensor for frequency estimation in two different study cases. The first study case considers the frequency measurement of the electrical power supply, and the second one considers the frequency measurement of the signal obtained from a Stanford Research DS345 synthesized function generator [19]. Some of the main features of this device are that it generates standard waveforms with frequency resolution of 1 μHz, and accuracy of ±5 part-per-million; which makes it suitable for being used as reference to test the performance of the proposed smart sensor. The output from the synthesized function generator is contaminated with white noise at 10%, 20%, and 30% for a SNR = 17.0, 11.0, 7.4 dB, respectively. The proposed smart sensor depicted in Figure 2 is implemented in a low cost FPGA device xc3s1000 from Xilinx, embedded on the Spartan-3 Starter Board from Digilent [20]. The processing time takes 1.0078 s to perform the frequency estimation and the smart sensor provides readouts every 2 s.

Power Supply Frequency Measurement
The proposed smart sensor for frequency measurement can be utilized with several primary sensors. For this study case, the standard off-the-shelf current clamp i200s from Fluke is utilized for current monitoring. A 12-bit 4-channel serial-output analog to digital converter ADS7841 [21] is used for signal acquisition. Figure 8 shows the experiment setup for high-resolution frequency measurement monitoring the power-line-supply current from a standard electrical load (1 hp induction motor) with a current clamp as primary sensor. The current signal is sensed during 1 s at a sampling frequency of 512 Hz. The signal conditioning system provides the FPGA implementation of the proposed smart sensor with 512 discrete samples for high-resolution frequency estimation, the result is shown on the 4-digit 7-segment LED display, where the user selects between the high-and low-part of the estimation result to be shown on the display. For the case treated here 60.002734 Hz. Figure 9 shows the sensed current signal from the power line. By taking 40 readouts of the power-line frequency, the calculated mean and standard deviation are 60.0008 Hz and 0.0013 Hz, respectively.

Frequency Estimation of Digitally Synthesized Functions
In this case the frequency is estimated from voltage signals generated by a Stanford Research DS345 synthesized function generator. Similar to the previous case of study, a 12-bit 4-channel serial-output analog to digital converter ADS7841 is used for signal acquisition. Figure 10 shows the experiment setup for high-resolution frequency measurement, monitoring voltage signals. The synthesized voltage signal shown in Figure 11 is sampled during 1 s at a sampling rate of 512 Hz. The signal conditioning system provides the FPGA implementation of the proposed smart sensor with 512 discrete samples for high-resolution frequency estimation. The estimation result is shown on the 4-digit 7-segment LED display, where the high-and low-part of the estimation result can be selected for being shown on the display. For the case treated here, the frequency estimation of a synthesized pure sinusoidal signal with a frequency of 59.973 Hz is 59.972656 Hz.  To test the performance of the proposed smart sensor, three experiments are set up considering a 60 Hz sinusoidal signal generated by the DS345 function generator with white noise contamination at 10%, 20%, and 30% of its amplitude for a SNR = 17.0, 11.0, 7.4 dB, and as shown in Figure 12a-c, respectively. Table 5 summarizes the obtained results for 40 readouts from the proposed smart sensor.

Smart Sensor Linearity.
A test of linearity to the proposed smart sensor for high resolution frequency estimation is carried out in this section. Figure 13 shows the proposed smart sensor behavior under small variations of the input signal frequency. The input signal frequency increases from 59.3 Hz in steps of 0.05 Hz up to 60.7 Hz obtaining the correspondence line in Figure 13; which shows a linear behavior of the proposed smart sensor. The frequency variation range from 59.3 Hz to 60.7 Hz corresponds to the international standard CEI/IEC 61000-4-30 [2]; which states that the power frequency of the supply signal must vary around ±1% (from 59.4 Hz to 60.6 Hz). The results show that the proposed smart sensor provides a very accurate solution with an uncertainty of ±0.0024 Hz, with a maximum estimation error of 0.0055 Hz and an integral linearity of 0.189 %.

Discussion
An important result of this work is the hardware implementation of a smart sensor for high-resolution frequency detection in real-time applications. The proposed smart sensor is implemented in a low-cost FPGA device reaching operation speeds of 33.74 MHz; which provides accurate frequency readouts every 2 s.
The proposed smart sensor shows high performance operation, meeting the international standards for frequency measurement even with high-level noise contamination. This is shown in the simulation results where different study cases were treated, with the white-noise-contamination case at SNR = 7.4 dB being the one with the highest error. On the other hand, the proposed sensor shows a very good performance in analyzing real signals generated with a highly accurate reference source with high resolution, giving mean errors of 0.0007, 0.0001, and 0.0020 Hz for a periodic signal contaminated with white noise at SNR = 17.0, 11.0, and 7.4 dB, respectively. Regarding harmonic contamination, the proposed sensor showed to be highly insensitive as depicted in Tables 3 and 4. Finally, the proposed smart sensor shows a linear behavior for small frequency variations, which means that it will follow any small change in the signal frequency; this is shown in the linearity tests where the efficiency of the proposed smart sensor for power systems frequency estimation is demonstrated, providing results that are even below of those prescribed by international standards.

Conclusions
This work presents the development of a smart sensor for frequency estimation in real-time applications. The proposed sensor complies with international standards for frequency measurement in power systems, providing fast and accurate estimations with high resolution and small deviations as demonstrated by the results obtained in linearity test section, different from other methodologies where low resolutions of just decades of Hz are achieved. The proposed smart sensor implementation uses a simple architecture describing recursive functions for the CZT computation utilizing addition, multiplication, and accumulation operations, different from other algorithms using complex mathematics (e.g., FFT) and weighting factors for increasing their resolution (e.g., Zoom-FFT) or implementing the CZT in multiple iterations. The proposed system is considered a smart sensor since it integrates a commercially available current clamp, hall-effect sensor, or resistor as primary sensor, analyzing the corresponding output with digital signal processing techniques in the time domain for estimating the input signal frequency online, with high resolution. Other techniques can use only one kind of primary sensor and require the transformation of the monitored signal into the frequency domain. From the stated above, it can be concluded that the proposed smart sensor for high resolution frequency estimation is a low-cost and efficient solution for real-time application in power systems such as control and protection, thanks to its straightforward FPGA-based implementation that provides an accurate frequency readout every 2 s. complying international standards for power frequency monitoring different from other that either have problems meeting the norm [9][10][11], or require complex algorithms that make difficult their implementation [22,23].