10
1680 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY2009 Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms Pedro M. Ramos, Member, IEEE, Fernando M. Janeiro, Member, IEEE, Mouhaydine Tlemçani, and A. Cruz Serra, Senior Member, IEEE Abstract—In this paper, recent advances of a new digital-signal- processor (DSP)-based impedance measurement instrument un- der development are presented. The digital signal processing algorithms are based on ellipse fitting for the extraction of the acquired sine signal parameters so that the impedance magnitude and phase can be determined. Special attention is devoted to the improvement of the algorithm’s efficiency, i.e., by enabling the acquisition of a large number of samples by processing noncon- secutive data segments with no extra memory requirements. This capability is shown to reduce the experimental uncertainties of the estimated parameters. The systematic errors caused by the two different acquisition channels are measured and taken into account. The combined experimental measurement uncertainty is evaluated for the frequency sweep measurement of a particular impedance. Index Terms—Digital signal processor (DSP), DSP-based instrumentation, ellipse-fitting algorithm, experimental uncer- tainty analysis, impedance measurements. I. I NTRODUCTION I N all scientific fields, accurate measurements are vital to the advancement of human knowledge, either by experi- mentally validating existing theories or by presenting results that cannot be explained by the prevailing theories, leading to new developments that can support those results. In many cases, those measurements are based on accurately measuring an unknown impedance that corresponds to a sensor output [1]–[4]. Therefore, it is of utmost importance to have the ability to quickly and accurately measure impedances across a broad range of frequencies. This is possible with commercial instruments such as impedance network analyzers, but these cost tens of thousands of dollars and are bulky. Cheaper im- pedance measurement instruments usually only cover a fixed set of frequencies (sometimes only two and, most of the time, Manuscript received June 30, 2008; revised January 6, 2009. First pub- lished February 20, 2009; current version published April 7, 2009. This work was supported by the Portuguese National Research Project under Reference PTDC/EEA-ELC/72875/2006. The Associate Editor coordinating the review process for this paper was Dr. Rik Pintelon. P. M. Ramos and A. C. Serra are with the Instituto Superior Técnico, Tech- nical University of Lisbon, 1049-001 Lisbon, Portugal, and also with the In- strumentation and Measurement Research Line, Instituto de Telecomunicações, 1049-001 Lisbon, Portugal (e-mail: [email protected]; [email protected]). F. M. Janeiro is with the Department of Physics, Universidade de Évora, 7000-671 Évora, Portugal, and also with the Instrumentation and Measurement Research Line, Instituto de Telecomunicações, 1049-001 Lisbon, Portugal (e-mail: [email protected]). M. Tlemçani is with the Department of Physics, Universidade de Évora, 7000-671 Évora, Portugal, and also with the Centro de Geofisica de Évora, 7000-671 Évora, Portugal, and the Instituto de Telecomunicações, 1049-001 Lisbon, Portugal (e-mail: [email protected]). Digital Object Identifier 10.1109/TIM.2009.2014512 limited to fewer than ten different frequencies). A low-cost portable system that is able to quickly and accurately measure an impedance at different frequencies (such as those proposed in [5] and [6]) is thus needed. Advances in data-acquisition systems have been shaping the way measurements are made. In addition to being a low-cost and accurate solution, these systems have the advantage of needing a few or even no front-end analog electronics, resulting in fewer system nonlinearities. Additionally, systematic errors can easily be compensated in the signal processing phase of the measurement. Recently, impedance measurements based on a four-wire setup and a data-acquisition system have successfully been demonstrated [5]. The basic setup comprises a sine wave generator that supplies current to the series of a reference impedance and the impedance to be measured. The voltage across both impedances is acquired by a two-channel analog- to-digital converter (ADC), and the unknown impedance value can be estimated with signal-processing algorithms, such as the sine-fitting algorithms standardized in [7]. This proce- dure was presented in [8] using sine waves whose parameters were extracted by a seven-parameter sine-fitting algorithm. In [9], a multiharmonic signal was used, allowing the frequency characterization of the impedance with a single measurement. However, sine-fitting algorithms (the one-channel version nor- malized in [7] and the two-channel version proposed in [8]) are iterative, and due to their nonlinear nature, convergence depends, for example, on the signal-to-noise ratio (SNR) and the number of measured periods. Different approaches for solving these problems have been proposed, including minor modifications to the normalized sine-fitting algorithm [10], the use of interpolated fast Fourier transform [11], or even the application of genetic algorithms [12]. Other algorithms such as linear parametric spectral estimators [13] can also be used but were not considered in this work. The extraction of the sine wave parameters can become noniterative if the frequency of the signals is not estimated. One solution is to apply the three-parameter sine fitting with the known frequency. However, the frequency uncertainty (together with the uncertainty of the sampling frequency) can cause significant errors in the estimation of the remaining parameters [10]. A particularly innovative procedure was presented in [14], where an XY plot of the two acquired sine waves, thus remov- ing the time dependence of each sample, produces an ellipse whose parameters can be estimated by using an ellipse-fitting algorithm [15], [16]. Although the frequency is an important parameter in impedance measurements, its value is imposed by 0018-9456/$25.00 © 2009 IEEE

Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

  • Upload
    ac

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

1680 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY 2009

Recent Developments on Impedance MeasurementsWith DSP-Based Ellipse-Fitting Algorithms

Pedro M. Ramos, Member, IEEE, Fernando M. Janeiro, Member, IEEE,Mouhaydine Tlemçani, and A. Cruz Serra, Senior Member, IEEE

Abstract—In this paper, recent advances of a new digital-signal-processor (DSP)-based impedance measurement instrument un-der development are presented. The digital signal processingalgorithms are based on ellipse fitting for the extraction of theacquired sine signal parameters so that the impedance magnitudeand phase can be determined. Special attention is devoted to theimprovement of the algorithm’s efficiency, i.e., by enabling theacquisition of a large number of samples by processing noncon-secutive data segments with no extra memory requirements. Thiscapability is shown to reduce the experimental uncertainties ofthe estimated parameters. The systematic errors caused by thetwo different acquisition channels are measured and taken intoaccount. The combined experimental measurement uncertainty isevaluated for the frequency sweep measurement of a particularimpedance.

