[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 | * |
---|
| 19 | * |
---|
| 20 | * |
---|
| 21 | *---------------------------------------------------------------------- |
---|
| 22 | * Author: Rodolfo Rodrigues |
---|
| 23 | * $Id$ |
---|
| 24 | *--------------------------------------------------------------------*# |
---|
| 25 | |
---|
| 26 | using "streams"; |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | Model tank_basic |
---|
| 30 | PARAMETERS |
---|
| 31 | outer PP as Plugin (Brief="External physical properties", Type="PP"); |
---|
| 32 | outer NComp as Integer (Brief="Number of components", Default=1); |
---|
| 33 | |
---|
| 34 | VARIABLES |
---|
| 35 | in Inlet as stream; # Inlet stream |
---|
| 36 | out Outletm as stream; # Intermediary outlet stream |
---|
| 37 | |
---|
| 38 | M(NComp)as mol (Brief="Component molar holdup"); |
---|
| 39 | Mt as mol (Brief="Total component molar holdup"); |
---|
| 40 | V as volume (Brief="Volume of reactional mixture"); |
---|
| 41 | E as energy (Brief="Internal energy"); |
---|
| 42 | Q as heat_rate(Brief="Reactor duty", Default=0); |
---|
| 43 | |
---|
| 44 | Across as area (Brief="Tank cross section area"); |
---|
| 45 | Level as length (Brief="Tank level"); |
---|
| 46 | |
---|
| 47 | EQUATIONS |
---|
| 48 | "Component molar balance" |
---|
| 49 | diff(M) = Inlet.F*Inlet.z - Outletm.F*Outletm.z; |
---|
| 50 | |
---|
| 51 | "Component molar" |
---|
| 52 | M = Mt*Outletm.z; |
---|
| 53 | |
---|
| 54 | "Mole fraction normalisation" |
---|
| 55 | sum(Outletm.z) = 1.0; |
---|
| 56 | |
---|
| 57 | "Energy balance" |
---|
| 58 | diff(E) = Inlet.F*Inlet.h - Outletm.F*Outletm.h + Q; |
---|
| 59 | |
---|
| 60 | "Geometry" |
---|
| 61 | V = Across*Level; |
---|
| 62 | end |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | #*--------------------------------------------------------------------- |
---|
| 66 | * only liquid phase |
---|
| 67 | *--------------------------------------------------------------------*# |
---|
| 68 | |
---|
| 69 | Model tank_liq as tank_basic |
---|
| 70 | EQUATIONS |
---|
| 71 | "Vapourisation fraction" |
---|
| 72 | Outletm.v = 0.0; |
---|
| 73 | |
---|
| 74 | "Liquid Enthalpy" |
---|
| 75 | Outletm.h = PP.LiquidEnthalpy(Outletm.T,Outletm.P,Outletm.z); |
---|
| 76 | |
---|
| 77 | "Volume constraint" |
---|
| 78 | V = Mt*PP.LiquidVolume(Outletm.T,Outletm.P,Outletm.z); |
---|
| 79 | |
---|
| 80 | "Total internal energy" |
---|
| 81 | E = Mt*Outletm.h - Outletm.P*V; |
---|
| 82 | end |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | #*--------------------------------------------------------------------- |
---|
| 86 | * only vapour phase |
---|
| 87 | *--------------------------------------------------------------------*# |
---|
| 88 | |
---|
| 89 | Model tank_vap as tank_basic |
---|
| 90 | EQUATIONS |
---|
| 91 | "Vapourisation fraction" |
---|
| 92 | Outletm.v = 1.0; |
---|
| 93 | |
---|
| 94 | "Vapour Enthalpy" |
---|
| 95 | Outletm.h = PP.VapourEnthalpy(Outletm.T,Outletm.P,Outletm.z); |
---|
| 96 | |
---|
| 97 | "Volume constraint" |
---|
| 98 | V = Mt*PP.VapourVolume(Outletm.T,Outletm.P,Outletm.z); |
---|
| 99 | |
---|
| 100 | "Total internal energy" |
---|
| 101 | E = Mt*Outletm.h; |
---|
| 102 | end |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | #*--------------------------------------------------------------------- |
---|
| 106 | * liquid and vapour phases |
---|
| 107 | *--------------------------------------------------------------------*# |
---|
| 108 | |
---|
| 109 | Model tank_liqvap |
---|
| 110 | PARAMETERS |
---|
| 111 | outer PP as Plugin(Brief="External physical properties", Type="PP"); |
---|
| 112 | outer NComp as Integer (Brief="Number of components", Default=1); |
---|
| 113 | |
---|
| 114 | VARIABLES |
---|
| 115 | in Inlet as stream; # Inlet stream |
---|
| 116 | out OutletmL as liquid_stream; # Intermediary liquid outlet stream |
---|
| 117 | out OutletV as vapour_stream; # Outlet vapour stream |
---|
| 118 | |
---|
| 119 | M(NComp)as mol (Brief="Component molar holdup"); |
---|
| 120 | ML as mol (Brief="Molar liquid holdup"); |
---|
| 121 | MV as mol (Brief="Molar vapour holdup"); |
---|
| 122 | V as volume (Brief="Volume of reactional mixture"); |
---|
| 123 | E as energy (Brief="Internal energy"); |
---|
| 124 | Q as heat_rate (Brief="Reactor duty", Default=0); |
---|
| 125 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 126 | |
---|
| 127 | Across as area (Brief="Tank cross section area"); |
---|
| 128 | Level as length (Brief="Tank level"); |
---|
| 129 | |
---|
| 130 | EQUATIONS |
---|
| 131 | "Component molar balance" |
---|
| 132 | diff(M) = Inlet.F*Inlet.z - (OutletmL.F*OutletmL.z + OutletV.F*OutletV.z); |
---|
| 133 | |
---|
| 134 | "Molar holdup" |
---|
| 135 | M = ML*OutletmL.z + MV*OutletV.z; |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | "Mole fraction normalisation" |
---|
| 139 | sum(OutletmL.z) = 1.0; |
---|
| 140 | |
---|
| 141 | "Mole fraction normalisation" |
---|
| 142 | sum(OutletmL.z) = sum(OutletV.z); |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | "Vapourisation fraction" |
---|
| 146 | OutletV.v = 1.0; |
---|
| 147 | |
---|
| 148 | "Vapourisation fraction" |
---|
| 149 | OutletmL.v = 0.0; |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | "Energy balance" |
---|
| 153 | diff(E) = Inlet.F*Inlet.h - (OutletmL.F*OutletmL.h + OutletV.F*OutletV.h) + Q; |
---|
| 154 | |
---|
| 155 | "Total internal energy" |
---|
| 156 | E = ML*OutletmL.h + MV*OutletV.h; #- OutletmL.P*V; P_tank*V_tank |
---|
| 157 | |
---|
| 158 | "Geometry constraint" |
---|
| 159 | V = ML*vL + MV*PP.VapourVolume(OutletV.T,OutletV.P,OutletV.z); |
---|
| 160 | |
---|
| 161 | |
---|
| 162 | "Chemical Equilibrium" |
---|
| 163 | PP.LiquidFugacityCoefficient(OutletmL.T,OutletmL.P,OutletmL.z)*OutletmL.z = |
---|
| 164 | PP.VapourFugacityCoefficient(OutletV.T,OutletV.P,OutletV.z)*OutletV.z; |
---|
| 165 | |
---|
| 166 | "Mechanical Equilibrium" |
---|
| 167 | OutletmL.P = OutletV.P; |
---|
| 168 | |
---|
| 169 | "Thermal Equilibrium" |
---|
| 170 | OutletmL.T = OutletV.T; |
---|
| 171 | |
---|
| 172 | "Liquid Volume" |
---|
| 173 | vL = PP.LiquidVolume(OutletmL.T,OutletmL.P,OutletmL.z); |
---|
| 174 | |
---|
| 175 | "Tank Level" |
---|
| 176 | ML*vL = Across*Level; |
---|
| 177 | end |
---|