{
 "metadata": {
  "name": "",
  "signature": "sha256:e41e7a899079e095312b80bb51a6a04abde629cd10b5f06d1688520f00c1a4b7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Single Phase A-C Circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.1: page 211:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "E_max=500;#  emf  in  volts\n",
      "thita=30;#  in  degree\n",
      "\n",
      "#calculations:\n",
      "e=E_max*math.sin(thita*math.pi/180);\n",
      "\n",
      "#Results\n",
      "print  \"instantaneous  value,e(v)  =  \",e "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "instantaneous  value,e(v)  =   250.0\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.2: page 212:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "I_max=1.414;#  maximum  value  of  current  in  A\n",
      "\n",
      "#calculations:\n",
      "I_rms=I_max*0.707;\n",
      "\n",
      "#Results\n",
      "print  \"rms  value  of  current,I_rms(A) = \",round(I_rms)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms  value  of  current,I_rms(A) =  1.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.3: page 220:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "f=50;#  frequency  in  Hz\n",
      "L=0.2;#  inductance  in  H\n",
      "V=220;#  voltage  in  volts\n",
      "\n",
      "#calculations:\n",
      "XL=2*math.pi*f*L#  in  ohm\n",
      "Z=XL;\n",
      "I=V/Z;\n",
      "\n",
      "#Results\n",
      "print  \"current  drawn,I(A)  =  \",round(I,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  drawn,I(A)  =   3.5\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.4: page 222:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "f=50;#  frequency  in  Hz\n",
      "C=100*10**-6#  capacitor  in  Farad\n",
      "V=210;#  voltage  in  volts\n",
      "\n",
      "#calculations:\n",
      "XC=(1/(2*math.pi*f*C));\n",
      "Z=XC;\n",
      "I=V/Z;\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",round(I,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   6.6\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.5: page 222:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "f=50;#  frequency  in  Hz\n",
      "L=0.4;#  inductance  in  H\n",
      "V=220;#  voltage  in  volts\n",
      "f1=25;#  frequency  is  halved\n",
      "f2=100;#  frequency  is  doubled\n",
      "\n",
      "#calculations:\n",
      "XL=2*math.pi*f*L;\n",
      "I=V/XL;\n",
      "\n",
      "XL1=2*math.pi*f1*L;\n",
      "I1=V/XL1;\n",
      "\n",
      "XL2=2*math.pi*f2*L;\n",
      "I2=V/XL2;\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",round(I,2) \n",
      "print  \"(a)current  when  frequency  is  halved,I(A)  =  \",round(I1,2)\n",
      "print  \"current  when  frequency  is  doubled,I(A)  =  \",round(I2,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   1.75\n",
        "(a)current  when  frequency  is  halved,I(A)  =   3.5\n",
        "current  when  frequency  is  doubled,I(A)  =   0.875\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.6: page 223:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given  data  :\n",
      "f=50;#  frequency  in  Hz\n",
      "C=28*10**-6#  capacitor  in  Farad\n",
      "V=250;#  voltage  in  volts\n",
      "f1=25#  when  frequency  is  halved\n",
      "f2=100#  when  frequency  is  doubled\n",
      "\n",
      "#calculations:\n",
      "XC=1/(2*math.pi*f*C);\n",
      "I=V/XC;\n",
      "\n",
      "XC1=1/(2*math.pi*f1*C);\n",
      "I1=V/XC1;\n",
      "\n",
      "XC2=1/(2*math.pi*f2*C);\n",
      "I2=V/XC2;\n",
      "\n",
      "#Results\n",
      "print  \"current  flowing,I(A)  =  \",round(I,1)\n",
      "print  \"current  flowing  when  frequency  is  halved,I(A)  =  \",round(I1,1)\n",
      "print  \"current  flowing  when  frequency  is  doubled  ,I(A)  =\",round(I2,1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current  flowing,I(A)  =   2.2\n",
        "current  flowing  when  frequency  is  halved,I(A)  =   1.1\n",
        "current  flowing  when  frequency  is  doubled  ,I(A)  = 4.4\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.7: Page 224:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "R=40  #in  ohms\n",
      "L=0.07#IN  HENRY\n",
      "V=223#IN  VOLTS\n",
      "F=50  #  IN  HERTS\n",
      "\n",
      "#calculations:\n",
      "Xl=2*math.pi*F*L#  inductive  reactance  in  ohms\n",
      "Z=(R**2+Xl**2)**0.5#IMPEDENCE  IN  OHMS\n",
      "I=V/Z;#in  amperes\n",
      "csp=R/Z#pf\n",
      "phi=math.acos(csp)#angle  of  phase  differnce  in  degree\n",
      "\n",
      "def decdeg2dms(dd):\n",
      "    mnt,sec = divmod(dd*3600,60)\n",
      "    deg,mnt = divmod(mnt,60)\n",
      "    return deg,mnt,sec\n",
      "phiAct = decdeg2dms(phi*180/math.pi)\n",
      "\n",
      "#Results\n",
      "print  \"inductive  reactance  in  ohms  is\",round(Xl)\n",
      "print  \"impedence  in  ohms  is\",round(Z,2) \n",
      "print  \"current  in  amperes  is\",round(I,1)\n",
      "print  \"angle  of  phase  difference  is  \",phiAct[0],\"Degrees and \",phiAct[1],\"minutes\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "inductive  reactance  in  ohms  is 22.0\n",
        "impedence  in  ohms  is 45.65\n",
        "current  in  amperes  is 4.9\n",
        "angle  of  phase  difference  is   28.0 Degrees and  48.0 minutes\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.8: Page 226:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "V=200#in  volts\n",
      "I=2.5#  in  amperes\n",
      "Vo=250#  in  volts\n",
      "f=50  #  in  hertz\n",
      "\n",
      "#calculations:\n",
      "R=V/I#  in  ohms\n",
      "Z=Vo/I#  in  ohms\n",
      "Xl=(Z**2-R**2)**0.5#inductive  reactance  in  ohms\n",
      "L=(Xl/(2*math.pi*f))#inductance  in  henry\n",
      "pf=R/Z#power  factor\n",
      "phi=math.acos(pf)#angle  of  phase  differnce  in  degree\n",
      "def decdeg2dms(dd):\n",
      "    mnt,sec = divmod(dd*3600,60)\n",
      "    deg,mnt = divmod(mnt,60)\n",
      "    return deg,mnt,sec\n",
      "phiAct = decdeg2dms(phi*180/math.pi)\n",
      "\n",
      "#Results\n",
      "print  \"inductance  in  henry  is\",round(L,4)\n",
      "print  \"angle  of  phase  difference  is  \",phiAct[0],\"Degrees and \",phiAct[1],\"minutes\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "inductance  in  henry  is 0.191\n",
        "angle  of  phase  difference  is   36.0 Degrees and  52.0 minutes\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.9: page 226:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "W=100#in  watts\n",
      "V=110#in  volts\n",
      "Vc=220#in  volts\n",
      "f=50  #in  hertz\n",
      "\n",
      "#calculations:\n",
      "I=W/V#  in  amperes\n",
      "R=V/I#in  ohms\n",
      "Z=Vc/I#  in  ohms\n",
      "Xc=math.sqrt(Z**2-R**2)#  IN  OHMS\n",
      "C=(1/(2*math.pi*f*Xc))#  in  farads\n",
      "\n",
      "#Results\n",
      "print  \"capacitance  in  micro  farads  is\",round(C*10**6,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "capacitance  in  micro  farads  is 15.19\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.10: page 227:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "R=5.94#in  ohms\n",
      "L=0.35#IN  HENRY\n",
      "C=35  #  in  micro  farads\n",
      "V=220#IN  VOLTS\n",
      "F=50  #  IN  HERTS\n",
      "\n",
      "#calculations:\n",
      "Xc=(1/(2*math.pi*F*C*10**-6))#  capacitive  reactance  in  ohms\n",
      "Xl=2*math.pi*F*L#  inductive  reactance  in  ohms\n",
      "Z=math.sqrt(R**2+(Xl-Xc)**2)#  impedence  in  ohms\n",
      "I=V/round(Z)#  in  amperes\n",
      "pf=R/round(Z)#  power  factor\n",
      "Zc=math.sqrt(R**2+Xl**2)#impedence  of  the  coil\n",
      "Vl=I*Zc#voltage  drop  across  the  coil\n",
      "Vc=I*Xc#voltage  drop  across  the  capacitor\n",
      "W=I**2*R#total  power  taken  in  watts\n",
      "\n",
      "#Results\n",
      "print  \"(a)impedence  in  ohms  is\",round(Z)\n",
      "print  \"(b)current  in  amperes  is\",I\n",
      "print  \"(c)angle  of  phase  diffence  between  voltage  and  current  is\",pf\n",
      "print  \"(d)voltage  across  the  coil  in  volts  is\",round(Vl,1)\n",
      "print  \"(e)voltage  across  capacitor  in  volts  is\",round(Vc,1)\n",
      "print  \"(f)total  power  taken  in  watts  is\",round(W,1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)impedence  in  ohms  is 20.0\n",
        "(b)current  in  amperes  is 11.0\n",
        "(c)angle  of  phase  diffence  between  voltage  and  current  is 0.297\n",
        "(d)voltage  across  the  coil  in  volts  is 1211.3\n",
        "(e)voltage  across  capacitor  in  volts  is 1000.4\n",
        "(f)total  power  taken  in  watts  is 718.7\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.11: page 233:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "r1=6  #in  ohms\n",
      "r2=3.95#in  ohms\n",
      "R=r1+r2#in  ohms\n",
      "L1=0.21#IN  HENRY\n",
      "L2=0.14#in  henry\n",
      "C1=30#  in  micro  farads\n",
      "C2=60#in  micro  farads\n",
      "V=220#IN  VOLTS\n",
      "F=50  #  IN  HERTS\n",
      "\n",
      "#calculations:\n",
      "Xc1=(1/(2*math.pi*F*C1*10**-6))#  capacitive  reactance  in  ohms\n",
      "Xc2=(1/(2*math.pi*F*C2*10**-6))#  capacitive  reactance  in  ohms\n",
      "Xc=Xc1+Xc2#IN  OHMS\n",
      "Xl1=2*math.pi*F*L1#  inductive  reactance  in  ohms\n",
      "Xl2=2*math.pi*F*L2#  inductive  reactance  in  ohms\n",
      "Xl=Xl1+Xl2#in  ohms\n",
      "Z=math.sqrt(R**2+(Xl-Xc)**2)#  impedence  in  ohms\n",
      "I=V/Z#\n",
      "pf=R/Z#  leading  power  factor\n",
      "\n",
      "#Results\n",
      "print  \"(a)impedence  in  ohms  is\",round(Z)\n",
      "print  \"(b)current  in  amperes  is\",round(I)\n",
      "print  \"(c)power  factor  (leading)  is\",round(pf,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)impedence  in  ohms  is 50.0\n",
        "(b)current  in  amperes  is 4.0\n",
        "(c)power  factor  (leading)  is 0.198\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.12: Page 233:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#given data:\n",
      "V=200#  in  volts\n",
      "L=0.04#  in  henry\n",
      "C=100#in  micro  fards\n",
      "f=50  #  hertz\n",
      "Z1=10#ohms\n",
      "R1=10#  in  ohms\n",
      "X1=0  #  in  ohms\n",
      "R2=5  #  in  ohms\n",
      "R3=15#  in  ohms\n",
      "\n",
      "#calculations:\n",
      "Xl=2*math.pi*f*L#inductive  reactance  in  ohms\n",
      "Xc=(1/(2*math.pi*f*C*10**-6))#CAPACITIVE  REACTANCE  IN  OHMS\n",
      "Z2=math.sqrt(R2**2+Xl**2)#in  ohms\n",
      "X2=Xl#\n",
      "Z3=math.sqrt(R3**2+Xc**2)#  IN  OHMS\n",
      "X3=Xc#\n",
      "g1=R1/(Z1)**2#  conductance  of    branch  1  in  mho\n",
      "b1=X1/(Z1)**2#susceptance  in  mho  in  branch  1\n",
      "g2=R2/(Z2)**2#  conductance  of    branch  2  in  mho\n",
      "b2=X2/(Z2)**2#susceptance  in  mho  in  branch  2\n",
      "g3=R3/(Z3)**2#  conductance  of    branch  3  in  mho\n",
      "b3=X3/(Z3)**2#susceptance  in  mho  in  branch  3\n",
      "G=g1+g2+g3#  total  conductance  in  mho\n",
      "B=b1+b2-b3#  total  susceptance  in  mho\n",
      "Y=math.sqrt(G**2+B**2)#in  ohms\n",
      "I0=V*Y#curent  in  ampere\n",
      "theta=math.acos(G/Y)#\n",
      "\n",
      "def decdeg2dms(dd):\n",
      "    mnt,sec = divmod(dd*3600,60)\n",
      "    deg,mnt = divmod(mnt,60)\n",
      "    return deg,mnt,sec\n",
      "phiAct = decdeg2dms(theta*180/math.pi)\n",
      "\n",
      "I=V/Z3#curent  in  amperes\n",
      "pf3=R3/Z3#power  factor\n",
      "phi=math.acos(pf3)#angle  of  phase  differnce  in  degree\n",
      "\n",
      "\n",
      "tc3=pf3#\n",
      "ts3=math.sin(phi)\n",
      "pf1=R1/R1#\n",
      "tc1=pf1#\n",
      "ts1=math.sin(math.acos(pf1))#\n",
      "I1=V/Z1#\n",
      "E1=I1*tc1#  energy  component  in  branch  1\n",
      "EL1=I1*ts1#  idel  current  component  in  branch  1\n",
      "I2=V/Z2#\n",
      "pf2=R2/Z2#\n",
      "tc2=pf2#\n",
      "ts2=math.sin(math.acos(pf2))#\n",
      "E2=I2*tc2#ENERGY  COMPONENT  IN  BRANCH2\n",
      "EL2=I2*ts2#idele  current  component  in  branch  2\n",
      "E3=I*tc3#energy  component  in  branch3\n",
      "EL3=I*ts3#idle  component  of  current  in  branch  3\n",
      "E=E1+E2+E3#sum  of  energy  component  of  current\n",
      "EL=EL1+EL2-EL3#sum  of  idel  component  of  current\n",
      "It=math.sqrt(E**2+EL**2)#  total  current\n",
      "pft=E/It#power  factor  of  the  complete  circuit\n",
      "phi=math.acos(0.95)#angle  of  phase  differnce  in  degree\n",
      "\n",
      "Zt=V/It#in  ohms\n",
      "R=Zt*pft#equivalent  series  resistance\n",
      "X=Zt*(math.sin(phi))#equivalent  series  reactance\n",
      "\n",
      "\n",
      "#Results\n",
      "print \"(a)current  in  amperes  is\",round(I0)\n",
      "print  \"Phase angle  is  \",phiAct[0],\"Degrees and \",phiAct[1],\"minutes\"\n",
      "print  \"(c)equivalent  series  resistance  in  ohms  is\",round(R,2)\n",
      "print  \"euivalent  series  reactance  in  ohms  is\",round(X,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)current  in  amperes  is 29.0\n",
        "Phase angle  is   17.0 Degrees and  8.0 minutes\n",
        "(c)equivalent  series  resistance  in  ohms  is 6.55\n",
        "euivalent  series  reactance  in  ohms  is 2.14\n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}