source: branches/gui/sample/stage_separators/sample_column.mso @ 555

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

Updating the models to be usable by the gui

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 22.6 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 555 2008-07-18 19:01:13Z 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.P = 185 * 'kPa';
77        reb.T = 328.12 * 'K';
78        reb.z = [0.001848, 0.9982];
79       
80        sec.trays.Emv = 1;
81        sec.trays(1).OutletV.F = 150 * 'kmol/h';
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 = 270 *'K';
97        sec.trays.Level = 0.9 * sec.trays.hw;
98        sec.trays.OutletL.z(1) = 0.5;
99       
100        OPTIONS
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        #Dynamic = false;
109end
110
111# column section with 8 trays
112FlowSheet SectionColumn_Test_with8tray
113        PARAMETERS
114        PP      as Plugin(Brief="Physical Properties",
115                Type="PP",
116                Components = [ "isobutane", "benzene"],
117                LiquidModel = "PR",
118                VapourModel = "PR"
119        );
120        NComp   as Integer;
121
122        SET
123        NComp = PP.NumberOfComponents;
124       
125        DEVICES
126        sec as Section_Column;
127        feed as liquid_stream;
128        reb as vapour_stream;
129        cond as liquid_stream;
130        zero as stream;
131       
132        CONNECTIONS
133        feed to sec.trays(5).Inlet;
134       
135        zero to sec.trays([1:4]).Inlet;
136        zero to sec.trays([6:8]).Inlet;
137       
138        reb to sec.trays(8).InletV;
139        cond to sec.trays(1).InletL;
140       
141        SPECIFY
142        feed.F = 113.4 * 'kmol/h';
143        feed.T = 291 * 'K';
144        feed.P = 168.3 * 'kPa';
145        feed.z = [0.5, 0.5];
146
147        zero.F = 0 * 'kmol/h';
148        zero.T = 300 * 'K';
149        zero.P = 1 * 'atm';
150        zero.z = [0.5, 0.5];
151        zero.v = 0;
152        zero.h = 0 * 'J/mol';
153       
154        cond.F = 68 * 'kmol/h';
155        cond.P = 150 * 'kPa';
156        cond.T = 281.75 * 'K';
157        cond.z = [0.6664, 0.3336];
158
159#       reb.F = 153 * 'kmol/h';
160        reb.P = 185 * 'kPa';
161        reb.T = 328.12 * 'K';
162        reb.z = [0.001848, 0.9982];
163       
164        sec.trays.Emv = 1;
165        sec.trays(1).OutletV.F = 150 * 'kmol/h';
166
167        SET
168        sec.NTrays = 8;
169        #COLUMN
170        sec.trays.V = 4 * 'ft^3';
171        sec.trays.Ah = 0.394 * 'ft^2';
172        sec.trays.lw = 20.94 * 'in';
173        sec.trays.hw = 0.125 * 'ft';
174        sec.trays.Q = 0 * 'kW';
175        sec.trays.beta = 0.6;
176        sec.trays.alfa = 4;
177        sec.trays.Ap = 3.94 * 'ft^2';
178
179        INITIAL
180        sec.trays.OutletL.T = [290:(300-290)/(sec.NTrays-1):300] *'K';
181        sec.trays.Level = 0.3 * sec.trays.hw;
182        sec.trays.OutletL.z(1) = 0.5;
183       
184        OPTIONS
185        TimeStep = 1;
186        TimeEnd = 100;
187        #GuessFile="SectionColumn_Test_with8tray.rlt";
188        #Dynamic = false;
189end
190
191
192FlowSheet Distillation_kettle_cond_Test
193        PARAMETERS
194        PP      as Plugin(Brief="Physical Properties",
195                Type="PP",
196                Components = [ "isobutane", "n-pentane", "propylene",
197                "benzene", "isobutene" ],
198                LiquidModel = "PR",
199                VapourModel = "PR"
200        );
201        NComp   as Integer;
202       
203        VARIABLES
204        Qc as energy_source (Brief="Heat rate removed from condenser");
205        Qr as energy_source (Brief="Heat rate supplied to reboiler");
206       
207        SET
208        NComp = PP.NumberOfComponents;
209
210        DEVICES
211        col as Distillation_kettle_cond;
212        feed as source;
213        zero as stream;
214       
215        CONNECTIONS
216        feed.Outlet to col.trays(5).Inlet;
217        zero to col.reb.Inlet;
218        zero to col.trays([1:4]).Inlet;
219        zero to col.trays([6:col.NTrays]).Inlet;
220        Qc.OutletQ to col.cond.InletQ;
221        Qr.OutletQ to col.reb.InletQ;
222       
223        SPECIFY
224        feed.Outlet.F = 113.4 * 'kmol/h';
225        feed.Outlet.T = 291 * 'K';
226        feed.Outlet.P = 168.3 * 'kPa';
227        feed.Outlet.z = 1/NComp;
228       
229        zero.F = 0 * 'kmol/h';
230        zero.T = 300 * 'K';
231        zero.P = 1 * 'atm';
232        zero.z = 1/NComp;
233        zero.v = 0;
234        zero.h = 0 * 'J/mol';
235       
236        col.sptop.Outlet2.F = 85 * 'kmol/h';
237        col.reb.OutletL.F = 28.4 * 'kmol/h';
238        col.sptop.frac = 0.444445;
239        col.cond.OutletV.F = 0 * 'kmol/h';
240        Qr.OutletQ = 3.7743e6 * 'kJ/h';
241        Qc.OutletQ = -3.71e6 * 'kJ/h';
242        col.pump1.dP = 16 * 'kPa';
243        col.trays.Emv = 1;
244       
245        col.alfaTopo = 2;
246       
247        SET
248        col.NTrays = 8;
249        col.cond.V = 2 * 'm^3';
250        col.cond.Across = 1 * 'm^2';
251        col.trays.V = 4 * 'ft^3';
252        col.trays.Ah = 0.394 * 'ft^2';
253        col.trays.lw = 20.94 * 'in';
254        col.trays.hw = 0.125 * 'ft';
255        col.trays.Q = 0 * 'kW';
256        col.trays.beta = 0.6;
257        col.trays.alfa = 4;
258        col.trays.Ap = 3.94 * 'ft^2';
259        col.reb.V = 2 * 'm^3';
260        col.reb.Across = 1 * 'm^2';
261       
262        INITIAL
263        # condenser
264        col.cond.OutletL.T = 260 *'K';
265        col.cond.Level = 1 * 'm';
266        col.cond.OutletL.z([1:4]) = [0.65, 0.05, 0.01, 0.01];
267
268        # reboiler
269        col.reb.OutletL.T = 350 *'K';
270        col.reb.Level = 1 * 'm';
271        col.reb.OutletL.z([1:4]) = [0.1, 0.7, 0.01, 0.01];
272
273        # column trays
274        col.trays.OutletL.T = [290:(330-290)/(col.NTrays-1):330] * 'K';
275        col.trays.Level = 1.2 * col.trays.hw;
276        col.trays.OutletL.z([1:4]) = [0.5, 0.05, 0.01, 0.01];
277
278        OPTIONS
279        TimeStep = 0.1;
280        TimeEnd = 50;
281        #GuessFile="Distillation_kettle_cond_Test.rlt";
282        #Dynamic = false;       
283end
284
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 energy_source (Brief="Heat rate removed from condenser");
316        Qr as energy_source (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;
331        LCtop as PIDIncr;
332        LCbot as PIDIncr;
333        PC as PIDIncr;
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.OutletQ to col.cond.InletQ;
341        Qr.OutletQ to col.reb.InletQ;
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.Action = "Direct";
352        TCcond.Clip = "Clipped";
353        TCcond.Mode = "Automatic";
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.OutletQ = 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.Action = "Reverse";
370        PC.Clip = "Clipped";
371        PC.Mode = "Automatic";
372        PC.Parameters.intTime = 50*'s';
373        PC.Parameters.gain = 0.5;
374        PC.Parameters.derivTime = 1*'s';
375        PC.Ports.setPoint = (4.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.Action = "Reverse";
388        LCtop.Clip = "Clipped";
389        LCtop.Mode = "Automatic";
390        LCtop.Parameters.intTime = 10*'s';
391        LCtop.Parameters.gain = 1;
392        LCtop.Parameters.derivTime = 0*'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.Action = "Reverse";
406        LCbot.Clip = "Clipped";
407        LCbot.Mode = "Automatic";
408        LCbot.Parameters.intTime = 100*'s';
409        LCbot.Parameters.gain = 1;
410        LCbot.Parameters.derivTime = 0*'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 = 75 * '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 = 5 * 'bar';
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.OutletQ = 4e6 * 'kJ/h';
438        col.pump1.dP = 16 * 'kPa';
439        col.trays.Emv = 1;
440        col.alfaTopo = 2;
441
442        SET
443        col.NTrays = 8;
444        col.cond.V = 2 * 'm^3';
445        col.cond.Across = 1 * 'm^2';
446        col.trays.V = 4 * 'ft^3';
447        col.trays.Ah = 0.394 * 'ft^2';
448        col.trays.lw = 20.94 * 'in';
449        col.trays.hw = 0.125 * 'ft';
450        col.trays.Q = 0 * 'kW';
451        col.trays.beta = 0.6;
452        col.trays.alfa = 4;
453        col.trays.Ap = 3.94 * 'ft^2';
454        col.reb.V = 2 * 'm^3';
455        col.reb.Across = 1 * 'm^2';
456
457        # Controllers type
458        TCcond.PID_Select = "Ideal_AW";
459        PC.PID_Select = "Ideal_AW";
460        LCtop.PID_Select = "Ideal_AW";
461        LCbot.PID_Select = "Ideal_AW";
462
463        Qrmax = 5e6 * 'kJ/h';
464        Qrmin = 1e6 * 'kJ/h';
465        Frmin = 0 * 'kmol/h';
466        Frmax = 60 * 'kmol/h';
467        Fcmin = 0 * 'kmol/h';
468        Fcmax = 120 * 'kmol/h';
469        Hmint = 0 * 'm';
470        Hmaxt = 2 * 'm';
471        Hminb = 0 * 'm';
472        Hmaxb = 2 * 'm';
473        Pmin = 0.5 * 'bar';
474        Pmax = 6 * 'bar';
475        Qcmax = -5e5 * 'kJ/h';
476        Qcmin = -5e6 * 'kJ/h';
477        Tmax = (30+273.15) * 'K';
478        Tmin = (-20+273.15) * 'K';
479       
480        INITIAL
481        # condenser
482        col.cond.OutletL.T = 260 *'K';
483        col.cond.Level = 1 * 'm';
484        col.cond.OutletL.z([1:4]) = [0.2, 0.2, 0.4, 0.05];
485
486        # reboiler
487        col.reb.OutletL.T = 350 *'K';
488        col.reb.Level = 1 * 'm';
489        col.reb.OutletL.z([1:4]) = [0.1, 0.4, 0.1, 0.3];
490
491        # column trays
492        col.trays.OutletL.T = [290:(330-290)/(col.NTrays-1):330] * 'K';
493        col.trays.Level = 1.2 * col.trays.hw;
494        col.trays.OutletL.z([1:4]) = [0.15, 0.3, 0.25, 0.2];
495
496        OPTIONS
497        TimeStep = 0.1;
498        TimeEnd = 5;
499        TimeUnit = 'h';
500        InitialFile = "Column_ctrl.rlt";
501        DAESolver(File="dassl");
502        #GuessFile = "Column_ctrl.rlt";
503        #Dynamic = false;
504end
505
506# packed column section with 8 trays
507FlowSheet PackedSectionColumn
508        PARAMETERS
509        PP      as Plugin(Brief="Physical Properties",
510                Type="PP",
511                Components = [ "isobutane", "n-pentane", "propylene",
512                "benzene", "isobutene" ],
513                LiquidModel = "PR",
514                VapourModel = "PR"
515        );
516        NComp   as Integer;
517
518        SET
519        NComp = PP.NumberOfComponents;
520       
521        DEVICES
522        sec as Packed_Section_Column;
523        feed as liquid_stream;
524        reb as vapour_stream;
525        cond as liquid_stream;
526        zero as stream;
527       
528        CONNECTIONS
529        feed to sec.stage(5).Inlet;
530        zero to sec.stage([1:4]).Inlet;
531        zero to sec.stage([6:sec.NStages]).Inlet;
532        reb to sec.stage(8).InletV;
533        cond to sec.stage(1).InletL;
534       
535        SPECIFY
536        feed.F = 113.4 * 'kmol/h';
537        feed.T = 291 * 'K';
538        feed.P = 1.66 * 'atm';
539        feed.z = [0.2, 0.2, 0.2, 0.2, 0.2];
540
541        zero.F = 0 * 'kmol/h';
542        zero.T = 300 * 'K';
543        zero.P = 1 * 'atm';
544        zero.z = [0.2, 0.2, 0.2, 0.2, 0.2];
545        zero.v = 0;
546        zero.h = 0 * 'J/mol';
547       
548        cond.F = 85 * 'kmol/h';
549        cond.P = 2.33 * 'atm';
550        cond.T = 283.5 * 'K';
551        cond.z = [0.599, 0.044, 0.035, 0.007, 0.315];
552
553        reb.F = 137.57 * 'kmol/h';
554        reb.P = 2.46 * 'atm';
555        reb.T = 325 * 'K';
556        reb.z = [0.16, 0.542, 0.013, 0.008, 0.277];
557
558        sec.dP = 0.008 * 'atm'; #queda de pressao na secao!
559
560        SET
561        sec.H = 4 * 'm';#altura do recheio
562        sec.NStages = 8; #numero de estagios teoricos do recheio
563        sec.stage.Q = 0 * 'kW';
564        sec.stage.d = 1.009 * 'm';
565        sec.stage.Cpo = 0.763;
566        sec.stage.e = 0.951;
567        sec.stage.a = 112.6 * 'm^2/m^3';
568        sec.stage.Qsil = 0.1;#coeficiente de resistencia do recheio
569
570        INITIAL
571        sec.stage.OutletL.T =[283:(325-283)/(sec.NStages-1):325] *'K';
572        sec.stage.ML = 0.01 * 'kmol';
573        sec.stage.OutletL.z([1:4]) = [0.3, 0.2, 0.002, 0.1];
574
575        OPTIONS
576        DAESolver(File="dassl");
577        NLASolver(File="nlasolver");
578        TimeStep = 10;
579        TimeEnd = 100;
580end
581
582FlowSheet Packed_kettle_cond_Test
583        PARAMETERS
584        PP      as Plugin(Brief="Physical Properties",
585                Type="PP",
586                Components = [ "isobutane", "n-pentane", "propylene",
587                "benzene", "isobutene" ],
588                LiquidModel = "PR",
589                VapourModel = "PR"
590        );
591        NComp   as Integer;
592       
593        VARIABLES
594        Qc as energy_source (Brief="Heat rate removed from condenser");
595        Qr as energy_source (Brief="Heat rate supplied to reboiler");
596       
597        SET
598        NComp = PP.NumberOfComponents;
599
600        DEVICES
601        col as PackedDistillation_kettle_cond;
602        feed as source;
603        zero as stream;
604       
605        CONNECTIONS
606        feed.Outlet to col.stage(5).Inlet;
607        zero to col.reb.Inlet;
608        zero to col.stage([1:4]).Inlet;
609        zero to col.stage([6:col.NStages]).Inlet;
610        Qc.OutletQ to col.cond.InletQ;
611        Qr.OutletQ to col.reb.InletQ;
612       
613        SPECIFY
614        feed.Outlet.F = 113.4 * 'kmol/h';
615        feed.Outlet.T = 291 * 'K';
616        feed.Outlet.P = 168.3 * 'kPa';
617        feed.Outlet.z = 1/NComp;
618       
619        zero.F = 0 * 'kmol/h';
620        zero.T = 300 * 'K';
621        zero.P = 1 * 'atm';
622        zero.z = 1/NComp;
623        zero.v = 0;
624        zero.h = 0 * 'J/mol';
625       
626        col.sptop.Outlet2.F = 85 * 'kmol/h';
627        col.reb.OutletL.F = 28.4 * 'kmol/h';
628        col.sptop.frac = 0.444445;
629        col.cond.OutletV.F = 0 * 'kmol/h';
630        Qr.OutletQ = 3.7743e6 * 'kJ/h';
631        Qc.OutletQ = -3.71e6 * 'kJ/h';
632        col.pump1.dP = 16 * 'kPa';
633
634        col.dP = 0.024 * 'atm'; #queda de pressao entre o topo e o fundo da coluna.
635
636        SET
637        col.H = 3.5 * 'm'; # altura de recheio
638        col.NStages = 8; # numero de estagios teoricos do recheio
639        col.stage.Q = 0 * 'kW';
640        col.stage.d = 2.24 * 'ft';
641        col.stage.Cpo = 0.763;
642        col.stage.e = 0.951;
643        col.stage.a = 112.6 * 'm^2/m^3';
644
645        col.cond.V = 2 * 'm^3';
646        col.cond.Across = 1 * 'm^2';
647        col.reb.V = 2 * 'm^3';
648        col.reb.Across = 1 * 'm^2';
649        col.stage.Qsil = 2; # coeficiente de resistencia do recheio
650       
651        INITIAL
652        # condenser
653        col.cond.OutletL.T = 260 *'K';
654        col.cond.Level = 1 * 'm';
655        col.cond.OutletL.z([1:4]) = [0.65, 0.05, 0.01, 0.01];
656
657        # reboiler
658        col.reb.OutletL.T = 330 *'K';
659        col.reb.Level = 1 * 'm';
660        col.reb.OutletL.z([1:4]) = [0.1, 0.7, 0.01, 0.01];
661
662        # column trays
663        col.stage.OutletL.T = [290:(330-290)/(col.NStages-1):330] * 'K';
664        col.stage.ML = 0.1 * 'kmol';
665        col.stage.OutletL.z([1:4]) = [0.15, 0.5, 0.001, 0.1];
666
667        OPTIONS
668        TimeStep = 10;
669        TimeEnd = 500;
670end
671
672FlowSheet PackedColumn_ctrl
673        PARAMETERS
674        PP      as Plugin(Brief="Physical Properties",
675                Type="PP",
676                Components = [ "isobutane", "n-pentane", "propylene",
677                        "benzene", "isobutene" ],
678                LiquidModel = "PR",
679                VapourModel = "PR"
680        );
681        NComp   as Integer;
682       
683        Qcmin as heat_rate (Brief="Minimum Condenser Heat supplied");
684        Qcmax as heat_rate (Brief="Maximum Condenser Heat supplied");
685        Qrmin as heat_rate (Brief="Minimum Reboiler Heat supplied");
686        Qrmax as heat_rate (Brief="Maximum Reboiler Heat supplied");
687        Frmin as flow_mol (Brief="Minimum bottom flow rate");
688        Frmax as flow_mol (Brief="Maximum bottom flow rate");
689        Fcmin as flow_mol (Brief="Minimum reflux flow rate");
690        Fcmax as flow_mol (Brief="Maximum reflux flow rate");
691        Hmint as length (Brief="Minimum liquid level in top tank");
692        Hmaxt as length (Brief="Maximum liquid level in top tank");
693    Hminb as length (Brief="Minimum liquid level in reboiler");
694        Hmaxb as length (Brief="Maximum liquid level in reboiler");
695        Pmax as pressure (Brief="Maximum column pressure");
696        Pmin as pressure (Brief="Minimum column pressure");
697        Tmax as temperature (Brief="Maximum column temperature");
698        Tmin as temperature (Brief="Minimum column temperature");
699
700        VARIABLES
701        Qc as energy_source (Brief="Heat rate removed from condenser");
702        Qr as energy_source (Brief="Heat rate supplied to reboiler");
703        Had_top as Real (Brief="Dimensionless condenser level");
704        Had_bot as Real (Brief="Dimensionless reboiler level");
705        Pad as Real (Brief="Dimensionless pressure");
706        Tad as Real (Brief="Dimensionless temperature");
707        RR      as positive (Brief="Reflux ratio");
708
709        SET
710        NComp = PP.NumberOfComponents;
711
712        DEVICES
713        col as PackedDistillation_kettle_cond;
714        feed as source;
715        zero as stream;
716        TCcond as PIDIncr;
717        LCtop as PIDIncr;
718        LCbot as PIDIncr;
719        PC as PIDIncr;
720
721        CONNECTIONS
722        feed.Outlet to col.stage(5).Inlet;
723        zero to col.reb.Inlet;
724        zero to col.stage([1:4]).Inlet;
725        zero to col.stage([6:col.NStages]).Inlet;
726        Qc.OutletQ to col.cond.InletQ;
727        Qr.OutletQ to col.reb.InletQ;
728       
729        SET
730        TCcond.Action = "Direct";
731        TCcond.Clip = "Clipped";
732        TCcond.Mode = "Automatic";
733
734        PC.Action = "Reverse";
735        PC.Clip = "Clipped";
736        PC.Mode = "Automatic";
737
738        LCtop.Action = "Reverse";
739        LCtop.Clip = "Clipped";
740        LCtop.Mode = "Automatic";
741       
742        LCbot.Action = "Reverse";
743        LCbot.Clip = "Clipped";
744        LCbot.Mode = "Automatic";
745
746        EQUATIONS
747   "Temperature Controller"
748        TCcond.Parameters.tau = 0*'s'; 
749        TCcond.Parameters.tauSet = 0*'s';       
750        TCcond.Parameters.alpha = 0.3;
751        TCcond.Parameters.bias = 0.5;   
752        TCcond.Parameters.gamma = 1;
753        TCcond.Parameters.beta = 1;
754        TCcond.Parameters.intTime = 60*'s';
755        TCcond.Parameters.gain = 0.6;
756        TCcond.Parameters.derivTime = 1*'s';
757        TCcond.Ports.setPoint = ((15+273.15) * 'K' - Tmin)/(Tmax-Tmin);
758        TCcond.Ports.input = Tad;
759        Tad = (col.cond.OutletL.T-Tmin)/(Tmax-Tmin);
760        Qc.OutletQ = Qcmin+(Qcmax-Qcmin)*TCcond.Ports.output;   
761
762        "Pressure Controller"
763        PC.Parameters.tau = 0*'s';     
764        PC.Parameters.tauSet = 0*'s';   
765        PC.Parameters.alpha = 0.3;
766        PC.Parameters.bias = 0;
767        PC.Parameters.gamma = 1;
768        PC.Parameters.beta = 1;
769        PC.Parameters.intTime = 50*'s';
770        PC.Parameters.gain = 0.5;
771        PC.Parameters.derivTime = 1*'s';
772        PC.Ports.setPoint = (4.0*'bar'-Pmin)/(Pmax-Pmin);
773        PC.Ports.input = Pad;
774        Pad = (col.cond.OutletV.P-Pmin)/(Pmax-Pmin);
775        col.cond.OutletV.F = (Fcmin+(Fcmax-Fcmin)*PC.Ports.output);     
776       
777        "Ttop Level Controller"
778        LCtop.Parameters.tau = 0*'s';   
779        LCtop.Parameters.tauSet = 0*'s';       
780        LCtop.Parameters.alpha = 0.3;
781        LCtop.Parameters.bias = 0.5;   
782        LCtop.Parameters.gamma = 1;
783        LCtop.Parameters.beta = 1;
784        LCtop.Parameters.intTime = 10*'s';
785        LCtop.Parameters.gain = 1;
786        LCtop.Parameters.derivTime = 0*'s';
787        LCtop.Ports.setPoint = (1.0 * 'm' - Hmint)/(Hmaxt-Hmint);
788        LCtop.Ports.input = Had_top;
789        Had_top = (col.cond.Level-Hmint)/(Hmaxt-Hmint);
790        col.sptop.Outlet1.F = Fcmin + (Fcmax-Fcmin) * LCtop.Ports.output;
791
792        "Tbottom Level Controller"
793        LCbot.Parameters.tau = 0*'s';   
794        LCbot.Parameters.tauSet = 0*'s';       
795        LCbot.Parameters.alpha = 0.3;
796        LCbot.Parameters.bias = 0.5;   
797        LCbot.Parameters.gamma = 1;
798        LCbot.Parameters.beta = 1;
799        LCbot.Parameters.intTime = 100*'s';
800        LCbot.Parameters.gain = 1;
801        LCbot.Parameters.derivTime = 0*'s';
802        LCbot.Ports.setPoint = (1.0 * 'm' - Hminb)/(Hmaxb-Hminb);
803        LCbot.Ports.input = Had_bot;
804        Had_bot = (col.reb.Level-Hminb)/(Hmaxb-Hminb);
805        col.reb.OutletL.F = Frmin + (Frmax-Frmin) * LCbot.Ports.output;
806
807        RR * (col.cond.OutletV.F + col.sptop.Outlet1.F) = col.sptop.Outlet2.F;
808       
809        if time < 1 * 'h' then
810                col.sptop.Outlet2.F = 75 * 'kmol/h'; # reflux
811        else
812                col.sptop.Outlet2.F = 85 * 'kmol/h'; # reflux
813        end
814
815        SPECIFY
816        feed.Outlet.F = 113.4 * 'kmol/h';
817        feed.Outlet.T = 291 * 'K';
818        feed.Outlet.P = 5 * 'bar';
819        feed.Outlet.z = 1/NComp;
820       
821        zero.F = 0 * 'kmol/h';
822        zero.T = 300 * 'K';
823        zero.P = 1 * 'atm';
824        zero.z = 1/NComp;
825        zero.v = 0;
826        zero.h = 0 * 'J/mol';
827       
828        Qr.OutletQ = 4e6 * 'kJ/h';
829        col.pump1.dP = 16 * 'kPa';
830       
831        col.dP = 0.024  * 'atm'; #queda de pressao entre o topo e o fundo da coluna
832
833        SET
834        col.H = 3.5 * 'm'; #altura do recheio
835        col.NStages = 8; #numero de estagios teoricos do recheio
836        col.stage.Q = 0 * 'kW';
837        col.stage.d = 2.24 * 'ft';
838        col.stage.Cpo = 0.763;
839        col.stage.e = 0.951;
840        col.stage.a = 112.6 * 'm^2/m^3';
841
842        col.cond.V = 2 * 'm^3';
843        col.cond.Across = 1 * 'm^2';
844        col.reb.V = 2 * 'm^3';
845        col.reb.Across = 1 * 'm^2';
846
847        col.stage.Qsil = 2; #coeficiente de resistencia do recheio
848
849        # Controllers type
850        TCcond.PID_Select = "Ideal_AW";
851        PC.PID_Select = "Ideal_AW";
852        LCtop.PID_Select = "Ideal_AW";
853        LCbot.PID_Select = "Ideal_AW";
854
855        Qrmax = 5e6 * 'kJ/h';
856        Qrmin = 1e6 * 'kJ/h';
857        Frmin = 0 * 'kmol/h';
858        Frmax = 60 * 'kmol/h';
859        Fcmin = 0 * 'kmol/h';
860        Fcmax = 120 * 'kmol/h';
861        Hmint = 0 * 'm';
862        Hmaxt = 2 * 'm';
863        Hminb = 0 * 'm';
864        Hmaxb = 2 * 'm';
865        Pmin = 0.5 * 'bar';
866        Pmax = 6 * 'bar';
867        Qcmax = -5e5 * 'kJ/h';
868        Qcmin = -5e6 * 'kJ/h';
869        Tmax = (30+273.15) * 'K';
870        Tmin = (-20+273.15) * 'K';
871       
872        INITIAL
873        # condenser
874        col.cond.OutletL.T = 260 *'K';
875        col.cond.Level = 1 * 'm';
876        col.cond.OutletL.z([1:4]) = [0.2, 0.2, 0.4, 0.05];
877
878        # reboiler
879        col.reb.OutletL.T = 350 *'K';
880        col.reb.Level = 1 * 'm';
881        col.reb.OutletL.z([1:4]) = [0.1, 0.4, 0.1, 0.3];
882
883        # column trays
884        col.stage.OutletL.T = [290:(330-290)/(col.NStages-1):330] * 'K';
885        col.stage.ML = 0.1 * 'kmol';
886        col.stage.OutletL.z([1:4]) = [0.15, 0.3, 0.25, 0.2];
887
888        OPTIONS
889        TimeStep = 0.1;
890        TimeEnd = 5;
891        TimeUnit = 'h';
892        InitialFile = "Packed_Column_ctrl.rlt";
893        #GuessFile = "Packed_Column_ctrl.rlt";
894        #Dynamic = false;
895end
Note: See TracBrowser for help on using the repository browser.