source: branches/gui/sample/controllers/sample_PID_MIMO.mso @ 941

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