Index Terms—Digital signal processor (DSP), DSP-basedinstrumentation, ellipse-fitting algorithm, experimental uncer-tainty analysis, impedance measurements.

I. INTRODUCTION

IN all scientific fields, accurate measurements are vital tothe advancement of human knowledge, either by experi-

mentally validating existing theories or by presenting resultsthat cannot be explained by the prevailing theories, leadingto new developments that can support those results. In manycases, those measurements are based on accurately measuringan unknown impedance that corresponds to a sensor output[1]–[4]. Therefore, it is of utmost importance to have theability to quickly and accurately measure impedances across abroad range of frequencies. This is possible with commercialinstruments such as impedance network analyzers, but thesecost tens of thousands of dollars and are bulky. Cheaper im-pedance measurement instruments usually only cover a fixedset of frequencies (sometimes only two and, most of the time,

Manuscript received June 30, 2008; revised January 6, 2009. First pub-lished February 20, 2009; current version published April 7, 2009. This workwas supported by the Portuguese National Research Project under ReferencePTDC/EEA-ELC/72875/2006. The Associate Editor coordinating the reviewprocess for this paper was Dr. Rik Pintelon.

P. M. Ramos and A. C. Serra are with the Instituto Superior Técnico, Tech-nical University of Lisbon, 1049-001 Lisbon, Portugal, and also with the In-strumentation and Measurement Research Line, Instituto de Telecomunicações,1049-001 Lisbon, Portugal (e-mail: [email protected]; [email protected]).

F. M. Janeiro is with the Department of Physics, Universidade de Évora,7000-671 Évora, Portugal, and also with the Instrumentation and MeasurementResearch Line, Instituto de Telecomunicações, 1049-001 Lisbon, Portugal(e-mail: [email protected]).

M. Tlemçani is with the Department of Physics, Universidade de Évora,7000-671 Évora, Portugal, and also with the Centro de Geofisica de Évora,7000-671 Évora, Portugal, and the Instituto de Telecomunicações, 1049-001Lisbon, Portugal (e-mail: [email protected]).

Digital Object Identifier 10.1109/TIM.2009.2014512

limited to fewer than ten different frequencies). A low-costportable system that is able to quickly and accurately measurean impedance at different frequencies (such as those proposedin [5] and [6]) is thus needed.

Advances in data-acquisition systems have been shaping theway measurements are made. In addition to being a low-costand accurate solution, these systems have the advantage ofneeding a few or even no front-end analog electronics, resultingin fewer system nonlinearities. Additionally, systematic errorscan easily be compensated in the signal processing phase of themeasurement.

Recently, impedance measurements based on a four-wiresetup and a data-acquisition system have successfully beendemonstrated [5]. The basic setup comprises a sine wavegenerator that supplies current to the series of a referenceimpedance and the impedance to be measured. The voltageacross both impedances is acquired by a two-channel analog-to-digital converter (ADC), and the unknown impedance valuecan be estimated with signal-processing algorithms, such asthe sine-fitting algorithms standardized in [7]. This proce-dure was presented in [8] using sine waves whose parameterswere extracted by a seven-parameter sine-fitting algorithm. In[9], a multiharmonic signal was used, allowing the frequencycharacterization of the impedance with a single measurement.However, sine-fitting algorithms (the one-channel version nor-malized in [7] and the two-channel version proposed in [8])are iterative, and due to their nonlinear nature, convergencedepends, for example, on the signal-to-noise ratio (SNR) andthe number of measured periods. Different approaches forsolving these problems have been proposed, including minormodifications to the normalized sine-fitting algorithm [10], theuse of interpolated fast Fourier transform [11], or even theapplication of genetic algorithms [12]. Other algorithms suchas linear parametric spectral estimators [13] can also be usedbut were not considered in this work.

The extraction of the sine wave parameters can becomenoniterative if the frequency of the signals is not estimated.One solution is to apply the three-parameter sine fitting with theknown frequency. However, the frequency uncertainty (togetherwith the uncertainty of the sampling frequency) can causesignificant errors in the estimation of the remaining parameters[10]. A particularly innovative procedure was presented in [14],where an XY plot of the two acquired sine waves, thus remov-ing the time dependence of each sample, produces an ellipsewhose parameters can be estimated by using an ellipse-fittingalgorithm [15], [16]. Although the frequency is an importantparameter in impedance measurements, its value is imposed by

0018-9456/$25.00 © 2009 IEEE

Page 2: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

RAMOS et al.: DEVELOPMENTS ON IMPEDANCE MEASUREMENT WITH DSP-BASED ELLIPSE-FITTING ALGORITHM 1681

the signal generator and does not need to be determined for theactual impedance measurement.

The need to have an accurate, portable, and low-costimpedance-measuring device directly leads to the use of digitalsignal processors (DSPs) for the signal processing needed afterdata acquisition. The ellipse-fitting algorithm is very efficientsince it is noniterative, and its use for impedance measurementswas originally presented in [17]. Another advantage of thisalgorithm is that it can be modified from its original form [16]into a version with very low memory requirements, resulting invery fast signal processing and, therefore, high-speed measure-ments. The uncertainty of the measurements performed withthis setup was presented in [18].

This paper is a development of [18] as the acquisition chan-nels, which comprised two instrumentation amplifiers and theDSP kit internal electronics, are frequency characterized andcompensated for. This allows the correction of the previouslymade measurements, leading to a better accuracy in a widerfrequency range. In addition, for the first time, a detailedexplanation on how to transform the original algorithm intoa low-memory version is presented here, thus showing thereduction in the experimental uncertainty directly associatedwith the increase in the number of processed samples.

