## Systematic errors

In the previous post (Feb 10, 2013), I showed how GTC lets you build up an uncertainty calculation step by step. In this post, I will explain how to deal with systematic errors.

### A simple voltmeter

Last time, I used an equation for the reading displayed by the meter $$x_\mathrm{dis}$$ in terms of the actual applied voltage $$V$$ and instrumental errors
$x_\mathrm{dis} = (1 + e_\mathrm{gain}) V + e_\mathrm{zero}$
where, $$e_\mathrm{gain}$$ is the residual error in the gain setting and $$e_\mathrm{zero}$$ is the residual error in the zero offset. I did not include a term for random noise, because that was estimated from a sample of readings. In this post we will add a term for random noise to the model instead. So the model becomes
$x_\mathrm{dis} = (1 + e_\mathrm{gain} + e_\mathrm{ran}) V + e_\mathrm{zero}$
Now, $$e_\mathrm{gain}$$ and $$e_\mathrm{zero}$$ are systematic errors: they endure from one measurement to the next. So, for example, the contribution to uncertainty from random errors can be reduced by averaging readings from the same meter, but not the uncertainty contributions associated with $$e_\mathrm{gain}$$ and $$e_\mathrm{zero}$$.

How can this be handled with GTC?

Simple.

We associate one, and only one, uncertain number with the estimate of any quantity in the meter model. So, there will be one uncertain number for the estimate of $$e_\mathrm{gain}$$ and one for the estimate of $$e_\mathrm{zero}$$, regardless of how many readings are made with the voltmeter.

There will be a different uncertain number for each reading representing the random noise $$e_{\mathrm{ran}\cdot i}$$, because the error changes from one reading to the next.

### A voltage ratio measurement

We will consider a simple measurement in which a resistance value $$R_\mathrm{x}$$ is estimated by measuring a voltage ratio.

The circuit is shown in this figure,

where a single meter is used to measure the potential difference across each resistor. We will just assume that the current through the circuit does not vary.

With $$R_\mathrm{s}$$ known, $$R_\mathrm{x}$$ can be calculated
$R_\mathrm{x} = R_\mathrm{s}\frac{V_\mathrm{x}}{V_\mathrm{s}}$
Suppose that we measure $$V_\mathrm{x} = 4.9885 \, \mathrm{V}$$ and  $$V_\mathrm{s} =5.0100 \, \mathrm{V}$$. Suppose also that $$R_\mathrm{s} = 1000.000 \; u(R_\mathrm{s}) = 1 \times 10^{-3} \, \Omega$$ and that the relative standard uncertainty in the meter gain is  $$u(e_\mathrm{gain}) = 3 \times 10^{-6} \; \mathrm{V}/ \mathrm{V}$$, that the relative standard uncertainty due to meter noise is $$u(e_\mathrm{ran}) = 1 \times 10^{-7} \; \mathrm{V}/ \mathrm{V}$$ and the standard uncertainty in the zero setting is $$u(e_\mathrm{zero}) = 1 \times 10^{-6} \; \mathrm{V}$$.

Common sense tells us that the uncertainty due to gain error cancels when the voltage ration is calculated. So, one might simply ignore that term. The zero setting uncertainty will not have very much effect on the combined uncertainty $$R_\mathrm{s}$$ either.

However, I am not going to make those assumptions. Instead, I will show that GTC arrives at the correct result anyway, with no need to think about simplifying the mathematical model.

I will define uncertain numbers for the estimates of $$R_\mathrm{s}$$, $$V_\mathrm{s}$$ and $$V_\mathrm{x}$$ and then work out
$R_\mathrm{x} = R_\mathrm{s} \frac{V_\mathrm{x}}{V_\mathrm{s}}$
Here is the standard resistance
R_s = 1000 + ureal(0,1E-3,label='R_s')

and here are the voltmeter errors
e_zero = ureal(0,1E-6,label='e_zero')
e_gain = ureal(1,3E-6,label='e_gain')

Uncertain numbers representing the individual voltage measurements are then (note an uncertain number for the meter noise is created independently for each reading)
e_ran_1 = ureal(1,1E-7,label='e_ran_1')
V_s = (5.0100 - e_zero) / (e_gain * e_ran_1)

e_ran_2 = ureal(1,1E-7,label='e_ran_2')
V_x = (4.9885 - e_zero) / (e_gain * e_ran_2)

And the unknown resistance is
R_x = R_s * V_x/V_s

The value, the uncertainty and the uncertainty budget of the result are displayed by
print "R_x = %G, u(R_x) = %G" % (value(R_x), uncertainty(R_x))
for cpt in reporting.budget(R_x,trim=0):
print "%s: %G" % cpt

We obtain the following results:
R_x = 995.709, u(R_x) = 0.00100562
R_s: 0.000995709
e_ran_1: 9.95709E-05
e_ran_2: 9.95709E-05
e_zero: 8.5657E-07
e_gain: 0

As expected, the uncertainty due to an error in the voltmeter gain setting is zero and the uncertainty due to an error in the zero offset is also small. The uncertainty of this measurement is dominated by the standard resistor uncertainty, followed in importance by the meter noise.

Now, suppose that two meters of the same type are used to simultaneously measure $$V_\mathrm{s}$$ and $$V_\mathrm{x}$$. This would ensure that the current flowing in the circuit elements was indeed the same, rather than just assuming it to be constant.

Different meters will have different residual gain and zero setting errors. So the calculation must now define uncertain numbers for each meter.

The code now looks like this
R_s = 1000 + ureal(0,1E-3,label='R_s')

# Meter 1
e_zero_1 = ureal(0,1E-6,label='e_zero_1')
e_gain_1 = ureal(1,3E-6,label='e_gain_1')

# Meter 2
e_zero_2 = ureal(0,1E-6,label='e_zero_2')
e_gain_2 = ureal(1,3E-6,label='e_gain_2')

e_ran_1 = ureal(1,1E-7,label='e_ran_1')
V_s = (5.0100 - e_zero_1) / (e_gain_1 * e_ran_1)

e_ran_2 = ureal(1,1E-7,label='e_ran_2')
V_x = (4.9885 - e_zero_2) / (e_gain_2 * e_ran_2)

# Result
R_x = R_s * V_x/V_s

# Display results
print "R_x = %G, u(R_x) = %G" % (value(R_x), uncertainty(R_x))
for cpt in reporting.budget(R_x,trim=0):
print "%s: %G" % cpt

We obtain the following results:
R_x = 995.709, u(R_x) = 0.0043516
e_gain_1: 0.00298713
e_gain_2: 0.00298713
R_s: 0.000995709
e_zero_2: 0.000199601
e_zero_1: 0.000198744
e_ran_1: 9.95709E-05
e_ran_2: 9.95709E-05

This is quite a different result. The combined standard uncertainty $$u(R_\mathrm{x})$$ is a lot bigger and the gain error uncertainties now dominate the uncertainty budget.

### In summary

Every error in a measurement model has to be estimated in the GUM process of calculating uncertainty. Often residual errors are approximately zero, or unity, but these estimates still carry uncertainty.

Using GTC, every estimate of a quantity in the model is associated with one, and only one, uncertain number. When this rule is understood, GTC can be used to handle quite complicated data processing problems.

The next post will revisit this example. I will show then how object-oriented programming techniques can be used to implement the voltmeter model.