{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9 - D C Motors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 - pg 9_14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "e.m.f for lap wound (V) =  462.0\n",
      "e.m.f for wave wound (V) =  924.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_1,pg 9_14\n",
    "#calculate the emf for lap and wave wounds\n",
    "#given\n",
    "P=4.\n",
    "Z=440.\n",
    "phi=0.07#flux(in Wb)\n",
    "N=900.\n",
    "#for lap-wound\n",
    "#calculations\n",
    "A=P\n",
    "E=phi*P*N*Z/(60*A)\n",
    "#results\n",
    "print\"e.m.f for lap wound (V) = \",E\n",
    "#for wave wound\n",
    "A=2.\n",
    "E=phi*P*N*Z/(60*A)\n",
    "print\"e.m.f for wave wound (V) = \",E\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 - pg 9_15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "e.m.f for lap wound (V) =  263.424\n",
      "speed of generator for wave wound (rpm) =  560.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_2,pg 9_15\n",
    "#calculate the speed and emf\n",
    "#given\n",
    "P=4.\n",
    "phi=21.*10**-3#flux(in Wb)\n",
    "N=1120.\n",
    "C=42.#coils\n",
    "tpC=8.#turns per coil\n",
    "#calculations and results\n",
    "t=C*tpC#total turns\n",
    "Z=2*t\n",
    "#for lap wound\n",
    "A=P\n",
    "E=phi*P*N*Z/(60*A)\n",
    "print\"e.m.f for lap wound (V) = \",E\n",
    "#for wave wound\n",
    "A=2.\n",
    "E=263.424\n",
    "N=E*60*A/(phi*P*Z)\n",
    "print\"speed of generator for wave wound (rpm) = \",N"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 - pg 9_20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "back e.m.f of motor (V) =  197.5\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_3,pg 9_20\n",
    "#calculate the back emf \n",
    "#given\n",
    "V=220.\n",
    "Ia=30.\n",
    "Ra=0.75\n",
    "#calculations\n",
    "Eb=V-Ia*Ra\n",
    "#results\n",
    "print\"back e.m.f of motor (V) = \",Eb\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 - pg 9_21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "back e.m.f (V) =  206.0\n",
      "speed of motor (rpm) =  1648.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_4,pg 9_21\n",
    "#calculate the back emf and speed of motor\n",
    "P=4.\n",
    "A=P\n",
    "V=230.\n",
    "Ra=0.6\n",
    "Z=250.\n",
    "phi=30.*10**-3#flux(in Wb)\n",
    "Ia=40.\n",
    "#calculations\n",
    "Eb=V-Ia*Ra\n",
    "N=Eb*60*A/(phi*P*Z)\n",
    "#results\n",
    "print\"back e.m.f (V) = \",Eb\n",
    "print\"speed of motor (rpm) = \",N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 - pg 9_24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "gross torque (N-m) =  76.32\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_5,pg 9_24\n",
    "#calculate the gross torque\n",
    "#given\n",
    "P=4.\n",
    "A=P\n",
    "Z=480.\n",
    "phi=20.*10**-3#flux(in Wb)\n",
    "Ia=50.\n",
    "#calculations\n",
    "Ta=0.159*phi*Ia*(P*Z/A)\n",
    "#results\n",
    "print\"gross torque (N-m) = \",Ta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 - pg 9_25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "induced e.m.f (V) =  225.0\n",
      "armature current (A) =  6.25\n",
      "stray losses (W) =  1406.25\n",
      "loss torque (Nm) =  13.429\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_6,pg 9_25\n",
    "#calculate the induced emf, armature current, stray losses and loss torque\n",
    "import math\n",
    "#given\n",
    "P=4.\n",
    "A=P\n",
    "No=1000.#speed of motor\n",
    "Z=540.\n",
    "V=230.\n",
    "phi=25.*10**-3#flux(In Wb)\n",
    "Ra=0.8\n",
    "#calculations\n",
    "Ebo=phi*P*No*Z/(60*A)#induced e.m.f\n",
    "Iao=(V-Ebo)/Ra#armature current\n",
    "SL=Ebo*Iao#stray losses\n",
    "wo=2*math.pi*No/60#angular velocity\n",
    "Tf=Ebo*Iao/wo#loss torque\n",
    "#results\n",
    "print\"induced e.m.f (V) = \",Ebo\n",
    "print\"armature current (A) = \",Iao\n",
    "print\"stray losses (W) = \",SL\n",
    "print\"loss torque (Nm) = \",round(Tf,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 - pg 9_37"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  1374.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_7,pg 9_37\n",
    "#calculate the speed of motor\n",
    "#given\n",
    "P=4.\n",
    "Z=200.\n",
    "V=250.\n",
    "A=2.\n",
    "phi=25.*10**-3\n",
    "Ia=60.\n",
    "#calculations\n",
    "Il=Ia\n",
    "Ra=0.15\n",
    "Rse=0.2\n",
    "Eb=V-Ia*(Ra+Rse)\n",
    "N=Eb*60*A/(phi*P*Z)\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 - pg 9_38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "back e.m.f (V) =  244.375\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_8,pg 9_38\n",
    "#calculate the back emf\n",
    "#given\n",
    "V=250.\n",
    "Il=20.\n",
    "Ra=0.3\n",
    "Rsh=200.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ia=Il-Ish\n",
    "Eb=V-Ia*Ra\n",
    "#results\n",
    "print\"back e.m.f (V) = \",Eb\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 - pg 9_38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed at full load (rpm) =  939.67\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_9,pg 9_38\n",
    "#calculate the speed at full load\n",
    "#given\n",
    "No=1000.\n",
    "V=220.\n",
    "Rsh=110.\n",
    "Ra=0.3\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ilo=6.\n",
    "Iao=Ilo-Ish\n",
    "Rao=0.3\n",
    "Ebo=V-Iao*Ra\n",
    "#on full load\n",
    "Il=50\n",
    "IaFL=Il-Ish\n",
    "EbFL=V-IaFL*Ra\n",
    "#N=k*Eb/phi\n",
    "NFL=No*EbFL/Ebo\n",
    "#results\n",
    "print\"speed at full load (rpm) = \",round(NFL,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10 - pg 9_39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor on new load (rpm) =  300.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_10,pg 9_39\n",
    "#calculate the speed of motor on new load\n",
    "#given\n",
    "N1=800.\n",
    "I1=20.\n",
    "V=250.\n",
    "Ia1=I1\n",
    "I2=50.\n",
    "Ia2=I2\n",
    "Ra=0.2\n",
    "Ise1=I1\n",
    "Ise2=I2\n",
    "Rse=0.3\n",
    "#calculations\n",
    "Eb1=V-Ia1*Ra-Ise1*Rse\n",
    "Eb2=V-Ia2*Ra-Ise2*Rse\n",
    "#from speed equation\n",
    "N2=N1*(Eb2/Eb1)*(Ia1/Ia2)\n",
    "#results\n",
    "print\"speed of motor on new load (rpm) = \",N2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11 - pg 9_45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "new current (A) =  40.0\n",
      "new speed (rpm) =  2938.776\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_11,pg 9_45\n",
    "#calculate the new current and speed\n",
    "#given\n",
    "V=250.\n",
    "Rsh=250.\n",
    "Ra=0.25\n",
    "Rx=Rsh\n",
    "Ia1=20.\n",
    "#calculations\n",
    "Ish1=V/Rsh\n",
    "Ish2=V/(Rsh+Rx)\n",
    "N1=1500.\n",
    "Eb1=V-Ia1*Ra\n",
    "#phi=k*Ish\n",
    "#T1=T2\n",
    "Ia2=Ish1*Ia1/Ish2#new current\n",
    "Eb2=V-Ia2*Ra\n",
    "#from speed equation\n",
    "N2=N1*(((Eb1/Eb2)*(Ish2/Ish1))**-1)#new speed\n",
    "#results\n",
    "print\"new current (A) = \",Ia2\n",
    "print\"new speed (rpm) = \",round(N2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12 - pg 9_46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance in shunt field (ohm) =  88.313\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_12,pg 9_46\n",
    "#calculate the resistance in shunt field\n",
    "#given\n",
    "import math\n",
    "V=250.\n",
    "Ra=0.5\n",
    "Rsh=250.\n",
    "Ia1=20.\n",
    "Ish1=V/Rsh\n",
    "Eb1=V-Ia1*Ra\n",
    "N1=600.\n",
    "N2=800.\n",
    "#T1=T2\n",
    "#Ish1*Ia1=Ish2*Ia2\n",
    "#Ish2*Ia2=20............(1)\n",
    "#(N1/N2)=(Eb1/Eb2)*(Ish2/Ish1)...........(2)\n",
    "#using (1) and (2)\n",
    "#240*(Ish2^2)-187.5*Ish2+7.5=0.........(3)\n",
    "b=-187.5\n",
    "a=240\n",
    "c=7.5\n",
    "#calculations\n",
    "Ish2=(-b+math.sqrt(((b**2)-4*a*c)))/(2*a)#neglecting lower value\n",
    "Rx=(V/Ish2)-Rsh\n",
    "#results\n",
    "print\"resistance in shunt field (ohm) = \",round(Rx,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13 - pg 9_51"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  912.743\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_13,pg 9_51\n",
    "#calculate the speed of motor\n",
    "#given\n",
    "import math\n",
    "V=250.\n",
    "Ra=0.15\n",
    "Rx=0.1\n",
    "Rse=0.1\n",
    "N1=800.\n",
    "Ise1=30.\n",
    "Ia1=30.#Ia1=Ise1\n",
    "I1=Ia1\n",
    "#phi=k*Ise\n",
    "#T2=T1+0.5*T1(increased by 50%)..........(1)\n",
    "#Ise2=Ia2*Rx/(Rx+Rse)\n",
    "#putting values of Rx and Rse Ise2=0.5*Ia2.........(2)\n",
    "#putting (1) and (2) in torque equation\n",
    "#calculations\n",
    "Ia2=math.sqrt(2700)\n",
    "Ise2=0.5*Ia2#from (2)\n",
    "Eb1=V-Ia1*Ra-Ise1*Rse\n",
    "Eb2=V-Ia2*Ra-Ise2*Rse\n",
    "#using speed equation\n",
    "N2=N1*Eb2*Ise1/(Eb1*Ise2)\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",round(N2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 14 - pg 9_52"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  1119.5122\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_14,pg 9_52\n",
    "#calculate the speed of motor\n",
    "#given\n",
    "V=220.\n",
    "Ise1=15.\n",
    "Ia1=Ise1\n",
    "Ia2=10.\n",
    "Ise2=Ia2\n",
    "I2=Ia2\n",
    "N1=900.\n",
    "Ra=0.5\n",
    "Rse=0.5\n",
    "Rx=4.\n",
    "#calculations\n",
    "Eb1=V-Ia1*Ra-Ise1*Rse\n",
    "Eb2=V-Ia2*Ra-Ise2*Rse-I2*Rx\n",
    "N2=N1*Eb2*Ise1/(Eb1*Ise2)\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",round(N2,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15 - pg 9_64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "useful torque (Nm) =  185.26\n",
      "efficiency at load (percent) =  79.38\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_15,pg 9_64\n",
    "#calculate the useful torque and efficiency at load\n",
    "#given\n",
    "import math\n",
    "P=6.\n",
    "V=500.\n",
    "A=2.#wave wound\n",
    "Z=1200.\n",
    "phi=20*10**-3#flux\n",
    "Ra=0.5\n",
    "Rsh=250.\n",
    "Il=20.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ia=Il-Ish\n",
    "Eb=V-Ia*Ra\n",
    "N=Eb*60*A/(phi*P*Z)\n",
    "Pm=Eb*Ia#mechanical power\n",
    "w=2*math.pi*N/60#angular velocity\n",
    "Tg=Pm/w\n",
    "ML=900#mechanical losses\n",
    "Pout=Pm-ML\n",
    "Tsh=Pout/w#usefull torque\n",
    "Pin=V*Il\n",
    "n=Pout*100/Pin#efficiency at load\n",
    "#results\n",
    "print\"useful torque (Nm) = \",round(Tsh,2)\n",
    "print\"efficiency at load (percent) = \",n\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16 - pg 9_65"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  1860.85\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_16,pg 9_65\n",
    "#calculate the speed of motor\n",
    "#given\n",
    "V=120.\n",
    "Ra=0.2\n",
    "Rsh=60.\n",
    "#for full load\n",
    "Il1=40.\n",
    "N1=1800.\n",
    "#for shunt motor\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ia1=Il1-Ish\n",
    "Eb1=V-Ia1*Ra\n",
    "#for half load T2=T1/2\n",
    "Ia2=Ia1*0.5#T=k*Ia\n",
    "Eb2=V-Ia2*Ra\n",
    "N2=N1*Eb2/Eb1#from torque equation\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",round(N2,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 17 - pg 9_66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed as generator (rpm) =  1592.7\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_17,pg 9_66\n",
    "#calculate the speed of generator\n",
    "#given\n",
    "Ra=0.08\n",
    "Eb1=242.\n",
    "V=250.\n",
    "Ia=87.\n",
    "Vt=V#generator supply\n",
    "Nm=1500.\n",
    "#calculations\n",
    "Ia1=(V-Eb1)/Ra\n",
    "#at start N=0, Eb=0\n",
    "Ias=V/Ra#Ia(start)\n",
    "Ia2=120\n",
    "Eb2=V-Ia2*Ra\n",
    "Eg=Vt+Ia*Ra#generator e.m.f\n",
    "Ng=Nm*Eg/Eb1#speed as generator\n",
    "#results\n",
    "print\"speed as generator (rpm) = \",round(Ng,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 18 - pg 9_67"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "gross mechanical power (kW) =  70.812\n",
      "stray losses (W) =  11132.13\n",
      "no load speed (rpm) =  1250.9121\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_18,pg 9_67\n",
    "#calculate the gross mechanical power,stray losses and no load speed\n",
    "#given\n",
    "import math\n",
    "V=250.\n",
    "Po=59680.\n",
    "Rsh=250.\n",
    "Ra=0.04\n",
    "n=80.#efficiency\n",
    "N1=1200.\n",
    "#calculations and results\n",
    "Il=Po*100/(V*n)#Pi=V*Il\n",
    "Ish=V/Rsh\n",
    "Ia=Il-Ish\n",
    "Eb=V-Ia*Ra\n",
    "Pm=Eb*Ia#gross mechanical power\n",
    "SL=Pm-Po#stray losses\n",
    "print\"gross mechanical power (kW) = \",round(Pm/1000.,3)\n",
    "print\"stray losses (W) = \",round(SL,2)\n",
    "#on no load\n",
    "#Pg=S, Ebo*Iao=SL..........(1)\n",
    "#Ebo=V-Iao*Ra............(2)\n",
    "#putting (2) in (1)\n",
    "#(Iao^2)-6250*Iao+278303.24=0\n",
    "b=-6250.\n",
    "a=1.\n",
    "c=278303.24\n",
    "Iao=(-b-math.sqrt((b**2)-4*a*c))/(2*a)\n",
    "I=Iao-Ish#current drawn on no load\n",
    "Ebo=V-Iao*Ra\n",
    "No=N1*Ebo/Eb\n",
    "print\"no load speed (rpm) = \",round(No,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 19 - pg 9_69"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load speed (rpm) =  1234.102\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_19,pg 9_69\n",
    "#calculate the full load speed\n",
    "#given\n",
    "V=250.\n",
    "P=4.\n",
    "Ra=0.1\n",
    "Rsh=125.\n",
    "Vbr=2.#brush drop\n",
    "#no load condition\n",
    "Ilo=4.\n",
    "No=1200.\n",
    "Il1=61.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Iao=Ilo-Ish\n",
    "Ebo=V-Iao*Ra-Vbr\n",
    "#full load condition\n",
    "#phi1=phio-o.o5*phio       (weakened by 5%)\n",
    "#phi=phi1/phio\n",
    "phi=0.95\n",
    "Ia1=Il1-Ish\n",
    "Eb1=V-Ia1*Ra-Vbr\n",
    "N1=No*Eb1/(Ebo*phi)\n",
    "#results\n",
    "print\"full load speed (rpm) = \",round(N1,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 20 - pg 9_70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load speed (rpm) =  1233.396\n",
      "speed regulation (percent) =  3.64\n",
      "hp rating of machine (hp) =  19.42\n",
      "full load efficiency (percent) =  86.48\n",
      "The answer differs from the textbook due to rounding off error\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_20,pg 9_70\n",
    "#calculate the full load speed, speed regulation, hp rating and efficiency\n",
    "#given\n",
    "V=250.\n",
    "Ra=0.15\n",
    "Rsh=166.67\n",
    "No=1280.\n",
    "Il1=67.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ia1=Il1-Ish\n",
    "Eb1=V-Ia1*Ra\n",
    "#on no load\n",
    "Ilo=6.5\n",
    "Ish=1.5\n",
    "Iao=Ilo-Ish\n",
    "Ebo=V-Iao*Ra\n",
    "N1=Eb1*No/Ebo\n",
    "Sr=(No-N1)*100/No#speed regulation\n",
    "SL=Ebo*Iao\n",
    "Po=Eb1*Ia1-SL#full load shaft output\n",
    "hp=Po/746.#horse power rating\n",
    "Pi=V*Il1\n",
    "n=Po*100./Pi\n",
    "#results\n",
    "print\"full load speed (rpm) = \",round(N1,3)\n",
    "print\"speed regulation (percent) = \",round(Sr,2)\n",
    "print\"hp rating of machine (hp) = \",round(hp,2)\n",
    "print\"full load efficiency (percent) = \",round(n,2)\n",
    "print \"The answer differs from the textbook due to rounding off error\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 21 - pg 9_71"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  976.389\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_21,pg 9_71\n",
    "#calculate the speed of motor\n",
    "import math\n",
    "#given\n",
    "Ra=0.1\n",
    "V=110.\n",
    "P=4.\n",
    "Ia1=50.\n",
    "I1=Ia1\n",
    "Rse=0.02\n",
    "N1=700\n",
    "#calculations\n",
    "Eb1=V-Ia1*Ra-Ia1*Rse\n",
    "#using torque  equation T=k*phi*Ia\n",
    "Ia2=math.sqrt(2)*Ia1\n",
    "Eb2=V-Ia2*Ra-Ia2*Rse/4#parallel speed groups\n",
    "#using speed equation N=k*Eb/phi\n",
    "N2=N1*Eb2*2*Ia1/(Eb1*Ia2)\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",round(N2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22 - pg 9_73"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "new speed of motor (rpm) =  2378.414\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_22,pg 9_73\n",
    "#calculate the new speed of motor\n",
    "#given\n",
    "P=4.\n",
    "Ia1=50.\n",
    "N1=2000.\n",
    "V=230.\n",
    "#calculations\n",
    "#coils connected in series\n",
    "#phi1=k*Ia1*(4*n)=k*200*n\n",
    "#coils connected in parallel groups of series coils\n",
    "#phi2=k*((Ia2*2*n/2)+(Ia2*2*n/2))=k*2*n*Ia2\n",
    "#phi1/phi2=100/Ia2........(1)\n",
    "#N1/N2=phi2/phi1........(2)\n",
    "#T=kN**2..........(3)\n",
    "Ia2=(Ia1*(100**3))**(1./4)#using (1) in (3)\n",
    "N2=(((N1**3)*Ia2)/Ia1)**(1./3)\n",
    "#results\n",
    "print\"new speed of motor (rpm) = \",round(N2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 24 - pg 9_76"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "extra resistance to reduce speed (ohm) =  9.744\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_24,pg 9_76\n",
    "#calculate the extra resistance to reduce speed\n",
    "import math\n",
    "#given\n",
    "V=200.\n",
    "Ia1=30.\n",
    "Ra=0.75\n",
    "Rse=0.75\n",
    "#calculations\n",
    "R=Ra+Rse\n",
    "Eb1=V-Ia1*R\n",
    "#N2=0.6*N1\n",
    "N=0.6#N=N2/N1\n",
    "#using T=k*Ia**2 and T=k*N**3\n",
    "Ia2=math.sqrt(((0.6**3)*30**2))\n",
    "#using speed equation N=k*Eb/Ia\n",
    "Eb2=N*Eb1*Ia2/Ia1\n",
    "#Eb2=V-Ia2*(R+Rx)\n",
    "Rx=-(Eb2-V+Ia2*R)/Ia2\n",
    "#results\n",
    "print\"extra resistance to reduce speed (ohm) = \",round(Rx,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 25 - pg 9_77"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "new supply voltage (V) =  354.6875\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_25,pg 9_77\n",
    "#calculate the new supply voltage\n",
    "#given\n",
    "R=1.\n",
    "V1=230.\n",
    "N1=300.\n",
    "Ia1=15.\n",
    "N2=375.\n",
    "#calculations\n",
    "#using torque equation T=k*N^2\n",
    "Ia2=N2*Ia1/N1\n",
    "#using speed equation N=k*Eb/Ia........(1)\n",
    "Eb1=V1-Ia1*R\n",
    "#case-2\n",
    "#Eb2=V2-Ia2*R=V2-18.75......(2)\n",
    "#putting (2) in (1)\n",
    "V2=(N2*Eb1*Ia2/(N1*Ia1))+18.75\n",
    "#results\n",
    "print\"new supply voltage (V) = \",V2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 26 - pg 9_78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "power input in case-2 (kW) =  12.145\n",
      "efficiency of motor =  74.107\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_26,pg 9_78\n",
    "#calculate the power input and efficiency of motor\n",
    "#given\n",
    "import math\n",
    "V=400.\n",
    "Po1=18.5*10**3\n",
    "Pi1=22.5*10**3\n",
    "Rsh=200.\n",
    "Ra=0.4\n",
    "Po2=9.*10**3\n",
    "#calculations\n",
    "I1=Pi1/V\n",
    "Ish=V/Rsh\n",
    "Ia1=I1-Ish\n",
    "Acl=(Ia1**2)*Ra#armature copper loss\n",
    "Scl=(Ish**2)*Rsh#shunt feild copper loss\n",
    "TL=Pi1-Po1#total losses\n",
    "SFl=TL-(Acl+Scl)#stray and friction loss\n",
    "#case-2\n",
    "Pm=Po2+SFl#mechanical power\n",
    "#Pm=Eb2*Ia2.........(1)\n",
    "#Eb2=V-Ia2*Ra.......(2)\n",
    "#using (1) and (2)\n",
    "#0.4*(Ia2**2)-400*Ia2+11022.75=0\n",
    "a=0.4\n",
    "b=-400\n",
    "c=11022.775\n",
    "Ia2=(-b-math.sqrt((b**2)-4*a*c))/(2*a)#neglecting higher value\n",
    "Pi2=Po2+(Ia2**2)*Ra+(Ish**2)*Rsh+SFl\n",
    "n=Po2*100/Pi2#efficiency\n",
    "#results\n",
    "print\"power input in case-2 (kW) = \",round(Pi2/1000.,3)\n",
    "print\"efficiency of motor = \",round(n,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 27 - pg 9_79"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum efficiency =  75.59\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_27,pg 9_79\n",
    "#calculate the maximum efficiency\n",
    "#given\n",
    "import math\n",
    "V=250.\n",
    "Ilo=4.\n",
    "Ra=1.\n",
    "Rsh=250.\n",
    "Il1=20.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Iao=Ilo-Ish\n",
    "Ia1=Il1-Ish\n",
    "Ebo=V-Iao*Ra\n",
    "Po=Ebo*Iao\n",
    "Eb1=V-Ia1*Ra\n",
    "P1=Eb1*Ia1\n",
    "Pout=P1-Po\n",
    "Pi=V*Il1\n",
    "n=Pout*100/Pi\n",
    "#fro max. efficiency\n",
    "#const. losses=variable losses\n",
    "Ia=math.sqrt(Po+(Ish**2)*Rsh)\n",
    "Ebm=V-Ia*Ra\n",
    "Pm=Ebm*Ia\n",
    "Pout=Pm-Po\n",
    "Pi=V*(Ia+Ish)\n",
    "nm=Pout*100/Pi\n",
    "#results\n",
    "print\"maximum efficiency = \",round(nm,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 28 - pg 9_81"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "back e.m.f (V) =  83.33\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_28,pg 9_81\n",
    "#calculate the back emf\n",
    "#given\n",
    "V=250.\n",
    "FLo=16.*10**3#full scale output\n",
    "n=80.\n",
    "#calculations\n",
    "I=FLo*100/n#input\n",
    "Il=I/V\n",
    "Il=Il\n",
    "Ia=1.5*Il\n",
    "#at start\n",
    "Ra=V/Ia\n",
    "Rac=0.18#Ra actual\n",
    "Ras=Ra-Rac#Ra starter\n",
    "Ia=Il#Ia drops as motor starts\n",
    "Eb=V-Ia*(Ra)\n",
    "#results\n",
    "print\"back e.m.f (V) = \",round(Eb,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 29 - pg 9_82"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "electromagnetic torque (Nm) =  122.148\n",
      "flux per pole (mWb) =  11.9316\n",
      "efficiency of motor (percent) =  85.733\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_29,pg 9_82\n",
    "#calculate the electromagnetic torque, flux and efficiency\n",
    "#given\n",
    "import math\n",
    "Po=20.*735.5#(in W)\n",
    "V=230.\n",
    "N=1150.\n",
    "P=4.\n",
    "A=P\n",
    "Z=882.\n",
    "Ia=73.\n",
    "Ish=1.6\n",
    "#calculations\n",
    "T=60*Po/(2*math.pi*N)\n",
    "phi=T*A/(0.159*Ia*P*Z)#flux per pole\n",
    "Il=Ia+Ish\n",
    "Pin=V*Il\n",
    "n=Po*100/Pin\n",
    "#results\n",
    "print\"electromagnetic torque (Nm) = \",round(T,4)\n",
    "print\"flux per pole (mWb) = \",round(phi*1000.,4)\n",
    "print\"efficiency of motor (percent) = \",round(n,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 30 - pg 9_83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor (rpm) =  785.478\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_30,pg 9_83\n",
    "#calculate the speed of motor\n",
    "#given\n",
    "Pr=12.*10**3#rated output\n",
    "V=200.\n",
    "Rsh=80.\n",
    "N1=800.\n",
    "n=0.9#efficiency\n",
    "#calculations\n",
    "Out=0.8*Pr#output is 80% of rated\n",
    "In=Out/n#input\n",
    "TL=In-Out\n",
    "#for max. efficiency\n",
    "Iln=70#new current\n",
    "#TL=Wc+(Ia1^2)*Ra\n",
    "#bur Wc=(Ia1^2)*Ra\n",
    "Wc=TL/2\n",
    "Il=In/V\n",
    "Ish=V/Rsh\n",
    "Ia1=Il-Ish\n",
    "Ra=Wc/(Ia1**2)\n",
    "Ia2=Iln-Ish\n",
    "Wcn=Wc#const. losses remain same\n",
    "TL=(Ia2**2)*Ra+Wcn\n",
    "Pi=V*Iln\n",
    "n=(Pi-TL)*100/Pi\n",
    "Eb1=V-Ia1*Ra\n",
    "Eb2=V-Ia2*Ra\n",
    "N2=N1*Eb2/Eb1\n",
    "#results\n",
    "print\"speed of motor (rpm) = \",round(N2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 31 - pg 9_85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "efficiency of motor (percent) =  84.896\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_31,pg 9_85\n",
    "#calculate the efficiency of motor\n",
    "#given\n",
    "Po=8.952*10**3\n",
    "V=440.\n",
    "Ra=1.1\n",
    "Rsh=650\n",
    "Rint=0.4\n",
    "Rreg=50.\n",
    "Ml=450.\n",
    "Vbr=2.#brush drop\n",
    "Il=24.\n",
    "#calculations\n",
    "Rat=Ra+Rint#series connection\n",
    "Rsht=Rsh+Rreg#series connection\n",
    "Ish=V/Rsht\n",
    "Ia=Il-Ish\n",
    "Acl=(Ia**2)*Rat#armature copper loss\n",
    "Fcl=(Ish**2)*Rsht#feild copper loss\n",
    "Bdl=Vbr*Ia#brush drop loss\n",
    "TL=Acl+Fcl+Bdl+Ml\n",
    "n=Po*100/(Po+TL)\n",
    "#results\n",
    "print\"efficiency of motor (percent) = \",round(n,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 32 - pg 9_85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motors (rpm) =  334.816\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_32,pg 9_85\n",
    "#calculate the speed of motors\n",
    "#given\n",
    "#for first motor\n",
    "N1=700.\n",
    "R=0.5#Ra+Rse\n",
    "I1=70.\n",
    "V=500.\n",
    "#calculations\n",
    "Eb1=V-I1*R\n",
    "K1=Eb1/(N1*I1)\n",
    "#for second motor\n",
    "N2=750.\n",
    "R=0.5\n",
    "I2=70.\n",
    "V=500.\n",
    "Eb2=V-I2*R\n",
    "K2=Eb2/(N2*I2)\n",
    "#motors in series\n",
    "It=70.\n",
    "Rt=2*R\n",
    "Eb=V-It*Rt\n",
    "N=Eb/(K1*It+K2*It)\n",
    "#results\n",
    "print\"speed of motors (rpm) = \",round(N,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 33 - pg 9_86"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum efficiency output (W) =  10225.936\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_33,pg 9_86\n",
    "#calculate the maximum efficiency output\n",
    "#given\n",
    "import math\n",
    "Po=7.46*10**3\n",
    "V=250\n",
    "Ilo=5.\n",
    "Ra=0.5\n",
    "Rsh=250.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Iao=Ilo-Ish\n",
    "Acl=(Iao**2)*Ra\n",
    "Fcl=(Ish**2)*Rsh\n",
    "Pi=V*Ilo\n",
    "FWl=Pi-Acl-Fcl#friction and windage loss\n",
    "#Pin=Eb*Ia=(V-Ia*Ra)*Ia\n",
    "#0.5*(Ia**2)-250*Ia+8452=0\n",
    "b=-250\n",
    "a=0.5\n",
    "c=8452\n",
    "Ia=(-b-math.sqrt((b**2)-4*a*c))/(2*a)#neglecting higher value\n",
    "TL=(Ia**2)*Ra+(Ish**2)*Rsh+FWl\n",
    "n=Po*100/(Po+TL)\n",
    "#for max. efficiency\n",
    "Ia=math.sqrt((FWl+Fcl)/Ra)\n",
    "Eb=V-Ia*Ra\n",
    "Pm=Eb*Ia\n",
    "#Po at nmax\n",
    "Po=Pm-FWl\n",
    "#results\n",
    "print\"maximum efficiency output (W) = \",round(Po,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 34 - pg 9_87"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed of motor case-1 (rpm) =  946.817\n",
      "speed of motor case-2 (rpm) =  830.983\n",
      "speed of motor case-3 (rpm) =  1101.3554\n"
     ]
    }
   ],
   "source": [
    "#Chapter-9,Example9_33,pg 9_87\n",
    "#calculate the speed of motor in both cases\n",
    "#given\n",
    "V=500.\n",
    "Ra=1.2\n",
    "Rsh=500.\n",
    "#calculations\n",
    "Ish=V/Rsh\n",
    "Ilo=4.\n",
    "Iao=Ilo-Ish\n",
    "Ebo=V-Iao*Ra\n",
    "Il1=26.\n",
    "Ish1=1.\n",
    "Ia1=Il1-Ish1\n",
    "Eb1=V-Ia1*Ra\n",
    "No=1000.\n",
    "N1=No*Eb1/Ebo\n",
    "print\"speed of motor case-1 (rpm) = \",round(N1,3)\n",
    "Rx=2.3#connected in series with armature\n",
    "Eb2=V-Ia1*(Ra+Rx)\n",
    "N2=N1*Eb2/Eb1\n",
    "#results\n",
    "print\"speed of motor case-2 (rpm) = \",round(N2,3)\n",
    "Ish3=Ish1-0.15*Ish1#reduced by 15%\n",
    "Ia3=Ish1*Ia1/(Ish3)\n",
    "Eb3=V-Ia3*Ra\n",
    "N3=N1*Eb3*Ish1/(Eb1*Ish3)\n",
    "print\"speed of motor case-3 (rpm) = \",round(N3,4)\n"
   ]
  }
 ],
 "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
}