{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 7:Synchronous Machines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.1:Page number-412"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "n= 3000.0 rpm\n",
      "D= 0.764 m\n",
      "output of the alternator= 3505.213 KVA\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#case a\n",
    "\n",
    "f=150\n",
    "p=2\n",
    "\n",
    "#assume the diameter of the stator bore is d meter\n",
    "n=120*50/2  #where n is rotor speed\n",
    "\n",
    "print \"n=\",round(n,0),\"rpm\"\n",
    "\n",
    "pi=3.14\n",
    "d=(120*60)/(pi*3000)  \n",
    "\n",
    "print \"D=\",round(d,3),\"m\"\n",
    "\n",
    "#case b\n",
    "\n",
    "k=2\n",
    "l=1\n",
    "o=k*d**2*n*l\n",
    "\n",
    "print \"output of the alternator=\",round(o,3),\"KVA\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.2:Page number-423 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The total number of cycles the clock should perform in 24 hours for correct time is= 4320000.0\n",
      "The number of cycles clock performs from 8am to 7pm is= 1977120.0\n",
      "The desired average frequency for correct time for remaining 13 hours is= 50.06154\n",
      "s= 0.8\n",
      "time= 57.6\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#The total number of cycles the clock should perform in 24 hours for correct time is\n",
    "\n",
    "t=24*60*60*50\n",
    "\n",
    "print \"The total number of cycles the clock should perform in 24 hours for correct time is=\",round(t,0)\n",
    "\n",
    "#The number of cycles the clock performs from 8am to 7pm is\n",
    "\n",
    "n=(6*49.95+5*49.90)*60*60\n",
    "\n",
    "print \"The number of cycles clock performs from 8am to 7pm is=\",round(n,0)\n",
    "\n",
    "#the number of cycles required in remaining 13 hours is t-n that is 2342.88*10**3\n",
    "\n",
    "a=(2342.88*10**3)/(13*60*60)\n",
    "\n",
    "print \"The desired average frequency for correct time for remaining 13 hours is=\",round(a,5)\n",
    "\n",
    "#The shortfall in number of cycles from 8am to 7pm\n",
    "\n",
    "s=0.05*6+0.10*5\n",
    "\n",
    "print \"s=\",round(s,3)\n",
    "\n",
    "#The time by which the clock is incorrect at 7pm\n",
    "\n",
    "time=(0.8*60*60)/50\n",
    " \n",
    "print \"time=\",round(time,5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.3:Page number-423"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency= 50.0 Hz\n",
      "Phase emf= 2301.696 v\n",
      "The line voltage is= 3986.654 v\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#given\n",
    "\n",
    "n=500 #speed to rotation\n",
    "p=12  #poles\n",
    "\n",
    "#case a\n",
    "\n",
    "f=n*p/120  #frequency\n",
    "print \"frequency=\",round(f,0),\"Hz\"\n",
    "    \n",
    "#case b\n",
    "\n",
    "kp=1  #kp is the winding at full pitch\n",
    "\n",
    "#kd is the distribution factor where kd=sin[mk/2]/msin(k/2) where k is a gama function\n",
    "\n",
    "#m=108/12*3\n",
    "m=3\n",
    "\n",
    "#gama or k=180/slots per pole=9 k=20\n",
    "\n",
    "#after substituting above values in kd we get kd=0.96\n",
    "\n",
    "#z=108*12/3 = 432\n",
    "\n",
    "ep=2.22*1*0.96*432*50*50*10**-3\n",
    "\n",
    "print \"Phase emf=\",round(ep,3),\"v\"\n",
    "\n",
    "#case c\n",
    "\n",
    "vl=3**0.5*ep\n",
    "\n",
    "print \"The line voltage is=\",round(vl,3),\"v\"\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.4:Page number-424"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "n= 600.0 rpm\n",
      "phase emf= 1864.44569 v\n",
      "the line voltage= 3229.315 v\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#given\n",
    "\n",
    "f=50 #frequency\n",
    "p=10 #number of poles\n",
    "\n",
    "#case a\n",
    "n=120*f/p\n",
    "\n",
    "print \"n=\",round(n,0),\"rpm\"\n",
    "\n",
    "#case b\n",
    "\n",
    "#the pitch factor kp=0.966\n",
    "\n",
    "#m=2 and gama=180/slots per pole and it is obtained as 30\n",
    "\n",
    "#kd=sin[(mgama)/2]/msin(gama/2)=0.966\n",
    "\n",
    "z=6*2*10\n",
    "\n",
    "ep=z*2.22*0.966*0.966*50*0.15\n",
    "\n",
    "print \"phase emf=\",round(ep,5),\"v\"\n",
    "\n",
    "#case c\n",
    "\n",
    "el=3**0.5*ep\n",
    "\n",
    "print \"the line voltage=\",round(el,3),\"v\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.5:Page number-436"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5.44650074006\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#given\n",
    "\n",
    "vt=1905.26 #at angle 0\n",
    "angle=36.87\n",
    "ia=43.74 #at angle -36.87\n",
    "zs=3.51  #at angle 85.91\n",
    "\n",
    "#e=vt+ia*zs\n",
    "#(1905.26+43.74*3.51angle(85.91-36.87))\n",
    "#1905.26+153.35angle(49.04)\n",
    "#1905.26+153.35*(0.6558+j0.7551)\n",
    "#=2009.03 angle(3.31)\n",
    "\n",
    "p=((2009.03-1905.26)/1905.26)*100\n",
    "\n",
    "print p\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.6:Page number-439"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4.46227272727\n",
      "-9.335\n",
      "17.7059090909\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#given\n",
    "\n",
    "zs=4 # at angle 84.26\n",
    "xs=3.98\n",
    "impangle=84.26\n",
    "\n",
    "#case a\n",
    "\n",
    "#vt=2200+j0\n",
    "#ia=120\n",
    "#e=vt+ia*zs\n",
    "#on substituting and calculating we get the value of e as 2298.17 at 12 degrees\n",
    "\n",
    "p=((2298.17-2200)/2200)*100\n",
    "\n",
    "print p\n",
    "\n",
    "#case b\n",
    "\n",
    "#performing same functions as above for pf leading 0.8 we get e=1994.63 at 12 degrees\n",
    "\n",
    "p=((1994.63-2200)/2200)*100\n",
    "\n",
    "print p\n",
    "\n",
    "#case c\n",
    "\n",
    "#same as above but pf lags by 0.707 and on calculating generates e as 2589.53\n",
    "\n",
    "p=((2589.53-2200)/2200)*100\n",
    "\n",
    "print p\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.7:Page number-444"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "load voltage= 209.4847 v\n",
      "the load current is 20.95 at angle -38.65\n",
      "The output of generator1= 2094.4 VA\n",
      "The output of generator2= 2514.6 VA\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#From the circuit diagram of the figure we can obtain tha following equations based on which the problems are solved\n",
    "#eqn 1..........vl=(i1+i2)*zl....the load voltage\n",
    "#eqn 2..........vl=e1-i1*z1=e2-i2*z2\n",
    "#eqn 3..........i1=(e1-vl)*y1 and i2=(e2-vl)*y2\n",
    "#eqn 4..........vl=(e1*y1+e2+y2)/(y1+y2+yl)\n",
    "\n",
    "#load voltage case a\n",
    "\n",
    "#vl=209.26-j*9.7 in x+iy form and angle is calculated \n",
    "\n",
    "vl=(209.26**2+9.7**2)**0.5\n",
    "\n",
    "print \"load voltage=\",round(vl,5),\"v\"\n",
    "\n",
    "#using eqn 3 the following generator currents are generated\n",
    "\n",
    "#i1=7.45-j5.92 for which i1=9.52 at angle -38.45 is generated\n",
    "#i2=8.91-j7.17 for which i2=11.43 at angle -38.83 is generated\n",
    "\n",
    "#case b\n",
    "\n",
    "#the load current il=i1+i2 is obtained as 20.95 at angle -38.65\n",
    "\n",
    "print \"the load current is 20.95 at angle -38.65\"\n",
    "\n",
    "#case c\n",
    "\n",
    "g1=220*9.52\n",
    "g2=220*11.43\n",
    "\n",
    "print \"The output of generator1=\",round(g1,3),\"VA\"\n",
    "print \"The output of generator2=\",round(g2,4),\"VA\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.8:Page number-446"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E= 6600.12121 V\n",
      "The power angle=13.63\n",
      "Armature current= 295.18199 A\n",
      "power factor=0.68\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#case a\n",
    "\n",
    "#case 1\n",
    "\n",
    "v=6600  #voltage\n",
    "ir=200  #armature current\n",
    "xs=8   #reactance\n",
    "\n",
    "e=(v**2+(ir*xs))**0.5\n",
    "\n",
    "print \"E=\",round(e,5),\"V\"\n",
    "\n",
    "#case 2\n",
    "\n",
    "#from triangle in the firgure the power angle is obtained as 13.63\n",
    "\n",
    "print \"The power angle=13.63\"\n",
    "\n",
    "#case b\n",
    "\n",
    "#due to excitation we obtain ix=217.10A\n",
    "\n",
    "#case 3\n",
    "ix=217.10\n",
    "i=((ir**2+ix**2))**0.5\n",
    "\n",
    "print \"Armature current=\",round(i,5),\"A\"\n",
    "\n",
    "#case 4\n",
    "\n",
    "#power factor cos(angle)=ir/i=0.68\n",
    "\n",
    "print \"power factor=0.68\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.9:Page number-447"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "armature current= 356.6275 A\n",
      "power factor= 0.84121\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#this problem has few notations and values taken from problem above\n",
    "#case a\n",
    "\n",
    "#the generator output becomes 1.5*6600*200\n",
    "\n",
    "o=1980 #generator output\n",
    "#the power angle is obtaimed as 16.42\n",
    "\n",
    "#applying cosine to the triangle in the problem gives ixs=2853.02\n",
    "#hence armature current is\n",
    "i=2853.02/8\n",
    "\n",
    "print \"armature current=\",round(i,5),\"A\"\n",
    "\n",
    "#case b\n",
    "\n",
    "pf=1980000/(6600*356.63) #power factor=o/(V*I)\n",
    "\n",
    "print \"power factor=\",round(pf,5)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.10:Page number-454"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power supplied to the motor is= 467500.0 kW\n",
      "emf induced=5744.08 at angle -10.39\n",
      "emf induced=7051.44 at angle -8.88\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#case a\n",
    "\n",
    "vl=11000\n",
    "il=50\n",
    "pf=0.85 #powerfactor\n",
    "\n",
    "p=vl*il*pf\n",
    "\n",
    "print \"Power supplied to the motor is=\",round(p,5),\"kW\"\n",
    "\n",
    "#case b\n",
    "\n",
    "vt=6350.85 #at angle 0 \n",
    "zs=25.02 #at angle 0\n",
    "\n",
    "#subcase 1 powerfactor at 0.85 lag\n",
    "\n",
    "#e=vt-ia*zs\n",
    "#e=6350.85-50(at angle -31.79)*25.02(at angle 87.71)\n",
    "\n",
    "#substituting and solving as in x+iy form we get 5744.08 at angle -10.39 as the value of e\n",
    "\n",
    "print \"emf induced=5744.08 at angle -10.39\"\n",
    "\n",
    "#subcase 2\n",
    "\n",
    "#for a 0.85 lead same process as above is followed except angles are considered positive due to lead\n",
    "\n",
    "print \"emf induced=7051.44 at angle -8.88\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7.11:Page number-455"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "input KVA to the motor is= 15.069\n",
      "the power factor=0.70\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#given and calculted using regular formulas\n",
    "\n",
    "p=14.38\n",
    "q=10.78 #reactive power component \n",
    "\n",
    "pm=8.95 #mechanical load driven by motor \n",
    "#In order to make pf of the circuit load to improve to unity the motor must supply power to the circuit equalling q\n",
    "#hence total input power s to the motor maybe written as s=(pm/n)+jQ\n",
    "#on sustituting values we get s=10.53+j10.78 KVA\n",
    "\n",
    "i=((10.53**2+10.78**2)**0.5)\n",
    "\n",
    "print \"input KVA to the motor is=\",round(i,3)\n",
    "\n",
    "#from the triangle the angle is obtained as 45.67\n",
    "#hence the power factor is cos(45.67)=0.70\n",
    "\n",
    "print \"the power factor=0.70\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}