Skip to content

Commit

Permalink
~
Browse files Browse the repository at this point in the history
  • Loading branch information
aakanksha-gubbala committed Apr 6, 2021
1 parent 33aa58c commit 26497f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
1 change: 0 additions & 1 deletion density.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ def get_density(s, T):
def rho(T):
return A / B ** (1 + (1 - T / C) ** D)
return rho(T) if s != 'Hexane' else rho

15 changes: 2 additions & 13 deletions mccabethiele.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import pyplot, style
from scipy.optimize import fsolve


np.seterr(divide='ignore', invalid='ignore')


def main():
st.title('McCabe-Thiele Plot Generator')
st.write('The McCabe-Thiele method is used to determine the number of equilibrium stages for a distillation column.')
st.write(
'The McCabe-Thiele method is used to determine the number of equilibrium stages for a distillation column.')

style.use('classic')

Expand All @@ -22,11 +22,9 @@ def main():
q = st.number_input('Thermal Quality', value=1.000)
a = st.number_input('Relative Volatility', value=2.500)


def dbf(f):
return [xd * f[0] + xb * f[1] - zf * F, f[0] + f[1] - F]


[D, B] = fsolve(dbf, [30, 20])

st.write('Distillate: ', round(D, 4), 'Bottoms: ', round(B, 4))
Expand All @@ -36,34 +34,27 @@ def dbf(f):
Vr = Lr + D
Vs = Vr + (q - 1) * F


def x_eq(x):
# x on the equlibrium curve
return x / (a * (1 - x) + x)


def rec_opline(x):
# rectifying section operating line: y = (Lr/Vr)*x + (D*xd/Vr)
return (Lr / Vr) * x + (D * xd / Vr)


def strip_opline(x):
# stripping section operating line: y = (Ls/Vs)*x - (B*xb/Vs)
return (Ls / Vs) * x - (B * xb / Vs)


# intersection point of rectifying opline and stripping opline
def inter_pt(p):
return [(Lr / Vr) * p[0] + (D * xd / Vr) - p[1], (Ls / Vs) * p[0] - (B * xb / Vs) - p[1]]


[xq, yq] = fsolve(inter_pt, [0.5, 0.5])


def min_reflux(x):
return [q * x[0] - zf - x[1] * (q - 1), x[1] - a * x[0] / (1 + x[0] * (a - 1))]


[xrmin, yrmin] = fsolve(min_reflux, [0.5, 0.6])

slope = (xd - yrmin) / (xd - xrmin)
Expand Down Expand Up @@ -121,12 +112,10 @@ def min_reflux(x):
xb_tr = st.number_input('Bottom concentration', value=0.100)
a_tr = st.number_input('Relative Volatility (average)', value=2.500)


def x_eq(x):
# x on the equlibrium curve
return x / (a_tr * (1 - x) + x)


# y-x equilibrium curve
x = np.linspace(0, 1, 10000)
y = a_tr * x / (1 + x * (a_tr - 1))
Expand Down
6 changes: 2 additions & 4 deletions volume.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import pandas as pd
from density import get_density


molecular_weights = pd.read_csv("molecularWeights.txt", sep='!', names=['Compounds', 'MW'])
molecular_weights = dict(zip(molecular_weights['Compounds'], molecular_weights['MW'] ))
molecular_weights = dict(zip(molecular_weights['Compounds'], molecular_weights['MW']))


def get_volume(s, T):
return 0.001*molecular_weights[s]/get_density(s, T)

return 0.001 * molecular_weights[s] / get_density(s, T)

0 comments on commit 26497f8

Please sign in to comment.