{
 "metadata": {
  "name": "",
  "signature": "sha256:8fbea94d95545217443f7f11dc625fd30401d8ada653a14429e8ea1197cd191c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7: Synchronous Generators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2, Page 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P=4;#no. of poles\n",
      "S=48;#no. of slots\n",
      "\n",
      "#Calculations\n",
      "S_p=S/P;#slots per pole\n",
      "S_span=180/S_p;#slot span\n",
      "n=S/(3*P);#no. of coils in phase group\n",
      "C_span=9*S_span;#coil span\n",
      "K_p=math.sin(C_span/2*math.pi/180);\n",
      "\n",
      "#Result\n",
      "print 'pitch factor =%.3f'%K_p"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "pitch factor =0.921\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3, Page 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P=12;#no. of poles\n",
      "S=108;#no. of slots\n",
      "\n",
      "#Calculations\n",
      "n=S/(3*P);#no. of coils in a phase group\n",
      "S_p=S/P;\n",
      "Y=180/S_p;#slot span (in electrical degree)\n",
      "K_d=(math.sin(3*(Y/2)*math.pi/180))/(3*math.sin(Y/2*math.pi/180));\n",
      "\n",
      "#Result\n",
      "print 'distribution factor=%.2f'%K_d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distribution factor=0.96\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5, Page 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N_m=375;#speed of motor (in rpm)\n",
      "N=10;#no of turns\n",
      "P=16;#no. of poles\n",
      "S=144;#no. of slots\n",
      "Phy=0.025;#flux (in Weber)\n",
      "\n",
      "#Calculations&Results\n",
      "S_p=S/P;#slots per pole\n",
      "Y=180/S_p;#slot span\n",
      "C_p=Y*7;#coil pitch\n",
      "K_p=math.sin(C_p/2*math.pi/180);#pitch factor\n",
      "K_d=(math.sin(3*(Y/2)*math.pi/180))/(3*math.sin(Y/2*math.pi/180));#distribution factor\n",
      "K_w=K_p*K_d;#winding factor\n",
      "N_e=P*3*N*K_w/2;#effective no. of turns\n",
      "f=N_m*P/120;\n",
      "print '(a) frequency of induced voltage (in Hertz)=%.f'%f\n",
      "E_a=4.44*f*N_e*Phy;\n",
      "print '(b) Rms value of Phase voltage (in Volts)=%.2f'%E_a;\n",
      "E_L=E_a*math.sqrt(3);\n",
      "print '(c) line voltage (in Volts)=%.f'%E_L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) frequency of induced voltage (in Hertz)=50\n",
        "(b) Rms value of Phase voltage (in Volts)=1201.35\n",
        "(c) line voltage (in Volts)=2081\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.6, Page 426"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V=208;#in volts\n",
      "P_o=9000;\n",
      "\n",
      "#Calculations&Results\n",
      "R=complex(0.1,5.6);\n",
      "V_a=int(V/math.sqrt(3));#rms value of per phase voltage\n",
      "I_a=P_o/(3*V_a);#rms value of per phase current\n",
      "print \"(a)  For 80% lagging power factor of load\"\n",
      "theta=(-1)*math.acos(0.8);\n",
      "I_a_L=(I_a)*complex(math.cos(theta),math.sin(theta));\n",
      "E_a=V_a+I_a_L*R;#in volts\n",
      "VR=((abs(E_a)-V_a)/V_a)*100;\n",
      "print 'voltage regulation (%%)=%.1f'%VR\n",
      "print \"(b)  For Unity power factor of load\"\n",
      "theta=math.acos(1);\n",
      "I_a_L=(I_a)*complex(math.cos(theta),math.sin(theta))\n",
      "E_a=V_a+I_a_L*R;#in volts\n",
      "VR=((abs(E_a)-V_a)/V_a)*100;\n",
      "print 'voltage regulation (%%)=%.2f'%VR\n",
      "print \"(c)  For 80% leading power factor of load\"\n",
      "theta=math.acos(0.8);\n",
      "I_a_L=(I_a)*complex(math.cos(theta),math.sin(theta));\n",
      "E_a=V_a+I_a_L*R;#in volts\n",
      "VR=((abs(E_a)-V_a)/V_a)*100;\n",
      "print 'voltage regulation (%%)=%.2f'%VR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  For 80% lagging power factor of load\n",
        "voltage regulation (%)=94.8\n",
        "(b)  For Unity power factor of load\n",
        "voltage regulation (%)=55.02\n",
        "(c)  For 80% leading power factor of load\n",
        "voltage regulation (%)=-0.26\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.7, Page 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V=208;#in volts\n",
      "N_m=1200;#speed of generator (in rpm)\n",
      "P_r=9000;#rated power in (Volt-Amperes)\n",
      "\n",
      "#Calculations&Results\n",
      "Z_a=complex(0.3,5);#armature impedance (ohm/phase)\n",
      "R_f=4.5;#feild winding resistance\n",
      "P_rot=500;#rotational loss (in Watts)\n",
      "I_f=5;#feild winding current\n",
      "pf=0.8;#lagging\n",
      "V_a=int (V/math.sqrt(3));\n",
      "theta=(-1)*math.acos(pf);\n",
      "I_a_o=P_r/(3*V_a);#per phase armature current (magnitude)\n",
      "I_a=I_a_o*complex(math.cos(theta),math.sin(theta));\n",
      "E_a=V_a+(I_a*Z_a);#per phase generated voltage\n",
      "VR=((abs(E_a)-V_a)/V_a)*100;\n",
      "print '(a) Voltage Regulation (%%)=%.2f'%VR\n",
      "P_o=3*V_a*abs(I_a)*pf;#power output \n",
      "P_cu=3*((abs(I_a))**2)*0.3;#copper loss\n",
      "P_d=P_o+P_cu;#power developed\n",
      "P_c=P_rot+(I_f**2)*R_f;#constant loss\n",
      "P_in=P_d+P_c;#power input\n",
      "Eff=(P_o/P_in)*100;\n",
      "print '(b) Efficiency (%%)=%.f'%(math.ceil(Eff))\n",
      "w_s=2*math.pi*N_m/60;\n",
      "T=(P_d+P_rot)/w_s;\n",
      "print '(c) Torque developed (in Newton-meter)=%.2f'%T"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Voltage Regulation (%)=85.44\n",
        "(b) Efficiency (%)=86\n",
        "(c) Torque developed (in Newton-meter)=65.75\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.8, Page 438"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V_r=2300;#rated voltage (in Volts)\n",
      "P_r=500*10**3;#rated power (in Volt-Amperes)\n",
      "pf=0.8;#lagging\n",
      "theta=-1*(math.acos(0.8));\n",
      "I_sc=150;#short circuit current (in Amperes)\n",
      "\n",
      "#Calculations&Results\n",
      "V_anL=V_r/math.sqrt(3);#open-circuit phase voltage\n",
      "Z_sc=V_anL/I_sc;#(in ohms)\n",
      "X_s=math.sqrt((Z_sc**2)-0.5**2);\n",
      "print 'synchronous reactance per phase (in ohms)=%.2f'%X_s\n",
      "I_ao=P_r/(3*V_anL);#full load current (magnitude)\n",
      "I_a=I_ao*complex(math.cos(theta),math.sin(theta));\n",
      "V_b=V_anL;#base value of voltage\n",
      "I_b=I_ao;#base value of current\n",
      "Z_b=V_b/I_b;#base value of impedance\n",
      "I_apu=I_a/I_b;#per unit armature current\n",
      "V_pu=V_anL/V_b;#per unit voltage\n",
      "Z_spu=complex(0.5,X_s)/Z_b;#per unit impedance\n",
      "E_apu=V_pu+(I_apu*Z_spu);\n",
      "VR=(abs(E_apu)-1)*100;\n",
      "print 'voltage regulation (%%)=%.2f'%VR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "synchronous reactance per phase (in ohms)=8.84\n",
        "voltage regulation (%)=66.68\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.9, Page 450"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "V_r=13.8*10**3;#in volts\n",
      "R_a=0;\n",
      "X_d=1.83;#in ohms\n",
      "X_q=1.21;#in ohms\n",
      "P_r=70.*10**6;#in Volt-Ampere\n",
      "pf=0.8;#lagging\n",
      "theta=(-1)*math.acos(pf);\n",
      "\n",
      "#Calculations&Results\n",
      "V_a=V_r/(math.sqrt(3));#rms value of per phase voltage\n",
      "I_ao=P_r/(3*V_a);\n",
      "tan_delta=((I_ao*X_q*math.cos(theta))-(I_ao*R_a*math.sin(theta)))/(V_a+(I_ao*((R_a*math.cos(theta))-(X_q*math.sin(theta)))));\n",
      "delta=math.atan(tan_delta);\n",
      "alpha=delta+math.acos(pf);\n",
      "I_d=I_ao*math.sin(alpha)*(complex(math.cos(delta-90),math.sin(delta-90)));\n",
      "I_q=I_ao*math.cos(alpha)*(complex(math.cos(delta),math.sin(delta)));\n",
      "E_a=abs(V_a+(I_q*complex(0,X_q))+(I_d*complex(0,X_d)));\n",
      "VR=((E_a-V_a)/V_a)*100;\n",
      "print 'voltage regulation (%%)=%.2f'%VR\n",
      "P_d=3*V_a*I_ao*pf;\n",
      "print 'Power developed (in Mega-Watts)=%.f'%(P_d/(10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage regulation (%)=45.99\n",
        "Power developed (in Mega-Watts)=56\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.10, Page 458"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import cmath\n",
      "\n",
      "#Variable declaration\n",
      "Z_s1=complex(0,5);#ohm/phase\n",
      "Z_s2=complex(0,8);#ohm/phase\n",
      "\n",
      "#Calculations&Results\n",
      "Z_L=complex(4,3);#load impedance (in ohm/phase)\n",
      "def phasor(theta):\n",
      "    return complex(math.cos(theta*math.pi/180),math.sin(theta*math.pi/180));\n",
      "\n",
      "def angle(x,y):\n",
      "    return math.degrees(math.atan(y/x))\n",
      "\n",
      "E_a1=120*phasor(10);\n",
      "E_a2=120*phasor(20);\n",
      "V_a=(((E_a1*Z_s2)+(E_a2*Z_s1))/((Z_L*(Z_s1+Z_s2))+(Z_s1*Z_s2)))*Z_L;\n",
      "V_a_m = math.sqrt(V_a.real**2+V_a.imag**2)\n",
      "print '(a) magnitude of phase voltage (in Volts)=%.2f'%V_a_m\n",
      "a1=angle(V_a.real,V_a.imag);\n",
      "print 'phase angle of voltage (in Degree)=%.2f'%a1\n",
      "I_a1=(E_a1-V_a)/Z_s1;\n",
      "I_a1_m = math.sqrt(I_a1.real**2+I_a1.imag**2)\n",
      "print '(b) magnitude of armature current of generator 1 (in Amperes)=%.2f'%(I_a1_m)\n",
      "a2=angle(I_a1.real,I_a1.imag)\n",
      "print 'phase angle of armature current of generator 1 (in Degree)=%.2f'%a2\n",
      "I_a2=(E_a2-V_a)/Z_s2;\n",
      "I_a2_m = math.sqrt(I_a2.real**2+I_a2.imag**2)\n",
      "print 'magnitude of armature current of generator 2 (in Amperes)=%.2f'%I_a2_m\n",
      "a3=angle(I_a2.real,I_a2.imag)\n",
      "print 'phase angle of armature current of generator 2 (in Degree)=%.2f'%a3\n",
      "P_o1=3*V_a*I_a1.conjugate()\n",
      "P_o2=3*V_a*I_a2.conjugate()\n",
      "print ' (c) Power developed of generator 1 (in Watts)=%.2f'%(P_o1.real)\n",
      "print 'Power developed of generator 2 (in Watts)=%.2f'%(P_o2.real)\n",
      "P_o=P_o1.real+P_o2.real;\n",
      "print '(d) total power output (in Watts)=%.1f'%P_o"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) magnitude of phase voltage (in Volts)=82.17\n",
        "phase angle of voltage (in Degree)=-5.93\n",
        "(b) magnitude of armature current of generator 1 (in Amperes)=9.36\n",
        "phase angle of armature current of generator 1 (in Degree)=-51.17\n",
        "magnitude of armature current of generator 2 (in Amperes)=7.31\n",
        "phase angle of armature current of generator 2 (in Degree)=-32.06\n",
        " (c) Power developed of generator 1 (in Watts)=1624.15\n",
        "Power developed of generator 2 (in Watts)=1617.13\n",
        "(d) total power output (in Watts)=3241.3\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}