source: trunk/sample/stage_separators/sample_batch_dist_PID.mso @ 243

Last change on this file since 243 was 213, checked in by Rafael de Pelegrini Soares, 17 years ago

Adapted some samples to the new Plugin mechanism

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.8 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 batch distillation with controllers
17*--------------------------------------------------------------------
18*
19* This sample file needs VRTherm DEMO (www.vrtech.com.br) to run.
20*
21*----------------------------------------------------------------------
22* Author:
23* $Id: sample_batch_dist_PID.mso 213 2007-03-15 19:40:55Z rafael $
24*--------------------------------------------------------------------*#
25using "stage_separators/batch_dist";
26using "controllers/PIDs";
27
28FlowSheet TesteBatch_PID
29       
30        PARAMETERS
31        PP              as Plugin(Brief="Physical Properties",
32                Type="PP", Components = [ "isobutane", "benzene" ],
33                LiquidModel = "PR", VapourModel = "PR");
34        NComp   as Integer;
35        P_max   as pressure(Brief="Maximum Pressure on distillator");
36        P_min   as pressure(Brief="Minimum Pressure on distillator");
37       
38        VARIABLES
39        P_ad    as fraction(Brief="Dimensionless pressure");
40        P_set   as pressure(Brief="Minimum Pressure on distillator");
41
42        SET
43        NComp = PP.NumberOfComponents;
44       
45        DEVICES
46        batch   as Diff_Dist;
47        reflux  as stream;
48        feed    as stream;
49        pidP    as PID_Ideal_AWBT;
50       
51        CONNECTIONS
52        reflux to batch.InletL;
53        feed to batch.Inlet;
54
55        EQUATIONS
56        if batch.Level > 1E-3 then
57                batch.Q = 3.7743e6 * 'kJ/h';
58        else
59                batch.Q = 0 * 'kJ/h';
60        end
61
62    "Pressure Controller"
63        pidP.Parameters.tau = 0*'s';   
64        pidP.Parameters.tauSet = 0*'s';
65        pidP.Parameters.alpha = 0.3;
66        pidP.Parameters.bias = 0;       
67        pidP.Parameters.gamma = 1;
68        pidP.Parameters.beta = 1;
69        pidP.Options.action = -1;
70        pidP.Options.clip = 1;
71        pidP.Options.autoMan = 0;
72        pidP.Parameters.intTime = 0.1*'min';
73        pidP.Parameters.gain = 1;
74        pidP.Parameters.derivTime = 0.02*'min';
75        pidP.Ports.setPoint = (P_set-P_min)/(P_max-P_min);
76        pidP.Ports.input = P_ad;
77        P_ad = (batch.P-P_min)/(P_max-P_min);
78        batch.OutletV.F = 500 * 'kmol/h' * pidP.Ports.output;
79
80        SPECIFY
81        reflux.F = 0 * 'kmol/h';
82        reflux.T = 328 * 'K';
83        reflux.P = 180 * 'kPa';
84        reflux.z = [0.5, 0.5];
85        reflux.v = 0;
86        reflux.h = 0 * 'kJ/kmol';
87       
88        feed.F = 0 * 'kmol/h';
89        feed.T = 328 * 'K';
90        feed.P = 180 * 'kPa';
91        feed.z = [0.5, 0.5];
92        feed.v = 0;
93        feed.h = 0 * 'kJ/kmol';
94
95        P_set = 300 * 'kPa';
96
97        SET
98        batch.V = 3 * 'm^3';
99        batch.Across = 1 * 'm^2';
100        P_max = 500 * 'kPa';
101        P_min = 100 * 'kPa';
102       
103        INITIAL
104        batch.T = 298 *'K';
105        batch.Level = 2.5 * 'm';
106        batch.x(2) = 0.2;
107       
108        OPTIONS
109        RelativeAccuracy = 1e-5;
110        TimeEnd = 6;
111        TimeStep = 0.01;
112        TimeUnit = 'min';
113end
Note: See TracBrowser for help on using the repository browser.