source: trunk/sample/controllers/Sample_flash_pid.mso @ 537

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

Updating flash example.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2008 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 - 2008 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* Flash separator sample file.
17*--------------------------------------------------------------------
18*
19* This sample file needs VRTherm (www.vrtech.com.br) to run.
20*
21*--------------------------------------------------------------------
22* Author: Rafael de Pelegrini Soares
23* $Id: Sample_flash_pid.mso 537 2008-06-16 03:58:00Z arge $
24*------------------------------------------------------------------*#
25
26using "stage_separators/flash";
27using "controllers/PIDIncr";
28
29FlowSheet Flash_Dynamic
30       
31        PARAMETERS
32        PP      as Plugin(Brief="Physical Properties",Type="PP",
33                Components = ["n-butane", "benzene", "n-octane"],
34                LiquidModel = "PR",
35                VapourModel = "PR");
36        NComp   as Integer;
37        #Maximum and minimum vapor and liquid flow rates
38        FVMin as flow_mol;
39        FVMax as flow_mol;
40        FLMax as flow_mol;
41        FLMin as flow_mol;
42        #Maximum and minimum pressure
43        PMin as pressure;
44        PMax as pressure;
45        #Maximum and minimum level
46        LMax as length;
47        LMin as length;
48
49        VARIABLES
50        L_ad as Real (Brief="Dimensionless level");
51        P_ad as Real (Brief="Dimensionless pressure");
52        Q       as energy_source (Brief="Heat supplied");
53       
54        DEVICES
55        pidL as PIDIncr; #Level controller
56        pidP as PIDIncr; #Pressure controller
57        fl as flash;
58        s1 as source;
59       
60        SET
61        NComp = PP.NumberOfComponents;
62       
63        pidL.PID_Select = "Parallel_AWBT";
64        pidP.PID_Select = "Parallel_AWBT";
65       
66        #Flash model parameters
67        fl.V = 10 * 'm^3';
68        fl.diameter = 0.5 * 'm';
69        fl.orientation = "vertical";
70       
71        #Maximum and minimum values
72        PMax=2.36 *'atm';
73        PMin=0 *'atm';
74        LMax=2 *'m';
75        LMin=0 *'m';
76        FVMax=300*'kmol/h';
77        FVMin=0*'kmol/h';
78        FLMax=692.7*'kmol/h';
79        FLMin=0*'kmol/h';
80
81        CONNECTIONS
82        s1.Outlet to fl.Inlet;
83        Q.OutletQ to fl.InletQ;
84       
85        SPECIFY
86
87        Q.OutletQ.Q = 1026.32 * 'kJ/s';
88
89        #Level controller parameters
90        pidL.Ports.setPoint=0.5;
91        pidL.Parameters.bias=0.5;
92        pidL.Parameters.gain=1.1776;
93        pidL.Parameters.derivTime=19*'s';
94        pidL.Parameters.intTime=76*'s';
95        pidL.Parameters.tau=1*'s';
96        pidL.Parameters.tauSet=1*'s';
97        pidL.Parameters.alpha =1;
98        pidL.Parameters.beta =1;
99    pidL.Parameters.gamma =1;
100        #Level controller configuration
101        pidL.Options.autoMan=0;         
102        pidL.Options.clip=1;                   
103        pidL.Options.action =-1;
104       
105        #Pressure controller parameters
106        pidP.Parameters.bias=0.5;       
107        pidP.Parameters.gain=0.9275;
108        pidP.Parameters.derivTime=18*'s';
109        pidP.Parameters.intTime=72*'s';
110        pidP.Parameters.tau=1*'s';
111        pidP.Parameters.tauSet=1*'s';
112        pidP.Parameters.alpha =1;
113        pidP.Parameters.beta =1;
114        pidP.Parameters.gamma =1;
115        #Pressure controller configuration
116        pidP.Options.autoMan=0;         
117        pidP.Options.clip=1;           
118        pidP.Options.action =-1;
119
120        EQUATIONS
121        #Feed stream
122        s1.Outlet.z = [0.3, 0.3, 0.4]; 
123        s1.Outlet.P = 5 * 'atm';       
124       
125        #Disturbance
126        if time < 0.5*'h' then
127                s1.Outlet.T = 338 * 'K';
128                s1.Outlet.F = 496.3 * 'kmol/h';
129        else
130                s1.Outlet.T = 360 * 'K';
131                s1.Outlet.F = 450 * 'kmol/h';
132        end
133
134        #Control variables: fl.Level and fl.OutletV.P
135        #Normalized control variables
136        L_ad*(LMax-LMin)=fl.Level-LMin;
137        P_ad*(PMax-PMin)=fl.OutletV.P-PMin;
138       
139        #Controllers input ports
140        pidL.Ports.input=L_ad;
141        pidP.Ports.input=P_ad; 
142       
143        #Setpoint change
144        if time < 2*'h' then
145                pidP.Ports.setPoint=0.501822;
146        else
147                pidP.Ports.setPoint=0.8474576;
148        end     
149       
150        #Controllers output ports
151        #Manipulated variables: fl.OutletV.F (pressure control) and fl.OutletL.F (level control)
152        fl.OutletV.F = pidP.Ports.output*(FVMax-FVMin)+FVMin;
153        fl.OutletL.F = pidL.Ports.output*(FLMax-FLMin)+FLMin;
154
155        INITIAL
156        fl.OutletL.T = 340 *'K';
157        fl.Level = 1* 'm';
158        fl.OutletL.z(1) = 0.1;
159        fl.OutletL.z(2) = 0.1;
160
161        OPTIONS
162        TimeStep = 0.02;
163        TimeEnd = 3;
164        TimeUnit = 'h';
165        DAESolver(File="dassl");
166end
167
168
169
Note: See TracBrowser for help on using the repository browser.