The paper has five sections, including an introduction anda conclusion. In Section II, the ellipse-fitting algorithm, aswell as the calculations needed to obtain the acquired sinevoltage parameters, is described. This section also describesthe algorithm’s implementation that allows it to process sampleby sample, instead of needing all the samples that the originalalgorithm requires. A technique for reducing roundoff errorsis also described here. Section III describes the impedancemeasurement setup, including a description of the front-endanalog electronics and its frequency characterization. The mea-surement uncertainty calculation procedure is also describedin this section. The measurement results are presented inSection IV, where an RLC series impedance frequency responseis characterized. The expanded measurement uncertainties arecomputed and compared with the measurements obtained withthe commercial impedance analyzer Agilent 4294A [19].

II. ELLIPSE-FITTING ALGORITHM

In this section, the ellipse-fitting algorithm, which fits an el-lipse to two sets of simultaneously acquired sine signal samplesthrough two channels of an ADC, is described. The algorithmintroduced in [15] and improved in [16] estimates the ellipseparameters that best fit, in the least-square error criteria, thequadratic form that represents the two signals in the XY plane.

The acquired signals can be modeled by

v1(t) = D1 cos(2πft + ϕ1) + C1

v2(t) = D2 cos(2πft + ϕ2) + C2 (1)

where Di is the sine amplitude, Ci is the dc component, ϕi

is the phase of channel i, and f is the common frequency.The phase difference between the two signals is defined asΔϕ = ϕ2 − ϕ1. The two signals are simultaneously sampledat sampling frequency fs, and N samples per channel are

Fig. 1. Ellipse fitting of two simulated sine signals with f = 1.44 kHz,D1 = 0.9 V, D2 = 0.6 V, and Δϕ = 65◦. White noise with nRMS = 10 mVwas added to both channels before sampling at 96 kS/s with 200 samples perchannel.

acquired, with the samples defined as (v1,1, . . . v1,n, . . . v1,N )for channel 1 and (v2,1, . . . v2,n, . . . v2,N ) for channel 2.

Regarding ADC saturated samples, in the seven-parameteralgorithm [8], they are simply removed from the correspondingchannel vector, together with their timestamps. In the ellipse-fitting algorithm, the samples are also removed from the samplevector, together with the corresponding samples of the otherchannel whether they are also saturated or not.

Fig. 1 shows a simulated ellipse plot resulting from twosine signals with f = 1.44 kHz, D1 = 0.9 V, D2 = 0.6 V,and Δϕ = 65◦. Gaussian white noise with nRMS = 10 mV wasadded before sampling at fs = 96 kS/s. A total of 200 samplescorresponding to three periods of the input sine signals wereacquired.

Algebraic manipulation of (1) yields the quadratic form

(v1 − C1

D1

)2

+(

v2 − C2

D2

)2

−2(v1 − C1)(v2 − C2)

D1D2cos(Δϕ) − sin2(Δϕ) = 0 (2)

which can be written as

F (v1, v2) = av21 + bv1v2 + cv2

2 + dv1 + ev2 + g = 0. (3)

Equation (3) corresponds to an ellipse if b2 − 4ac < 0. Thiscondition corresponds, in the sine signals, to D1,D2 �= 0 andΔϕ �= kπ, with k ∈ Z, meaning that both signals must havenonzero amplitude and that they must be neither in phasenor in-phase opposition. Condition b2 − 4ac < 0 can be set tob2 − 4ac = −1 by introducing a scale factor.

Cost function L =∑N

n=1 F 2(v1,n, v2,n) is minimized usingthe numerical procedure introduced in [15] and refined in [16],which is a noniterative algorithm based on Lagrange multipliersthat estimates parameters a, b, c, d, e, and g of (3) subject tocondition b2 − 4ac = −1.

Page 3: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

1682 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY 2009

Solution vector a = [ a b c d e g ] is obtained byintroducing Lagrange multiplier λ and a constant matrix C toenforce the restriction condition (see [16] for further details).The conditions for the optimal solution a to minimize L are

Sa =λCa

aTCa = 1 (4)

where S is the scatter matrix, which can be subdividedaccording to

S =(

S1 S2

ST2 S3

)(5)

with

S1 =1N

⎛⎝ Sv4

1Sv3

1v2Sv2

1v22

Sv31v2

Sv21v2

2Sv1v3

2Sv2

1v22

Sv1v32

Sv42

⎞⎠

S2 =1N

⎛⎝ Sv3

1Sv2

1v2Sv2

1Sv2

1v2Sv1v2

2Sv1v2

Sv1v22

Sv32

Sv22

⎞⎠

S3 =1N

⎛⎝ Sv2

1Sv1v2 Sv1

Sv1v2 Sv22

Sv2

Sv1 Sv2 N

⎞⎠ . (6)

The elements of S1, S2, and S3 are

Svl1vm

2=

N∑n=1

vl1,nvm

2,n. (7)

By directly constructing these matrices (instead of the im-plementation used in [16]), the method no longer requiresmemory allocation proportional to the number of samples.This means that a larger number of samples can be processedby the algorithm without increased memory requirements. Inaddition, since the acquired samples, after being used to updatethe individual elements of the three matrices, are no longerneeded, they can be discarded to optimize memory usage.In the implementation, the number of samples is limited to960 per acquisition due to direct-memory-access (DMA, whichis the method used to transfer samples from the ADC) restric-tions. However, due to the way the ellipse-fitting algorithmis implemented (and because no time information is needed,unlike in sine-fitting algorithms), new acquisitions (segments)can be made, requiring only that the elements of the matricesbe stored and updated with each new sample, regardless of itstimestamp. To reduce roundoff errors caused by floating-pointsummations, a set of parameters for matrices S1, S2, and S3

is constructed from the newly arrived 960 samples per channelbefore they are added to the preexistent elements. During thisprocess, the required amount of memory corresponds only tothe 15 different values that constitute matrices S1, S2, andS3 (and an extra 15 values for the temporary elements of thecurrent segment). For the calculation of the ellipse’s parametervector a, the DSP implementation follows the rest of themethod proposed in [16].

