#*-------------------------------------------------------------------
* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
*
* This LIBRARY is free software; you can distribute it and/or modify
* it under the therms of the ALSOC FREE LICENSE as available at
* http://www.enq.ufrgs.br/alsoc.
*
* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
* from http://www.rps.eng.br Copyright (C) 2002-2004.
* All rights reserved.
*
* EMSO is distributed under the therms of the ALSOC LICENSE as
* available at http://www.enq.ufrgs.br/alsoc.
*
*-------------------------------------------------------------------
* Model of tanks
*--------------------------------------------------------------------
* Streams:
* * an inlet stream
* * an outlet stream
*
* Specify:
* * the Inlet stream
* * the Outlet flow
* * the tank Q
*
* Initial:
* * the tank temperature (OutletL.T)
* * the tank level (h)
* * (NoComps - 1) Outlet compositions
*----------------------------------------------------------------------
* Author: Paula B. Staudt
* $Id: tank.mso 210 2007-03-15 12:52:28Z arge $
*--------------------------------------------------------------------*#
using "streams";
Model tank
PARAMETERS
outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
outer NComp as Integer;
Across as area (Brief="Tank cross section area", Default=2);
VARIABLES
in Inlet as stream;
out Outlet as liquid_stream;
in Q as heat_rate (Brief="Rate of heat supply");
Level as length(Brief="Tank level");
M(NComp) as mol (Brief="Molar Holdup in the tank");
E as energy (Brief="Total Energy Holdup on tank");
vL as volume_mol (Brief="Liquid Molar Volume");
EQUATIONS
"Mass balance"
diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
"Energy balance"
diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
"Energy Holdup"
E = sum(M)*Outlet.h;
"Mechanical Equilibrium"
Inlet.P = Outlet.P;
"Liquid Volume"
vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
"Composition"
M = Outlet.z*sum(M);
"Level of liquid phase"
Level = sum(M)*vL/Across;
end
#*----------------------------------------------------------
*
*Model of a tank with a lain cylinder geometry
*
*---------------------------------------------------------*#
Model tank_cylindrical
PARAMETERS
outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
outer NComp as Integer;
radius as length(Brief="Tank radius");
L as length(Brief="Tank length");
VARIABLES
in Inlet as stream;
out Outlet as liquid_stream;
in Q as heat_rate (Brief="Rate of heat supply");
Level as length(Brief="Tank level");
Across as area (Brief="Tank cross section area", Default=2);
M(NComp) as mol (Brief="Molar Holdup in the tank");
E as energy (Brief="Total Energy Holdup on tank");
vL as volume_mol (Brief="Liquid Molar Volume");
EQUATIONS
"Mass balance"
diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
"Energy balance"
diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
"Energy Holdup"
E = sum(M)*Outlet.h;
"Mechanical Equilibrium"
Inlet.P = Outlet.P;
"Liquid Volume"
vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
"Composition"
M = Outlet.z*sum(M);
"Cylindrical Area"
Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) +
(Level-radius)*sqrt(Level*(2*radius - Level));
"Level of liquid phase"
L*Across = sum(M)*vL;
end
Model tank_simplified
PARAMETERS
k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4);
A as area (Brief="Tank area", Default=2);
VARIABLES
h as length(Brief="Tank level");
in Fin as flow_vol(Brief="Input flow");
out Fout as flow_vol(Brief="Output flow");
EQUATIONS
"Mass balance"
diff(A*h) = Fin - Fout;
"Valve equation"
Fout = k*sqrt(h);
end
Model tank_feed
PARAMETERS
outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
outer NComp as Integer;
Across as area (Brief="Tank cross section area", Default=2);
VARIABLES
in Feed as stream;
in Inlet as stream;
out Outlet as liquid_stream;
in Q as heat_rate (Brief="Rate of heat supply");
Level as length(Brief="Tank level");
M(NComp) as mol (Brief="Molar Holdup in the tank");
E as energy (Brief="Total Energy Holdup on tank");
vL as volume_mol (Brief="Liquid Molar Volume");
EQUATIONS
"Mass balance"
diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z;
"Energy balance"
diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
"Energy Holdup"
E = sum(M)*Outlet.h;
"Mechanical Equilibrium"
Inlet.P = Outlet.P;
"Liquid Volume"
vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
"Composition"
M = Outlet.z*sum(M);
"Level of liquid phase"
Level = sum(M)*vL/Across;
end