{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ch:15 Shafts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 15-2 - Page 421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d is 17.73 mm    \n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi, sqrt, tan\n",
    "dA=150#\n",
    "dB=250#\n",
    "alpha=20*pi/180#\n",
    "W=400#\n",
    "sigyt=400#\n",
    "sigut=500#\n",
    "Kb=1.5#\n",
    "Kt=2#\n",
    "T=W*dA/2#\n",
    "Pt=T/(dB/2)#\n",
    "Pr1=W*tan(alpha)#\n",
    "Pr2=Pt*tan(alpha)#\n",
    "RDH=((W*120)-(Pt*320))/440#\n",
    "RcH=W-RDH-Pt#\n",
    "#RcH=400+65.5-240#\n",
    "McH=0#\n",
    "MAH=RcH*120#\n",
    "MBH=RDH*120#\n",
    "RDV=((Pr1*120)-(Pr2*320))/440#\n",
    "RcV=Pr1-RDV-Pr2#\n",
    "MAV=RcV*120#\n",
    "MBV=RDV*120#\n",
    "Mmax=sqrt((MAH**2)+(MAV**2))#\n",
    "T=30*10**3#\n",
    "Ta=0.135*sigut#\n",
    "d=16*sqrt((Kb*Mmax)**2+(Kt*T)**2)/(pi*Ta)#\n",
    "d=d**(1/3)#\n",
    "print \"d is %0.2f mm    \"%(d)#\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 15-3 - Page 421"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d1 is 12.46 mm    \n",
      "\n",
      "d2 is 13.23 mm    \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "P=16*746#\n",
    "N=3000#\n",
    "w=2*pi*N/60#\n",
    "T=P/w*10**3#\n",
    "sigy=400#\n",
    "Ty=sigy/2#\n",
    "FOS=2#\n",
    "Ta=Ty/FOS#\n",
    "d=T*16/(pi*Ta)#\n",
    "d1=d**(1/3)#\n",
    "r=3#\n",
    "D=d1+(2*r)#\n",
    "SCF=1.196\n",
    "Tys=Ta/SCF#\n",
    "d=T*16/(pi*Tys)#\n",
    "d2=d**(1/3)#\n",
    "d=14#\n",
    "D=d+(2*r)#\n",
    "print \"d1 is %0.2f mm    \"%(d1)#\n",
    "print \"\\nd2 is %0.2f mm    \"%(d2)#\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 15-4 - Page 422"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " d1 is 39.16 mm    \n",
      "\n",
      " d2 is 29.25 mm    \n",
      "\n",
      " d3 is 55.6 mm    \n",
      "\n",
      " d4 is 44.67 mm    \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "P1=24*10**3#\n",
    "P2=10*10**3#\n",
    "sigyt=460#\n",
    "Tya=sigyt*0.3#\n",
    "SCF=2.84#\n",
    "Ta=Tya/SCF#\n",
    "N=400#\n",
    "w=2*pi*N/60#\n",
    "T1=P1/w#\n",
    "T2=P2/w#\n",
    "d1=T1*16*10**3/(pi*Ta)#\n",
    "d1=d1**(1/3)#\n",
    "d2=T2*16*10**3/(pi*Ta)#\n",
    "d2=d2**(1/3)#\n",
    "theta1=pi/3600#\n",
    "l1=120#\n",
    "G=84*10**3#\n",
    "d3=T1*10**3*l1*32/(pi*G*theta1)#\n",
    "d3=d3**(1/4)#\n",
    "d4=T2*l1*10**3*32/(pi*G*theta1)#\n",
    "d4=d4**(1/4)#\n",
    "print \" d1 is %0.2f mm    \"%(d1)#\n",
    "print \"\\n d2 is %0.2f mm    \"%(d2)#\n",
    "print \"\\n d3 is %0.1f mm    \"%(d3)#\n",
    "print \"\\n d4 is %0.2f mm    \"%(d4)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 15-5 - Page 423"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d is 33.6 mm    \n",
      "\n",
      "theta is 0.33 degree    \n"
     ]
    }
   ],
   "source": [
    "from math import sin, exp\n",
    "d=200#\n",
    "r=d/2#\n",
    "N=300#\n",
    "P=5000#\n",
    "D=500#\n",
    "R=D/2#\n",
    "u=0.3#\n",
    "E=205*10**3#\n",
    "G=84*10**3#\n",
    "Ta=60#\n",
    "Kb=1.5#\n",
    "Kt=2#\n",
    "w=2*pi*N/60#\n",
    "beta1=20*pi/180#\n",
    "V=r*w#\n",
    "v=R*w#\n",
    "# Let T1-T2 =T\n",
    "T=P/V#\n",
    "x=u*pi/sin(beta1)#\n",
    "T2=T/((exp(x)-1))#\n",
    "T1=T2*exp(x)#\n",
    "t=P/v#\n",
    "y=u*pi#\n",
    "T3=t/((exp(x)-1))#\n",
    "T4=T3*exp(x)#\n",
    "T=P/w#\n",
    "Rc=2612##\n",
    "RA=645.1#\n",
    "MB=96.76#\n",
    "MC=-208.96#\n",
    "d=16*10**3*sqrt((Kb*MC)**2+(Kt*T)**2)/(pi*Ta)#\n",
    "d=d**(1/3)#\n",
    "l=380#\n",
    "J=pi*d**4/32#\n",
    "theta=T*10**3*l/(G*J)#\n",
    "theta=theta*180/pi#\n",
    "print \"d is %0.1f mm    \"%(d)#\n",
    "print \"\\ntheta is %0.2f degree    \"%(theta)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## exa 15-6 - Page 423"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "d is 37 mm    \n",
      "\n",
      "theta is 0.1735 deg    \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "T=400#\n",
    "Pt=4800#\n",
    "Pg=3600#\n",
    "sigyt=360#\n",
    "E=205*10**3#\n",
    "G=80*10**3#\n",
    "Kb=2#\n",
    "Kt=1.5#\n",
    "FOS=3#\n",
    "RC=((Pt*90)+(Pg*200))/140#\n",
    "RA=8400-RC#\n",
    "MB=RA*0.9#\n",
    "MC=Pg*0.045#\n",
    "Te=sqrt((Kb*MC)**2+(Kt*T)**2)#\n",
    "Ta=0.577*sigyt/FOS#\n",
    "d=16*10**3*Te/(pi*Ta)#\n",
    "d=d**(1/3)#\n",
    "L=110#\n",
    "J=pi*d**4/32#\n",
    "T=400#\n",
    "theta=T*10**3*L/(G*J)#\n",
    "theta=theta*180/pi#\n",
    "print \"d is %0.0f mm    \"%(d)#\n",
    "print \"\\ntheta is %0.4f deg    \"%(theta)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## exa 15-7 - Page 424"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "n is 1.75     \n"
     ]
    }
   ],
   "source": [
    "from math import sqrt, pi\n",
    "T=47*10**3#\n",
    "M=32*10**3#\n",
    "d=20#\n",
    "siga=32*M/(pi*d**3)#\n",
    "Tm=16*T/(pi*d**3)#\n",
    "sige=75#\n",
    "Tys=165#\n",
    "n=1/sqrt((siga/sige)**2+(Tm/Tys)**2)#\n",
    "print \"n is %0.2f     \"%(n)#\n",
    "  "
   ]
  }
 ],
 "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
}