# 07 Uncertainty Analysis

accuracy of pressure transducer $\pm 0.25 \%$ FS or $\pm 0.25 \%$ of reading.

Full scale 0-100 bar:

$\pm 0.25 \%$ of reading, and I read 1 bar, $u_P = 0.0025 \times P$, ie, 0.0025 bar.  If $P = 10$ bar, $u_P = 0.025$ bar.

$\pm 0.25 \%$ FS (full scale), independent of $P$ measured, $u_P = 0.25\% \times full scale$.  ie $u_P = 100\times 0.0025 = 0.25$ bar.  If I read 1 bar, $u_P = 0.25 \times P$ = 25\%.  If $P = 10$ bar, $u_P = 0.25$ bar = 2.5\% of reading.

accuracy includes: linearity, hysterisis, and repeatability

Linearity: Perfect sensor is a $0^th$ order sensor: $y(t) = K F(t)$: if $K$ is a constant: linear response of the sensor.  If $K$ is not constant: response is not linear anymore.  Need to calibrate, very, very carefully.

Hysterisis: Sensitivity to direction of excitation, ie loading vs unloading of sensor.

Repeatability: 

$y(t) = K F(t) + a$: $ a$ 0 offset.  due to drift, thermal effects, etc.  We remove it by ``zeroing'' the sensor, ie taking value at 0 input.


## Elemental Uncertainties
Uncertainty due to elemental contributors, $u_i$:
\begin{align}
u_{e} = \sqrt{\sum_i u_i^2}
\end{align}
If you have several components
\begin{align}
u_{overall} & = \sqrt{\sum_{comp} u_{comp}^2}
\end{align}

### Pressure Regulator Calibration 

