{
 "metadata": {
  "name": "",
  "signature": "sha256:93168f4fdcda81fb8a5194b03c33462ec0c810df117544b3470474e9e7f2fcbf"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Ch-8 : Control of DC Drivers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.12.4: p-275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Motor torque  \n",
      "import numpy as np  \n",
      "#given data :\n",
      "Vs_rms=230  # in volts\n",
      "N=1200  # in rpm\n",
      "Ia=40  # in A\n",
      "Ra=0.25  #in ohm\n",
      "Ka_fi1=0.182  # in V/rpm\n",
      "Ka_fi=(0.182*60)/(2*np.pi)  \n",
      "alfa_a=30  \n",
      "T=Ka_fi*Ia  \n",
      "print \"(a) Motor torque, T =\",round(T,2),\"N-m \"\n",
      "Ea=((2*np.sqrt(2)*Vs_rms)/np.pi)*(np.cos(alfa_a*np.pi/180))  \n",
      "N=(Ea-(Ra*Ia))/Ka_fi1  \n",
      "print \"(b) Speed of the motor, N =\",round(N,2),\"rpm\"\n",
      "Is_rms=Ia  \n",
      "PF=(Ea*Ia)/(Vs_rms*Is_rms)  \n",
      "print \"(c) Power factor, PF =\",round(PF,2),\"lagging\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Motor torque, T = 69.52 N-m \n",
        "(b) Speed of the motor, N = 930.39 rpm\n",
        "(c) Power factor, PF = 0.78 lagging\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.13.2: p-278"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Delay Angel of Armature,No load speed and speed regulation\n",
      "import numpy as np\n",
      "#given data :\n",
      "VL_rms=208  # in volts\n",
      "Kv=1.2  # in V/A-rad/sec\n",
      "Vs_rms=round(VL_rms/np.sqrt(3),2)  \n",
      "Vm=np.sqrt(2)*Vs_rms  \n",
      "Rf=240   # in ohm\n",
      "Ra=0.25  # in ohm\n",
      "alfa_f=0  # in degree\n",
      "V=280  # in volts\n",
      "Twenty_HP=20*746  #in watt\n",
      "Ia=Twenty_HP/V\n",
      "Ef=round((3*np.sqrt(3)*Vm*np.cos(alfa_f*np.pi/180))/np.pi,2)  \n",
      "N=1800  \n",
      "w=(N*2*np.pi)/60  \n",
      "If=Ef/Rf  \n",
      "Eg=Kv*w*If  \n",
      "Ea=round(Eg+(Ia*Ra),2)  \n",
      "alfa_a=(np.arccos((Ea*np.pi)/(3*np.sqrt(3)*Vm)))  \n",
      "print \"(a) Delay Angel Of Armature, alfa_a = \",round(alfa_a,2),\"degree\"\n",
      "Ia1=(Ia*10)/100\n",
      "Eg_noL=Ea-(Ia1*Ra)  \n",
      "w_0=(Eg_noL/(1.2*1.17))  # rad/sec\n",
      "N_0=(w_0*60)/(2*np.pi)  \n",
      "print \"(b) NO load speed at alfa|_a =\",round(N_0,2),\"rpm\"\n",
      "SR=((N_0-N)/N)*100  \n",
      "print \"(c) Speed Regulation, SR =\",round(SR,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Delay Angel Of Armature, alfa_a =  0.14 degree\n",
        "(b) NO load speed at alfa|_a = 1882.25 rpm\n",
        "(c) Speed Regulation, SR = 4.57 %\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.14.3 - P : 284"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#alpha, speed and delay angle\n",
      "from __future__ import division\n",
      "import numpy as np\n",
      "#given data :\n",
      "v1=208  #\n",
      "vsrms=v1/np.sqrt(3)  #\n",
      "n=1000  #rpm\n",
      "w=n*(np.pi/30)  #in rad/s\n",
      "ang=0  #\n",
      "ef=((3*np.sqrt(3)*np.sqrt(2)*vsrms*np.cos(ang))/np.pi)  #in volts\n",
      "rf=140  #in ohms\n",
      "If=ef/rf  #in amperes\n",
      "t=120  #N-m\n",
      "kv=1.2  #\n",
      "ia=(t)/(kv*If)  #in amperes\n",
      "eg=kv*If*w  #in volts\n",
      "ra=0.25  #in ohms\n",
      "ea=eg+(ia*ra)  #\n",
      "alpha=np.arccos((ea*np.pi)/(3*np.sqrt(3)*np.sqrt(2)*vsrms))\n",
      "print \"(a) alpha is\",round(alpha,2),\"degree\"\n",
      "rf=140  #in ohms\n",
      "If=ea/rf  #in amperes\n",
      "t=120  #N-m\n",
      "kv=1.2  #\n",
      "ia=(t)/(kv*If)  #in amperes\n",
      "ra=0.25  #in ohms\n",
      "eg=ea-(ia*ra)  #\n",
      "w=(eg/(kv*If))  #in rad/s\n",
      "N=w*(30/np.pi)  #rpm\n",
      "print \"(b) Speed is\",round(N,2),\"rpm\"\n",
      "n1=1000  #rpm\n",
      "w=n1*(np.pi/30)  #in rad/s\n",
      "v1=208  #\n",
      "vsrms=v1/np.sqrt(3)  #\n",
      "w1=(1800*(np.pi/30))  #\n",
      "n=1800  #rpm\n",
      "ang=0  #\n",
      "T=120  #n-m\n",
      "alphas=0  #\n",
      "ang=0  #\n",
      "ea=((3*np.sqrt(3)*np.sqrt(2)*vsrms*np.arccos(ang))/np.pi)  #in volts\n",
      "rf=140  #in ohms\n",
      "If=ea/rf  #in amperes\n",
      "t=120  #N-m\n",
      "kv=1.2  #\n",
      "ia=(t)/(kv*If)  #in amperes\n",
      "ra=0.25  #in ohms\n",
      "eg=ea-(ia*ra)  #\n",
      "if1=eg/(kv*w1)  #in amperese\n",
      "ef1=if1*rf  #in volts\n",
      "alphaf=np.arccos((ef1*np.pi)/(3*np.sqrt(3)*120*np.sqrt(2)))  \n",
      "print \"(c) Delay angle is\",round(alphaf,2),\"degree\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) alpha is 0.34 degree\n",
        "(b) Speed is 1058.39 rpm\n",
        "(c) Delay angle is 0.3 degree\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15.1: p-296"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#  Firing angle to keep the motor current and Power fed back \n",
      "from numpy import pi, sqrt, arccos\n",
      "#given data :\n",
      "Vs_rms=260  # in volts\n",
      "Ia=40  # in A\n",
      "Eg=192  #in volts\n",
      "kv=0.182  # in V/rpm\n",
      "Ra=0.3  # in ohm\n",
      "Ea=Eg+(Ia*Ra)  \n",
      "alfa_a=arccos((Ea*pi)/(2*Vs_rms*sqrt(2)))  \n",
      "print \"(a) Firing angle to keep motor current, alfa_a =\",round(alfa_a,2),\"degree\"\n",
      "Ea1=-Eg+(Ia*Ra)  \n",
      "alfa_b=arccos((Ea1*pi)/(2*Vs_rms*sqrt(2)))  \n",
      "print \"(b) Firing angle, alfa_b =\",round(alfa_b,2),\"degree\"\n",
      "Ia=40  # in A\n",
      "Eg=192  #in volts\n",
      "Ra=0.3  # in ohm\n",
      "Ea=-Eg+(Ia*Ra)  \n",
      "P=abs(Ea)*Ia  \n",
      "print \"(c) Power fed back, P =\",round(P,2),\"Watt\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Firing angle to keep motor current, alfa_a = 0.51 degree\n",
        "(b) Firing angle, alfa_b = 2.45 degree\n",
        "(c) Power fed back, P = 7200.0 Watt\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.15.3: p-312"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# torque developed,speed and input power factor\n",
      "from numpy import pi, sqrt, arccos, cos\n",
      "#given data :\n",
      "v=208  #in volts\n",
      "f=50  #in Hz\n",
      "ra=0.5  #in ohms\n",
      "rf=345  #in ohms\n",
      "kv=0.71  #in V/A-rad/sec\n",
      "alpha=45  #in degree\n",
      "ia=55  #in amperes\n",
      "If=((2*sqrt(2)*v*cos(0))/(pi*rf))  #in amperes\n",
      "t=kv*If*ia  #in  N/m\n",
      "print \"(a) Torque is\",round(t,2),\"N/m\"\n",
      "eb=((2*sqrt(2)*v*cos(alpha))/pi)-(ia*ra)  #in volts\n",
      "w=eb/(kv*If)  #in rad/sec\n",
      "N=w/(2*pi)  #rps\n",
      "print \"(b) speed is\",round(N*60,2),\"rpm\"\n",
      "#speed is calculated wrong in the textbook\n",
      "ea=132.4  #in volts\n",
      "ef=187.3  #in volts\n",
      "pi=(ea*ia)+(ef*If)  #in watts\n",
      "Isrms=sqrt((ia)**2+(If)**2)  #in amperes\n",
      "va1=Isrms*v  #in VA\n",
      "Pf=pi/va1  #\n",
      "print \"(d) power factor is\",round(Pf,2), \"lagging\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Torque is 21.2 N/m\n",
        "(b) speed is 1756.17 rpm\n",
        "(d) power factor is 0.65 lagging\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.16.1: p-318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# No load speed ,firing angle ,Power Factor and speed regulation\n",
      "from numpy import pi, sqrt, arccos, cos\n",
      "#given data :\n",
      "Ra=0.075  #in ohm\n",
      "alfa1=0  # in degree\n",
      "alfa2=30  # in degree\n",
      "VL_rms=480  # in volts\n",
      "Ka_fi=0.3  # in V/rms\n",
      "Vs_rms=round(VL_rms/sqrt(3),2)  \n",
      "Vm=sqrt(2)*Vs_rms  \n",
      "Ea=round((3*sqrt(3)*Vm*cos(alfa1))/pi)  \n",
      "Ea1=((3*sqrt(3)*Vm*cos(alfa2))/pi)  \n",
      "Ia=(10/100)*160  # in A\n",
      "N_0=(Ea-Ia*Ra)/Ka_fi  \n",
      "N_30=(Ea1-Ia*Ra)/Ka_fi  \n",
      "print \"part (a)\"\n",
      "print \"No load speed at alfa=0 degree is\",round(N_0,2),\"rpm\"\n",
      "print \"No load speed at alfa=30 degree is\",round(N_30,2),\"rpm\"\n",
      "print \"part (b)\"\n",
      "Ia=160  # in A\n",
      "N=1800  # in rpm\n",
      "Eg=540  # in volts\n",
      "Ea=(Eg+(Ia*Ra))  \n",
      "alfa=(arccos((Ea*pi)/(3*sqrt(3)*Vm)))  \n",
      "print \"The firng angel, alfa is\",round(alfa,2),\"degree\"\n",
      "Is_rms=sqrt(2/3)*Ia  \n",
      "Sva=3*Vs_rms*Is_rms  \n",
      "PF=(Ea*Ia)/(Sva)  \n",
      "print \"(c) Power Factor, PF =\",round(PF,2),\"lagging\"\n",
      "Ra=0.075  #in ohm\n",
      "Ia=160  # in A\n",
      "Ia1=16  # in A\n",
      "Eg=540  # in volts\n",
      "Ka_fi=0.3  # in V/rms\n",
      "N=1800  # in rpm\n",
      "Ea=(Eg+(Ia*Ra))  \n",
      "Eg1=Ea-(Ia1*Ra)  \n",
      "N_0=Eg1/Ka_fi  \n",
      "SR=((N_0-N)/N)*100  \n",
      "print \"(d) Speed Regulation, SR =\",round(SR,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part (a)\n",
        "No load speed at alfa=0 degree is 2156.0 rpm\n",
        "No load speed at alfa=30 degree is 329.3 rpm\n",
        "part (b)\n",
        "The firng angel, alfa is 0.55 degree\n",
        "(c) Power Factor, PF = 0.81 lagging\n",
        "(d) Speed Regulation, SR = 2.0 %\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}