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

Last change on this file since 494 was 313, checked in by Argimiro Resende Secchi, 16 years ago

Change name of outlet energy stream to OutletQ.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 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* 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 313 2007-07-14 16:45:55Z 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        #Valores utilizados na normalização do nível e da pressão do flash
38        #Vazões mínimas e máximas das correntes de vapor e líquido
39        FVMin as flow_mol;
40        FVMax as flow_mol;
41        FLMax as flow_mol;
42        FLMin as flow_mol;
43        #Pressão máxima e mínima
44        PMin as pressure;
45        PMax as pressure;
46        #Nível máximo e mínimo
47        LMax as length;
48        LMin as length;
49
50        VARIABLES
51        #Nível e Pressão normalizados
52        L_ad as Real;
53        P_ad as Real;
54        Q       as energy_source (Brief="Heat supplied");
55       
56        DEVICES
57        #Controlador para o nível
58        pidL as PIDIncr;
59        #Controlador para a pressão
60        pidP as PIDIncr;
61        fl as flash;
62        s1 as source;
63       
64        SET
65        NComp = PP.NumberOfComponents;
66       
67        pidL.PID_Select = "Parallel_AWBT";
68        pidP.PID_Select = "Parallel_AWBT";
69       
70        #Parâmetros do modelo de flash
71        #fl.V = 1 * 'm^3';
72        #fl.Across = 0.5* 'm^2';
73        fl.diameter = 0.5 * 'm';
74        fl.orientation = "vertical";
75       
76        #Valores máximos e mínimos para as normalizações
77        PMax=2.36 *'atm';
78        PMin=0 *'atm';
79        LMax=2 *'m';
80        LMin=0 *'m';
81        FVMax=300*'kmol/h';
82        FVMin=0*'kmol/h';
83        FLMax=692.7*'kmol/h';
84        FLMin=0*'kmol/h';
85
86        CONNECTIONS
87        s1.Outlet to fl.Inlet;
88        Q.OutletQ to fl.InletQ;
89       
90        SPECIFY
91
92        Q.OutletQ.Q = 1026.32 * 'kJ/s';
93
94        #Parâmetros do controlador de nível
95        pidL.Parameters.bias=0.5;
96        pidL.Parameters.gain=1.1776;
97        pidL.Parameters.derivTime=19*'s';
98        pidL.Parameters.intTime=76*'s';
99        pidL.Parameters.tau=1*'s';
100        pidL.Parameters.tauSet=1*'s';
101        pidL.Parameters.alpha =1;
102        pidL.Parameters.beta =1;
103    pidL.Parameters.gamma =1;
104        #Opções do controlador de nível
105        pidL.Options.autoMan=0;         
106        pidL.Options.clip=1;                   
107        pidL.Ports.setPoint=0.5;
108        pidL.Options.action =-1;
109       
110        #Parâmetros do controlador de pressão
111        pidP.Parameters.bias=0.5;       
112        pidP.Parameters.gain=0.9275;
113        pidP.Parameters.derivTime=18*'s';
114        pidP.Parameters.intTime=72*'s';
115        pidP.Parameters.tau=1*'s';
116        pidP.Parameters.tauSet=1*'s';
117        pidP.Parameters.alpha =1;
118        pidP.Parameters.beta =1;
119        pidP.Parameters.gamma =1;
120        #Opções do controlador de pressão
121        pidP.Options.autoMan=0;         
122        pidP.Options.clip=1;           
123        pidP.Options.action =-1;
124
125        EQUATIONS
126        #Corrente de entrada do flash
127        s1.Outlet.z = [0.3, 0.3, 0.4]; 
128        s1.Outlet.P = 5 * 'atm';       
129       
130        #Distúrbio regulatório
131        if time<2000 then
132                s1.Outlet.T = 338 * 'K';
133                s1.Outlet.F = 496.3 * 'kmol/h';
134        else
135                s1.Outlet.T = 360 * 'K';
136                s1.Outlet.F = 450 * 'kmol/h';
137        end
138
139        #Normalização das variáveis controladas
140        #Variáveis controladas: fl.Level e fl.OutletV.P
141        L_ad*(LMax-LMin)=fl.Level-LMin;
142        P_ad*(PMax-PMin)=fl.OutletV.P-PMin;
143       
144        #Conexão das entradas dos pid´s
145        pidL.Ports.input=L_ad;
146        pidP.Ports.input=P_ad; 
147       
148        #Distúrbio servo
149        if time<7200 then
150                pidP.Ports.setPoint=0.501822;
151        else
152                pidP.Ports.setPoint=0.8474576;
153        end     
154       
155        #Conexão entre os controladores e o flash
156        #Variáveis manipuladas: fl.OutletV.F(controle de pressão) e fl.OutletL.F(nível)
157        fl.OutletV.F = pidP.Ports.output*(FVMax-FVMin)+FVMin;
158        fl.OutletL.F = pidL.Ports.output*(FLMax-FLMin)+FLMin;
159
160        INITIAL
161        fl.OutletL.T = 340 *'K';
162        fl.Level = 1* 'm';
163        fl.OutletL.z(1) = 0.1;
164        fl.OutletL.z(2) = 0.1;
165
166        OPTIONS
167        #time = [0:100:7000 7000:0.10:8150 8150:100:10000];
168        TimeStep = 100;
169        TimeEnd = 10000;
170end
171
172
173
Note: See TracBrowser for help on using the repository browser.