It is desired to use an Equilibar pressure regulator QPV in gas flow experiment.  The specifications for this regulator are:
(https://www.equilibar.com/electronic-pressure-regulators/)

> accuracy = .25%FS

> repeatability = 0.02%FS

However, the pressure regulator accuracy is too low for our application and one decides to calibrate it with a pressure transducer that has an accuracy of 0.04 % of FS.

> What will be the accuracy of the calibrated instrument?

Ucertainty before calibration?

common unit \% FS


```python
import numpy
u_acc = 0.25
u_rep = 0.02
u_e = numpy.sqrt(u_acc**2+u_rep**2)
print('u_e = ',u_e,' %FS')
```

    u_e =  0.25079872407968906  %FS


What if I calibrate?


```python
u_acc_cal = 0.04
u_rep_cal = u_rep
u_e_cal = numpy.sqrt(u_acc_cal**2+u_rep_cal**2)
print('u_e_cal = ',u_e_cal,' %FS')
```

    u_e_cal =  0.044721359549995794  %FS


### Pressure Measurement

A pressure transducer is connected to a digital data-acquisition board on a computer.  The characteristics of the pressure transducer and the data-acquisition system (DAS) are given below.  All uncertainties are given at 95 % confidence level.  

The environment temperature is uncertain by $\pm 10^\circ$C.


> Pressure Transducer Characteristics: 

Range: 0-1,000 kPa 

 Output: 0-5 V 

 Linearity: $\pm 0.25$ %FS 

 Repeatability: $\pm 0.06$ %FS 

 Thermal-stability error: $\pm 0.01$ %FS/$^\circ$C  

> DAS Characteristics:

 Number of bits: 10 bits

 Input range: $0-10,\, 0-1,\, 0-0.1,\, 0-0.01$ V

 Gain error: $\pm 2$ LSD

 Linearity: $\pm 2$ LSD

Overall Uncertainty for measurement: Combination of Pressure Transducer and DAS

\begin{align}
u_{overall} & = \sqrt{\sum_{comp} u_{comp}^2} \\
& = \sqrt{u_{PT}^2 + u_{DAS}^2}
\end{align}

Uncertainty of presssure transducer
\begin{align}
u_{PT} = \sqrt{\sum_i u_i^2}
\end{align}
with $u_i$ elemental error:
> linearity: $\pm 0.25$ %FS 

> repeatability: $\pm 0.06$ %FS 

> Thermal stability: $\pm 0.01$ %FS/$^\circ$C


```python
# U_PT
FS_1 = 1000 #kPa
FS_2 = 5 # V
FS_3 = 100 # %
# here we will work in V, because error %FS, ie fixed V value
# if error % of reading, % would be ok as well.
tempFlu = 10 # degC

u_lin = 0.0025 * FS_2 # V
u_rep = 0.0006 * FS_2 # V
u_th = 0.0001 * FS_2 * tempFlu # V
u_PT = numpy.sqrt(u_lin**2 + u_rep**2 + u_th**2)
print(u_lin, u_rep, u_th)
print(u_PT, ' V')
```

    0.0125 0.0029999999999999996 0.005
    0.013793114224133724  V


LSD: Least Significant Digit

01101: binary word, LSD: bit associated with $2^0$ and MSD (most significant digit): bit associated with $2^{N-1}$ for $N$ bit word.

ie value of the first bin in your digitized word/measurement.

number of bins: $2^N$, $N$: number of bits

size of a bin: resolution, $\Delta V = \frac{V_{max} - V_{min}}{2^N}$


```python
#u _DAS: 3 error sources: DO NOT FORGET QUANTIZATION ERROR

N = 12 # bits
Range = 10 # V, guarantee no clipping
Q = Range/2**(N+1) # V
LSD = 2* Q # V
u_d_lin = 2 * LSD # V
u_d_gain = 2 * LSD # V
u_DAS = numpy.sqrt(u_d_lin**2 + u_d_gain**2 + Q**2)
print(u_d_lin, u_d_gain, Q)
print(u_DAS, ' V')
```

    0.0048828125 0.0048828125 0.001220703125
    0.007012405574387242  V



```python
u_overall = numpy.sqrt(u_PT**2 + u_DAS**2)
print(u_PT, u_DAS)
print(u_overall, ' V')
```

    0.013793114224133724 0.007012405574387242
    0.015473326466526108  V


## Uncertainty of a result

\begin{align}
R = f(x_1, x_2, \dots) \quad u_R = \sqrt{\sum_i \left( u_{x_i} \frac{\partial f}{\partial x_i} \right)^2}
\end{align}

If $f$/ is a polynomial:
\begin{align}
f(x_1, x_2, \dots) =  b \prod_i x_i^{a_i} 
\end{align}

Then the uncertainty reduces to:
\begin{align}
\frac{u_R}{R} = \sqrt{\sum_i \left( a_i \frac{u_{x_i}}{x_i} \right)^2}\end{align}



### Design of experiment

One wishes to determine the heat transfer coefficient, $h$, of a heated rod of length, $L$, and diameter, $D$, in a flow. By applying the first law of thermodynamics one can relate the input power of the experiment, $W$, to
$h$ by:

\begin{align*}
h = \frac{W}{\pi D L \Delta T}, \textrm{where $\Delta$T is the temperature difference between the rod and the surrounding fluid}
\end{align*}

The relative uncertainties are: $\frac{u_L}{L}=0.1\%$, $\frac{u_D}{D}=0.2\%$, $\frac{u_{\Delta T}}{\Delta T} = 1.0\%$.  One wishes to have a maximum relative inaccuracy of 2% of $h$.

What should be the relative accuracy of the power measurements, $u_W/W$?


\begin{align}
h = W^1 \pi^{-1} D^{-1} L^{-1} \Delta T^{-1}
\end{align}

\begin{align}
\frac{u_h}{h} = \sqrt{(1\times \frac{u_W}{W})^2 + (-1 \times \frac{u_D}{D})^2 + (-1 \times \frac{u_L}{L})^2 + (-1 \times \frac{u_{\Delta T}}{\Delta T})^2}
\end{align}

\begin{align}
(\frac{u_W}{W})^2 = (\frac{u_h}{h})^2 - \left( (-1 \times \frac{u_D}{D})^2 + (-1 \times \frac{u_L}{L})^2 + (-1 \times \frac{u_{\Delta T}}{\Delta T})^2 \right)
\end{align}


```python
u_hh = 0.02 
u_DD = 0.002
u_LL = 0.001
u_tt = 0.01
u_ww = numpy.sqrt(u_hh**2 - (u_DD**2 + u_LL**2 + u_tt**2))
                  
print(u_ww)
```

    0.017175564037317667


uncertainty on W should be less than 1.7% at 95% confidence level (2 $\sigma$).


```python

```

060fa5e30e0fbf7decd86872429f3709f11ca525
ipynb
Jupyter Notebook
Lectures/07_UncertaintyAnalysis.ipynb
eiriniflorou/GWU-MAE3120_2022
52cd589c4cfcb0dda357c326cc60c2951cedca3b
BSD-3-Clause
2021-01-13T18:33:24.000Z
2021-01-13T18:33:24.000Z
Lectures/07_UncertaintyAnalysis.ipynb
eiriniflorou/GWU-MAE3120_2022
52cd589c4cfcb0dda357c326cc60c2951cedca3b
BSD-3-Clause
Lectures/07_UncertaintyAnalysis.ipynb
eiriniflorou/GWU-MAE3120_2022
52cd589c4cfcb0dda357c326cc60c2951cedca3b
BSD-3-Clause
2021-01-13T18:18:40.000Z
2021-04-25T19:16:37.000Z
Qwen/Qwen-72B
1. YES
2. YES