diff options
Diffstat (limited to 'Industrial_Instrumentation/Chapter_8.ipynb')
-rw-r--r-- | Industrial_Instrumentation/Chapter_8.ipynb | 485 |
1 files changed, 485 insertions, 0 deletions
diff --git a/Industrial_Instrumentation/Chapter_8.ipynb b/Industrial_Instrumentation/Chapter_8.ipynb new file mode 100644 index 00000000..8a84dda0 --- /dev/null +++ b/Industrial_Instrumentation/Chapter_8.ipynb @@ -0,0 +1,485 @@ +{ + "metadata": { + "name": "Chapter_8" + }, + "nbformat": 2, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "source": [ + "<h1>Chapter 8:Fundamentals of measuring instruments <h1>" + ] + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.1, Page Number: 507<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Flux density calculation'''", + "", + "#variable declaration", + "fi=10.0*10**-6 # fi-flux", + "inch=2.54*10**-2 # length", + "A=inch**2 # area", + "", + "#calculation", + "B =fi/A", + "", + "#Result", + "print('Flux Density B= %.1f mT'%(B*1000))" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flux Density B= 15.5 mT" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.2, Page Number: 508<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Power Dissipation and accuracy of result'''", + "", + "#variable Declaration", + "i=10*10**-3 # current in A", + "R=1000.0 # resistance in ohm", + "P=(i**2)*R # Power", + "err_R=10.0 # Error in Resistance measurement", + "err_I=(2.0/100)*25*100/10 # Error in current measurement", + "", + "#calculation", + "err_I2=2*err_I", + "err_p=err_I2+err_R", + "", + "#Result", + "print('%% error in I^2 = \u00b1 %d%%\\n%% error in Power = \u00b1 %d%%'%(err_I2,err_p))" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% error in I^2 = \u00b1 10%", + "% error in Power = \u00b1 20%" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.3, Page Number: 508<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''max and min levels of input supply current'''", + "", + "#variable Declaration", + "i1=37.0 # current in branch 1 ", + "i2=42.0 # current in branch 2", + "i3=13.0 # current in branch 3", + "i4=6.7 # current in branch 4", + "", + "#Calculation", + "Imax=(i1+i2)+(i1+i2)*(3.0/100)+(i3+i4)+(i3+i4)*(1.0/100)", + "Imin=(i1+i2)-(i1+i2)*(3.0/100)+(i3+i4)-(i3+i4)*(1.0/100)", + "", + "#result", + "print('Maximum level of total supply current = %.3f mA'%Imax)", + "print('\\nMinimum level of total supply current = %.3f mA'%Imin)" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum level of total supply current = 101.267 mA", + "", + "Minimum level of total supply current = 96.133 mA" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.4, Page Number:508<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Time constant for thermometer'''", + "", + "import math", + "", + "#(a)", + "", + "#variable declaration", + "T=200.0 # intermediate temperature ", + "T0=300.0 # final temperature ", + "Ti=70.0 # initial temperature ", + "t=3.0 # time in seconds ", + "", + "#calculation", + "x=(T-T0)/(Ti-T0)", + "tow=-t/math.log(x)", + "", + "#result", + "print('(a)\\nTime constant tow=%.1f s'%tow)", + "", + "", + "#(b)", + "", + "#variable declaration", + "t1=5.0 # time in seconds ", + "#calculation", + "T5=T0+((Ti-T0)*math.e**(-t1/tow))", + "", + "#result", + "print('\\n(b)\\nTemperature after 5 seconds T5 = %.2f\u00b0C'%T5)" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)", + "Time constant tow=3.6 s", + "", + "(b)", + "Temperature after 5 seconds T5 = 242.61\u00b0C" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.5, Page Number:<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Error calculation of second order instrument'''", + "", + "import math", + "", + "#variable declaration", + "w=9.0 # excitation frequency", + "wn=6.0 # natural frequency", + "dr=0.6 # damping ratio", + "", + "#calculations", + "", + "x=w/wn", + "Ar=1/math.sqrt(((1-(x)**2)**2)+(2*dr*x)**2)", + "err=(1-Ar)*100", + "", + "#Result", + "print('A=%.3f'%Ar)", + "print('\\nError = %.2f%%'%err)" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A=0.456", + "", + "Error = 54.37%" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.6, PAge Number: 510<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Output of first order instrument for unit step input'''", + "", + "#variable Declaration", + "t=2.0 # output to be calculated after t seconds", + "", + "#calculation", + "y=1-math.e**(-(t-1.5)/0.5)", + "", + "#result", + "print('y(t)at t=2 will be y(t)=%.3f'%y)" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y(t)at t=2 will be y(t)=0.632" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.7, Page Number: 510<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Statistic of Temperature readings'''", + "", + "import math", + "", + "#variable declaration", + "", + "#Temperature Readings", + "x1=98.5 # Reading 1", + "x2=99.0 # Reading 2", + "x3=99.5 # Reading 3 ", + "x4=100.0 # Reading 4", + "x5=100.5 # Reading 5", + "x6=101.0 # Reading 6", + "x7=101.5 # Reading 7", + "# Frequency", + "f1=4.0 # Reading 1", + "f2=13.0 # Reading 2", + "f3=19.0 # Reading 3", + "f4=35.0 # Reading 4", + "f5=17.0 # Reading 5", + "f6=10.0 # Reading 6", + "f7=2.0 # Reading 7", + "", + "#(i) Arithmatic Mean", + "", + "#calculation", + "x_bar=((x1*f1)+(x2*f2)+(x3*f3)+(x4*f4)+(x5*f5)+(x6*f6)+(x7*f7))/(f1+f2+f3+f4+f5+f6+f7)", + "", + "#result", + "print('(i)\\n\\tArithmatic Mean = %.2f\u00b0C'%x_bar)", + "", + "#(ii) Average Deviation", + "", + "#calculation", + "D=(abs(x1-x_bar)*f1)+(abs(x2-x_bar)*f2)+(abs(x3-x_bar)*f3)+(abs(x4-x_bar)*f4)", + "D=D+(abs(x5-x_bar)*f5)+(abs(x6-x_bar)*f6)+(abs(x7-x_bar)*f7)", + "D=D/(f1+f2+f3+f4+f5+f6+f7)", + "", + "#result", + "print('\\n(ii)\\n\\tAverage Deviation =%.4f\u00b0C'%D)", + "", + "#Standard deviation", + "", + "#Calculation", + "sigma=((x1-x_bar)**2*f1)+((x2-x_bar)**2*f2)+((x3-x_bar)**2*f3)+((x4-x_bar)**2*f4)", + "sigma=sigma+((x5-x_bar)**2*f5)+((x6-x_bar)**2*f6)+((x7-x_bar)**2*f7)", + "sigma=math.sqrt(sigma)", + "sigma=sigma/math.sqrt(f1+f2+f3+f4+f5+f6+f7)", + "", + "#result", + "print('\\n(iii)\\n\\tStandard deviation = %.3f\u00b0C'%sigma)", + "", + "#variance", + "", + "#result", + "print('\\n(iv)\\n\\tVariance = %.4f\u00b0C'%(sigma**2))", + "", + "#Probable Error", + "", + "#result", + "print('\\n(v)\\n\\tProbable Error= %.4f\u00b0C'%(0.6745*sigma))" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)", + "\tArithmatic Mean = 99.93\u00b0C", + "", + "(ii)", + "\tAverage Deviation =0.5196\u00b0C", + "", + "(iii)", + "\tStandard deviation = 0.671\u00b0C", + "", + "(iv)", + "\tVariance = 0.4501\u00b0C", + "", + "(v)", + "\tProbable Error= 0.4525\u00b0C" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.8, Page Number: 511<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Calculation of damping coefficient and natural frequency for 2nd order instrument'''", + "", + "import math", + "", + "#variable Declaration", + "wn=math.sqrt(3.0) # natural frequency of osscilation", + "", + "#Calculation", + "x=3.2/(2*wn)", + "", + "#Result", + "print('Damping coefficient = %.3f\\nNatural frequency of Oscillation = %.3f'%(x,wn))" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Damping coefficient = 0.924", + "Natural frequency of Oscillation = 1.732" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.9, Page Number: 512<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''calculation of Amplitude inaccuracy and phase shift from transfer function'''", + "", + "import math", + "#variable declaration", + "w=100.0 # natural frequency of osscilation", + "", + "#calculation", + "fi=-math.atan(0.1*w)-math.atan(0.5*w)", + "A=1/(math.sqrt(1+(0.1*w)**2)*(math.sqrt(1+(0.5*w)**2)))", + "A=1*1000.0/math.ceil(1000*A)", + "err=(1-1.0/A)*100", + "", + "#Result", + "print('A=K/%d\\n%% error = %.1f%%\\nfi = %.2f\u00b0'%(A,err,fi*180/math.pi))" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A=K/500", + "% error = 99.8%", + "fi = -173.14\u00b0" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "source": [ + "<h3>Example 8.10, Page Number: 512<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''temperature and altitude calculation from first order thermometer placed in balloon'''", + "", + "#calculations", + "R=0.15*10/50 # Temperature gradient", + "K=1.0 # constant", + "tow=15.0 # time constant ", + "", + "#Calculations", + "deg=K*R*tow", + "", + "#(i)", + "a=15-deg", + "", + "#(ii)", + "alt_red=deg*50.0/0.15", + "h=5000-alt_red", + "", + "#result", + "print('(i)The actual temperature when instrument reads 15\u00b0C is %.2f\u00b0C'%a)", + "print('\\n The true temperature at 5000 metres = %.2f '%a)", + "print('\\n(ii)\\nThe true altitude at which 15\u00b0C occurs is %d metres'%h)" + ], + "language": "python", + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)The actual temperature when instrument reads 15\u00b0C is 14.55\u00b0C", + "", + " The true temperature at 5000 metres = 14.55 ", + "", + "(ii)", + "The true altitude at which 15\u00b0C occurs is 4850 metres" + ] + } + ], + "prompt_number": 10 + } + ] + } + ] +}
\ No newline at end of file |