{
 "metadata": {
  "name": "",
  "signature": "sha256:18b62f9d05dddb3fa3e34cb2cfa86e210f5eaa5cdedab202d52d0e65a17b4192"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16 : Turning Moment Diagrams and Flywheel"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.1 Page No : 573"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import linalg\n",
      "\n",
      "# Variables:\n",
      "m = 6.5*1000 \t\t#kg\n",
      "k = 1.8 \t\t\t#m\n",
      "deltaE = 56.*1000 \t#N-m\n",
      "N = 120. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the maximum and minimum speeds\n",
      "#We know that fluctuation of energy deltaE  =  math.pi**2/900*m*k**2*N*(N1-N2) or N1-N2  =  (deltaE/(math.pi**2/900*m*k**2*N))    .....(i)\n",
      "#Also mean speed N  =  (N1+N2)/2 or N1+N2  =  2*N                                                                     .....(ii)\n",
      "A = [[1, -1],[ 1, 1]]\n",
      "B = [deltaE/(math.pi**2/900*m*k**2*N), 2*N]\n",
      "V = linalg.solve(A,B)\n",
      "N1 = round(V[0]) \t\t\t#rpm\n",
      "N2 = round(V[1]) \t\t\t#rpm\n",
      "\n",
      "#Results:\n",
      "print \" Maximum speed N1  =  %d rpm.\"%(N1)\n",
      "print \" Minimum speed N2  =  %d rpm.\"%(N2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Maximum speed N1  =  121 rpm.\n",
        " Minimum speed N2  =  119 rpm.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.2 Page No : 573"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "k = 1.   \t\t\t#m\n",
      "m = 2500. \t\t\t#kg\n",
      "T = 1500. \t\t\t#N-m\n",
      "\n",
      "#Solution:\n",
      "#Angular acceleration of the flywheel:\n",
      "#Calculating the mass moment of inertia of the flywheel\n",
      "I = m*k**2 \t\t\t#kg-m**2\n",
      "#Calculating the angular acceleration of the flywheel\n",
      "alpha = T/I \t\t\t#rad/s**2\n",
      "#Kinetic energy of the flywheel:\n",
      "omega1 = 0 \t\t\t#Angular speed at rest\n",
      "#Calculating the angular speed after 10 seconds\n",
      "omega2 = omega1+alpha*10 \t\t\t#rad/s\n",
      "#Calculating the kinetic energy of the flywheel\n",
      "KE = 1./2*I*(omega2)**2/1000 \t\t\t#Kinetic energy of the flywheel kN-m\n",
      "\n",
      "#Results:\n",
      "print \" Angular acceleration of the flywheel alpha  =  %.1f rad/s**2.\"%(alpha)\n",
      "print \" Kinetic energy of the flywheel  =  %.1f kN-m.\"%(KE)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Angular acceleration of the flywheel alpha  =  0.6 rad/s**2.\n",
        " Kinetic energy of the flywheel  =  45.0 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.3 Page No : 574"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 300.*1000 \t#W\n",
      "N = 90. \t\t#rpm\n",
      "CE = 0.1\n",
      "k = 2. \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Calculating the mean angular speed\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 1./100\n",
      "#Calculating the work done per cycle\n",
      "WD = P*60/N \t\t\t#Work done per cycle N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = WD*CE \t\t\t#N-m\n",
      "#Calculating the mass of the flywheel\n",
      "m = deltaE/(k**2*omega**2*CS) \t\t\t#kg\n",
      "#Results:\n",
      "print \" Mass of the flywheel, m  =  %d kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of the flywheel, m  =  5628 kg.\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.4 Page No : 574"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "m = 36. \t\t\t#kg\n",
      "k = 150./1000 \t\t#m\n",
      "N = 1800. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.6\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the value of 1 mm**2 on the turning moment diagram\n",
      "c = 5*math.pi/180 \t\t\t#Value of 1 mm**2 on turning miment diagram N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "#From the turning moment diagram maximum energy  =  E+295 and minimum energy  =  E-690\n",
      "deltaE = (285-(-690))*c \t\t\t#N-m\n",
      "#Calculating the coefficient of fluctuation of energy\n",
      "CS = deltaE/(m*k**2*omega**2)*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Coefficient of fluctuation of speed CS  =  %.1f %%.\"%(CS)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Coefficient of fluctuation of speed CS  =  0.3 %.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.5 Page No : 575"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 600. \t\t\t#rpm\n",
      "R = 0.5 \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.7\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 3./100\n",
      "#Calculating the value of 1 mm**2 on turning moment diagram\n",
      "c = 600*math.pi/60 \t\t\t#Value of 1 mm**2 on turning moment diagram N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "#From the turning moment diagram maximum fluctuation  =  E+52 and minimum fluctuation  =  E-120\n",
      "deltaE = (52.-(-120))*c \t\t\t#N-m\n",
      "#Calculating the mass of the flywheel\n",
      "m = deltaE/(R**2*omega**2*CS) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass of the flywheel m  =  %d kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of the flywheel m  =  182 kg.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.6 Page No : 584\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 250. \t\t\t#rpm\n",
      "m = 500. \t\t\t#kg\n",
      "k = 600./1000 \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.8\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the torque required for one complete cycle\n",
      "T = (6*math.pi*750)+(1./2*math.pi*(3000-750))+(2*math.pi*(3000-750))+(1./2*math.pi*(3000-750)) \t\t\t#N-m\n",
      "#Calculating the mean torque\n",
      "Tmean = T/(6*math.pi) \t\t\t#N-m\n",
      "#Calculating the power required to drive the machine\n",
      "P = Tmean*omega/1000 \t\t\t#kW\n",
      "#Coefficient of fluctuation of speed:\n",
      "#Calculating the value of LM\n",
      "LM = math.pi*((3000.-1875)/(3000-750.))\n",
      "#Calculating the value of NP\n",
      "NP = math.pi*((3000.-1875)/(3000-750))\n",
      "#Calculating the value of BM\n",
      "BM = 3000-1875. \t\t\t#N-m CN = BM\n",
      "#Calculating the value of MN\n",
      "MN = 2*math.pi\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = (1./2*LM*BM)+(MN*BM)+(1./2*NP*BM) \t\t\t#N-m\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = deltaE/(m*k**2*omega**2)\n",
      "\n",
      "#Results:\n",
      "print \" Power required to drive the machine P  =  %.3f kW.\"%(P)\n",
      "print \" Coefficient of speed CS  =  %.3f.\"%(CS)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power required to drive the machine P  =  49.087 kW.\n",
        " Coefficient of speed CS  =  0.072.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.7 Page No : 578"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 100. \t\t\t#rpm\n",
      "k = 1.75 \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.9\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 1.5/100\n",
      "#Coefficient of fluctuation of energy:\n",
      "AB = 2000.\n",
      "LM = 1500. \t\t\t#N-m\n",
      "#Calculating the work done per cycle\n",
      "WD = (1./2*math.pi*AB)+(1./2*math.pi*LM) \t\t\t#Work done per cycle N-m\n",
      "#Calculating the mean resisting torque\n",
      "Tmean = WD/(2*math.pi) \t\t\t#N-m\n",
      "#Calculating the value of CD\n",
      "CD = math.pi/2000*(2000-875) \t\t\t#rad\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = 1./2*CD*(2000-875) \t\t\t#N-m\n",
      "#Calculating the coefficient of fluctuation of energy\n",
      "Ce = deltaE/WD*100 \t\t\t#%\n",
      "#Calculating the mass of the flywheel\n",
      "m = deltaE/(k**2*omega**2*CS) \t\t\t#kg\n",
      "#Crank angles for minimum and maximum speeds:\n",
      "#Calculating the value of CE\n",
      "CE = (2000.-875)/2000*(4*math.pi/9) \t\t\t#rad\n",
      "#Calculating the crank angle for minimum speed\n",
      "thetaC = ((4.*math.pi/9)-CE)*180/math.pi \t\t\t#degrees\n",
      "#Calculating the value of ED\n",
      "ED = (2000.-875)/2000*(math.pi-(4*math.pi/9)) \t\t\t#rad\n",
      "#Calculating the crank angle for maximum speed\n",
      "thetaD = ((4.*math.pi/9)+ED)*180/math.pi \t\t\t#degrees\n",
      "\n",
      "#Results:\n",
      "print \" Coefficient of fluctuation of energy CE  =  %d %%.\"%(Ce)\n",
      "print \" Mass of the flywheel, m  =  %.1f kg.\"%(m)\n",
      "print \" Crank angle from IDC for the minimum speed, thetaC  =  %d degrees.\"%(thetaC)\n",
      "print \" Crank angle from IDC for the maximum speed, thetaD  =  %d degrees.\"%(thetaD)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Coefficient of fluctuation of energy CE  =  18 %.\n",
        " Mass of the flywheel, m  =  197.3 kg.\n",
        " Crank angle from IDC for the minimum speed, thetaC  =  35 degrees.\n",
        " Crank angle from IDC for the maximum speed, thetaD  =  136 degrees.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.8 Page No : 580"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 600. \t\t\t#rpm\n",
      "Tmax = 90. \t\t\t#N-m\n",
      "m = 12. \t\t\t#kg\n",
      "k = 80./1000 \t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.10\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Power developed:\n",
      "#Calculating the work done per cycle\n",
      "WD = 3*1./2*math.pi*90 \t\t\t#Work done per cycle N-m\n",
      "#Calculating the mean torque\n",
      "Tmean = WD/(2*math.pi) \t\t\t#N-m\\\n",
      "#Calculating the power developed\n",
      "P = Tmean*omega/1000 \t\t\t#Power developed kW\n",
      "#Coefficient of fluctuation of speed:\n",
      "#Calculating the maximum fluctuation of energy\n",
      "#From the torque-crank angle diagram maximum energy = E+5.89 and minimum energy = E-5.89\n",
      "deltaE = 5.89-(-5.89) \t\t\t#N-m\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = round(deltaE/(m*k**2*omega**2)*100) \t\t\t#%\n",
      "#Calculating the coefficient of fluctuation of energy\n",
      "CE = deltaE/WD*100 \t\t\t#%\n",
      "#Calculating the maximum angular acceleration of the flywheel\n",
      "alpha = (Tmax-Tmean)/(m*k**2) \t\t\t#rad/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Power developed  =  %.2f kW.\"%(P)\n",
      "print \" Coefficient of fluctuation of speed CS  =  %d %%.\"%(CS)\n",
      "print \" Coefficient of fluctuation of energy CE  =  %.2f %%.\"%(CE)\n",
      "print \" Maximum angular acceleration of the flywheel alpha  =  %d rad/s**2.\"%(alpha)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power developed  =  4.24 kW.\n",
        " Coefficient of fluctuation of speed CS  =  4 %.\n",
        " Coefficient of fluctuation of energy CE  =  2.78 %.\n",
        " Maximum angular acceleration of the flywheel alpha  =  292 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.9 Page No : 582"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 20.*1000 \t\t\t#W\n",
      "N = 300. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.11\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#ra/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 4./100\n",
      "#Calculating the number of working strokes per cycle for a four stroke engine\n",
      "n = N/2\n",
      "#Calculating the work done per cycle\n",
      "WD = P*60/n \t\t\t#Work done per cycle N-m\n",
      "#Calculating the work done during expansion cycle\n",
      "WE = WD*3./2 \t\t\t#N-m\n",
      "#Calculating the maximum turning moment\n",
      "Tmax = WE*2/math.pi \t\t\t#N-m\n",
      "#Calculating the mean turning moment\n",
      "Tmean = WD/(4*math.pi) \t\t\t#N-m\n",
      "#Calculating the excess turning moment\n",
      "Texcess = Tmax-Tmean \t\t\t#N-m\n",
      "#Calculating the value of DE\n",
      "DE = Texcess/Tmax*math.pi \t\t\t#rad\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = (1./2*DE*Texcess) \t\t\t#N-m\n",
      "#Calculating the moment of inertia of the flywheel\n",
      "I = deltaE/(omega**2*CS) \t\t\t#kg-m**2\n",
      "\n",
      "#Results:\n",
      "print \" Moment of inertia of the flywheel I  =  %.1f kg-m**2.\"%(I)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Moment of inertia of the flywheel I  =  255.4 kg-m**2.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.10 Page No : 584"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "a1 = 0.45*10**-3\n",
      "a2 = 1.7*10**-3\n",
      "a3 = 6.8*10**-3\n",
      "a4 = 0.65*10**-3 \t\t\t#m**2\n",
      "N1 = 202.\n",
      "N2 = 198. \t\t\t#rpm\n",
      "R = 1.2 \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.12\n",
      "#Calculating the net area\n",
      "a = a3-(a1+a2+a4) \t\t\t#Net area m**2\n",
      "#Calculating the energy scale constant\n",
      "c = 3*10**6 \t\t\t#Energy scale constant N-m\n",
      "#Calculating the net work done per cycle\n",
      "WD = a*c \t\t\t#Net work done per cycle N-m\n",
      "#Calculating the mean torque\n",
      "Tmean = round(WD/(4*math.pi)) \t\t\t#N-m\n",
      "#Calculating the value of FG\n",
      "FG = Tmean \t\t\t#N-m\n",
      "#Calculating the work done during expansion stroke\n",
      "WDe = a3*c \t\t\t#Work done during expansion stroke N-m\n",
      "#Calculating the value of AG\n",
      "AG = WDe/(1./2*math.pi) \t\t\t#N-m\n",
      "#Calculating the excess torque\n",
      "Texcess = round(AG-FG,-1) \t\t\t#N-m\n",
      "#Calculating the value of AF\n",
      "AF = Texcess \t\t\t#N-m\n",
      "#Calculating the value of DE\n",
      "DE = round(AF/AG*math.pi,1) \t\t\t#rad\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = 1./2*DE*AF \t\t\t#N-m\n",
      "#Mass of the rim of a flywheel:\n",
      "#Calculating the mean speed of the flywheel\n",
      "N = (N1+N2)/2 \t\t\t#rpm\n",
      "#Calculating the mass of the rim of a flywheel\n",
      "m = deltaE/(math.pi**2/900*R**2*N*(N1-N2)) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass of the rim of the flywheel m  =  %.f kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of the rim of the flywheel m  =  1381 kg.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.11 page no : 585"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from scipy.integrate import quad\n",
      "\n",
      "# variables\n",
      "w = math.pi*2*180./60     # rad/s\n",
      "T = 180                   # rpm\n",
      "Cs = 0.01                 # speed\n",
      "\n",
      "# Calculations\n",
      "work_done_r = 20000 * 2    # pi N-m\n",
      "Tmean = work_done_r/2      # N-m\n",
      "power = round(Tmean * w,-3)/1000\n",
      "deltaE = 11078 \n",
      "energy = deltaE/round((w**2*Cs),2)\n",
      "excess = 9500*math.sin(math.radians(90)) - 5700*math.cos(math.radians(90))\n",
      "alpha = excess/energy\n",
      "\n",
      "# results\n",
      "print \"power developed by the engine : %.f kW\"%power\n",
      "print \"maximum fluctuation of energy : %.f kg-m**2\"%energy\n",
      "print \"Alpha a = %.3f rad/s**2\"%alpha"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power developed by the engine : 377 kW\n",
        "maximum fluctuation of energy : 3121 kg-m**2\n",
        "Alpha a = 3.044 rad/s**2\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.12 Page No : 587"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables:\n",
      "m = 500. \t\t\t#kg\n",
      "k = 0.4 \t\t\t#m\n",
      "N = 150. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.14\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Fluctuation of energy:\n",
      "#Equating the change in torque to zero and calculating the value of theta\n",
      "thetaA = math.sin(math.radians(0))\n",
      "thetaC = math.sin(math.radians(0))+180\n",
      "thetaE = math.sin(math.radians(0))+360 \t\t\t#degrees\n",
      "thetaB = 65.4\n",
      "thetaD = 294.6\n",
      "\n",
      "#Calculating the maximum fluctuation of energy\n",
      "def f4(theta): \n",
      "    return (5000+600*math.sin(2*theta))-(5000+500*math.sin(theta))\n",
      "\n",
      "deltaE = round( quad(f4 ,thetaC*math.pi/180,thetaD*math.pi/180)[0])\n",
      "\n",
      "#Calculating the total percentage fluctuation of speed\n",
      "CS = deltaE/(m*k**2*omega**2)*100 \t\t\t#%\n",
      "#Maximum and minimum angular acceleration of the flywheel and the corresponding shaft positions:\n",
      "#Calculating the maximum or minimum values of theta\n",
      "#Differentiating (600*math.sin(2*theta))-500*math.sin(theta)  =  0 with respect to theta and equating to zero\n",
      "#we get 12*2*(math.cos(theta))**2-5*math.cos(theta)-12  =  0\n",
      "a = 12.*2\n",
      "b = -5.\n",
      "c = -12.\n",
      "costheta1 = (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "costheta2 = (-b-math.sqrt(b**2-4*a*c))/(2*a)\n",
      "theta1 = math.degrees(math.acos(costheta1))\n",
      "theta2 = math.degrees(math.acos(costheta2)) \t\t\t#degrees\n",
      "#Calculating the maximum torque\n",
      "Tmax = 600*math.sin(math.radians(2*theta1))-500*math.sin(math.radians(theta1)) \t\t\t#N-m\n",
      "#Calculating the minimum torque\n",
      "Tmin = 600*math.sin(math.radians(2*theta2))-500*math.sin(math.radians(theta2)) \t\t\t#N-m\n",
      "#Calculating the maximum acceleration\n",
      "alphamax = Tmax/(m*k**2) \t\t\t#rad/s**2\n",
      "#Calculating the minimum acceleration\n",
      "alphamin = abs(Tmin)/(m*k**2) \t\t\t#rad/s**2\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Fluctuation of energy deltaE  =  %d N-m.\"%(deltaE)\n",
      "print \" Total percentage fluctuation of speed CS  =  %.1f %%.\"%(CS)\n",
      "print \" Shaft position corresponding to maximum and minimum accelerations\\\n",
      " theta  =  %d degrees and %.1f degrees.\"%(theta1,theta2)\n",
      "print \" Maximum acceleration, alphamax  =  %.2f rad/s**2.\"%(alphamax)\n",
      "print \" Minimum acceleration alphamin  =  %.1f rad/s**2.\"%(alphamin)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Fluctuation of energy deltaE  =  1204 N-m.\n",
        " Total percentage fluctuation of speed CS  =  6.1 %.\n",
        " Shaft position corresponding to maximum and minimum accelerations theta  =  35 degrees and 127.6 degrees.\n",
        " Maximum acceleration, alphamax  =  3.46 rad/s**2.\n",
        " Minimum acceleration alphamin  =  12.2 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.13 Page No : 589"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables:\n",
      "I = 1000. \t\t\t#kg-m**2\n",
      "N = 300. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.15 and Fig. 16.16\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Power of the engine:\n",
      "#Calculating the work done per revolution\n",
      "def f0(theta): \n",
      "    return 5000+1500*math.sin(3*theta)\n",
      "\n",
      "WD =  quad(f0,0,2*math.pi)[0]\n",
      "\n",
      "#Calculating the mean resisting torque\n",
      "Tmean = WD/(2*math.pi) \t\t\t#N-m\n",
      "#Calculating the power of the engine\n",
      "P = Tmean*omega/1000 \t\t\t#kW\n",
      "#Maximum fluctuation of the speed of the flywheel when resisting torque is consmath.tant:\n",
      "#Calculating the value of theta \n",
      "theta = (5000-5000)/1500\n",
      "theta = 1./3*(math.sin(math.radians((theta)))+180) \t\t\t#degrees\n",
      "#Calculating the maximum fluctuation of energy\n",
      "def f1(theta): \n",
      "    return 5000+1500*math.sin(3*theta)-5000\n",
      "\n",
      "deltaE =  quad(f1,0,60*math.pi/180)[0]\n",
      "\n",
      "#Calculating the maximum fluctuation of speed of the flywheel\n",
      "CS1 = deltaE/(I*omega**2)*100 \t\t\t#%\n",
      "#Maximum fluctuation of speed of the flywheel when resisting torque (5000+600*math.sin(theta)) N-m:\n",
      "#Calculating the values of theta thetaB and thetaC\n",
      "thetaB = math.sin(math.radians(math.sqrt((1./4*(3-600./1500))))) \t\t\t#degrees\n",
      "thetaC = 180-thetaB \t\t\t#degrees\n",
      "#Calculating the maximum fluctuation of energy\n",
      "\n",
      "def f2(theta): \n",
      "    return (5000+1500*math.sin(3*theta))-(5000+600*math.sin(theta))\n",
      "\n",
      "deltaE = round( quad(f2,thetaB*math.pi/180,thetaC*math.pi/180)[0])\n",
      "\n",
      "#Calculating the maximum fluctuation of speed of the flywheel\n",
      "CS2 = abs(deltaE)/(I*omega**2)*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Power of the engine P  =  %.1f kW.\"%(P)\n",
      "print \" Maximum fluctuation of the speed of the flywheel when resisting torque\\\n",
      " is constant, CS  =  %.1f %%.\"%(CS1)\n",
      "print \" Maximum fluctuation of speed of the flywheel when resisting torque \\\n",
      " 5000+600*sintheta N-m CS  =  %.3f %%.\"%(CS2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power of the engine P  =  157.1 kW.\n",
        " Maximum fluctuation of the speed of the flywheel when resisting torque is constant, CS  =  0.1 %.\n",
        " Maximum fluctuation of speed of the flywheel when resisting torque  5000+600*sintheta N-m CS  =  0.020 %.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.14 Page No : 592"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 800. \t\t\t#rpm\n",
      "stroke = 300. \t\t\t#mm\n",
      "sigma = 7.*10**6 \t\t\t#N/m**2\n",
      "rho = 7200. \t\t\t#kg/m**3\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.18\n",
      "#Calculating the angular speed of the engine\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 4./100\n",
      "#Diameter of the flywheel rim:\n",
      "#Calculating the peripheral velocity of the flywheel rim\n",
      "v = math.sqrt(sigma/rho) \t\t\t#m/s\n",
      "#Calculating the diameter of the flywheel rim\n",
      "D = v*60/(math.pi*N) \t\t\t#m\n",
      "#Cross-section of the flywheel rim:\n",
      "#Calculating the value of 1 mm**2 on the turning moment diagram\n",
      "c = 500.*math.pi/30 \t\t\t#Value of 1 mm**2 on the turning moment diagram N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = round((420.-(-30))*c) \t\t\t#N-m\n",
      "#Calculating the mass of the flywheel rim\n",
      "m = deltaE/(v**2*CS) \t\t\t#kg\n",
      "#Calculating the thickness of the flywheel rim\n",
      "t = math.sqrt(m/(math.pi*D*5*rho))*1000 \t\t\t#mm\n",
      "#Calculating the width of the flywheel rim\n",
      "b = 5*t \t\t\t                #mm\n",
      "\n",
      "#Results:\n",
      "print \" Diameter of the flywheel rim D  =  %.3f m.\"%(D)\n",
      "print \" Thickness of the flywheel rim t  =  %d mm.\"%(t)\n",
      "print \" Width of the flywheel rim b  =  %d mm.\"%(b)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Diameter of the flywheel rim D  =  0.744 m.\n",
        " Thickness of the flywheel rim t  =  84 mm.\n",
        " Width of the flywheel rim b  =  424 mm.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.15 Page No : 594"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 150.*1000 \t\t\t#W\n",
      "N = 80. \t\t\t#rpm\n",
      "CE = 0.1\n",
      "D = 2.\n",
      "R = D/2. \t\t\t#m\n",
      "rho = 7200. \t\t\t#kg/m**3\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the engine\n",
      "omega = round(2*math.pi*N/60,1) \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 4./100\n",
      "#Mass of the flywheel rim:\n",
      "#Calculating the work done per cycle\n",
      "WD = P*60/N \t\t\t#Work done per cycle N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = WD*CE \t\t\t#N-m\n",
      "#Calculating the mass moment of inertia of the flywheel\n",
      "I = deltaE/(omega**2*CS) \t\t\t#kg-m**2\n",
      "#Calculating the mass moment of inertia of the flywheel rim\n",
      "Irim = 0.95*I \t\t\t#kg-m**2\n",
      "#Calculating the mass of the flywheel rim\n",
      "k = R \t\t\t#Radius of gyration m\n",
      "m = Irim/k**2 \t\t\t#kg\n",
      "#Calculating the cross-sectional area of the flywheel rim\n",
      "A = m/(2*math.pi*R*rho) \t\t\t#m**2\n",
      "\n",
      "#Resilts:\n",
      "print \" Mass of the flywheel rim m  =  %.f kg.\"%(m)\n",
      "print \" Cross-sectional area of the flywheel rim A  =  %.3f m**2.\"%(A)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of the flywheel rim m  =  3787 kg.\n",
        " Cross-sectional area of the flywheel rim A  =  0.084 m**2.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.16 Page No : 595"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 600. \t\t\t#rpm\n",
      "rho = 7250. \t\t\t#kg/m**3\n",
      "sigma = 6.*10**6 \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.19\n",
      "#Calculating the angular speed of the engine\n",
      "omega = 2.*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the total fluctuation of speed\n",
      "CS = 2./100\n",
      "#Moment of inertia of the flywheel:\n",
      "#Calculating the value of 1 mm**2 of turning moment diagram\n",
      "c = 250.*math.pi/60 \t\t\t#Value of 1 mm**2 of turning moment diagram N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = round((162.-(-35))*c) \t\t\t#N-m\n",
      "#Calculating the moment of inertia of the flywheel\n",
      "I = deltaE/(omega**2*CS) \t\t\t#kg-m**2\n",
      "#Dimensions of the flywheel rim:\n",
      "#Calculating the peripheral velocity of the flywheel\n",
      "v = math.sqrt(sigma/rho) \t\t\t#m/s\n",
      "#Calculating the mean diameter of the flywheel\n",
      "D = v*60/(math.pi*N) \t\t\t#m\n",
      "#Calculating the maximum fluctuation of energy of the flywheel rim\n",
      "deltaErim = 0.92*deltaE \t\t\t#N-m\n",
      "#Calculating the mass of the flywheel rim\n",
      "m = deltaErim/(v**2*CS) \t\t\t#kg\n",
      "#Calculating the thickness of the flywheel rim\n",
      "t = math.sqrt(m/(math.pi*D*2*rho))*1000 \t\t\t#mm\n",
      "#Calculating the breadth of the flywheel rim\n",
      "b = 2*t \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Moment of inertia of the flywheel I  =  %.1f kg-m**2.\"%(I)\n",
      "print \" Thickness of the flywheel rim t  =  %.1f mm.\"%(t)\n",
      "print \" Breadth of the flywheel rim b  =  %.1f mm.\"%(b)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Moment of inertia of the flywheel I  =  32.7 kg-m**2.\n",
        " Thickness of the flywheel rim t  =  58.6 mm.\n",
        " Breadth of the flywheel rim b  =  117.2 mm.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.17 Page No : 596"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "a1 = 5.*10**-5          #m**2\n",
      "a2 = 21.*10**-5        #m**2\n",
      "a3 = 85.*10**-5        #m**2\n",
      "a4 = 8.*10**-5 \t\t\t#m**2\n",
      "N2 = 98.\n",
      "N1 = 102. \t\t\t#rpm\n",
      "rho = 8150. \t\t\t#kg/m**3\n",
      "sigma = 7.5*10**6 \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.20\n",
      "#Calculating the net area\n",
      "a = a3-(a1+a2+a4) \t\t\t#Net area m**2\n",
      "#Calculating the value of 1 m**2 on the turning moment diagram in terms of work\n",
      "c = 14*10**6 \t\t\t#Value of 1 m**2 on the turning moment diagram N-m\n",
      "#Calculating the net work done per cycle\n",
      "WD = a*c \t\t\t#Net work done per cycle N-m\n",
      "#Calculating the mean torque on the flywheel\n",
      "Tmean = round(WD/(4*math.pi)) \t\t\t#N-m\n",
      "FG = Tmean \t\t\t#N-m\n",
      "#Calculating the work done during expansion stroke\n",
      "WDe = int(a3*c) \t\t\t#Work done during expansion stroke N-m\n",
      "#Calculating the value of AG\n",
      "AG = int(WDe/(1./2*math.pi)) \t\t\t#N-m\n",
      "#Calculating the excess torque\n",
      "Texcess = AG-FG \t\t\t#Excess torque N-m\n",
      "AF = Texcess \t\t\t#N-m\n",
      "#Calculating the value of DE\n",
      "DE = round(AF/AG*math.pi,1) \t\t\t#rad\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = 1./2*DE*AF \t\t\t#N-m\n",
      "#Moment of inertia of the flywheel:\n",
      "#Calculating the mean speed during the cycle\n",
      "N = (N1+N2)/2 \t\t\t#rpm\n",
      "#Calculating the corresponding angular mean speed\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = (N1-N2)/N\n",
      "#Calculating the moment of inertia of the flywheel\n",
      "I = deltaE/(omega**2*CS) \t\t\t#kg-m**2\n",
      "#Size of flywheel:\n",
      "#Calculating the peripheral velocity of the flywheel\n",
      "v = math.sqrt(sigma/rho) \t\t\t#m/s\n",
      "#Calculating the mean diameter of the flywheel\n",
      "D = v*60/(math.pi*N) \t\t\t#m\n",
      "#Calculating the mass of the flywheel rim\n",
      "m = deltaE/(v**2*CS) \t\t\t#kg\n",
      "#Calculating the thickness of the flywheel rim\n",
      "t = math.sqrt(m/(math.pi*D*4*rho))*1000 \t\t\t#mm\n",
      "#Calculating the width of the flywheel rim\n",
      "b = 4*t \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Moment of inertia of the flywheel I  =  %.f kg-m**2.\"%(I)\n",
      "print \" Thickness of the flywheel rim t  =  %.1f mm.\"%(t)\n",
      "print \" Width of the flywheel rim b  =  %.1f mm.\"%(b)\n",
      "\n",
      "# rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Moment of inertia of the flywheel I  =  2316 kg-m**2.\n",
        " Thickness of the flywheel rim t  =  21.6 mm.\n",
        " Width of the flywheel rim b  =  86.3 mm.\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.18 Page No : 599"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 50.*1000 \t\t\t#W\n",
      "N = 150. \t\t\t#rpm\n",
      "n = 75.\n",
      "sigma = 4.*10**6 \t\t\t#N/m**2\n",
      "rho = 7200. \t\t\t#kg/m**3\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 16.21\n",
      "#Calculating the angular speed of the engine\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the mean torque transmitted by the flywheel\n",
      "Tmean = P/omega \t\t\t#N-m\n",
      "FG = Tmean \t\t\t#N-m\n",
      "#Calculating the work done per cycle\n",
      "WD = Tmean*4*math.pi \t\t\t#Work done per cycle N-m\n",
      "#Calculating the work done during power stroke\n",
      "WDp = 1.4*WD \t\t\t#Work done during power stroke N-m\n",
      "#Calculating the maximum torque transmitted by the flywheel\n",
      "Tmax = WDp/(1./2*math.pi) \t\t\t#N-m\n",
      "BF = Tmax \t\t\t#N-m\n",
      "#Calculating the excess torque\n",
      "Texcess = Tmax-Tmean \t\t\t#N-m\n",
      "BG = Texcess \t\t\t#N-m\n",
      "#Calculating the value of DE\n",
      "DE = BG/BF*math.pi \t\t\t#N-m\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = 1./2*DE*BG \t\t\t#N-m\n",
      "#Mean diameter of the flywheel:\n",
      "#Calculating the peripheral velocity of the flywheel\n",
      "v = math.sqrt(sigma/rho) \t\t\t#m/s\n",
      "#Calculating the mean diameter of the flywheel\n",
      "D = v*60./(math.pi*N) \t\t\t#m\n",
      "#Cross-sectional dimensions of the rim:\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 1./100\n",
      "#Calculating the total energy of the flywheel\n",
      "E = deltaE/(2*CS) \t\t\t#N-m\n",
      "#Calculating the energy of the rim\n",
      "Erim = 15./16*E \t\t\t#N-m\n",
      "#Calculating the mass of the flywheel rim\n",
      "m = Erim/(1./2*v**2) \t\t\t#kg\n",
      "#Calculating the thickness of the rim\n",
      "t = round(math.sqrt(m/(math.pi*D*4*rho))*1000) \t\t\t#mm\n",
      "#Calculating the width of the rim\n",
      "b = 4*t \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Mean diameter of the flywheel D  =  %d m.\"%(D)\n",
      "print \" Thickness of the flywheel rim t  =  %d mm.\"%(t)\n",
      "print \" Width of the flywheel rim b  =  %d mm.\"%(b)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mean diameter of the flywheel D  =  3 m.\n",
        " Thickness of the flywheel rim t  =  170 mm.\n",
        " Width of the flywheel rim b  =  680 mm.\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.19 Page No : 603"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N1 = 225.\n",
      "N2 = 200. \t\t\t#rpm\n",
      "k = 0.5 \t\t\t#m\n",
      "E1 = 15.*1000 \t\t\t#N-m\n",
      "HolePunched = 720. \t\t\t#per hour\n",
      "\n",
      "#Solution:\n",
      "#Power of the motor:\n",
      "#Calculating the total energy required per second\n",
      "E = E1*HolePunched/3600 \t\t\t#N-m/s\n",
      "#Calculating the power of the motor\n",
      "P = E/1000 \t\t\t#kW\n",
      "#Minimum mass of the flywheel:\n",
      "#Calculating the energy supplied by the motor in 2 seconds\n",
      "E2 = E*2 \t\t\t#N-m\n",
      "#Calculating the energy supplied by the flywheel during punching\n",
      "deltaE = E1-E2 \t\t\t#N-m\n",
      "#Calculating the mean speed of the flywheel\n",
      "N = (N1+N2)/2 \t\t\t#rpm\n",
      "#Calculating the minimum mass of the flywheel\n",
      "m = round(deltaE*900/(math.pi**2*k**2*N*(N1-N2))) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Power of the motor P  =  %d kW.\"%(P)\n",
      "print \" Minimum mass of the flywheel m  =  %d kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power of the motor P  =  3 kW.\n",
        " Minimum mass of the flywheel m  =  618 kg.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.20 Page No : 603"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "d = 38.             #mm\n",
      "t = 32.             #mm\n",
      "s = 100. \t\t\t#mm\n",
      "E1 = 7. \t\t\t#N-m/mm**2 of sheared area\n",
      "v = 25. \t\t\t#m/s\n",
      "\n",
      "#Solution:\n",
      "#Power of the motor required:\n",
      "#Calculating the sheared area\n",
      "A = round(math.pi*d*t) \t\t\t#mm**2\n",
      "#Calculating the total energy required per hole\n",
      "E1 = E1*A \t\t\t#N-m\n",
      "#Calculating the energy required for punching work per second\n",
      "E = E1/10 \t\t\t#Energy required for punching work per second N-m/s\n",
      "#Calculating the power of the motor required\n",
      "P = E/1000 \t\t\t#Power of the motor required kW\n",
      "#Mass of the flywheel required:\n",
      "#Calculating the time required to punch a hole in a 32 mm thick plate\n",
      "t32 = 10/(2*s)*t \t\t\t#Time required to punch a hole in 32 mm thick plate seconds\n",
      "#Calculating the energy supplied by the motor in t32 seconds\n",
      "E2 = E*t32 \t\t\t#N-m\n",
      "#Calculating the energy to be supplied by the flywheel during punching\n",
      "deltaE = E1-E2 \t\t\t#N-m\n",
      "#Calculating the coefficient of fluctuation of speed\n",
      "CS = 3/100.\n",
      "#Calculating the mass of the flywheel required\n",
      "m = round(deltaE/(v**2*CS)) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Power of the motor required P  =  %.3f kW.\"%(P)\n",
      "print \" Mass of the flywheel required m  =  %d kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power of the motor required P  =  2.674 kW.\n",
        " Mass of the flywheel required m  =  1198 kg.\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.21 Page No : 604"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 3. \t\t\t#kW\n",
      "m = 150. \t\t\t#kg\n",
      "k = 0.6 \t\t\t#m\n",
      "N1 = 300. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the flywheel before riveting\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Speed of the flywheel immediately after riveting:\n",
      "#Calculating the energy supplied by the motor\n",
      "E2 = P*1000 \t\t\t#N-m/s\n",
      "#Calculating the energy absorbed during one riveting operation which takes 1 second\n",
      "E1 = 10000 \t\t\t#N-m\n",
      "#Calculating the energy to be supplied by the flywheel for each riveting operation per second\n",
      "deltaE = E1-E2 \t\t\t#N-m\n",
      "#Calculating the angular speed of the flywheel immediately after riveting\n",
      "omega2 = math.sqrt(omega1**2-(2*deltaE/(m*k**2))) \t\t\t#rad/s\n",
      "#Calculating the corresponding speed in rpm\n",
      "N2 = omega2*60/(2*math.pi) \t\t\t#rpm\n",
      "#Calculating the number of rivets that can be closed per minute\n",
      "n = E2/E1*60 \t\t\t#Number of rivets that can be closed per minute\n",
      "\n",
      "#Results:\n",
      "print \" Speed of the flywheel immediately after riveting N2  =  %.1f rpm.\"%(N2)\n",
      "print \" Number of rivets that can be closed per minute  =  %d rivets.\"%(n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Speed of the flywheel immediately after riveting N2  =  257.6 rpm.\n",
        " Number of rivets that can be closed per minute  =  18 rivets.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.22 Page No : 605"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "d = 40.             #mm\n",
      "t = 15. \t\t\t#mm\n",
      "NoofHoles = 30. \t\t\t#per minute\n",
      "EnergyRequired = 6. \t\t\t#N-m/mm**2\n",
      "Time = 1./10 \t\t\t#seconds\n",
      "N1 = 160.\n",
      "N2 = 140. \t\t\t#rpm\n",
      "k = 1. \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Calculating the sheared area per hole\n",
      "A = round(math.pi*d*t) \t\t\t#Sheared area per hole mm**2\n",
      "#Calculating the energy required to punch a hole\n",
      "E1 = EnergyRequired*A \t\t\t#N-m\n",
      "#Calculating the energy required for punching work per second\n",
      "E = E1*NoofHoles/60 \t\t\t#Energy required for punching work per second N-m/s\n",
      "#Calculating the energy supplied by the motor during the time of punching\n",
      "E2 = E*Time \t\t\t#N-m\n",
      "#Calculating the energy to be supplied by the flywheel during punching a hole\n",
      "deltaE = E1-E2 \t\t\t#N-m\n",
      "#Calculating the mean speed of the flywheel\n",
      "N = (N1+N2)/2 \t\t\t#rpm\n",
      "#Calculating the mass of the flywheel required\n",
      "m = round(deltaE*900/(math.pi**2*k**2*N*(N1-N2))) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass of the flywheel required m  =  %d kg.\"%(m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of the flywheel required m  =  327 kg.\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.23 Page No : 606"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "n = 25.\n",
      "d1 = 25./1000      #m\n",
      "t1 = 18./1000      #m\n",
      "D = 1.4\n",
      "R = D/2 \t\t\t#m\n",
      "touu = 300.*10**6 \t\t\t#N/m**2\n",
      "etam = 95./100\n",
      "CS = 0.1\n",
      "sigma = 6.*10**6 \t\t\t#N/m**2\n",
      "rho = 7250. \t\t\t#kg/m**3\n",
      "\n",
      "#Solution:\n",
      "#Power needed for the driving motor:\n",
      "#Calculating the area of the plate sheared\n",
      "AS = math.pi*d1*t1 \t\t\t#m**2\n",
      "#Calculating the maximum shearing force required for punching\n",
      "FS = AS*touu \t\t\t#N\n",
      "#Calculating the energy required per stroke\n",
      "E = 1./2*FS*t1 \t\t\t#Energy required per stroke N-m\n",
      "#Calculating the energy required per minute\n",
      "E1 = E*n \t\t\t#Energy required per minute N-m\n",
      "#Calculating the power required for the driving motor\n",
      "P = E1/(60*etam)/1000 \t\t\t#Energy required for the driving motor kW\n",
      "#Dimensions for the rim cross-section:\n",
      "#Calculating the maximum fluctuation of energy\n",
      "deltaE = 9./10*E \t\t\t#N-m\n",
      "#Calculating the maximum fluctuation of energy provided by the rim\n",
      "deltaErim = 0.95*deltaE \t\t\t#N-m\n",
      "#Calculating the mean speed of the flywheel\n",
      "N = 9.*25 \t\t\t#rpm\n",
      "#Calculating the mean angular speed\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the mass of the flywheel\n",
      "m = round(deltaErim/(R**2*omega**2*CS)) \t\t\t#kg\n",
      "#Calculating the thickness of rim\n",
      "t = math.sqrt(m/(math.pi*D*2*rho))*1000 \t\t\t#mm\n",
      "#Calculating the width of rim\n",
      "b = 2*t \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Power needed for the driving motor  =  %.3f kW.\"%(P)\n",
      "print \" Thickness of the flywheel rim t  =  %d mm.\"%(t)\n",
      "print \" Width of the flywheel rim b  =  %d mm.\"%(b)\n",
      "#Answers vary due to rounding-off errors"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Power needed for the driving motor  =  1.674 kW.\n",
        " Thickness of the flywheel rim t  =  43 mm.\n",
        " Width of the flywheel rim b  =  86 mm.\n"
       ]
      }
     ],
     "prompt_number": 32
    }
   ],
   "metadata": {}
  }
 ]
}