{
 "metadata": {
  "name": "",
  "signature": "sha256:0872fbc3ae91821d4330e3facbf2559c866bc6b64416332df388f5fee66480e0"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 : Mechanisms with Lower Pairs"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1 Page No : 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "c = 1.2\n",
      "b = 2.7 \t\t\t#m\n",
      "\n",
      "#Solution:\n",
      "#Calculating the inclination of the track arm to the longitudinal axis\n",
      "alpha = math.tan(c/(2*b))*180/math.pi \t\t\t#degrees\n",
      "\n",
      "#Results:\n",
      "print \" Inclination of the track arm to the longitudinal axis, alpha  =  %.1f degrees.\"%(alpha)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Inclination of the track arm to the longitudinal axis, alpha  =  12.9 degrees.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2 Page No : 251\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variables\n",
      "a = 180. - 160.    # degrees\n",
      "N = 1500.          # r.p.m.; \n",
      "m = 12.            # kg ; \n",
      "k =  0.1           # m\n",
      "\n",
      "# calculations\n",
      "w = round(2*math.pi*N/60)\n",
      "I = m*k**2\n",
      "cos2theta = 2*math.sin(math.radians(a))**2/(2 - math.sin(math.radians(a))**2)\n",
      "theta = math.degrees(math.acos(cos2theta))/2\n",
      "dw1bydt = w**2*math.cos(math.radians(a)) * math.sin(math.radians(2*theta)) * math.sin(math.radians(a))**2 / ( 1 - math.cos(math.radians(theta))**2 * math.sin(math.radians(a))**2)**2\n",
      "max_t = I * dw1bydt\n",
      "\n",
      "# results\n",
      "print \"Maximum angular acceleration of the driven shaft : %.f rad/s**2\"%dw1bydt\n",
      "print \"maximum torque required : %.f N-m\"%max_t\n",
      "\n",
      "\n",
      "# answers are different because of rounding error. please check using calculator."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum angular acceleration of the driven shaft : 3080 rad/s**2\n",
        "maximum torque required : 370 N-m\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3 Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "alpha = 18*math.pi/180 \t\t\t#radians\n",
      "\n",
      "#Solution:\n",
      "#Maximum velocity is possible when\n",
      "theta1 = 0.\n",
      "theta2 = 180. \t\t\t#degrees\n",
      "\n",
      "#Calculating the angle turned by the driving shaft when the velocity ratio is unity\n",
      "theta3 = math.cos(math.sqrt((1-math.cos(alpha))/(math.sin(alpha)**2)))*180/math.pi \t\t\t#degrees\n",
      "theta4 = 180-theta3 \t\t\t#degrees\n",
      "\n",
      "#Results:\n",
      "print \" Angle turned by the driving shaft when the velocity ratio is maximum, theta  =  %d degrees\\\n",
      " or %d degrees.\"%(theta1,theta2)\n",
      "print \" Angle turned by the driving shaft when the velocity ratio is unity, theta  =  %.1f degrees or\\\n",
      " %.1f degrees.\"%(theta3,theta4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Angle turned by the driving shaft when the velocity ratio is maximum, theta  =  0 degrees or 180 degrees.\n",
        " Angle turned by the driving shaft when the velocity ratio is unity, theta  =  43.2 degrees or 136.8 degrees.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4 Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 500. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular velocity of the driving shaft\n",
      "omega = 2*math.pi*N/60.0 \t\t\t#rad/s\n",
      "#Calculating the total fluctuation of speed of the driven shaft\n",
      "q = 12./100*omega \t\t\t#rad/s\n",
      "#Calculating the greatest permissible angle between the centre lines of the shafts\n",
      "#alpha = math.cos((-(q/omega)+math.sqrt(0.12**2+4))/2.0)*180/math.pi\t\t\t#degrees\n",
      "cosalpha =((-(q/omega)+math.sqrt(0.12**2+4))/2.0)\t\t\t#degrees\n",
      "alpha = math.degrees(math.acos(cosalpha))\n",
      "\n",
      "#Results:\n",
      "print \" Greatest permissible angle between the centre lines of the shafts, alpha  =  %.2f degrees.\"%(alpha)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Greatest permissible angle between the centre lines of the shafts, alpha  =  19.64 degrees.\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5 Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "N = 1200.\n",
      "q = 100. \t\t\t#rpm\n",
      "#Solution:\n",
      "#Calculating the greatest permissible angle between the centre lines of the shafts\n",
      "cosalpha = ((-(100./1200)+math.sqrt(0.083**2+4))/2)\n",
      "alpha = math.degrees(math.acos(cosalpha))                    #degrees\n",
      "#Calculating the maximum speed of the driven shaft\n",
      "N1max = N/cosalpha \t\t\t#rpm\n",
      "#Calculating the minimum speed of the driven shaft\n",
      "N1min = N*cosalpha\t\t\t#rpm\n",
      "\n",
      "#Results:\n",
      "print \" Greatest permissible angle between the centre lines of the shafts, alpha  =  %.1f degrees.\"%(alpha)\n",
      "print \" Maximum speed of the driven shaft, N1max  =  %d rpm.\"%(N1max)\n",
      "print \" Minimum speed of the driven shaft, N1min  =  %d rpm.\"%(N1min)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Greatest permissible angle between the centre lines of the shafts, alpha  =  16.4 degrees.\n",
        " Maximum speed of the driven shaft, N1max  =  1251 rpm.\n",
        " Minimum speed of the driven shaft, N1min  =  1151 rpm.\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6 page no : 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variables\n",
      "N = 240.       # r.p.m \n",
      "w = 2 * math.pi * 240./60       #rad/s \n",
      "alpha = 20    \n",
      "m = 55.          # kg ;\n",
      "k = .150         \n",
      "mm = 0.15        #m ; \n",
      "T1 = 200.         #N-m ; \n",
      "theta = 45.       #  \u00b0 ; \n",
      "q = 24.          # r.p.m.\n",
      "\n",
      "# calculations\n",
      "I = round(m * k**2,2) \n",
      "dw1bydt = round(-(w**2)*math.cos(math.radians(alpha))*math.sin(math.radians(2*theta))*math.sin(math.radians(alpha))**2 / (1- math.cos(math.radians(theta))**2 * math.sin(math.radians(alpha))**2)**2,2)\n",
      "T2 = I * dw1bydt\n",
      "T = T1 + T2\n",
      "Tdash = T*math.cos(math.radians(alpha))/(1-math.cos(math.radians(theta))**2 * math.sin(math.radians(alpha))**2)\n",
      "cosapha = (-0.1+math.sqrt((0.1**2)+4))/2\n",
      "alpha = math.degrees(math.acos(cosapha))\n",
      "\n",
      "# result\n",
      "print \"T' = %.1f N-m\"%Tdash\n",
      "print \"Alpha a = %.1f degrees\"%alpha\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T' = 102.7 N-m\n",
        "Alpha a = 18.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7 Page No : 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "alpha = 20. \t\t\t#degrees\n",
      "NA = 500.    \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the maximum speed of the intermediate shaft\n",
      "NBmax = NA/math.cos(math.radians(alpha)) \t\t\t#rpm\n",
      "#Calculating the minimum speed of the intermediate shaft\n",
      "NBmin = NA*math.cos(math.radians(alpha)) \t\t\t#rpm\n",
      "#Calculating the maximum speed of the driven shaft\n",
      "NCmax = NBmax/math.cos(math.radians(alpha)) \t\t\t#rpm\n",
      "#Calculating the minimum speed of the driven shaft\n",
      "NCmin = NBmin*math.cos(math.radians(alpha)) \t\t\t#rpm\n",
      "\n",
      "#Results:\n",
      "print \" Maximum speed of the intermediate shaft( NBmax)  =  %.1f rad/s.\"%(NBmax)\n",
      "print \" Minimum speed of the intermediate shaft( NBmin)  =  %.2f rad/s.\"%(NBmin)\n",
      "print \" Maximum speed of the driven shaft( NCmax)  =  %.2f rad/s.\"%(NCmax)\n",
      "print \" Minimum speed of the driven shaft( NCmin)  =  %.1f rad/s.\"%(NCmin)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Maximum speed of the intermediate shaft( NBmax)  =  532.1 rad/s.\n",
        " Minimum speed of the intermediate shaft( NBmin)  =  469.85 rad/s.\n",
        " Maximum speed of the driven shaft( NCmax)  =  566.24 rad/s.\n",
        " Minimum speed of the driven shaft( NCmin)  =  441.5 rad/s.\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}