[1008] | 1 | #*------------------------------------------------------------------- |
---|
| 2 | * Biorrefinaria Petrobras |
---|
| 3 | *-------------------------------------------------------------------- |
---|
| 4 | * Nome do arquivo: main_stream.mso |
---|
| 5 | * Projeto: Modelo integrado de producao de etanol 1G/2G |
---|
| 6 | * Conteudo: corrente de materias |
---|
| 7 | *--------------------------------------------------------------------*# |
---|
| 8 | |
---|
| 9 | #*------------------------------------------------------------------- |
---|
| 10 | * |
---|
| 11 | * Versao 2.2 |
---|
| 12 | * Data: 03/2016 |
---|
| 13 | * Autores: Anderson R. A. Lino e Gabriel C. Fonseca |
---|
| 14 | * |
---|
| 15 | *-------------------------------------------------------------------- |
---|
| 16 | *Descricao: modelo da corrente de materiais que sera utilizado |
---|
| 17 | *na simulacao do processo |
---|
| 18 | *-------------------------------------------------------------------- |
---|
| 19 | |
---|
| 20 | *-------------------------------------------------------------------- |
---|
| 21 | * Notas: Os compostos solidos nao soluveis tem sua entalpia representada pela funcao |
---|
| 22 | * vapourEnthalpy. Foi a melhor adaptacao que pode ser feita, pois no caso do |
---|
| 23 | * liquido, mesmo usando o modelo IdealLiquid, o Cp calculado nao eh diretamente |
---|
| 24 | * o Cp calculado pela equacao fornecida no VRTherm. Tambem foram feitos |
---|
| 25 | * dois flowsheets para averiguar o modelo (teste e teste2). |
---|
| 26 | * |
---|
| 27 | * Os modelos de corrente envolvendo solidos nao consideram o equilibrio termodinamico entre |
---|
| 28 | * a fase solida e as fases liquida ou vapor. Desta forma, caso haja uma transicao de fases |
---|
| 29 | * envolvendo a fase solida, o usuario devera representa-la como uma "reacao quimica". |
---|
| 30 | * Neste caso, vale ressaltar que os componentes envolvidos na transicao de fases devem estar |
---|
| 31 | * presentes tanto na fase solida quanto na fase fluida. |
---|
| 32 | *--------------------------------------------------------------------*# |
---|
| 33 | |
---|
| 34 | using "streams"; |
---|
| 35 | |
---|
| 36 | Model fluid as stream |
---|
| 37 | ATTRIBUTES |
---|
| 38 | Pallete = false; |
---|
| 39 | Brief = "Fluid phase of the main stream"; |
---|
| 40 | Info = |
---|
| 41 | "== GENERAL == |
---|
| 42 | This is the model of the fluid part of the main stream. |
---|
| 43 | In addition to the variables already present in the stream model, there are mass flow rate and mass fraction variables"; |
---|
| 44 | |
---|
| 45 | #*------------------------------------------------------------------- |
---|
| 46 | * Parametros |
---|
| 47 | *--------------------------------------------------------------------*# |
---|
| 48 | |
---|
| 49 | PARAMETERS |
---|
| 50 | outer PP as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 51 | M(NComp) as molweight (Brief = "Component Mol Weight (Fluid Phase), Vector Size = NComp", Protected=true); |
---|
| 52 | |
---|
| 53 | #*------------------------------------------------------------------- |
---|
| 54 | * Define o valor dos parametros declarados no modelo |
---|
| 55 | *--------------------------------------------------------------------*# |
---|
| 56 | |
---|
| 57 | SET |
---|
| 58 | M = PP.MolecularWeight(); |
---|
| 59 | |
---|
| 60 | #*------------------------------------------------------------------ |
---|
| 61 | * Declaracao de variaveis |
---|
| 62 | *-------------------------------------------------------------------*# |
---|
| 63 | |
---|
| 64 | VARIABLES |
---|
| 65 | Fw as flow_mass (Brief = "Fluid Phase Mass Flow", Symbol = "F_w"); |
---|
| 66 | zw(NComp) as fraction (Brief = "Fluid Phase Mass Fraction, Vector Size = NComp", Symbol = "z_w"); |
---|
| 67 | Mw as molweight (Brief = "Average Molar Weight", Symbol = "M_w"); |
---|
| 68 | |
---|
| 69 | #*------------------------------------------------------------------- |
---|
| 70 | * Equacoes do modelo |
---|
| 71 | *--------------------------------------------------------------------*# |
---|
| 72 | |
---|
| 73 | EQUATIONS |
---|
| 74 | if Fw equal 0 * 'kg/h' then |
---|
| 75 | "Average Molar Weight (Fluid Phase)" |
---|
| 76 | Mw = 1 * 'kg/kmol'; |
---|
| 77 | |
---|
| 78 | "Conversion Between Mass and Molar Fraction (Fluid Phase)" |
---|
| 79 | zw = z; |
---|
| 80 | |
---|
| 81 | "Conversion Between Mass and Molar Flow (Fluid Phase)" |
---|
| 82 | Fw = F * 'kg/kmol'; |
---|
| 83 | else |
---|
| 84 | "Average Molar Weight (Fluid Phase)" |
---|
| 85 | Mw = sum(z * M); |
---|
| 86 | |
---|
| 87 | "Conversion Between Mass and Molar Fraction (Fluid Phase)" |
---|
| 88 | zw * Mw = z * M * sum(z); |
---|
| 89 | |
---|
| 90 | "Conversion Between Mass and Molar Flow (Fluid Phase)" |
---|
| 91 | Fw = F * Mw; |
---|
| 92 | end |
---|
| 93 | |
---|
| 94 | end |
---|
| 95 | |
---|
| 96 | Model fluid2 as stream |
---|
| 97 | ATTRIBUTES |
---|
| 98 | Pallete = false; |
---|
| 99 | Brief = "Fluid phase of the main stream"; |
---|
| 100 | Info = |
---|
| 101 | "== GENERAL == |
---|
| 102 | This is the model of the fluid part of the main stream. |
---|
| 103 | In addition to the variables already present in the stream model, there are mass flow rate and mass fraction variables"; |
---|
| 104 | |
---|
| 105 | #*------------------------------------------------------------------- |
---|
| 106 | * Parametros |
---|
| 107 | *--------------------------------------------------------------------*# |
---|
| 108 | |
---|
| 109 | PARAMETERS |
---|
| 110 | outer PP as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 111 | M(NComp) as molweight (Brief = "Component Mol Weight (Fluid Phase), Vector Size = NComp", Protected=true); |
---|
| 112 | |
---|
| 113 | #*------------------------------------------------------------------- |
---|
| 114 | * Define o valor dos parametros declarados no modelo |
---|
| 115 | *--------------------------------------------------------------------*# |
---|
| 116 | |
---|
| 117 | SET |
---|
| 118 | M = PP.MolecularWeight(); |
---|
| 119 | |
---|
| 120 | #*------------------------------------------------------------------ |
---|
| 121 | * Declaracao de variaveis |
---|
| 122 | *-------------------------------------------------------------------*# |
---|
| 123 | |
---|
| 124 | VARIABLES |
---|
| 125 | Fw as flow_mass (Brief = "Fluid Phase Mass Flow", Symbol = "F_w"); |
---|
| 126 | zw(NComp) as fraction (Brief = "Fluid Phase Mass Fraction, Vector Size = NComp", Symbol = "z_w"); |
---|
| 127 | # Mw as molweight (Brief = "Average Molar Weight", Symbol = "M_w"); |
---|
| 128 | Mw as Real (Brief = "Molar Weight", Default=75, Lower=1, Upper=1e3, final Unit = 'kg/kmol'); |
---|
| 129 | |
---|
| 130 | #*------------------------------------------------------------------- |
---|
| 131 | * Equacoes do modelo |
---|
| 132 | *--------------------------------------------------------------------*# |
---|
| 133 | |
---|
| 134 | EQUATIONS |
---|
| 135 | if F equal 0 * 'mol/s' then |
---|
| 136 | "Average Molar Weight (Solid Phase)" |
---|
| 137 | #Mw = 10 * 'kg/kmol'; |
---|
| 138 | Mw=sum((z * M)); |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | "Conversion Between Mass and Molar Fraction (Solid Phase)" |
---|
| 142 | #zw = z; |
---|
| 143 | zw * Mw = z * M; |
---|
| 144 | |
---|
| 145 | "Conversion Between Mass and Molar Flow (Solid Phase)" |
---|
| 146 | #Fw = F * 'kg/kmol'; |
---|
| 147 | Fw = 0 *'kg/h'; |
---|
| 148 | |
---|
| 149 | else |
---|
| 150 | "Average Molar Weight (Fluid Phase)" |
---|
| 151 | Mw = sum(z * M); |
---|
| 152 | |
---|
| 153 | "Conversion Between Mass and Molar Fraction (Fluid Phase)" |
---|
| 154 | #zw * Mw = z * M * sum(z); |
---|
| 155 | #zw * Mw = z * M; |
---|
| 156 | |
---|
| 157 | zw*Fw=z*F*M; |
---|
| 158 | |
---|
| 159 | "Conversion Between Mass and Molar Flow (Fluid Phase)" |
---|
| 160 | Fw = F * Mw; |
---|
| 161 | end |
---|
| 162 | |
---|
| 163 | end |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | Model solid |
---|
| 167 | ATTRIBUTES |
---|
| 168 | Pallete = false; |
---|
| 169 | Brief = "Solid phase of the main stream"; |
---|
| 170 | Info = |
---|
| 171 | "== GENERAL == |
---|
| 172 | This is the model of the solid part of the main stream."; |
---|
| 173 | |
---|
| 174 | #*------------------------------------------------------------------- |
---|
| 175 | * Parametros |
---|
| 176 | *--------------------------------------------------------------------*# |
---|
| 177 | |
---|
| 178 | PARAMETERS |
---|
| 179 | outer PPS as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 180 | outer NCompS as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 181 | M(NCompS) as molweight (Brief = "Component Mol Weight (Solid Phase), Vector Size = NCompS", Protected=true); |
---|
| 182 | |
---|
| 183 | #*------------------------------------------------------------------- |
---|
| 184 | * Define o valor dos parametros declarados no modelo |
---|
| 185 | *--------------------------------------------------------------------*# |
---|
| 186 | |
---|
| 187 | SET |
---|
| 188 | M = PPS.MolecularWeight(); |
---|
| 189 | |
---|
| 190 | #*------------------------------------------------------------------ |
---|
| 191 | * Declaracao de variaveis |
---|
| 192 | *-------------------------------------------------------------------*# |
---|
| 193 | |
---|
| 194 | VARIABLES |
---|
| 195 | F as flow_mol (Brief = "Solid Phase Molar Flow", Symbol = "F"); |
---|
| 196 | Fw as flow_mass (Brief = "Solid Phase Mass Flow", Symbol = "F_w"); |
---|
| 197 | z(NCompS) as fraction (Brief = "Solid Phase Molar Fraction, Vector Size = NCompS", Symbol = "z"); |
---|
| 198 | zw(NCompS) as fraction (Brief = "Solid Phase Mass Fraction, Vector Size = NCompS", Symbol = "z_w"); |
---|
| 199 | h as enth_mol (Brief = "Stream Enthalpy", Protected = true); |
---|
| 200 | Mw as molweight (Brief = "Average Molar Weight", Symbol = "M_w"); |
---|
| 201 | |
---|
| 202 | #*------------------------------------------------------------------- |
---|
| 203 | * Equacoes do modelo |
---|
| 204 | *--------------------------------------------------------------------*# |
---|
| 205 | |
---|
| 206 | EQUATIONS |
---|
| 207 | |
---|
| 208 | if Fw equal 0 * 'kg/h' then |
---|
| 209 | "Average Molar Weight (Solid Phase)" |
---|
| 210 | Mw = 10 * 'kg/kmol'; |
---|
| 211 | |
---|
| 212 | "Conversion Between Mass and Molar Fraction (Solid Phase)" |
---|
| 213 | zw = z; |
---|
| 214 | |
---|
| 215 | "Conversion Between Mass and Molar Flow (Solid Phase)" |
---|
| 216 | Fw = F * 'kg/kmol'; |
---|
| 217 | else |
---|
| 218 | "Average Molar Weight (Solid Phase)" |
---|
| 219 | Mw = max([sum(z * M),1*'kg/kmol']); |
---|
| 220 | |
---|
| 221 | |
---|
| 222 | "Conversion Between Mass and Molar Fraction (Solid Phase)" |
---|
| 223 | zw * Mw = z * M * sum(z); |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | "Conversion Between Mass and Molar Flow (Solid Phase)" |
---|
| 227 | Fw = F * Mw; |
---|
| 228 | end |
---|
| 229 | |
---|
| 230 | end |
---|
| 231 | |
---|
| 232 | Model solid2 |
---|
| 233 | ATTRIBUTES |
---|
| 234 | Pallete = false; |
---|
| 235 | Brief = "Solid phase of the main stream"; |
---|
| 236 | Info = |
---|
| 237 | "== GENERAL == |
---|
| 238 | This is the model of the solid part of the main stream."; |
---|
| 239 | |
---|
| 240 | #*------------------------------------------------------------------- |
---|
| 241 | * Parametros |
---|
| 242 | *--------------------------------------------------------------------*# |
---|
| 243 | |
---|
| 244 | PARAMETERS |
---|
| 245 | outer PPS as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 246 | outer NCompS as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 247 | M(NCompS) as molweight (Brief = "Component Mol Weight (Solid Phase), Vector Size = NCompS", Protected=true); |
---|
| 248 | |
---|
| 249 | #*------------------------------------------------------------------- |
---|
| 250 | * Define o valor dos parametros declarados no modelo |
---|
| 251 | *--------------------------------------------------------------------*# |
---|
| 252 | |
---|
| 253 | SET |
---|
| 254 | M = PPS.MolecularWeight(); |
---|
| 255 | |
---|
| 256 | #*------------------------------------------------------------------ |
---|
| 257 | * Declaracao de variaveis |
---|
| 258 | *-------------------------------------------------------------------*# |
---|
| 259 | |
---|
| 260 | VARIABLES |
---|
| 261 | F as flow_mol (Brief = "Solid Phase Molar Flow", Symbol = "F"); |
---|
| 262 | Fw as flow_mass (Brief = "Solid Phase Mass Flow", Symbol = "F_w"); |
---|
| 263 | z(NCompS) as fraction (Brief = "Solid Phase Molar Fraction, Vector Size = NCompS", Symbol = "z"); |
---|
| 264 | zw(NCompS) as fraction (Brief = "Solid Phase Mass Fraction, Vector Size = NCompS", Symbol = "z_w"); |
---|
| 265 | h as enth_mol (Brief = "Stream Enthalpy", Protected = true); |
---|
| 266 | #Mw as molweight (Brief = "Average Molar Weight", Symbol = "M_w"); |
---|
| 267 | Mw as Real (Brief = "Molar Weight", Default=75, Lower=1, Upper=1e3, final Unit = 'kg/kmol'); |
---|
| 268 | #*------------------------------------------------------------------- |
---|
| 269 | * Equacoes do modelo |
---|
| 270 | *--------------------------------------------------------------------*# |
---|
| 271 | |
---|
| 272 | EQUATIONS |
---|
| 273 | |
---|
| 274 | if F equal 0 * 'mol/s' then |
---|
| 275 | "Average Molar Weight (Solid Phase)" |
---|
| 276 | #Mw = 10 * 'kg/kmol'; |
---|
| 277 | Mw=sum((z * M)); |
---|
| 278 | |
---|
| 279 | "Conversion Between Mass and Molar Fraction (Solid Phase)" |
---|
| 280 | #zw = z; |
---|
| 281 | zw * Mw = z * M; |
---|
| 282 | |
---|
| 283 | "Conversion Between Mass and Molar Flow (Solid Phase)" |
---|
| 284 | #Fw = F * 'kg/kmol'; |
---|
| 285 | Fw = 0 *'kg/h'; |
---|
| 286 | else |
---|
| 287 | "Average Molar Weight (Solid Phase)" |
---|
| 288 | #Mw = max([sum(z * M),1*'kg/kmol']); |
---|
| 289 | Mw=sum((z * M)); |
---|
| 290 | |
---|
| 291 | "Conversion Between Mass and Molar Fraction (Solid Phase)" |
---|
| 292 | #zw * Mw = z * M * sum(z); |
---|
| 293 | zw*Fw=z*F*M; |
---|
| 294 | #zw * Mw = z * M; |
---|
| 295 | |
---|
| 296 | "Conversion Between Mass and Molar Flow (Solid Phase)" |
---|
| 297 | Fw = F * Mw; |
---|
| 298 | end |
---|
| 299 | |
---|
| 300 | end |
---|
| 301 | |
---|
| 302 | Model total |
---|
| 303 | ATTRIBUTES |
---|
| 304 | Pallete = false; |
---|
| 305 | Brief = "Totals of main stream mixing solid and fluid phases"; |
---|
| 306 | Info = |
---|
| 307 | "== GENERAL == |
---|
| 308 | This is the model of the totals in the main stream mixing solid and fluid phases."; |
---|
| 309 | |
---|
| 310 | #*------------------------------------------------------------------- |
---|
| 311 | * Parametros |
---|
| 312 | *--------------------------------------------------------------------*# |
---|
| 313 | |
---|
| 314 | PARAMETERS |
---|
| 315 | outer NCompT as Integer (Brief = "Number of Chemical Components", Lower = 1); |
---|
| 316 | outer NComp as Integer (Brief = "Number of Chemical Components", Lower = 1); |
---|
| 317 | outer NCompS as Integer (Brief = "Number of Chemical Components", Lower = 1); |
---|
| 318 | |
---|
| 319 | #*------------------------------------------------------------------ |
---|
| 320 | * Declaracao de variaveis |
---|
| 321 | *-------------------------------------------------------------------*# |
---|
| 322 | |
---|
| 323 | VARIABLES |
---|
| 324 | F as flow_mol (Brief = "Total Molar Flow", Symbol = "F"); |
---|
| 325 | Fw as flow_mass (Brief = "Total Mass Flow", Symbol = "F_w"); |
---|
| 326 | #z(NCompT) as fraction (Brief = "Total Molar Fraction, Vector Size = NCompT", Symbol = "z"); |
---|
| 327 | z(NComp + NCompS) as fraction (Brief = "Total Molar Fraction, Vector Size = NCompT", Symbol = "z"); |
---|
| 328 | zw(NComp + NCompS) as fraction (Brief = "Total Mass Fraction, Vector Size = NCompT", Symbol = "z_w"); |
---|
| 329 | |
---|
| 330 | end |
---|
| 331 | |
---|
| 332 | Model main_stream |
---|
| 333 | ATTRIBUTES |
---|
| 334 | Pallete = false; |
---|
| 335 | Brief = "General matter stream containing solid and fluid phase"; |
---|
| 336 | Info = |
---|
| 337 | "== GENERAL == |
---|
| 338 | This stream should be used when solids are present. |
---|
| 339 | The stream was separated in two phases: Fluid and Solid. |
---|
| 340 | Both phases have variables for the flow rate (both mass and molar), enthalpy (molar) and mass and molar fractions. |
---|
| 341 | Additionaly, the total flow rate (mass and molar) and mass and molar fractions are also calculated. |
---|
| 342 | Note that the enthalpy of the solid phase is calculated through a call to the VapourEnthalpy method of VRTherm. |
---|
| 343 | |
---|
| 344 | == ASSUMPTIONS == |
---|
| 345 | This model does not consider equilibrium between the solid phase and the fluid phase (both liquid and vapour). |
---|
| 346 | Therefore, if a phase transition involving the solid phase occours, the user should represent it as a 'chemical reaction'. |
---|
| 347 | Note that for the phase transition to be represented, the compounds involved should be present both in the fluid and solid phases. |
---|
| 348 | "; |
---|
| 349 | |
---|
| 350 | #*------------------------------------------------------------------- |
---|
| 351 | * Parametros |
---|
| 352 | *--------------------------------------------------------------------*# |
---|
| 353 | |
---|
| 354 | PARAMETERS |
---|
| 355 | NCompT as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 356 | |
---|
| 357 | #*------------------------------------------------------------------- |
---|
| 358 | * Define o valor dos parametros declarados no modelo |
---|
| 359 | *--------------------------------------------------------------------*# |
---|
| 360 | |
---|
| 361 | SET |
---|
| 362 | NCompT = Solid.NCompS + Fluid.NComp; |
---|
| 363 | #NCompT = 3; |
---|
| 364 | |
---|
| 365 | #*------------------------------------------------------------------- |
---|
| 366 | * Declaracao de variaveis |
---|
| 367 | *--------------------------------------------------------------------*# |
---|
| 368 | |
---|
| 369 | VARIABLES |
---|
| 370 | Fluid as fluid (Brief = "Fluid phase of the stream", Symbol = "^{Fluid}"); |
---|
| 371 | Solid as solid (Brief = "Solid phase of the stream", Symbol = "^{Solid}"); |
---|
| 372 | Total as total (Brief = "Overall stream", Symbol = "^{Total}"); |
---|
| 373 | T as temperature (Brief = "Stream Temperature"); |
---|
| 374 | P as pressure (Brief = "Stream Pressure"); |
---|
| 375 | v as fraction (Brief = "Vapour fraction of the fluid phase"); |
---|
| 376 | |
---|
| 377 | EQUATIONS |
---|
| 378 | "Thermical equilibrium between fluid and solid phases" |
---|
| 379 | T = Fluid.T; |
---|
| 380 | |
---|
| 381 | "Mechanical equilibrium between fluid and solid phases" |
---|
| 382 | P = Fluid.P; |
---|
| 383 | |
---|
| 384 | "Vapour fraction" |
---|
| 385 | v = Fluid.v; |
---|
| 386 | |
---|
| 387 | "Calculation of mass flow" |
---|
| 388 | Total.Fw = Solid.Fw + Fluid.Fw; |
---|
| 389 | |
---|
| 390 | "Calculation of molar flow" |
---|
| 391 | Total.F = Solid.F + Fluid.F; |
---|
| 392 | |
---|
| 393 | if Total.Fw equal 0*'kg/s' then |
---|
| 394 | |
---|
| 395 | "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 396 | Total.zw(1) = 1; |
---|
| 397 | |
---|
| 398 | "Calculation of zw for the Solid Phase (NComp)" |
---|
| 399 | Total.zw(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 400 | |
---|
| 401 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 402 | Total.z(1) = 1; |
---|
| 403 | |
---|
| 404 | "Calculation of z for the Solid Phase (NComp)" |
---|
| 405 | Total.z(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 406 | |
---|
| 407 | else |
---|
| 408 | |
---|
| 409 | "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 410 | Total.zw(1:Fluid.NComp) * Total.Fw = Fluid.zw * Fluid.Fw; |
---|
| 411 | |
---|
| 412 | "Calculation of zw for the Solid Phase (NComp)" |
---|
| 413 | Total.zw([Fluid.NComp+1:Fluid.NComp+Solid.NCompS]) * Total.Fw = Solid.zw * Solid.Fw; |
---|
| 414 | |
---|
| 415 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 416 | Total.F * Total.z(1:Fluid.NComp) = Fluid.F * Fluid.z; |
---|
| 417 | |
---|
| 418 | "Calculation of z for the Solid Phase (NComp)" |
---|
| 419 | Total.F * Total.z([Fluid.NComp+1:Solid.NCompS + Fluid.NComp]) = Solid.F * Solid.z; |
---|
| 420 | |
---|
| 421 | end |
---|
| 422 | |
---|
| 423 | end |
---|
| 424 | |
---|
| 425 | Model main_stream2 |
---|
| 426 | ATTRIBUTES |
---|
| 427 | Pallete = false; |
---|
| 428 | Brief = "General matter stream containing solid and fluid phase"; |
---|
| 429 | Info = |
---|
| 430 | "== GENERAL == |
---|
| 431 | This stream should be used when solids are present. |
---|
| 432 | The stream was separated in two phases: Fluid and Solid. |
---|
| 433 | Both phases have variables for the flow rate (both mass and molar), enthalpy (molar) and mass and molar fractions. |
---|
| 434 | Additionaly, the total flow rate (mass and molar) and mass and molar fractions are also calculated. |
---|
| 435 | Note that the enthalpy of the solid phase is calculated through a call to the VapourEnthalpy method of VRTherm. |
---|
| 436 | |
---|
| 437 | == ASSUMPTIONS == |
---|
| 438 | This model does not consider equilibrium between the solid phase and the fluid phase (both liquid and vapour). |
---|
| 439 | Therefore, if a phase transition involving the solid phase occours, the user should represent it as a 'chemical reaction'. |
---|
| 440 | Note that for the phase transition to be represented, the compounds involved should be present both in the fluid and solid phases. |
---|
| 441 | "; |
---|
| 442 | |
---|
| 443 | #*------------------------------------------------------------------- |
---|
| 444 | * Parametros |
---|
| 445 | *--------------------------------------------------------------------*# |
---|
| 446 | |
---|
| 447 | PARAMETERS |
---|
| 448 | NCompT as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 449 | |
---|
| 450 | #*------------------------------------------------------------------- |
---|
| 451 | * Define o valor dos parametros declarados no modelo |
---|
| 452 | *--------------------------------------------------------------------*# |
---|
| 453 | |
---|
| 454 | SET |
---|
| 455 | NCompT = Solid.NCompS + Fluid.NComp; |
---|
| 456 | |
---|
| 457 | #*------------------------------------------------------------------- |
---|
| 458 | * Declaracao de variaveis |
---|
| 459 | *--------------------------------------------------------------------*# |
---|
| 460 | |
---|
| 461 | VARIABLES |
---|
| 462 | Fluid as fluid2 (Brief = "Fluid phase of the stream", Symbol = "^{Fluid}"); |
---|
| 463 | Solid as solid2 (Brief = "Solid phase of the stream", Symbol = "^{Solid}"); |
---|
| 464 | Total as total (Brief = "Overall stream", Symbol = "^{Total}"); |
---|
| 465 | T as temperature (Brief = "Stream Temperature"); |
---|
| 466 | P as pressure (Brief = "Stream Pressure"); |
---|
| 467 | v as fraction (Brief = "Vapour fraction of the fluid phase"); |
---|
| 468 | |
---|
| 469 | EQUATIONS |
---|
| 470 | "Thermical equilibrium between fluid and solid phases" |
---|
| 471 | T = Fluid.T; |
---|
| 472 | |
---|
| 473 | "Mechanical equilibrium between fluid and solid phases" |
---|
| 474 | P = Fluid.P; |
---|
| 475 | |
---|
| 476 | "Vapour fraction" |
---|
| 477 | v = Fluid.v; |
---|
| 478 | |
---|
| 479 | "Calculation of mass flow" |
---|
| 480 | Total.Fw = Solid.Fw + Fluid.Fw; |
---|
| 481 | |
---|
| 482 | |
---|
| 483 | "Calculation of molar flow" |
---|
| 484 | Total.F = Solid.F + Fluid.F; |
---|
| 485 | |
---|
| 486 | if Total.Fw equal 0*'kg/s' then |
---|
| 487 | |
---|
| 488 | "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 489 | Total.zw(1) = 1; |
---|
| 490 | |
---|
| 491 | "Calculation of zw for the Solid Phase (NComp)" |
---|
| 492 | Total.zw(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 493 | |
---|
| 494 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 495 | Total.z(1) = 1; |
---|
| 496 | |
---|
| 497 | "Calculation of z for the Solid Phase (NComp)" |
---|
| 498 | Total.z(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 499 | |
---|
| 500 | else |
---|
| 501 | |
---|
| 502 | "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 503 | Total.zw(1:Fluid.NComp) * Total.Fw = Fluid.zw * Fluid.Fw; |
---|
| 504 | |
---|
| 505 | "Calculation of zw for the Solid Phase (NCompS)" |
---|
| 506 | Total.zw([Fluid.NComp+1:Fluid.NComp+Solid.NCompS]) * Total.Fw = Solid.zw * Solid.Fw; |
---|
| 507 | |
---|
| 508 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 509 | Total.F * Total.z(1:Fluid.NComp) = Fluid.F * Fluid.z; |
---|
| 510 | |
---|
| 511 | "Calculation of z for the Solid Phase (NCompS)" |
---|
| 512 | Total.F * Total.z([Fluid.NComp+1:NCompT]) = Solid.F * Solid.z; |
---|
| 513 | |
---|
| 514 | end |
---|
| 515 | |
---|
| 516 | end |
---|
| 517 | |
---|
| 518 | Model main_stream_PH as main_stream |
---|
| 519 | ATTRIBUTES |
---|
| 520 | Brief = "Main Stream With Built-in Flash Calculation"; |
---|
| 521 | Info = |
---|
| 522 | "== GENERAL == |
---|
| 523 | This model should be used when the vaporization fraction |
---|
| 524 | is unknown. |
---|
| 525 | |
---|
| 526 | The built-in flash calculation will determine the stream |
---|
| 527 | state as a function of the overall composition '''z''', the |
---|
| 528 | pressure '''P''' and the enthalpy '''h'''. |
---|
| 529 | |
---|
| 530 | Additionally, the liquid composition '''x''' and the vapor |
---|
| 531 | composition '''y''' are calculated. |
---|
| 532 | "; |
---|
| 533 | Pallete = false; |
---|
| 534 | |
---|
| 535 | |
---|
| 536 | #*------------------------------------------------------------------- |
---|
| 537 | * Declaracao de variaveis |
---|
| 538 | *--------------------------------------------------------------------*# |
---|
| 539 | |
---|
| 540 | VARIABLES |
---|
| 541 | x(Fluid.NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 542 | y(Fluid.NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 543 | |
---|
| 544 | #*------------------------------------------------------------------- |
---|
| 545 | * Equacoes do modelo |
---|
| 546 | *--------------------------------------------------------------------*# |
---|
| 547 | |
---|
| 548 | EQUATIONS |
---|
| 549 | "Flash Calculation, array = [v, x, y]" |
---|
| 550 | [v, x, y] = Fluid.PP.FlashPH(P, Fluid.h, Fluid.z); |
---|
| 551 | |
---|
| 552 | "Fluid Phase Molar Enthalpy" |
---|
| 553 | Fluid.h = (1-v)*Fluid.PP.LiquidEnthalpy(T, P, x) + v*Fluid.PP.VapourEnthalpy(T, P, y); |
---|
| 554 | |
---|
| 555 | "Solid Phase Molar Enthalpy" |
---|
| 556 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 557 | |
---|
| 558 | end |
---|
| 559 | |
---|
| 560 | Model main_stream_eq as main_stream |
---|
| 561 | |
---|
| 562 | ATTRIBUTES |
---|
| 563 | Brief = "Main Stream With Specified State"; |
---|
| 564 | Info = |
---|
| 565 | "== GENERAL == |
---|
| 566 | This stream should be used when the state is known: Liquid or Vapour. |
---|
| 567 | This will determine the VRTherm method used to calculate the fluid phase enthalpy. |
---|
| 568 | "; |
---|
| 569 | Pallete = false; |
---|
| 570 | |
---|
| 571 | #*------------------------------------------------------------------- |
---|
| 572 | * Parametros |
---|
| 573 | *--------------------------------------------------------------------*# |
---|
| 574 | |
---|
| 575 | PARAMETERS |
---|
| 576 | Phase as Switcher (Brief = "Stream Phase for enthalpy calculation", Valid = ["Liquid", "Vapour"], Default = "Liquid"); |
---|
| 577 | |
---|
| 578 | #*------------------------------------------------------------------- |
---|
| 579 | * Equacoes do modelo |
---|
| 580 | *--------------------------------------------------------------------*# |
---|
| 581 | |
---|
| 582 | EQUATIONS |
---|
| 583 | |
---|
| 584 | switch Phase |
---|
| 585 | |
---|
| 586 | case "Liquid": |
---|
| 587 | |
---|
| 588 | "Fluid Phase Molar Enthalpy" |
---|
| 589 | Fluid.h = Fluid.PP.LiquidEnthalpy(T, P, Fluid.z); |
---|
| 590 | |
---|
| 591 | "Vapour fraction" |
---|
| 592 | v = 0; |
---|
| 593 | |
---|
| 594 | case "Vapour": |
---|
| 595 | |
---|
| 596 | "Fluid Phase Molar Enthalpy" |
---|
| 597 | Fluid.h = Fluid.PP.VapourEnthalpy(T, P, Fluid.z); |
---|
| 598 | |
---|
| 599 | "Vapour fraction" |
---|
| 600 | v = 1; |
---|
| 601 | |
---|
| 602 | end |
---|
| 603 | |
---|
| 604 | "Solid Phase Molar Enthalpy" |
---|
| 605 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 606 | |
---|
| 607 | end |
---|
| 608 | |
---|
| 609 | Model main_stream_eq2 as main_stream2 |
---|
| 610 | |
---|
| 611 | ATTRIBUTES |
---|
| 612 | Brief = "Main Stream With Specified State"; |
---|
| 613 | Info = |
---|
| 614 | "== GENERAL == |
---|
| 615 | This stream should be used when the state is known: Liquid or Vapour. |
---|
| 616 | This will determine the VRTherm method used to calculate the fluid phase enthalpy. |
---|
| 617 | "; |
---|
| 618 | Pallete = false; |
---|
| 619 | |
---|
| 620 | #*------------------------------------------------------------------- |
---|
| 621 | * Parametros |
---|
| 622 | *--------------------------------------------------------------------*# |
---|
| 623 | |
---|
| 624 | PARAMETERS |
---|
| 625 | Phase as Switcher (Brief = "Stream Phase for enthalpy calculation", Valid = ["Liquid", "Vapour"], Default = "Liquid"); |
---|
| 626 | |
---|
| 627 | #*------------------------------------------------------------------- |
---|
| 628 | * Equacoes do modelo |
---|
| 629 | *--------------------------------------------------------------------*# |
---|
| 630 | |
---|
| 631 | EQUATIONS |
---|
| 632 | |
---|
| 633 | switch Phase |
---|
| 634 | |
---|
| 635 | case "Liquid": |
---|
| 636 | |
---|
| 637 | "Fluid Phase Molar Enthalpy" |
---|
| 638 | Fluid.h = Fluid.PP.LiquidEnthalpy(T, P, Fluid.z); |
---|
| 639 | |
---|
| 640 | "Vapour fraction" |
---|
| 641 | v = 0; |
---|
| 642 | |
---|
| 643 | case "Vapour": |
---|
| 644 | |
---|
| 645 | "Fluid Phase Molar Enthalpy" |
---|
| 646 | Fluid.h = Fluid.PP.VapourEnthalpy(T, P, Fluid.z); |
---|
| 647 | |
---|
| 648 | "Vapour fraction" |
---|
| 649 | v = 1; |
---|
| 650 | |
---|
| 651 | end |
---|
| 652 | |
---|
| 653 | "Solid Phase Molar Enthalpy" |
---|
| 654 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 655 | |
---|
| 656 | end |
---|
| 657 | |
---|
| 658 | Model main_sourceR |
---|
| 659 | ATTRIBUTES |
---|
| 660 | Pallete = true; |
---|
| 661 | Icon = "icon/massR"; |
---|
| 662 | Brief = "Main Stream Source"; |
---|
| 663 | Info = |
---|
| 664 | "== GENERAL == |
---|
| 665 | This model should be used for boundary streams. |
---|
| 666 | Usually these streams are known and come from other process |
---|
| 667 | units. |
---|
| 668 | |
---|
| 669 | == SPECIFY == |
---|
| 670 | * Molar or mass flow (for both fluid and solid phases); |
---|
| 671 | * Temperature; |
---|
| 672 | * Pressure; |
---|
| 673 | * Molar or mass composition (for both fluid and solid phases). |
---|
| 674 | |
---|
| 675 | == ADITIONAL INFORMATION == |
---|
| 676 | * Mass density (fluid phase); |
---|
| 677 | * Mass and molar flow; |
---|
| 678 | * Mass and molar compostions; |
---|
| 679 | * Specific volume (fluid phase); |
---|
| 680 | * Vapour fraction (fluid phase); |
---|
| 681 | * Volumetric flow (fluid phase); |
---|
| 682 | * Liquid and Vapour compositions (fluid phase). |
---|
| 683 | "; |
---|
| 684 | |
---|
| 685 | #*------------------------------------------------------------------- |
---|
| 686 | #Parametros |
---|
| 687 | *--------------------------------------------------------------------*# |
---|
| 688 | |
---|
| 689 | PARAMETERS |
---|
| 690 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
| 691 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
| 692 | |
---|
| 693 | #*------------------------------------------------------------------- |
---|
| 694 | * Declaracao de variaveis |
---|
| 695 | *--------------------------------------------------------------------*# |
---|
| 696 | |
---|
| 697 | VARIABLES |
---|
| 698 | |
---|
| 699 | out Outlet as main_stream (Brief = "Outlet Stream", PosY = 0.5256, PosX = 1.0, Symbol="_{out}", Protected=true); |
---|
| 700 | Fluid as fluid; |
---|
| 701 | Solid as solid; |
---|
| 702 | |
---|
| 703 | CompositionOfFluid(Fluid.NComp) as positive (Brief = "Stream Composition (Fluid Phase)"); |
---|
| 704 | SumOfCompositionOfFluid as positive (Brief = "Sum of Stream Composition (Fluid Phase)", Protected=true); |
---|
| 705 | |
---|
| 706 | CompositionOfSolid(Solid.NCompS) as positive (Brief = "Stream Composition (Solid Phase)"); |
---|
| 707 | SumOfCompositionOfSolid as positive (Brief = "Sum of Stream Composition (Solid Phase)", Protected=true); |
---|
| 708 | |
---|
| 709 | Fvol as flow_vol (Brief = "Volumetric flow (Fluid phase)"); |
---|
| 710 | T as temperature (Brief = "Stream Temperature"); |
---|
| 711 | T_Cdeg as Real (Brief = "Temperature in Celsius", Lower=-250, Upper=5000); |
---|
| 712 | P as pressure (Brief = "Stream Pressure"); |
---|
| 713 | |
---|
| 714 | x(Fluid.NComp) as fraction (Brief = "Liquid Molar Fraction", Hidden=true); |
---|
| 715 | y(Fluid.NComp) as fraction (Brief = "Vapour Molar Fraction", Hidden=true); |
---|
| 716 | |
---|
| 717 | vm as volume_mol (Brief = "Molar Volume (Fluid Phase)", Protected=true); |
---|
| 718 | rho as dens_mass (Brief = "Stream Mass Density (Fluid Phase)", Protected=true); |
---|
| 719 | rhom as dens_mol (Brief = "Stream Molar Density (Fluid Phase)", Protected=true); |
---|
| 720 | #*------------------------------------------------------------------- |
---|
| 721 | * Equacoes do modelo |
---|
| 722 | *--------------------------------------------------------------------*# |
---|
| 723 | |
---|
| 724 | EQUATIONS |
---|
| 725 | |
---|
| 726 | switch CompositionBasis |
---|
| 727 | |
---|
| 728 | case "Molar": |
---|
| 729 | "Fluid Phase Molar Composition" |
---|
| 730 | Fluid.z = CompositionOfFluid/sum(CompositionOfFluid); |
---|
| 731 | |
---|
| 732 | "Solid Phase Molar Composition" |
---|
| 733 | Solid.z = CompositionOfSolid/sum(CompositionOfSolid); |
---|
| 734 | |
---|
| 735 | case "Mass": |
---|
| 736 | "Fluid Phase Mass Composition" |
---|
| 737 | Fluid.zw = CompositionOfFluid/sum(CompositionOfFluid); |
---|
| 738 | |
---|
| 739 | "Solid Phase Mass Composition" |
---|
| 740 | Solid.zw = CompositionOfSolid/sum(CompositionOfSolid); |
---|
| 741 | |
---|
| 742 | end |
---|
| 743 | |
---|
| 744 | switch ValidPhases |
---|
| 745 | |
---|
| 746 | case "Liquid-Only": |
---|
| 747 | |
---|
| 748 | "Vapour Fraction" |
---|
| 749 | Fluid.v = 0; |
---|
| 750 | |
---|
| 751 | "Liquid Composition" |
---|
| 752 | x = Fluid.z; |
---|
| 753 | |
---|
| 754 | "Vapour Composition" |
---|
| 755 | y = Fluid.z; |
---|
| 756 | |
---|
| 757 | "Fluid Phase Molar Enthalpy" |
---|
| 758 | Fluid.h = Fluid.PP.LiquidEnthalpy(T, P, x); |
---|
| 759 | |
---|
| 760 | "Molar Volume" |
---|
| 761 | vm = Fluid.PP.LiquidVolume(T, P, Fluid.z); |
---|
| 762 | |
---|
| 763 | case "Vapour-Only": |
---|
| 764 | |
---|
| 765 | " Vapor Fraction" |
---|
| 766 | Fluid.v = 1; |
---|
| 767 | |
---|
| 768 | "Liquid Composition" |
---|
| 769 | x = Fluid.z; |
---|
| 770 | |
---|
| 771 | "Vapour Composition" |
---|
| 772 | y = Fluid.z; |
---|
| 773 | |
---|
| 774 | "Fluid Phase Molar Enthalpy" |
---|
| 775 | Fluid.h = Fluid.PP.VapourEnthalpy(T, P, y); |
---|
| 776 | |
---|
| 777 | "Fluid Phase Molar Volume" |
---|
| 778 | vm = Fluid.PP.VapourVolume(T, P, y); |
---|
| 779 | |
---|
| 780 | case "Vapour-Liquid": |
---|
| 781 | |
---|
| 782 | "Flash Calculation (Fluid Phase), array = [Outlet.v, x, y]" |
---|
| 783 | [Fluid.v, x, y] = Fluid.PP.Flash(T, P, Fluid.z); |
---|
| 784 | |
---|
| 785 | "Fluid Phase Molar Enthalpy" |
---|
| 786 | Fluid.h = (1-Fluid.v)*Fluid.PP.LiquidEnthalpy(T, P, x) + Fluid.v*Fluid.PP.VapourEnthalpy(T, P, y); |
---|
| 787 | |
---|
| 788 | "Molar Volume for the Fluid Phase" |
---|
| 789 | vm = (1-Fluid.v)*Fluid.PP.LiquidVolume(T, P, x) + Fluid.v*Fluid.PP.VapourVolume(T, P, y); |
---|
| 790 | |
---|
| 791 | end |
---|
| 792 | |
---|
| 793 | "Solid Phase Molar Enthalpy" |
---|
| 794 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 795 | |
---|
| 796 | "Sum of Composition for the Fluid Phase" |
---|
| 797 | SumOfCompositionOfFluid = sum(CompositionOfFluid); |
---|
| 798 | |
---|
| 799 | "Sum of Composition for the Solid Phase" |
---|
| 800 | SumOfCompositionOfSolid = sum(CompositionOfSolid); |
---|
| 801 | |
---|
| 802 | "Fluid Phase Molar Density" |
---|
| 803 | rhom * vm = 1; |
---|
| 804 | |
---|
| 805 | "Mass or Molar Density (Fluid Phase)" |
---|
| 806 | rhom * Fluid.Mw = rho; |
---|
| 807 | |
---|
| 808 | "Volumetric Flow (Fluid Phase)" |
---|
| 809 | Fvol = Fluid.F * vm ; |
---|
| 810 | |
---|
| 811 | "Temperature in Celsius Degree" |
---|
| 812 | T_Cdeg = T/'K' - 273.15; |
---|
| 813 | |
---|
| 814 | "Shortcut for temperature" |
---|
| 815 | T = Outlet.T; |
---|
| 816 | |
---|
| 817 | "Shortcut for pressure" |
---|
| 818 | P = Outlet.P; |
---|
| 819 | |
---|
| 820 | "Shortcut for mass flow of fluid" |
---|
| 821 | Fluid.Fw = Outlet.Fluid.Fw; |
---|
| 822 | |
---|
| 823 | "Shortcut for mass fraction of fluid" |
---|
| 824 | Fluid.zw = Outlet.Fluid.zw; |
---|
| 825 | |
---|
| 826 | "Shortcut for temperature of fluid" |
---|
| 827 | Fluid.T = Outlet.Fluid.T; |
---|
| 828 | |
---|
| 829 | "Shortcut for pressure of fluid" |
---|
| 830 | Fluid.P = Outlet.Fluid.P; |
---|
| 831 | |
---|
| 832 | "Shortcut for enthalpy of fluid" |
---|
| 833 | Fluid.h = Outlet.Fluid.h; |
---|
| 834 | |
---|
| 835 | "Shortcut for vapour fraction fluid" |
---|
| 836 | Fluid.v = Outlet.Fluid.v; |
---|
| 837 | |
---|
| 838 | "Shortcut for mass flow of solid" |
---|
| 839 | Solid.Fw = Outlet.Solid.Fw; |
---|
| 840 | |
---|
| 841 | "Shortcut for mass fraction of solid" |
---|
| 842 | Solid.zw = Outlet.Solid.zw; |
---|
| 843 | |
---|
| 844 | "Shortcut for enthalpy of solid" |
---|
| 845 | Solid.h = Outlet.Solid.h; |
---|
| 846 | |
---|
| 847 | end |
---|
| 848 | |
---|
| 849 | Model main_sourceL |
---|
| 850 | ATTRIBUTES |
---|
| 851 | Pallete = true; |
---|
| 852 | Icon = "icon/massL"; |
---|
| 853 | Brief = "Solid Stream Source"; |
---|
| 854 | Info = |
---|
| 855 | "== GENERAL == |
---|
| 856 | This model should be used for boundary streams. |
---|
| 857 | Usually these streams are known and come from other process |
---|
| 858 | units. |
---|
| 859 | |
---|
| 860 | == SPECIFY == |
---|
| 861 | * Molar or mass flow (for both fluid and solid phases); |
---|
| 862 | * Temperature; |
---|
| 863 | * Pressure; |
---|
| 864 | * Molar or mass composition (for both fluid and solid phases). |
---|
| 865 | |
---|
| 866 | == ADITIONAL INFORMATION == |
---|
| 867 | * Mass density (fluid phase); |
---|
| 868 | * Mass and molar flow; |
---|
| 869 | * Mass and molar compostions; |
---|
| 870 | * Specific volume (fluid phase); |
---|
| 871 | * Vapour fraction (fluid phase); |
---|
| 872 | * Volumetric flow (fluid phase); |
---|
| 873 | * Liquid and Vapour compositions (fluid phase). |
---|
| 874 | "; |
---|
| 875 | |
---|
| 876 | #*------------------------------------------------------------------- |
---|
| 877 | #Parametros |
---|
| 878 | *--------------------------------------------------------------------*# |
---|
| 879 | |
---|
| 880 | PARAMETERS |
---|
| 881 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
| 882 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
| 883 | |
---|
| 884 | #*------------------------------------------------------------------- |
---|
| 885 | * Declaracao de variaveis |
---|
| 886 | *--------------------------------------------------------------------*# |
---|
| 887 | |
---|
| 888 | VARIABLES |
---|
| 889 | |
---|
| 890 | out Outlet as main_stream (Brief = "Outlet Stream", PosY = 0.5256, PosX = 0.0, Symbol="_{out}", Protected=true); |
---|
| 891 | Fluid as fluid; |
---|
| 892 | Solid as solid; |
---|
| 893 | |
---|
| 894 | CompositionOfFluid(Fluid.NComp) as positive (Brief = "Stream Composition (Fluid Phase)"); |
---|
| 895 | SumOfCompositionOfFluid as positive (Brief = "Sum of Stream Composition (Fluid Phase)", Protected=true); |
---|
| 896 | |
---|
| 897 | CompositionOfSolid(Solid.NCompS) as positive (Brief = "Stream Composition (Solid Phase)"); |
---|
| 898 | SumOfCompositionOfSolid as positive (Brief = "Sum of Stream Composition (Solid Phase)", Protected=true); |
---|
| 899 | |
---|
| 900 | Fvol as flow_vol (Brief = "Volumetric flow (Fluid phase)"); |
---|
| 901 | T as temperature (Brief = "Stream Temperature"); |
---|
| 902 | T_Cdeg as Real (Brief = "Temperature in Celsius", Lower=-250, Upper=5000); |
---|
| 903 | P as pressure (Brief = "Stream Pressure"); |
---|
| 904 | |
---|
| 905 | x(Outlet.Fluid.NComp) as fraction (Brief = "Liquid Molar Fraction", Hidden=true); |
---|
| 906 | y(Outlet.Fluid.NComp) as fraction (Brief = "Vapour Molar Fraction", Hidden=true); |
---|
| 907 | |
---|
| 908 | vm as volume_mol (Brief = "Molar Volume (Fluid Phase)", Protected=true); |
---|
| 909 | rho as dens_mass (Brief = "Stream Mass Density (Fluid Phase)", Protected=true); |
---|
| 910 | rhom as dens_mol (Brief = "Stream Molar Density (Fluid Phase)", Protected=true); |
---|
| 911 | #*------------------------------------------------------------------- |
---|
| 912 | * Equacoes do modelo |
---|
| 913 | *--------------------------------------------------------------------*# |
---|
| 914 | |
---|
| 915 | EQUATIONS |
---|
| 916 | |
---|
| 917 | switch CompositionBasis |
---|
| 918 | |
---|
| 919 | case "Molar": |
---|
| 920 | "Fluid Phase Molar Composition" |
---|
| 921 | Fluid.z = CompositionOfFluid/sum(CompositionOfFluid); |
---|
| 922 | |
---|
| 923 | "Solid Phase Molar Composition" |
---|
| 924 | Solid.z = CompositionOfSolid/sum(CompositionOfSolid); |
---|
| 925 | |
---|
| 926 | case "Mass": |
---|
| 927 | "Fluid Phase Mass Composition" |
---|
| 928 | Fluid.zw = CompositionOfFluid/sum(CompositionOfFluid); |
---|
| 929 | |
---|
| 930 | "Solid Phase Mass Composition" |
---|
| 931 | Solid.zw = CompositionOfSolid/sum(CompositionOfSolid); |
---|
| 932 | |
---|
| 933 | end |
---|
| 934 | |
---|
| 935 | switch ValidPhases |
---|
| 936 | |
---|
| 937 | case "Liquid-Only": |
---|
| 938 | |
---|
| 939 | "Vapour Fraction" |
---|
| 940 | Fluid.v = 0; |
---|
| 941 | |
---|
| 942 | "Liquid Composition" |
---|
| 943 | x = Fluid.z; |
---|
| 944 | |
---|
| 945 | "Vapour Composition" |
---|
| 946 | y = Fluid.z; |
---|
| 947 | |
---|
| 948 | "Fluid Phase Molar Enthalpy" |
---|
| 949 | Fluid.h = Fluid.PP.LiquidEnthalpy(T, P, x); |
---|
| 950 | |
---|
| 951 | "Molar Volume" |
---|
| 952 | vm = Fluid.PP.LiquidVolume(T, P, Fluid.z); |
---|
| 953 | |
---|
| 954 | case "Vapour-Only": |
---|
| 955 | |
---|
| 956 | " Vapor Fraction" |
---|
| 957 | Fluid.v = 1; |
---|
| 958 | |
---|
| 959 | "Liquid Composition" |
---|
| 960 | x = Fluid.z; |
---|
| 961 | |
---|
| 962 | "Vapour Composition" |
---|
| 963 | y = Fluid.z; |
---|
| 964 | |
---|
| 965 | "Fluid Phase Molar Enthalpy" |
---|
| 966 | Fluid.h = Fluid.PP.VapourEnthalpy(T, P, y); |
---|
| 967 | |
---|
| 968 | "Fluid Phase Molar Volume" |
---|
| 969 | vm = Fluid.PP.VapourVolume(T, P, y); |
---|
| 970 | |
---|
| 971 | case "Vapour-Liquid": |
---|
| 972 | |
---|
| 973 | "Flash Calculation (Fluid Phase), array = [Outlet.v, x, y]" |
---|
| 974 | [Fluid.v, x, y] = Fluid.PP.Flash(T, P, Fluid.z); |
---|
| 975 | |
---|
| 976 | "Fluid Phase Molar Enthalpy" |
---|
| 977 | Fluid.h = (1-Fluid.v)*Fluid.PP.LiquidEnthalpy(T, P, x) + Fluid.v*Fluid.PP.VapourEnthalpy(T, P, y); |
---|
| 978 | |
---|
| 979 | "Molar Volume for the Fluid Phase" |
---|
| 980 | vm = (1-Fluid.v)*Fluid.PP.LiquidVolume(T, P, x) + Fluid.v*Fluid.PP.VapourVolume(T, P, y); |
---|
| 981 | |
---|
| 982 | end |
---|
| 983 | |
---|
| 984 | "Solid Phase Molar Enthalpy" |
---|
| 985 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 986 | |
---|
| 987 | "Sum of Composition for the Fluid Phase" |
---|
| 988 | SumOfCompositionOfFluid = sum(CompositionOfFluid); |
---|
| 989 | |
---|
| 990 | "Sum of Composition for the Solid Phase" |
---|
| 991 | SumOfCompositionOfSolid = sum(CompositionOfSolid); |
---|
| 992 | |
---|
| 993 | "Fluid Phase Molar Density" |
---|
| 994 | rhom * vm = 1; |
---|
| 995 | |
---|
| 996 | "Mass or Molar Density (Fluid Phase)" |
---|
| 997 | rhom * Fluid.Mw = rho; |
---|
| 998 | |
---|
| 999 | "Volumetric Flow (Fluid Phase)" |
---|
| 1000 | Fvol = Fluid.F * vm ; |
---|
| 1001 | |
---|
| 1002 | "Temperature in Celsius Degree" |
---|
| 1003 | T_Cdeg = T/'K' - 273.15; |
---|
| 1004 | |
---|
| 1005 | "Shortcut for temperature" |
---|
| 1006 | T = Outlet.T; |
---|
| 1007 | |
---|
| 1008 | "Shortcut for pressure" |
---|
| 1009 | P = Outlet.P; |
---|
| 1010 | |
---|
| 1011 | "Shortcut for mass flow of fluid" |
---|
| 1012 | Fluid.Fw = Outlet.Fluid.Fw; |
---|
| 1013 | |
---|
| 1014 | "Shortcut for mass fraction of fluid" |
---|
| 1015 | Fluid.zw = Outlet.Fluid.zw; |
---|
| 1016 | |
---|
| 1017 | "Shortcut for temperature of fluid" |
---|
| 1018 | Fluid.T = Outlet.Fluid.T; |
---|
| 1019 | |
---|
| 1020 | "Shortcut for pressure of fluid" |
---|
| 1021 | Fluid.P = Outlet.Fluid.P; |
---|
| 1022 | |
---|
| 1023 | "Shortcut for enthalpy of fluid" |
---|
| 1024 | Fluid.h = Outlet.Fluid.h; |
---|
| 1025 | |
---|
| 1026 | "Shortcut for vapour fraction fluid" |
---|
| 1027 | Fluid.v = Outlet.Fluid.v; |
---|
| 1028 | |
---|
| 1029 | "Shortcut for mass flow of solid" |
---|
| 1030 | Solid.Fw = Outlet.Solid.Fw; |
---|
| 1031 | |
---|
| 1032 | "Shortcut for mass fraction of solid" |
---|
| 1033 | Solid.zw = Outlet.Solid.zw; |
---|
| 1034 | |
---|
| 1035 | "Shortcut for enthalpy of solid" |
---|
| 1036 | Solid.h = Outlet.Solid.h; |
---|
| 1037 | |
---|
| 1038 | end |
---|
| 1039 | |
---|
| 1040 | Model main_sinkR |
---|
| 1041 | ATTRIBUTES |
---|
| 1042 | Pallete = true; |
---|
| 1043 | Icon = "icon/massR"; |
---|
| 1044 | Brief = "Main Stream Sink"; |
---|
| 1045 | Info = |
---|
| 1046 | "== GENERAL == |
---|
| 1047 | This model should be used for boundary streams when no additional |
---|
| 1048 | information about the stream is desired. |
---|
| 1049 | "; |
---|
| 1050 | |
---|
| 1051 | #*------------------------------------------------------------------- |
---|
| 1052 | * Declaracao de variaveis |
---|
| 1053 | *--------------------------------------------------------------------*# |
---|
| 1054 | |
---|
| 1055 | VARIABLES |
---|
| 1056 | |
---|
| 1057 | in Inlet as main_stream (Brief = "Inlet Stream", PosY = 0.5256, PosX = 0.0, Symbol="_{in}", Protected=true); |
---|
| 1058 | |
---|
| 1059 | end |
---|
| 1060 | |
---|
| 1061 | Model main_sinkL |
---|
| 1062 | ATTRIBUTES |
---|
| 1063 | Pallete = true; |
---|
| 1064 | Icon = "icon/massL"; |
---|
| 1065 | Brief = "Solid Stream Sink"; |
---|
| 1066 | Info = |
---|
| 1067 | "== GENERAL == |
---|
| 1068 | This model should be used for boundary streams when no additional |
---|
| 1069 | information about the stream is desired. |
---|
| 1070 | "; |
---|
| 1071 | |
---|
| 1072 | #*------------------------------------------------------------------- |
---|
| 1073 | * Declaracao de variaveis |
---|
| 1074 | *--------------------------------------------------------------------*# |
---|
| 1075 | |
---|
| 1076 | VARIABLES |
---|
| 1077 | |
---|
| 1078 | in Inlet as main_stream (Brief = "Inlet Stream", PosY = 0.5256, PosX = 1.0, Symbol="_{in}", Protected=true); |
---|
| 1079 | |
---|
| 1080 | end |
---|
| 1081 | |
---|
| 1082 | FlowSheet teste_main_source |
---|
| 1083 | |
---|
| 1084 | #*------------------------------------------------------------------- |
---|
| 1085 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
| 1086 | *--------------------------------------------------------------------*# |
---|
| 1087 | |
---|
| 1088 | DEVICES |
---|
| 1089 | SS101 as main_sourceR; |
---|
| 1090 | |
---|
| 1091 | #*------------------------------------------------------------------- |
---|
| 1092 | #Parametros |
---|
| 1093 | *--------------------------------------------------------------------*# |
---|
| 1094 | |
---|
| 1095 | PARAMETERS |
---|
| 1096 | PP as Plugin (Brief = "External Physical Properties", |
---|
| 1097 | Type="PP", |
---|
| 1098 | Project = "Flowsheets/v2_2/Fluid_v2_2.vrtherm" |
---|
| 1099 | ); |
---|
| 1100 | PPS as Plugin (Brief = "External Physical Properties", |
---|
| 1101 | Type="PP", |
---|
| 1102 | Project = "Flowsheets/v2_2/Solid_v2_2.vrtherm" |
---|
| 1103 | ); |
---|
| 1104 | NComp as Integer (Brief = "Number of chemical components"); |
---|
| 1105 | NCompS as Integer (Brief = "Number of chemical components in the solid phase"); |
---|
| 1106 | |
---|
| 1107 | #*------------------------------------------------------------------- |
---|
| 1108 | * Define o valor dos parametros declarados no modelo |
---|
| 1109 | *--------------------------------------------------------------------*# |
---|
| 1110 | |
---|
| 1111 | SET |
---|
| 1112 | NComp = PP.NumberOfComponents(); |
---|
| 1113 | NCompS = PPS.NumberOfComponents(); |
---|
| 1114 | SS101.CompositionBasis = "Molar"; |
---|
| 1115 | |
---|
| 1116 | |
---|
| 1117 | #*------------------------------------------------------------------- |
---|
| 1118 | * Especifica variaveis definidas no modelo |
---|
| 1119 | *--------------------------------------------------------------------*# |
---|
| 1120 | |
---|
| 1121 | SPECIFY |
---|
| 1122 | SS101.Fluid.Fw = 0 * 'kg/h'; |
---|
| 1123 | SS101.Solid.Fw = 0 * 'kg/h'; |
---|
| 1124 | |
---|
| 1125 | SS101.T = 300 * 'K'; |
---|
| 1126 | |
---|
| 1127 | SS101.P = 1 * 'atm'; |
---|
| 1128 | |
---|
| 1129 | SS101.CompositionOfSolid(1) = 0.4; |
---|
| 1130 | SS101.CompositionOfSolid(2) = 0.3; |
---|
| 1131 | SS101.CompositionOfSolid(3) = 0.28; |
---|
| 1132 | SS101.CompositionOfSolid(4) = 0.02; |
---|
| 1133 | SS101.CompositionOfSolid(5:NCompS) = 0; |
---|
| 1134 | SS101.CompositionOfFluid(1) = 0.9; |
---|
| 1135 | SS101.CompositionOfFluid(2) = 0.08; |
---|
| 1136 | SS101.CompositionOfFluid(3) = 0.02; |
---|
| 1137 | SS101.CompositionOfFluid(4:NComp) = 0; |
---|
| 1138 | |
---|
| 1139 | #*------------------------------------------------------------------- |
---|
| 1140 | * Opcoes do Solver |
---|
| 1141 | *--------------------------------------------------------------------*# |
---|
| 1142 | |
---|
| 1143 | OPTIONS |
---|
| 1144 | Dynamic = false; |
---|
| 1145 | |
---|
| 1146 | end |
---|
| 1147 | |
---|
| 1148 | FlowSheet teste_main_source_and_main_sink |
---|
| 1149 | |
---|
| 1150 | #*------------------------------------------------------------------- |
---|
| 1151 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
| 1152 | *--------------------------------------------------------------------*# |
---|
| 1153 | |
---|
| 1154 | DEVICES |
---|
| 1155 | SS101 as main_sourceR; |
---|
| 1156 | SS102 as main_sinkL; |
---|
| 1157 | |
---|
| 1158 | #*------------------------------------------------------------------- |
---|
| 1159 | * Conexoes entre dispositivos |
---|
| 1160 | *--------------------------------------------------------------------*# |
---|
| 1161 | |
---|
| 1162 | CONNECTIONS |
---|
| 1163 | SS101.Outlet to SS102.Inlet; |
---|
| 1164 | |
---|
| 1165 | #*------------------------------------------------------------------- |
---|
| 1166 | #Parametros |
---|
| 1167 | *--------------------------------------------------------------------*# |
---|
| 1168 | |
---|
| 1169 | PARAMETERS |
---|
| 1170 | PP as Plugin (Brief = "External Physical Properties", |
---|
| 1171 | Type="PP", |
---|
| 1172 | Project = "Flowsheets/v2_2/Fluid_v2_2.vrtherm" |
---|
| 1173 | ); |
---|
| 1174 | PPS as Plugin (Brief = "External Physical Properties", |
---|
| 1175 | Type="PP", |
---|
| 1176 | Project = "Flowsheets/v2_2/Solid_v2_2.vrtherm" |
---|
| 1177 | ); |
---|
| 1178 | NComp as Integer (Brief = "Number of chemical components"); |
---|
| 1179 | NCompS as Integer (Brief = "Number of chemical components in the solid phase"); |
---|
| 1180 | |
---|
| 1181 | #*------------------------------------------------------------------- |
---|
| 1182 | * Define o valor dos parametros declarados no modelo |
---|
| 1183 | *--------------------------------------------------------------------*# |
---|
| 1184 | |
---|
| 1185 | SET |
---|
| 1186 | NComp = PP.NumberOfComponents(); |
---|
| 1187 | NCompS = PPS.NumberOfComponents(); |
---|
| 1188 | SS101.CompositionBasis = "Molar"; |
---|
| 1189 | |
---|
| 1190 | |
---|
| 1191 | #*------------------------------------------------------------------- |
---|
| 1192 | * Especifica variaveis definidas no modelo |
---|
| 1193 | *--------------------------------------------------------------------*# |
---|
| 1194 | |
---|
| 1195 | SPECIFY |
---|
| 1196 | SS101.Fluid.Fw = 0 * 'kg/h'; |
---|
| 1197 | SS101.Solid.Fw = 0 * 'kg/h'; |
---|
| 1198 | |
---|
| 1199 | SS101.T = 300 * 'K'; |
---|
| 1200 | |
---|
| 1201 | SS101.P = 1 * 'atm'; |
---|
| 1202 | |
---|
| 1203 | SS101.CompositionOfSolid(1) = 0.4; |
---|
| 1204 | SS101.CompositionOfSolid(2) = 0.3; |
---|
| 1205 | SS101.CompositionOfSolid(3) = 0.28; |
---|
| 1206 | SS101.CompositionOfSolid(4) = 0.02; |
---|
| 1207 | SS101.CompositionOfSolid(5:NCompS) = 0; |
---|
| 1208 | SS101.CompositionOfFluid(1) = 0.9; |
---|
| 1209 | SS101.CompositionOfFluid(2) = 0.08; |
---|
| 1210 | SS101.CompositionOfFluid(3) = 0.02; |
---|
| 1211 | SS101.CompositionOfFluid(4:NComp) = 0; |
---|
| 1212 | |
---|
| 1213 | #*------------------------------------------------------------------- |
---|
| 1214 | * Opcoes do Solver |
---|
| 1215 | *--------------------------------------------------------------------*# |
---|
| 1216 | |
---|
| 1217 | OPTIONS |
---|
| 1218 | Dynamic = false; |
---|
| 1219 | |
---|
| 1220 | end |
---|
| 1221 | |
---|
| 1222 | Model simple_fluid as stream |
---|
| 1223 | ATTRIBUTES |
---|
| 1224 | Pallete = false; |
---|
| 1225 | Brief = "Simple Stream of Fluid phase of the main stream"; |
---|
| 1226 | Info = |
---|
| 1227 | "== GENERAL == |
---|
| 1228 | This is the model of the fluid part of the main stream. |
---|
| 1229 | In addition to the variables already present in the stream model, there are mass flow rate and mass fraction variables"; |
---|
| 1230 | |
---|
| 1231 | #*------------------------------------------------------------------- |
---|
| 1232 | * Parametros |
---|
| 1233 | *--------------------------------------------------------------------*# |
---|
| 1234 | |
---|
| 1235 | PARAMETERS |
---|
| 1236 | outer PP as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 1237 | M(NComp) as molweight (Brief = "Component Mol Weight (Fluid Phase), Vector Size = NComp", Protected=true); |
---|
| 1238 | |
---|
| 1239 | #*------------------------------------------------------------------- |
---|
| 1240 | * Define o valor dos parametros declarados no modelo |
---|
| 1241 | *--------------------------------------------------------------------*# |
---|
| 1242 | |
---|
| 1243 | SET |
---|
| 1244 | M = PP.MolecularWeight(); |
---|
| 1245 | |
---|
| 1246 | end |
---|
| 1247 | |
---|
| 1248 | Model simple_solid |
---|
| 1249 | ATTRIBUTES |
---|
| 1250 | Pallete = false; |
---|
| 1251 | Brief = "Solid phase of the main stream"; |
---|
| 1252 | Info = |
---|
| 1253 | "== GENERAL == |
---|
| 1254 | This is the model of the solid part of the main stream."; |
---|
| 1255 | |
---|
| 1256 | #*------------------------------------------------------------------- |
---|
| 1257 | * Parametros |
---|
| 1258 | *--------------------------------------------------------------------*# |
---|
| 1259 | |
---|
| 1260 | PARAMETERS |
---|
| 1261 | outer PPS as Plugin (Brief = "External Physical Properties (Fluid Phase)", Type="PP"); |
---|
| 1262 | outer NCompS as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 1263 | M(NCompS) as molweight (Brief = "Component Mol Weight (Solid Phase), Vector Size = NCompS", Protected=true); |
---|
| 1264 | |
---|
| 1265 | #*------------------------------------------------------------------- |
---|
| 1266 | * Define o valor dos parametros declarados no modelo |
---|
| 1267 | *--------------------------------------------------------------------*# |
---|
| 1268 | |
---|
| 1269 | SET |
---|
| 1270 | M = PPS.MolecularWeight(); |
---|
| 1271 | |
---|
| 1272 | #*------------------------------------------------------------------ |
---|
| 1273 | * Declaracao de variaveis |
---|
| 1274 | *-------------------------------------------------------------------*# |
---|
| 1275 | |
---|
| 1276 | VARIABLES |
---|
| 1277 | F as flow_mol (Brief = "Solid Phase Molar Flow", Symbol = "F"); |
---|
| 1278 | z(NCompS) as fraction (Brief = "Solid Phase Molar Fraction, Vector Size = NCompS", Symbol = "z"); |
---|
| 1279 | h as enth_mol (Brief = "Stream Enthalpy", Protected = true); |
---|
| 1280 | |
---|
| 1281 | #*------------------------------------------------------------------- |
---|
| 1282 | * Equacoes do modelo |
---|
| 1283 | *--------------------------------------------------------------------*# |
---|
| 1284 | |
---|
| 1285 | |
---|
| 1286 | |
---|
| 1287 | end |
---|
| 1288 | |
---|
| 1289 | Model simple_total |
---|
| 1290 | ATTRIBUTES |
---|
| 1291 | Pallete = false; |
---|
| 1292 | Brief = "Totals of main stream mixing solid and fluid phases"; |
---|
| 1293 | Info = |
---|
| 1294 | "== GENERAL == |
---|
| 1295 | This is the model of the totals in the main stream mixing solid and fluid phases."; |
---|
| 1296 | |
---|
| 1297 | #*------------------------------------------------------------------- |
---|
| 1298 | * Parametros |
---|
| 1299 | *--------------------------------------------------------------------*# |
---|
| 1300 | |
---|
| 1301 | PARAMETERS |
---|
| 1302 | outer NCompT as Integer (Brief = "Number of Chemical Components", Lower = 1); |
---|
| 1303 | |
---|
| 1304 | #*------------------------------------------------------------------ |
---|
| 1305 | * Declaracao de variaveis |
---|
| 1306 | *-------------------------------------------------------------------*# |
---|
| 1307 | |
---|
| 1308 | VARIABLES |
---|
| 1309 | F as flow_mol (Brief = "Total Molar Flow", Symbol = "F"); |
---|
| 1310 | z(NCompT) as fraction (Brief = "Total Molar Fraction, Vector Size = NCompT", Symbol = "z"); |
---|
| 1311 | |
---|
| 1312 | end |
---|
| 1313 | |
---|
| 1314 | |
---|
| 1315 | Model simple_main_stream |
---|
| 1316 | |
---|
| 1317 | ATTRIBUTES |
---|
| 1318 | Pallete = false; |
---|
| 1319 | Brief = "General matter stream containing solid and fluid phase"; |
---|
| 1320 | Info = |
---|
| 1321 | "== GENERAL == |
---|
| 1322 | This stream should be used when solids are present. |
---|
| 1323 | The stream was separated in two phases: Fluid and Solid. |
---|
| 1324 | Both phases have variables for the flow rate (molar), enthalpy (molar) and molar fractions. |
---|
| 1325 | Additionaly, the total flow rate (mass and molar) and mass and molar fractions are also calculated. |
---|
| 1326 | Note that the enthalpy of the solid phase is calculated through a call to the VapourEnthalpy method of VRTherm. |
---|
| 1327 | |
---|
| 1328 | == ASSUMPTIONS == |
---|
| 1329 | This model does not consider equilibrium between the solid phase and the fluid phase (both liquid and vapour). |
---|
| 1330 | Therefore, if a phase transition involving the solid phase occours, the user should represent it as a 'chemical reaction'. |
---|
| 1331 | Note that for the phase transition to be represented, the compounds involved should be present both in the fluid and solid phases. |
---|
| 1332 | "; |
---|
| 1333 | |
---|
| 1334 | #*------------------------------------------------------------------- |
---|
| 1335 | * Parametros |
---|
| 1336 | *--------------------------------------------------------------------*# |
---|
| 1337 | |
---|
| 1338 | PARAMETERS |
---|
| 1339 | NCompT as Integer (Brief = "Number of Chemical Components for the Solid Phase", Lower = 1); |
---|
| 1340 | |
---|
| 1341 | #*------------------------------------------------------------------- |
---|
| 1342 | * Define o valor dos parametros declarados no modelo |
---|
| 1343 | *--------------------------------------------------------------------*# |
---|
| 1344 | |
---|
| 1345 | SET |
---|
| 1346 | NCompT = Solid.NCompS + Fluid.NComp; |
---|
| 1347 | |
---|
| 1348 | #*------------------------------------------------------------------- |
---|
| 1349 | * Declaracao de variaveis |
---|
| 1350 | *--------------------------------------------------------------------*# |
---|
| 1351 | |
---|
| 1352 | VARIABLES |
---|
| 1353 | Fluid as simple_fluid (Brief = "Fluid phase of the stream", Symbol = "^{Fluid}"); |
---|
| 1354 | Solid as simple_solid (Brief = "Solid phase of the stream", Symbol = "^{Solid}"); |
---|
| 1355 | Total as simple_total (Brief = "Overall stream", Symbol = "^{Total}"); |
---|
| 1356 | T as temperature (Brief = "Stream Temperature"); |
---|
| 1357 | P as pressure (Brief = "Stream Pressure"); |
---|
| 1358 | v as fraction (Brief = "Vapour fraction of the fluid phase"); |
---|
| 1359 | |
---|
| 1360 | EQUATIONS |
---|
| 1361 | "Thermical equilibrium between fluid and solid phases" |
---|
| 1362 | T = Fluid.T; |
---|
| 1363 | |
---|
| 1364 | "Mechanical equilibrium between fluid and solid phases" |
---|
| 1365 | P = Fluid.P; |
---|
| 1366 | |
---|
| 1367 | "Vapour fraction" |
---|
| 1368 | v = Fluid.v; |
---|
| 1369 | |
---|
| 1370 | # "Calculation of mass flow" |
---|
| 1371 | # Total.Fw = Solid.Fw + Fluid.Fw; |
---|
| 1372 | |
---|
| 1373 | "Calculation of molar flow" |
---|
| 1374 | Total.F = Solid.F + Fluid.F; |
---|
| 1375 | |
---|
| 1376 | if Total.F equal 0*'mol/s' then |
---|
| 1377 | |
---|
| 1378 | # "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 1379 | # Total.zw(1) = 1; |
---|
| 1380 | |
---|
| 1381 | # "Calculation of zw for the Solid Phase (NComp)" |
---|
| 1382 | # Total.zw(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 1383 | |
---|
| 1384 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 1385 | Total.z(1) = 1; |
---|
| 1386 | |
---|
| 1387 | "Calculation of z for the Solid Phase (NComp)" |
---|
| 1388 | Total.z(2:Fluid.NComp+Solid.NCompS) = 0; |
---|
| 1389 | |
---|
| 1390 | else |
---|
| 1391 | |
---|
| 1392 | # "Calculation of zw for the Fluid Phase (NComp)" |
---|
| 1393 | # Total.zw(1:Fluid.NComp) * Total.Fw = Fluid.zw * Fluid.Fw; |
---|
| 1394 | |
---|
| 1395 | # "Calculation of zw for the Solid Phase (NComp)" |
---|
| 1396 | # Total.zw([Fluid.NComp+1:Fluid.NComp+Solid.NCompS]) * Total.Fw = Solid.zw * Solid.Fw; |
---|
| 1397 | |
---|
| 1398 | "Calculation of z for the Fluid Phase (NComp)" |
---|
| 1399 | Total.F * Total.z(1:Fluid.NComp) = Fluid.F * Fluid.z; |
---|
| 1400 | |
---|
| 1401 | "Calculation of z for the Solid Phase (NComp)" |
---|
| 1402 | Total.F * Total.z([Fluid.NComp+1:NCompT]) = Solid.F * Solid.z; |
---|
| 1403 | |
---|
| 1404 | end |
---|
| 1405 | |
---|
| 1406 | end |
---|
| 1407 | |
---|
| 1408 | Model simple_main_stream_eq as simple_main_stream |
---|
| 1409 | |
---|
| 1410 | ATTRIBUTES |
---|
| 1411 | Brief = "Main Stream With Specified State"; |
---|
| 1412 | Info = |
---|
| 1413 | "== GENERAL == |
---|
| 1414 | This stream should be used when the state is known: Liquid or Vapour. |
---|
| 1415 | This will determine the VRTherm method used to calculate the fluid phase enthalpy. |
---|
| 1416 | "; |
---|
| 1417 | Pallete = false; |
---|
| 1418 | |
---|
| 1419 | #*------------------------------------------------------------------- |
---|
| 1420 | * Parametros |
---|
| 1421 | *--------------------------------------------------------------------*# |
---|
| 1422 | |
---|
| 1423 | PARAMETERS |
---|
| 1424 | Phase as Switcher (Brief = "Stream Phase for enthalpy calculation", Valid = ["Liquid", "Vapour"], Default = "Liquid"); |
---|
| 1425 | |
---|
| 1426 | #*------------------------------------------------------------------- |
---|
| 1427 | * Equacoes do modelo |
---|
| 1428 | *--------------------------------------------------------------------*# |
---|
| 1429 | |
---|
| 1430 | EQUATIONS |
---|
| 1431 | |
---|
| 1432 | switch Phase |
---|
| 1433 | |
---|
| 1434 | case "Liquid": |
---|
| 1435 | |
---|
| 1436 | "Fluid Phase Molar Enthalpy" |
---|
| 1437 | Fluid.h = Fluid.PP.LiquidEnthalpy(T, P, Fluid.z); |
---|
| 1438 | |
---|
| 1439 | "Vapour fraction" |
---|
| 1440 | v = 0; |
---|
| 1441 | |
---|
| 1442 | case "Vapour": |
---|
| 1443 | |
---|
| 1444 | "Fluid Phase Molar Enthalpy" |
---|
| 1445 | Fluid.h = Fluid.PP.VapourEnthalpy(T, P, Fluid.z); |
---|
| 1446 | |
---|
| 1447 | "Vapour fraction" |
---|
| 1448 | v = 1; |
---|
| 1449 | |
---|
| 1450 | end |
---|
| 1451 | |
---|
| 1452 | "Solid Phase Molar Enthalpy" |
---|
| 1453 | Solid.h = Solid.PPS.VapourEnthalpy(T, P, Solid.z); |
---|
| 1454 | |
---|
| 1455 | end |
---|