source: trunk/BioModel/water_stream.mso @ 1009

Last change on this file since 1009 was 1008, checked in by Argimiro Resende Secchi, 22 months ago

Adding BioModel? to the MSO library.

File size: 15.6 KB
Line 
1#*-------------------------------------------------------------------
2* Biorrefinaria Petrobras
3*--------------------------------------------------------------------
4* Nome do arquivo: water_stream.mso
5* Projeto: Modelo integrado de producao de etanol 1G/2G
6* Conteudo: corrente de agua
7*--------------------------------------------------------------------*#
8
9#*-------------------------------------------------------------------
10*
11* Data:    03/2016
12* Autores:   Anderson R. A. Lino e Gabriel C. Fonseca
13* versao 1.0
14*--------------------------------------------------------------------
15*Descricao: modelo da corrente de agua que sera utilizado
16*na simulacao do processo
17*--------------------------------------------------------------------*#
18
19using "types";
20       
21Model water_stream
22       
23        ATTRIBUTES
24        Brief= "Basic Water Stream";
25        Color = "blue";
26        Info =
27"== GENERAL ==
28* This stream should be used when the current is known to be composed only by water (liquid or vapour);
29* All the variables are based on mass.
30";
31
32#*-------------------------------------------------------------------
33* Declaracao de variaveis
34*--------------------------------------------------------------------*#
35       
36        VARIABLES
37
38        Fw as flow_mass         (Brief = "Stream Mass Flow");
39        P as pressure           (Brief = "Stream Pressure", Default = 10, Lower = 5e-3, Upper = 200);
40        T as temperature        (Brief = "Stream Pressure", Default = 600, Lower = 273.16, Upper = 900);
41        S as entr_mass          (Brief = "Stream Mass Entropy", Default = 5, Lower = 1e-3,Upper = 20);
42        H as enth_mass          (Brief = "Stream Mass Pressure", Default = 3000, Lower = 1, Upper = 7000);
43        v as fraction           (Brief = "Vapour Fraction");
44       
45end
46
47Model water_stream_vapfrac as water_stream
48        ATTRIBUTES
49        Brief= "Water Stream With Built-in Vapour Fraction Calculation";
50        Color = "blue";
51        Info =
52"== GENERAL ==
53* This stream should be used when the vapour fraction is unknown;
54* Vapour fraction is determined by comparison with saturated water and steam enthalpy.
55";
56#*-------------------------------------------------------------------
57* Parametros
58*--------------------------------------------------------------------*#
59       
60        PARAMETERS
61       
62        propterm as Plugin (Brief = "IAPWS 97 properties of water", Type = "water", Symbol = "{}");
63       
64#*-------------------------------------------------------------------
65* Declaracao de variaveis
66*--------------------------------------------------------------------*#
67
68        VARIABLES
69       
70        Hl as enth_mass (Brief = "Saturated Water Enthalpy", Hidden = true);
71        Hv as enth_mass (Brief = "Saturated Steam Enthalpy", Hidden = true);
72        Sl as entr_mass (Brief = "Saturated Water Entropy", Hidden = true);
73        Sv as entr_mass (Brief = "Saturated Steam Entropy", Hidden = true);
74       
75#*-------------------------------------------------------------------
76* Equacoes do modelo
77*--------------------------------------------------------------------*#
78       
79        EQUATIONS
80       
81        "Steam Mass Entropy and Enthalpy, array = [Sv, Hv]"
82        [Sv, Hv] = propterm.propPTv(P, propterm.Tsat(P));
83       
84        "Water Mass Entropy and Enthalpy, array = [Sl, Hl]"
85        [Sl, Hl] = propterm.propPTl(P, propterm.Tsat(P));
86       
87        if H > Hv then
88                "Vapour fraction"
89                v = 1;
90        else if H < Hl then
91                "Vapour fraction"
92                v = 0;
93        else
94                "Vapour Fraction"
95                (Hv - Hl) * v = (H - Hl);
96        end
97        end
98       
99end
100
101Model water_stream_eq as water_stream
102        ATTRIBUTES
103        Brief= "Water Stream With Specified State";
104        Color = "blue";
105        Info =
106"== GENERAL ==
107* This stream should be used when the state is known: subcooled water, superheated steam or liquid-vapour equilibrium;
108* When subcooled water or superheated steam is choosen, the user should specify the pressure and temperature;
109* When liquid-vapour equilibrium is choosen, the user should specify the vapour fraction and the pressure or the temperature.
110";
111#*-------------------------------------------------------------------
112* Parametros
113*--------------------------------------------------------------------*#
114       
115        PARAMETERS
116       
117        propterm as Plugin (Brief = "IAPWS 97 properties of water", Type = "water", Symbol = "{}");
118        ValidPhases as Switcher (Brief = "Saturation State of the Stream", Valid = ["Vapour-Only", "Liquid-Only", "Vapour-Liquid"], Default = "Vapour-Liquid");
119       
120#*-------------------------------------------------------------------
121* Declaracao de variaveis
122*--------------------------------------------------------------------*#
123       
124        VARIABLES
125       
126        Hl as enth_mass (Brief = "Saturated Water Mass Enthalpy", Hidden = true);
127        Hv as enth_mass (Brief = "Saturated Steam Mass Enthalpy", Hidden = true);
128        Sl as entr_mass (Brief = "Saturated Water Mass Entropy", Hidden = true);
129        Sv as entr_mass (Brief = "Saturated Steam Mass Entropy", Hidden = true);
130       
131#*-------------------------------------------------------------------
132* Equacoes do modelo
133*--------------------------------------------------------------------*#
134
135        EQUATIONS
136       
137        "Saturated Water Mass Enthalpy and Entropy, array = [Sl, Hl]"
138        [Sl, Hl] = propterm.propPTl(P, propterm.Tsat(P));
139
140        "Saturated Steam Mass Enthalpy and Entropy, array = [Sv, Hv]"
141        [Sv, Hv] = propterm.propPTv(P, propterm.Tsat(P));
142       
143switch ValidPhases
144       
145        case "Vapour-Only":
146       
147                "Superheated Steam Condition"
148                        v = 1;
149               
150                "Outlet Mass Entropy and Enthalpy , array = [S, H]"
151                        [S, H] = propterm.propPTv(P, T);
152                       
153                when T <= propterm.Tsat(P) switchto "Liquid-Only";
154       
155        case "Liquid-Only":
156       
157                "Subcooled Water Condition"
158                        v = 0;
159
160                "Outlet Mass Entropy and Enthalpy, array = [S, H]"
161                        [S, H] = propterm.propPTl(P, T);
162                       
163                when T > propterm.Tsat(P) switchto "Vapour-Only";
164       
165        case "Vapour-Liquid":
166       
167                "Saturation Temperature"
168                        T = propterm.Tsat(P);
169               
170                "Outlet Mass Entropy"
171                        S = Sl + v * (Sv - Sl);
172               
173                "Outlet Mass Enthalpy"
174                        H = Hl + v * (Hv - Hl);
175       
176        end
177
178end
179
180
181Model water_sourceR
182
183        ATTRIBUTES
184        Pallete         = true;
185        Icon            = "icon/waterR";
186        Brief           = "Water Stream Source";
187        Info =
188"== GENERAL ==
189        This model should be used for boundary streams.
190        Usually these streams are known and come from other process units.
191        The user should choose the state of the stream: subcooled water, superheated steam or liquid-vapour equilibrium.
192        When subcooled water or superheated steam is choosen, the user should specify the pressure and temperature.
193        When liquid-vapour equilibrium is choosen, the user should specify the vapour fraction and the pressure or the temperature.
194
195== SPECIFY ==
196* If subcooled water or superheated steam: pressure and temperature;
197* If liquid-vapour equilibrium: vapour fraction and temperature or pressure;
198* Additionally, the user should always specify the Mass Flow;
199
200== ADITIONAL INFORMATION ==
201* Mass Enthalpy;
202* Mass Entropy.
203";
204
205#*-------------------------------------------------------------------
206* Parametros
207*--------------------------------------------------------------------*#
208
209        PARAMETERS
210
211        propterm        as Plugin       (Brief = "IAPWS 97 properties of water", Type = "water", Symbol = "{}");
212        ValidPhases as Switcher (Brief = "Saturation State of the Stream", Valid = ["Vapour-Only", "Liquid-Only", "Vapour-Liquid"], Default = "Vapour-Liquid");
213       
214#*-------------------------------------------------------------------
215* Declaracao de variaveis
216*--------------------------------------------------------------------*#
217
218        VARIABLES
219
220out Outlet              as water_stream (Brief = "Outlet Water Stream", PosX = 1.0, PosY = 0.5256, Symbol="_{out}", Protected = true);
221        P                       as pressure             (Brief = "Stream Pressure");
222        Fw                      as flow_mass    (Brief = "Stream Mass Flow");
223        T                       as temperature  (Brief = "Stream Temperature", Default = 300);
224        v                       as fraction     (Brief = "Vapour fraction");
225       
226        Hl as enth_mass (Brief = "Saturated Water Mass Enthalpy", Hidden = true);
227        Hv as enth_mass (Brief = "Saturated Steam Mass Enthalpy", Hidden = true);
228        Sl as entr_mass (Brief = "Saturated Water Mass Entropy", Hidden = true);
229        Sv as entr_mass (Brief = "Saturated Steam Mass Entropy", Hidden = true);
230       
231#*-------------------------------------------------------------------
232* Equacoes do modelo
233*--------------------------------------------------------------------*#
234
235        EQUATIONS
236
237        "Saturated Water Mass Enthalpy and Entropy, array = [Sl, Hl]"
238                [Sl, Hl] = propterm.propPTl(Outlet.P, propterm.Tsat(Outlet.P));
239
240        "Saturated Steam Mass Enthalpy and Entropy, array = [Sv, Hv]"
241                [Sv, Hv] = propterm.propPTv(Outlet.P, propterm.Tsat(Outlet.P));
242       
243switch ValidPhases
244       
245        case "Vapour-Only":
246       
247                "SuperHeated Steam Condition"
248                        Outlet.v = 1;
249               
250                "Outlet Mass Entropy and Enthalpy, array = [S, H]"
251                        [Outlet.S, Outlet.H] = propterm.propPTv(Outlet.P, Outlet.T);
252                       
253                when T < propterm.Tsat(P) switchto "Liquid-Only";
254       
255        case "Liquid-Only":
256       
257                "Subcooled Water Condition"
258                        Outlet.v = 0;
259
260                "Outlet Mass Entropy and Enthalpy, array = [S, H]"
261                        [Outlet.S, Outlet.H] = propterm.propPTl(Outlet.P, Outlet.T);
262                       
263                when T > propterm.Tsat(P) switchto "Vapour-Only";
264       
265        case "Vapour-Liquid":
266       
267                "Saturation Temperature"
268                        Outlet.T = propterm.Tsat(P);
269               
270                "Outlet Mass Entropy"
271                        Outlet.S = Sl + Outlet.v * (Sv - Sl);
272               
273                "Outlet Mass Enthalpy"
274                        Outlet.H = Hl + Outlet.v * (Hv - Hl);
275       
276        end
277       
278        "Equate Pressure"
279                P = Outlet.P;
280       
281        "Equate Flow"   
282                Fw = Outlet.Fw;
283       
284        "Equate Vapour Fraction"
285                v = Outlet.v;
286       
287        "Equate Temperature"
288                T = Outlet.T;
289end
290
291
292Model water_sourceL
293
294ATTRIBUTES
295        Pallete         = true;
296        Icon            = "icon/waterL";
297        Brief           = "Water Stream Source";
298        Info =
299"== GENERAL ==
300        This model should be used for boundary streams.
301        Usually these streams are known and come from other process units.
302        The user should choose the state of the stream: subcooled water, superheated steam or liquid-vapour equilibrium.
303        When subcooled water or superheated steam is choosen, the user should specify the pressure and temperature.
304        When liquid-vapour equilibrium is choosen, the user should specify the vapour fraction and the pressure or the temperature.
305
306== SPECIFY ==
307* If subcooled water or superheated steam: pressure and temperature;
308* If liquid-vapour equilibrium: vapour fraction and temperature or pressure;
309* Additionally, the user should always specify the Mass Flow;
310
311== ADITIONAL INFORMATION ==
312* Mass Enthalpy;
313* Mass Entropy.
314";
315
316#*-------------------------------------------------------------------
317* Parametros
318*--------------------------------------------------------------------*#
319
320PARAMETERS
321
322        propterm        as Plugin       (Brief = "IAPWS 97 properties of water", Type = "water", Symbol = "{}");
323        ValidPhases as Switcher (Brief = "Saturation State of the Stream", Valid = ["Vapour-Only", "Liquid-Only", "Vapour-Liquid"], Default = "Vapour-Liquid");
324       
325#*-------------------------------------------------------------------
326* Declaracao de variaveis
327*--------------------------------------------------------------------*#
328       
329VARIABLES
330
331out Outlet              as water_stream (Brief = "Outlet Water Stream", PosX = 0, PosY = 0.5256, Symbol="_{out}", Protected = true);
332        P                       as pressure             (Brief = "Stream Pressure");
333        Fw                      as flow_mass    (Brief = "Stream Mass Flow");
334        T                       as temperature  (Brief = "Stream Temperature", Default = 300);
335        v                       as fraction     (Brief = "Vapour fraction");
336       
337        Hl as enth_mass (Brief = "Saturated Water Mass Enthalpy", Hidden = true);
338        Hv as enth_mass (Brief = "Saturated Steam Mass Enthalpy", Hidden = true);
339        Sl as entr_mass (Brief = "Saturated Water Mass Entropy", Hidden = true);
340        Sv as entr_mass (Brief = "Saturated Steam Mass Entropy", Hidden = true);
341       
342#*-------------------------------------------------------------------
343* Equacoes do modelo
344*--------------------------------------------------------------------*#
345
346        EQUATIONS
347
348        "Saturated Water Mass Enthalpy and Entropy, array = [Sl, Hl]"
349                [Sl, Hl] = propterm.propPTl(Outlet.P, propterm.Tsat(Outlet.P));
350
351        "Saturated Steam Mass Enthalpy and Entropy, array = [S, H]"
352                [Sv, Hv] = propterm.propPTv(Outlet.P, propterm.Tsat(Outlet.P));
353       
354switch ValidPhases
355       
356        case "Vapour-Only":
357       
358                "SuperHeated Steam Condition"
359                        Outlet.v = 1;
360               
361                "Outlet Mass Entropy and Enthalpy, array = [S, H]"
362                        [Outlet.S, Outlet.H] = propterm.propPTv(Outlet.P, Outlet.T);
363                       
364                when T < propterm.Tsat(P) switchto "Liquid-Only";
365       
366        case "Liquid-Only":
367       
368                "Subcooled Water Condition"
369                        Outlet.v = 0;
370
371                "Outlet Mass Entropy and Enthalpy, array = [S, H]"
372                        [Outlet.S, Outlet.H] = propterm.propPTl(Outlet.P, Outlet.T);
373                       
374                when T > propterm.Tsat(P) switchto "Vapour-Only";
375       
376        case "Vapour-Liquid":
377       
378                "Saturation Temperature"
379                        Outlet.T = propterm.Tsat(P);
380               
381                "Outlet Mass Entropy"
382                        Outlet.S = Sl + Outlet.v * (Sv - Sl);
383               
384                "Outlet Mass Enthalpy"
385                        Outlet.H = Hl + Outlet.v * (Hv - Hl);
386       
387        end
388       
389        "Equate Pressure"
390                P = Outlet.P;
391       
392        "Equate Flow"   
393                Fw = Outlet.Fw;
394       
395        "Equate Vapour Fraction"
396                v = Outlet.v;
397       
398        "Equate Temperature"
399                T = Outlet.T;
400end
401
402
403Model water_sinkR
404
405        ATTRIBUTES
406        Pallete         = true;
407        Icon            = "icon/waterR";
408        Brief           = "Water Stream Sink";
409        Info =
410"== GENERAL ==
411        This model should be used for boundary streams when no additional
412        information about the stream is desired.
413";
414       
415#*-------------------------------------------------------------------
416* Declaracao de variaveis
417*--------------------------------------------------------------------*#
418
419        VARIABLES
420
421in  Inlet               as water_stream (Brief = "Inlet Water Stream", PosX = 0.0, PosY = 0.5256, Symbol="_{in}", Protected = true);
422
423end
424
425
426Model water_sinkL
427
428ATTRIBUTES
429        Pallete         = true;
430        Icon            = "icon/waterL";
431        Brief           = "Water Stream Sink";
432        Info =
433"== GENERAL ==
434        This model should be used for boundary streams when no additional
435        information about the stream is desired.
436";
437
438#*-------------------------------------------------------------------
439* Declaracao de variaveis
440*--------------------------------------------------------------------*#
441       
442VARIABLES
443
444in Inlet                as water_stream (Brief = "Inlet Water Stream", PosX = 1.0, PosY = 0.5256, Symbol="_{in}", Protected = true);
445       
446end
447
448
449
450
451FlowSheet teste
452       
453#*-------------------------------------------------------------------
454* Declaracao de dispositivos (ou blocos contendo o modelo)
455*--------------------------------------------------------------------*#
456       
457        DEVICES
458        SS101 as water_sourceR;
459       
460#*-------------------------------------------------------------------
461* Especifica variaveis definidas no modelo
462*--------------------------------------------------------------------*#
463       
464        SPECIFY
465       
466        SS101.Fw = 100 * 'kg/h';
467        SS101.T = 368.15 * 'K';
468        SS101.P = 80 * 'bar';
469       
470#*-------------------------------------------------------------------
471* Define o valor dos parametros declarados no modelo
472*--------------------------------------------------------------------*#
473       
474        SET
475        SS101.ValidPhases = "Liquid-Only";
476       
477#*-------------------------------------------------------------------
478* Opcoes do Solver
479*--------------------------------------------------------------------*#
480       
481        OPTIONS
482        Dynamic = false;
483
484end
485
486
487FlowSheet teste2
488       
489#*-------------------------------------------------------------------
490* Declaracao de dispositivos (ou blocos contendo o modelo)
491*--------------------------------------------------------------------*#
492       
493        DEVICES
494        SS101 as water_sourceL;
495        SS102 as water_sinkL;
496
497#*-------------------------------------------------------------------
498* Conexoes entre dispositivos
499*--------------------------------------------------------------------*#
500       
501        CONNECTIONS
502        SS101.Outlet to SS102.Inlet;
503       
504#*-------------------------------------------------------------------
505* Especifica variaveis definidas no modelo
506*--------------------------------------------------------------------*#
507       
508        SPECIFY
509       
510        SS101.Fw = 100 * 'kg/h';
511        SS101.T = 368.15 * 'K';
512        SS101.P = 80 * 'bar';
513       
514#*-------------------------------------------------------------------
515* Define o valor dos parametros declarados no modelo
516*--------------------------------------------------------------------*#
517       
518        SET
519        SS101.ValidPhases = "Liquid-Only";
520       
521#*-------------------------------------------------------------------
522* Opcoes do Solver
523*--------------------------------------------------------------------*#
524       
525        OPTIONS
526        Dynamic = false;
527
528end
529
Note: See TracBrowser for help on using the repository browser.