{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      " Chapter 2:Dynamics of Electric Drives"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.1,Page no:16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#variable declaration\n",
      "Jo=0.2     # inertia of the motor in kg-m2\n",
      "a1=0.1     # reduction gear\n",
      "J1=10      # inertia of the load in kg-m2\n",
      "Tl1=10     # load torque\n",
      "v=1.5      # speed of the translational load \n",
      "M1=1000    # mass of the translational load\n",
      "N=1420     # speed of the motor\n",
      "n1=.9      # efficiency of the reduction gear\n",
      "n1_=0.85   # efficiency of the translational load and the motor\n",
      "F1=M1*9.81 # force of the translational load \n",
      "\n",
      "#Calculation\n",
      "Wm=N*math.pi/30 #angular speed\n",
      "J=Jo+a1**2*J1+ M1*(v/Wm)**2 # total equivalent moment of inertia\n",
      "Tl= a1*Tl1/n1+F1/n1_*(v/Wm) # total equivalent torque\n",
      "\n",
      "#Result\n",
      "print\"\\nEquivalent moment of inertia is :\",round(J,1),\"kg-m2\"\n",
      "print\"\\nEquivalent load torque :\",round(Tl,2),\"N-m\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Equivalent moment of inertia is: 0.4 kg-m2\n",
        "\n",
        "Equivalent load torque : 117.53 N-m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.2,Page no:22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import scipy\n",
      "from scipy import integrate\n",
      "import math\n",
      "\n",
      "# variable declaration\n",
      "J=10           #moment of inertia of the drive in kg-m2\n",
      "print(\"Passive load torque during steady state is :Tl=0.05*N in N-m\")\n",
      "print(\"And load torque : T=100-0.1*N in N-m \")\n",
      "print(\"load torque  when the direction is reversed T=-100-0.1*N  in N-m\")\n",
      "\n",
      "#Calculation\n",
      "print(\"T-Tl=0\")\n",
      "print(\"100-0.1*N-0.05*N=0\")\n",
      "N=100/0.15     #Required speed of the motor in rpm during steady state\n",
      "N2=-100/0.15   #During reversal speed is in opposite direction\n",
      "print(\"\\nJdWm/dt=-100-0.1*N-0.05*N during reversing\")\n",
      "print(\"dN/dt=30/(J*pi)*(-100-0.15*N)\")\n",
      "print(\"dN/dt=(-95.49-0.143*N)\")\n",
      "N1=N\n",
      "N2=N2*0.95 #for speed reversal \n",
      "x2 = lambda N: 1/(-95.49-0.143*N)\n",
      "t=integrate.quad(x2, round(N1), round(N2))\n",
      "\n",
      "#result\n",
      "print\"\\nHence Time of reversal is :\",round(t[0],2),\"s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Passive load torque during steady state is :Tl=0.05*N in N-m\n",
        "And load torque : T=100-0.1*N in N-m \n",
        "load torque  when the direction is reversed T=-100-0.1*N  in N-m\n",
        "T-Tl=0\n",
        "100-0.1*N-0.05*N=0\n",
        "\n",
        "JdWm/dt=-100-0.1*N-0.05*N during reversing\n",
        "dN/dt=30/(J*pi)*(-100-0.15*N)\n",
        "dN/dt=(-95.49-0.143*N)\n",
        "\n",
        "Hence Time of reversal is : 25.51 s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.3,Page no:27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#variable declaration\n",
      "Tlh=1000     # load torque in N-m\n",
      "Tmax=700     # maximum motor torque\n",
      "Tll=200      # light load for the motor to regain its steady state\n",
      "Tmin=Tll     # minimum torque\n",
      "t_h=10       # period for which a load torque of 1000 N-m is apllied in sec\n",
      "Jm=10        # moment of inertia of the motor in Kg-m2\n",
      "No=500       # no load speed in rpm\n",
      "Tr=500       # torque at a given no load speed in N-m\n",
      "\n",
      "#Calculation\n",
      "Wmo=No*2*math.pi/60 # angular no load speed in rad/sec\n",
      "s=0.05              # slip at a torque of 500 N-m\n",
      "Wmr=(1-s)*Wmo       # angular speed at a torque of 500 N-m in rad/sec\n",
      "\n",
      "y=math.log((Tlh-Tmin)/(Tlh-Tmax))\n",
      "x=Tr/(Wmo-Wmr)\n",
      "\n",
      "J=x*t_h/y\n",
      "Jf=J-Jm\n",
      "\n",
      "#Result \n",
      "#answer in the book is wrong\n",
      "print\"\\n\\nMoment of inertia of the flywheel : \", round(Jf,1),\"Kg-m2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "Moment of inertia of the flywheel :  1937.2 Kg-m2\n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}