{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Selection of Motor Power Rating"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1,Page no:49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.optimize import fsolve\n",
      "#Variable declaration\n",
      "P=30.0 #[Power  KW\n",
      "theta1=30.0 #Temperature degree C\n",
      "t1=40.0 # time in  min\n",
      "theta2=45.0 #Final temperature in degree C\n",
      "\n",
      "#Calculation\n",
      "t2=80.0 #min(t2=2*t1)\n",
      "#theta=theta_f*(1-exp(-t/T))\"\n",
      "def f(T):\n",
      "    return((1-math.exp(-80.0/T))/(1-math.exp(-40/T))-(theta2/theta1))\n",
      "T=fsolve(f,1)\n",
      "theta_f=theta1/(1.0-math.exp(-t1/T)) #degreeC\n",
      "#Result\n",
      "print\"(a).Thermal time constant: \",round(T[0],2),\"minutes\"\n",
      "print\"(b).Final temperature rise: \",theta_f,\"degrees\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (a).Thermal time constant:  57.71 minutes\n",
        "(b).Final temperature rise:  60.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2,Page no:50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "P=30.0 #Power in KW\n",
      "theta1=20.0 #Temerature degree C\n",
      "t1=30.0 #Time in min\n",
      "theta2=30.0 #Temperature in degree C\n",
      "t2=60.0 #Final time innmin(t2=2*t1)\n",
      "\n",
      "#Calculation\n",
      "#Let exp(-t1/T)=x then exp(-t2/T)=x**2\n",
      "#theta1/theta2=(1-x)/(1-x**2)\n",
      "#x**2*theta1-x*theta2+theta2-theta1=0\n",
      "def f(T):\n",
      "    return(((1-math.exp(-t2/T))/(1-math.exp(-t1/T)))-theta2/theta1)\n",
      "T=fsolve(f,1)\n",
      "theta_f=theta1/(1-math.exp(-t1/T)) #degreeC\n",
      "\n",
      "#Result\n",
      "print\"Thermal time constant  : \",round(T[0],2),\"minutes\"\n",
      "print\"Final temperature rise  : \",theta_f,\"C\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Thermal time constant  :  43.28 minutes\n",
        "Final temperature rise  :  40.0 C\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3,Page no:51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "T_ambient=30        #Ambient tmeperature in dgree C\n",
      "P=30.0 #Power  in KW\n",
      "theta1=54.0-T_ambient #Temperature durin g full load operation degree C\n",
      "t1=1.0 #Time in hour\n",
      "theta2=67.0-T_ambient #Temperature in degree C\n",
      "t2=2.0 #Time in hour(t2=2*t1)\n",
      "\n",
      "#Calculation\n",
      "def f(T):\n",
      "    return(((1-math.exp(-2/T))/(1-math.exp(-1/T)))-theta2/theta1)\n",
      "T=fsolve(f,1)\n",
      "theta_f=theta1/(1-math.exp(-t1/T)) #degreeC\n",
      "theta_steady=theta_f+30 #degreeC\n",
      "\n",
      "#Result\n",
      "print\"(a)  Final steady state temperature  : \",round(theta_steady,2),\"C\"\n",
      "print\"(b)  Heating time constant :\",round(T[0],2),\"hour\"\n",
      "theta2=theta_f #degree C\n",
      "t=2.7 #hour\n",
      "theta=40-30 #degree C\n",
      "Tdash=-t/math.log(theta/theta2) #hour\n",
      "print\"(c)  Cooling time constant: \",round(Tdash,2),\"hour\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (a)  Final steady state temperature  :  82.36 C\n",
        "(b)  Heating time constant : 1.63 hour\n",
        "(c)  Cooling time constant:  1.63 hour\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4,Page no:52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "T=110.0 #Time in min\n",
      "Tdash=150.0 #Final time in min\n",
      "t=30.0 #Run time of motor min\n",
      "tdash=45.0 #Switch off time in min\n",
      "theta_f=50.0 #final temperature rise in degree C\n",
      "\n",
      "#Calculation\n",
      "#theta=theta_f-(theta_f-theta1)*exp(-t/T)\n",
      "#theta1=theta*exp(-tdash/Tdash) \n",
      "theta=(theta_f-theta_f*math.exp(-t/T))/(1-math.exp(-tdash/Tdash)*math.exp(-t/T)) #degreeC\n",
      "\n",
      "#Result\n",
      "print\"Maximum temperature rise of the motor: \",round(theta,2),\"C\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum temperature rise of the motor:  27.37 C\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5,Page no:52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "theta1=20.0 #Initial temperature in degreeC\n",
      "theta2=28.0 #Final temperature in degreeC\n",
      "dthetaBYdt1=0.08 #Rate of temp rise in degreeC/min\n",
      "dthetaBYdt2=0.06 #Rate of temp rise in degreeC/min\n",
      "\n",
      "#Calculation\n",
      "#theta=theta_f-(theta_f-theta1)*exp(-t/T)\n",
      "#dtheta/dt=(theta_f-theta)/T\n",
      "#dthetaBYdt1/dthetaBYdt2=(theta_f-theta1)/(theta_f-theta2)\n",
      "theta_f=(theta2*dthetaBYdt1-theta1*dthetaBYdt2)/(dthetaBYdt1-dthetaBYdt2)\n",
      "T=(theta_f-theta1)/dthetaBYdt1 #min\n",
      "\n",
      "#Result\n",
      "print\"Final temperature rise,theta_f= : \",theta_f,\"C\"\n",
      "print\"Heating time constant: \",T,\"minutes\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Final temperature rise,theta_f= :  52.0 C\n",
        "Heating time constant:  400.0 minutes\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6,Page no:59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "cycle1=50.0 #Duty cycle hp\n",
      "t1=20.0 #Time in sec\n",
      "cycle2=100.0 #Duty cycle in hp\n",
      "t2=20.0 #Time in sec\n",
      "cycle3=150.0 #3rd duty cycle in hp\n",
      "t3=10.0 #time sec\n",
      "cycle4=120.0 #4th duty cyclein hp\n",
      "t4=20.0 #time sec\n",
      "cycle5=0.0 #th duty cycle in hp\n",
      "t5=15.0 #sec\n",
      "\n",
      "#Calculation\n",
      "hp_rms=math.sqrt((cycle1**2*t1+cycle2**2*t2+cycle3**2*t3+cycle4**2*t4+cycle5**2*t5)/(t1+t2+t3+t4+t5)) #hp\n",
      "\n",
      "#Result\n",
      "print\"hp(rms) for the motor : \",round(hp_rms,2),\"hp\"\n",
      "print\"We should choose 100hp motor.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hp(rms) for the motor :  94.74 hp\n",
        "We should choose 100hp motor.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7,Page no:61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "t_on=15.0 #Time for full load [min]\n",
      "t_off=25.0 #time for off load in [min]\n",
      "T=100.0 #Heating time constant in [min]\n",
      "Tdash=140.0 #Cooling time constant in [min]\n",
      "theta_f=55.0 #Continuous full load operation time in [degree C]\n",
      "\n",
      "#Calculation\n",
      "#theta=theta_f-(theta_f-theta1)*exp(-t/T)\n",
      "#theta1=theta*exp(-tdash/Tdash) \n",
      "theta_max=theta_f*(1-math.exp(-t_on/T))/(1-math.exp(-(t_off/Tdash+t_on/T))) #degreeC\n",
      "\n",
      "#Result\n",
      "print\"Maximum temperature rise: \",round(theta_max,2),\"C\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum temperature rise:  27.36 C\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8,Page no:62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\n",
      "#Variable declaration\n",
      "Rating=100.0 #Rating in KW\n",
      "alfa=0.9 #Ratio rating unitless\n",
      "ts=20.0 #Running time in min\n",
      "T=100.0 #Heating time constant in min\n",
      "\n",
      "#Calculation\n",
      "S=math.sqrt((1.0+alfa)/(1.0-math.exp(-ts/T))) \n",
      "ShortTimeRating=S*Rating #KW\n",
      "\n",
      "#Result\n",
      "print\"Short time rating: \",round(ShortTimeRating,1),\"kW\"\n",
      "print\"NOTE:Answer is wrong in the textbook.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Short time rating:  323.8 kW\n",
        "NOTE:Answer is wrong in the textbook.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9,Page no:62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "T=80.0 #Heating time constant in min\n",
      "Tdash=110.0 #cooling time constant in min\n",
      "Rating=50.0 #Full load rating in [KW]\n",
      "ts=15.0 #Runt time in [min]\n",
      "\n",
      "#Calculation\n",
      "S=math.sqrt(1.0/(1.0-math.exp(-ts/T))) \n",
      "ShortTimeRating=S*Rating #KW\n",
      "t_off=20.0 #min\n",
      "S=math.sqrt((1.0-math.exp(-(ts/T+t_off/Tdash)))/(1.0-math.exp(-(ts/T))))\n",
      "DutyRating=S*Rating #KW\n",
      "\n",
      "#Result\n",
      "print\"(a)  Short time rating of motor: \",round(ShortTimeRating,1),\"kW\"\n",
      "print\"(b)  Intermittent periodic duty rating: \",round(DutyRating,2),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  Short time rating of motor:  120.9 kW\n",
        "(b)  Intermittent periodic duty rating:  67.2 kW\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10,Page no:63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "T=90.0 #Heating time constant in [min]\n",
      "t=25.0 #time in min \n",
      "ShortTimeRating=50.0 #Short time rating in KW\n",
      "Eff=80/100.0 #Efficiency\n",
      "\n",
      "#Calculation\n",
      "#Let full load rating is P KW and Losses=Pc\n",
      "#CuLoss=(P/(P*Eff))**2 & alfa=Pc/CuLoss\n",
      "alfa=(Eff)**2 #unitless\n",
      "S=math.sqrt(((1.0+alfa)/(1.0-math.exp(-t/T))-alfa)) \n",
      "ContinuousRating_fl=ShortTimeRating/S #KW\n",
      "\n",
      "#Result\n",
      "print\"Full load continuous rating: \",round(ContinuousRating_fl,1),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Full load continuous rating:  20.2 kW\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11,Page no:63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "Rating=25.0 #Rating in [KW]\n",
      "T=90.0 #Heating time constant in min\n",
      "ts=30.0 #time in min\n",
      "\n",
      "#Calculation\n",
      "S=math.sqrt(1.0/(1.0-math.exp(-ts/T))) \n",
      "HalfHourRating=S*Rating #KW\n",
      "\n",
      "#Result\n",
      "print\"Half hour rating of motor: \",round(HalfHourRating,2),\"kW\"\n",
      "print\"Answer wrong in textbook.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Half hour rating of motor:  46.96 kW\n",
        "Answer wrong in textbook.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12,Page no:63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration:\n",
      "ts=20        #rating itme in [min]\n",
      "W=300         #rating in [W]\n",
      "T=60         #time constant in [minutes]\n",
      "max_eff_load=0.8      #Maximum effeciency of motor at load\n",
      "\n",
      "#Calculations\n",
      "import sympy\n",
      "P=sympy.Symbol('P')\n",
      "pc=sympy.Symbol('pc')\n",
      "Full_load_CL=(P/(0.8*P))**2*pc\n",
      "alpha=pc/Full_load_CL\n",
      "S=math.sqrt((1.0+alpha)/(1-math.exp(-ts/64.0))-alpha)\n",
      "Cont_rating=W/round(S,1)\n",
      "\n",
      "#Result\n",
      "print\"Continuous rating of motor is :\",round(Cont_rating,1),\"W\"\n",
      "print\"NOTE:There is a slight error in book in calculation of S,approximate value is taken\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Continuous rating of motor is : 130.4 W\n",
        "NOTE:There is a slight error in book in calculation of S,approximate value is taken\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Continuous rating of motor is : 130.4 W\n",
        "NOTE:There is a slight error in book in calculation of S,approximate value is taken\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13,Page no:67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "P=6.0 #poles\n",
      "f=50.0 #Frequency in [Hz]\n",
      "MoI=9.5 #Moment of inertia in [Kg-m**2]\n",
      "Tr=550.0 #Torque in [N-m]\n",
      "S=5.0/100.0 #Slip\n",
      "Tmax=720.0 #MAximum torque in [N-m]\n",
      "T_LH=1020.0 #Torque requirement in [N-m]\n",
      "th=12.0 #Time in [sec]\n",
      "Tmin=220.0 #Light torque req in [N-m]\n",
      "Snl=3.0/100.0 #No load slip\n",
      "Ns=120.0*f/P #Speed in rpm\n",
      "\n",
      "#Calculation\n",
      "Nnl=Ns-Ns*Snl #rpm\n",
      "Nrated=Ns-Ns*S #rpm\n",
      "omega_mo=Nnl*2.0*math.pi/60.0 #rad/s\n",
      "omega_mr=Nrated*2.0*math.pi/60.0 #rad/s\n",
      "J=(Tr/(omega_mo-omega_mr))*(th/math.log((T_LH-Tmin)/(T_LH-Tmax))) #Kg-m**2\n",
      "MoI_flywheel=J-MoI #Kg-m**2\n",
      "\n",
      "#Result\n",
      "print\"Moment of inertia of flywheel : \",MoI_flywheel,\"kg-m^2\"\n",
      "print\"NOTE:Answer in the book is wrong.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moment of inertia of flywheel :  3203.36081501 kg-m^2\n",
        "NOTE:Answer in the book is wrong.\n"
       ]
      }
     ],
     "prompt_number": 26
    }
   ],
   "metadata": {}
  }
 ]
}