{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: Dynamics of Machines. Turning Moment. The Flywheel"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "ne=31\n",
      "na=25\n",
      "nb=90\n",
      "nc=83\n",
      "Ta=10 #lbft\n",
      "\n",
      "#Calculations\n",
      "#Ne-Nf/(Nc-Nf)=-83/31\n",
      "k=114./83#k=Nc/Nf As Ne = 0, on simplification we get Nc/Nf= 114/83\n",
      "j=-90./25#j=Na/Nb\n",
      "#Nc=Nb, Thus Na/Nc=-90/25\n",
      "#Na/Nf=(Na/Nc)*(Nc/Nf) ie Na/Nf=k*j\n",
      "#Tf*Nf=Ta*Na\n",
      "Tf=Ta*k*j\n",
      "\n",
      "#Result\n",
      "print \"Torque exerted on driven shaft = %.1f lb.ft\"%Tf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Torque exerted on driven shaft = -49.4 lb.ft\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, Page 415"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "D=9.#in\n",
      "stroke=24.#in\n",
      "d=2#in\n",
      "l=60.#in\n",
      "CP=l\n",
      "N=120\n",
      "theta=40#degrees\n",
      "x=theta*math.pi/180\n",
      "P1=160#lb/in^2\n",
      "P2=32#lb/in^2\n",
      "\n",
      "#Calculations\n",
      "OC=stroke/2\n",
      "F=math.pi*(D/2)**2*P1-math.pi*(D/2)**2*P2+math.pi*(d/2)**2*P2\n",
      "#Ft*Vc=F*Vp; Where Vc and Vp are velocities of crank and pin respectively\n",
      "#Vp/Vc=IP/IC=OM/OC - From similar triangles  ; fig 274\n",
      "n=CP/OC\n",
      "OM=OC*(math.sin(x) + (math.sin(2*x)/(2*n)))#from 3.11\n",
      "T=F*OM/12#torque exerted on crankshaft\n",
      "Torque=math.floor(T)\n",
      "\n",
      "#Result\n",
      "print \"The torque exerted on crankshaft= F*OM = %.f lb ft\"%Torque"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The torque exerted on crankshaft= F*OM = 6110 lb ft\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, Page 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "AB=12.5#in\n",
      "IB=10.15#in\n",
      "IA=10.75#in\n",
      "IX=2.92#in\n",
      "IY=5.5#in\n",
      "w=3#lb\n",
      "Fi=5#lb\n",
      "Fa1=9#lb\n",
      "\n",
      "#Calculations\n",
      "Fb1=(Fa1*IA-w*IY-Fi*IX)/IB\n",
      "#From the polygon of forces\n",
      "Fa2=7.66#lb\n",
      "Fb2=3.0#lb\n",
      "Fa=(Fa1**2+Fa2**2)**(1./2)\n",
      "Fb=(Fb1**2+Fb2**2)**(1./2)\n",
      "\n",
      "#Results\n",
      "print \"The total force applied to the link AB at the pin A = Fa = %.2f lb\\nThe total force applied to the link AB\" \\\n",
      "      \"at the pin B = Fb = %.2f lb\"%(Fa,Fb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total force applied to the link AB at the pin A = Fa = 11.82 lb\n",
        "The total force applied to the link ABat the pin B = Fb = 7.13 lb\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, Page 424"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "CP=60.#in\n",
      "l=CP/12\n",
      "a=41.\n",
      "cg=19.\n",
      "g=32.2#ft/s^2\n",
      "m1=580.#lb\n",
      "Mr=500.#lb\n",
      "n=5.#from example 12.3\n",
      "x=40*math.pi/180\n",
      "N=120.\n",
      "r=1.#ft\n",
      "k=25.\n",
      "\n",
      "#Calculations\n",
      "w=N*math.pi/30\n",
      "Rm=m1+(cg/CP)*Mr\n",
      "fp=w**2*r*(math.cos(x)+math.cos(2*x)/n)\n",
      "Fp=-Rm*fp/g\n",
      "OM=0.7413#ft -from example 12.3\n",
      "Tp=Fp*OM#from 12.6\n",
      "L=a+k**2/a#length for simple equivalent pendulum\n",
      "L1=L/12\n",
      "Tc=-Mr*(a/12)*(l-L1)*w**2*math.sin(2*x*math.pi/180)/(g*2*n**2)#from 12.10\n",
      "Tw=-Mr*a*math.cos(x*math.pi/180)/(n*12)\n",
      "T=Tp+Tc+Tw\n",
      "\n",
      "#Results\n",
      "print \"Tp= %.f lbft\\nTc = %.1f lbft\\nTw = %.1f lbft\\nTotal torque exerted on the crankshaft due to the inertia of \"\\\n",
      "      \"the moving parts = Tp+Tc+tw = %.1f lbft\"%(Tp,Tc,Tw,T)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tp= -2149 lbft\n",
        "Tc = -1.3 lbft\n",
        "Tw = -341.6 lbft\n",
        "Total torque exerted on the crankshaft due to the inertia of the moving parts = Tp+Tc+tw = -2492.3 lbft\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, Page 428"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "AB=2.5#in\n",
      "BC=7.#in\n",
      "CD=4.5#in\n",
      "AD=8.#in\n",
      "ED=2.3#from figure\n",
      "N=180\n",
      "w=N*math.pi/30\n",
      "m=3.#lb\n",
      "k=3.5#radius of gyration\n",
      "g=32.2#ft/s**2\n",
      "QT=1.35#inches from figure\n",
      "\n",
      "#Calculations\n",
      "alpha=w**2*(QT/CD)\n",
      "Torque=m*(k/12)**2*alpha/g\n",
      "Torque1=Torque*12\n",
      "Tadd=m*ED#additional torque\n",
      "Tc=Tadd+Torque1#total torque\n",
      "Fc1=Tc/CD\n",
      "#link BC\n",
      "M=5#lb\n",
      "gA=1.8#in\n",
      "fg=w**2*(gA/12)\n",
      "F=M*fg/g\n",
      "OaG=5.6#in\n",
      "Kg=2.9#in\n",
      "GZ=Kg**2/OaG\n",
      "#scaled from figure\n",
      "IB=9#in\n",
      "IC=5.8#in\n",
      "IX=2.49#in\n",
      "IY=1.93#in\n",
      "Fb1=(Fc1*IC+F*IX+M*IY)/IB\n",
      "Tor=Fb1*AB\n",
      "#from force polygon\n",
      "Fc2=1#lb\n",
      "Fb2=15.2#lb\n",
      "Fb=(Fb1**2+Fb2**2)**(1./2)\n",
      "Fc=(Fc1**2+Fc2**2)**(1./2)\n",
      "\n",
      "#Results\n",
      "print \"The torque which must be exerted on AB in order to overcome the inertia of the links = Fb1*AB = %.1f lb.in\"\\\n",
      "      \"\\nThe total force applied to the link BC \\nAt pin C = %.2f lb\\nAt pin B = %.1f lb\"%(Tor,Fc,Fb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The torque which must be exerted on AB in order to overcome the inertia of the links = Fb1*AB = 14.5 lb.in\n",
        "The total force applied to the link BC \n",
        "At pin C = 3.92 lb\n",
        "At pin B = 16.3 lb\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, Page 441"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N=210#rpm\n",
      "w=N*math.pi/30\n",
      "F=50\n",
      "\n",
      "#Calculations\n",
      "p1=F*120/(N*2)#N*p=F*120\n",
      "p2=math.floor(p1)#no of poles must be a whole number ; P2=P/2\n",
      "p=2*p2\n",
      "N1=F*120/p\n",
      "n=3#no of impulse per second\n",
      "Ks=n/(6*p)#equation 12.13\n",
      "\n",
      "#Results\n",
      "print \"Ks = %.4f\\n\\nActual speed = %.1f rpm\\nNumber of poles = %.f\"%(Ks,N1,p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ks = 0.0179\n",
        "\n",
        "Actual speed = 214.3 rpm\n",
        "Number of poles = 28\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, Page 443"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N=120#rpm\n",
      "k=3.5#ft\n",
      "Ef=2500#ft lb\n",
      "Ks=.01\n",
      "g=32.2#ft/s^2\n",
      "\n",
      "#Calculations\n",
      "w=math.pi*N/30#angular velocity\n",
      "W=g*Ef/(w**2*k**2*Ks*2240)#Weight of flying wheel\n",
      "\n",
      "#Result\n",
      "print \"Weight of flying wheel, W = %.2f tons\"%W"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Weight of flying wheel, W = 1.86 tons\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, Page 443"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N=270#rpm\n",
      "ihp=35.8\n",
      "k=2.25#ft\n",
      "g=32.2#ft/s^2\n",
      "ke=1.93#from table on p 440\n",
      "\n",
      "#Calculations\n",
      "E=ihp*33000/N\n",
      "Ef=ke*E\n",
      "w=math.pi*N/30\n",
      "W=1000#lb\n",
      "MOI=2*W*k**2#moment of inertia of both wheel\n",
      "ks=Ef*g/(MOI*w**2)#formula for ks\n",
      "p=ks/2\n",
      "\n",
      "#Results\n",
      "print \"The fluctuation speed is therefore %.1f%% or %.1f%% on either side of the mean speed\"%(ks*100,p*100)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fluctuation speed is therefore 3.4% or 1.7% on either side of the mean speed\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, Page 444"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "ihp=25.\n",
      "N=300.#rpm\n",
      "Ks=2./100#given\n",
      "u=2.3#work done by gases during expansion is u(2.3) times that during compression\n",
      "\n",
      "#Calculations\n",
      "E=ihp*33000/N#indicated work done per revolution\n",
      "E1=E*2#indicated work done per cycle\n",
      "We=E1/(1-1./u)#work done by gases during expansion\n",
      "AB=We*2./math.pi#the maximum torque from fig 290\n",
      "AC=E/(2*math.pi)#mean turning moment\n",
      "CB=AB-AC#maximum excess turning moment\n",
      "Ef=(CB/AB)**2*We#fluctuation of energy\n",
      "Ke=Ef/E\n",
      "w=math.pi*N/30#angular speed\n",
      "g=32.2#ft/s^2\n",
      "moi=g*Ef/(w**2*Ks)#moment of inertia\n",
      "\n",
      "#Result\n",
      "print \"Moment of inertia of the flywheel = %.f lb ft^2\"%moi\n",
      "\n",
      "#answer is not EXACT due to the approximations in calculations done by the author of the book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moment of inertia of the flywheel = 13710 lb ft^2\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, Page 445"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N=100#rpm\n",
      "ke=1.93#As per given figure\n",
      "l=15#1 inch of fig = 15 ton ft \n",
      "x=40#degrees; 1 inch = 40 degree\n",
      "I=150#ton ft^2\n",
      "g = 32.2\n",
      "\n",
      "\n",
      "#Calculations\n",
      "w=math.pi*N/30#angular speed\n",
      "E=l*x*math.pi/180#energy\n",
      "Ef=E*ke#fluctuation energy\n",
      "Ks=Ef*g/(w**2*I)#from equation 12.14\n",
      "p=Ks*100/2#dummy variables\n",
      "q=p*2#dummy variables\n",
      "\n",
      "#Results\n",
      "print \"The total fluctuation of speed is %.2f percent and the variation in speed is %.2f percent on either side of \"\\\n",
      "      \"\\n the mean speed\"%(q,p)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total fluctuation of speed is 3.96 percent and the variation in speed is 1.98 percent on either side of \n",
        " the mean speed\n"
       ]
      }
     ],
     "prompt_number": 18
    }
   ],
   "metadata": {}
  }
 ]
}