{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 7.34 Pump Power and Operating Cost"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Given a pump provides 428 feet of head, pumps 700 gpm of 60 deg F water.\n",
    "The efficiencies of the pump, motor, and VSD are as follows: 70.7%, 95%, 96%.\n",
    "\n",
    "Find the brake horsepower, electrical horsepower, and the operating cost (on an 8000 hour/year basis) given a power cost of $0.12/kWhr."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2022-08-22T01:20:05.047233Z",
     "iopub.status.busy": "2022-08-22T01:20:05.046764Z",
     "iopub.status.idle": "2022-08-22T01:20:05.709670Z",
     "shell.execute_reply": "2022-08-22T01:20:05.709030Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The brake power is 107.05591309130916 horsepower\n",
      "The power is 117.38586961766357 horsepower\n",
      "The cost is  $84033.24278348622 dimensionless dollars/year\n"
     ]
    }
   ],
   "source": [
    "from fluids.units import *\n",
    "rho = 62.364*u.lb/u.ft**3\n",
    "head = 428*u.foot\n",
    "Q = 700*u.gal/u.min\n",
    "pump_efficiency = 0.707\n",
    "total_efficiency = .707*.95*.96\n",
    "dP = head*rho*u.gravity\n",
    "\n",
    "# unfortunately pint does not support currency, so we keep it dimensionless\n",
    "rate = 0.12/(u.kW*u.hour)\n",
    "\n",
    "bhp = Q*dP/pump_efficiency\n",
    "print('The brake power is %s' %(bhp.to(u.hp)))\n",
    "power = Q*dP/total_efficiency\n",
    "print('The power is %s' %(power.to(u.hp)))\n",
    "cost = power*rate\n",
    "cost = (cost*8000*u.hour).to_base_units()\n",
    "print('The cost is  $%s dollars/year' %(cost))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The value given in Crane is $83970."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
