# HW 04 Solutions

1.  (a) output is 0-5 V

(b) best DAS input range would be 0-10 V, there will be clipping otherwise.

(c) Pressure transducer has 3 sources of elemental uncertainties: linearity, repeatability, and hysterisis.  We will use the RSS of the 3 elemental uncertainties to find the uncertainty in the pressure transducer.

first we have to select a common unit to work with for the pressure transducer 
and the DAS.  Because the uncertainty in the PT are given in full scale (FS), it is preferrable to work in absolut voltages.


```python
import numpy
# Pressure transducer
FS_PT = 5 # V

u_PT_lin = 0.0025 * FS_PT # V
u_PT_rep = 0.0006 * FS_PT # V
u_PT_hys = 0.001 * FS_PT # V
print("linearity %1.4f" % u_PT_lin, 'V')
print( "repeatability %1.4f" % u_PT_rep, 'V')
print("hysterisi %1.4f" % u_PT_hys, 'V')
u_PT = numpy.sqrt(u_PT_lin**2 + u_PT_rep**2 + u_PT_hys**2)
print("Uncertainty of pressure transducer, u_PT = %1.4f" % u_PT , ' V')

# DAS
N = 16 # bits
Range = 10 # V, guarantee no clipping
Q = Range/2**(N+1) # V
LSD = 2 * Q # V
u_DAS_lin = 2 * LSD # V
u_DAS_gain = 2 * LSD # V
u_DAS = numpy.sqrt(u_DAS_lin**2 + u_DAS_gain**2 + Q**2)
print("linearity %1.6f" % u_DAS_lin, ' V')
print("gain %1.6f" % u_DAS_gain, ' V')
print("quantization error %1.6f" % Q, ' V')

print("Uncertainty of DAS %1.6f" %u_DAS, ' V')
```

    linearity 0.0125 V
    repeatability 0.0030 V
    hysterisi 0.0050 V
    Uncertainty of pressure transducer, u_PT = 0.0138  V
    linearity 0.000305  V
    gain 0.000305  V
    quantization error 0.000076  V
    Uncertainty of DAS 0.000438  V


(d)  We use of the RSS of the PT and DAS to find the overall uncertainty of the system


```python
u_overall = numpy.sqrt(u_PT**2 + u_DAS**2)
print("overall uncertainty %1.6f" %u_overall, ' V')
```

    overall uncertainty 0.013800  V


(e) The overall uncertainty is dominated by the pressure transducer.  I would try and replace it.

2. The overall accuracy is the RSS of the thermocouple and its display.  I would compute and report the uncertainties in $^\circ C$.


```python
u_TC = 0.5 # C
u_display = 0.5 # C
u_overall_TC = numpy.sqrt(u_TC**2 + u_display**2)
print("overall uncertainty is %1.4f" % u_overall_TC, 'C')
```

    overall uncertainty is 0.7071 C


3. (a) Remember the ideal gas law:
\begin{align}
\rho = \frac{P}{RT} = P^1 R^{-1} T^{-1}
\end{align}
The ideal gas constant $R$ is very well known and we can assume it is know perfectly (ie its uncertainty is negligible).

Using uncertainty of a result, one has:
\begin{align}
\frac{u_\rho}{\rho} = \sqrt{\left( 1 \cdot \frac{u_P}{P}\right)^2 + \left( -1 \cdot \frac{u_T}{T} \right)^2}
\end{align}
I need to select a unit for this analysis.  I will work as percentage error, which is ideal for the relative uncertainties I am using here, and convert to the appropriate unit when necessary.


```python
u_PP = 0.005 # relative
u_T = 1 # K
T = 288 # temperature is the thermodynamic temperature in Kelvin
u_rhorho = numpy.sqrt(u_PP**2 + (u_T/T)**2)

print("relative temperature uncertainty %1.4f" % (u_T/T*100), '%')
print("relative uncertainty on density %1.4f" % (u_rhorho*100), ' %')
```

    relative temperature uncertainty 0.3472 %
    relative uncertainty on density 0.6087  %


(b)  If we increase the accuracy of the temperature measurement from $\pm 1^\circ C$ to $\pm 0.5^\circ C$, our relative error on temperature measurement is now halved, or $\pm 0.1736\%$, so we have hope to meet our resolution target on the density.  To solve this optimization problem, the trick is not to inverse the governing equation (the result) first, but to invert the uncertainty of a result equation...

Starting from the equation above and taking the square of it:
\begin{align}
\left( \frac{u_\rho}{\rho} \right)^2 & = \left( \frac{u_P}{P}\right)^2 + \left( \frac{u_T}{T} \right)^2  \\
\left( \frac{u_P}{P}\right)^2 & = \left( \frac{u_\rho}{\rho} \right)^2 - \left( \frac{u_T}{T} \right)^2  
\end{align}


```python
u_TT = 0.5/288 # relative
u_rhrh = 0.0025 # relative

u_PP2 = numpy.sqrt(u_rhrh**2 - u_TT**2)
print("Relative pressure uncertainty must be no larger than %1.4f" % (u_PP2*100), '%')
```

    Relative pressure uncertainty must be no larger than 0.1799 %



```python

```

31cb2e20e93c08d7b2d58002c96ad7c8ae42c48b
ipynb
Jupyter Notebook
HWs/HW04_solutions.ipynb
Dan-Hunt-r/GWU-MAE3120_2022
fe5e9f6b4f6e0bbc741901e3e812d7d6dcc4a0ed
BSD-3-Clause
2022-01-11T17:38:12.000Z
2022-02-05T05:02:50.000Z
HWs/HW04_solutions.ipynb
Dan-Hunt-r/GWU-MAE3120_2022
fe5e9f6b4f6e0bbc741901e3e812d7d6dcc4a0ed
BSD-3-Clause
HWs/HW04_solutions.ipynb
Dan-Hunt-r/GWU-MAE3120_2022
fe5e9f6b4f6e0bbc741901e3e812d7d6dcc4a0ed
BSD-3-Clause
2022-01-13T17:55:14.000Z
2022-03-24T14:41:03.000Z
Qwen/Qwen-72B
1. YES
2. YES