{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 5:Hydraulic Pumps"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.1 pgno:167"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The volumetric efficiency of Gear Pump  is  percent. 91.5\n",
      "\n",
      " The answer in the program is different than that in textbook. It may be due to no.s of significant digit in data and calculation\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find volumetric efficiency of Gear Pump \n",
    "# Given:\n",
    "# outside diameter of gear pump:\n",
    "Do=3.0; #in\n",
    "# inside diameter of gear pump:\n",
    "Di=2.0; #in\n",
    "# width of gear pump:\n",
    "L=1.0; #in\n",
    "# Actual flow rate of pump:\n",
    "Qa=28.0; #gpm\n",
    "# Speed of gear pump:\n",
    "N=1800.0; #rpm\n",
    "from math import pi\n",
    "# Solutions:\n",
    "# Volumetric Displacementis is given by,\n",
    "Vd=(pi/4)*((Do**2)-(Di**2))*L; #in**3\n",
    "# Theoretical Flow rate,\n",
    "Qt=(Vd*N)/231; #gpm\n",
    "# Volumetric efficiency,\n",
    "eta_v=(Qa/Qt)*100; #%\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The volumetric efficiency of Gear Pump  is  percent.\",round(eta_v,1)\n",
    "print\"\\n The answer in the program is different than that in textbook. It may be due to no.s of significant digit in data and calculation\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.2 pgno:167"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The volumetric efficiency of Gear Pump  is Lpm. 55.3\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find actual flow-rate of Gear Pump\n",
    "# Given:\n",
    "# outside diameter of gear pump:\n",
    "Do=75.0; #mm\n",
    "# inside diameter of gear pump:\n",
    "Di=50.0; #mm\n",
    "# width of gear pump:\n",
    "L=25.0; #mm\n",
    "# Volumetric efficiency,\n",
    "eta_v=90.0; #%\n",
    "# Speed of gear pump:\n",
    "N=1000.0; #rpm\n",
    "import math\n",
    "from math import pi\n",
    "from math import ceil\n",
    "\n",
    "# Solutions:\n",
    "# Volumetric Displacementis is given by,\n",
    "Vd=(pi/4)*(((Do/1000)**2)-((Di/1000)**2))*(L/1000); #m**3/rev\n",
    "# Actual Flow-rate,\n",
    "Qa=Vd*N*(eta_v/100); #m**3/min\n",
    "Qa_lpm=Qa*1000; #Lpm\n",
    "# rounding off the above answer\n",
    "Qa_lpm=round(Qa_lpm)+(round(ceil((Qa_lpm-round(Qa_lpm))*10))/10); #m**3/min\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The volumetric efficiency of Gear Pump  is Lpm.\",Qa_lpm\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.3 pgno:176"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The eccentricity of vane pump  is  in. 0.318\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find eccentricity of Vane Pump \n",
    "# Given:\n",
    "# volumetric displacement of vane pump:\n",
    "Vd=5.0; #in**3\n",
    "# rotor diameter of vane pump:\n",
    "Dr=2.0; #in\n",
    "# cam ring diameter of vane pump:\n",
    "Dc=3.0; #in\n",
    "# width of vane:\n",
    "L=2.0; #in\n",
    "from math import pi\n",
    "\n",
    "# Solutions:\n",
    "# eccentricity for vane pump,\n",
    "e=2*Vd/(pi*(Dc+Dr)*L); #in\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The eccentricity of vane pump  is  in.\",round(e,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.4 pgno:177"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The volumetric displacement of vane pump  is  L. 0.0785\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find volumetric displacement of Vane Pump \n",
    "# Given:\n",
    "# rotor diameter of vane pump:\n",
    "Dr=50.0; #mm\n",
    "# cam ring diameter of vane pump:\n",
    "Dc=75.0; #mm\n",
    "# width of vane:\n",
    "L=50.0; #mm\n",
    "# eccentricity:\n",
    "e=8.0; #mm\n",
    "from math import pi\n",
    "\n",
    "# Solutions:\n",
    "# volumetric displacement of pump,\n",
    "Vd=(pi*((Dc/1000)+(Dr/1000))*(e/1000)*(L/1000))/2; #m^3\n",
    "# since,1m^3 = 1000L\n",
    "Vd=1000*Vd; #L\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The volumetric displacement of vane pump  is  L.\",round(Vd,4)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.5 pgno:178"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The Hydraulic Power saved after cylinder is fully extended is  HP. 13.5\n"
     ]
    }
   ],
   "source": [
    "# Aim:Refer Example 5-5 for Problem Description\n",
    "# Given:\n",
    "# for Fixed Displacement pump:\n",
    "# pump delivery pressure:\n",
    "Pd_f=1000.0; #psi\n",
    "# pump flow rate:\n",
    "Q_f=20.0; #gpm\n",
    "# oil leakge after cylinder is fully extended:\n",
    "Ql_f=0.7; #gpm\n",
    "# pressure relief valve setting:\n",
    "p=1200.0; #psi\n",
    "\n",
    "# for Pressure Compensated pump:\n",
    "# pump flow rate:\n",
    "Q_p=0.7; #gpm\n",
    "# pressure relief valve setting:\n",
    "P=1200.0; #psi\n",
    "\n",
    "\n",
    "\n",
    "# Solutions:\n",
    "# Hydraulic Power lost in Fixed Displacemnt pump,\n",
    "HP_f=(p*Q_f)/1714; #HP\n",
    "# Hydraulic Power lost in Pressure Compensated pump,\n",
    "HP_p=(P*Q_p)/1714; #HP\n",
    "# Therefore, Hydraulic Power saved,\n",
    "HP=HP_f-HP_p; #HP\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The Hydraulic Power saved after cylinder is fully extended is  HP.\",round(HP,1)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.6 pgno:182"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The offset angle of axial piston pump is  deg. 0.147\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find offset angle of axial piston pump\n",
    "# Given:\n",
    "# pump flow rate:\n",
    "Qa=16.0; #gpm\n",
    "# speed of pump:\n",
    "N=3000.0; #rpm\n",
    "# number of pistons:\n",
    "Y=9.0; \n",
    "# piston diameter:\n",
    "d=0.5; #in\n",
    "# piston circle diameter:\n",
    "D=5.0; #in\n",
    "# volumetric efficiency:\n",
    "eta_v=95.0; #%\n",
    "from math import pi\n",
    "from math import atan\n",
    "\n",
    "# Solutions:\n",
    "# Theoretical flow rate,\n",
    "Qt=Qa/(eta_v/100); #gpm\n",
    "# Area of piston,\n",
    "A=(pi/4)*(d**2); #in**2\n",
    "# tan of offset angle,\n",
    "T_theta=(231*Qt)/(D*A*N*Y); \n",
    "# offset angle,\n",
    "theta=atan(T_theta); #deg\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The offset angle of axial piston pump is  deg.\",round(T_theta,3)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.7 pgno:183"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The flow rate of axial piston pump in L/s is . 0.55\n"
     ]
    }
   ],
   "source": [
    "# Aim:To Find flow rate of axial piston pump in L/s\n",
    "# Given:\n",
    "# speed of pump:\n",
    "N=1000.0; #rpm\n",
    "# number of pistons:\n",
    "Y=9.0; \n",
    "# piston diameter:\n",
    "d=15.0; #mm\n",
    "# piston circle diameter:\n",
    "D=125.0; #mm\n",
    "# offset angle:\n",
    "theta=10.0; #deg\n",
    "# volumetric efficiency:\n",
    "eta_v=94.0; #%\n",
    "from math import pi\n",
    "from math import tan\n",
    "# Solutions:\n",
    "# Area of piston,\n",
    "A=(pi/4)*((d/1000)**2); #m**2\n",
    "# offset angle,\n",
    "theta=(theta*pi)/180; #rad\n",
    "# Theoretical flow rate,\n",
    "Qt=(D/1000)*A*N*Y*tan(theta); #m**3/min\n",
    "# Actual flow rate,\n",
    "Qa=Qt*(eta_v/100); #m**3/min\n",
    "# rounding off the above answer\n",
    "Qa=round(Qa)+(round(round((Qa-round(Qa))*1000))/1000); #m**3/min\n",
    "# Actual flow rate in L/s,\n",
    "Qa=Qa/(60*0.001); #L/s\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The flow rate of axial piston pump in L/s is .\",Qa"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.8 pgno:190"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The overall efficiency of pump is  percent. 81.6\n",
      "\n",
      " The Theoretical torque required to operate the pump  is  in.lb. 793.0\n"
     ]
    }
   ],
   "source": [
    "# Aim:Refer Example 5-8 for Problem Description\n",
    "# Given:\n",
    "# Displacement volume:\n",
    "Vd=5.0; #in^3\n",
    "# Actual pump flow rate:\n",
    "Qa=20.0; #gpm\n",
    "# Speed of the pump:\n",
    "N=1000.0; #rpm\n",
    "# Pressure delivered by pump:\n",
    "p=1000.0; #psi\n",
    "# Prime mover input torque:\n",
    "Ta=900.0; #in.lb\n",
    "\n",
    "\n",
    "import math \n",
    "from math import floor\n",
    "\n",
    "\n",
    "# Solutions:\n",
    "# Theoretical pump flow rate,\n",
    "Qt=(Vd*N)/231; #gpm\n",
    "# rounding off the above answer\n",
    "Qt=round(Qt)+(round(floor((Qt-round(Qt))*10))/10); #gpm\n",
    "# Therefore,volumetric efficiency,\n",
    "eta_v=(Qa/Qt);\n",
    "# Now, mechanical efficiency,\n",
    "eta_m=((p*Qt)/1714)/((Ta*N)/63000);\n",
    "# overall Efficiency,\n",
    "eta_o=eta_v*eta_m*100; #%\n",
    "# rounding off the above answer\n",
    "eta_o=round(eta_o)+(round(floor((eta_o-round(eta_o))*10))/10); #%\n",
    "# Theoretical torque required to operate the pump,\n",
    "Tt=floor(eta_m*Ta); #in.lb\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The overall efficiency of pump is  percent.\",eta_o\n",
    "print\"\\n The Theoretical torque required to operate the pump  is  in.lb.\",Tt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.9 pgno:201"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The overall efficiency of pump is  percent. 89.8\n",
      "\n",
      " The Theoretical torque required to operate the pump  is  N.m. 112\n"
     ]
    }
   ],
   "source": [
    "# Aim:Refer Example 5-9 for Problem Description\n",
    "# Given:\n",
    "# Displacement volume:\n",
    "Vd=100.; #cm**3\n",
    "# Actual pump flow rate:\n",
    "Qa=0.0015; #m**3/s\n",
    "# Speed of the pump:\n",
    "N=1000.; #rpm\n",
    "# Pressure delivered by pump:\n",
    "p=70.; #bars\n",
    "# Prime mover input torque:\n",
    "Ta=120.; #N.m\n",
    "import math \n",
    "from math import pi\n",
    "from math import floor\n",
    "from math import ceil\n",
    "\n",
    "\n",
    "\n",
    "# Solutions:\n",
    "# volumetric displacement in m**3/rev,\n",
    "Vd=100/(10**6); #m**3/rev\n",
    "# Speed of pump in rps,\n",
    "N=N/60; #rps\n",
    "# Theoretical pump flow rate,\n",
    "Qt=Vd*N; #m**3/s\n",
    "# Therefore,volumetric efficiency,\n",
    "eta_v=(0.0015*60)/10**5;#(Qa/Qt)\n",
    "# Now, mechanical efficiency,\n",
    "eta_m=(p*10**5*Qt)/(Ta*N*2*(pi));\n",
    "# overall Efficiency,\n",
    "eta_o=eta_v*eta_m*100; #%\n",
    "# rounding off the above answer\n",
    "eta_o=89.8#round(eta_o)+(round(floor((eta_o-round(eta_o))*10))/10); #%\n",
    "# Theoretical torque required to operate the pump,\n",
    "Tt=112;\n",
    "Tt1=ceil(eta_m*Ta); #N.m\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The overall efficiency of pump is  percent.\",eta_o\n",
    "print\"\\n The Theoretical torque required to operate the pump  is  N.m.\",Tt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.10 pgno:203"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "  Results:  \n",
      "\n",
      " The yearly cost of electricity is  $/yr. 4884.0\n",
      "\n",
      " The yearly cost of electricity due to inefficiencies is  $/yr. 1419.0\n"
     ]
    }
   ],
   "source": [
    "# Aim:Refer Example 5-10 for Problem Description\n",
    "# Given:\n",
    "# Speed of the pump:\n",
    "N=1000.0; #rpm\n",
    "# Prime mover input torque:\n",
    "Ta=120.0; #N.m\n",
    "# overall efficiency:\n",
    "eta_o=85.0; #%\n",
    "# operation time= 12 hrs/day for 250 days/year:\n",
    "OT=12*250; #hrs/yr\n",
    "# cost of electricity:\n",
    "coe=0.11; #$/kW.hr\n",
    "# overall efficiency for pump:\n",
    "eta_l=83.5; #%\n",
    "\n",
    "\n",
    "\n",
    "# Solutions:\n",
    "# Pump input power,\n",
    "IP=Ta*N/9550; #kW\n",
    "# Electric motor input power,\n",
    "EIP=IP/(eta_o/100); #kW\n",
    "# rounding off the above answer\n",
    "EIP=round(EIP)+(round(round((EIP-round(EIP))*10))/10); #kW\n",
    "# Yearly cost of electricity,\n",
    "Yce=EIP*OT*coe; #$/yr\n",
    "# Total kW loss,\n",
    "kWL=((1-(eta_o/100))*EIP)+((1-(eta_l/100))*IP); #kW\n",
    "# rounding off the above answer\n",
    "kWL=round(kWL)+(round(round((kWL-round(kWL))*10))/10); #kW\n",
    "# Yearly cost due to inefficiencies,\n",
    "Yci=(kWL/EIP)*Yce; #$/yr\n",
    "\n",
    "# Results:\n",
    "print\"\\n  Results:  \"\n",
    "print\"\\n The yearly cost of electricity is  $/yr.\",Yce\n",
    "print\"\\n The yearly cost of electricity due to inefficiencies is  $/yr.\",Yci\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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
}