{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ch:25 Gears"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-1 - Page 669"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dp is 125 mm  \n",
      "\n",
      "dg is 300 mm  \n",
      "\n",
      "CD is 212.5 mm   \n",
      "\n",
      "ha is 5 mm   \n",
      "\n",
      "hf is 6.25 mm   \n",
      "\n",
      "c is 1.25 mm   \n",
      "\n",
      "r is 2 mm   \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt, pi\n",
    "Zp=25#\n",
    "Zg=60#\n",
    "m=5#\n",
    "dp=m*Zp#\n",
    "dg=m*Zg#\n",
    "CD=(dp+dg)/2#\n",
    "ha=m#\n",
    "hf=1.25*m#\n",
    "c=hf-ha#\n",
    "r=0.4*m#\n",
    "print \"dp is %0.0f mm  \"%(dp)#\n",
    "print \"\\ndg is %0.0f mm  \"%(dg)#\n",
    "print \"\\nCD is %0.1f mm   \"%(CD)#\n",
    "print \"\\nha is %0.0f mm   \"%(ha)#\n",
    "print \"\\nhf is %0.2f mm   \"%(hf)#\n",
    "print \"\\nc is %0.2f mm   \"%(c)#\n",
    "print \"\\nr is %0.0f mm   \"%(r)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-2 - Page 669"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dp is 77 mm  \n",
      "\n",
      "dg is 309 mm  \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "from sympy import symbols, solve\n",
    "N=800#\n",
    "P=6000#\n",
    "n=200#\n",
    "Cs=1.4#\n",
    "sigb=150#\n",
    "FOS=2#\n",
    "Zp=18#\n",
    "Zg=Zp*N/n#\n",
    "Y=pi*(0.154-(0.912/Zp))#\n",
    "p=[1 ,0 ,-9.5846, -38.135]#\n",
    "P = symbols('P')\n",
    "expr = P**3*p[0]+P**2*p[1]+P*p[2]+p[3]\n",
    "m=solve(expr, P)[0]#\n",
    "dp=m*Zp#\n",
    "dg=m*Zg#\n",
    "# printing data in scilab o/p window\n",
    "print \"dp is %0.0f mm  \"%(dp)#\n",
    "print \"\\ndg is %0.0f mm  \"%(dg)#\n",
    "# Answer is given wrong in the textbook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-3 - Page 670"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Sb is 16110 N   \n",
      "\n",
      "Sw is 25200 N  \n",
      "\n",
      "P is 11.657 kW  \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "Zp=30#\n",
    "N=1000#\n",
    "Zg=75#\n",
    "m=5#\n",
    "b=60#\n",
    "sigut=450#\n",
    "BHN=350#\n",
    "Cs=1.5#\n",
    "FOS=2#\n",
    "dp=m*Zp#\n",
    "dg=m*Zg#\n",
    "v=2*pi*N*dp/(60*1000*2)#\n",
    "Cv=3/(3+v)#\n",
    "sigb=450/3#\n",
    "Y=0.358#\n",
    "Sb=m*b*sigb*Y#\n",
    "Q=(2*Zg)/(Zp+Zg)#\n",
    "K=0.16*(BHN/100)**2#\n",
    "Sw=b*dp*Q*K#\n",
    "Pt=Sb*Cv/(Cs*FOS)#\n",
    "P=Pt*v#\n",
    "P=P*10**-3#\n",
    "print \"Sb is %0.0f N   \"%(Sb)#\n",
    "print \"\\nSw is %0.0f N  \"%(Sw)#\n",
    "print \"\\nP is %0.3f kW  \"%(P)#\n",
    "\n",
    "#The difference in the value of Sw is due to rounding-off of the value of Q."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-4 - Page 670"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "BHN is 333    \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "n=240#\n",
    "P=8000#\n",
    "N=1200#\n",
    "CD=300#\n",
    "Cs=1.5#\n",
    "alpha=20*pi/180#\n",
    "G=N/n#\n",
    "dp=CD*2/6#\n",
    "dg=5*dp#\n",
    "v=2*pi*N*dp/(60*1000*2)#\n",
    "Cv=3/(3+v)#\n",
    "Pt=P/v#\n",
    "Peff=Pt*Cs/Cv#\n",
    "m=4#\n",
    "b=10*m#\n",
    "FOS=2#\n",
    "Sb=Peff*FOS#\n",
    "sigut=600#\n",
    "sigb=sigut/3#\n",
    "Zp=dp/m#\n",
    "Zg=dg/m#\n",
    "Q=(2*Zg)/(Zp+Zg)#\n",
    "K=Sb/(b*dp*Q)#\n",
    "BHN=sqrt(K/0.16)*100#\n",
    "BHN=333#\n",
    "print \"BHN is %0.0f    \"%(BHN)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-5 - Page 671"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ps is 2166.67 N   \n",
      "\n",
      "Pd is 1358.6 N   \n",
      "\n",
      "BHN is 282   \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "alpha=20*pi/180#\n",
    "N=800#\n",
    "P=6000#\n",
    "sigut=450#\n",
    "i=5#\n",
    "Cs=1.3#\n",
    "v=3.6#\n",
    "FOS=2#\n",
    "Pt=P/v#\n",
    "Cv=3/(3+v)#\n",
    "sigb=sigut/3#\n",
    "dp=3.6*1000*2*60/(2*pi*N)#\n",
    "dp=86#\n",
    "Sb=Pt*Cs/Cv*FOS#\n",
    "#Let x be m**2*Y\n",
    "x=Sb/(10*sigb)#\n",
    "m=5#\n",
    "Zp=18#\n",
    "dp=m*Zp#\n",
    "Zg=i*Zp#\n",
    "dg=m*Zg#\n",
    "b=10*m#\n",
    "phip=m+(0.25*sqrt(dp))#\n",
    "ep=32+(2.5*phip)#\n",
    "phig=m+(0.25*sqrt(dg))#\n",
    "eg=32+(2.5*phig)#\n",
    "e=ep+eg#\n",
    "e=e*10**-3#\n",
    "Ps=Cs*Pt#\n",
    "r1=dp/2#\n",
    "r2=dg/2#\n",
    "Pd=e*N*Zp*b*r1*r2/(2530*sqrt(r1**2+r2**2))#\n",
    "Q=(2*Zg)/(Zp+Zg)#\n",
    "K=Sb/(b*dp*Q)#\n",
    "BHN=sqrt(K/0.16)*100#\n",
    "print \"Ps is %0.2f N   \"%(Ps)#\n",
    "print \"\\nPd is %0.1f N   \"%(Pd)#\n",
    "print \"\\nBHN is %0.0f   \"%(BHN)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 25-4 - Page 672"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m is 6 mm   \n",
      "\n",
      "Pd is 434.590 N   \n",
      "\n",
      "Sw is 13244 N   \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "P=9000#\n",
    "N=900#\n",
    "n=150#\n",
    "sigut=750#\n",
    "BHN=300#\n",
    "Cs=1.5#\n",
    "FOS=2#\n",
    "i=N/n#\n",
    "x=sqrt(i)#\n",
    "Zp=18#\n",
    "Zg=x*Zp#\n",
    "Zg=44#\n",
    "#Let actual speed reduction be xa\n",
    "xa=Zg/Zp#\n",
    "n1=N/xa**2#\n",
    "T1=P*60/(2*pi*N)#\n",
    "i2=N/xa#\n",
    "T2=N/i2*T1#\n",
    "m=6#\n",
    "dp=Zp*m#\n",
    "dg=m*Zg#\n",
    "phip=m+(0.25*sqrt(dp))#\n",
    "ep=16+(1.25*phip)#\n",
    "phig=m+(0.25*sqrt(dg))#\n",
    "eg=16+(1.25*phig)#\n",
    "e=ep+eg#\n",
    "e=e*10**-3#\n",
    "Pt=26000#\n",
    "Ps=Cs*Pt#\n",
    "r1=dp/2#\n",
    "r2=dg/2#\n",
    "b=10*m#\n",
    "Pd=e*i2*Zp*b*r1*r2/(2530*sqrt(r1**2+r2**2))#\n",
    "Q=(2*Zg)/(Zp+Zg)#\n",
    "sigb=sigut/3#\n",
    "Y=0.308#\n",
    "\n",
    "Sb=b*m*sigb*Y#\n",
    "K=0.16*(BHN/100)**2#\n",
    "Sw=b*dp*K*Q#\n",
    "print \"m is %0.0f mm   \"%(m)#\n",
    "print \"\\nPd is %0.3f N   \"%(Pd)#\n",
    "print \"\\nSw is %0.0f N   \"%(Sw)  \n",
    "#The difference in the values is due to rounding-off of the values."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}