-
Notifications
You must be signed in to change notification settings - Fork 1
/
tanks.py
82 lines (58 loc) · 1.39 KB
/
tanks.py
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
# Installed Libs (Testing to comment from Fork)
import math
import numpy as np
from scipy.integrate import odeint
# Local Libs
from physicochemical_properties import liquor_properties
from physicochemical_properties import water_properties
from physicochemical_properties import vapor_properties
from global_data import *
liquor=liquor_properties()
water=water_properties()
vapor=vapor_properties()
class tank:
'''
Parameters:
Dp, Diameter of pipe [in]
A, Cross-sectional area [m]
V, Tank volume [m3]
'''
def __init__(self, Dp, A, V):
self.Dp=Dp
self.A=A
self.V=V
sel.hmax=V/A
def in_out(self, fluid_in, fluid_out):
self.fluid_in = fluid_in
self.fluid_out = fluid_out
def round_rsd_time(self,rsd_time):
## Round residence time according to sample time
ts=Db_data.ts
A=rsd_time/ts
B=math.ceil(A)
round_time=B*ts
return round_time
@staticmethod
def model_level(x, t, Dp, A, hmax, Fin, Pout, Tj, Bj, Zj):
Ltk=x[0]
# Juice viscosity
pj=liquor.density(Tj,Bj,Zj)
# Juice density
uj=liquor.viscosity(Tj,Bj,Zj)
#Lengh of out pipe
Lp=5.0
# Gravity
g=9.80665 #[m/s2]
# Athmosferic pressure
Patm= 101325 #[Pa]
# Hidrostatic pressure
Ph=pj*g*Ltk*hmax
dPout=Ph-Pout
Rp=(8*uj*Lp)/(math.pi*(0.0127*Dp)**4)
rsd_time=(A*hmax)/(Fin)
if t-rsd_time>0.0:
dLtk = (pj*(Fin-((dPout)/Rp)))/(pj*A*hmax)
else:
dLtk=0.0
dy=dLtk
return dy