#*-------------------------------------------------------------------
* 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.
*
*----------------------------------------------------------------------
* Author: Paula B. Staudt
* $Id$
*--------------------------------------------------------------------*#
using "streams";
Model thermosyphon
ATTRIBUTES
Pallete = true;
Icon = "icon/Thermosyphon";
Brief = "Model of a Steady State reboiler thermosyphon.";
Info =
"== ASSUMPTIONS ==
* perfect mixing of both phases;
* no thermodynamics equilibrium;
== SET ==
* the pressure drop in the reboiler;
* the FlowConstant that relates the Flow through the reboiler and the heat duty
** Flow^3 = FlowConstant*InletQ
== SPECIFY ==
* the InletLiquid stream;
* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model)
OR the outlet temperature (OutletVapour.T);
== OPTIONAL ==
* the reboiler model has two control ports
** TI OutletVapour Temperature Indicator;
** PI OutletVapour Pressure Indicator;
";
PARAMETERS
outer PP as Plugin (Brief = "External Physical Properties", Type="PP");
outer NComp as Integer (Brief="Number of Components");
Pdrop as press_delta (Brief="Pressure Drop in the reboiler", Symbol = "\Delta P");
FlowConstant as Real (Brief = "Flow Constant");
k as Real (Brief = "Flow Constant", Hidden = true, Unit='mol^3/(kg*m^2)');
SET
k = 1*'mol^3/(kg*m^2)';
VARIABLES
in InletLiquid as stream (Brief="Liquid inlet stream", PosX=0.44, PosY=1, Symbol="_{inL}");
out OutletVapour as streamPH (Brief="Vapour outlet stream", PosX=0, PosY=0.09, Symbol="_{outV}");
in InletQ as power (Brief="Heat supplied", PosX=1, PosY=0.77, Symbol="Q_{in}", Protected = true);
out TI as control_signal (Brief="Temperature Indicator of Reboiler", Protected = true, PosX=1, PosY=0.57);
out PI as control_signal (Brief="Pressure Indicator of Reboiler", Protected = true, PosX=1, PosY=0.35);
EQUATIONS
"Molar Flow Balance"
InletLiquid.F = OutletVapour.F;
"Molar Composition Balance"
InletLiquid.z = OutletVapour.z;
"Energy Balance"
InletLiquid.F*InletLiquid.h + InletQ = OutletVapour.F*OutletVapour.h;
"Pressure Drop"
OutletVapour.P = InletLiquid.P - Pdrop;
"Temperature indicator"
TI * 'K' = OutletVapour.T;
"Pressure indicator"
PI * 'atm' = OutletVapour.P;
"Flow through the thermosyphon reboiler"
OutletVapour.F^3 = FlowConstant*k*InletQ;
end
Model reboilerSteady
ATTRIBUTES
Pallete = true;
Icon = "icon/ReboilerSteady";
Brief = "Model of a Steady State reboiler with no thermodynamics equilibrium - thermosyphon.";
Info =
"Model of a Steady State reboiler with two approaches:
**Fake Conditions: fake calculation of vaporisation fraction and output temperature, but with a real
calculation of the output stream enthalpy.
**Flash PH: in the outlet stream a PH Flash is performed to obtain the outlet conditions.
== ASSUMPTIONS ==
* perfect mixing of both phases;
* no thermodynamics equilibrium;
== SET ==
* the option Flash_Calculation
* the fake Outlet temperature;
* the fake outlet vapour fraction;
* the pressure drop in the reboiler;
* the FlowConstant that relates the Flow through the reboiler and the heat duty
** Flow^3 = FlowConstant*InletQ
== SPECIFY ==
* the InletLiquid stream;
* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model)
OR the outlet temperature (OutletVapour.T);
== OPTIONAL ==
* the reboiler model has two control ports
** TI OutletVapour Temperature Indicator;
** PI OutletVapour Pressure Indicator;
";
PARAMETERS
outer PP as Plugin (Brief = "External Physical Properties", Type="PP");
outer NComp as Integer (Brief="Number of Components");
Flash_Calculation as Switcher (Brief="Flash Calculation", Valid=["Flash_PH","Fake_Conditions"],Default="Fake_Conditions");
Pdrop as press_delta (Brief="Pressure Drop in the reboiler", Symbol = "\Delta P");
FlowConstant as Real (Brief = "Flow Constant");
Fake_Temperature as temperature (Brief="Fake temperature", Symbol = "T_{fake}");
Fake_Vfrac as fraction (Brief="Fake vapour fraction", Symbol = "v_{fake}");
k as Real (Brief = "Flow Constant", Hidden = true, Unit='mol^3/(kg*m^2)');
SET
k = 1*'mol^3/(kg*m^2)';
VARIABLES
in InletLiquid as stream (Brief="Liquid inlet stream", PosX=0.345, PosY=1, Symbol="_{inL}", Protected = true);
out OutletVapour as stream (Brief="Vapour outlet stream", PosX=0.17, PosY=0, Symbol="_{outV}", Protected = true);
in InletQ as power (Brief="Heat supplied", PosX=1, PosY=0.08, Symbol="Q_{in}", Protected = true);
x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true);
y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true);
out TI as control_signal (Brief="Temperature Indicator of Reboiler", Protected = true, PosX=0.44, PosY=0);
out PI as control_signal (Brief="Pressure Indicator of Reboiler", Protected = true, PosX=0.35, PosY=0);
EQUATIONS
"Molar Flow Balance"
InletLiquid.F = OutletVapour.F;
"Molar Composition Balance"
InletLiquid.z = OutletVapour.z;
"Energy Balance"
InletLiquid.F*InletLiquid.h + InletQ = OutletVapour.F*OutletVapour.h;
"Pressure Drop"
OutletVapour.P = InletLiquid.P - Pdrop;
"Temperature indicator"
TI * 'K' = OutletVapour.T;
"Pressure indicator"
PI * 'atm' = OutletVapour.P;
"Flow through the reboiler"
OutletVapour.F^3 = FlowConstant*k*InletQ;
switch Flash_Calculation
case "Flash_PH":
#*"Flash Calculation"
[OutletVapour.v, x, y] = PP.FlashPH(OutletVapour.P, OutletVapour.h, OutletVapour.z);
"Enthalpy"
OutletVapour.h = (1-OutletVapour.v)*PP.LiquidEnthalpy(OutletVapour.T, OutletVapour.P, x) +
OutletVapour.v*PP.VapourEnthalpy(OutletVapour.T, OutletVapour.P, y);
*#
"Fake Vapourisation Fraction"
OutletVapour.v = Fake_Vfrac;
"Fake output temperature"
OutletVapour.T = Fake_Temperature;
"Fake Liquid Molar Fraction"
x = 1;
"Fake Vapour Molar Fraction"
y = 1;
case "Fake_Conditions":
"Fake Vapourisation Fraction"
OutletVapour.v = Fake_Vfrac;
"Fake output temperature"
OutletVapour.T = Fake_Temperature;
"Fake Liquid Molar Fraction"
x = 1;
"Fake Vapour Molar Fraction"
y = 1;
end
end
Model reboilerReact
ATTRIBUTES
Pallete = false;
Icon = "icon/Reboiler";
Brief = "Model of a dynamic reboiler with reaction.";
Info =
"== Assumptions ==
* perfect mixing of both phases;
* thermodynamics equilibrium;
* no liquid entrainment in the vapour stream;
* the reaction takes place only in the liquid phase.
== Specify ==
* the kinetics variables;
* the inlet stream;
* the liquid inlet stream;
* the outlet flows: OutletVapour.F and OutletLiquid.F;
* the heat supply.
== Initial Conditions ==
* the reboiler temperature (OutletLiquid.T);
* the reboiler liquid level (Level);
* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
";
PARAMETERS
outer PP as Plugin(Type="PP");
outer NComp as Integer;
Across as area (Brief="Cross Section Area of reboiler");
V as volume (Brief="Total volume of reboiler");
stoic(NComp) as Real(Brief="Stoichiometric matrix");
Hr as energy_mol;
Initial_Level as length (Brief="Initial Level of liquid phase");
Initial_Temperature as temperature (Brief="Initial Temperature of Reboiler");
Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition");
VARIABLES
in InletLiquid as stream (Brief="Liquid inlet stream", PosX=0, PosY=0.5254, Symbol="_{inL}");
out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.2413, PosY=1, Symbol="_{outL}");
out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.5079, PosY=0, Symbol="_{outV}");
InletQ as power (Brief="Heat supplied", PosX=1, PosY=0.6123, Symbol="_{in}");
M(NComp) as mol (Brief="Molar Holdup in the tray");
ML as mol (Brief="Molar liquid holdup");
MV as mol (Brief="Molar vapour holdup");
E as energy (Brief="Total Energy Holdup on tray");
vL as volume_mol (Brief="Liquid Molar Volume");
vV as volume_mol (Brief="Vapour Molar volume");
Level as length (Brief="Level of liquid phase");
Vol as volume;
rhoV as dens_mass;
r3 as reaction_mol (Brief = "Reaction resulting ethyl acetate", DisplayUnit = 'mol/l/s');
C(NComp) as conc_mol (Brief = "Molar concentration", Lower = -1);
INITIAL
Level = Initial_Level;
OutletLiquid.T = Initial_Temperature;
OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
EQUATIONS
"Molar Concentration"
OutletLiquid.z = vL * C;
"Reaction"
r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
"Component Molar Balance"
diff(M)= InletLiquid.F*InletLiquid.z- OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
"Energy Balance"
diff(E) = InletLiquid.F*InletLiquid.h- OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * vL*ML;
"Molar Holdup"
M = ML*OutletLiquid.z + MV*OutletVapour.z;
"Energy Holdup"
E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*V;
"Mol fraction normalisation"
sum(OutletLiquid.z)=1.0;
"Liquid Volume"
vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
"Vapour Volume"
vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
"Vapour Density"
rhoV = PP.VapourDensity(OutletVapour.T, OutletVapour.P, OutletVapour.z);
"Level of liquid phase"
Level = ML*vL/Across;
Vol = ML*vL;
"Mechanical Equilibrium"
OutletLiquid.P = OutletVapour.P;
"Thermal Equilibrium"
OutletLiquid.T = OutletVapour.T;
"Geometry Constraint"
V = ML*vL + MV*vV;
"Chemical Equilibrium"
PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
sum(OutletLiquid.z)=sum(OutletVapour.z);
end
Model reboiler
ATTRIBUTES
Pallete = true;
Icon = "icon/Reboiler";
Brief = "Model of a dynamic reboiler - kettle with control.";
Info =
"== ASSUMPTIONS ==
* perfect mixing of both phases;
* thermodynamics equilibrium;
* no liquid entrainment in the vapour stream.
== SET ==
*Orientation: vessel position - vertical or horizontal;
*Heads (bottom and top heads are identical)
**elliptical: 2:1 elliptical heads (25% of vessel diameter);
**hemispherical: hemispherical heads (50% of vessel diameter);
*Diameter: Vessel diameter;
*Lenght: Side length of the cylinder shell;
== SPECIFY ==
* the InletLiquid stream;
* the outlet flows: OutletVapour.F and OutletLiquid.F;
* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
== OPTIONAL ==
* the reboiler model has three control ports
** TI OutletLiquid Temperature Indicator;
** PI OutletLiquid Pressure Indicator;
** LI Level Indicator of Reboiler;
== INITIAL CONDITIONS ==
* Initial_Temperature : the reboiler temperature (OutletLiquid.T);
* Levelpercent_Initial : the reboiler liquid level in percent (LI);
* Initial_Composition : (NoComps) OutletLiquid compositions.
";
PARAMETERS
outer PP as Plugin (Brief = "External Physical Properties", Type="PP");
outer NComp as Integer (Brief="Number of Components");
pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi");
g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical");
Heads as Switcher (Valid=["elliptical","hemispherical"],Default="elliptical");
Diameter as length (Brief="Vessel diameter", Symbol="D_{i}");
Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}");
Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}");
Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}");
Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}");
radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}");
Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70);
Initial_Temperature as temperature (Brief="Initial Temperature of Reboiler");
Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition",Lower=1E-6);
SET
pi = 3.141593;
g = 9.81 * 'm/(s^2)';
Vhead_elliptical = (pi*Diameter^3)/12;
Vhead_hemispherical = (pi*Diameter^3)/6;
Vcylinder = 0.25*(pi*Diameter^2)*Lenght;
radius = 0.5*Diameter;
VARIABLES
in InletLiquid as stream (Brief="Liquid inlet stream", PosX=0.17, PosY=1, Symbol="_{in}^{Liquid}");
out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.17, PosY=0, Symbol="_{out}^{Vapour}");
in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
out TI as control_signal (Brief="Temperature Indicator of Reboiler", Protected = true, PosX=0.44, PosY=0);
out LI as control_signal (Brief="Level Indicator of Reboiler", Protected = true, PosX=0.53, PosY=0);
out PI as control_signal (Brief="Pressure Indicator of Reboiler", Protected = true, PosX=0.35, PosY=0);
M(NComp) as mol (Brief="Molar Holdup in the tray", Protected = true);
ML as mol (Brief="Molar liquid holdup", Protected = true);
MV as mol (Brief="Molar vapour holdup", Protected = true);
E as energy (Brief="Total Energy Holdup on tray", Protected = true);
vL as volume_mol (Brief="Liquid Molar Volume", Protected = true);
vV as volume_mol (Brief="Vapour Molar volume", Protected = true);
rhoV as dens_mass (Brief="Vapour Density", Protected = true, Symbol="\rho");
Level as length (Brief="Level of liquid phase", Protected = true);
Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");
Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");
Across as area (Brief="Cross Section Area of reboiler",Protected=true);
INITIAL
"Initial level Percent"
LI = Levelpercent_Initial;
"Initial Temperature"
OutletLiquid.T = Initial_Temperature;
"Initial Composition"
OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
EQUATIONS
switch Orientation
case "vertical":
"Vessel Cross Section Area"
Across = 0.25*(pi*Diameter^2);
switch Heads
case "elliptical":
"Vessel Total Volume"
Vtotal = Vhead_elliptical + Vcylinder;
if Level < 0.25*Diameter then
"Vessel Filled Volume"
Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3);
else
"Vessel Filled Volume"
Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3);
end
case "hemispherical":
"Vessel Total Volume"
Vtotal = Vhead_hemispherical + Vcylinder;
if Level < 0.5*Diameter then
"Vessel Filled Volume"
Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3);
else
"Vessel Filled Volume"
Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2);
end
end
case "horizontal":
"Vessel Cross Section Area"
Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2));
switch Heads
case "elliptical":
"Vessel Total Volume"
Vtotal = Vhead_elliptical + Vcylinder;
"Vessel Filled Volume"
Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght;
case "hemispherical":
"Vessel Total Volume"
Vtotal = Vhead_hemispherical + Vcylinder;
"Vessel Filled Volume"
Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght;
end
end
"Component Molar Balance"
diff(M)= InletLiquid.F*InletLiquid.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z;
"Energy Balance"
diff(E) = InletLiquid.F*InletLiquid.h - OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ;
"Molar Holdup"
M = ML*OutletLiquid.z + MV*OutletVapour.z;
"Energy Holdup"
E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*Vtotal;
"Mol Fraction Normalisation"
sum(OutletLiquid.z)=1.0;
"Mol fraction Constraint"
sum(OutletLiquid.z)=sum(OutletVapour.z);
"Vapour Density"
rhoV = PP.VapourDensity(OutletVapour.T, OutletVapour.P, OutletVapour.z);
"Liquid Volume"
vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
"Vapour Volume"
vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
"Chemical Equilibrium"
PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
"Mechanical Equilibrium"
OutletLiquid.P = OutletVapour.P;
"Thermal Equilibrium"
OutletLiquid.T = OutletVapour.T;
"Pressure Drop"
OutletLiquid.P = InletLiquid.P - Pdrop;
"Geometry Constraint"
Vtotal = ML*vL + MV*vV;
"Liquid Level"
ML * vL = Vfilled;
"Temperature Indicator"
TI * 'K' = OutletLiquid.T;
"Pressure Indicator"
PI * 'atm' = OutletLiquid.P;
"Level indicator"
LI*Vtotal= Vfilled;
end