From the estimated vector of parameters, the amplitude ratioof the sine amplitudes is

D2

D1=

√a

c(8)

whereas the dc components are

C1 =2cd − be

b2 − 4acand C2 =

2ae − bd

b2 − 4ac. (9)

The phase difference is obtained from

cos(Δϕ) = − sign(a)b2√

ac. (10)

However, the sign of the phase difference cannot be obtainedfrom (10), because the algorithm cannot determine how theellipse is being constructed (either clockwise or counterclock-wise). This is a known issue when using the XY plot todetermine the phase difference of two sine signals. Due to thedefinition of Δϕ, it is known that Δϕ > 0 if the ellipse isconstructed counterclockwise and Δϕ < 0 if it is constructedclockwise.

To determine the sign of the phase difference, a voting systemis implemented to estimate the rotation direction of the ellipse.This can be achieved by measuring the sign of the rotation angleusing the barycenter of the sampled points as reference. Thecoordinates of the barycenter of the ellipse are updated (aftereach data acquisition segment has been acquired) from two ofthe values already computed for the S3 matrix, i.e.,

xN =Sv1

Nacquiredand yN =

Sv2

Nacquired(11)

where Nacquired is the number of acquired samples so far.This procedure is well suited for situations with dc com-

ponents since it dynamically approaches the ellipse’s center.Each sample pair defines a complex number in the Argandplane centered at xN and yN . The sign difference betweenconsecutive angles

δn|n=1,...,N−1 = sign {arg [v1,n+1 − xN + j(v2,n+1 − yN )]

− arg [v1,n − xN + j(v2,n − yN )]} (12)

defines the vote for each sample. It should be noted that thenumber of votes that correctly estimate the rotation directionof the ellipse is always much greater than the number of voteswith a wrong estimation, even in situations with low SNR orwhen the sampling-frequency to signal-frequency ratio is high.This occurs, because, since the samples create an ellipse on theArgand plane, there is a trend on the sign of the consecutiveangles that allows the correct estimation of the ellipse rotationdirection, and each sample only contributes with one vote forthe final outcome.

The estimated Δϕ sign is

sign(Δϕ) = −sign

(N−1∑n=1

δn

). (13)

Page 4: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

RAMOS et al.: DEVELOPMENTS ON IMPEDANCE MEASUREMENT WITH DSP-BASED ELLIPSE-FITTING ALGORITHM 1683

Fig. 2. Evolution of the barycenter of the ellipse as each sample is acquired.After one third of the first period (point P), the barycenter is already well withinthe ellipse.

This method for determining the ellipse rotation only workswhen the Nyquist sampling theorem is fulfilled (i.e., thesampling frequency is at least twice the value of the signalfrequency).

The estimated values of xN and yN are updated each time anew acquisition segment is acquired. This means that, with eachnew segment, the values of the barycenter are improved, andtherefore, the errors caused by additive noise are reduced. Forthe situation shown in Fig. 1, the sample-by-sample dynamicdetermination of the barycenter is shown in Fig. 2. Clearly,after just a few samples, the barycenter has already traveledinto the ellipse, and the sign of the consecutive angles, asdetermined in (13), is already correct, although the barycenterdoes not match the absolute center of the ellipse. This algorithmfor determining the barycenter is also very computationallyefficient since the sample values of the previous segments arediscarded.

Although the estimates of the barycenter are slightly biaseddue to the noninteger number of periods, it should be notedthat this does not affect the outcome of the estimated phasesignal since the only requirement is that the barycenter iswithin the ellipse for the correct determination of the phasedifference. For the situation shown in Fig. 2, after one third ofthe first period (point P), the barycenter is already well withinthe ellipse and remains there. Notice that the first barycenteris only determined after 960 samples, which corresponds to14.4 periods (f = 1.44 kHz).

A way to further improve the computational efficiency ofthe determination of the sign phase difference is to assess theresults of the voting system after each segment. If the votingresults are overwhelming (more than 66%) in either direction,the voting system is disabled, together with the barycenterestimation algorithm, and the phase difference is determinedfrom the results of the voting system so far. For example, forthe noisy results shown in Fig. 2 (SNR1 = 36 dB and SNR2 =32 dB), after the first period, the voting is already 82%, and thevoting system would correctly estimate the sign of the phasedifference.

To evaluate the influence of the SNRs on the estimator bias[20], numerical simulations were made, changing the SNRof both channels with random phase difference in the range±[10◦; 170◦] (to avoid ellipse degeneration). For each pair ofSNRs, 100 000 simulations were made, and the average errorand the error standard deviation of the estimated amplitude ratioand phase difference were obtained and are shown in Fig. 3.The amplitudes of both channels were set to D1 = 1 V andD2 = 0.5 V, the frequency is 1000 Hz, the sampling rate is96 kS/s, and the number of samples is 1920 (which correspondsto 20 periods). From the results shown in Fig. 3, it can be seenthat there is some bias on the estimation of the amplitude ratioand that this bias is higher for lower SNRs. The measurementsetup used in this work has been characterized at differentfrequencies, and the measured SNR has always been betterthan 60 dB. For SNR1 = SNR2 = 60 dB, the results shown inFig. 3 have an average error of the D2/D1 ratio of 7.0 × 10−10,and the corresponding standard deviation of the error is 2.3 ×10−5. The average error of the phase difference estimation is(2.6 × 10−6)◦, and the corresponding standard deviation of theerror is (2.6 × 10−3)◦. These results show that the bias ofthe estimator is negligible for these SNR values. However, asshown in Fig. 3, for lower SNRs, the bias of the estimatorshould be taken into account.

The asymmetric behavior of the average error of the esti-mated amplitude ratio [Fig. 3(a)] is caused by the fact thatamplitude D1 is affected by SNR1 and is the denominatorof the estimated amplitude ratio, whereas amplitude D2 isaffected by SNR2 and is the numerator of the estimated am-plitude ratio. The estimator bias for poor SNRs overestimatessine amplitudes D1 and D2. Therefore, ratio D2/D1 can beunderestimated or overestimated, depending on the relativevalue of the two SNRs. The overestimation of D2 results in anoverestimated ratio D2/D1, whereas the overestimation of D1

