{
 "metadata": {
  "name": "",
  "signature": "sha256:13844e2491f60bc4c521c5dd5ea680eaf26c07059f7a5c77baf4e368f712f152"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15 : Inertia Forces in Reciprocating Parts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.1 Page No : 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "OC = 200./1000          #m\n",
      "PC = 700./1000 \t\t\t#m\n",
      "omega = 120. \t\t\t#rad/s\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.5\n",
      "OM = 127./1000\n",
      "CM = 173./1000\n",
      "QN = 93./1000\n",
      "NO = 200./1000 \t\t\t#m\n",
      "\n",
      "#Velocity and acceleration of the piston:\n",
      "#Calculating the velocity of the piston P\n",
      "vP = omega*OM \t\t\t#m/s\n",
      "#Calculating the acceleration of the piston P\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#Velocity and acceleration of the mid-point of the connecting rod:\n",
      "#By measurement\n",
      "OD1 = 140./1000\n",
      "OD2 = 193./1000 \t\t\t#m\n",
      "#Calculating the velocity of D\n",
      "vD = omega*OD1 \t\t\t#m/s\n",
      "#Calculating the acceleration of D\n",
      "aD = omega**2*OD2 \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the velocity of the connecting rod PC\n",
      "vPC = omega*CM \t\t\t#m/s\n",
      "#Calculating the angular velocity of the connecting rod PC\n",
      "omegaPC = vPC/PC \t\t\t#rad/s\n",
      "#Calculating the math.tangential component of the acceleration of P with respect to C\n",
      "atPC = omega**2*QN \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod PC\n",
      "alphaPC = atPC/PC \t\t\t#ra/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the piston P, vP  =  %.2f m/s.\"%(vP)\n",
      "print \" Acceleration of the piston P, aP  =  %d m/s**2.\"%( aP)\n",
      "print \" Velocity of D, vD  =  %.1f m/s.\"%(vD)\n",
      "print \" Acceleration of D, aD  =  %.1f m/s**2.\"%(aD)\n",
      "print \" Angular velocity of the connecting rod PC, omegaPC  =  %.2f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod PC alphaPC  =  %.2f rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the piston P, vP  =  15.24 m/s.\n",
        " Acceleration of the piston P, aP  =  2880 m/s**2.\n",
        " Velocity of D, vD  =  16.8 m/s.\n",
        " Acceleration of D, aD  =  2779.2 m/s**2.\n",
        " Angular velocity of the connecting rod PC, omegaPC  =  29.66 rad/s.\n",
        " Angular acceleration of the connecting rod PC alphaPC  =  1913.14 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.2 Page No : 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "OC = 150./1000     #m\n",
      "PC = 600./1000     #m\n",
      "CD = 150./1000 \t\t#m\n",
      "N = 450. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.6\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#By measurement\n",
      "OM = 145./1000\n",
      "CM = 78./1000\n",
      "QN = 130./1000\n",
      "NO = 56./1000 \t\t\t#m\n",
      "\n",
      "#Velocity and acceleration of alider:\n",
      "#Calculating the velocity of the slider P\n",
      "vP = omega*OM \t\t\t#m/s\n",
      "#Calculating the acceleration of the slider P\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#Velocity and acceleration of point D on the connecting rod:\n",
      "#Calculating the length od CD1\n",
      "CD1 = CD/PC*CM \t\t\t#m\n",
      "#By measurement\n",
      "OD1 = 145./1000\n",
      "OD2 = 120./1000 \t\t\t#m\n",
      "\n",
      "#Calculating the velocity of point D\n",
      "vD = omega*OD1 \t\t\t#m/s\n",
      "#Calculating the acceleration of point D\n",
      "aD = omega**2*OD2 \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the velocity of the connecting rod PC\n",
      "vPC = omega*CM \t\t\t#m/s\n",
      "#Calculating the angular velocity of the connecting rod\n",
      "omegaPC = vPC/PC \t\t\t#rad/s\n",
      "#Calculating the tangential component of the acceleration of P with respect to C\n",
      "atPC = omega**2*QN \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod PC\n",
      "alphaPC = atPC/PC \t\t\t#rad/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the slider P vP  =  %.3f m/s.\"%(vP)\n",
      "print \" Acceleration of the slider P aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" Velocity of point D vD  =  %.3f m/s.\"%(vD)\n",
      "print \" Acceleration of point D aD  =  %.2f m/s**2.\"%(aD)\n",
      "print \" Angular velocity of the connecting rod omegaPC  =  %.3f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod PC alphaPC  =  %.2f rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the slider P vP  =  6.833 m/s.\n",
        " Acceleration of the slider P aP  =  124.4 m/s**2.\n",
        " Velocity of point D vD  =  6.833 m/s.\n",
        " Acceleration of point D aD  =  266.48 m/s**2.\n",
        " Angular velocity of the connecting rod omegaPC  =  6.126 rad/s.\n",
        " Angular acceleration of the connecting rod PC alphaPC  =  481.14 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.3 Page No : 527"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 300./1000\n",
      "l = 1. \t\t\t#m\n",
      "N = 200. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Crank angle at which the maximum velocity occurs:\n",
      "#Calculating the ratio of length of connecting rod to crank radius\n",
      "n = l/r\n",
      "#Velocity of the piston vP  =  omega*r*(math.sin(math.radians(theta)+math.sin(math.radians(2*theta)/(2*n))    .....(i)\n",
      "#For maximum velocity d(vP)/d(theta)  =  0                                  .....(ii)\n",
      "#Substituting (i) in (ii) we get 2(math.cos(theta))**2+n*math.cos(theta)-1  =  0\n",
      "a = 2.\n",
      "b = n\n",
      "c = -1.\n",
      "costheta = (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "#Calculating the crank angle from the inner dead centre at which the maximum velocity occurs\n",
      "theta = round(math.degrees(math.acos(costheta))) \t\t\t#degrees\n",
      "#Calculating the maximum velocity of the piston:\n",
      "vPmax = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Results:\n",
      "print \" Crank angle from the inner dead centre at which the maximum velocity occurs theta  =  %.2f degrees.\"%(theta)\n",
      "print \" Maximum velocity of the piston( vPmax)  =  %.2f m/s.\"%(vPmax)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Crank angle from the inner dead centre at which the maximum velocity occurs theta  =  75.00 degrees.\n",
        " Maximum velocity of the piston( vPmax)  =  6.54 m/s.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.4 Page No : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 0.3             #m\n",
      "l = 1.5 \t\t\t#m\n",
      "N = 180. \t\t\t#rpm\n",
      "theta = 40. \t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the piston\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Velocity of the piston:\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the velocity of the piston\n",
      "vP = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Position of the crank for zero acceleration of the piston:\n",
      "ap1 = 0\n",
      "#Calculating the position of the crank from the inner dead centre for zero acceleration of the piston\n",
      "#We have ap1  =  omega**2*r*(math.cos(theta1)+math.cos(2*theta1)/n) or 2*(math.cos(theta1))**2+n*math.cos(theta1)-1  =  0\n",
      "a = 2.\n",
      "b = n\n",
      "c = -1.\n",
      "costheta1 = (-b+math.sqrt(b**2-4*a*c))/(2*a)\n",
      "#Calculating the crank angle from the inner dead centre for zero acceleration of the piston\n",
      "theta1 = math.degrees(math.acos(costheta1)) \t\t\t#degrees\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the piston vP  =  %.2f m/s.\"%( vP)\n",
      "print \" Acceleration of the piston aP  =  %.2f m/s**2.\"%(aP)\n",
      "print \" Position of the crank for zero acceleration of the piston theta1  =  %.2f degrees or\\\n",
      " %.2f degrees.\"%(theta1,360-theta1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the piston vP  =  4.19 m/s.\n",
        " Acceleration of the piston aP  =  85.36 m/s**2.\n",
        " Position of the crank for zero acceleration of the piston theta1  =  79.27 degrees or 280.73 degrees.\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.5 Page No : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 150./1000\n",
      "l = 600./1000 \t\t\t#m\n",
      "theta = 60. \t\t\t#degrees\n",
      "N = 450. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Velocity and acceleration of the slider:\n",
      "#Calculating the ratio of length of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the velocity of the slider\n",
      "vP = omega*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/(2*n)) \t\t\t#m/s\n",
      "#Calculating the acceleration of the slider\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Angular velocity and angular acceleration of the connecting rod:\n",
      "#Calculating the angular velocity of the connecting rod\n",
      "omegaPC = omega*math.cos(math.radians(theta))/n \t\t\t#rad/s\n",
      "#Calculating the angular acceleration of the connecting rod\n",
      "alphaPC = round(omega**2*math.sin(math.radians(theta))/n) \t\t\t#rad/s**2\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of the slider vP  =  %.1f m/s.\"%(vP)\n",
      "print \" Acceleration of the slider aP  =  %.2f m/s**2.\"%(aP)\n",
      "print \" Angular velocity of the connecting rod omegaPC  =  %.1f rad/s.\"%(omegaPC)\n",
      "print \" Angular acceleration of the connecting rod alphaPC  =  %d rad/s**2.\"%(alphaPC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of the slider vP  =  6.9 m/s.\n",
        " Acceleration of the slider aP  =  124.91 m/s**2.\n",
        " Angular velocity of the connecting rod omegaPC  =  5.9 rad/s.\n",
        " Angular acceleration of the connecting rod alphaPC  =  481 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.6 Page No : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 175./1000     #m\n",
      "L = 200./1000     #m\n",
      "r = L/2           #m\n",
      "l = 400./1000 \t  #m\n",
      "N = 500. \t\t  #rpm\n",
      "mR = 180. \t\t  #kg\n",
      "theta = 60        #degrees\n",
      "#Solution:\n",
      "omega = round(2*math.pi*N/60,1) \t\t\t#rad/s\n",
      "\n",
      "# Graphical method\n",
      "ON = 0.038       # m\n",
      "aR = omega**2 * ON\n",
      "FI = mR * aR/1000\n",
      "print \" Inertia force FI  =  %.2f kN.\"%(FI)\n",
      "\n",
      "#Calculating the angular speed of the crank\n",
      "\n",
      "#Analytical method:\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)/1000 \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Inertia force FI  =  %.2f kN.\"%(FI)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Inertia force FI  =  18.78 kN.\n",
        " Inertia force FI  =  18.53 kN.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.7 Page No : 533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "\n",
      "# Variables:\n",
      "r = 300./1000       #m\n",
      "l = 1.2             #m\n",
      "D = 0.5 \t\t\t#m\n",
      "mR = 250. \t\t\t#kg\n",
      "theta = 60. \t\t#degrees\n",
      "dp = 0.35 \t\t\t#p1-p2 N/mm**2\n",
      "N = 250. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the net load on the piston\n",
      "FL = (dp)*math.pi/4*(D*1000)**2 \t\t\t#N\n",
      "#Calculating the ratio of length of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the accelerating or inertia force on reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = (FL-FI)/1000 \t\t\t#kN\n",
      "#Pressure on slide bars:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the pressure on the slide bars\n",
      "FN = FP*math.tan(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the thrust in the connecting rod\n",
      "FQ = FP/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the tangential force on the crank pin\n",
      "FT = FQ*math.sin(math.radians(theta+phi)) \t\t\t#kN\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = FT*r \t\t\t#kN-m\n",
      "\n",
      "#Results:\n",
      "print \" Pressure on the slide bars FN  =  %.2f kN.\"%(FN)\n",
      "print \" Thrust in the connecting rod FQ  =  %.2f kN.\"%(FQ)\n",
      "print \" Tangential force on the crank-pin FT  =  %.2f kN.\"%(FT)\n",
      "print \" Turning moment on the crank shaft T  =  %.3f kN-m.\"%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure on the slide bars FN  =  10.97 kN.\n",
        " Thrust in the connecting rod FQ  =  50.65 kN.\n",
        " Tangential force on the crank-pin FT  =  48.30 kN.\n",
        " Turning moment on the crank shaft T  =  14.491 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.8 Page No : 534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 300./1000      #m\n",
      "L = 450./1000      #m\n",
      "r = L/2            #m\n",
      "d = 50./1000       #m\n",
      "l = 1.2 \t\t\t#m\n",
      "N = 200. \t\t\t#rpm\n",
      "mR = 225. \t\t\t#kg\n",
      "theta = 125. \t\t\t#degrees\n",
      "p1 = 30*1000.       #N/m**2\n",
      "p2 = 1.5*1000. \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the area of the piston\n",
      "A1 = math.pi/4*D**2 \t\t\t#m**2\n",
      "#Calculating the area of the piston rod\n",
      "a = math.pi/4*d**2 \t\t\t#m**2\n",
      "#Calculating the force on the piston due to steam pressure\n",
      "FL = round(p1*A1-p2*(A1-a)) \t\t\t#N\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = FL-FI+mR*9.81 \t\t\t#N\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the effective turning moment on the crank shaft\n",
      "T = FP*math.sin(math.radians(theta+phi))/math.cos(math.radians(phi))*r \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Effective turning moment of the crank shaft T  =  %.f N-m.\"%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Effective turning moment of the crank shaft T  =  3020 N-m.\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.9 Page No : 534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 1800. \t\t\t#rpm\n",
      "r = 50./1000        #m\n",
      "l = 200./1000       #m\n",
      "D = 80./1000        #m\n",
      "x = 10./1000 \t\t#m\n",
      "mR = 1. \t\t\t#kg\n",
      "p = 0.7 \t\t\t#N/mm**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Net load on the gudgeon pin:\n",
      "#Calculating the load on the piston\n",
      "FL = round(math.pi/4*(D*1000)**2*p) \t\t\t#N\n",
      "#Refer Fig. 15.10\n",
      "#By measurement\n",
      "theta = 33. \t\t\t#degrees\n",
      "#Calculating the ratio of lengths of connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net load on the gudgeon pin\n",
      "FP = FL-FI \t\t\t#N\n",
      "#Thrust in the connecting rod:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the thrust in the connecting rod\n",
      "FQ = FP/math.cos(math.radians(phi)) \t\t\t#N\n",
      "#Calculating the reaction between the piston and cylinder\n",
      "FN = FP*math.tan(math.radians(phi)) \t\t\t#N\n",
      "#Engine speed at which the abov values will become zero:\n",
      "#Calculating the speed at which FI = FL\n",
      "omega1 = math.sqrt((math.pi/4*(D*1000)**2*p)/(mR*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n))) \t\t\t#rad/s\n",
      "#Calculating the corresponding speed in rpm\n",
      "N1 = omega1*60/(2*math.pi) \t\t\t#rpm\n",
      "\n",
      "print phi\n",
      "#Results:\n",
      "print \" Net load on the gudgeon pin FP  =  %.f N.\"%(FP)\n",
      "print \" Thrust in the connecting rod FQ  =  %.1f N.\"%(FQ)\n",
      "print \" Reaction between the piston and cylinder FN  =  %d N.\"%(FN)\n",
      "print \" Engine speed at which the above values will become zero N1  =  %d rpm.\"%(N1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "7.82568845753\n",
        " Net load on the gudgeon pin FP  =  1848 N.\n",
        " Thrust in the connecting rod FQ  =  1865.8 N.\n",
        " Reaction between the piston and cylinder FN  =  254 N.\n",
        " Engine speed at which the above values will become zero N1  =  2612 rpm.\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.10 Page No : 536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "aP = 36. \t\t\t#m/s**2\n",
      "theta = 30. \t\t#degrees\n",
      "p = 0.5 \t\t\t#N/mm**2\n",
      "RF = 600. \t\t\t#N\n",
      "D = 300./1000       #m\n",
      "r = 300./1000 \t\t#m\n",
      "mR = 180. \t\t\t#kg\n",
      "n = 4.5\n",
      "\n",
      "#Solution:\n",
      "#Reaction on the guide bars:\n",
      "#Calculating the load on the piston\n",
      "FL = round(p*math.pi/4*(D*1000)**2) \t\t\t#N\n",
      "#Calculating the inertia force due to reciprocating parts\n",
      "FI = mR*aP \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = (FL-FI-RF)/1000 \t\t\t#kN\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the reaction on the guide bars\n",
      "FN = FP*math.tan(phi) \t\t\t#kN\n",
      "#Calculating the thrust on the crank shaft bearing\n",
      "FB = (FP*math.cos(math.radians(phi+theta)))/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r \t\t\t#kN-m\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Reaction on the guide bars FN  =  %.f kN.\"%(FN)\n",
      "print \" Thrust on the crank shaft bearing FB  =  %.1f kN.\"%(FB)\n",
      "print \" Turning moment on the crank shaft T  =  %.2f kN-m.\"%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Reaction on the guide bars FN  =  3 kN.\n",
        " Thrust on the crank shaft bearing FB  =  22.9 kN.\n",
        " Turning moment on the crank shaft T  =  5.06 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.11 Page No : 537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 100./1000          #m\n",
      "L = 120./1000          #m\n",
      "r = L/2                #m\n",
      "l = 250./1000 \t\t\t#m\n",
      "mR = 1.1     \t\t\t#kg\n",
      "N = 2000. \t    \t\t#rpm\n",
      "theta = 20. \t\t\t#degrees\n",
      "p = 700. \t\t    \t#kN/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Net force on the piston:\n",
      "#Calculating the force due to gas pressure\n",
      "FL = p*math.pi/4*D**2 \t\t\t#kN\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the piston\n",
      "FI = round(mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)) \t\t\t#N\n",
      "#Calculating the net force on the piston\n",
      "FP = (FL*1000)-FI+mR*9.81 \t\t\t#N\n",
      "#Resulmath.tant force on the gudgeon pin:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(theta)/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the resultant load on the gudgeon pin\n",
      "FQ = round(FP/math.cos(phi)) \t\t\t#N\n",
      "#Calculating the thrust on the cylinder walls\n",
      "FN = FP*math.tan(math.radians(4.7)) \t\t\t#N \n",
      "#Speed above which the gudgeon pin load would be reversed in direction:\n",
      "#Calculating the minimum speed for FP to be negative\n",
      "omega1 = math.sqrt((FL*1000+mR*9.81)/(mR*r*(math.cos(theta)+math.cos(2*theta)/n))) \t\t\t#rad/s\n",
      "#Calculating the corresponding speed in rpm\n",
      "N1 = 273*60/(2*math.pi) \t\t\t#rpm\n",
      "\n",
      "#Results:\n",
      "print \" Net force on the piston FP  =  %.1f N.\"%(FP)\n",
      "print \" Resultant load on the gudgeon pin FQ  =  %d N.\"%(FQ)\n",
      "print \" Thrust on the cylinder walls FN  =  %.1f N.\"%(FN)\n",
      "print \" Speed above which the gudgeon pin load would be reversed in direction N1 > %d rpm.\"%(N1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Net force on the piston FP  =  2255.6 N.\n",
        " Resultant load on the gudgeon pin FQ  =  2265 N.\n",
        " Thrust on the cylinder walls FN  =  185.4 N.\n",
        " Speed above which the gudgeon pin load would be reversed in direction N1 > 2606 rpm.\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.12 Page No : 538"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 120. \t\t\t#rpm\n",
      "D = 250./1000       #m\n",
      "L = 400./1000       #m\n",
      "r = L/2             #m\n",
      "l = 0.6             #m\n",
      "d = 50./1000 \t\t#m\n",
      "mR = 60. \t\t\t#kg\n",
      "theta = 45. \t\t#degrees\n",
      "p1 = 550.*1000      #N/m**2\n",
      "p2 = 70.*1000 \t\t\t#N/m**2\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Turning moment on the crankshaft:\n",
      "#Calculating the area of the piston on the cover end side\n",
      "A1 = math.pi/4*D**2 \t\t\t#m**2\n",
      "#Calculating the area of the piston rod\n",
      "a = math.pi/4*d**2 \t\t\t#m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = p1*A1-p2*(A1-a) \t\t\t#N\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = (FL-FI)/1000 \t\t\t#kN\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the turning moment on the crank shaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r*1000\t\t\t#N-m\n",
      "#Calculating the thrust on the bearings\n",
      "FB = (FP*math.cos(math.radians(theta+phi)))/math.cos(math.radians(phi)) \t\t\t#kN\n",
      "#Acceleration of the flywheel:\n",
      "P = 20.*1000 \t\t\t#W\n",
      "m = 60. \t\t\t#kg\n",
      "k = 0.6 \t\t\t#m\n",
      "#Calculating the mass moment of inertia of the flywheel\n",
      "I = m*k**2 \t\t\t#kg-m**2\n",
      "#Calculating the resisting torque\n",
      "TR = P*60/(2*math.pi*N) \t\t\t#N-m\n",
      "#Calculating the acceleration of the flywheel\n",
      "alpha = (T-TR)/I \t\t\t#rad/s**2\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Turning moment on the crank shaft T  =  %f N-m.\"%(T)   # rounding off error \n",
      "print \" Thrust on the bearings FB  =  %.2f kN.\"%(FB)\n",
      "print \" Acceleration of the flywheel alpha  =  %.1f rad/s**2.\"%(alpha)\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Turning moment on the crank shaft T  =  3929.026139 N-m.\n",
        " Thrust on the bearings FB  =  11.98 kN.\n",
        " Acceleration of the flywheel alpha  =  108.2 rad/s**2.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.13 Page No : 540"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 300./1000       #m\n",
      "L = 500./1000       #m\n",
      "r = L/2 \t\t\t#m\n",
      "n = 4.5\n",
      "N = 180. \t\t\t#rpm\n",
      "mR = 280. \t\t\t#kg\n",
      "theta = 45. \t\t#degrees\n",
      "p1 = 0.1 \t\t\t#N/mm**2\n",
      "CR = 14. \t\t\t#Compression ration V1/V2\n",
      "p4 = 2.2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.12\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the pressure corresponding to point 2\n",
      "p2 = p1*(CR)**1.35 \t\t\t#N/mm**2\n",
      "#Calculating the swept volume\n",
      "VS = math.pi/4*D**2*L \t\t\t#m**3\n",
      "VC = VS/(CR-1) \t\t\t#m**3\n",
      "#Calculating the volume corresponding to point 3\n",
      "V3 = VC+(1/10*VS) \t\t\t#m**3\n",
      "#Calculating the print lacement of the piston corresponding to crank print lacement of 45 degrees\n",
      "x = r*((1-math.cos(math.radians(theta)))+(math.sin(math.radians(theta)))**2/(2*n)) \t\t\t#m\n",
      "#Calculating the volume corresponding to point 4'\n",
      "V4dash = VC+(math.pi/4*D**2*x) \t\t\t#m**2\n",
      "#Calculating the pressure corresponding to point 4'\n",
      "p3 = p2\n",
      "p4dash = p3*(V3/V4dash)**1.35 \t\t\t#N/mm**2\n",
      "\n",
      "#Calculating the difference of pressures on two sides of the piston\n",
      "p = (p4-p1)*10**6 \t\t\t#N/m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = p*math.pi/4*D**2 \t\t\t#N\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = mR*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#N\n",
      "#Calculating the net force on the piston or piston effort\n",
      "FP = FL-FI+mR*9.81 \t\t\t#N\n",
      "#Crank-pin effort:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = math.degrees(math.asin(sinphi))\n",
      "#Calculating the crank-pin effort\n",
      "FT = (FP*math.sin(math.radians(theta+phi)))/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "#Calculating the thrust on the bearings\n",
      "FB = (FP*math.cos(math.radians(theta+phi)))/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "#Calculating the turning moment on the crankshaft\n",
      "T = FT*r \t\t\t#kN-m\n",
      "\n",
      "#Results:\n",
      "print \" Crank-pin effort FT  =  %.3f kN.\"%(FT)\n",
      "print \" Thrust on the bearings FB  =  %.3f kN.\"%(FB)\n",
      "print \" Turning moment on the crankshaft T  =  %.2f kN-m.\"%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Crank-pin effort FT  =  109.501 kN.\n",
        " Thrust on the bearings FB  =  79.438 kN.\n",
        " Turning moment on the crankshaft T  =  27.38 kN-m.\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.14 Page No : 542"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 240./1000       #m\n",
      "L = 360./1000       #m\n",
      "r = L/2             #m\n",
      "l = 0.6 \t\t\t#m\n",
      "N = 300. \t\t\t#rpm\n",
      "mR = 160. \t\t\t#kg\n",
      "pA = (8+1.03)*10**5\n",
      "pE = (-0.75+1.03)*10**5 \t\t\t#N/m**2\n",
      "FR = 500. \t    \t\t#N\n",
      "theta = 75. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.13\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the stroke volume\n",
      "VS = math.pi/4*D**2*L \t\t\t#m**3\n",
      "#Calculating the volume of steam at cut-off\n",
      "VB = VS/3 \t\t\t#m**3\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the print lacement of the piston when the crank position is 75 degrees from the top dead centre\n",
      "x = r*((1-math.cos(math.radians(theta)))+(math.sin(math.radians(theta)))**2/(2*n)) \t\t\t#m**3\n",
      "#Calculating the volume corresponding to point C'\n",
      "VCdash = VS*x/L \t\t\t#m**3\n",
      "#Calculating the pressure corresponding to point C'\n",
      "pB = pA\n",
      "pCdash = round((pB*VB)/VCdash) \t\t\t#N/m**2\n",
      "#Calculating the difference of pressures on the two sides of the piston\n",
      "p = round(pCdash-pE) \t\t\t#N/m**2\n",
      "#Calculating the net load on the piston\n",
      "FL = round(math.pi/4*D**2*p) \t\t\t#N\n",
      "#Calculating the inertia force on the reciprocating parts\n",
      "FI = round(mR*omega**2*r*(math.cos(math.radians(theta))+(math.cos(math.radians(2*theta))/n))) \t\t\t#N\n",
      "#Calculating the piston effort\n",
      "FP = FL-FI+mR*9.81-FR \t\t\t#N\n",
      "#Turning moment on the crankshaft:\n",
      "#Calculating the angle of inclination of the connecting rod to the line of stroke\n",
      "sinphi = math.sin(math.radians(theta))/n \t\t\t#degrees\n",
      "phi = round(math.degrees(math.asin(sinphi)),3)\n",
      "\n",
      "#Calculating the turning moment on the crankshaft\n",
      "T = (FP*math.sin(math.radians(theta+phi)))/math.cos(math.radians(phi))*r \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Turning moment on the crankshaft T  =  %d N-m.\"%(T)\n",
      "\n",
      "# note : rounding error. please check using calculator"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Turning moment on the crankshaft T  =  5778 N-m.\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.15 Page No : 545"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "l = 300.            #mm\n",
      "l1 = 200. \t\t\t#mm\n",
      "m = 15. \t\t\t#kg\n",
      "I = 7000. \t\t\t#kg-mm**2\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.16 and Fig. 15.17\n",
      "#Calculating the radius of gyration of the connecting rod about an axis pasmath.sing through its centre of gravity\n",
      "kG = math.sqrt(I/m) \t\t\t#mm\n",
      "#Calculating the distance of other mass from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#mm\n",
      "#Calculating the magnitude of mass placed at the small end centre\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the mass placed at a dismath.tance l2 from the centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the small end centre m1  =  %.2f kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.2f mm from the centre of gravity m2  =  %.2f kg.\"%(l2,m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the small end centre m1  =  0.17 kg.\n",
        " Mass placed at a distance 2.33 mm from the centre of gravity m2  =  14.83 kg.\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.16 Page No : 546"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:  \n",
      "h = 650./1000          #m\n",
      "l1 = (650.-25)/1000    #m\n",
      "m = 37.5 \t\t\t#kg\n",
      "tp = 1.87 \t\t\t#seconds\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.18 and Fig. 15.19\n",
      "#Calculating the radius of gyration of the connecting rod about an axis pasmath.sing through its centre of gravity\n",
      "kG = math.sqrt((tp/(2*math.pi))**2*(9.81*h)-h**2) \t\t\t#m\n",
      "#Calculating the dismath.tance of mass m2 from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of mass placed at the small end centre\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of mass placed at a dismath.tance l2 from centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the small end centre A m1  =  %d kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.3f m from G m2  =  %.1f kg.\"%(l2,m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the small end centre A m1  =  10 kg.\n",
        " Mass placed at a distance 0.228 m from G m2  =  27.5 kg.\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.17 Page No : 547"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "m = 55. \t\t\t#kg\n",
      "l = 850./1000       #m\n",
      "d1 = 75./1000       #m\n",
      "d2 = 100./1000 \t\t#m\n",
      "tp1 = 1.83          #sec\n",
      "tp2 = 1.68 \t\t\t#seconds\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.20\n",
      "#Calculating the length of equivalent simple pendulum when suspended from the top of small end bearing\n",
      "L1 = 9.81*(tp1/(2*math.pi))**2 \t\t\t#m\n",
      "#Calculating the length of equivalent simple pendulum when suspended from the top of big end bearing\n",
      "L2 = 9.81*(tp2/(2*math.pi))**2 \t\t\t#m\n",
      "#Radius of gyration of the rod about an axis pasmath.sing through the centre of gravity and perpendicular to the plane of oscillation:\n",
      "#Calculating the distances of centre of gravity from the top of small end and big end bearings\n",
      "#We have h1*(L1-h1)  =  h2*(L2-h2) or h1**2-h2**2+h2*L2-h1*L1  =  0                                                                    .....(i)\n",
      "#Also h1+h2  =  d1/2+l+d2/2 or h1+h2-d1/2-l-d2/2  =  0                                                                               .....(ii)\n",
      "def f(x):\n",
      "    y = [0,0]\n",
      "    h1 = x[0]\n",
      "    h2 = x[1]\n",
      "    y[0] = h1**2-h2**2+h2*L2-h1*L1\n",
      "    y[1] = h1+h2-d1/2-l-d2/2\n",
      "    return y\n",
      "\n",
      "z = fsolve(f,[1,1])\n",
      "h1 = z[0]\n",
      "h2 = z[1] \t\t\t#m\n",
      "\n",
      "#Calculating the required radius of gyration of the rod\n",
      "kG = math.sqrt(h1*(L1-h1)) \t\t\t#m\n",
      "#Calculating the moment of inertia of the rod\n",
      "I = m*(kG)**2 \t\t\t#kg-m**2\n",
      "#Dynamically equivalent system for the rod:\n",
      "#Calculating the distance of the mass situated at the centre of small end bearing from the centre of gravity\n",
      "l1 = h1-d1/2 \t\t\t#m\n",
      "#Calculating the distance of the second mass from the centre of gravity towards big end bearing\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of the mass situated at the centre of small end bearing\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the second mass\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "\n",
      "#Results:\n",
      "print \" Radius of gyration of the rod about an axis passing through the centre of\\\n",
      " gravity and perpendicular to the plane of oscillation, kG  =  %.3f m.\"%(kG)\n",
      "print \" Moment of inertia of the rod, I  =  %.2f kg-m**2.\"%(I)\n",
      "print \" Magnitude of the mass situated at the centre of small end bearing, m1  =  %.2f kg.\"%(m1)\n",
      "print \" Magnitude of the second mass, m2  =  %.2f kg.\"%(m2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Radius of gyration of the rod about an axis passing through the centre of gravity and perpendicular to the plane of oscillation, kG  =  0.345 m.\n",
        " Moment of inertia of the rod, I  =  6.56 kg-m**2.\n",
        " Magnitude of the mass situated at the centre of small end bearing, m1  =  13.32 kg.\n",
        " Magnitude of the second mass, m2  =  41.68 kg.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.18 Page No : 550"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "m = 2. \t\t\t#kg\n",
      "l = 250./1000   #m\n",
      "l1 = 100./1000  #m\n",
      "kG = 110./1000 \t\t\t#m\n",
      "alpha = 23000. \t\t\t#rad/s**2\n",
      "\n",
      "#Solution:\n",
      "#Equivalent dynamical system:\n",
      "#Calculating the distance of the second mass from the centre of gravity\n",
      "l2 = (kG)**2/l1 \t\t\t#m\n",
      "#Calculating the magnitude of the mass placed at the gudgeon pin\n",
      "m1 = (l2*m)/(l1+l2) \t\t\t#kg\n",
      "#Calculating the magnitude of the mass placed at a distance l2 from centre of gravity\n",
      "m2 = (l1*m)/(l1+l2) \t\t\t#kg\n",
      "#Correction couple:\n",
      "#Calculating the magnitude of l3\n",
      "l3 = l-l1 \t\t\t#m\n",
      "#Calculating the new radius of gyration\n",
      "k1 = math.sqrt(l1*l3) \t\t\t#m**2\n",
      "#Calculating the correction couple\n",
      "Tdash = m*(k1**2-kG**2)*alpha \t\t\t#N-m\n",
      "\n",
      "#Results:\n",
      "print \" Mass placed at the gudgeon pin, m1  =  %.1f kg.\"%(m1)\n",
      "print \" Mass placed at a distance %.3f m from the centre of gravity m2  =  %.1f kg.\"%(l2,m2)\n",
      "print \" Correction couple Tdash  =  %.1f N-m.\"%(Tdash)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass placed at the gudgeon pin, m1  =  1.1 kg.\n",
        " Mass placed at a distance 0.121 m from the centre of gravity m2  =  0.9 kg.\n",
        " Correction couple Tdash  =  133.4 N-m.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.19 Page No : 554"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "r = 125.           #mm\n",
      "OC = r             #mm\n",
      "l = 500.           #mm\n",
      "PC = l             #mm\n",
      "PG = 275.          #mm\n",
      "kG = 150. \t\t\t#mm\n",
      "mC = 60. \t\t\t#kg\n",
      "N = 600. \t\t\t#rpm\n",
      "theta = 45. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.24\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Acceleration of the piston:\n",
      "#By measurement\n",
      "NO = 90./1000 \t\t\t#m\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*NO \t\t\t#m/s**2\n",
      "#The magnitude position and direction of inertia force due to the mass of the connecting rod:\n",
      "#By measurement\n",
      "gO = 103./1000 \t\t\t#m\n",
      "#Calculating the magnitude of the inertia force of the connecting rod\n",
      "FC = mC*omega**2*gO/1000 \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Acceleration of the piston aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" The magnitude of inertia force due to the mass of the connecting rod FC  =  %.1f kN.\"%(FC)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Acceleration of the piston aP  =  355.3 m/s**2.\n",
        " The magnitude of inertia force due to the mass of the connecting rod FC  =  24.4 kN.\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.20 Page No : 555"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "D = 240./1000      #m\n",
      "L = 600./1000      #m\n",
      "r = L/2            #m\n",
      "l = 1.5            #m\n",
      "GC = 500./1000     #m\n",
      "kG = 650./1000 \t   #m\n",
      "mR = 300.\n",
      "mC = 250. \t\t\t#kg\n",
      "N = 125. \t\t\t#rpm\n",
      "theta = 30. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.25\n",
      "#Calculating the angular speed of the crank\n",
      "omega = round(2*math.pi*N/60,1) \t\t\t#rad/s\n",
      "#Analytical method:\n",
      "#Calculating the distance of centre of gravity of the connecting rod from P\n",
      "l1 = l-GC \t\t\t#m\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the inertia force due to total mass of the reciprocating parts at P\n",
      "FI = int((mR+(l-l1)/l*mC)*omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n)) \t\t\t#N\n",
      "#Calculating the corresponding torque due to FI\n",
      "TI = int(FI*r*(math.sin(math.radians(theta))+math.sin(math.radians(2*theta))/ \\\n",
      "(2*math.sqrt(n**2-(math.sin(math.radians(theta)))**2)))) \t\t\t#N-m\n",
      "#Calculating the equivalent length of a simple pendulum when swung about an axis through P\n",
      "L = ((kG)**2+(l1)**2)/l1 \t\t\t#m\n",
      "#Calculating the correcting torque\n",
      "TC = mC*l1*(l-L) *(omega**2 * math.sin(math.radians(60)))/(2*n**2)\t\t\t#N-m\n",
      "#Calculating the torque due to the weight of the connecting rod at C\n",
      "TW = mC*9.81*(l1/n)*math.cos(math.radians(theta)) \t\t\t#N-m\n",
      "#Calculating the total torque exerted on the crankshaft\n",
      "Tt = TI+TC+TW \t\t\t#Total torque exerted on the crankshaft N-m\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Total torque exerted on the crankshaft  =  %.1f N-m.\"%(round(Tt,-1))\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total torque exerted on the crankshaft  =  3840.0 N-m.\n"
       ]
      }
     ],
     "prompt_number": 110
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.21 Page No : 558"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 1200. \t\t\t#rpm\n",
      "L = 110./1000\n",
      "r = L/2\n",
      "l = 250./1000\n",
      "PC = l\n",
      "CG = 75./1000 \t\t\t#m\n",
      "mC = 1.25 \t\t\t#kg\n",
      "theta = 40. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.26\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Radius of gyration of the connecting rod about an axis through its mass centre:\n",
      "#Calculating the distance of the centre of gravity from the point of suspension\n",
      "l1 = l-CG \t\t\t#m\n",
      "PG = l1\n",
      "#Calculating the frequency of oscillation\n",
      "n = 21./20 \t\t\t#Hz\n",
      "#Calculating the radius of gyration of the connecting rod about an axis through its mass centre\n",
      "kG = round(math.sqrt((9.81*l1/(2*math.pi*n)**2)-l1**2)*1000) \t\t\t#mm\n",
      "#Acceleration of the piston:\n",
      "#Calculating the ratio of lengths of the connecting rod and crank\n",
      "n = l/r\n",
      "#Calculating the acceleration of the piston\n",
      "aP = omega**2*r*(math.cos(math.radians(theta))+math.cos(math.radians(2*theta))/n) \t\t\t#m/s**2\n",
      "#Calculating the angular acceleration of the connecting rod\n",
      "alphaPC = (-omega**2*math.sin(math.radians(theta)))/n \t\t\t#rad/s**2\n",
      "#Inertia torque exerted on the crankshaft:\n",
      "#Calculating the mass of the connecting rod at P\n",
      "m1 = (l-l1)/l*mC \t\t\t#kg\n",
      "#Calculating the vertical inertia force\n",
      "FI = round(m1*aP) \t\t\t#N\n",
      "#By measurement\n",
      "OM = 0.0425\n",
      "NC = 0.035 \t\t\t#m\n",
      "#Calculating the corresponding torque due to FI\n",
      "TI = FI*OM \t\t\t#N-m\n",
      "#Calculating the equivalent length of a simple pendulum when swung about an axis pasmath.sing through P\n",
      "L = ((kG/1000)**2+(l1)**2)/l1 \t\t\t#m\n",
      "#Calculating the correction couple\n",
      "Tdash = mC*l1*(l-L)*alphaPC \t\t\t#N-m\n",
      "#Calculating the corresponding torque on the crankshaft\n",
      "TC = -Tdash*math.cos(math.radians(theta))/n \t\t\t#N-m\n",
      "#Calculating the torque due to mass at P\n",
      "TP = m1*9.81*OM \t\t\t#N-m\n",
      "#Calculating the equivalent mass of the connecting rod at C\n",
      "m2 = mC*(l1/l) \t\t\t#kg\n",
      "#Calculating the torque due to mass at C\n",
      "TW = m2*9.81*NC \t\t\t#N-m\n",
      "#Calculating the inertia force exerted on the crankshaft\n",
      "Ti = TI+TC-TP-TW \t\t\t#Inertia torque exerted on the crankshaft N-m\n",
      "\n",
      "#Results:\n",
      "print \" Radius of gyration of the connecting rod about an axis through its mass centre kG  =  %d mm.\"%(kG)\n",
      "print \" Acceleration of the piston aP  =  %.1f m/s**2.\"%(aP)\n",
      "print \" Angular acceleration of the connecting rod alphaPC  =  %.1f rad/s**2.\"%(alphaPC)\n",
      "print \" Inertia torque exerted on the crankshaft  =  %.3f N-m.\"%(Ti)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Radius of gyration of the connecting rod about an axis through its mass centre kG  =  94 mm.\n",
        " Acceleration of the piston aP  =  698.5 m/s**2.\n",
        " Angular acceleration of the connecting rod alphaPC  =  -2233.1 rad/s**2.\n",
        " Inertia torque exerted on the crankshaft  =  12.696 N-m.\n"
       ]
      }
     ],
     "prompt_number": 112
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.22 Page No : 559"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "l = 225./1000      #m\n",
      "PC = l             #m\n",
      "L = 150./1000      #m\n",
      "r = L/2            #m\n",
      "D = 112.5/1000     #m\n",
      "PG = 150./1000     #m\n",
      "kG = 87.5/1000 \t   #m\n",
      "mC = 1.6\n",
      "mR = 2.4 \t\t\t#kg\n",
      "theta = 40 \t\t\t#degrees\n",
      "p = 1.8*10**6 \t\t#N/m**2\n",
      "N = 2000. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Refer Fig. 15.27\n",
      "#Calculating the angular speed of the crank\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#By measurement\n",
      "NO = 0.0625\n",
      "gO = 0.0685\n",
      "IC = 0.29\n",
      "IP = 0.24\n",
      "IY = 0.148\n",
      "IX = 0.08 \t\t\t#m\n",
      "#Calculating the force due to gas pressure\n",
      "FL = math.pi/4*D**2*p \t\t\t#N\n",
      "#Calculating the inertia force due to mass of the reciprocating parts\n",
      "FI = mR*omega**2*NO \t\t\t#N\n",
      "#Calculating the net force on the piston\n",
      "FP = FL-FI \t\t\t#N\n",
      "#Calculating the inertia force due to mass of the connecting rod\n",
      "FC = mC*omega**2*gO \t\t\t#N\n",
      "#Calculating the force acting perpendicular to the crank OC\n",
      "FT = ((FP*IP)-((mC*9.81*IY)+(FC*IX)))/IC \t\t\t#N\n",
      "#By measurement\n",
      "FN = 3550.\n",
      "FR = 7550.\n",
      "FQ = 13750. \t\t\t#N\n",
      "\n",
      "#Results:\n",
      "print \" Resultant force on the crank pin FQ  =  %d N.\"%(FQ)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Resultant force on the crank pin FQ  =  13750 N.\n"
       ]
      }
     ],
     "prompt_number": 36
    }
   ],
   "metadata": {}
  }
 ]
}