{
 "metadata": {
  "name": "",
  "signature": "sha256:3272b71267bbacf52f9c327ed8b09b4bccad5d41aa103777487106ade1397663"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter15:Electronic Instruments"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 512"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate shunt resistance and multiplying factor\n",
      "#given\n",
      "Im=5.*10.**-3.;#A\n",
      "Rm=20.;#ohm\n",
      "I=5.;#A\n",
      "Rsh=Rm*Im/(I-Im);\n",
      "n=I/Im;\n",
      "print '%s %.5f %s' %(\"Shunt resistance =\",Rsh,\"ohm\\n\");\n",
      "print '%s %.f %s' %(\"Multiplying factor =\",n,\"\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistance = 0.02002 ohm\n",
        "\n",
        "Multiplying factor = 1000 \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 512"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate shunt resistance\n",
      "#given\n",
      "#At I= 1 mA\n",
      "I1=1.*10.**-3.;#A\n",
      "Im=0.1*10.**-3.;#A\n",
      "Rm=500.;#ohm\n",
      "Rsh=Rm*Im/(I1-Im);\n",
      "print '%s %.4f %s' %(\"Shunt resistance =\",Rsh,\"ohm\\n\");\n",
      "\n",
      "\n",
      "#At I= 1 mA\n",
      "I2=10.*10.**-3.;#A\n",
      "Rsh=Rm*Im/(I2-Im);\n",
      "print '%s %.4f %s' %(\"Shunt resistance =\",Rsh,\"ohm\\n\");\n",
      "\n",
      "\n",
      "#At I= 1 mA\n",
      "I3=100.*10.**-3.;#A\n",
      "Rsh=Rm*Im/(I3-Im);\n",
      "print '%s %.4f %s' %(\"Shunt resistance =\",Rsh,\"ohm\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistance = 55.5556 ohm\n",
        "\n",
        "Shunt resistance = 5.0505 ohm\n",
        "\n",
        "Shunt resistance = 0.5005 ohm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 514"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Caluclate the series resistance to convert it into voltmeter\n",
      "#given\n",
      "Im=100.*10.**-6.;#A\n",
      "Rm=100.;#ohm\n",
      "V=100.;#V\n",
      "Rs=V/Im-Rm;\n",
      "print '%s %.1f %s' %(\"The value of series resistance is\",Rs/1000,\"kohm\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of series resistance is 999.9 kohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 515"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate multiplier resistance and voltage multiplying factor\n",
      "#given\n",
      "Im=50.*10.**-6.;#A\n",
      "Rm=1000.;#ohm\n",
      "V=50.;#V\n",
      "Rs=V/Im-Rm;\n",
      "print '%s %.f %s' %(\"The value of multiplier resistance is\",Rs/1000,\"kohm\\n\");\n",
      "Vm=Im*Rm;\n",
      "n=V/Vm;\n",
      "print '%s %.f %s' %(\"Voltage multiplying factor =\",n,\"\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of multiplier resistance is 999 kohm\n",
        "\n",
        "Voltage multiplying factor = 1000 \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 518"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate reading and error of each voltmeter\n",
      "#given\n",
      "def  prll(r1,r2):\n",
      "\tz=r1*r2/(r1+r2)#\n",
      "\treturn z\n",
      "S_A=1000.;# ohm/V#sensitivity\n",
      "S_B=20000.;# ohm/V#sensitivity\n",
      "R=50.;#V#range of voltmeter\n",
      "Vs=150.;#V#Supply\n",
      "R1=100.*10.**3.;#ohm\n",
      "R2=50.*10.**3.;#ohm\n",
      "Vt=Vs*(R2/(R1+R2));\n",
      "\n",
      "#Voltmeter A\n",
      "Ri1=S_A*R;\n",
      "Rxy_A=prll(Ri1,R2);      #total resistance at X and Y\n",
      "V1=Vs*(Rxy_A/(Rxy_A+R1));\n",
      "print '%s %.f %s' %(\"The voltmeter indicates\",V1,\"V\\n\");\n",
      "\n",
      "#Voltmeter B\n",
      "Ri2=S_B*R;\n",
      "Rxy_B=prll(Ri2,R2);      #total resistance at X and Y\n",
      "V2=Vs*(Rxy_B/(Rxy_B+R1));\n",
      "print '%s %.2f %s' %(\"The voltmeter indicates\",V2,\"V\\n\");\n",
      "\n",
      "e1=(Vt-V1)*100./Vt;\n",
      "e2=(Vt-V2)*100./Vt;\n",
      "print '%s %.f %s' %(\"The error in the reading of voltmeter A =\",e1,\"percent\\n\");\n",
      "print '%s %.2f %s' %(\"The error in the reading of voltmeter A =\",e2,\"percent\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltmeter indicates 30 V\n",
        "\n",
        "The voltmeter indicates 48.39 V\n",
        "\n",
        "The error in the reading of voltmeter A = 40 percent\n",
        "\n",
        "The error in the reading of voltmeter A = 3.23 percent\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 531"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine rms value of the ac voltage\n",
      "#given\n",
      "import math\n",
      "l=8.3;#cm#length of the trace\n",
      "D=5.;# V/cm#deflection sensitivity\n",
      "Vpp=l*D;\n",
      "Vrms=Vpp/(2.*math.sqrt(2.));\n",
      "print '%s %.1f %s' %(\"The rms value of the ac voltage\",Vrms,\"V\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rms value of the ac voltage 14.7 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 531"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine rms value and frequency of the sine voltage\n",
      "#given\n",
      "import math\n",
      "l=3.5;#cm         #length of the trace\n",
      "D=2.;# V/cm        #deflection sensitivity\n",
      "Vpp=l*D;\n",
      "Vrms=Vpp/math.sqrt(2.);\n",
      "print '%s %.2f %s' %(\"The rms value of the sine voltage =\",Vrms,\"V\\n\");\n",
      "x=4.;#cm #one cycle length on x axis\n",
      "t=0.5*10.**-3.;# s/cm    #timebase setting\n",
      "T=x*t;\n",
      "f=1./T;\n",
      "print '%s %.1f %s' %(\"The frequency of the sine voltage =\",f/1000,\"kHz\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rms value of the sine voltage = 4.95 V\n",
        "\n",
        "The frequency of the sine voltage = 0.5 kHz\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}