results in an underestimated ratio D2/D1. This effect is clearlyshown in Fig. 3(a) for the lower SNR values.

III. IMPEDANCE MEASUREMENT

The measurement procedure is based on the volt–amperemethod shown in Fig. 4, which consists of measuring the ratiobetween amplitude D2 of the voltage across the impedanceunder test Z and amplitude D1 of the voltage across ref-erence impedance ZR, as well as the phase difference be-tween the two sine signals Δϕ. This is accomplished usingthe simultaneously acquired samples of the ADCs and thesignal-processing algorithms. A sine wave generator suppliescurrent to the circuit at the desired measurement frequencyand can be replaced with a direct digital synthesizer (DDS)generator, as implemented in [5]. In the current testbed setup, aTTi TGA1242 function generator with a IEEE 488.2 interfaceis used.

Impedance magnitude |Z| and its phase ϕZ are deter-mined by

|Z| =D2

D1|ZR| (14)

ϕZ = Δϕ + ϕZR(15)

Page 5: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

1684 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY 2009

Fig. 3. Numerical simulation results. (a) Average error of the estimated amplitude ratio. (b) Average error of the estimated phase difference. (c) Amplitude ratioerror standard deviation. (d) Phase difference error standard deviation.

Fig. 4. Measurement setup. FG is the function generator (TTi TGA1242) that supplies the current at the desired measurement frequency, ZR is the referenceimpedance, and Z is the impedance under measurement. IA are the used instrumentation amplifiers with a gain of 1, because the DSP kit inputs are not differential.ADC1R and ADC1L are the two channels of the sigma–delta ADC (which were named “right” and “left” for audio applications).

where |ZR| and ϕZRare the magnitude and phase of the refer-

ence impedance at the measurement frequency, respectively.Since there are two analog circuits (one for each channel),

it is necessary to perform a characterization to assess differentgains and delays between the two circuits, leading to asymme-tries between them. This characterization procedure consists ofapplying the same sine signal to both channels and measuringthe amplitude ratio and phase difference for each frequency.For this specific procedure, the seven-parameter sine-fittingalgorithm [8] is used to determine the amplitude ratio and phasedifference. With these correction coefficients, the measuredamplitude ratio and phase are corrected to take into accountthe different frequency responses of the two-channel analog

circuitry. In Fig. 5, the measured amplitude ratio and phasedifference for the same input sine signal are shown. The maxi-mum gain error is below 0.25%, whereas the introduced phasedifference is between −0.054◦ and −0.008◦.

To assess the measurement uncertainty, the measurementprocess is repeated a number of times, and the average values ofD2/D1 and Δϕ, together with the corresponding experimentalstandard deviations, are determined.

The measurement results are affected by uncertainty, whichincludes the uncertainty due to the reference impedance (u|ZR|and uϕZR

) and experimental uncertainty (i.e., the standarddeviations of the repeated measurements) of the measuredamplitude ratio (uD2/D1) and phase difference (uΔϕ). The

Page 6: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

RAMOS et al.: DEVELOPMENTS ON IMPEDANCE MEASUREMENT WITH DSP-BASED ELLIPSE-FITTING ALGORITHM 1685

Fig. 5. (Thick line, left vertical axis) Measured correction amplitude ratio.(Dashed line, right vertical axis) Phase difference.

final uncertainty combines these uncertainties by the law ofuncertainty propagation [21]. The uncertainty of the impedancemagnitude is

u|Z| =

√u2

D2/D1|ZR|2 + u2

|ZR|

(D2

D1

)2

(16)

whereas the uncertainty of the impedance phase is

uϕZ=

√u2

Δϕ + u2ϕZR

. (17)

The value of |ZR| used in (16) corresponds to the magnitudeof the reference impedance, as measured by the Agilent 4294A,whereas the value of D2/D1 is the average value of the repeti-tive measurements of the amplitude ratio.

Since the reference impedance was measured using anAgilent 4294A precision impedance analyzer, the uncertaintiesof the reference impedance (u|ZR| and uϕZR

) correspond totype-B uncertainties [21] and are obtained from the maximummeasurement errors of the Agilent [19], i.e.,

u|ZR| =εmax (|ZR|)√

3and uϕZR

=εmax(ϕZR

)√3

. (18)

Note that the maximum measurement errors of the Agilent4294A were determined using the full specifications suppliedby Agilent and not the simplified accuracy of the device.

IV. EXPERIMENTAL RESULT

The implementation was executed in a DSP developmentkit from Analog Devices that includes an ADSP-BF533 thatworks at 594 MHz with 144 kB of internal random-accessmemory (RAM) and is capable of 1500 million multiply accu-mulate cycle/s. Also included in the kit is a 24-bit multichannelsigma–delta ADC with a sampling rate of 48 or 96 kS/s thatis used to simultaneously sample the voltages across bothimpedances (as shown in Fig. 3). The kit also has 64 MB ofsynchronous dynamic RAM and 2 MB of flash memory to

Fig. 6. Examples of measured ellipses corresponding to different measure-ment frequencies. Each ellipse has 960 points acquired at 96 kS/s.

store the execution program. Upon bootup or reset, the programstored in the flash memory is loaded into the DSP memory andexecuted.

For the impedance measurement results presented in thissection, the sampling rate was set to 96 kS/s, and 960 samplesper channel were acquired.

A set of commands was implemented to enable the commu-nication of the DSP kit with a personal computer (PC) througha fast serial connection. One of these commands instructs theDSP to acquire the samples from the two input channels andtransmit the samples to the PC. This enables the monitoring ofthe acquired samples at the measurement frequencies. Anothercommand corresponds to the acquisition and application of theellipse-fitting algorithm, as described in the previous section.The returned parameters include the amplitude ratio, the phasedifference, and the two dc components.

