{
 "metadata": {
  "name": "",
  "signature": "sha256:212ce889d9f64f00c714723a9e3110b735cade9ea1d505fecd98a7e24257c63b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter3 - Electromechanical Instruments"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2.1 - page : 3-5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Torque\n",
      "#given data :\n",
      "N=10  # turns\n",
      "L=1.5*10**-2    # in m\n",
      "I=1    # in mA\n",
      "I*=10**-3  #A\n",
      "B=0.5 #  T\n",
      "d=1*10**-2    # in m\n",
      "Td=B*I*L*d*N  # Nm\n",
      "print \"Torque, Td = \", Td,\"Nm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Torque, Td =  7.5e-07 Nm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2. - page : 3-5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# number of turns\n",
      "#given data :\n",
      "import math\n",
      "theta=math.pi/2\n",
      "I=5*10**-3    # in A\n",
      "B=1.8*10**-3    # in Wb/m2\n",
      "C=0.14*10**-6    # in Nm/rad\n",
      "L=15*10**-3    # in m\n",
      "d=12*10**-3    # in m\n",
      "N=(C*theta)/(B*I*L*d)\n",
      "print \"Number of turns, N = \", round(N),\"turns\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of turns, N =  136.0 turns\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2.3 - page : 3-6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# resistance\n",
      "#given data :\n",
      "Tc=240*10**-6    #in Nm\n",
      "N=100  # Turns\n",
      "L=40*10**-3  # in m\n",
      "d=30*10**-3  # in m\n",
      "B=1    #in Wb/m2\n",
      "TdBYI=N*B*L*d\n",
      "I=Tc/TdBYI\n",
      "#voltage per division=I*(R/100)\n",
      "R=100/I  # ohm\n",
      "R*=10**-3  # kohm\n",
      "print \"Resistance, R = \", R,\"kohm\"\n",
      "#UNIT IS GIVEN WRONG FOR THE ANSWER IN THE BOOK."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance, R =  50.0 kohm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2.4 - page : 3-7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# flux density and diameter\n",
      "import math\n",
      "#given data :\n",
      "p=1.7*10**-8    #in ohm-m\n",
      "V=100*10**-3    #in V\n",
      "R=50    # in ohm\n",
      "theta=120    #in degree\n",
      "L=30    # in mm\n",
      "d=25    # in mm\n",
      "N=100\n",
      "C=0.375*10**-6    # in Nm/degree\n",
      "I=V/R  # A\n",
      "Td_By_B=I*L*10**-3*d*10**-3*N\n",
      "Tc=C*theta  # N-m\n",
      "B=Tc/Td_By_B # in Wb/m2\n",
      "print \"The flux density, B = \", B,\"Wb/m2\"\n",
      "Rc=0.3*R\n",
      "Lmt=2*(L+d)\n",
      "a=(N*p*Lmt*10**-3*10**6)/Rc\n",
      "D=(4/(math.pi*a))**(1.0/2)\n",
      "print \"Diameter, D = \", round(D,1),\"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux density, B =  0.3 Wb/m2\n",
        "Diameter, D =  10.1 m\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4.1 - page : 3-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# shunt resistor\n",
      "#given data :\n",
      "Im=3*10**-3    # in A\n",
      "Rm=100    # in ohm\n",
      "I=150*10**-3    #in A\n",
      "Rsh=(Im*Rm)/(I-Im)\n",
      "print \"Shunt resistor, Rsh = \", round(Rsh,2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistor, Rsh =  2.04 ohm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4.2 - page : 3-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# shunt resistormultiplying factor and resistance\n",
      "#given data :\n",
      "Rsh=300    #in ohm\n",
      "Rm=1500    #in ohm\n",
      "m=1+(Rm/Rsh)\n",
      "print \"Multiplying factor, m = \",m\n",
      "m1=40.0\n",
      "Rsh1=Rm/(m1-1)\n",
      "print \"The shunt resistor, Rsh1 = \", round(Rsh1,2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Multiplying factor, m =  6\n",
        "The shunt resistor, Rsh1 =  38.46 ohm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5.1 - page : 3-13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given data :\n",
      "Rm=100.0    # in ohm\n",
      "Im=1.0\n",
      "#for range 0-20 mA\n",
      "I1=20.0\n",
      "m=I1/Im\n",
      "Rsh1=Rm/(m-1)\n",
      "print \"The shunt resistor, Rsh1 = \", round(Rsh1,2),\"ohm\"\n",
      "#for the range of 0-100 mA\n",
      "I2=100.0\n",
      "m=I2/Im\n",
      "Rsh2=Rm/(m-1)\n",
      "print \"The shunt resistor, Rsh2 = \", round(Rsh2,2),\"ohm\"\n",
      "#for the range 0-200 mA\n",
      "I3=200.0\n",
      "m=I3/Im\n",
      "Rsh3=Rm/(m-1)\n",
      "print \"The shunt resistor, Rsh3 = \", round(Rsh3,2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The shunt resistor, Rsh1 =  5.26 ohm\n",
        "The shunt resistor, Rsh2 =  1.01 ohm\n",
        "The shunt resistor, Rsh3 =  0.5 ohm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6.1 - page : 3-15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "from numpy.linalg import inv\n",
      "#design\n",
      "Rm=50.0 #in ohm\n",
      "Im=2.0 #in mA\n",
      "Im*=10**-3  # A\n",
      "I1=2.0 #in A\n",
      "I2=10.0 #in A\n",
      "I3=15.0 #in A\n",
      "#Let Rs=R1+R2+R3\n",
      "A=numpy.array([[I1,I1,I1],[-Im,I2,I2],[Im,Im,-I3]])\n",
      "B=numpy.array([[Im*Rm],[Im*Rm],[-Im*Rm]])\n",
      "Ainv=inv(A)\n",
      "X=numpy.dot(Ainv,B)\n",
      "R1=X[0]\n",
      "R2=X[1]\n",
      "R3=X[2]\n",
      "print \"Value of shunt resistors are : \"\n",
      "print \"R1 is %f ohm, R2 is %.1e ohm & R3 is %.2e ohm\" %(round(R1,5), R2, R3)\n",
      "# Answer is wrong in the textbook."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of shunt resistors are : \n",
        "R1 is 0.039990 ohm, R2 is 3.3e-03 ohm & R3 is 6.67e-03 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9.1 - page : 3-19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Multiplier\n",
      "#Given data :\n",
      "Vin=20.0 #in volts\n",
      "I_fsd=50.0*10 **-6 # in Farad\n",
      "Rm=200.0 # in ohm\n",
      "Rs=(Vin/I_fsd)-Rm  # in ohm\n",
      "Rs=Rs/10**3   # kohm\n",
      "print \"The multiplier, Rs = \", Rs, \" kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The multiplier, Rs =  399.8  kohm\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9.2 - page : 3-19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Full scale deflection current\n",
      "#given data :\n",
      "Vin=10.0 # in V\n",
      "Rs=200.0 #in kohm\n",
      "Rm=400.0 # in ohm\n",
      "I_fsd=Vin/((Rs*10 **3)+Rm) # A\n",
      "I_fsd*=10**6  # micro A\n",
      "print \"Full scale deflection current, I_fsd  = \", round(I_fsd,1), \" micro A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Full scale deflection current, I_fsd  =  49.9  micro A\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10.1 - page : 3-22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Multiplier\n",
      "#given data :\n",
      "V1=200.0 #in V\n",
      "V2=100.0 #in V\n",
      "V3=10.0 # in V\n",
      "Rm=100.0 #in ohm\n",
      "I_fsd=50*10 **-3 \n",
      "#for the range 0-10V   \n",
      "Rt3=V3/I_fsd \n",
      "Rs3=Rt3-Rm # ohm\n",
      "print \"The multiplier, Rs3 = \", Rs3, \" ohm.\"\n",
      "#for the range 0-100V\n",
      "Rt2=V2/I_fsd \n",
      "Rs2=Rt2-(Rm+Rs3)  # ohm \n",
      "print \"The multiplier, Rs2 = \", Rs2, \" ohm.\"\n",
      "Rt1=V1/I_fsd \n",
      "Rs1=Rt1-(Rm+Rs3+Rs2) \n",
      "print \"The multiplier, Rs1 = \", Rs1, \" ohm.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The multiplier, Rs3 =  100.0  ohm.\n",
        "The multiplier, Rs2 =  1800.0  ohm.\n",
        "The multiplier, Rs1 =  2000.0  ohm.\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11.1 - page : 3-23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Multiplier\n",
      "#given data :\n",
      "Rm=200.0 #in ohm\n",
      "I_fsd=150.0*10 **-6 # in A\n",
      "S=1/I_fsd \n",
      "V=50 #in V\n",
      "Rs=(S*V)-Rm   # ohm \n",
      "Rs*=10**-3   # kohm\n",
      "print \"Multiplier, Rs = \", round(Rs,2), \" kohm.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Multiplier, Rs =  333.13  kohm.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11.2 - page : 3-24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Accurate voltmeter reading\n",
      "r1=50.0 # in kohms\n",
      "r2=50.0 #in kohms\n",
      "v=100.0 #in V\n",
      "vr2=(r1/(r1+r2))*v # voltage in V\n",
      "#case 1\n",
      "s1=12000.0 #sensivity in ohm/V\n",
      "rm1=r1*s1*10**-3 # in kohm\n",
      "req=((rm1*r1)/(rm1+r1)) #equivalent resistance in ohm\n",
      "v1=((req/(r1+req)))*v # voltmeter reading when sensivity is 12000 ohm/V\n",
      "#case 2\n",
      "s2=15000 #sensivity in ohm/V V\n",
      "rm2=r1*s2*10**-3 # in kohm\n",
      "req1=((rm2*r1)/(rm2+r1)) #equivalent resistance in ohm\n",
      "v2=((req1/(r1+req1)))*v # voltmeter reading when sensivity is 15000 ohm/V\n",
      "print \"Voltmeter reading when sensivity is 12000 ohm/V is \", round(v1,2), \" V\"\n",
      "print \"Voltmeter reading when sensivity is 15000 ohm/V is \", round(v2,2), \" V. This voltmeter will measure the correct value.\"\n",
      "# Answer in the textbook is not accurate"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltmeter reading when sensivity is 12000 ohm/V is  48.0  V\n",
        "Voltmeter reading when sensivity is 15000 ohm/V is  48.39  V. This voltmeter will measure the correct value.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15.1 - page : 3-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#voltage\n",
      "r1=25.0 # kohms\n",
      "r2=5.0 #in kohms\n",
      "v=30.0 #in V\n",
      "# part(i)\n",
      "vr2=(r2/(r1+r2))*v # voltage in V across 5 kohms resistance\n",
      "Vactual=vr2  # V\n",
      "print \"Voltage across 5 kohm Resistance is \", vr2, \" V.\"\n",
      "#part (ii)\n",
      "vr2=(r1/(r1+r2))*v # voltage in V across 5 kohm resistance\n",
      "#case 1\n",
      "s1=1.0 #sensivity in kohm/V\n",
      "v1=10.0 # in V\n",
      "rm1=v1*s1 #in kohm\n",
      "req=((rm1*r2)/(rm1+r2)) # equivalent resistance in ohm\n",
      "vrb1=((req/(r1+req)))*v # voltmeter reading when sensivity is 1 kohm/V\n",
      "print \"Voltmeter reading when sensivity is 1 kohm/V is \",round(vrb1,2), \" V.\"\n",
      "# part(iii)\n",
      "#case 2\n",
      "s2=20 #sensivity in kohm/V\n",
      "v1=10 # in V\n",
      "rm2=v1*s2 #in kohm\n",
      "req1=((rm2*r2)/(rm2+r2)) #equivalent resistance in ohm\n",
      "vrb2=((req1/(r1+req1)))*v # voltmeter reading when sensivity is 1 kohm/V\n",
      "print \"Voltmeter reading when sensivity is 1 kohm/V is \",round(vrb2,2), \" V.\"\n",
      "#part(iii) #error\n",
      "er1=(Vactual-vrb1)/Vactual*100 #voltmeter 1 error in %\n",
      "er2=(Vactual-vrb2)/Vactual*100 #voltmeter 2 error in %\n",
      "print \"Voltmeter 1 error is \",round(er1,2),\" %\"\n",
      "print \"Voltmeter 2 error is \",round(er2,1),\" %\"\n",
      "#Answer is wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage across 5 kohm Resistance is  5.0  V.\n",
        "Voltmeter reading when sensivity is 1 kohm/V is  3.53  V.\n",
        "Voltmeter reading when sensivity is 1 kohm/V is  4.9  V.\n",
        "Voltmeter 1 error is  29.41  %\n",
        "Voltmeter 2 error is  2.0  %\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15.2 - page : 3-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Shunt resistance\n",
      "#Given data :\n",
      "Im=1.0 # in mA\n",
      "Rm=100.0 # in ohm\n",
      "I=100.0 # in mA\n",
      "Rsh=(Im*10**-3*Rm)/((I-Im)*10**-3) \n",
      "print \"Shunt resistance, Rsh = \",round(Rsh,3),\" ohm.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistance, Rsh =  1.01  ohm.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15.3 - page : 3-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Shunt resistance\n",
      "#Given data :\n",
      "Im=1.0 # in mA\n",
      "P=100.0 # in kW\n",
      "I=100.0 # in mA\n",
      "Rm=(P)/(Im)**2 # ohm\n",
      "Rsh=((Im*10**-3*Rm*10**3)/((I-Im)*10**-3))*10**-3 # ohm\n",
      "print \"Shunt resistance, Rsh = \",round(Rsh,3), \" kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistance, Rsh =  1.01  kohm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15.4 - page : 3-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Shunt resistance\n",
      "#given data :\n",
      "Rsh=200.0 # in ohm\n",
      "Rm=100.0 # in ohm\n",
      "m=50.0 \n",
      "Rsh=Rm/(m-1) # ohm\n",
      "print \"The shunt resistance, Rsh = \", round(Rsh,2), \" ohm.\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The shunt resistance, Rsh =  2.04  ohm.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15.5 - page : 3-30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# shunt resistance\n",
      "#Given data :\n",
      "Im=1.0 # in mA\n",
      "Rm=100.0 # in ohm\n",
      "I=100.0 # in mA\n",
      "Rsh=(Im*10**-3*Rm)/((I-Im)*10**-3) # ohm\n",
      "print \"Shunt resistance, Rsh = \", round(Rsh,3), \" kohm.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shunt resistance, Rsh =  1.01  kohm.\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}