{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 4: DIRECT CURRENT GENERATORS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1, Page number 143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import *\n",
      "\n",
      "#Variable declaration\n",
      "N = 100.0         #Number of turns\n",
      "\n",
      "#Calculation\n",
      "t = Symbol('t')\n",
      "e = N*diff(0.05*sin(314*t), t, 1)\n",
      "\n",
      "#Result\n",
      "print('Induced voltage at the coil terminals , e = ' + repr(e) + ' V')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Induced voltage at the coil terminals , e = 1570.0*cos(314*t) V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page number 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "l = 0.65       #Length of conductor(m)\n",
      "v = 35.0       #Speed of conductor(m/s)\n",
      "B = 0.8        #Magnetic flux density(Tesla)\n",
      "\n",
      "#Calculation\n",
      "e = B*l*v      #Induced voltage at the conductor(V)\n",
      "\n",
      "#Result\n",
      "print('Induced voltage at the conductor , e = %.1f V' %e)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Induced voltage at the conductor , e = 18.2 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page number 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 1.5                    #Length of conductor(m)\n",
      "v = 20.0                   #Velocity of conductor(m/s)\n",
      "theta = 35.0*math.pi/180   #Angle(radians)\n",
      "B = 0.9                    #Magnetic flux density(Wb/m^2)\n",
      "\n",
      "#Calculation\n",
      "e = B*l*v*math.sin(theta)  #Induced voltage at the conductor(V)\n",
      "\n",
      "#Result\n",
      "print('Induced voltage at the conductor , e = %.1f V' %e)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Induced voltage at the conductor , e = 15.5 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page number 152-153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 4.0          #Number of poles\n",
      "S = 40.0         #Number of slots\n",
      "C = 10.0         #Number of conductors per slot\n",
      "phi = 0.02       #Flux per pole(Wb)\n",
      "N = 1200.0       #Speed(rpm)\n",
      "\n",
      "#Calculation\n",
      "Z = S*C                   #Total number of conductors\n",
      "A = 2.0                   #Number of parallel paths for Wave winding\n",
      "E_g = P*phi*Z*N/(60*A)    #Generated emf(V)\n",
      "\n",
      "#Result\n",
      "print('Generated emf , E_g = %.f V' %E_g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Generated emf , E_g = 320 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page number 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P = 6.0       #Number of poles\n",
      "Z = 600.0     #Number of conductors\n",
      "phi = 0.05    #Flux per pole(Wb)\n",
      "N = 1000.0    #Speed of generator(rpm)\n",
      "I_a = 120.0   #Current supplied by generator(A)\n",
      "\n",
      "#Calculation\n",
      "A = P                                 #Number of parallel paths for lap winding\n",
      "E_g = P*phi*Z*N/(60*A)                #Generated voltage(V)\n",
      "T_em = (P*Z*phi)/(2*math.pi*A)*I_a    #Electromagnetic torque(N-m)\n",
      "\n",
      "\n",
      "#Result\n",
      "print('Generated voltage , E_g = %.f V' %E_g)\n",
      "print('Electromagnetic torque , T_em = %.2f N-m' %T_em)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Generated voltage , E_g = 500 V\n",
        "Electromagnetic torque , T_em = 572.96 N-m\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page number 156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_t = 220.0     #Shunt generator voltage(V)\n",
      "I_L = 250.0     #Load current(A)\n",
      "R_sh = 50.0     #Shunt field resistance(ohm)\n",
      "R_a = 0.02      #Armature resistance(ohm)\n",
      "\n",
      "#Calculation\n",
      "I_sh = V_t/R_sh     #Shunt field current(A)\n",
      "I_a = I_L+I_sh      #Armature current(A)\n",
      "E_g = V_t+I_a*R_a   #Generated voltage(V)\n",
      "\n",
      "#Result\n",
      "print('Generated voltage , E_g = %.2f V' %E_g)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Generated voltage , E_g = 225.09 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page number 158-160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "E = 25.0          #Power of compound generator(kW)\n",
      "V_t = 220.0       #Terminal voltage(V)\n",
      "R_a = 0.07        #Armature resistance(ohm)\n",
      "R_se = 0.05       #Series resistance(ohm)\n",
      "R_sh = 55.0       #Shunt field resistance(ohm)\n",
      "V_brush = 1.0     #Voltage drop per brush(V)\n",
      "\n",
      "#Calculation\n",
      "I_L = E*10**3/V_t                       #Load current in A\n",
      "I_sh = V_t/R_sh                         #Shunt field current(A)\n",
      "I_a = I_sh+I_L                          #Armature current(A)\n",
      "#For case(i)\n",
      "E_g1 = V_t+I_a*(R_a+R_se)+2*V_brush     #Generated emf(V)\n",
      "#For case(ii)\n",
      "V_ab = V_t+I_L*R_se                     #Voltage across the shunt field(V)\n",
      "I_sh2 = V_ab/R_sh                       #Current in the shunt field(A)\n",
      "I_a2 = I_sh2+I_L                        #Armature current(A)\n",
      "E_g2 = V_ab+I_a2*R_a+2*V_brush          #Generated emf(V)\n",
      "\n",
      "#Result\n",
      "print('(i)  Generated emf when generator is connected in long shunt , E_g = %.f V' %E_g1)\n",
      "print('(ii) Generated emf when generator is connected in short shunt , E_g = %.1f V' %E_g2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Generated emf when generator is connected in long shunt , E_g = 236 V\n",
        "(ii) Generated emf when generator is connected in short shunt , E_g = 235.9 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8, Page number 160-161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_t = 220.0     #Shunt generator voltage(V)\n",
      "I_L = 146.0     #Current delivered by generator(A)\n",
      "R_sh = 55.0     #Shunt field resistance(ohm)\n",
      "R_a = 0.012     #Armature resistance(ohm)\n",
      "R_se = 0.02     #Series field resistance(ohm)\n",
      "R_di = 0.03     #Diverter field resistance(ohm)\n",
      "\n",
      "#Calculation\n",
      "I_sh = V_t/R_sh               #Shunt field current(A)\n",
      "I_a = I_L+I_sh                #Armature current(A)\n",
      "R_com = R_se*R_di/(R_se+R_di) #Combined resistance(ohm)\n",
      "E_g = V_t+I_a*(R_a+R_com)     #Generated voltage(V)\n",
      "P_lsd = I_a**2*R_com          #Power loss in series field and diverter(W)\n",
      "P_la = I_a**2*R_a             #Power loss in the armature circuit resistance(W)\n",
      "P_lsh =  V_t*I_sh             #Power loss in shunt field resistance(W)\n",
      "P_dl = I_L*V_t                #Power delivered(W)\n",
      "\n",
      "#Result\n",
      "print('Generated voltage , E_g = %.1f V' %E_g)\n",
      "print('Power loss in the series field and diverter , P_lsd = %.1f W' %P_lsd)\n",
      "print('Power loss in the armature circuit resistance , P_la = %.1f W' %P_la)\n",
      "print('Power loss in the shunt field resistance , P_lsh = %.f W' %P_lsh)\n",
      "print('Power delivered to the load , P_dl = %.f W' %P_dl)\n",
      "print('\\nNOTE : ERROR : Shunt field resistance is taken as 50 ohm while solving I_sh in textbook but it is 55 ohm as per textbook question')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Generated voltage , E_g = 223.6 V\n",
        "Power loss in the series field and diverter , P_lsd = 270.0 W\n",
        "Power loss in the armature circuit resistance , P_la = 270.0 W\n",
        "Power loss in the shunt field resistance , P_lsh = 880 W\n",
        "Power delivered to the load , P_dl = 32120 W\n",
        "\n",
        "NOTE : ERROR : Shunt field resistance is taken as 50 ohm while solving I_sh in textbook but it is 55 ohm as per textbook question\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page number 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 4.0       #Number of poles\n",
      "Z = 500.0     #Number of conductors\n",
      "I_a = 30.0    #Current delivered by generator(A)\n",
      "alpha = 6.0   #Angle at which brushes are displaced angle(degree)\n",
      "\n",
      "#Calculation\n",
      "A = 2.0                               #Number of parallel paths for Wave winding\n",
      "I_c = I_a/A                           #Current per conductor(A)\n",
      "#For case(i)\n",
      "AT_d = Z*I_c*alpha/360                #Demagnetizing ampere-turns per pole(At)\n",
      "#For case(ii)\n",
      "AT_c = Z*I_c*((1/(2*P))-(alpha/360))  #Cross magnetizing ampere-turns per pole(At)\n",
      "\n",
      "#Result\n",
      "print('(i)  Demagnetizing ampere-turns , AT_d = %.f At' %AT_d)\n",
      "print('(ii) Cross-magnetizing ampere-turns , AT_c = %.1f At' %AT_c)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  Demagnetizing ampere-turns , AT_d = 125 At\n",
        "(ii) Cross-magnetizing ampere-turns , AT_c = 812.5 At\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page number 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Power = 12.0     #Power(kW)\n",
      "P = 4.0          #Number of poles\n",
      "Z = 500.0        #Number of conductors\n",
      "V_t = 250.0      #Generator voltage(V)\n",
      "N = 1000.0       #Speed(rpm)\n",
      "P_cu = 600       #Full load copper loss(W)\n",
      "brush_drop = 2.0 #Total brush drop(V)\n",
      "\n",
      "#Calculation\n",
      "A = P                                 #Number of parallel paths for lap winding\n",
      "I_a = Power*10**3/V_t                 #Armature current(A)\n",
      "R_a = P_cu/I_a**2                     #Armature resistance(ohm)\n",
      "E_g = V_t+I_a*R_a+brush_drop          #Generated voltage(V)\n",
      "phi = E_g*60*A/(P*Z*N)                #Flux per pole(Wb)\n",
      "\n",
      "#Result\n",
      "print('Flux per pole , \u03a6 = %.3f Wb' %phi)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flux per pole , \u03a6 = 0.032 Wb\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11, Page number 176-177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 4.0             #Number of poles\n",
      "I_L = 25.0          #Current delivered by generator(A)\n",
      "V_t = 230.0         #Generator terminal voltage(V)\n",
      "R_a = 0.2           #Armature resistance(ohm)\n",
      "R_sh = 55.0         #Shunt field resistance(ohm)\n",
      "V_brush = 1.0       #Voltage drop per brush(V)\n",
      "\n",
      "#Calculation\n",
      "I_sh = V_t/R_sh                #Shunt field current(A)\n",
      "I_a = I_L+I_sh                 #Armature current(A)\n",
      "E_g = V_t+I_a*R_a+2*V_brush    #Induced voltage(V)\n",
      "P_arm = E_g*I_a                #Power generated in armature(W)\n",
      "P_L = V_t*I_L                  #Power absorbed by load(W)\n",
      "n = (P_L/P_arm)*100            #Efficiency(percent)\n",
      "\n",
      "#Result\n",
      "print('Induced voltage , E_g = %.1f V' %E_g)\n",
      "print('Efficiency of generator , \u03b7 = %.1f percent' %n)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Induced voltage , E_g = 237.8 V\n",
        "Efficiency of generator , \u03b7 = 82.8 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}