{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# Chapter 9:Direct current machines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Example 9.1:Page number-525"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "phy=0.04\n",
      "e= 333.333 V\n",
      "n= 150.0 rpm\n",
      "e= 400.00 V\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#case a\n",
    "e=600\n",
    "p=6\n",
    "n=1500\n",
    "z=200\n",
    "a=2\n",
    "#since e=(phy*n*p*z)/(60*a)\n",
    "phy=(e*60*a)/(n*p*z)\n",
    "print \"phy=0.04\"\n",
    "#case b\n",
    "phy=0.05\n",
    "p=8\n",
    "n=500\n",
    "z=800\n",
    "a=8\n",
    "p=8\n",
    "e=(phy*p*n*z)/(60*a)\n",
    "print \"e=\",format(e,'.3f'),\"V\"\n",
    "#case c\n",
    "e=400\n",
    "a=2\n",
    "n=(e*60*a)/(phy*p*z)\n",
    "print \"n=\",format(n,'.1f'),\"rpm\"\n",
    "#case d\n",
    "phy=0.05\n",
    "p=4\n",
    "n=800\n",
    "z=600\n",
    "a=4\n",
    "p=4\n",
    "e=(phy*n*p*z)/(60*a)\n",
    "print \"e=\",format(e,'.2f'),\"V\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.2:Page number-526 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torque= 48.37 Nm\n",
      "power output= 4050.00 W\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "d=0.2\n",
    "l=0.25\n",
    "p=6\n",
    "z=250\n",
    "bav=0.9\n",
    "n=800\n",
    "a=2\n",
    "ld=50\n",
    "phy=0.045 #flux per pole=0.9*0.2*0.25\n",
    "e=(phy*p*n*z)/(60*a)\n",
    "ia=e/ld\n",
    "#case a\n",
    "t=(60*e*ia)/(2*3.14*n)\n",
    "print \"torque=\",format(t,'.2f'),\"Nm\"\n",
    "#case b\n",
    "po=e*ia\n",
    "print \"power output=\",format(po,'.2f'),\"W\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.3:Page number-528"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "e= 218.75 V\n",
      "the developer generated torque= 522.49 Nm\n",
      "power input= 29687.50 W\n",
      "power input= 21666.00 W\n",
      "power output= 18145.33 W\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#case a\n",
    "ia=125 #armature current\n",
    "ra=0.15\n",
    "v=200\n",
    "e=v+ia*ra\n",
    "print \"e=\",format(e,'.2f'),\"V\"\n",
    "#case b\n",
    "n=500\n",
    "t=(60*e*ia)/(2*3.14*n)\n",
    "print \"the developer generated torque=\",format(t,'.2f'),\"Nm\"\n",
    "#case c\n",
    "pi=(e*ia)+((ia**2)*ra)\n",
    "print \"power input=\",format(pi,'.2f'),\"W\"\n",
    "#case d\n",
    "e=183.75 #voltage generated at 420 rpm \n",
    "ia=108.33 #since generated voltage is less than bus voltage the generator draws current from bus and functions as motor\n",
    "#therefore,ia is the current when generator is functioning as motor\n",
    "powip=v*ia\n",
    "print \"power input=\",format(powip,'.2f'),\"W\"\n",
    "powop=(e*ia)-((ia**2)*ra)\n",
    "print \"power output=\",format(powop,'.2f'),\"W\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.4:Page number-538"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "generated emf= 136.50 V\n",
      "current= 195.82 A\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given\n",
    "i=250\n",
    "v=125\n",
    "rl=v/i #load resistance\n",
    "gemf=125+200*0.05+1.5\n",
    "print \"generated emf=\",format(gemf,'.2f'),\"V\"\n",
    "e=(136.5*1200)/1500 #generated emf at 1200rpm\n",
    "#let v be the terminal voltage at 1200rpm\n",
    "#then armature current ia=v/rl\n",
    "#substituting all values in v=e-ia*ra-(voltage drop across the brushes)=97.91\n",
    "v=97.91\n",
    "i=v*2 #where rl=0.5 in the denominator is written as 2 \n",
    "print \"current=\",format(i,'.2f'),\"A\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.5:Page number-539"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "when i=150 the voltage drop between points a and b is= 3.75 V\n",
      "when i=45 the voltage drop between points a and b is= 1.12 V\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given\n",
    "#the external characteristic of the generator,the combined armature and series field resistance is given by ra+rs\n",
    "r=0.375 #ra+rs\n",
    "#case a\n",
    "i=150\n",
    "#-0.375+0.4=0.025 the voltage drop\n",
    "vab=0.025*150\n",
    "print \"when i=150 the voltage drop between points a and b is=\",format(vab,'.2f'),\"V\"\n",
    "vab=0.025*45\n",
    "print \"when i=45 the voltage drop between points a and b is=\",format(vab,'.2f'),\"V\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "power input= 61875.00 W\n",
      "The input torque= 679.84 Nm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given\n",
    "v=250\n",
    "e=230\n",
    "ia=250\n",
    "If=2.5\n",
    "il=247.5\n",
    "#case a\n",
    "po=v*il\n",
    "print \"power input=\",format(po,'.2f'),\"W\"\n",
    "#case b\n",
    "n=800\n",
    "t=(60*e*il)/(2*3.14*n)\n",
    "print \"The input torque=\",format(t,'.2f'),\"Nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.7:page number-540"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "armature current= 51.00 A\n",
      "armature voltage= 406.06 V\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#shunt field current\n",
    "ish=400/220 #from circuit diagram\n",
    "#armature current\n",
    "i=50\n",
    "ia=i+ish\n",
    "print \"armature current=\",format(ia,'.2f'),\"A\"\n",
    "#armature voltage\n",
    "voldrop=3\n",
    "ra=0.04\n",
    "rs=0.02\n",
    "v=400\n",
    "e=v+ia*(ra+rs)+voldrop\n",
    "print \"armature voltage=\",format(e,'.2f'),\"V\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.8:Page number-549"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rse= 2.25 ohm\n",
      "n2= 1376.7 rpm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given\n",
    "i=35\n",
    "v=220\n",
    "ra=0.15\n",
    "n1=1600\n",
    "#when motor is running at 1200rpm the back emf eb1 is given by eb1=v-(35*0.15)\n",
    "eb1=214.75\n",
    "#flux phy1 is proportional to armature current ia.Thus, at ia1=35 and ia2=15 n is proportional to eb/phy\n",
    "#2=(eb2*phy1)/(phy2*eb1)\n",
    "#therefore\n",
    "eb2=184.07\n",
    "#case a\n",
    "#resistance to be connected in series is rse ohm\n",
    "ia2=15\n",
    "rse=((v-eb2)/ia2)-ra\n",
    "print \"rse=\",format(rse,'.2f'),\"ohm\"\n",
    "#case b\n",
    "eb2=0.5*1.15*214.75\n",
    "ia2=50\n",
    "rse=((v-eb2)/ia2)-ra\n",
    "phy1=35\n",
    "eb2=220-50*0.15\n",
    "n2=(n1*eb2*phy1)/(1.15*phy1*eb1)\n",
    "print \"n2=\",format(n2,'.1f'),\"rpm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " rse= 26.64 ohm\n",
      "rse= 5.92 ohm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#case a\n",
    "i=60\n",
    "eb1=450\n",
    "ia=15.18 #derived from problem\n",
    "#using formula n2/n1=(eb2*phy1)/(eb1*phy2)\n",
    "eb2=45.54\n",
    "rse=(eb1-eb2)/ia\n",
    "print \"rse=\",format(rse,'.2f'),\"ohm\"\n",
    "#case b\n",
    "ia=38.97 #derived\n",
    "#using the above used formula\n",
    "eb2=219.21\n",
    "rse=(eb1-eb2)/ia\n",
    "print \"rse=\",format(rse,'.2f'),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.10:Page number-551"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.1190161333\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given and derived from the circuit in the figure\n",
    "ish=2\n",
    "ia=77 #75+2\n",
    "ra=0.15\n",
    "v=200\n",
    "e=v+ia*ra\n",
    "#when dc machine runs as a motor \n",
    "ia=73 #75-2\n",
    "eb=v-(ia*ra)\n",
    "#n1 and n2 are the speeds at which the motor is operating as a generator and motor\n",
    "n1=211.55\n",
    "n2=189.05\n",
    "p=n1/n2\n",
    "print p"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.11:page number-552"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "n= 467.26 rpm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given\n",
    "n=500\n",
    "v=250\n",
    "rsh=80\n",
    "ra=0.02\n",
    "drop=1.5\n",
    "#derived\n",
    "ish=3.125 #ish=v/rsh\n",
    "il=480    #il=w*1000/v\n",
    "ia=483.125 #ia=il+ish\n",
    "e=v+ra*ia+2*drop\n",
    "il=80\n",
    "ia=il-ish\n",
    "eb=v-ra*ia-2*drop\n",
    "n=(500*eb)/e #e is proportional to n\n",
    "print \"n=\",format(n,'.2f'),\"rpm\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.12:Page number-553"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance to be inserted in the field circuit is= 86.53 ohm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given and derived\n",
    "ish=1\n",
    "il=26\n",
    "ia=25\n",
    "ra=0.4\n",
    "#phy1*i1=phy2*i2 and ish2*i2=ish1*i1\n",
    "#subtituting values in the above equation we get i2=25/ish2\n",
    "eb1=200-ia*ra\n",
    "#eb2=200-0.4*i2\n",
    "#eb1/eb2=(n1*ish1)/(n2*ish2)\n",
    "#190/(200-0.4*25/ish2)=500/(700*ish2)\n",
    "#on finding the square root we get the value of ish2 as 0.698A\n",
    "ish2=0.698\n",
    "totres=200/0.698\n",
    "r=totres-200\n",
    "print \"resistance to be inserted in the field circuit is=\",format(r,'.2f'),\"ohm\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.13:page number-554"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.797\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given and derived\n",
    "phy=0.015\n",
    "p=8\n",
    "z=1000\n",
    "a=2\n",
    "ra=0.4\n",
    "rsh=200\n",
    "v=400\n",
    "ish=2\n",
    "ia=25-2\n",
    "eb=400-25*0.4\n",
    "il=25\n",
    "n=(eb*60*a)/(phy*p*z)\n",
    "t=(phy*p*z*ia)/(2*3.14*2)\n",
    "powdev=eb*ia\n",
    "netshaft=powdev-1000 #aggregate losses\n",
    "torque=(netshaft*60)/(2*3.14*n)\n",
    "hp=netshaft/746\n",
    "powinput=v*il\n",
    "n=netshaft/powinput\n",
    "print n\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.14:page number-557"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R1= 0.69 ohm\n",
      "R2= 0.60 ohm\n",
      "R3= 0.53 ohm\n",
      "R4= 0.46 ohm\n",
      "R5= 0.28 ohm\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given and derived\n",
    "v=450\n",
    "r=0.25\n",
    "i1=160\n",
    "i2=125\n",
    "r1=450/float(160)\n",
    "eb1=v-i2*r1\n",
    "#flux decreases by 12% hence eb2=1.12*eb1\n",
    "eb2=110.60\n",
    "r2=(v-eb2)/i1\n",
    "eb3=v-i2*r2\n",
    "eb4=1.12*eb3\n",
    "r3=(v-eb4)/i1\n",
    "eb5=v-i2*r3eb6=1.12*eb5\n",
    "r4=(450-eb6)/i1\n",
    "eb7=v-i2*r4\n",
    "eb8=1.12*eb7\n",
    "r5=(v-eb8)/i1\n",
    "#resistance of each section of the starter is determined as follows\n",
    "R1=r1-r2\n",
    "print \"R1=\",format(R1,'.2f'),\"ohm\"\n",
    "R2=r2-r3\n",
    "print \"R2=\",format(R2,'.2f'),\"ohm\"\n",
    "R3=r3-r4\n",
    "print \"R3=\",format(R3,'.2f'),\"ohm\"\n",
    "R4=r4-r5\n",
    "print \"R4=\",format(R4,'.2f'),\"ohm\"\n",
    "R5=r5-r\n",
    "print \"R5=\",format(R5,'.2f'),\"ohm\"\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.15:Page number-562"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "91.3123872863\n",
      "90.9385770538\n",
      "93.5453695042\n",
      "75.8287544405\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#given and derived\n",
    "If=1.6\n",
    "ia=300\n",
    "loss=640 #400*1.6\n",
    "pconst=4140 #sum of core,field and friction losses\n",
    "ra=0.08\n",
    "ia=301.6\n",
    "arloss=7277 #armature loss at full load\n",
    "#case a\n",
    "po=120*1000\n",
    "n=(po/float(po+arloss+pconst))*100\n",
    "print n\n",
    "arlosshalfload=150+1.6 #il/2+if\n",
    "arlossfullload=1838.6 #ia**2*ra\n",
    "#case b\n",
    "n=((60*1000)/((60*1000)+1838.6+4140))*100\n",
    "print n\n",
    "#for maximum n ia=il\n",
    "ia=(pconst/ra)**0.5\n",
    "nmax=((120*1000)/float((120*1000)+2*4140))*100\n",
    "print nmax\n",
    "maxn=(ia*100)/300\n",
    "print maxn\n",
    "\n"
   ]
  },
  {
   "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.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}