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