You are on page 1of 7

PERFORM ALL TASKS IN GROUP

Introduction
For this Problem-Based Learning activity, you and your colleagues represent a group
of electrical engineers commissioned by Tenaga Nasional Berhad (TNB) to develop
a new digital smart meter for measuring electricity consumption in a household
subscribed to a single-phase supply.

Your group has come up with a proof-of-concept design for the smart meter and is
now in the unit test phase. For this Problem-Based Learning (PBL) session, you are
tasked with two:
1. Propose an estimator of the voltage RMS
2. Compare the results of the unit test with a reference reading
Task 1
To read a voltage, the digital smart meter needs to sample the voltage from the
incoming AC supply line. It is typical to adapt the line voltage (230 V RMS, 50 Hz) to
a much lower voltage (0 – 5 V, 50 Hz) that can be used with a microcontroller
system. The adaptation scheme is given as in Figure 1.

R1
To microcontroller ADC

9 V RMS
230 V RMS

0–5V
s(t)
U(t) R2
AC Supply
Internal bias
voltage generator
10 μF

Vbias
2.5 V Microcontroller ground

Figure 1: AC voltage measurement adaptation scheme for microcontrollers

The bias voltage 𝑉bias is used to bring the ‘zero level’ up to 2.5 V so that the input
voltage can vary from 0 V to 5 V.

The microcontroller is programmed to capture a full sinusoidal waveform at 1000


samples per seconds. An example of supply voltage, adapted voltage and captured
data can be visualized as in Figure 2. The data of the blue points are provided in the
file signal.csv.
Figure 2: Voltage measurement visualization. The supply voltage is given in blue, and the voltage at
the microcontroller input is in orange. The blue dots represent the eventual samples obtained from
the analog-to-digital converter.

Recall that a sinusoid is written mathematically as

𝑈(𝑡) = 𝐴0 cos(2𝜋𝑓0 𝑡 − 𝜙0 )

Where cos is the cosine function. We assume for simplicity that the frequency 𝑓0 =
50 Hz and the phase 𝜙0 = 0 radian. The objective of this task will be to estimate 𝐴0 ,
the sinusoid amplitude, from which the root-mean-square value is obtained

𝐴0
RMS =
√2

Note that there are two stages that step the voltage down from 230 V RMS to the
desired voltage:
1. The transformer ratio 𝑀 = 25.556
2. The resistor divider ratio 𝛼 = 0.1964

The voltage at the input of the microcontroller can be described as


1
𝑠(𝑡) = ⋅ 𝛼 ⋅ 𝑈(𝑡) + 𝑉bias + 𝑤(𝑡)
𝑀

and after analog-to-digital conversion, as

1
𝑠[𝑘] = ⋅ 𝛼 ⋅ 𝑈[𝑘] + 𝑉bias + 𝑤[𝑘]
𝑀

a) Develop the least-squares estimator of 𝐴0 . Refer to the Appendix for some


help on this matter.
(8 marks)
b) Analyse the effect of estimation when the frequency 𝑓0 of the proposed model
𝐻 varies between 45 Hz until 65 Hz.
(2 marks)
Task 2
The results of the unit test are presented in results.csv. The file results-
ref.csv contains the result of a reference device used undergoing the exact same
tests. A total of 24 trials were performed. Table I details the headers of the data
present within the two files above.

TABLE I: DATA HEADERS


results.csv results-ref.csv

Primary Voltage Primary Current Power factor (𝜑) Power factor (𝜑ref )
RMS (V) RMS (A)
<data1> <data1> <data1> <data1>
<data2> <data2> <data2> <data2>
⋮ ⋮ ⋮ ⋮

A typical procedure to compare test data agreement between two devices is the
Bland-Altman analysis. It provides a graphical and quantitative analysis of the error
between the methods by plotting the average of two matched measures against the
difference of these measures. In theory, the average and difference of the measures
should not present any correlation. Figure 3 illustrates the case of ideal and non-
ideal outcome of the Bland-Altman analysis.

a) Calculate the average and the difference of the readings of the power factor
(3 marks)
b) Display the Bland-Altman plot for the power factor
(2 marks)
c) Observe the plot and propose a reason for such observation. You should
support your proposal by analysing the plot and determine some statistics
(e.g. correlation).
(5 marks)
Deliverables
On the day of the PBL session, the following items are required for grading
• Presentation of the results of both Tasks. Present only a summary of the
result.
• One (1) short report (<12 pages) detailing your works. The report should be
well-written and thorough: make sure you do your research!

Figure 3: Scatter plot of some data comparing two measurement methods A and B, and the
respective Bland-Altman plot. The top two graphs show the normal case where method A and B
matches or ‘agrees’ with each other. The bottom two graphs show an abnormal case where they do
not.

Appendix: Least-square estimation


Suppose that you observe some data 𝑦 arranged in a column vector of 𝑁 observed

data samples. We first propose an observation model, for example


𝐴
𝑦 = 𝐴𝑥 + 𝐵𝟙 + 𝑤 = [𝑥 𝟙] [ ] + 𝑤 = 𝐻𝜃 + 𝑤
𝐵
where 𝑤 is the vector of uncertainty or noise observed from each sample.

The least-squares estimation principle relies on the minimization of the cost function
T
𝐽(𝜃) = (𝑦 − 𝐻𝜃) (𝑦 − 𝐻𝜃)

By developing the expression above and taking a partial derivative with respect to
the unknown 𝜃, one can obtain the following least-square estimator
𝜃̂ = (𝐻 T 𝐻)−1 𝐻 T 𝑦

The formula holds for any linear model 𝐻𝜃 = ℎ0 θ0 + ⋯ + ℎ𝑀−1 θ𝑀−1 .

You might also like