source: trunk/sample/controllers/sample_PIDIncr_MIMO.mso @ 976

Last change on this file since 976 was 910, checked in by Argimiro Resende Secchi, 14 years ago

Checking new EML.

File size: 9.0 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 PID MIMO application
17* (dual control of a distillation column)
18*--------------------------------------------------------------------
19*
20* This sample file needs VRTherm (www.vrtech.com.br) to run
21* the distillation column flowsheet.
22*
23*----------------------------------------------------------------------
24* Author: Argimiro R. Secchi
25* $Id: sample_PID_MIMO.mso 313 2007-07-14 16:45:55Z arge $
26*--------------------------------------------------------------------*#
27
28using "stage_separators/column";
29using "controllers/PIDIncr";
30
31FlowSheet Column_MPID
32        PARAMETERS
33        PP      as Plugin(Brief="Physical Properties",
34                Type="PP",
35                Components = [ "isobutane", "n-pentane", "propylene",
36                        "benzene", "isobutene" ],
37                LiquidModel = "PR",
38                VapourModel = "PR"
39        );
40        NComp   as Integer;
41       
42        Qrmin as heat_rate (Brief="Minimum Reboiler Heat supplied");
43        Qrmax as heat_rate (Brief="Maximum Reboiler Heat supplied");
44        RRmax as positive (Brief="Maximum reflux ratio");
45        RRmin as positive (Brief="Minimum reflux ratio");
46       
47        VARIABLES
48        Qc as energy_source (Brief="Heat rate removed from condenser");
49        Qr as energy_source (Brief="Heat rate supplied to reboiler");
50        P_sp as pressure (Brief="Pressure setpoint");
51        T_sp as temperature (Brief="Condenser temperature setpoint");
52        RR      as positive (Brief="Reflux ratio");
53        LC_sp as fraction (Brief="Condenser level setpoint");
54        LR_sp as fraction (Brief="Reboiler level setpoint");
55out     xtop as fraction (Brief="Controlled top composition");
56out     xbot as fraction (Brief="Controlled bottom composition");
57        xtop_sp as fraction (Brief="Controlled top composition setpoint");
58        xbot_sp as fraction (Brief="Controlled bottom composition setpoint");
59
60        SET
61        NComp = PP.NumberOfComponents;
62
63        DEVICES
64        col as Section_Column;
65        cond as condenser;
66        reb as reboiler;
67        sptop as splitter_column;
68        pump1 as pump;
69#       Valve_Distillate as valve_flow;
70#       Valve_Bottom as valve_flow;
71        feed as source;
72        TCcond as PIDIncr;
73        LCtop as PIDIncr;
74        LCbot as PIDIncr;
75        PC as PIDIncr;
76        PID11 as PIDIncr;
77        PID22 as PIDIncr;
78        PID12 as PIDIncr;
79        PID21 as PIDIncr;
80
81        CONNECTIONS
82        feed.Outlet to col.FeedTray;
83        Qc.OutletQ to cond.InletQ;
84        Qr.OutletQ to reb.InletQ;
85#       sptop.Distillate to Valve_Distillate.Inlet;
86        sptop.Reflux to pump1.Inlet;
87        pump1.Outlet to col.LiquidInlet;
88        col.VapourOutlet to cond.InletVapour;
89        cond.OutletLiquid to sptop.Inlet;
90        col.LiquidOutlet to reb.InletLiquid;
91        reb.OutletVapour to col.VapourInlet;
92#       reb.OutletLiquid to Valve_Bottom.Inlet;
93        cond.TI to TCcond.Input;
94        cond.PI to PC.Input;
95        cond.LI to LCtop.Input;
96        reb.LI to LCbot.Input;
97        xtop to PID11.Input;
98        xbot to PID12.Input;
99        xtop to PID21.Input;
100        xbot to PID22.Input;
101
102        EQUATIONS
103
104        TCcond.SetPoint * 'K' = T_sp;
105        Qc.OutletQ = TCcond.Output * 'kJ/h';
106
107        PC.SetPoint * 'bar' = P_sp;
108        cond.OutletVapour.F = PC.Output * 'kmol/h';
109
110        LCtop.SetPoint = LC_sp;
111        sptop.Distillate.F = LCtop.Output * 'kmol/h';
112
113        LCbot.SetPoint = LR_sp;
114        reb.OutletLiquid.F = LCbot.Output * 'kmol/h';
115
116        "MIMO PID Controller"
117        PID11.SetPoint = xtop_sp;
118        PID12.SetPoint = xbot_sp;
119
120        RR = RRmin + (RRmax-RRmin) * (PID11.Output + PID12.Output);
121
122        PID21.SetPoint = xtop_sp;
123        PID22.SetPoint = xbot_sp;
124
125        Qr.OutletQ = Qrmin + (Qrmax-Qrmin) * (PID21.Output + PID22.Output);
126
127        RR * (cond.OutletVapour.F + sptop.Distillate.F) = sptop.Reflux.F;
128        xtop = cond.OutletLiquid.z(4); # benzene
129        xbot = reb.OutletLiquid.z(3); # propylene
130
131        if time < 1 * 'h' then
132                feed.F = 113.4 * 'kmol/h';
133        else
134                feed.F = 120 * 'kmol/h';
135        end
136
137        SPECIFY
138        feed.T = 291 * 'K';
139        feed.P = 568.3 * 'kPa';
140        feed.Composition = 1/NComp;
141       
142#       Qr.OutletQ = 3e6 * 'kJ/h';
143        pump1.Pincrease = 16 * 'kPa';
144#       sptop.Reflux.F = 75 * 'kmol/h'; # reflux
145        col.VapourDrawOffFlow = 0 * 'kmol/h' ;
146        col.LiquidDrawOffFlow = 0 * 'kmol/h' ;
147
148        xtop_sp = 1e-3; # benzene
149        xbot_sp = 1e-5; # propylene
150        P_sp = 4.0*'bar';
151        T_sp = (15+273.15) * 'K';
152        LC_sp = 0.5;
153        LR_sp = 0.5;
154
155        SET
156        col.FeedTrayLocation(1) = 5;
157        col.NumberOfTrays = 8;
158        col.LiquidSideStreamLocation = 2;
159        col.VapourSideStreamLocation = 2;
160        col.WeirLength = 20.94 * 'in';
161        col.WeirHeight = 0.125 * 'ft';
162        col.TrayLiquidPasses = 1;
163        col.HeatSupply = 0 * 'kW' ;
164        col.AerationFraction = 0.6;
165        col.DryPdropCoeff = 4;
166        col.MurphreeEff = 1;
167
168        cond.Geometry.Lenght = 1 * 'm';
169        cond.Geometry.Diameter = 1 * 'm';
170        reb.Geometry.Lenght = 2 * 'm';
171        reb.Geometry.Diameter = 1 * 'm';
172
173        # Controllers type
174        TCcond.PID_Select = "Ideal_AW";
175        PC.PID_Select = "Ideal_AW";
176        LCtop.PID_Select = "Ideal_AW";
177        LCbot.PID_Select = "Ideal_AW";
178        PID11.PID_Select = "Ideal_AW";
179        PID12.PID_Select = "Ideal_AW";
180        PID21.PID_Select = "Ideal_AW";
181        PID22.PID_Select = "Ideal_AW";
182
183        # Temperature Controller
184        TCcond.tau = 1*'s';     
185        TCcond.tauSet = 1*'s'; 
186        TCcond.alpha = 0.1;
187        TCcond.bias = 0.5;     
188        TCcond.gamma = 1;
189        TCcond.beta = 1;
190        TCcond.Action = "Reverse";
191        TCcond.Clip = "Clipped";
192        TCcond.Mode = "Automatic";
193        TCcond.intTime = 60*'s';
194        TCcond.gain = 0.6;
195        TCcond.derivTime = 1*'s';
196
197        # Pressure Controller
198        PC.tau = 1*'s';
199        PC.tauSet = 1*'s';     
200        PC.alpha = 0.1;
201        PC.bias = 0;   
202        PC.gamma = 1;
203        PC.beta = 1;
204        PC.Action = "Direct";
205        PC.Clip = "Clipped";
206        PC.Mode = "Automatic";
207        PC.intTime = 50*'s';
208        PC.gain = 0.5;
209        PC.derivTime = 1*'s';
210
211        # Ttop Level Controller
212        LCtop.tau = 1*'s';     
213        LCtop.tauSet = 1*'s';   
214        LCtop.alpha = 0.1;
215        LCtop.bias = 0.5;       
216        LCtop.gamma = 1;
217        LCtop.beta = 1;
218        LCtop.Action = "Direct";
219        LCtop.Clip = "Clipped";
220        LCtop.Mode = "Automatic";
221        LCtop.intTime = 20*'s';
222        LCtop.gain = 1;
223        LCtop.derivTime = 0*'s';
224
225        # Tbottom Level Controller
226        LCbot.tau = 1*'s';     
227        LCbot.tauSet = 1*'s';   
228        LCbot.alpha = 0.1;
229        LCbot.bias = 0.5;       
230        LCbot.gamma = 1;
231        LCbot.beta = 1;
232        LCbot.Action = "Direct";
233        LCbot.Clip = "Clipped";
234        LCbot.Mode = "Automatic";
235        LCbot.intTime = 100*'s';
236        LCbot.gain = 1.5;
237        LCbot.derivTime = 0*'s';
238
239        # MIMO PID Controller
240        PID11.tau = 1*'s';     
241        PID11.tauSet = 1*'s';   
242        PID11.alpha = 0.1;
243        PID11.bias = 0.1;       
244        PID11.gamma = 1;
245        PID11.beta = 1;
246        PID11.Action = "Direct";
247        PID11.Clip = "Clipped";
248        PID11.Mode = "Automatic";
249        PID11.intTime = 60*'s';
250        PID11.gain = 0.6;
251        PID11.derivTime = 0*'s';
252
253        PID12.tau = 1*'s';     
254        PID12.tauSet = 1*'s';   
255        PID12.alpha = 0.1;
256        PID12.bias = 0.0;       
257        PID12.gamma = 1;
258        PID12.beta = 1;
259        PID12.Action = "Direct";
260        PID12.Clip = "Clipped";
261        PID12.Mode = "Automatic";
262        PID12.intTime = 100*'s';
263        PID12.gain = 0.5;
264        PID12.derivTime = 0*'s';
265       
266        PID21.tau = 1*'s';     
267        PID21.tauSet = 1*'s';   
268        PID21.alpha = 0.1;
269        PID21.bias = 0.0;       
270        PID21.gamma = 1;
271        PID21.beta = 1;
272        PID21.Action = "Reverse";
273        PID21.Clip = "Clipped";
274        PID21.Mode = "Automatic";
275        PID21.intTime = 100*'s';
276        PID21.gain = 0.5;
277        PID21.derivTime = 0*'s';
278
279        PID22.tau = 1*'s';     
280        PID22.tauSet = 1*'s';   
281        PID22.alpha = 0.1;
282        PID22.bias = 0.5;       
283        PID22.gamma = 1;
284        PID22.beta = 1;
285        PID22.Action = "Direct";
286        PID22.Clip = "Clipped";
287        PID22.Mode = "Automatic";
288        PID22.intTime = 60*'s';
289        PID22.gain = 0.6;
290        PID22.derivTime = 0*'s';
291
292        PC.MinOutput = 0;
293        PC.MaxOutput = 120;
294        PC.MinInput = 0.5;
295        PC.MaxInput = 10;
296        LCtop.MinInput = 0;
297        LCtop.MaxInput = 1;
298        LCtop.MinOutput = 0;
299        LCtop.MaxOutput = 120;
300        LCbot.MinInput = 0;
301        LCbot.MaxInput = 1;
302        LCbot.MinOutput = 0;
303        LCbot.MaxOutput = 60;
304        TCcond.MaxOutput = -5e5;
305        TCcond.MinOutput = -5e6;
306        TCcond.MaxInput = (30+273.15);
307        TCcond.MinInput = (-20+273.15);
308        PID11.MinInput = 0;
309        PID12.MinInput = 0;
310        PID21.MinInput = 0;
311        PID22.MinInput = 0;
312        PID11.MaxInput = 1;
313        PID12.MaxInput = 1;
314        PID21.MaxInput = 1;
315        PID22.MaxInput = 1;
316        RRmax = 5;
317        RRmin = 0.1;
318        Qrmax = 5e6 * 'kJ/h';
319        Qrmin = 1e6 * 'kJ/h';
320
321        # Initial condition
322        # condenser
323        cond.Levelpercent_Initial = 0.5;
324        cond.Initial_Temperature = 260 *'K';
325        cond.Initial_Composition = [0.2, 0.2, 0.4, 0.05, 0.15];
326
327        # reboiler
328        reb.Levelpercent_Initial = 0.5;
329        reb.Initial_Temperature = 350 *'K';
330        reb.Initial_Composition = [0.1, 0.4, 0.1, 0.3, 0.1];
331
332        # column trays
333        col.INITIALIZATION.TopTemperature = 290 * 'K';
334        col.INITIALIZATION.BottomTemperature = 330 * 'K';
335        col.INITIALIZATION.LevelFraction = 0.1;
336        col.INITIALIZATION.TopComposition = [0.2, 0.2, 0.4, 0.05, 0.15];
337        col.INITIALIZATION.BottomComposition = [0.1, 0.4, 0.1, 0.3, 0.1];
338
339        OPTIONS
340        TimeStep = 0.1;
341        TimeEnd = 5;
342        TimeUnit = 'h';
343        InitialFile = "Column_MPID.rlt";
344        DAESolver(File="dassl");
345        #GuessFile = "Column_MPID.rlt";
346        #Dynamic = false;
347end
348
Note: See TracBrowser for help on using the repository browser.