{
 "metadata": {
  "name": "",
  "signature": "sha256:e254c8288fbd2f2cd14434e82e95f71176cc32f312efb578ff8980e82a33844f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5:Bridge Measurements"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5.1:Pg-101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To find deflection caused by the given unbalance\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 5-1 in Page 101\n",
      "\n",
      "\n",
      "# Given data\n",
      "# Resistances of the 4 arms in ohm\n",
      "R_1 = 1000.0\n",
      "R_2 = 100.0\n",
      "R_3 = 200.0\n",
      "R_4 = 2005.0\n",
      "\n",
      "E = 5 # battery EMF in volt\n",
      "S_I = 10*(10**-3)/(10**-6) #Current sensitivity in m/A\n",
      "R_g = 100.0 #Internal resistance of galvanometer in ohm\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Calculations are made wrt fig 5-3 in page 103\n",
      "#Bridge balance occurs if arm BC has a resistance of 2000 ohm. The diagram shows arm BC has as a resistance of 2005 ohm\n",
      "\n",
      "#To calculate the current in the galvanometer, the ckt is thevenised wrt terminals B and D.\n",
      "#The potenttial from B to D, with the galvanometer removed is the Thevenin voltage\n",
      "\n",
      "# E_TH = E_AD - E_AB \n",
      "\n",
      "E_TH = E * ((R_2/(R_2+R_3)) - (R_1/ (R_1+R_4)))\n",
      "R_TH = ((R_2 * R_3/(R_2+R_3)) + (R_1 * R_4/ (R_1+R_4)))\n",
      "\n",
      "#When the galvanometer is now connected to the output terminals, The current through the galvanometer is\n",
      "\n",
      "I_g = E_TH /(R_TH +R_g)\n",
      "d = I_g * S_I\n",
      "print \"The deflection of the galvanometer = \",round(d*1000,2),\" mm\"\n",
      "\n",
      "#Result\n",
      "# The deflection of the galvanometer = 33.26 mm \n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The deflection of the galvanometer =  33.26  mm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5.2:pg-102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To check the capability of detecting unbalance\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 5-2 in Page 102\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "# Resistances of the 4 arms in ohm\n",
      "R_1 = 1000.0\n",
      "R_2 = 100.0\n",
      "R_3 = 200.0\n",
      "R_4 = 2005\n",
      "\n",
      "E = 5 # battery EMF in volt\n",
      "S_I = 1*(10**-3)/(10**-6) #Current sensitivity in m/A\n",
      "R_g = 500 #Internal resistance of galvanometer in ohm\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Calculations are made wrt fig 5-3 in page 103\n",
      "#Bridge balance occurs if arm BC has a resistance of 2000 ohm. The diagram shows arm BC has as a resistance of 2005 ohm\n",
      "\n",
      "#To calculate the current in the galvanometer, the ckt is thevenised wrt terminals B and D.\n",
      "#The potenttial from B to D, with the galvanometer removed is the Thevenin voltage\n",
      "\n",
      "# E_TH = E_AD - E_AB \n",
      "\n",
      "E_TH = E * ((R_2/(R_2+R_3)) - (R_1/ (R_1+R_4)))\n",
      "R_TH = ((R_2 * R_3/(R_2+R_3)) + (R_1 * R_4/ (R_1+R_4)))\n",
      "\n",
      "#When the galvanometer is now connected to the output terminals, The current through the galvanometer is\n",
      "\n",
      "I_g = E_TH /(R_TH +R_g)\n",
      "d = I_g * S_I\n",
      "print \"The deflection of the galvanometer = \",round(d*1000,2),\" mm\"\n",
      "print 'Given that galvanometer is capable of detecting a deflection of 1mm'\n",
      "print 'Hence looking at the result,it can be seen that this galvanometer produces a deflection that can be easily observed'\n",
      "\n",
      "#Result\n",
      "# The deflection of the galvanometer = 2.247 mm \n",
      "# Given that galvanometer is capable of detecting a deflection of 1mm   \n",
      " \n",
      "# Hence looking at the result,it can be seen that this galvanometer produces a deflection that can be easily observed   \n",
      " \n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The deflection of the galvanometer =  2.25  mm\n",
        "Given that galvanometer is capable of detecting a deflection of 1mm\n",
        "Hence looking at the result,it can be seen that this galvanometer produces a deflection that can be easily observed\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5.3:Pg-111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# To find the unknown impedence\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 5-3 in Page 111\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "# The given polar forms in textbook is represented in rect form\n",
      "Z_1 = 17.36482 +1j *98.48078\n",
      "Z_2 = 250\n",
      "Z_3 = 346.4102 +1j *200\n",
      "\n",
      "#Calculations\n",
      "#The first condition for bridge balance is Z_1*Z_4 = Z_2*Z_3\n",
      "mod_Z_4 = (abs(Z_2)*abs(Z_3))/abs(Z_1)\n",
      "\n",
      "#The second condition for bridge balance requires that sum of the phase angles of opposite arms be equal\n",
      "theta_Z_4 = math.atan(Z_2.imag)+math.atan(Z_3.imag)-math.atan(Z_1.imag)*180/math.pi\n",
      "\n",
      "print \"The impedence of the unknown arm =\",round(mod_Z_4),\" ohm /_ \",round(theta_Z_4),\" deg\\n\"\n",
      "print \"Here the magnitude of impedence is 1000 and phase angle is 50 in degrees\\n\"\n",
      "print \"The above value indicates that we are dealing with a capacitive element, possibly consisting of a series combination of a resistor and capacitance\"\n",
      "#Result\n",
      "# The impedence of the unknown arm = 1000 ohm /_ -50 deg\n",
      "# Here the magnitude of impedence is 1000 and phase angle is 50 in degrees\n",
      "# The above value indicates that we are dealing with a capacitive element, possibly consisting of a series combination of a resistor and capacitance \n",
      " \n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The impedence of the unknown arm = 1000.0  ohm /_  -88.0  deg\n",
        "\n",
        "Here the magnitude of impedence is 1000 and phase angle is 50 in degrees\n",
        "\n",
        "The above value indicates that we are dealing with a capacitive element, possibly consisting of a series combination of a resistor and capacitance\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5.4:pg-112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To find the unknown impedence\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 5-4 in Page 112\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "# The notations are wrt to the figure 5-10 in page 109\n",
      "\n",
      "#Arm AB\n",
      "R_1 = 450\n",
      "#Arm BC\n",
      "R_2 = 300\n",
      "C = 0.265 *(10**-6)\n",
      "#Arm DA\n",
      "R_3 = 200\n",
      "L = 15.9*(10**-3)\n",
      "f = 1000\n",
      "\n",
      "#Calculations\n",
      "w = 2*math.pi*f\n",
      "Z_1 = 450\n",
      "Z_2 = R_2 - 1j *floor(1/(w*C))\n",
      "Z_3 = R_3 + 1j*ceil(w*L)\n",
      "\n",
      "Z_4 = Z_1*Z_3/Z_2\n",
      "print \"The impedence of the unknown arm = \",round(imag(Z_4)),\" ohm\\n\"\n",
      "print \"The result indicates that Z_4 is a pure inductance with an inductive reactance of 150 ohm at a frequency of 1 khz.\\n\"\n",
      "\n",
      "L_ans = imag(Z_4)/w\n",
      "print \"The inductance present in the arm CD = \",round(L_ans*1000,1),\"m H\"\n",
      "\n",
      "#Result\n",
      "# The impedence of the unknown arm = 150i ohm\n",
      "# The result indicates that Z_4 is a pure inductance with an inductive reactance of 150 ohm at a frequency of 1 khz.\n",
      "# The inductance present in the arm CD = 23.9m H \n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The impedence of the unknown arm =  150.0  ohm\n",
        "\n",
        "The result indicates that Z_4 is a pure inductance with an inductive reactance of 150 ohm at a frequency of 1 khz.\n",
        "\n",
        "The inductance present in the arm CD =  23.9 m H\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5.5:pg-119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To balance the unbalanced bridge\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 5-5 in Page 119\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "Z_1 = -1000j\n",
      "Z_2 = 500\n",
      "Z_3 = 1000\n",
      "Z_4 = 100+500j\n",
      "\n",
      "# The balance is not possible with this condition as theta_1+theta_4 will be slightly negative than theta_2+theta3\n",
      "# Balance can be achieved by 2 methods:\n",
      "print \"First option is to modify Z_1 so that its phase angle is decreased to less than 90deg by placing a resistor in parallel with the capacitor.\"\n",
      "# The resistance R_1 can be determined by the standard approach\n",
      "\n",
      "#Calculations\n",
      "Y_1 = Z_4/(Z_2*Z_3)\n",
      "#Also,\n",
      "# Y_1 = (1/R) + %i/1000\n",
      "# equating both the equations and solving for R_1\n",
      "\n",
      "R_1 = 1/(Y_1-(1j/1000 ))\n",
      "print \"The value of the resistor R_1 in parallel with capacitor = \",R_1.real,\" ohm\\n\",\n",
      "\n",
      "# It should be noted that the addition of R_1 upsets the first balance condition as the magnitude of Z_1 is changed\n",
      "# Hence the variable R_3 should be adjusted to compensate this effect\n",
      "\n",
      "print 'The second option is to modify the phase angle of arm 2 or arm 3 by adding series capacitor'\n",
      "Z_3_1 = Z_1 *Z_4/Z_2\n",
      "# substituting for the component values and solving for X_C yeilds\n",
      "\n",
      "X_C = abs(1000- Z_3_1)/-1j\n",
      "print \"The value of the reactance of the capacitor used, X_C = \",X_C.imag,\" ohm\"\n",
      "\n",
      "\n",
      "#In this case the magnitude of the Z_3 is increased so that the first balance condition is changed\n",
      "#A small adjustment of R_3 is necessary to restore balance\n",
      "\n",
      "#Result\n",
      "# First option is to modify Z_1 so that its phase angle is decreased to less than 90deg by placing a resistor in parallel with the capacitor.   \n",
      "# The value of the resistor R_1 in parallel with capacitor = 5000 ohm\n",
      " \n",
      "# The second option is to modify the phase angle of arm 2 or arm 3 by adding series capacitor   \n",
      "# The value of the reactance of the capacitor used, X_C = 200 ohm \n",
      "\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "First option is to modify Z_1 so that its phase angle is decreased to less than 90deg by placing a resistor in parallel with the capacitor.\n",
        "The value of the resistor R_1 in parallel with capacitor =  5000.0  ohm\n",
        "The second option is to modify the phase angle of arm 2 or arm 3 by adding series capacitor\n",
        "The value of the reactance of the capacitor used, X_C =  200.0  ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}