source: branches/newlanguage/sample/controllers/Sample_flash_pid.mso @ 180

Last change on this file since 180 was 84, checked in by Paula Bettio Staudt, 17 years ago

Updated controllers sample files header

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 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 84 2006-12-08 20:37:22Z paula $
24*------------------------------------------------------------------*#
25
26using "stage_separators/flash";
27using "controllers/PIDIncr";
28
29FlowSheet Flash_Dynamic
30       
31        PARAMETERS
32        PP      as CalcObject(Brief="Physical Properties",File="vrpp");
33        NComp   as Integer;
34        #Valores utilizados na normalização do nível e da pressão do flash
35        #Vazões mínimas e máximas das correntes de vapor e líquido
36        FVMin as flow_mol;
37        FVMax as flow_mol;
38        FLMax as flow_mol;
39        FLMin as flow_mol;
40        #Pressão máxima e mínima
41        PMin as pressure;
42        PMax as pressure;
43        #Nível máximo e mínimo
44        LMax as length;
45        LMin as length;
46
47        VARIABLES
48        #Nível e Pressão normalizados
49        L_ad as Real;
50        P_ad as Real;
51        Q       as heat_rate (Brief="Heat supplied");
52       
53        DEVICES
54        #Controlador para o nível
55        pidL as PIDIncr_Parallel_AWBT;
56        #Controlador para a pressão
57        pidP as PIDIncr_Parallel_AWBT;
58        fl as flash;
59        s1 as streamTP;
60       
61        SET
62        PP.Components = ["n-butane", "benzene", "n-octane"];
63        PP.LiquidModel = "PR";
64        PP.VapourModel = "PR";
65        NComp = PP.NumberOfComponents;
66       
67        #Parâmetros do modelo de flash
68        fl.V = 1 * "m^3";
69        fl.Across = 0.5* "m^2";
70       
71        #Valores máximos e mínimos para as normalizações
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 to fl.Inlet;
83        Q to fl.Q;
84       
85        SPECIFY
86
87        Q = 1026.32 * "kJ/s";
88
89        #Parâmetros do controlador de nível
90        pidL.Parameters.bias=0.5;
91        pidL.Parameters.gain=1.1776;
92        pidL.Parameters.derivTime=19*"s";
93        pidL.Parameters.intTime=76*"s";
94        pidL.Parameters.tau=1*"s";
95        pidL.Parameters.tauSet=1*"s";
96        pidL.Parameters.alpha =1;
97        pidL.Parameters.beta =1;
98    pidL.Parameters.gamma =1;
99        #Opções do controlador de nível
100        pidL.Options.autoMan=0;         
101        pidL.Options.clip=1;                   
102        pidL.Ports.setPoint=0.5;
103        pidL.Options.action =-1;
104       
105        #Parâmetros do controlador de pressão
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        #Opções do controlador de pressão
116        pidP.Options.autoMan=0;         
117        pidP.Options.clip=1;           
118        pidP.Options.action =-1;
119
120        EQUATIONS
121        #Corrente de entrada do flash
122        s1.z = [0.3, 0.3, 0.4];
123        s1.P = 5 * "atm";       
124       
125        #Distúrbio regulatório
126        if time<2000 then
127                s1.T = 338 * "K";
128                s1.F = 496.3 * "kmol/h";
129        else
130                s1.T = 360 * "K";
131                s1.F = 450 * "kmol/h";
132        end
133
134        #Normalização das variáveis controladas
135        #Variáveis controladas: fl.Level e fl.OutletV.P
136        L_ad*(LMax-LMin)=fl.Level-LMin;
137        P_ad*(PMax-PMin)=fl.OutletV.P-PMin;
138       
139        #Conexão das entradas dos pid´s
140        pidL.Ports.input=L_ad;
141        pidP.Ports.input=P_ad; 
142       
143        #Distúrbio servo
144        if time<7200 then
145                pidP.Ports.setPoint=0.501822;
146        else
147                pidP.Ports.setPoint=0.8474576;
148        end     
149       
150        #Conexão entre os controladores e o flash
151        #Variáveis manipuladas: fl.OutletV.F(controle de pressão) e fl.OutletL.F(nível)
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        relativeAccuracy = 1e-6;
163        #time = [0:100:7000 7000:0.10:8150 8150:100:10000];
164        time = [0:100:10000];
165end
166
167
168
Note: See TracBrowser for help on using the repository browser.