To test the proposed measurement setup, an impedance wasbuilt using three decade boxes from IET Labs (a RS-200 forthe resistance, a CS-301 for the capacitor, and an LS-400 forthe inductance). With these decade boxes, an RLC series circuit(with R = 500 Ω, L = 40 mH, and C = 100 nF) was measuredusing the Agilent 4294A. The reference impedance (an IETLabs HARS-X-2-100, with ±0.01% + 2 mΩ set to 1 kΩ) wasalso measured with the analyzer to account for its frequencydependence.

As described in [17], the measurement setup is capable ofdetermining when the ellipse is degenerate (using the propertythat, even in these situations, the ellipse fitting can estimatethe phase difference with sufficiently low error) and avoiding itby selecting a different reference impedance whose phase canassure an absolute phase difference above 10◦. In this case, themeasurement procedure is then restarted.

In Fig. 6, examples of the measured ellipses are shown fordifferent measurement frequencies. Notice that, for a measure-ment frequency of 100 Hz, only one period of data is acquired,with 960 points per period, whereas, for 10 kHz, 100 periodsof data are acquired, with 9.6 samples per period. Each periodcorresponds to one ellipse rotation.

Page 7: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

1686 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY 2009

Fig. 7. Uncertainty regions and average values of the measured impedance at (left) 400 Hz and (right) 1 kHz (see text and Table I for further details).

To assess the measurement uncertainty, the impedance wasmeasured 1000 times for each frequency, and the experimentalstandard deviations and the average values of the impedancemagnitude and phase were calculated in the PC.

In Fig. 7, the average values of the impedance measured at400 Hz and 1 kHz with the DSP are shown (+), together withthe experimental expanded uncertainty region of the impedancemeasured with the DSP [see Fig. 7 (thick line)]. Also shownis the impedance measured with the Agilent instrument (×)and the corresponding expanded uncertainty region [see Fig. 7(long dashed line)]. The expanded uncertainty region of theimpedance measured with the DSP taking into account the un-certainty of ZR is also depicted [see Fig. 7 (short dashed line)].The expanded uncertainty regions were obtained from the 1-Duncertainty intervals of the impedance phase and magnitude.These uncertainty intervals were obtained with a coveragefactor of 2 to define an interval having a level of confidence ofapproximately 95%. Note that the overall uncertainty regionsobtained do not correspond to a confidence level of 95%. Theuncertainty region resembles parallelograms in Fig. 7 becauseof the considerable distance to the origin and the reduced phaseuncertainties. However, the actual shape is shown in Fig. 8,where the expanded standard deviation of the impedance’sphase 2σϕZ

defines half of the angle amplitude, and the ex-panded standard deviation of the impedance’s magnitude 2σ|Z|defines half of the radial length of the shape.

In Table I, the impedance measured values (and the cor-responding uncertainties) are shown for the two frequenciesshown in Fig. 7. The values shown in Table I comply with therecommendation in [21, Sec. 7.2.6] that the uncertainty valuesshould be represented with two significant digits and that theaverage values are consistently rounded with their uncertainties.Note that the Agilent uncertainty for 1 kHz is much smaller thanthe Agilent uncertainty for 400 Hz. In fact, for 1 kHz, the im-pedance magnitude maximum error is approximately 0.075%,whereas, for 400 Hz, it is approximately 0.3%. This situation isa direct consequence of the formulas of the maximum error of

Fig. 8. Graphical representation of the expanded uncertainty intervals and re-sulting uncertainty regions. For illustration purposes, the uncertainty limits aregreatly enhanced so that the shape of the uncertainty region is clearly visible.

TABLE IMEASURED VALUES AND CORRESPONDING UNCERTAINTIES OF THE

UNKNOWN IMPEDANCE FOR 400 Hz AND 1 kHz

Page 8: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

RAMOS et al.: DEVELOPMENTS ON IMPEDANCE MEASUREMENT WITH DSP-BASED ELLIPSE-FITTING ALGORITHM 1687

Fig. 9. (Thick line, left vertical axis) Average impedance magnitude. (Dashedline, right vertical axis) Corresponding relative uncertainty as a function of themeasured frequency.

Fig. 10. (Thick line, left vertical axis) Average impedance phase. (Dashedline, right vertical axis) Corresponding uncertainty as a function of the mea-sured frequency.

the Agilent [19] and is reflected in Fig. 6 by the smaller relativeregions of the uncertainties of the Agilent for 1 kHz.

In Figs. 9 and 10, the average measured impedance magni-tude and phase, as a function of the measurement frequency,are represented, together with the respective uncertainties, dis-regarding the uncertainty due to the reference impedance. Themaximum relative uncertainty for the impedance magnitude is0.11% (for f = 100 Hz), whereas the maximum impedancephase uncertainty is 0.062◦ also for 100 Hz.

As explained in Section II, the ellipse-fitting implementa-tion has an advantage when compared with the sine-fittingalgorithms concerning the number of samples. For the currentDSP setup, the number of acquired samples is limited to960 per channel for each acquisition, which means that themaximum number of samples for the sine-fitting algorithmis also 960, because, for different acquisitions, the relative

Fig. 11. (Thick line, left vertical axis) Evolution of the experimental standarddeviations of the voltage ratio and (dashed line, right vertical axis) phasedifference as functions of the number of samples for f = 400 Hz.

