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

Last change on this file since 215 was 213, checked in by Rafael de Pelegrini Soares, 17 years ago

Adapted some samples to the new Plugin mechanism

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