{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 10 - Three Phase Induction Motors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 - pg 10_14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load slip (percent) =  6.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_1,pg10_14\n",
    "#calculate the full load slip\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "N=1410.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-N)/Ns\n",
    "s=s*100#%s\n",
    "#results\n",
    "print\"full load slip (percent) = \",s\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 - pg 10_14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load speed of motor (rpm) =  1440.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_2,pg10_14\n",
    "#calculate the full load speed of motor\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "sfl=4/100.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "Nfl=Ns-sfl*Ns\n",
    "#results\n",
    "print\"full load speed of motor (rpm) = \",Nfl\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 - pg 10_16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency of induced e.m.f (Hz) =  1.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_3,pg10_16\n",
    "#calculate the frequency of induced emf\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "N=1470.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-N)/Ns\n",
    "fr=s*f\n",
    "#results\n",
    "print\"frequency of induced e.m.f (Hz) = \",fr\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 - pg 10_20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load slip (percent)=  4.0\n",
      "speed of motor (rpm) =  720.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_4,pg10_20\n",
    "#calculate the full load slip and speed of motor\n",
    "#given\n",
    "P=8.\n",
    "f=50.\n",
    "fr=2.\n",
    "#calculations\n",
    "s=fr/f\n",
    "s=s*100.\n",
    "#results\n",
    "print\"full load slip (percent)= \",s\n",
    "s=s/100\n",
    "Ns=120*f/P\n",
    "N=Ns*(1-s)\n",
    "print\"speed of motor (rpm) = \",N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 - pg 10_20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency of rotor e.m.f (Hz) =  1.5\n",
      "magnitude of induced e.m.f standstill (V) =  119.8\n",
      "magnitude of induced e.m.f running (V) =  3.594\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_5,pg10_20\n",
    "import math\n",
    "#calculate the frequency of rotor, magnitude of induced emf\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "N=1455.\n",
    "E1line=415.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-N)/Ns\n",
    "fr=s*f\n",
    "E1ph=E1line/math.sqrt(3)\n",
    "E2ph=0.5*E1ph#K=2\n",
    "E2r=s*E2ph\n",
    "#results\n",
    "print\"frequency of rotor e.m.f (Hz) = \",fr\n",
    "print\"magnitude of induced e.m.f standstill (V) = \",round(E2ph,1)\n",
    "print\"magnitude of induced e.m.f running (V) = \",round(E2r,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 - pg 10_21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " at start\n",
      "pf (lagging) =  0.196\n",
      "I2 (A) =  67.94\n",
      " on full load\n",
      "pf (lagging) =  0.9806\n",
      "I2 (A) =  13.587\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_6,pg10_21\n",
    "#calculate the rotor current and power factor\n",
    "import math\n",
    "from math import sqrt\n",
    "#given\n",
    "P=4\n",
    "f=50\n",
    "R2=0.2\n",
    "X2=1\n",
    "E2line=120\n",
    "#calculations and results\n",
    "E2ph=E2line/sqrt(3)\n",
    "Ns=120*f/P\n",
    "#at start\n",
    "pf=R2/sqrt((R2**2)+(X2**2))#power factor\n",
    "I2=E2ph/sqrt((R2**2)+(X2**2))\n",
    "print\" at start\"\n",
    "print\"pf (lagging) = \",round(pf,3)\n",
    "print\"I2 (A) = \",round(I2,2)\n",
    "#on full load\n",
    "N=1440.\n",
    "s=(Ns-N)/Ns\n",
    "pf=R2/sqrt((R2**2)+((s*X2)**2))\n",
    "I2=E2ph*s/sqrt((R2**2)+((s*X2)**2))\n",
    "print\" on full load\"\n",
    "print\"pf (lagging) = \",round(pf,4)\n",
    "print\"I2 (A) = \",round(I2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 - pg 10_24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torque on full load (Nm) =  87.81\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_7,pg10_24\n",
    "#calculate the torque on full load\n",
    "import math\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "R2=0.1\n",
    "X2=1.\n",
    "N=1440.\n",
    "K=0.5\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "E1line=400.\n",
    "E1ph=E1line/math.sqrt(3)\n",
    "E2ph=0.5*E1ph\n",
    "s=(Ns-N)/Ns\n",
    "ns=Ns/60#synchronous speed (r.p.s)\n",
    "T=(3/(2*math.pi*ns))*(s*(E2ph**2)*R2/((R2**2)+((s*X2)**2)))\n",
    "#results\n",
    "print \"torque on full load (Nm) = \",round(T,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 - pg 10_27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "starting torque (Nm) =  63.032\n",
      "slip at which max torque occurs (percent) =  10.0\n",
      "speed at which max torque occurs (rpm)  1350.0\n",
      "max torque (Nm) =  318.31\n",
      "full load torque (Nm) =  219.52\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_8,pg10_27\n",
    "#calculate the starting torque, max torque, speed\n",
    "import math\n",
    "from math import sqrt\n",
    "P=4.\n",
    "f=50.\n",
    "K=1/4.\n",
    "R2=0.01\n",
    "X2=0.1\n",
    "E1line=400.\n",
    "E1ph=E1line/sqrt(3)\n",
    "E2=E1ph/4\n",
    "Ns=120*f/P\n",
    "#at start\n",
    "s=1\n",
    "ns=Ns/60\n",
    "k=3/(2*math.pi*ns)\n",
    "Tst=k*(E2**2)*R2/((R2**2)+(X2**2))\n",
    "print\"starting torque (Nm) = \",round(Tst,3)\n",
    "\n",
    "#slip at max torque\n",
    "sm=R2/X2\n",
    "sm=sm*100\n",
    "print\"slip at which max torque occurs (percent) = \",round(sm,0)\n",
    "#speed at max torque\n",
    "sm=sm/100\n",
    "N=Ns*(1-sm)\n",
    "print\"speed at which max torque occurs (rpm) \",N\n",
    "\n",
    "#max. torque\n",
    "Tm=k*(E2**2)/(2*X2)\n",
    "sf=0.04\n",
    "Tfl=k*sf*(E2**2)*R2/((R2**2)+((sf*X2)**2))\n",
    "print\"max torque (Nm) = \",round(Tm,2)\n",
    "print\"full load torque (Nm) = \",round(Tfl,2)\t\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 - pg 10_33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load torque to max torque =  0.3824\n",
      "starting torque to max torque =  0.1203\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_9,pg10_33\n",
    "#calculate the full load torque and starting torque\n",
    "#given\n",
    "P=24.\n",
    "f=50.\n",
    "R2=0.016\n",
    "X2=0.265\n",
    "N=247.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "sf=(Ns-N)/Ns\n",
    "sm=R2/X2\n",
    "Tfm=2*sm*sf/((sm**2)+(sf**2))\n",
    "Tsm=2*sm/(1+(sm**2))\n",
    "#results\n",
    "print\"full load torque to max torque = \",round(Tfm,4)\n",
    "print\"starting torque to max torque = \",round(Tsm,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10 - pg 10_36"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "external resistance (ohm/phase) =  0.0136\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_10,pg10_36\n",
    "#calculate the external resistance\n",
    "#given\n",
    "import math\n",
    "R2=0.04\n",
    "X2=0.2\n",
    "#for Tm=Tst, sm=1\n",
    "#calculations\n",
    "R21=X2\n",
    "Rex=R2-R21\n",
    "#for Tst=Tm/2........(1)\n",
    "#Tst=k*(E2**2)*R21/((R21**2)+(X2**2))......(2)with added resistance\n",
    "#from (1) and (2)\n",
    "#(R21**2)-0.8*R21+0.04=0\n",
    "a=1\n",
    "b=-0.8\n",
    "c=0.04\n",
    "R21=(-b-math.sqrt((b**2)-4*a*c))/(2*a)#neglecting higher value\n",
    "Rex=R21-R2\n",
    "#results\n",
    "print\"external resistance (ohm/phase) = \",round(Rex,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11 - pg 10_42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rotor copper loss (W) =  469.326\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_11,pg10_42\n",
    "#calculate the rotor copper loss\n",
    "#given\n",
    "import math\n",
    "Tsh=190.\n",
    "P=8.\n",
    "f=50.\n",
    "fr=1.5\n",
    "ML=700.\n",
    "#calculations\n",
    "s=fr/f\n",
    "Ns=120*f/P\n",
    "N=Ns*(1-s)\n",
    "Po=Tsh*(2*math.pi*N/60.)\n",
    "Pm=Po+ML\n",
    "Pc=Pm*s/(1-s)\n",
    "#results\n",
    "print\"rotor copper loss (W) = \",round(Pc,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12 - pg 10_43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load efficiency (percent) =  92.78\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_12,pg10_43\n",
    "#calculate the full load efficiency\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "Pi=50.*10**3\n",
    "N=1440.\n",
    "Sl=1000.\n",
    "Fl=650.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-N)/Ns\n",
    "P2=Pi-Sl\n",
    "Pc=s*P2\n",
    "Pm=P2-Pc\n",
    "Po=Pm-Fl\n",
    "n=Po*100/Pi\n",
    "#results\n",
    "print\"full load efficiency (percent) = \",n\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13 - pg 10_44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "slip (percent) =  4.0\n",
      "net output power (kW) =  45.2389\n",
      "rotor copper loss per phase (W) =  733.0383\n",
      "rotor efficiency (percent) =  96.0\n",
      "rotor resistance per phase (ohm/phase) =  0.2036\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_13,pg10_44\n",
    "#calculate the net output power, rotor copper loss,efficiency and resistance per phase\n",
    "#given\n",
    "import math\n",
    "P=4.\n",
    "f=50.\n",
    "Tsh=300.\n",
    "Tlost=50.\n",
    "fr=120/60.#Hz\n",
    "#calculations\n",
    "s=fr/f\n",
    "s=s*100.\n",
    "print\"slip (percent) = \",s\n",
    "Ns=120.*f/P\n",
    "s=s/100.\n",
    "N=Ns*(1-s)\n",
    "Po=Tsh*2*math.pi*N/60\n",
    "Fl=Tlost*2*math.pi*N/60\n",
    "Pm=Po+Fl\n",
    "Pc=Pm*s/(1-s)\n",
    "Rcl=Pc/3#rotor copper loss per phase\n",
    "P2=Pc/s\n",
    "n=Pm*100./P2\n",
    "I2r=60\n",
    "R2=Rcl/(I2r**2)\n",
    "#results\n",
    "print\"net output power (kW) = \",round(Po/1000.,4)\n",
    "print\"rotor copper loss per phase (W) = \",round(Rcl,4)\n",
    "print\"rotor efficiency (percent) = \",n\n",
    "print\"rotor resistance per phase (ohm/phase) = \",round(R2,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 14 - pg 10_45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "gross mechanical power (W) =  25850.0\n",
      "rotor copper losses (W) =  1650.0\n",
      "rotor resistance per phase (ohm/phase) =  0.13\n",
      "full load efficiency (percent) =  82.49\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_14,pg10_45\n",
    "#calculate the gross mechanical power, rotor copper losses, resistance and full load efficiency\n",
    "#given\n",
    "Po=25.*10**3\n",
    "f=50.\n",
    "P=4.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "N=1410\n",
    "s=(Ns-N)/Ns\n",
    "Ml=850\n",
    "Pm=Po+Ml\n",
    "Pc=Pm*s/(1-s)\n",
    "I2r=65\n",
    "R2=Pc/(3*(I2r**2))\n",
    "Sl=1.7*Pc\n",
    "P2=Pc/s\n",
    "Pin=P2+Sl\n",
    "n=Po*100/Pin\n",
    "#results\n",
    "print\"gross mechanical power (W) = \",Pm\n",
    "print\"rotor copper losses (W) = \",Pc\n",
    "print\"rotor resistance per phase (ohm/phase) = \",round(R2,2)\n",
    "print\"full load efficiency (percent) = \",round(n,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15 - pg 10_47"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shaft torque (N-m) =  318.31\n",
      "gross torque (N-m) =  331.573\n",
      "rotor copper losses (W) =  1041.67\n",
      "stator copper losses (W) =  974.7\n",
      "stator iron losses (W) =  1950.6\n",
      "overall efficiency (percent) =  82.85\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_15,pg10_47\n",
    "#calculate the shaft torque, gross, rotor copper losses, stator copper and iron losses and overall efficiency \n",
    "#given\n",
    "import math\n",
    "Po=24.*10**3\n",
    "Il=57.\n",
    "Is=Il\n",
    "P=8.\n",
    "N=720.\n",
    "f=50.\n",
    "Vl=415.\n",
    "pf=0.707\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-N)/Ns\n",
    "Ml=1000.\n",
    "Pm=Po+Ml\n",
    "Pc=Pm*s/(1-s)\n",
    "Tsh=Po*60/(2*math.pi*N)\n",
    "T=Pm*60/(2*math.pi*N)\n",
    "Rcl=1041.66#rotor copper loss\n",
    "P2=Pc/s\n",
    "Pi=math.sqrt(3)*Vl*Il*pf\n",
    "Rs=0.1\n",
    "Scl=3*(Is**2)*Rs#stator copper loss\n",
    "Sl=Pi-P2\n",
    "Sil=Sl-Scl#stator iron loss\n",
    "n=Po*100/Pi\n",
    "#results\n",
    "print\"shaft torque (N-m) = \",round(Tsh,3)\n",
    "print\"gross torque (N-m) = \",round(T,3)\n",
    "print\"rotor copper losses (W) = \",round(Pc,2)\n",
    "print\"stator copper losses (W) = \",Scl\n",
    "print\"stator iron losses (W) = \",round(Sil,2)\n",
    "print\"overall efficiency (percent) = \",round(n,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16 - pg 10_52"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "supply current (times Ifl) =  3.33\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_16,pg10_52\n",
    "#calculate the supply current\n",
    "#given\n",
    "import math\n",
    "sf=0.05\n",
    "#Tst=Tfl\n",
    "Ifs=1/6.#Isc/Ifl=6\n",
    "#calculations\n",
    "x=math.sqrt((Ifs**2)/sf)#tapping on transformer\n",
    "t=x*100\n",
    "Ist=(x**2)*6\n",
    "#results\n",
    "print \"supply current (times Ifl) = \",round(Ist,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 17 - pg 10_54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of starting torque to full load torque =  0.165\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_17,pg10_54\n",
    "#calculate the ratio of starting torque to full load torque\n",
    "#given\n",
    "R2=0.4\n",
    "X2=4.\n",
    "#Tm=k*(E2**2)/(2*X2)\n",
    "#Tfl=Tm/2.5\n",
    "#Tfl=k*(E2**2)/20\n",
    "#Tst=k*(E2**2)*R2/((R2**2)+(X2**2))\n",
    "#E2=E2/sqrt(3)\n",
    "T=20*R2/(3*(((R2**2)+(X2**2))))\n",
    "#results\n",
    "print \"ratio of starting torque to full load torque = \",round(T,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 18 - pg 10_57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rotor current at start (A) =  800.85\n",
      "rotor power factor lagging (answer in book is wrong)=  0.0499\n",
      "rotor current at slip 0.03 (A) =  412.55\n",
      "external resistance (ohm/ph) (answer in book is wrong) =  0.7665\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_18,pg10_57\n",
    "#calculate the rotor power factor, external resistance and current\n",
    "#given\n",
    "import math\n",
    "from math import sqrt\n",
    "Vl=1000.\n",
    "f=50.\n",
    "K=3.6\n",
    "R2=0.01\n",
    "X2=0.2\n",
    "E1line=1000.\n",
    "#calculations and results\n",
    "E1=E1line/sqrt(3)\n",
    "E2=E1/K\n",
    "#at start,s=1\n",
    "I2=160.37/sqrt((R2**2)+(X2**2))\n",
    "pf=R2/sqrt((R2**2)+(X2**2))\n",
    "print\"rotor current at start (A) = \",round(I2,2)\n",
    "print\"rotor power factor lagging (answer in book is wrong)= \",round(pf,4)\n",
    "#at s=0.03\n",
    "s=0.03\n",
    "I2r=s*160.37/sqrt((R2**2)+((s*X2)**2))\n",
    "print\"rotor current at slip 0.03 (A) = \",round(I2r,2)\n",
    "I2=200.\n",
    "R21=sqrt(((E2/I2)**2)-(X2**2))\n",
    "Rex=R21-R2\n",
    "print\"external resistance (ohm/ph) (answer in book is wrong) = \",round(Rex,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 19 - pg 10_58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "starting torque (Nm) =  103.54\n",
      "full load torque (Nm) =  15.576\n",
      "maximum torque (Nm) =  117.342\n",
      "speed at max torque (rpm) =  200.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_19,pg10_58\n",
    "#calculate the starting torque, full load torque, maximum torque and speed at max torque\n",
    "import math\n",
    "#given\n",
    "P=12.\n",
    "f=50.\n",
    "R2=0.15\n",
    "X2=0.25\n",
    "E2=32.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "ns=Ns/60\n",
    "Tst=3*(E2**2)*R2/((2*math.pi*ns)*((R2**2)+(X2**2)))\n",
    "N=480.\n",
    "s=(Ns-N)/Ns\n",
    "Tfl=3*s*(E2**2)*R2/((2*math.pi*ns)*((R2**2)+((s*X2)**2)))\n",
    "Tm=3*(E2**2)/(2*math.pi*ns*2*X2)\n",
    "sm=R2/X2\n",
    "N=Ns*(1-sm)\n",
    "#results\n",
    "print\"starting torque (Nm) = \",round(Tst,2)\n",
    "print\"full load torque (Nm) = \",round(Tfl,3)\n",
    "print\"maximum torque (Nm) = \",round(Tm,3)\n",
    "print\"speed at max torque (rpm) = \",N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 20 - pg 10_59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "efficiency on full load (percent) =  85.78\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_20,pg10_59\n",
    "#calculate the efficiency in full load\n",
    "#given\n",
    "Po=50.*735.5#(in W)\n",
    "s=0.04\n",
    "#calculations\n",
    "#Rcl=X...............rotor copper loss\n",
    "#Sil=1.25X...........stator iron loss\n",
    "#Ml=Y, Y=(Y+1.25X)/3, Y=0.625X\n",
    "#TL=Sil+Rcl+Scl+Ml, TL=3.875X.........(a)\n",
    "#Pm=Po+Y, 36775+625X..........(1)\n",
    "#Pc=Pm*s/(1-s).............(2)\n",
    "#Pc=X, from (1) and (2)\n",
    "X=(s*Po)/(1-s-s*0.625)\n",
    "TL=3.875*X#from (a)\n",
    "n=Po*100./(Po+TL)\n",
    "#results\n",
    "print\"efficiency on full load (percent) = \",round(n,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 21 - pg 10_61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "new speed of motor (rpm) =  1392.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_21,pg10_61\n",
    "#calculate the new speed of motor\n",
    "#given\n",
    "import math\n",
    "P=4.\n",
    "f=50.\n",
    "R2=0.25\n",
    "X2=0.55\n",
    "N1=1440\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s1=(Ns-N1)/Ns\n",
    "Rex=0.2\n",
    "R21=R2+Rex\n",
    "#T1 at s1=T2 at s2\n",
    "#0.3025*s2^2-2.8342*s2+0.2025=0, s1=0.04\n",
    "a=0.3025\n",
    "b=-2.8342\n",
    "c=0.2025\n",
    "s2=(-b-math.sqrt((b**2)-4*a*c))/(2*a)#neglecting higher value\n",
    "N2=Ns*(1-s2)\n",
    "#results\n",
    "print\"new speed of motor (rpm) = \",round(N2,0)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 22 - pg 10_62"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "rotor current at start (A) =  9.4916\n",
      "rotor current for rheostat of 6 ohm (A) =  4.0324\n",
      "full load rotor current (A) =  2.2456\n",
      "full load power factor (lagging) =  0.9724\n",
      "rotor e.m.f on full load (V) =  1.1547\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_22,pg10_62\n",
    "#calculate the rotor current, full load current , power factor and rotor emf\n",
    "#given\n",
    "import math\n",
    "from math import sqrt\n",
    "E2line=50.\n",
    "R2=0.5\n",
    "X2=3.\n",
    "E2=E2line/sqrt(3)\n",
    "#calculations and results\n",
    "#at start\n",
    "s=1\n",
    "I2r=s*E2/(sqrt((R2**2)+((s*X2)**2)))\n",
    "print\"rotor current at start (A) = \",round(I2r,4)\n",
    "Rx=6.\n",
    "I2r=s*E2/(sqrt(((R2+Rx)**2)+((s*X2)**2)))\n",
    "print\"rotor current for rheostat of 6 ohm (A) = \",round(I2r,4)\n",
    "#at full load\n",
    "s=0.04\n",
    "I2r=s*E2/(sqrt((R2**2)+((s*X2)**2)))\n",
    "pf=R2/(sqrt((R2**2)+((s*X2)**2)))\n",
    "print\"full load rotor current (A) = \",round(I2r,4)\n",
    "print\"full load power factor (lagging) = \",round(pf,4)\n",
    "E2r=s*E2\n",
    "print\"rotor e.m.f on full load (V) = \",round(E2r,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 23 - pg 10_63"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "starting torque (Nm) =  103.54\n",
      "full load torque (Nm) =  15.576\n",
      "maximum torque (Nm) =  117.342\n",
      "speed at max torque (rpm) =  200.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_23,pg10_63\n",
    "#calculate the starting,full load, maximum torque and speed\n",
    "#given\n",
    "import math\n",
    "P=12.\n",
    "f=50.\n",
    "R2=0.15\n",
    "X2=0.25\n",
    "E2=32.\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "ns=Ns/60.\n",
    "k=3.\n",
    "Tst=k*(E2**2)*R2/((2*math.pi*ns)*((R2**2)+(X2**2)))\n",
    "N=480.\n",
    "s=(Ns-N)/Ns\n",
    "Tfl=k*s*(E2**2)*R2/((2*math.pi*ns)*((R2**2)+((s*X2)**2)))\n",
    "Tm=k*(E2**2)/(2*math.pi*ns*2*X2)\n",
    "sm=R2/X2\n",
    "N=Ns*(1-sm)\n",
    "#results\n",
    "print\"starting torque (Nm) = \",round(Tst,2)\n",
    "print\"full load torque (Nm) = \",round(Tfl,3)\n",
    "print\"maximum torque (Nm) = \",round(Tm,3)\n",
    "print\"speed at max torque (rpm) = \",N\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 24 - pg 10_64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load torque (Nm) =  202.52\n",
      "ratio of Tst to Tfl =  0.817\n",
      "ratio of Tm to Tfl =  2.043\n",
      "external resistance required (ohm/ph) =  1.6\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_24,pg10_64\n",
    "#calculate the full load torque and external resistance required\n",
    "#given\n",
    "import math\n",
    "P=4.\n",
    "f=50.\n",
    "R2=0.4\n",
    "X2=2.\n",
    "E2b=520.#between slip rings\n",
    "#calculations\n",
    "E2ph=E2b/math.sqrt(3)\n",
    "Ns=120*f/P\n",
    "N=1425.\n",
    "sf=(Ns-N)/Ns\n",
    "ns=Ns/60.\n",
    "Tfl=3*sf*(E2ph**2)*R2/((2*math.pi*ns)*((R2**2)+((sf*X2)**2)))\n",
    "Tst=3*(E2ph**2)*R2/((2*math.pi*ns)*((R2**2)+((X2)**2)))\n",
    "T=Tst/Tfl\n",
    "Tm=3*(E2ph**2)/((2*math.pi*ns)*((R2**2)+((X2)*2)))\n",
    "T1=Tm/Tfl\n",
    "#at start\n",
    "sm=1\n",
    "R21=X2\n",
    "Rex=R21-R2\n",
    "#results\n",
    "print\"full load torque (Nm) = \",round(Tfl,2)\n",
    "print\"ratio of Tst to Tfl = \",round(T,3)\n",
    "print\"ratio of Tm to Tfl = \",round(T1,3)\n",
    "print\"external resistance required (ohm/ph) = \",Rex"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 25 - pg 10_65"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "slip at full load =  0.04\n",
      "rotor frequency (Hz) =  2.0\n",
      "rotor copper loss per phase (kW) =  486.53\n",
      "total copper loss (kW) =  1.4596\n",
      "efficiency at full load (percent) =  89.02\n",
      "line current drawn (A) =  68.361\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_25,pg10_65\n",
    "#calculate the slip, rotor frequency, copper loss and efficiency\n",
    "#given\n",
    "import math\n",
    "Po=33.73*10**3\n",
    "P=4.\n",
    "Vl=400.\n",
    "f=50.\n",
    "Nfl=1440.\n",
    "pf=0.8\n",
    "Ml=1.3*10**3\n",
    "#calculations\n",
    "Ns=120*f/P\n",
    "s=(Ns-Nfl)/Ns\n",
    "fr=s*f\n",
    "Pm=Po+Ml\n",
    "Pc=Pm*s/(1-s)\n",
    "Pcp=Pc/3#copper loss per phase\n",
    "P2=Pc/s\n",
    "Sl=1.4*10**3\n",
    "Pi=P2+Sl\n",
    "n=Po*100/Pi\n",
    "Il=Pi/(math.sqrt(3)*Vl*pf)\n",
    "#results\n",
    "print\"slip at full load = \",s\n",
    "print\"rotor frequency (Hz) = \",round(fr,1)\n",
    "print\"rotor copper loss per phase (kW) = \",round(Pcp,2)\n",
    "print\"total copper loss (kW) = \",round(Pc/1000.,4)\n",
    "print\"efficiency at full load (percent) = \",round(n,2)\n",
    "print\"line current drawn (A) = \",round(Il,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 26 - pg 10_66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "power factor of rotor (lagging) =  0.989\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_26,pg10_66\n",
    "#calculate the power factor of rotor\n",
    "#given\n",
    "import math\n",
    "R2=0.04\n",
    "X2=0.2\n",
    "sfl=0.03\n",
    "#at Tst, s=1\n",
    "#Tfl=Tst\n",
    "#(R21**2)-1.3633*R21+0.04=0\n",
    "a=1\n",
    "b=-1.3633\n",
    "c=0.04\n",
    "#calculations\n",
    "R21=(-b+math.sqrt((b**2)-4*a*c))/(2*a)\n",
    "Rex=R21-R2\n",
    "pf=R21/math.sqrt((R21**2)+(X2**2))\n",
    "#results\n",
    "print\"power factor of rotor (lagging) = \",round(pf,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 27 - pg 10_67"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "full load speed (rpm) =  1318.7\n",
      "speed at max. torque (rpm) =  823.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_27,pg10_67\n",
    "#calculate the full load speed, speed at max torque\n",
    "#given\n",
    "import math\n",
    "P=4.\n",
    "f=50.\n",
    "Po=8.*10**3\n",
    "#Tst=1.5*Tfl and Tm=2*Tfl\n",
    "#(R2**2)+((sfl*X2)**2)=1.5*sfl*((R2**2)+(X2**2)).................(1)\n",
    "#(R2**2)+((sfl*X2)**2)=2*(sfl/sm)*((R2**2)+((sm*X2)**2))..........(2)\n",
    "#dividing (1) and (2) by (X2**2) on both sides and R2/X2=sm\n",
    "#(sm**2)+(sfl**2)=5*(1+(sm**2))*sfl.............(3)\n",
    "#(sm**2)+(sfl**2)=2*(2*(sm**2))*(sfl/sm)=4*sm*sfl...........(4)\n",
    "#dividing (3) by (4)\n",
    "#(sm**2)-2.667*sm+1=0\n",
    "a=1\n",
    "b=-2.667\n",
    "c=1\n",
    "#calculations\n",
    "sm=(-b-math.sqrt((b**2)-4*a*c))/(2*a)\n",
    "Ns=120*f/P\n",
    "#substituting sm in (4)\n",
    "#(sfl**2)-1.8052*sfl+0.2036=0\n",
    "a=1\n",
    "b=-1.8052\n",
    "c=0.2036\n",
    "sfl=(-b-math.sqrt((b**2)-4*a*c))/(2*a)\n",
    "N=Ns*(1-sfl)\n",
    "Nm=Ns*(1-sm)\n",
    "#results\n",
    "print\"full load speed (rpm) = \",round(N,1)\n",
    "print\"speed at max. torque (rpm) = \",round(Nm,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 28 - pg 10_68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "starting torque (Nm) =  34.8\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_28,pg10_68\n",
    "#calculate the starting torque\n",
    "import math\n",
    "#given\n",
    "Po=10*735.5#(in W)\n",
    "Nfl=1410.\n",
    "P=4.\n",
    "f=50.\n",
    "#calculations\n",
    "Ns=120.*f/P\n",
    "sfl=(Ns-Nfl)/Ns\n",
    "Nm=1200.\n",
    "sm=(Ns-Nm)/Ns\n",
    "T=2*sfl*sm/((sm**2)+(sfl**2))#Tfl/Tm\n",
    "T1=(1+(sm**2))/(2*sm)#Tm/Tst\n",
    "T2=T1*T#Tfl/Tst\n",
    "Tfl=Po*60./(2*math.pi*Nfl)\n",
    "Tst=Tfl/T2\n",
    "#results\n",
    "print\"starting torque (Nm) = \",round(Tst,1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 29 - pg 10_70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum torque (Nm) =  330.5\n",
      "speed (r.p.m) =  1250.0\n",
      "external resistance (ohm/ph) =  0.125\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_29,pg10_70\n",
    "#calculate the maximum torque, speed and external resistance\n",
    "#given\n",
    "P=4.\n",
    "f=50.\n",
    "R2=0.025\n",
    "X2=0.15\n",
    "sfl=0.04\n",
    "Tfl=150.\n",
    "#calculations\n",
    "sm=R2/X2\n",
    "Tm=Tfl*((R2**2)+((sfl*X2)**2))*sm/(sfl*((R2**2)+((sm*X2)**2)))\n",
    "Ns=120*f/P\n",
    "N=Ns*(1-sm)\n",
    "#at start\n",
    "R21=X2\n",
    "Rex=R21-R2\n",
    "#results\n",
    "print\"maximum torque (Nm) = \",Tm\n",
    "print\"speed (r.p.m) = \",N\n",
    "print\"external resistance (ohm/ph) = \",Rex\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 30 - pg 10_70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "motor output (kW) =  16.54099\n",
      "copper loss in rotor (W) =  575.54\n",
      "motor input (kW) =  20.0147\n",
      "efficiency of motor (percent) =  82.644\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_30,pg10_70\n",
    "#calculate the motor output, copper loss and efficiency\n",
    "#given\n",
    "import math\n",
    "Tsh=162.84\n",
    "P=6.\n",
    "f=50.\n",
    "Tlost=20.36\n",
    "fr=1.5\n",
    "#calculations\n",
    "s=fr/f\n",
    "Ns=120*f/P\n",
    "N=Ns*(1-s)\n",
    "Po=Tsh*(2*math.pi*N)/60\n",
    "Fl=Tlost*(2*math.pi*N)/60\n",
    "Pm=Po+Fl\n",
    "Pc=Pm*s/(1-s)\n",
    "P2=Pc/s\n",
    "Sl=830\n",
    "Pi=P2+Sl\n",
    "n=Po*100/Pi\n",
    "#results\n",
    "print\"motor output (kW) = \",round(Po/1000.,5)\n",
    "print\"copper loss in rotor (W) = \",round(Pc,3)\n",
    "print\"motor input (kW) = \",round(Pi/1000.,4)\n",
    "print\"efficiency of motor (percent) = \",round(n,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 31 - pg 10_71"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of max to full load torque =  1.45\n",
      "speed at max torque (rpm) =  675.0\n"
     ]
    }
   ],
   "source": [
    "#Chapter-10,Example10_31,pg10_71\n",
    "#calculate the ratio of max to full load torque and speed at max torque\n",
    "#given\n",
    "f=50.\n",
    "P=8.\n",
    "R2=0.01\n",
    "X2=0.1\n",
    "sfl=0.04\n",
    "#calculations\n",
    "#for Tmax\n",
    "sm=R2/X2\n",
    "#for Tfl\n",
    "s=sfl\n",
    "T=sm*R2*((R2**2)+((sfl*X2)**2))/((sfl*R2)*((R2**2)+((sm*X2)**2)))#Tmax/Tfl\n",
    "Ns=120*f/P\n",
    "sm=0.1\n",
    "N=Ns*(1-sm)\n",
    "#results\n",
    "print\"ratio of max to full load torque = \",T\n",
    "print\"speed at max torque (rpm) = \",N\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
}