{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 17: Rolling of Metals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Example 17.1, Forces in rolling, Page No. 596"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Maximum possible reduction when mu is 0.08 = 0.0768 in\n",
      "\n",
      "Maximum possible reduction when mu is 0.5 = 3 in\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from math import atan\n",
    "\n",
    "#variable declaration\n",
    "mu1=0.08;\n",
    "mu2=0.5;\n",
    "R=12;\n",
    "\n",
    "#calculation\n",
    "alpha=atan(mu1);\n",
    "dh1=mu1**2*R;\n",
    "dh2=mu2**2*R;\n",
    "\n",
    "#result\n",
    "print('\\nMaximum possible reduction when mu is 0.08 = %g in\\n')%(dh1);\n",
    "print('Maximum possible reduction when mu is 0.5 = %g in')%(dh2);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 17.2, Rolling Load, Page No. 598"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Rolling Load = 3039.51 kips\n",
      "\n",
      "Rolling Load  if sticking friction occurs = 5509.54 kips\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from math import sqrt\n",
    "from math import exp\n",
    "\n",
    "#variable declaration\n",
    "h0=1.5;\n",
    "mu=0.3;\n",
    "D=36;\n",
    "s_en=20;\n",
    "s_ex=30;\n",
    "\n",
    "#calculation\n",
    "h1=h0-0.3*h0;\n",
    "dh=h0-h1;\n",
    "h_=(h1+h0)/2;\n",
    "Lp=sqrt(D/2*dh);\n",
    "Q=mu*Lp/h_;\n",
    "sigma0=(s_en+s_ex)/2;\n",
    "P=sigma0*(exp(Q)-1)*s_ex*Lp/Q;\n",
    "Ps=sigma0*(Lp/(4*dh)+1)*s_ex*Lp;\n",
    "\n",
    "#result\n",
    "print('\\nRolling Load = %g kips')%(P);\n",
    "print('\\nRolling Load  if sticking friction occurs = %g kips')%(Ps);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 17.3, Rolling Load, Page No. 599"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "P2 = 1410.35\n",
      "R2 = 18.6281\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "from math import sqrt\n",
    "from math import exp\n",
    "\n",
    "#variable declaration\n",
    "h0=1.5;\n",
    "mu=0.3;\n",
    "D=36;\n",
    "s_en=20;\n",
    "s_ex=30;\n",
    "C=3.34*10**-4;\n",
    "P_=1357;\n",
    "\n",
    "#calculation\n",
    "h1=h0-0.3*h0;\n",
    "dh=h0-h1;\n",
    "h_=(h1+h0)/2;\n",
    "R=D/2;\n",
    "R1=R*(1+C*P_/(s_ex*(dh)));\n",
    "Lp=sqrt(R1*dh);\n",
    "Q=mu*Lp/h_;\n",
    "sigma0=(s_en+s_ex)/2;\n",
    "P2=sigma0*(exp(Q)-1)*s_ex*Lp/Q;\n",
    "P2=P2*0.45359                         #conversion to tons\n",
    "R2=R*(1+C*P2/(s_ex*(dh)));\n",
    "\n",
    "#result\n",
    "print('\\nP2 = %g\\nR2 = %g')%(P2,R2);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 17.4, Torque and Horsepower, Page No. 614"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Rolling Load = 540.012\n",
      "Horsepower = 1713.63\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from math import sqrt\n",
    "from math import pi\n",
    "from math import log\n",
    "\n",
    "#variable declaration\n",
    "w=12;\n",
    "hi=0.8;\n",
    "hf=0.6;\n",
    "D=40;\n",
    "N=100;\n",
    "\n",
    "#calculation\n",
    "R=D/2;\n",
    "dh=abs(hf-hi);\n",
    "e1=log(hi/hf);\n",
    "r=(hi-hf)/hi;\n",
    "sigma=20*e1**0.2/1.2;\n",
    "Qp=1.5;\n",
    "P=2*sigma*w*sqrt(R*(hi-hf))*Qp/sqrt(3);\n",
    "a=0.5*sqrt(R*dh);\n",
    "a=a/12;                             #conversion to ft\n",
    "hp=4*pi*a*P*N*1000/33000;\n",
    "\n",
    "#result\n",
    "print('\\nRolling Load = %g\\nHorsepower = %g')%(P,hp);\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
}