{
 "metadata": {
  "name": "",
  "signature": "sha256:eb16b5620fb956842995f8d06be59d7e1e1d7123054fdad5a84f667167801f94"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8: Differential, Instrumentation and Bridge amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.1 Page No 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "m = 100.0              #Differential Gain\n",
      "E1 = 10*10**-3\n",
      "E2 = 10*10**-3         #input voltages\n",
      "E3 = 0*10**-3 \n",
      "E4 = -20*10**-3        #input voltages\n",
      "\n",
      "#Calculation\n",
      "Vout1 = (m*E1)-(m*E2)    \n",
      "Vout2 = (m*E1)-(m*E3)\n",
      "Vout3 = (m*E1)-(m*E4)\n",
      "\n",
      "#Result\n",
      "print\" Output Voltages are   \", Vout1,\"V, \",Vout2,\"V ,\",Vout3,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Output Voltages are    0.0 V,  1.0 V , 3.0 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.2 Page no. 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "V=5      #V\n",
      "d=2       #mV\n",
      "E1=V+d*10**-3\n",
      "E2=V-d*10**-3\n",
      "\n",
      "#Calculation\n",
      "Eds=E1-E2\n",
      "Ecm=(E1+E2)/2.0\n",
      "\n",
      "#Result\n",
      "print\"Input signal voltage is\",Eds*1000,\"mV\"\n",
      "print\"Common mode voltage is\",Ecm,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input signal voltage is 4.0 mV\n",
        "Common mode voltage is 5.0 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.2 Page No 225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a = 2/9.0       #Differential Gain\n",
      "E1 = 10*10**-3\n",
      "E2 = 5*10**-3   #Input Voltages \n",
      "\n",
      "#Calculation\n",
      "Vout = (E1 - E2)*(1+(2/a))\n",
      "\n",
      "#Result\n",
      "print\" output voltage = \", Vout*1000,\"mV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " output voltage =  50.0 mV\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.3 Page No 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R = 25*10**3 \n",
      "aR = 50.0 \n",
      "\n",
      "#Calculation\n",
      "a = aR / R \n",
      "Gain = 1 + (2/a) \n",
      "\n",
      "#Result\n",
      "print\"Voltage Gain = \" , Gain "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage Gain =  1001.0\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.4 Page No 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import numpy\n",
      "a=numpy.inf\n",
      "\n",
      "#Calculation\n",
      "Gain = 1+(2/a)  \n",
      "\n",
      "#Result\n",
      "print\" Voltage Gain =  \", Gain"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Voltage Gain =   1.0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.5 Page No 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "m = 1001.0     #Gain\n",
      "E1 = 5.001\n",
      "E2 = 5.002\n",
      "E3 = 5.001 \n",
      "E4 = 5.000  \n",
      "E5 = -1.001 \n",
      "E6 = -1.002 \n",
      "\n",
      "#Calculation\n",
      "Vout1 = m*(E1-E2)\n",
      "Vout2 = m*(E3-E4) \n",
      "Vout3 = m*(E5-E6)\n",
      "\n",
      "#result\n",
      "print\" Output Voltages are   \", Vout1,\"V \",Vout2,\"V \",Vout3,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Output Voltages are    -1.001 V  1.001 V  1.001 V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.6 Page No 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Vout = 5.0    #Output Voltage\n",
      "\n",
      "#Calculation\n",
      "Vce = Vout  \n",
      "\n",
      "#Result\n",
      "print\" Vce=\",Vce,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Vce= 5.0 V\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.7 Page No 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Vre = 1.2  \n",
      "Re = 1*10**3 \n",
      "Vce = 5\n",
      "Vcc = 15         #Voltages in the circuit\n",
      "\n",
      "#Calculation\n",
      "Ie = Vre / Re \n",
      "Vcol = Vce + Vre \n",
      "Vrl = Vcc - Vcol \n",
      "\n",
      "#Result\n",
      "print\" Collector Voltage =  \", Vcol,\"V\"\n",
      "print\" Voltage across Rl  =\", Vrl,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Collector Voltage =   6.2 V\n",
        " Voltage across Rl  = 8.8 V\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.8 Page No 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Rs = 1*10**3\n",
      "E1 = 100*10**-3 \n",
      "E2 = 0  \n",
      "Rl = 5*10**3 \n",
      "Gain = 10 \n",
      "\n",
      "#Calculation\n",
      "Il = 10*((E1-E2)/Rs)\n",
      "Vr = Il * Rs \n",
      "Vref = Il * Rl \n",
      "V9 = Vref + Gain*(E1 - E2)\n",
      "\n",
      "#Result\n",
      "print\" Current across Load Resistor = \", Il*1000 ,\"mA\"\n",
      "print\" Voltage across R  =  \", Vr,\"V\"\n",
      "print\" Reference Voltage  =  \", Vref,\"V\" \n",
      "print\" Voltage at terminal 9 =\", V9,\"V\"  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Current across Load Resistor =  1.0 mA\n",
        " Voltage across R  =   1.0 V\n",
        " Reference Voltage  =   5.0 V\n",
        " Voltage at terminal 9 = 6.0 V\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.9 Page No 234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "GF = 2.0     #Gage factor\n",
      "DR = 0.001 \n",
      "R = 120.0 \n",
      "\n",
      "#calculation\n",
      "L = DR /(R*GF)  \n",
      "\n",
      "#result\n",
      "print\" Change in length is \",round(L*10**6,1),\"microinches per inch\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Change in length is  4.2 microinches per inch\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.10 Page No 236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "E = 1.0  \n",
      "DR = 0.001 \n",
      "R = 120.0    #Resistance in Ohm\n",
      "\n",
      "#Calculation\n",
      "Vout = (E*DR)/(4*R) \n",
      "\n",
      "#Result\n",
      "print\" Output of the Bridge = \", round(Vout*10**6,1),\"micro voltage\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Output of the Bridge =  2.1 micro voltage\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.11 Page No 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Vout = 100*10**-3 \n",
      "E = 5.0\n",
      "R = 120.0 \n",
      "Gain = 1000.0 \n",
      "E1 = 30 *10**6 \n",
      "Gf = 2.0          #Gage factor\n",
      "\n",
      "#calculation\n",
      "Vbridge = Vout / Gain \n",
      "DL = 20*10**-6 \n",
      "DR = (R * Vbridge)/E \n",
      "Rratio = DR / R   #Change in Resistance\n",
      "Strain = DL / Gf  #Change in Length \n",
      "Stress = E1 * Strain  \n",
      "\n",
      "#Result\n",
      "print \" Change in Resistance =  \", DR*1000 ,\"mohm\"\n",
      "print \" Ratio of Resistance =  \", Rratio,\"micro ohm/ohm\"\n",
      "print \" Strain value =  \", Strain ,\"micro inch/inch\"\n",
      "print \" Stress value = \", Stress ,\"psi\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Change in Resistance =   2.4 mohm\n",
        " Ratio of Resistance =   2e-05 micro ohm/ohm\n",
        " Strain value =   1e-05 micro inch/inch\n",
        " Stress value =  300.0 psi\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 8.12 Page No 245\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "T1=25    #C Temprature\n",
      "T2=50\n",
      "Tref=25   #C Reference temprature\n",
      "Rref=10000\n",
      "Rtrans=3603    #ohm, at 50 C\n",
      "\n",
      "\n",
      "#Calculation\n",
      "dR=Rtrans-Rref\n",
      "R1=10     #Kohm say\n",
      "E=1    #V trial choice\n",
      "I=E/(R1+Rref/1000.0)\n",
      "Vo=-I*dR\n",
      "\n",
      "#result\n",
      "print\"The value of dR for each temprature is\",dR,\"ohm\"\n",
      "print\"The current is\",I,\"mA\"\n",
      "print\"Vo for each value of R\",Vo,\"mV\"\n",
      "#NOTE: In the book the value of Vo is calculated wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of dR for each temprature is -6397 ohm\n",
        "The current is 0.05 mA\n",
        "Vo for each value of R 319.85 mV\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}