{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 6 : Rotating electrical machine"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 : pg 105"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Terminal voltage,(V) =  459.25\n"
     ]
    }
   ],
   "source": [
    "#Example  6.1# Terminal voltage \n",
    "#calculate the terminal voltage\n",
    "#given data :\n",
    "Z=440.;# number of lap\n",
    "N=900.;# revolutions in rpm\n",
    "fi=0.07;#fluxin Wb\n",
    "P=4.;# number of pole\n",
    "A=4.;#constant\n",
    "Ia=50.;# armature current in Amperes\n",
    "E=462.;#voltage in V\n",
    "#calculations\n",
    "E=(P*fi*Z*N)/(60*A);#general voltage in volts\n",
    "R=0.002;# resistance in ohm\n",
    "C=110.;# conductors\n",
    "Re=C*R;#resistance of each path in ohm\n",
    "Ra=Re/A;#armature resistance in ohm\n",
    "V=E-(Ia*Ra);#terminal voltage in volts\n",
    "#results\n",
    "print \"Terminal voltage,(V) = \",V"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 : pg 105"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "emf when machine acts as generator,(V) =  205.0\n",
      "emf when machine acts as motor,(V) =  195.0\n"
     ]
    }
   ],
   "source": [
    "#Example  6.2# e.m.f \n",
    "#calculate the emf in all cases\n",
    "#given data :\n",
    "V=200.;#voltage\n",
    "Ra=0.1;#resistance in ohm\n",
    "Ia=50.;#armature current in Amperes\n",
    "#calculations\n",
    "E=V+(Ia*Ra);#generator voltage in volts\n",
    "Eb=V-(Ia*Ra);#motor voltage in volts\n",
    "#results\n",
    "print \"emf when machine acts as generator,(V) = \",E\n",
    "print \"emf when machine acts as motor,(V) = \",Eb\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 : pg 106"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed  is,(rpm)= 623.944\n",
      "armature torque is, (N-m)= 323.76\n",
      "full load motor efficiency is ,(%)= 79.2\n"
     ]
    }
   ],
   "source": [
    "#Example  6.3\n",
    "#calculate the speed ,torque and efficiency\n",
    "v=200.;#voltage in volts\n",
    "r=100.;#resistance in ohms\n",
    "#calculations\n",
    "ish=v/r;#shunt current in amperes\n",
    "i=4;#current in amperes\n",
    "nla=i-ish;#no load armature current in amperes\n",
    "w=8.;#powerin kW\n",
    "ifl=(w*10**3)/v;#full load current in amperes\n",
    "fla=ifl-ish;#full load armature current in amperes\n",
    "r1=0.6;#internal resistance in ohms\n",
    "ebo=(v-(ish*r1));#voltage in volts\n",
    "eb=(v-(fla*r1));#voltage in volts\n",
    "no=700.;#number of rpm\n",
    "n=no*(eb/ebo);#number of rpm\n",
    "ta=((eb*fla*60)/(2*n));#armature torque in N-m\n",
    "nlpi=v*i;#no load power input in watts\n",
    "cl=(ish**2*r1);#copper losses in watts\n",
    "cl=nlpi-cl;#total copper lossses in Watts\n",
    "flacl=(fla**2*r1);#full load armmature copper losses in Watts\n",
    "tfll=flacl+cl;#total full load losses in Watts\n",
    "flo=(w*10**3)-tfll;#full load output in Watts\n",
    "ef=((flo)/(w*10**3))*100;#efficiency\n",
    "#results\n",
    "print \"speed  is,(rpm)=\",round(n,3)\n",
    "print \"armature torque is, (N-m)=\",ta\n",
    "print \"full load motor efficiency is ,(%)=\",ef\n",
    "#armature torque is calculated wrong in the textbook\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 : pg 108"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The speed of the machine,(rpm) =  1003.51\n"
     ]
    }
   ],
   "source": [
    "#Example  6.4#  speed\n",
    "#calculate the speed of the machine\n",
    "#given data :\n",
    "fi=0.02# flux in Wb\n",
    "P=4.;# number of poles\n",
    "A=2.;#constant\n",
    "Z=151.*A;#turns\n",
    "V=200.;# in volts\n",
    "Rsh=50.;#shunt resistance in ohm\n",
    "Ra=0.01;# armature resistance in ohm\n",
    "Pr=40000.;#power required  in Watts\n",
    "#calculations\n",
    "Il=Pr/V;#load current in amperes\n",
    "Ish=V/Rsh;#shunt current in amperes\n",
    "Ia=Il+Ish;#armature current in amperes\n",
    "E=V+(Ia*Ra);#generated voltage\n",
    "N=(60*A*E)/(fi*P*Z);#rpm\n",
    "#results\n",
    "print \"The speed of the machine,(rpm) = \",round(N,3)\n",
    "#answer is wrong in the textbook\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 : pg 112"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Power consumed is,(W)= 5154.127\n"
     ]
    }
   ],
   "source": [
    "#Example  6.5#  Power\n",
    "#calculate the power consumed\n",
    "#given data :\n",
    "fp=0.024;# flux per pole\n",
    "lf=1.2;# leakage factor\n",
    "fi=fp/lf;# in Wb\n",
    "Z=756;#turns\n",
    "P=4;# number of pole\n",
    "N=1000;# in rpm\n",
    "A=4;#constant\n",
    "#calculations\n",
    "E=(fi*Z*N*P)/(60*A);#generated voltage\n",
    "il=1/10.;#load current in amperes\n",
    "ish=1/100.;#shunt current in amperes\n",
    "ra=1;#armature resistance in ohms\n",
    "isa=il+ish;#current in amperes\n",
    "v=((E)/(1+(ra*isa)));#volts\n",
    "r2=10;#ohms\n",
    "il=v/r2;#amperes\n",
    "pc=il*v;#Watts\n",
    "#results\n",
    "print \"Power consumed is,(W)=\",round(pc,3)\n",
    "#answer is wrong in the textbook\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 : pg 115"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "emf genereted,(V) =  254.0\n",
      "part (b)\n",
      "Total copper losses,(kW) =  3.3\n",
      "Output of the prime mover,(W) =  51750.0\n",
      "part (c)\n",
      "Mechanical efficiency,(%) =  98.164\n",
      "Electrical efficiency,(%) =  93.504\n",
      "Commercial efficiency,(%) =  91.787\n"
     ]
    }
   ],
   "source": [
    "#Example  6.6: \n",
    "#calculate the e.m.f ,copper losses ,output of the prime mover ,commercial, mechanical and electrical efficiencies\n",
    "#given data :\n",
    "Il=190;#load current in Amperes\n",
    "V=250;# voltage in volts\n",
    "Ra=0.02;#armature resistance in ohm\n",
    "Rsh=25.;#shunt resistance in ohm\n",
    "#calculations and results\n",
    "Ish=V/Rsh;#shunt current in amperes\n",
    "Ia=Ish+Il;#armature current in amperes\n",
    "E=V+(Ia*Ra);#generated voltage\n",
    "print \"part (a)\"\n",
    "print \"emf genereted,(V) = \",E\n",
    "Cl=(Ia**2*Ra);# armeture copper losses\n",
    "Sl=Ish*V;# shunt copper losses\n",
    "T=(Cl+Sl)*10**-3;#copper losses in k-Watt\n",
    "print \"part (b)\"\n",
    "print \"Total copper losses,(kW) = \",T\n",
    "Eo=V*Il;#output voltage in volts\n",
    "I_l=950.;#iron loss in watt\n",
    "O=Eo+I_l+(T*10**3);#output in watt\n",
    "print \"Output of the prime mover,(W) = \",O\n",
    "Ep=O-I_l;# electrical power in W\n",
    "Me=(Ep/O)*100;#Mechanical efficiency\n",
    "print \"part (c)\"\n",
    "print \"Mechanical efficiency,(%) = \",round(Me,3)\n",
    "Ee=(Eo/Ep)*100;#Electrical efficiency\n",
    "print \"Electrical efficiency,(%) = \",round(Ee,3)\n",
    "Ce=(Eo/O)*100;#Commercial efficiency\n",
    "print \"Commercial efficiency,(%) = \",round(Ce,3)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 : pg 117"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "additional resistance required is,(Ohm)= 9.162\n"
     ]
    }
   ],
   "source": [
    "#Example  6.7# resistance \n",
    "#calculate the resistance\n",
    "#given:\n",
    "n=1000;#turns in rpm\n",
    "ra=0.3;#armature resistance in ohms\n",
    "rf=40;#field resistance in ohms\n",
    "it=5;#field current in amperes\n",
    "if1=4;#field current in amperes\n",
    "e1=220.;#emf in volts\n",
    "e2=200.;#emf in volts\n",
    "ia=35.;#armature current in amperes\n",
    "#calculations\n",
    "eb=(e1-(ia*ra));#emf in volts\n",
    "x=((eb-e2)/(it*if1));#additional field current in amperes\n",
    "ce=e1-e2;#change in emf in volts\n",
    "ix=if1+x;#total current in amperes\n",
    "rt=(e1/ix);#total resistance in ohms\n",
    "adr=rt-rf;#additional resistance required in ohms\n",
    "#results\n",
    "print \"additional resistance required is,(Ohm)=\",round(adr,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 : pg 120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "resistance to be added is,(Ohm)= 18.644\n",
      "part (b)\n",
      "resistance to be added is,(Ohm)= 1.519\n",
      "speed is,(rpm)= 1500.0\n"
     ]
    }
   ],
   "source": [
    "#Example  6.8# resistance and speed\n",
    "#calculate the resistance and speed\n",
    "from math import ceil\n",
    "#given:\n",
    "v1=240.;#primary voltage\n",
    "r1=0.2;#primary resistance in ohm\n",
    "i1=40.;#primary current in volts\n",
    "#calculations and results\n",
    "eb1=(v1-i1*r1);#primary emf\n",
    "n11=1800.;#number of turns on primary side in rpm\n",
    "n21=1600.;#number of turns on secondary side in rpm\n",
    "i2=10.;#secondary current in amperes\n",
    "x=((n21/n11)*(i2/i1)*eb1);#variable\n",
    "r=((v1-(i2*r1))-x)/i2;#resistance in ohm\n",
    "print \"part (a)\"\n",
    "print \"resistance to be added is,(Ohm)=\",round(r,3)\n",
    "print \"part (b)\"\n",
    "n11=1800.;#number of turns on primary side\n",
    "n21=900.;#number of turns on secondary side in rpm\n",
    "i2=60.;#secondary current in amperes\n",
    "x=((n21/n11)*(1.18)*eb1);#variable\n",
    "r=((v1-(i2*r1))-x)/i2;#resistance in ohms\n",
    "print \"resistance to be added is,(Ohm)=\",round(r,3)\n",
    "eb2=228.;#secondary emf in volts\n",
    "eb1=232.;#primary emf in volts\n",
    "p1=100.;#primary power in watt\n",
    "p2=118.;#secondary power in watt\n",
    "n2=((eb2/eb1)*(p1/p2)*n11);#speed in rpm\n",
    "print \"speed is,(rpm)=\",ceil(n2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 : pg 121"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "speed is,(rpm)= 1433.938\n"
     ]
    }
   ],
   "source": [
    "#Example  6.9# speed\n",
    "#calculate the speed\n",
    "from math import sqrt\n",
    "#given:\n",
    "i1=50.;#primary current in amperes\n",
    "i2=i1/(sqrt(2));#secondary current in amperes\n",
    "r1=0.2;#primary resistance in ohms\n",
    "v1=220.;#primary voltage in volts\n",
    "#calculations\n",
    "eb1=((v1-(i1*r1)));#primary emf in volts\n",
    "eb2=((v1-(i2*r1)));#secondary emf in volts\n",
    "n1=1000#primary speed in rpm\n",
    "n2=(n1*(eb2/eb1)*(i1/i2));#seconadry speed in rpm\n",
    "#results\n",
    "print \"speed is,(rpm)=\",round(n2,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10 : pg 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      " The speed of rotating magnetic field,(rpm) =  1500.0\n",
      "part (b)\n",
      "Motor speed,(rpm) =  1447.5\n",
      "part (c)\n",
      "Frequency  2.0  Hz or  120  rpm \n",
      "part (d)\n",
      "Frequency of rotor current,(Hz) =  50.0\n"
     ]
    }
   ],
   "source": [
    "#Example 6.10# \n",
    "#calculate the Speed ,motor speed,and frequency \n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "f=50.;#frquency  in Hz\n",
    "P=4;# number of pole\n",
    "#calculations and results\n",
    "Ns=(120*f)/P;#speed in rom\n",
    "print \" The speed of rotating magnetic field,(rpm) = \",Ns\n",
    "print \"part (b)\"\n",
    "S=0.035;# slip\n",
    "N=Ns*(1-S);#motor speed in rpm\n",
    "print \"Motor speed,(rpm) = \",N\n",
    "print \"part (c)\"\n",
    "S=0.04;# slip\n",
    "F=S*f;#frequency in Hz\n",
    "print \"Frequency \",F,\" Hz or \",120,\" rpm \"\n",
    "print \"part (d)\"\n",
    "f=50.;# in Hz\n",
    "F=f;#frequency in Hz\n",
    "print \"Frequency of rotor current,(Hz) = \",F\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11 : pg 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "rotor current per phase is,(A)= 14.003\n",
      "power factor is,= 0.243\n",
      "part (b)\n",
      "rotor current per phase is,(A)= 10.206\n",
      "power factor is,= 0.707\n"
     ]
    }
   ],
   "source": [
    "#Example 6.11# \n",
    "#calculate the current per phase and power factor\n",
    "from math import sqrt\n",
    "#given:\n",
    "v1=100.;#emf in volts\n",
    "vi=v1/sqrt(3);#induced emf in volts\n",
    "r1=1.;#rotor resistance ohms per phase\n",
    "r2=4.;#rotor reactance ohms per phase\n",
    "#calculations and results\n",
    "r=sqrt(r1**2+r2**2);#rotor impedence per phase\n",
    "rcp=(vi/r);#rotor current per phase\n",
    "pf=(1./r);#power factor\n",
    "print \"part (a)\"\n",
    "print \"rotor current per phase is,(A)=\",round(rcp,3)\n",
    "print \"power factor is,=\",round(pf,3)\n",
    "r3=3.;#ohms\n",
    "r4=r1+r3;#rotor resistance ohms per phase\n",
    "r2=4.;#rotor reactance ohms per phase\n",
    "r=sqrt(r4**2+r2**2);#rotor impedence per phase\n",
    "rcp=(vi/r);#rotor current per phase\n",
    "pf=(r4/r);#power factor\n",
    "print \"part (b)\"\n",
    "print \"rotor current per phase is,(A)=\",round(rcp,3)\n",
    "print \"power factor is,=\",round(pf,3)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12 : pg 127"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a) generator \n",
      "emf  when the armature current is full load unit pf is,(V)= 89.444\n",
      "emf  when the armature current is full load 0.8 pf (lag) is,(V)= 112.857\n",
      "emf  when the armature current is full load 0.8 pf (lead) is,(V)= 56.71\n",
      "part (b) motor\n",
      "emf  when the armature current is full load unit pf is,(V)= 89.444\n",
      "emf  when the armature current is full load 0.8 pf (lag) is,(V)= 56.71\n",
      "emf  when the armature current is full load 0.8 pf (lead) is,(V)= 112.857\n"
     ]
    }
   ],
   "source": [
    "#Example 6.12# emf\n",
    "#calculate the emf\n",
    "from math import sqrt, pi\n",
    "#given:\n",
    "print \"part (a) generator \"\n",
    "kva=4.;#kVA\n",
    "v=110.;#volts\n",
    "re=3.;#syncronous reacrance in ohms\n",
    "#calculations and results\n",
    "ip=((kva*10**3)/(sqrt(3)*v));#phase current in Amperes\n",
    "ep=v/(sqrt(3));#phase voltage in volts\n",
    "e1=ep+1j*(ip*3);#line voltage in volts\n",
    "e11=sqrt((e1.real**2)+e1.imag**2);#line voltage per phase in volts\n",
    "pf=0.8;#power factor\n",
    "e12=(sqrt((e1.real*pf)**2+(((e1.imag*sqrt(1-pf**2))+e1.imag))**2));#\n",
    "e13=(sqrt((e1.real*pf)**2+(((e1.imag*sqrt(1-pf**2))-e1.imag))**2));#\n",
    "print \"emf  when the armature current is full load unit pf is,(V)=\",round(e11,3)\n",
    "print \"emf  when the armature current is full load 0.8 pf (lag) is,(V)=\",round(e12,3)\n",
    "print \"emf  when the armature current is full load 0.8 pf (lead) is,(V)=\",round(e13,3)\n",
    "print \"part (b) motor\"\n",
    "kva=4;#kVa\n",
    "v=110;#volts\n",
    "re=3;#syncronous reacrance in ohms\n",
    "ip=((kva*10**3)/(sqrt(3)*v));#phase current in Amperes\n",
    "ep=v/(sqrt(3));#phase voltage in volts\n",
    "e1=ep-1j*(ip*3);#line voltage in volts\n",
    "e11=sqrt((e1.real**2)+e1.imag**2);#line voltage per phase in volts\n",
    "pf=0.8;#power factor\n",
    "e12=(sqrt((e1.real*pf)**2+(((e1.imag*sqrt(1-pf**2))-e1.imag))**2));#\n",
    "e13=(sqrt((e1.real*pf)**2+(((e1.imag*sqrt(1-pf**2))+e1.imag))**2));#\n",
    "print \"emf  when the armature current is full load unit pf is,(V)=\",round(e11,3)\n",
    "print \"emf  when the armature current is full load 0.8 pf (lag) is,(V)=\",round(e12,3)\n",
    "print \"emf  when the armature current is full load 0.8 pf (lead) is,(V)=\",round(e13,3)\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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}