[403] | 1 | #*--------------------------------------------------------------------- |
---|
| 2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
| 3 | * |
---|
| 4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
| 5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
| 6 | * http://www.enq.ufrgs.br/alsoc. |
---|
| 7 | * |
---|
| 8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
| 9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
| 10 | * All rights reserved. |
---|
| 11 | * |
---|
| 12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
| 13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
| 14 | * |
---|
| 15 | *---------------------------------------------------------------------- |
---|
| 16 | * Model of a tank basic |
---|
| 17 | *---------------------------------------------------------------------- |
---|
| 18 | * |
---|
[421] | 19 | * Description: |
---|
| 20 | * Generic model for a dynamic tank. |
---|
[403] | 21 | * |
---|
[421] | 22 | * Assumptions: |
---|
| 23 | * * single- and two-phases involved |
---|
| 24 | * * dynamic |
---|
[403] | 25 | * |
---|
| 26 | *---------------------------------------------------------------------- |
---|
| 27 | * Author: Rodolfo Rodrigues |
---|
| 28 | * $Id$ |
---|
| 29 | *--------------------------------------------------------------------*# |
---|
| 30 | |
---|
| 31 | using "streams"; |
---|
[426] | 32 | using "vol_tank"; |
---|
[403] | 33 | |
---|
| 34 | |
---|
| 35 | Model tank_basic |
---|
[421] | 36 | ATTRIBUTES |
---|
| 37 | Brief = "Basic model for a dynamic tank"; |
---|
| 38 | |
---|
[403] | 39 | PARAMETERS |
---|
[421] | 40 | outer PP as Plugin (Brief="External physical properties", Type="PP"); |
---|
| 41 | outer NComp as Integer (Brief="Number of components", Default=1); |
---|
[403] | 42 | |
---|
| 43 | VARIABLES |
---|
[421] | 44 | in Inlet as stream (Brief="Inlet stream", PosX=0, PosY=0, Symbol="_{in}"); |
---|
[422] | 45 | Outletm as stream (Brief="Intermediary outlet stream", Symbol="_{outm}"); |
---|
[426] | 46 | Tank as vol_tank (Brief="Routine to volume tank calculation", Symbol="_{tank}"); |
---|
| 47 | |
---|
[403] | 48 | M(NComp)as mol (Brief="Component molar holdup"); |
---|
| 49 | Mt as mol (Brief="Total component molar holdup"); |
---|
| 50 | E as energy (Brief="Internal energy"); |
---|
| 51 | Q as heat_rate(Brief="Reactor duty", Default=0); |
---|
| 52 | |
---|
| 53 | EQUATIONS |
---|
| 54 | "Component molar balance" |
---|
| 55 | diff(M) = Inlet.F*Inlet.z - Outletm.F*Outletm.z; |
---|
| 56 | |
---|
| 57 | "Component molar" |
---|
| 58 | M = Mt*Outletm.z; |
---|
| 59 | |
---|
| 60 | "Mole fraction normalisation" |
---|
[421] | 61 | sum(Outletm.z) = 1; |
---|
[403] | 62 | |
---|
| 63 | "Energy balance" |
---|
| 64 | diff(E) = Inlet.F*Inlet.h - Outletm.F*Outletm.h + Q; |
---|
| 65 | end |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | #*--------------------------------------------------------------------- |
---|
[421] | 69 | * only vapour phase |
---|
[403] | 70 | *--------------------------------------------------------------------*# |
---|
[421] | 71 | Model tank_vap as tank_basic |
---|
| 72 | ATTRIBUTES |
---|
| 73 | Brief = "Model of a generic vapour-phase tank"; |
---|
| 74 | |
---|
[403] | 75 | EQUATIONS |
---|
| 76 | "Vapourisation fraction" |
---|
[421] | 77 | Outletm.v = 1; |
---|
[403] | 78 | |
---|
[421] | 79 | "Vapour Enthalpy" |
---|
| 80 | Outletm.h = PP.VapourEnthalpy(Outletm.T,Outletm.P,Outletm.z); |
---|
| 81 | |
---|
[403] | 82 | "Volume constraint" |
---|
[426] | 83 | Tank.V = Mt*PP.VapourVolume(Outletm.T,Outletm.P,Outletm.z); |
---|
[421] | 84 | |
---|
[403] | 85 | "Total internal energy" |
---|
[421] | 86 | E = Mt*Outletm.h; |
---|
[403] | 87 | end |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | #*--------------------------------------------------------------------- |
---|
[421] | 91 | * only liquid phase |
---|
[403] | 92 | *--------------------------------------------------------------------*# |
---|
[421] | 93 | Model tank_liq as tank_basic |
---|
| 94 | ATTRIBUTES |
---|
| 95 | Brief = "Model of a generic liquid-phase tank"; |
---|
| 96 | |
---|
[403] | 97 | EQUATIONS |
---|
| 98 | "Vapourisation fraction" |
---|
[421] | 99 | Outletm.v = 0; |
---|
[403] | 100 | |
---|
[421] | 101 | "Liquid Enthalpy" |
---|
| 102 | Outletm.h = PP.LiquidEnthalpy(Outletm.T,Outletm.P,Outletm.z); |
---|
| 103 | |
---|
[403] | 104 | "Volume constraint" |
---|
[426] | 105 | Tank.V = Mt*PP.LiquidVolume(Outletm.T,Outletm.P,Outletm.z); |
---|
[421] | 106 | |
---|
[403] | 107 | "Total internal energy" |
---|
[426] | 108 | E = Mt*Outletm.h - Outletm.P*Tank.V; |
---|
[403] | 109 | end |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | #*--------------------------------------------------------------------- |
---|
| 113 | * liquid and vapour phases |
---|
| 114 | *--------------------------------------------------------------------*# |
---|
| 115 | Model tank_liqvap |
---|
[421] | 116 | ATTRIBUTES |
---|
| 117 | Brief = "Model of a generic two-phase tank"; |
---|
| 118 | |
---|
[403] | 119 | PARAMETERS |
---|
| 120 | outer PP as Plugin(Brief="External physical properties", Type="PP"); |
---|
| 121 | outer NComp as Integer (Brief="Number of components", Default=1); |
---|
| 122 | |
---|
| 123 | VARIABLES |
---|
[421] | 124 | in Inlet as stream (Brief="Inlet stream", PosX=0, PosY=0, Symbol="_{in}"); |
---|
[422] | 125 | OutletmL as liquid_stream (Brief="Intermediary liquid outlet stream", Symbol="_{outmL}"); |
---|
[421] | 126 | out OutletV as vapour_stream (Brief="Outlet vapour stream", Symbol="_{outV}"); |
---|
[426] | 127 | Tank as vol_tank (Brief="Routine to volume tank calculation", Symbol="_{tank}"); |
---|
| 128 | |
---|
[403] | 129 | M(NComp)as mol (Brief="Component molar holdup"); |
---|
| 130 | ML as mol (Brief="Molar liquid holdup"); |
---|
| 131 | MV as mol (Brief="Molar vapour holdup"); |
---|
| 132 | E as energy (Brief="Internal energy"); |
---|
| 133 | Q as heat_rate (Brief="Reactor duty", Default=0); |
---|
| 134 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 135 | |
---|
| 136 | EQUATIONS |
---|
| 137 | "Component molar balance" |
---|
| 138 | diff(M) = Inlet.F*Inlet.z - (OutletmL.F*OutletmL.z + OutletV.F*OutletV.z); |
---|
| 139 | |
---|
| 140 | "Molar holdup" |
---|
| 141 | M = ML*OutletmL.z + MV*OutletV.z; |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | "Mole fraction normalisation" |
---|
[421] | 145 | sum(OutletmL.z) = 1; |
---|
[403] | 146 | |
---|
| 147 | "Mole fraction normalisation" |
---|
| 148 | sum(OutletmL.z) = sum(OutletV.z); |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | "Vapourisation fraction" |
---|
[421] | 152 | OutletV.v = 1; |
---|
[403] | 153 | |
---|
| 154 | "Vapourisation fraction" |
---|
[421] | 155 | OutletmL.v = 0; |
---|
[403] | 156 | |
---|
| 157 | |
---|
| 158 | "Energy balance" |
---|
| 159 | diff(E) = Inlet.F*Inlet.h - (OutletmL.F*OutletmL.h + OutletV.F*OutletV.h) + Q; |
---|
| 160 | |
---|
| 161 | "Total internal energy" |
---|
[426] | 162 | E = ML*OutletmL.h + MV*OutletV.h; |
---|
[403] | 163 | |
---|
| 164 | "Geometry constraint" |
---|
[426] | 165 | Tank.V = ML*vL + MV*PP.VapourVolume(OutletV.T,OutletV.P,OutletV.z); |
---|
[403] | 166 | |
---|
| 167 | |
---|
| 168 | "Chemical Equilibrium" |
---|
| 169 | PP.LiquidFugacityCoefficient(OutletmL.T,OutletmL.P,OutletmL.z)*OutletmL.z = |
---|
| 170 | PP.VapourFugacityCoefficient(OutletV.T,OutletV.P,OutletV.z)*OutletV.z; |
---|
| 171 | |
---|
| 172 | "Mechanical Equilibrium" |
---|
| 173 | OutletmL.P = OutletV.P; |
---|
| 174 | |
---|
| 175 | "Thermal Equilibrium" |
---|
| 176 | OutletmL.T = OutletV.T; |
---|
| 177 | |
---|
| 178 | "Liquid Volume" |
---|
| 179 | vL = PP.LiquidVolume(OutletmL.T,OutletmL.P,OutletmL.z); |
---|
| 180 | |
---|
| 181 | "Tank Level" |
---|
[426] | 182 | ML*vL = Tank.V; |
---|
[403] | 183 | end |
---|