timestamps between acquisitions are lost (although they couldbe reconstructed from a system master clock, this would in-evitably introduce another source of uncertainty that wouldincrease the uncertainties of the frequency, signal amplitudes,and phases). For the ellipse fitting, there is no such limitation,because it can process multiple acquisitions or segments (thuseffectively increasing the number of samples for the algorithm).In addition, for the seven-parameter algorithm, the increasednumber of samples means that it has to construct larger matrices(the main matrix whose pseudoinverse needs to be determinedhas seven columns and 2N rows), which also requires largeamounts of memory because all the samples must be kept.The ellipse-fitting algorithm (as explained in Section II) onlyrequires storage of 15 variables (plus another 15 for processingeach acquisition segment), which correspond to the nonidenti-cal elements of matrix S. After each new segment is added intothe S matrices, the samples can be disregarded, thus reusingthe same memory for each segment. This means that, with theseven-parameter sine fitting, the amount of memory dependson the number of samples, and the method for keeping therelative timestamps introduces more uncertainty. On the otherhand, the ellipse-fitting algorithm memory requirements do notincrease as the number of samples increases, and no extra stepsfor managing relative timestamps are needed.

Taking advantage of these properties, it is possible to assesshow the experimental standard deviations of the estimatedparameters depend on the number of samples. In Fig. 11, theresults for 1000 repetitions are shown for different values of thenumber of samples. Clearly, there is a reduction in the experi-mental standard deviations. Note that, for 10 000 samples, thestandard deviation of the amplitude has reduced to about 9% ofthe corresponding value for 1000 samples.

Regarding measurement speed, the algorithm takes 11.1 msfor the acquisition process (960 samples at 96 kS/s plus process-ing time); 12.1 ms to determine the 15 parameters for the S1,S2, and S3 matrices; 4.8 ms to determine the rotation direction;and 0.3 ms to estimate the ellipse and sine parameters, totaling28.3 ms. These values have not been optimized, and at least the

Page 9: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

1688 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 58, NO. 5, MAY 2009

values corresponding to the 15 parameters and the rotation canfurther be improved by optimizing the code. For comparisonpurposes, the seven-parameter sine-fitting algorithm requires,on average, two iterations with a total time of 425 ms, whichcorresponds to 207 ms per iteration plus the 11.1 ms of theacquisition process.

V. CONCLUSION

In this paper, the latest developments of a new impedancemeasurement system have been presented. The measurementmethod consists of measuring the sine voltage across a ref-erence impedance and the voltage across the unknown im-pedance, with both impedances having the same current. Thetwo voltages are acquired with a two-channel simultaneoussampling ADC that sends the sampling results to a DSP. In theDSP, the ellipse-fitting algorithm determines the ellipse param-eters that correspond to the XY plot of the two voltages, andthe amplitude ratio, together with the phase difference, is deter-mined to finally estimate the impedance magnitude and phase.

The reported developments include the ability of the algo-rithm to process basically any number of samples required. Inprevious versions [17], [18], the number of samples was limiteddue to DMA restrictions. In the presented improved version,the implementation uses the fact that the ellipse fitting does notrequire time information, and so, multiple acquisitions can beused to assess the ellipse parameters. This fact is shown to re-duce the experimental uncertainty of the estimated parameters.Another improvement concerned the elimination of systematicerrors caused by slight differences in the two analog acquisitionchannels. By measuring the amplitude ratio and phase differ-ence when the same signal was applied to both channels, thesedifferences were corrected. Since the differences are frequencydependent, the measurement setup made a frequency sweepto determine the correction coefficients as a function of thefrequency as well. The experimental measurement uncertaintyis evaluated, with and without taking into account the uncer-tainty of the reference impedance. The results show that themeasurement method uncertainty is comparable with the un-certainty of the expensive Agilent 4294A Precision ImpedanceAnalyzer. However, this is not a limitation of the ellipse-fittingalgorithm or its DSP implementation but a consequence of themeasurement results being tied to the uncertainty of referenceimpedance values.

Future work includes replacing the DSP kit built-in ADCwith external ADCs to increase flexibility and different (andhigher) sampling frequencies, redesigning the analog front endof both channels to also include different gains to the channels,more external memory, a DDS, and some analog circuitry toself-generate the stimulus sine signal.

REFERENCES

[1] F. Caetano, J. Mata, J. Fareleira, C. Oliveira, and W. Wakeman, “Vis-cosity measurements of liquid toluene at low temperatures using a dualvibrating-wire technique,” Int. J. Thermophys., vol. 25, no. 1, pp. 1–11,Jan. 2004.

[2] B. Chachulski, J. Gêbicki, G. Jasiñski, P. Jasiñski, and A. Nowakowski,“Properties of a polyethyleneimine-based sensor for measuring mediumand high relative humidity,” Meas. Sci. Technol., vol. 17, no. 1, pp. 12–16,Jan. 2006.

[3] P. Arpaia, F. Clemente, and A. Zanesco, “Low-invasive diagnosisof metallic prosthesis osseointegration by electrical impedance spec-troscopy,” IEEE Trans. Instrum. Meas., vol. 56, no. 3, pp. 784–789,Jun. 2007.

[4] J. Hoja and G. Lentka, “Method using bilinear transformation for mea-surement of impedance parameters of a multielement two-terminal net-work,” IEEE Trans. Instrum. Meas., vol. 57, no. 8, pp. 1670–1677,Aug. 2008.

[5] T. Radil, P. M. Ramos, and A. C. Serra, “Impedance measurement withsine-fitting algorithms implemented in a DSP portable device,” IEEETrans. Instrum. Meas., vol. 57, no. 1, pp. 197–204, Jan. 2008.

[6] E. Angelini, A. Carullo, S. Corbellini, F. Ferraris, V. Gallone, S. Grassini,M. Parvis, and A. Vallan, “Handheld-impedance-measurement systemwith seven-decade capability and potentiostatic function,” IEEE Trans.Instrum. Meas., vol. 55, no. 2, pp. 436–441, Apr. 2006.

[7] IEEE Standard for Digitizing Waveform Records, IEEE Std. 1057-1994,Dec. 1994.

[8] P. M. Ramos and A. C. Serra, “A new sine-fitting algorithm for accurateamplitude and phase measurements in two channel acquisition systems,”Meas., vol. 41, no. 2, pp. 135–143, Feb. 2008.

[9] P. M. Ramos and A. C. Serra, “Impedance measurement using multi-harmonic least-squares waveform fitting algorithm,” Comput. StandardsInterfaces, vol. 30, no. 5, pp. 323–328, Jul. 2008.

