summaryrefslogtreecommitdiff
path: root/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb
blob: 572f406faac399a949b62bd9bb28df6ac23f9135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
 "metadata": {
  "name": "",
  "signature": "sha256:829300ed441b0056de124b3c59bbb1f7034cd4f5704a4d95b4ff6c77357fd0c5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 :  Introduction to Material  Balances"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.1  Page no. 142\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from numpy import matrix\n",
      "\n",
      "# Variables\n",
      "# Given\n",
      "P_O = 89 ;      # Premium octane -[octane/gal]\n",
      "S_O = 93 ;      # Supereme octane - [octane/gal]\n",
      "R_O = 87 ;      # Regular octane - [octane/gal]\n",
      "CP = 1.269 ;    # Cost of premium octane -[$/gal]\n",
      "SP = 1.349 ;    # Cost of supereme octane -[$/gal]\n",
      "RP = 1.149 ;    # Cost of regular octane -[$/gal]\n",
      "\n",
      "# Let x and y fraction of regular octane and supreme octane  is blended respectively,therefore: x + y = 1 ...(a)\n",
      "# and 89 = 87x + 93y ...(b)\n",
      "# Solve equations (a) and (b) simultaneously\n",
      "# Calculation\n",
      "a = matrix([[1,1],[87,93]]) ;          # Matrix of coefficients of unknown\n",
      "b = matrix([[1.0],[89.0]]) ;           # Matrix of constant\n",
      "a = a.I\n",
      "c = a * b\n",
      "cost =  c[0]*RP + c[1]*SP ;       # Cost after blending - [$/gal]\n",
      "sv = CP - cost ;                  # Save on blending - [$/gal]\n",
      "\n",
      "# Result\n",
      "# Check whether there is loss or save\n",
      "if (sv<0):\n",
      "    print 'We will not save money by blending.'\n",
      "else:\n",
      "    print 'We will save money by blending, and save is %.3f $/gal.'%sv"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We will save money by blending, and save is 0.053 $/gal.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 6.2 Page no. 147\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "fd= 1000.0 ;      #feed rate-[L/hr]\n",
      "cfd= 500.0;       #Weight of cells per litre- [mg/L]\n",
      "dn= 1.0 ;         #Density of feed-[g/cm**3]\n",
      "wp= 50.0 ;        # Weight percent of cells in product stream\n",
      "\n",
      "# Calculation and Result\n",
      "Pg=(fd*cfd*dn)/(1000*wp*.01) ;      # Mass balance for cells \n",
      "print ' Product flow(P) per hour is %.1f g'%Pg\n",
      "Dg= (fd*dn*1000) - Pg*(wp*.01) ;    # Mass balance for the fluid\n",
      "print '  Discharge flow per hour is %.3e g'%Dg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Product flow(P) per hour is 1000.0 g\n",
        "  Discharge flow per hour is 9.995e+05 g\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6.3  Page no. 154\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "dn =  0.80 ;                        #Density of motor oil-[g/cm**3]\n",
      "\n",
      "# Calculation and Result\n",
      "in_ms = (10000*(0.1337)*62.4*dn) ;  #  Initial mass of motor oil in the tank -[lb]\n",
      "print ' Initial mass of motor oil in the tank is %.1f lb'%in_ms\n",
      "\n",
      "m_fr = .0015 ;                      #Mass fractional loss\n",
      "print '  Mass fractional loss is %.4f '%m_fr\n",
      "\n",
      "Dsg = m_fr*in_ms ;                  # Mass balance for the fluid\n",
      "print '  Discharge of motor oil on flushing flow for 10000 gal motor oil is %.1f lb'%Dsg"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Initial mass of motor oil in the tank is 66743.0 lb\n",
        "  Mass fractional loss is 0.0015 \n",
        "  Discharge of motor oil on flushing flow for 10000 gal motor oil is 100.1 lb\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}