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

Last change on this file since 900 was 634, checked in by gerson bicca, 14 years ago

updates

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