{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter02 - Single Phase Induction Motors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 page 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, acos, pi, cos, atan\n",
      "from cmath import exp\n",
      "from __future__ import division\n",
      "# Given data\n",
      "Is=220 #in Ampere\n",
      "#For no load\n",
      "Vo=220 #in volt\n",
      "Io=6 #in Ampere\n",
      "wo=350 #in watt\n",
      "\n",
      "#From locked rotor test\n",
      "Vsc=125 #in volt\n",
      "Isc=15 #in Ampere\n",
      "Wsc=580 #in watt\n",
      "R1=1.5*1.2 #in \u03a9\n",
      "\n",
      "#Calculations\n",
      "Zeq=Vsc/Isc #in \u03a9\n",
      "Req=Wsc/Isc**2 #in \u03a9\n",
      "Xeq=sqrt(Zeq**2-Req**2) #in \u03a9\n",
      "R1=1.5*1.2 #1.5 times more\n",
      "R2=Req-R1 #in \u03a9\n",
      "#assume X1=X2  Xeq=X1+X2=2*X2\n",
      "X2=Xeq/2 #in \u03a9\n",
      "X1=X2 #in \u03a9\n",
      "r2=R2/2 #in \u03a9\n",
      "x2=X2/2 #in \u03a9\n",
      "\n",
      "cos_fio=wo/(Vo*Io) #unitless\n",
      "fi_o=acos(cos_fio) #in degree\n",
      "Io=Io*exp(1J*-fi_o*pi/180) #in Ampere(polar form)\n",
      "VAB=Vo-Io*(R1+r2/2+1J*(X1+X2/2)) #in volt\n",
      "Xo=abs(VAB)/abs(Io) #in ohm\n",
      "Xeq=2*Xo #in ohm\n",
      "S=5/100 #slip\n",
      "Zf=Xo*exp(1J*pi/2)*(r2/S+1J*X2/2)/(r2/S+1J*(X2/2+Xo)) #in ohm\n",
      "Z1=R1+1J*X1 #in ohm\n",
      "Z2=6.4819+1J*3.416 #in ohm\n",
      "Zeq=Z1+Z2+Zf #in ohm\n",
      "I1=Vo/Zeq #in Ampere\n",
      "PF=cos(atan((I1.imag)/(I1.real))) #lagging Power factor\n",
      "print \"Power factor = %0.4f lagging\"%PF \n",
      "Vf=I1*Zf #in volt\n",
      "I2f=Vf/(r2/S-1J*X2/2) #in Ampere\n",
      "Zb=Zf #in ohm\n",
      "Vb=I1*Zb #in Volt\n",
      "I2b=Vb/(r2/(2-S)+1J*X2) #in Ampere\n",
      "Pf=abs(I2f)**2*r2/S #in watts\n",
      "Pb=abs(I2b)**2*r2/(2-S) #in watts\n",
      "Pm=(1-S)*(Pf-Pb) #in watts\n",
      "Wo=350 #in watts\n",
      "Pout=Pm-Wo #in watts\n",
      "Pin=Vo*abs(I1)*PF #in watts\n",
      "Eff=Pout/Pin*100 #in %\n",
      "print \"Efficiency = %0.2f %% \"%Eff \n",
      "#Answer in the book is wrong. Lots of mistake in the solution while calculating Zf. "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power factor = 0.8144 lagging\n",
        "Efficiency = 21.64 % \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 Page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import real, imag\n",
      "from math import cos, atan,sin\n",
      "# Given data\n",
      "V1=110 #in volt\n",
      "Z1=2+1J*3 #in ohm\n",
      "Zeq_rotor=2+1J*3 #in ohm\n",
      "Xo=50 #in ohm(Magnetising impedence)\n",
      "Losses=25 #in watt(friction & voltage loss)\n",
      "S=5/100 #slip\n",
      "\n",
      "#Calculations\n",
      "R1=(Z1.real) #in \u03a9\n",
      "X1=(Z1.imag) #in \u03a9\n",
      "R2=real(Zeq_rotor.real) #in \u03a9\n",
      "X2=imag(Zeq_rotor.imag) #in \u03a9\n",
      "r2=R2/2 #in \u03a9\n",
      "x2=X2/2 #in \u03a9\n",
      "xo=Xo/2 #in ohm\n",
      "Zf=1J*xo*(r2/S+1J*x2)/(r2/S+1J*(xo+x2)) #in ohm\n",
      "Zb=1J*xo*(r2/(2-S)+1J*x2)/(r2/(2-S)+1J*(xo+x2)) #in ohm\n",
      "Zeq=Z1+Zf+Zb #in ohm\n",
      "I1=V1/Zeq #in Ampere\n",
      "InputCurrent=abs(I1) #in Ampere\n",
      "print \"Input current = %0.3f A\" %InputCurrent\n",
      "PF=cos(atan((I1.imag)/(I1.real))) \n",
      "print \"Power factor = %0.4f lagging \"%PF \n",
      "Vf=I1*Zf #in volt\n",
      "I2f=Vf/(r2/S+1J*x2) #in Ampere\n",
      "Vb=I1*Zb #in Volt\n",
      "I2b=Vb/(r2/(2-S)+1J*x2) #in Ampere\n",
      "Pf=abs(I2f)**2*r2/S #in watts\n",
      "Pb=13.88 #in watts\n",
      "Pm=(1-S)*(Pf-Pb) #in watts\n",
      "Pout=Pm-Losses #in watts\n",
      "Pin=V1*abs(I1)*PF #in watts\n",
      "Eff=Pout/Pin*100 #in %\n",
      "print \"Efficiency = %0.2f %% \"%Eff \n",
      "# Answer in the textbook are wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Input current = 5.648 A\n",
        "Power factor = 0.7552 lagging \n",
        "Efficiency = 70.63 % \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 Page 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import tan, pi, sqrt\n",
      "# Given data\n",
      "Pout=250 #in watt\n",
      "V1=230 #in volt\n",
      "f=50 #in Hz\n",
      "Zm=4.5+1J*3.7 #in ohm\n",
      "Za=9.5+1J*3.5 #in ohm\n",
      "\n",
      "#Calculations\n",
      "#Za=9.5+%i*3.5-%i*Xc #in ohm(Xc assumed to be connected in auxiliary winding)\n",
      "fi_a=90-atan((Zm.imag)/(Zm.real)) #in degree\n",
      "Ra=(Za.real) #in ohm\n",
      "Xa=(Za.imag) #in ohm\n",
      "X=tan(fi_a)*Ra #in ohm\n",
      "Xc=X+Xa #in ohm\n",
      "C=1/2/pi/f/Xc #in Farad\n",
      "print \"Value of capacitance = %0.2f micro farad \"%(C*10**6) \n",
      "#Note : In the book, instead of Capacitance which is asked, \n",
      "#Torque is calculated even not asked in question and not given the sufficient data to calculate it."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of capacitance = 70.28 micro farad \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 Page 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import degrees\n",
      "# Given data\n",
      "f=50 #in Hz\n",
      "Z1m=3+1J*2.7 #in ohm\n",
      "Z1a=7+1J*3 #in ohm\n",
      "alfa=90 #in degree\n",
      "\n",
      "#Calculations\n",
      "#Z1a=7+%i*3-%i*Xc #in ohm(Xc assumed to be connected in auxiliary winding)\n",
      "fi_a=90-degrees(atan((Z1m.imag)/(Z1m.real)))\n",
      "R1a=(Z1a.real) #in ohm\n",
      "X1a=(Z1a.imag) #in ohm\n",
      "X=tan(fi_a*pi/180)*R1a #in ohm\n",
      "Xc=X+X1a #in ohm\n",
      "C=1/2/pi/f/Xc #in Farad\n",
      "print \"Value of capacitance = %0.3f micro farad \"%(C*10**6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of capacitance = 295.339 micro farad \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5 Page 140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "V1=230 #in volt\n",
      "f=50 #in Hz\n",
      "Vm=100 #in volt\n",
      "Im=2 #in Ampere\n",
      "Wm=40 #in watts\n",
      "Va=80 #in volt\n",
      "Ia=1 #in Ampere\n",
      "Wa=50 #in watts\n",
      "\n",
      "#Calculations\n",
      "Z1em=Vm/Im #in ohm\n",
      "R1em=Wm/Im**2 #in ohm\n",
      "X1em=sqrt(Z1em**2-R1em**2) #in ohm\n",
      "R1m=R1em/2 #in ohm\n",
      "X1m=X1em/2 #in ohm\n",
      "fi_m=degrees(atan(X1m/R1m)) #in degree\n",
      "\n",
      "Z1ea=Va/Ia #in ohm\n",
      "R1ea=Wa/Ia**2 #in ohm\n",
      "X1ea=sqrt(Z1ea**2-R1ea**2) #in ohm\n",
      "Ra=R1ea-R1m #in ohm\n",
      "Xa=X1ea-X1m #in ohm\n",
      "fi_a=90-fi_m #in degree\n",
      "#after connecting capacitor\n",
      "Xc=Xa-tan(-fi_a*pi/180)*Ra\n",
      "C=1/2/pi/f/Xc #in Farad\n",
      "print \"Value of capacitance = %0.2f micro farad\"%(C*10**6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of capacitance = 67.52 micro farad\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}