{
 "metadata": {
  "name": "",
  "signature": "sha256:ea707a0cc7de0224e885823c97ef777e5b813dde41f39951ee0ed1ad37c83a74"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter7 - Low, High and Precise Resistance Measurements"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.1 - page7-24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Resistance\n",
      "#Given data :\n",
      "R1=5.0 # in kohm\n",
      "R2=7.0 # in kohm\n",
      "R3=10.0  # in kohm\n",
      "Rx=(R2*R3)/R1 \n",
      "print \"Unknown resistance, Rx = \", Rx,\" kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown resistance, Rx =  14.0  kohm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.2 - page7-24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Current\n",
      "#Given data :\n",
      "R1=1.5 # in kohm\n",
      "R2=3.0 # in kohm\n",
      "R3=5.0  # in kohm\n",
      "R4=14.0 #in kohm\n",
      "Rg=250.0 #in ohm\n",
      "E=10.0 #in V\n",
      "Vd=(E*R4)/(R2+R4) \n",
      "Vc=(E*R3)/(R1+R3) \n",
      "E_th=E*((R4/(R2+R4))-(R3/(R1+R3))) \n",
      "R_th=((R1*R3)/(R1+R3))+((R2*R4)/(R2+R4)) \n",
      "Ig=(E_th/((R_th*10**3)+Rg))*10**6 \n",
      "print \"Current, Ig = \",round(Ig,2),\" micro A\"\n",
      "# answer is wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current, Ig =  140.15  micro A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.3 - page7-26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Deflection\n",
      "#Given data :\n",
      "s=8 #sensivity in mm/micro A\n",
      "R1=1.0 # in kohm\n",
      "R2=5.0 # in kohm\n",
      "R3=2.0  # in kohm\n",
      "R4=10.0 #in kohm\n",
      "Rg=150.0 #in ohm\n",
      "E=6.0 #in V\n",
      "r=10.0 # unbalance resistance in ohm\n",
      "del_r=10.0 # in kohm\n",
      "R4_1=((R4*10**3)+r)*10**-3 \n",
      "Vd=(E*R4_1)/(R2+R4_1) \n",
      "Vc=(E*R3)/(R1+R3) \n",
      "E_th=E*((R4_1/(R2+R4_1))-(R3/(R1+R3))) \n",
      "R_th=((R1*R3)/(R1+R3))+((R2*R4)/(R2+R4)) \n",
      "Ig=(E_th/((R_th*10**3)+Rg))*10**6 \n",
      "d=Ig*s #deflection in mm\n",
      "print \"Deflection is \",round(d,1), \" mm\"\n",
      "#answer is wrong in the textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Deflection is  2.6  mm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.4 - page7-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Current\n",
      "#Given data :\n",
      "R=500.0 #in ohm\n",
      "Rg=150.0 # in ohm\n",
      "del_r=10.0 # in ohm\n",
      "E=6.0 #in V\n",
      "E_th=(E*del_r)/(4*R) \n",
      "R_th=R \n",
      "Ig=(E_th/(R_th+Rg))*10**6 \n",
      "print \"Current, Ig = \", round(Ig,3), \"micro A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current, Ig =  46.154 micro A\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.5  page7-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Supply voltage\n",
      "#Given data :\n",
      "R=120.0 #in ohm\n",
      "del_r=1.0 # in ohm\n",
      "E_th=10*10**-3 #in V\n",
      "E=(E_th*4*R)/del_r \n",
      "print \"Supply voltage, E = \", E,\" V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Supply voltage, E =  4.8  V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.6 - page7-30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Resistance\n",
      "#Given data :\n",
      "A=100.24 # in ohm\n",
      "B=200.0 # in ohm\n",
      "a=100.31 # in ohm\n",
      "b=200.0 # in ohm\n",
      "S=100.03 # in micro ohm\n",
      "r=700.0 # in micro ohm\n",
      "X=((A/b)*S)+(((r*b)/(r+a+b))*((A/B)-(a/b))) \n",
      "print \"Unknown resistance, X = \", round(X,2), \"micro ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown resistance, X =  50.09 micro ohm\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.7 - page7-31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Deflection\n",
      "#Given data :\n",
      "R_ab=100.0 # in ohm\n",
      "R_bc=500.0 # in ohm\n",
      "R_cd=1000.0 # in ohm\n",
      "R_da=200.0 # in ohm\n",
      "V=10.0 \n",
      "VRg=200. # in ohm\n",
      "del_CD=10.0 # in ohm\n",
      "V_bd=V*((R_ab/(R_ab+R_bc))-(R_da/(R_da+R_cd+del_CD))) \n",
      "R_bd=(((R_ab*R_bc)/(R_ab+R_bc))+((VRg*(R_cd+del_CD))/(VRg+R_cd+del_CD))) \n",
      "I_G=(V_bd/(R_bd+VRg)) \n",
      "s=5 #sensivity in micro A/mm\n",
      "dg=I_G*10**6*s #deflection in mm\n",
      "print \"Deflection is \",round(dg,0),\" mm\"\n",
      "#answer is wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Deflection is  153.0  mm\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.8 - page7-32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#LIMITING VALUE OF RESISTANCE\n",
      "P=100.0 #OHMS\n",
      "Q=P \n",
      "S=230.0 #IN ohm\n",
      "DP=0.02 #ERROR IN PERCENTAGE\n",
      "DS=0.01 #IN PERCENTAGE\n",
      "R=(P/Q)*S #unknown resistance in ohms\n",
      "dr=(DP+DP+DS) #relative limiting error in unknow resistance in percentage \u00b1\n",
      "drm=(dr/100)*R #magnitude of error\n",
      "R1=R+drm #in ohms\n",
      "R2=R-drm #in ohms\n",
      "print \"Limiting value of unknow resistance is \", R2, \" ohm to \", R1, \" ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Limiting value of unknow resistance is  229.885  ohm to  230.115  ohm\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.9 - page7-33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Insulation resistance of cable\n",
      "t=120.0 #in seconds\n",
      "v1=300.0 #in volts\n",
      "v2=100.0 #in volts\n",
      "c=300.0 #capacitance in pf\n",
      "r=t/(c)/math.log(v1/v2)#resistance in Mohm\n",
      "print \"Resistance of cable is \", round(r,3),\" Mohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of cable is  0.364  Mohm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.10 - page7-33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Resistance \n",
      "g=2000.0 #in ohms\n",
      "s=10.0 #in kohm\n",
      "q1=40.0 #divisions\n",
      "q2=46.0 #divisions\n",
      "r=((q1/q2)*((s*10**3)+(g)))-g #in ohms\n",
      "print \"Unknown resistance is \",round(r,2),\" ohm\"\n",
      "#answer is wrong in the textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown resistance is  8434.78  ohm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.11 - page7-34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Resistance \n",
      "t=200.0 # in V\n",
      "i=0.5 #in A\n",
      "ra=10.0 #in ohm\n",
      "x=t/i #in ohm\n",
      "r=x-ra #in ohm\n",
      "print \"Unknown resistance is \",r,\" ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown resistance is  390.0  ohm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5.12 - page7-34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ammeter and voltmeter readings\n",
      "t=200.0 # in V\n",
      "i=0.5 #in A\n",
      "ra=10.0 #in ohm\n",
      "x=t/i #in ohm\n",
      "r=x-ra #in ohm\n",
      "sv=10 #sensivity in kohms / V\n",
      "v=1000 #in V\n",
      "rv=v*sv *10**-6 # in Mohm\n",
      "rp=((rv*10**6)*r)/(rv*10**6+r) #in ohm\n",
      "vr=((t*rp)/(ra+rp)) #voltmeter reading in V\n",
      "vi=vr/rp #ammeter rading in A\n",
      "print \"Voltmeter reading is \",round(vr,2),\" V\"\n",
      "print \"Ammeter rading is \",round(vi,5),\" A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltmeter reading is  194.81  V\n",
        "Ammeter rading is  0.51899  A\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}