{ "metadata": { "name": "", "signature": "sha256:d75e4cfd03813a2ebb58ae96e012a8b8020f7dffa90e8d93acabe5330e357932" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Chapter 8:Fundamentals of measuring instruments

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.1, Page Number: 507

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Flux Density B= 15.5 mT" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.2, Page Number: 508

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "% error in I^2 = \u00b1 10%\n", "% error in Power = \u00b1 20%" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.3, Page Number: 508

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "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", "metadata": {}, "source": [ "

Example 8.4, Page Number:508

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(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", "metadata": {}, "source": [ "

Example 8.5, Page Number:

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A=0.456\n", "\n", "Error = 54.37%" ] } ], "prompt_number": 5 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.6, PAge Number: 510

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "y(t)at t=2 will be y(t)=0.632" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.7, Page Number: 510

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(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", "metadata": {}, "source": [ "

Example 8.8, Page Number: 511

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Damping coefficient = 0.924\n", "Natural frequency of Oscillation = 1.732" ] } ], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.9, Page Number: 512

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A=K/500\n", "% error = 99.8%\n", "fi = -173.14\u00b0" ] } ], "prompt_number": 9 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8.10, Page Number: 512

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\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", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "(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": {} } ] }