{
 "metadata": {
  "name": "",
  "signature": "sha256:0910cfded5ae40d0ea2b9576604d8007ec8328215058593fcec218762063deff"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14: A.C. Distribution"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.1, Page Number: 359"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "l = 300                      #line length(m)\n",
      "magI1 = 100                     #current at load 1(A)\n",
      "pf1 = 0.707                  #power factor at load 1\n",
      "l1 = 200                      #line length till load 1(m)\n",
      "magI2 = 200                     #current drawn at load 2(A)\n",
      "pf2 = 0.8                   #power factor at laod 2\n",
      "l2 = 300                    #line length till load 2(m)\n",
      "R = 0.2                      #total resistance of line(ohm/km)\n",
      "X = 0.1                      #total reactance of the line(ohm/km)\n",
      "\n",
      "#Calculation:\n",
      "phy1 = math.acos(pf1)\n",
      "phy2 = math.acos(pf2)\n",
      "Zac = (R+X*1j)*200/1000       #Impedance of section AC(ohm)\n",
      "Zcb = (R+X*1j)*100/1000       #Impedance of section CB(ohm)\n",
      "#Taking voltage at the far end B as the reference vector, we have\n",
      "I2 = magI2*(pf2-1j*math.sin(phy2))         #Load current at point B(A)\n",
      "I1 = magI1*(pf1-1j*math.sin(phy1))         #Load current at point C(A)\n",
      "Icb = I2                                   #A\n",
      "Iac = I1+I2                              #A\n",
      "Vcb = Icb*Zcb                           #V\n",
      "Vac = Iac*Zac                            #V\n",
      "V = Vac+Vcb                            #Voltage drop in the distributor(V)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Voltage drop in the distributor is\",round(abs(V),2),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Voltage drop in the distributor is 17.85 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.2, Page Number: 359"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "l = 2000                      #line length(m)\n",
      "magI1 = 80                     #current at load 1(A)\n",
      "pf1 = 0.9                 #power factor at load 1\n",
      "l1 = 1000                      #line length till load 1(m)\n",
      "magI2 = 120                     #current drawn at load 2(A)\n",
      "pf2 = 0.8                   #power factor at laod 2\n",
      "l2 = 2000                    #line length till load 2(m)\n",
      "R = 0.05                      #total resistance of line(ohm/km)\n",
      "X = 0.1                      #total reactance of the line(ohm/km)\n",
      "magVb = 230                     #voltage maintained at point B(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "phy1 = math.acos(pf1)\n",
      "phy2 = math.acos(pf2)\n",
      "Zac = (R+X*1j)*1000/1000       #Impedance of section AC(ohm)\n",
      "Zcb = (R+X*1j)*1000/1000       #Impedance of section CB(ohm)\n",
      "#Taking voltage at the far end B as the reference vector, we have\n",
      "I2 = magI2*(pf2-1j*math.sin(phy2))         #Load current at point B(A)\n",
      "I1 = magI1*(pf1-1j*math.sin(phy1))         #Load current at point C(A)\n",
      "Icb = I2                                   #A\n",
      "Iac = I1+I2                              #A\n",
      "Vcb = Icb*Zcb                           #V\n",
      "Vac = Iac*Zac                            #V\n",
      "V = Vac+Vcb+magVb*(1+0j)                            #Voltage drop in the distributor(V)\n",
      "theta = math.atan(V.imag/V.real)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i) Voltage drop in the distributor is\",round(abs(V),2),\"V\"\n",
      "print \"(ii)The phase difference between Va and Vb is \",round(math.degrees(theta),2),\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Voltage drop in the distributor is 261.67 V\n",
        "(ii)The phase difference between Va and Vb is  3.83 degrees\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.3, Page Number: 360"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "magI1 = 100                     #current at load 1(A)\n",
      "pf1 = 0.6                 #power factor at load 1\n",
      "magI2 = 100                     #current drawn at load 2(A)\n",
      "pf2 = 0.8                   #power factor at laod 2\n",
      "R = 0.1                      #total resistance of line(ohm/km)\n",
      "X = 0.15                      #total reactance of the line(ohm/km)\n",
      "magVb = 200                     #voltage maintained at point B(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "phy1 = math.acos(pf1)\n",
      "phy2 = math.acos(pf2)\n",
      "Zam = (R+X*1j)              #Impedance of section AM(ohm)\n",
      "Zmb = (R+X*1j)             #Impedance of section MB(ohm)\n",
      "#Taking voltage at the far end B as the reference vector, we have\n",
      "I2 = magI2*(pf2-1j*math.sin(phy2))         #Load current at point B(A)\n",
      "Imb = I2  \n",
      "Vb = magVb*(1+0j)                       #V\n",
      "Vmb = Imb*Zmb                           #V\n",
      "Vm = Vb+Vmb                              #V\n",
      "alpha = math.atan(Vm.imag/Vm.real)         #V\n",
      "#The load current I1 has a lagging p.f. of 0\u00b76 w.r.t. VM. It lags \n",
      "#behind Vm by an angle phy1.\n",
      "#Phase angle between I1 and Vb\n",
      "phy11 = phy1-alpha\n",
      "I1 = magI1*(math.cos(phy11)-math.sin(phy11)*1j)         #A\n",
      "Iam = I1+I2                              #A\n",
      "Vam = Iam*Zam                            #V\n",
      "Va = Vm+Vam                             #V\n",
      "theta = math.atan(Va.imag/Va.real)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i)Voltage at mid-point is\",round(abs(Vm),1),\"V\"\n",
      "print \"(ii) Sending end voltage Va is\",round(abs(Va),2),\"V\"\n",
      "print \"(iii)The phase difference between Va and Vb is \",round(math.degrees(theta),2),\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)Voltage at mid-point is 217.1 V\n",
        "(ii) Sending end voltage Va is 252.33 V\n",
        "(iii)The phase difference between Va and Vb is  3.07 degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.4, Page Number: 362"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Zab = 1+1j                    #ohm\n",
      "Zbc = 1+2j                    #ohm\n",
      "Zac = 1+3j                    #ohm\n",
      "Ib = 20                       #load current at B(A)\n",
      "pfb = 0.8                      #power factor at A\n",
      "Ic = 15                       #load current at C(A)\n",
      "pfc = 0.6                      #power factor at B\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "Iab = Ib*(pfb-1j*math.sin(math.acos(pfb)))        #Current in section AB(A)\n",
      "Iac = Ic*(pfc-1j*math.sin(math.acos(pfc)))        #Current in section AB(A)\n",
      "Vab = Iab*Zab                     #Voltage drop in section AB(V)\n",
      "Vac = Iac*Zac                     #Voltage drop in section AC(V)\n",
      "#point B is at higher potential than point C. The p.d. between B and C\n",
      "#is Thevenin\u2019s equivalent circuit e.m.f. Eo i.e.\n",
      "Eo = Vac-Vab                     #volt\n",
      "Zo = Zab+Zac                    #Thevenin\u2019s equivalent impedance(ohm)\n",
      "Ibc = Eo/(Zo+Zbc)                #A\n",
      "Iab1 = Iab+Ibc                   #A\n",
      "Iac1 = Iac-Ibc                   #A\n",
      "Ia = Iab+Iac                     #Current fed at A(A)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The total current fed at A is\",Ia,\"A\"\n",
      "print \"\\nCurrent in AB is\",Iab1.real+round(Iab1.imag,2)*1j,\"A\"\n",
      "print \"\\nCurrent in BC is\",Ibc.real+round(Ibc.imag,2)*1j,\"A\"\n",
      "print \"\\nCurrent in AC is\",Iac1.real+round(Iac1.imag,2)*1j,\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total current fed at A is (25-24j) A\n",
        "\n",
        "Current in AB is (18.6-13.53j) A\n",
        "\n",
        "Current in BC is (2.6-1.53j) A\n",
        "\n",
        "Current in AC is (6.4-10.47j) A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.5, Page Number: 363"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      "#Variable declaration:\n",
      "l = 1000                      #line length(m)\n",
      "magI1 = 5                     #current at load 1(A)\n",
      "pf1 = 0.8                 #power factor at load 1\n",
      "l1 = 600                      #line length till load 1(m)\n",
      "pf2 = 0.85                   #power factor at motor load B\n",
      "Po = 10                      #power output at B(H.P)\n",
      "n = 0.9                     #efficiency\n",
      "l2 = 400                    #line length till load 2(m)\n",
      "R = 1                      #total resistance of line(ohm/km)\n",
      "X = 0.5                      #total reactance of the line(ohm/km)\n",
      "magVb = 400                     #voltage maintained at point B(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "Zac = (R+X*1j)*l1/l                 #ohm\n",
      "Zcb = (R+X*1j)*l2/l                 #ohm\n",
      "magVbp = magVb/3**0.5               #volt per phase\n",
      "Vbp = magVbp*(1+0j)                 #V\n",
      "magIb = Po*746/(3**0.5*magVb*pf2*n)           #Line current at B(A)\n",
      "magI2p = magIb\n",
      "I2p = magI2p*(pf2-1j*math.sin(math.atan(pf2)))    #A\n",
      "I1p = magI1*(pf1-1j*math.sin(math.atan(pf1)))       #A\n",
      "Iac = I1p+I2p                      #Current in section AC(A)\n",
      "Icb = I2p                          #Current in section CB(A)\n",
      "Vcb = Icb*Zcb                      #V\n",
      "Vac = Iac*Zac                      #V\n",
      "Va = Vbp+Vcb+Vac                    #V\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Line voltage at A is\",round(abs(Va)*3**0.5),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Line voltage at A is 434.0 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.6, Page Number: 364"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from sympy import *\n",
      "\n",
      "#Variable declaration:\n",
      "magVa = 11000                      #volt\n",
      "magIb = 50                            #load current at B(A)\n",
      "pf2 = 0.8                           #power factor(lagging)\n",
      "magIc = 120                            #load current at C(A)\n",
      "pf3 = 1.0                           #power factor(lagging)\n",
      "magId = 70                             #load current at D(A)\n",
      "pf4 = 0.866                         #power factor(lagging)\n",
      "Zab = 1+0.6j                        #ohm\n",
      "Zbc = 1.2+0.9j                      #ohm\n",
      "Zcd = 0.8+0.5j                        #ohm\n",
      "Zda = 3+2j                          #ohm\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "#Let current in section AB be (x + j*y).\n",
      "x,y = symbols('x,y')\n",
      "Iab = x+1j*y\n",
      "x,y = symbols('x,y')\n",
      "Ibc = Iab-magIb*(pf2-math.sin(math.atan(pf2)))     #A\n",
      "Icd = (x-40+1j*(y+30))-(120+0j)                   #A\n",
      "Ida = ((x-160)+1j*(y+30))-(70*(0.866-0.5j))          #A\n",
      "Vab = Iab*Zab                         #Drop in section AB(V)\n",
      "Vbc = Ibc*Zbc                         #Drop in section BC(V)\n",
      "Vcd = Icd*Zcd                          #Drop in section CD(V)\n",
      "Vda = Ida*Zda                         #Drop in section DA(V)\n",
      "#  Vab+Vbc+Vcd+Vda = 0\n",
      "#  As the real and imaginary parts have to be separately zero,\n",
      "#  6*x-4*y-1009.8 = 0\n",
      "#  4*x+6*y-302.2 = 0\n",
      "x1 = solve(6*x-4*y-1009.8,x)[0]\n",
      "y1 = round(solve(4*x1+6*y-302.2,y)[0],1)\n",
      "x11 = round(solve(6*x-4*y1-1009.8,x)[0],1)\n",
      "#now putting the values of x11 and y1 in above equationa,\n",
      "Iab1 = x11+1j*y1                                     #A\n",
      "Ibc1 = (x11-40)+1j*(y1+30)                           #A\n",
      "Icd1 = (x11-40+1j*(y1+30))-(120+0j)                   #A\n",
      "Ida1 = ((x11-160)+1j*(y1+30))-(70*(0.866-0.5j))          #A\n",
      "magVap = round(magVa/3**0.5)                     #Voltage at supply end A(V)\n",
      "Vb = magVap*(1+0j)-Iab1*Zab               #Voltage at station B(V/phase)\n",
      "Vc = Vb-Ibc1*Zbc               #Voltage at station C(V/phase)\n",
      "Vd = Vc-Icd1*Zcd               #Voltage at station D(V/phase)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Current in section AB is\",Iab1,\"A\"\n",
      "print \"Current in section BC is\",Ibc1,\"A\"\n",
      "print \"Current in section CD is\",Icd1,\"A\"\n",
      "print \"Current in section DA is\",Ida1,\"A\"\n",
      "print \"Voltage at A is\",magVap*(1+0j),\"V/phase\"\n",
      "print \"Voltage at B is\",Vb,\"V/phase\"\n",
      "print \"Voltage at C is\",Vc,\"V/phase\"\n",
      "print \"Voltage at D is\",Vd,\"V/phase\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current in section AB is (139.8-42.8j) A\n",
        "Current in section BC is (99.8-12.8j) A\n",
        "Current in section CD is (-20.2-12.8j) A\n",
        "Current in section DA is (-80.82+22.2j) A\n",
        "Voltage at A is (6351+0j) V/phase\n",
        "Voltage at B is (6185.52-41.08j) V/phase\n",
        "Voltage at C is (6054.24-115.54j) V/phase\n",
        "Voltage at D is (6064-95.2j) V/phase\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.7, Page Number: 368"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "\n",
      "#Variable declaration:\n",
      "Pr = 10                        #load connected to line R(kW)\n",
      "Py = 8                        #load connected to line Y(kW)\n",
      "Pb = 5                        #load connected to line B(kW)\n",
      "Vl = 400                      #line voltage(V)\n",
      "#the loads are non-reactive.\n",
      "\n",
      "#Calculation:\n",
      "Vp = round(Vl/3**0.5)                    #phase voltage(V)\n",
      "Ir = Pr*1000/Vp                 #A\n",
      "Iy = Py*1000/Vp                  #A\n",
      "Ib = Pb*1000/Vp                  #A\n",
      "\n",
      "#Resolving the three currents along x-axis and y-axis, we have,\n",
      "Ih = Iy*math.cos(math.pi/6)-Ib*math.cos(math.pi/6)         #Resultant horizontal component(A)\n",
      "Iv = Ir-Iy*math.cos(math.pi/3)-Ib*math.cos(math.pi/3)       #Resultant vertical component(A)\n",
      "In = (Ih**2+Iv**2)**0.5          #current in neutral wire(A)\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"(i) Ir =\",round(Ir,1),\"A\"\n",
      "print \"    Iy =\",round(Iy,1),\"A\"\n",
      "print \"    Ib =\",round(Ib,2),\"A\"\n",
      "print \"(ii) Current in neutral wire is\",round(In,1),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) Ir = 43.3 A\n",
        "    Iy = 34.6 A\n",
        "    Ib = 21.65 A\n",
        "(ii) Current in neutral wire is 18.9 A\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.8, Page Number: 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Vl = 400                          #line voltage(V)\n",
      "Vp = 230                          #voltage across lamp(V)\n",
      "I1 = 70                           #current in load RN(A)\n",
      "I2 = 84                           #current in load YN(A)\n",
      "I3 = 33                           #current in load BN(A)\n",
      "Im = 200                         #current taken by the motor(A)\n",
      "pf = 0.2                        #power factor(lagging)\n",
      "\n",
      "#Calculation:\n",
      "#Lamp load alone:\n",
      "Ih = I2*math.cos(math.pi/6)-I3*math.cos(math.pi/6)         #Resultant H-component(A)\n",
      "Iv = I1-I3*math.cos(math.pi/3)-84*math.cos(math.pi/3)      #Resultant V-component(A)\n",
      "In = math.sqrt(Ih**2+Iv**2)                          #Neutral current(A)\n",
      "\n",
      "\n",
      "#Both lamp load and motor load:\n",
      "Ir = Im*pf                             #Active component of motor current(A)\n",
      "Ix = Im*math.sin(math.acos(pf))        #Reactive component of motor current(A)\n",
      "IR = ((Ir+I1)**2+Ix**2)**0.5          #A\n",
      "IY = ((Ir+I2)**2+Ix**2)**0.5          #A\n",
      "IB = ((Ir+I3)**2+Ix**2)**0.5          #A\n",
      "P = Vp*(I1+I2+I3)*1                   #Watt       #( cos phy_L = 1)\n",
      "Pm = 3**0.5*Vl*Im*pf                  #Power supplied to motor(W)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"Lamp load alone: neutral curent is\",round(In,2),\"A\"\n",
      "print \"\\nWhen Both lamp load and motor load is present:\"\n",
      "print \"The current components are:\"\n",
      "print \"Neutral current is\",round(In,2),\"A\"\n",
      "print \"IR =\",round(IR,1),\"A;\\tIY =\",round(IY,0),\"A;\\tIB =\",round(IB,2),\"A\"\n",
      "print \"Power supplied to the lamp is\",P,\"W\"\n",
      "print \"Power supplied to the motor is\",round(Pm),\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lamp load alone: neutral curent is 45.64 A\n",
        "\n",
        "When Both lamp load and motor load is present:\n",
        "The current components are:\n",
        "Neutral current is 45.64 A\n",
        "IR = 224.7 A;\tIY = 232.0 A;\tIB = 209.11 A\n",
        "Power supplied to the lamp is 43010 W\n",
        "Power supplied to the motor is 27713.0 W\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.9, Page Number: 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Prn = 20                          #kW\n",
      "pf1 = 1                          #power factor of loaf RN\n",
      "kVAyn = 28.75                   #kVA of load YN\n",
      "kVAbn = 28.75                   #kVA of load BN\n",
      "pf2 = 0.866                     #power factor of laod YN & BN each.(lagging)\n",
      "Vl = 400                        #line voltage(V)\n",
      "Vp = 230                         #phase voltage(V)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "phy1 = math.acos(pf1)\n",
      "phy2 = math.acos(pf2)\n",
      "phy3 = phy2\n",
      "Ir = Prn*1000/Vp                   #A\n",
      "Iy = kVAyn*1000/Vp                 #A\n",
      "Ib = kVAbn*1000/Vp                 #A\n",
      "Ih = Ir-Iy*math.cos(phy2)-Ib*math.cos(phy2)          #A\n",
      "Iv = 0+Iy*math.sin(phy2)-Iy*math.sin(phy3)           #A\n",
      "In = math.sqrt(Ih**2+Iv**2)                               #A\n",
      "#When load from B to N removed.:\n",
      "#When the load from B to N is removed, the various line currents are:\n",
      "#Ir in phase with Vrn; Iy lagging by 30 deg.; Ib = 0.\n",
      "Ir1 = Ir\n",
      "Iy1 = Iy;     Ib1 = 0                    #A\n",
      "Ih1 = Ir1-Iy1*math.cos(math.pi/6)             #A\n",
      "Iv1 = 0-Iy1*math.sin(math.pi/6)               #A\n",
      "In1 = math.sqrt(Ih1**2+Iv1**2)               #A\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"When no changes were made, the various currents are:\"\n",
      "print \"Ir =\",round(Ir,2),\"A;\\tIy =\",Iy,\"A;\\tIb =\",Ib,\"A;\\tIn =\",round(In,2),\"A\"\n",
      "print \"\\nWhen load from B to N removed, the various currents are:\"\n",
      "print \"Ir =\",round(Ir1,2),\"A;\\tIy =\",Iy1,\"A;\\tIb =\",Ib1,\"A;\\tIn =\",round(In1,2),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When no changes were made, the various currents are:\n",
        "Ir = 86.96 A;\tIy = 125.0 A;\tIb = 125.0 A;\tIn = 129.54 A\n",
        "\n",
        "When load from B to N removed, the various currents are:\n",
        "Ir = 86.96 A;\tIy = 125.0 A;\tIb = 0 A;\tIn = 66.03 A\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.10, Page Number: 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import cmath\n",
      "import math\n",
      "\n",
      "#Variable declaration:\n",
      "Vl = 400                       #line voltage(V)\n",
      "Vp = 230                         #phase voltage(V)\n",
      "Ir = 30                        #load current at R-phase(A)\n",
      "pf1 = 0.866                    #power factor for R-phase(lagging)\n",
      "Iy = 30                        ##load current at Y-phase(A)\n",
      "pf2 = 0.866                    #power factor for R-phase(lagging)\n",
      "Ib = 30                         ##load current at R-phase(A)\n",
      "pf3 = 1.0                    #power factor for R-phase(lagging)\n",
      "R = 0.2                       #resistance of each line conductor(ohm)\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "phy1 = math.acos(pf1)\n",
      "phy2 = math.acos(pf2)\n",
      "phy3 = math.acos(pf3)\n",
      "\n",
      "VR = Vp*(1+0j)                #V\n",
      "VY = Vp*(math.cos(-2*math.pi/3)+math.sin(-2*math.pi/3))        #V\n",
      "VB = Vp*(math.cos(2*math.pi/3)+math.sin(-2*math.pi/3))          #V\n",
      "\n",
      "#the line currents can be expressed as :\n",
      "IR = cmath.rect(30,-math.pi/6)                    #A\n",
      "IY = cmath.rect(30,-math.pi/2)                     #A\n",
      "IB = cmath.rect(30,2*math.pi/3)                   #A\n",
      "IN = IR+IY+IB                                #A\n",
      "\n",
      "#Since, the area of X-section of neutral is half of any line conductor.\n",
      "Rn = 2*R                                 #resistance of neutral(ohm)\n",
      "#ER = VR + Drop in R phase + Drop in neutral\n",
      "ER = VR+R*IR+IN*2*R                    #V\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The supply end voltage for R phase is\",round(ER.real,3)+1j*round(ER.imag,3),\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The supply end voltage for R phase is (239.588-10.608j) V\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 14.11, Page Number: 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable declaration:\n",
      "Vl = 400                    #line voltage(V)\n",
      "Vp = 230                      #phase voltage(A)\n",
      "Pln = 100                   #load connected b/n LN(W)\n",
      "Pyn = 150                   #load connected b/n YN(W)\n",
      "\n",
      "\n",
      "\n",
      "#Calculation:\n",
      "#before disconnecting the neutral wire,\n",
      "R1 = Vp**2/Pln                        #Resistance of lamp L1(ohm)\n",
      "R2 = Vp**2/Pyn                        #Resistance of lamp L2(ohm)\n",
      "\n",
      "#When the neutral wire is disconnected,\n",
      "EL = 400                              #V\n",
      "I = EL/(R1+R2)                       #A\n",
      "V1 = I*R1                            #Voltage across lamp L1(V)\n",
      "V2 = I*R2                            #Voltage across lamp L2(V)\n",
      "\n",
      "\n",
      "\n",
      "#Result:\n",
      "print \"The voltage across the lamps are:\"\n",
      "print \"Lamp 1, Voltage =\",V1,\"V ;\\tLamp 2, voltage =\",V2,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The voltage across the lamps are:\n",
        "Lamp 1, Voltage = 240.0 V ;\tLamp 2, voltage = 160.0 V\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}