[10] M. F. da Silva, P. M. Ramos, and A. C. Serra, “A new four parameter sinefitting technique,” Meas., vol. 35, no. 2, pp. 131–137, Mar. 2004.

[11] T. Z. Bilau, T. Megyeri, A. Sárhegyi, J. Márkus, and I. Kollár, “Fourparameter fitting of sine wave testing results: Iteration and convergence,”Comput. Standards Interfaces, vol. 26, no. 1, pp. 51–56, Jan. 2004.

[12] F. M. Janeiro and P. M. Ramos, “Impedance measurements using ge-netic algorithms and multiharmonic signals,” IEEE Trans. Instrum. Meas.,vol. 58, no. 2, pp. 383–388, Feb. 2009.

[13] S. L. Marple, Jr., Digital Spectral Analysis With Applications.Englewood Cliffs, NJ: Prentice–Hall, 1987.

[14] F. M. Janeiro, P. M. Ramos, M. Tlemçani, and A. C. Serra, “Analysis ofa non-iterative algorithm for the amplitude and phase difference estima-tion of two acquired sinewaves,” in Proc. XVIII IMEKO World Congr.,Rio de Janeiro, Brazil, Sep. 2006.

[15] A. Fitzgibbon, M. Pilu, and R. Fischer, “Direct least squares fittingof ellipses,” in Proc. 13th Int. Conf. Pattern Recog., Vienna, Austria,Sep. 1996, pp. 253–257.

[16] R. Halír and J. Flusser, “Numerically stable direct least squares fitting ofellipses,” in Proc. WSCG, Feb. 1998, pp. 125–132.

[17] P. M. Ramos, F. M. Janeiro, M. Tlemçani, and A. C. Serra, “Implemen-tation of a DSP based impedance measurement instrument using ellipsefitting algorithms,” in Proc. 15th IMEKO TC4 Symp. Novelties Elect.Meas. Instrum., Iasi, Romania, Sep. 2007, pp. 492–497.

[18] P. M. Ramos, F. M. Janeiro, M. Tlemçani, and A. C. Serra, “Uncertaintyanalysis of impedance measurements using DSP implemented ellipse fit-ting algorithms,” in Proc. IEEE I2MTC, Victoria, BC, Canada, May 2008,pp. 463–467.

[19] Agilent 4294A, Precision Impedance Analyzer, Datasheet, Jan. 2003.[Online]. Available: http://www.agilent.com

[20] Y. Amemiya and W. A. Fuller, “Estimation for the nonlinear functional-relationship,” Ann. Stat., vol. 16, no. 1, pp. 147–160, Mar. 1988.

[21] Guide to the Expression of Uncertainty in Measurement, ISO, Geneva,Switzerland, 1995.

Pedro M. Ramos (M’02) was born in Lisbon,Portugal, on November 23, 1972. He received theElectrical and Computer Engineering Diploma andthe M.Sc. and Ph.D. degrees in electrical and com-puters engineering from Instituto Superior Técnico(IST), Technical University of Lisbon (UTL) in1995, 1997, and 2001, respectively.

Since 1999, he has been a member of the Teachingand Research Staff with the IST/UTL. Since 1995,he has been with the Instituto de Telecomunicações,Lisbon, where he is currently a member of the In-

strumentation and Measurement Research Line. His current research interestsinclude impedance measurements, sine-fitting algorithms, automatic measure-ment systems, and power-quality monitoring/measurements.

Page 10: Recent Developments on Impedance Measurements With DSP-Based Ellipse-Fitting Algorithms

RAMOS et al.: DEVELOPMENTS ON IMPEDANCE MEASUREMENT WITH DSP-BASED ELLIPSE-FITTING ALGORITHM 1689

Fernando M. Janeiro (M’04) was born in Almada,Portugal, on June 16, 1974. He received the Diplomaand the Ph.D. degree in electrical and computerengineering from Instituto Superior Técnico (IST),Technical University of Lisbon (UTL), Lisbon,Portugal, in 1997 and 2004, respectively.

Since 2001, he has a member of the Teachingand Research Staff with the Universidade de Évora,Évora, Portugal, where he is currently an AssistantProfessor with the Department of Physics. Since1997, he has been with Instituto de Telecomuni-

cações, Lisbon, where he is currently a member of the Instrumentation andMeasurement Research Line. His current research interests include impedancemeasurements, sine-fitting algorithms, power-quality measurements, and envi-ronmental measurement systems.

Mouhaydine Tlemçani was born in Azrou,Morocco, in 1966. He received the M.Sc. degreein electrical engineering from Slovak TechnicalUniversity, Bratislava, Slovak Republic, in 1992 andthe Ph.D. degree from the Universidade de Évora,Évora, Portugal, in 2007.

He is currently an Assistant Professor of instru-mentation and control theory with the Departmentof Physics, Universidade de Évora. He is also a FullMember of the Centro de Geofisica de Évora and aCollaborator with the Instituto de Telecomunicações,

Lisbon, Portugal. His current research interests include electrical measure-ments, signal processing, and nonlinear dynamics.

A. Cruz Serra (M’00–SM’03) was born inCoimbra, Portugal, on December 17, 1956. He re-ceived the Electrotechnical Engineering Diplomafrom the University of Oporto, Oporto, Portugal, in1978 and the M.Sc. and Ph.D. degrees in electri-cal and computers engineering from Instituto Supe-rior Técnico (IST), Technical University of Lisbon,Lisbon, Portugal, in 1985 and 1992, respectively.

Since 1978, he has been a member of the Teach-ing and Research Staff with the IST, where he iscurrently a Full Professor of instrumentation and

measurement. Since 1994, he has been with the Instituto de Telecomunicações,Lisbon, where he is currently a member of the Instrumentation and Measure-ment Research Line. His current research interests include electrical measure-ments, analog-to-digital converter modeling, testing and standardization, andautomatic measurement systems.