source: branches/newlanguage/sample/stage_separators/sample_column.mso @ 125

Last change on this file since 125 was 125, checked in by Rafael de Pelegrini Soares, 16 years ago

Updated some models for the new language proposal

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.4 KB
Line 
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* Sample file for column model
17*--------------------------------------------------------------------
18*
19* This sample file needs VRTherm DEMO(www.vrtech.com.br) to run
20* SectionColumn_Test and needs VRTherm full to run the distillation
21* column flowsheet.
22*
23*----------------------------------------------------------------------
24* Author: Paula B. Staudt
25* $Id: sample_column.mso 125 2007-01-22 19:57:16Z rafael $
26*--------------------------------------------------------------------*#
27
28using "stage_separators/column";
29using "controllers/PIDIncr";
30
31# column section with 2 trays
32FlowSheet SectionColumn_Test_with2tray
33        PARAMETERS
34        PP      as Plugin(Brief="Physical Properties",File="vrpp");
35        NComp   as Integer;
36
37        SET
38        PP.Components = [ "isobutane", "benzene"];
39        PP.LiquidModel = "PR";
40        PP.VapourModel = "PR";
41        NComp = PP.NumberOfComponents;
42       
43        DEVICES
44        sec as Section_Column;
45        feed as liquid_stream;
46        reb as vapour_stream;
47        cond as liquid_stream;
48        zero as stream;
49       
50        CONNECTIONS
51        feed to sec.trays(2).Inlet;
52        zero to sec.trays(1).Inlet;
53        reb to sec.trays(2).InletV;
54        cond to sec.trays(1).InletL;
55       
56        SPECIFY
57        feed.F = 113.4 * "kmol/h";
58        feed.T = 291 * "K";
59        feed.P = 168.3 * "kPa";
60        feed.z = [0.5, 0.5];
61
62        zero.F = 0 * "kmol/h";
63        zero.T = 300 * "K";
64        zero.P = 1 * "atm";
65        zero.z = [0.5, 0.5];
66        zero.v = 0;
67        zero.h = 0 * "J/mol";
68       
69        cond.F = 68 * "kmol/h";
70        cond.P = 150 * "kPa";
71        cond.T = 281.75 * "K";
72        cond.z = [0.6664, 0.3336];
73
74        reb.F = 153 * "kmol/h";
75        reb.P = 185 * "kPa";
76        reb.T = 328.12 * "K";
77        reb.z = [0.001848, 0.9982];
78       
79        sec.trays.Emv = 1;
80
81        SET
82        sec.NTrays = 2;
83        #COLUMN
84        sec.trays.V = 4 * "ft^3";
85        sec.trays.Ah = 0.394 * "ft^2";
86        sec.trays.lw = 20.94 * "in";
87        sec.trays.hw = 0.125 * "ft";
88        sec.trays.Q = 0 * "kW";
89        sec.trays.beta = 0.6;
90        sec.trays.alfa = 4;
91        sec.trays.Ap = 3.94 * "ft^2";
92
93        INITIAL
94        sec.trays.OutletL.T = 290 *"K";
95        sec.trays.Level = 0.9 * sec.trays.hw;
96        sec.trays.OutletL.z(1) = 0.5;
97       
98        OPTIONS
99        #relativeAccuracy = 1e-3;
100        NLASolver = "sundials";
101        TimeStep = 10;
102        TimeEnd = 1000;
103       
104# After running few seconds of transient the steady-state
105# can be obtained by using the results from that transient:
106
107        #guessFile="SectionColumn_Test_with2tray.rlt";
108        #mode = "steady";
109end
110
111# column section with 8 trays
112FlowSheet SectionColumn_Test_with8tray
113        PARAMETERS
114        PP      as Plugin(Brief="Physical Properties",File="vrpp");
115        NComp   as Integer;
116
117        SET
118        PP.Components = [ "isobutane", "benzene"];
119        PP.LiquidModel = "PR";
120        PP.VapourModel = "PR";
121        PP.Derivatives = 0;
122        NComp = PP.NumberOfComponents;
123       
124        DEVICES
125        sec as Section_Column;
126        feed as liquid_stream;
127        reb as vapour_stream;
128        cond as liquid_stream;
129        zero as stream;
130       
131        CONNECTIONS
132        feed to sec.trays(5).Inlet;
133       
134        zero to sec.trays([1:4]).Inlet;
135        zero to sec.trays([6:8]).Inlet;
136       
137        reb to sec.trays(8).InletV;
138        cond to sec.trays(1).InletL;
139       
140        SPECIFY
141        feed.F = 113.4 * "kmol/h";
142        feed.T = 291 * "K";
143        feed.P = 168.3 * "kPa";
144        feed.z = [0.5, 0.5];
145
146        zero.F = 0 * "kmol/h";
147        zero.T = 300 * "K";
148        zero.P = 1 * "atm";
149        zero.z = [0.5, 0.5];
150        zero.v = 0;
151        zero.h = 0 * "J/mol";
152       
153        cond.F = 68 * "kmol/h";
154        cond.P = 150 * "kPa";
155        cond.T = 281.75 * "K";
156        cond.z = [0.6664, 0.3336];
157
158        reb.F = 153 * "kmol/h";
159        reb.P = 185 * "kPa";
160        reb.T = 328.12 * "K";
161        reb.z = [0.001848, 0.9982];
162       
163        sec.trays.Emv = 1;
164
165        SET
166        sec.NTrays = 8;
167        #COLUMN
168        sec.trays.V = 4 * "ft^3";
169        sec.trays.Ah = 0.394 * "ft^2";
170        sec.trays.lw = 20.94 * "in";
171        sec.trays.hw = 0.125 * "ft";
172        sec.trays.Q = 0 * "kW";
173        sec.trays.beta = 0.6;
174        sec.trays.alfa = 4;
175        sec.trays.Ap = 3.94 * "ft^2";
176
177        INITIAL
178        sec.trays.OutletL.T = [290:(330-290)/(sec.NTrays-1):330] *"K";
179        sec.trays.Level = 0.3 * sec.trays.hw;
180        sec.trays.OutletL.z(1) = 0.5;
181       
182        OPTIONS
183        RelativeAccuracy = 1e-5;
184        TimeStep = 1;
185        TimeEnd = 100;
186        #guessFile="SectionColumn_Test_with8tray.rlt";
187        #mode = "steady";
188end
189
190
191FlowSheet Distillation_kettle_cond_Test
192        PARAMETERS
193        PP      as Plugin(Brief="Physical Properties",File="vrpp");
194        NComp   as Integer;
195       
196        VARIABLES
197        Qc as heat_rate (Brief="Heat rate removed from condenser");
198        Qr as heat_rate (Brief="Heat rate supplied to reboiler");
199       
200        SET
201        PP.Components = [ "isobutane", "n-pentane", "propylene",
202                "benzene", "isobutene" ];
203        PP.LiquidModel = "PR";
204        PP.VapourModel = "PR";
205        PP.Derivatives = 1;
206        NComp = PP.NumberOfComponents;
207
208        DEVICES
209        col as Distillation_kettle_cond;
210        feed as source;
211        zero as stream;
212       
213        CONNECTIONS
214        feed to col.trays(5).Inlet;
215        zero to col.reb.Inlet;
216        zero to col.trays([1:4]).Inlet;
217        zero to col.trays([6:col.NTrays]).Inlet;
218        Qc to col.cond.Q;
219        Qr to col.reb.Q;
220       
221        SPECIFY
222        feed.Outlet.F = 113.4 * "kmol/h";
223        feed.Outlet.T = 291 * "K";
224        feed.Outlet.P = 168.3 * "kPa";
225        feed.Outlet.z = 1/NComp;
226       
227        zero.F = 0 * "kmol/h";
228        zero.T = 300 * "K";
229        zero.P = 1 * "atm";
230        zero.z = 1/NComp;
231        zero.v = 0;
232        zero.h = 0 * "J/mol";
233       
234        col.sptop.Outlet2.F = 85 * "kmol/h";
235        col.reb.OutletL.F = 28.4 * "kmol/h";
236        col.sptop.frac = 0.444445;
237        col.cond.OutletV.F = 0 * "kmol/h";
238        Qr = 3.7743e6 * "kJ/h";
239        Qc = -3.71e6 * "kJ/h";
240        col.pump1.dP = 16 * "kPa";
241        col.trays.Emv = 1;
242       
243        SET
244        col.NTrays = 8;
245        col.cond.V = 2 * "m^3";
246        col.cond.Across = 1 * "m^2";
247        col.trays.V = 4 * "ft^3";
248        col.trays.Ah = 0.394 * "ft^2";
249        col.trays.lw = 20.94 * "in";
250        col.trays.hw = 0.125 * "ft";
251        col.trays.Q = 0 * "kW";
252        col.trays.beta = 0.6;
253        col.trays.alfa = 4;
254        col.trays.Ap = 3.94 * "ft^2";
255        col.reb.V = 2 * "m^3";
256        col.reb.Across = 1 * "m^2";
257       
258        INITIAL
259        # condenser
260        col.cond.OutletL.T = 260 *"K";
261        col.cond.Level = 1 * "m";
262        col.cond.OutletL.z([1:4]) = [0.65, 0.05, 0.01, 0.01];
263
264        # reboiler
265        col.reb.OutletL.T = 330 *"K";
266        col.reb.Level = 1 * "m";
267        col.reb.OutletL.z([1:4]) = [0.1, 0.7, 0.01, 0.01];
268
269        # column trays
270        col.trays.OutletL.T = [290:(330-290)/(col.NTrays-1):330] * "K";
271        col.trays.Level = 1.2 * col.trays.hw;
272        col.trays.OutletL.z([1:4]) = [0.5, 0.05, 0.01, 0.01];
273
274        OPTIONS
275        RelativeAccuracy = 1e-3;
276        TimeStep = 0.01;
277        TimeEnd = 50;
278        #time = [0:0.01:1, 2:50];
279        #guessFile="Distillation_kettle_cond_Test.rlt";
280        #mode = "steady";       
281end
282
283FlowSheet Column_ctrl
284        PARAMETERS
285        PP      as Plugin(Brief="Physical Properties",File="vrpp");
286        NComp   as Integer;
287       
288        Qcmin as heat_rate (Brief="Minimum Condenser Heat supplied");
289        Qcmax as heat_rate (Brief="Maximum Condenser Heat supplied");
290        Qrmin as heat_rate (Brief="Minimum Reboiler Heat supplied");
291        Qrmax as heat_rate (Brief="Maximum Reboiler Heat supplied");
292        Frmin as flow_mol (Brief="Minimum bottom flow rate");
293        Frmax as flow_mol (Brief="Maximum bottom flow rate");
294        Fcmin as flow_mol (Brief="Minimum reflux flow rate");
295        Fcmax as flow_mol (Brief="Maximum reflux flow rate");
296        Hmint as length (Brief="Minimum liquid level in top tank");
297        Hmaxt as length (Brief="Maximum liquid level in top tank");
298    Hminb as length (Brief="Minimum liquid level in reboiler");
299        Hmaxb as length (Brief="Maximum liquid level in reboiler");
300        Pmax as pressure (Brief="Maximum column pressure");
301        Pmin as pressure (Brief="Minimum column pressure");
302        Tmax as temperature (Brief="Maximum column temperature");
303        Tmin as temperature (Brief="Minimum column temperature");
304
305        VARIABLES
306        Qc as heat_rate (Brief="Heat rate removed from condenser");
307        Qr as heat_rate (Brief="Heat rate supplied to reboiler");
308        Had_top as Real (Brief="Dimensionless condenser level");
309        Had_bot as Real (Brief="Dimensionless reboiler level");
310        Pad as Real (Brief="Dimensionless pressure");
311        Tad as Real (Brief="Dimensionless temperature");
312        RR      as positive (Brief="Reflux ratio");
313
314        SET
315        PP.Components = [ "isobutane", "n-pentane", "propylene",
316                "benzene", "isobutene" ];
317        PP.LiquidModel = "PR";
318        PP.VapourModel = "PR";
319        PP.Derivatives = 1;
320        NComp = PP.NumberOfComponents;
321
322        DEVICES
323        col as Distillation_kettle_cond;
324        feed as source;
325        zero as stream;
326        TCcond as PIDIncr_Ideal_AW;
327        LCtop as PIDIncr_Ideal_AW;
328        LCbot as PIDIncr_Ideal_AW;
329        PC as PIDIncr_Ideal_AW;
330
331        CONNECTIONS
332        feed to col.trays(5).Inlet;
333        zero to col.reb.Inlet;
334        zero to col.trays([1:4]).Inlet;
335        zero to col.trays([6:col.NTrays]).Inlet;
336        Qc to col.cond.Q;
337        Qr to col.reb.Q;
338
339        EQUATIONS
340   "Temperature Controller"
341        TCcond.Parameters.tau = 0*"s"; 
342        TCcond.Parameters.tauSet = 0*"s";       
343        TCcond.Parameters.alpha = 0.3;
344        TCcond.Parameters.bias = 0.5;   
345        TCcond.Parameters.gamma = 1;
346        TCcond.Parameters.beta = 1;
347        TCcond.Options.action = 1;
348        TCcond.Options.clip = 1;
349        TCcond.Options.autoMan = 0;
350        TCcond.Parameters.intTime = 60*"s";
351        TCcond.Parameters.gain = 0.6;
352        TCcond.Parameters.derivTime = 1*"s";
353        TCcond.Ports.setPoint = ((15+273.15) * "K" - Tmin)/(Tmax-Tmin);
354        TCcond.Ports.input = Tad;
355        Tad = (col.cond.OutletL.T-Tmin)/(Tmax-Tmin);
356        Qc = Qcmin+(Qcmax-Qcmin)*TCcond.Ports.output;   
357
358        "Pressure Controller"
359        PC.Parameters.tau = 0*"s";     
360        PC.Parameters.tauSet = 0*"s";   
361        PC.Parameters.alpha = 0.3;
362        PC.Parameters.bias = 0;
363        PC.Parameters.gamma = 1;
364        PC.Parameters.beta = 1;
365        PC.Options.action = -1;
366        PC.Options.clip = 1;
367        PC.Options.autoMan = 0;
368        PC.Parameters.intTime = 50*"s";
369        PC.Parameters.gain = 0.5;
370        PC.Parameters.derivTime = 1*"s";
371        PC.Ports.setPoint = (2.0*"bar"-Pmin)/(Pmax-Pmin);
372        PC.Ports.input = Pad;
373        Pad = (col.cond.OutletV.P-Pmin)/(Pmax-Pmin);
374        col.cond.OutletV.F = (Fcmin+(Fcmax-Fcmin)*PC.Ports.output);     
375       
376        "Ttop Level Controller"
377        LCtop.Parameters.tau = 0*"s";   
378        LCtop.Parameters.tauSet = 0*"s";       
379        LCtop.Parameters.alpha = 0.3;
380        LCtop.Parameters.bias = 0.5;   
381        LCtop.Parameters.gamma = 1;
382        LCtop.Parameters.beta = 1;
383        LCtop.Options.action = -1;
384        LCtop.Options.clip = 1;
385        LCtop.Options.autoMan = 0;
386        LCtop.Parameters.intTime = 10*"s";
387        LCtop.Parameters.gain = 1;
388        LCtop.Parameters.derivTime = 1*"s";
389        LCtop.Ports.setPoint = (1.0 * "m" - Hmint)/(Hmaxt-Hmint);
390        LCtop.Ports.input = Had_top;
391        Had_top = (col.cond.Level-Hmint)/(Hmaxt-Hmint);
392        col.sptop.Outlet1.F = Fcmin + (Fcmax-Fcmin) * LCtop.Ports.output;
393
394        "Tbottom Level Controller"
395        LCbot.Parameters.tau = 0*"s";   
396        LCbot.Parameters.tauSet = 0*"s";       
397        LCbot.Parameters.alpha = 0.3;
398        LCbot.Parameters.bias = 0.5;   
399        LCbot.Parameters.gamma = 1;
400        LCbot.Parameters.beta = 1;
401        LCbot.Options.action = -1;
402        LCbot.Options.clip = 1;
403        LCbot.Options.autoMan = 0;
404        LCbot.Parameters.intTime = 100*"s";
405        LCbot.Parameters.gain = 1;
406        LCbot.Parameters.derivTime = 1*"s";
407        LCbot.Ports.setPoint = (1.0 * "m" - Hminb)/(Hmaxb-Hminb);
408        LCbot.Ports.input = Had_bot;
409        Had_bot = (col.reb.Level-Hminb)/(Hmaxb-Hminb);
410        col.reb.OutletL.F = Frmin + (Frmax-Frmin) * LCbot.Ports.output;
411
412        RR * (col.cond.OutletV.F + col.sptop.Outlet1.F) = col.sptop.Outlet2.F;
413       
414        if time < 1 * "h" then
415                col.sptop.Outlet2.F = 70 * "kmol/h"; # reflux
416        else
417                col.sptop.Outlet2.F = 85 * "kmol/h"; # reflux
418        end
419
420        SPECIFY
421        feed.Outlet.F = 113.4 * "kmol/h";
422        feed.Outlet.T = 291 * "K";
423        feed.Outlet.P = 168.3 * "kPa";
424        feed.Outlet.z = 1/NComp;
425       
426        zero.F = 0 * "kmol/h";
427        zero.T = 300 * "K";
428        zero.P = 1 * "atm";
429        zero.z = 1/NComp;
430        zero.v = 0;
431        zero.h = 0 * "J/mol";
432       
433        Qr = 3e6 * "kJ/h";
434        col.pump1.dP = 16 * "kPa";
435        col.trays.Emv = 1;
436
437        SET
438        col.NTrays = 8;
439        col.cond.V = 2 * "m^3";
440        col.cond.Across = 1 * "m^2";
441        col.trays.V = 4 * "ft^3";
442        col.trays.Ah = 0.394 * "ft^2";
443        col.trays.lw = 20.94 * "in";
444        col.trays.hw = 0.125 * "ft";
445        col.trays.Q = 0 * "kW";
446        col.trays.beta = 0.6;
447        col.trays.alfa = 4;
448        col.trays.Ap = 3.94 * "ft^2";
449        col.reb.V = 2 * "m^3";
450        col.reb.Across = 1 * "m^2";
451
452        Qrmax = 5e6 * "kJ/h";
453        Qrmin = 1e6 * "kJ/h";
454        Frmin = 0 * "kmol/h";
455        Frmax = 60 * "kmol/h";
456        Fcmin = 0 * "kmol/h";
457        Fcmax = 120 * "kmol/h";
458        Hmint = 0 * "m";
459        Hmaxt = 2 * "m";
460        Hminb = 0 * "m";
461        Hmaxb = 2 * "m";
462        Pmin = 0.5 * "bar";
463        Pmax = 4 * "bar";
464        Qcmax = -5e5 * "kJ/h";
465        Qcmin = -5e6 * "kJ/h";
466        Tmax = (30+273.15) * "K";
467        Tmin = (-20+273.15) * "K";
468       
469        INITIAL
470        # condenser
471        col.cond.OutletL.T = 260 *"K";
472        col.cond.Level = 1 * "m";
473        col.cond.OutletL.z([1:4]) = [0.2, 0.2, 0.4, 0.05];
474
475        # reboiler
476        col.reb.OutletL.T = 350 *"K";
477        col.reb.Level = 1 * "m";
478        col.reb.OutletL.z([1:4]) = [0.1, 0.4, 0.1, 0.3];
479       
480        # column trays
481        col.trays.OutletL.T = [290:(330-290)/(col.NTrays-1):330] * "K";
482        col.trays.Level = 1.2 * col.trays.hw;
483        col.trays.OutletL.z([1:4]) = [0.15, 0.3, 0.25, 0.2];
484
485        OPTIONS
486        RelativeAccuracy = 1e-3;
487        TimeStep = 0.01;
488        TimeEnd = 2;
489        TimeUnit = "h";
490        #time = [0:0.01:0.1, 0.11:0.01:2]*"h";
491        #initialFile = "Column_ctrl.rlt";
492        #guessFile = "Column_ctrl.rlt";
493        #mode = "steady";
494end
495
Note: See TracBrowser for help on using the repository browser.