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 318 2007-07-19 04:23:31Z arge $ |
---|
24 | *--------------------------------------------------------------------*# |
---|
25 | using "stage_separators/batch_dist"; |
---|
26 | using "controllers/PIDs"; |
---|
27 | |
---|
28 | FlowSheet 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 liquid_stream; |
---|
48 | feed as source; |
---|
49 | pidP as PID; |
---|
50 | Q as energy_source; |
---|
51 | |
---|
52 | CONNECTIONS |
---|
53 | reflux to batch.InletL; |
---|
54 | feed.Outlet to batch.Inlet; |
---|
55 | Q.OutletQ to batch.InletQ; |
---|
56 | |
---|
57 | EQUATIONS |
---|
58 | if batch.Level > 1E-3 then |
---|
59 | Q.OutletQ.Q = 3.7743e6 * 'kJ/h'; |
---|
60 | else |
---|
61 | Q.OutletQ.Q = 0 * 'kJ/h'; |
---|
62 | end |
---|
63 | |
---|
64 | "Pressure Controller" |
---|
65 | pidP.Parameters.tau = 0*'s'; |
---|
66 | pidP.Parameters.tauSet = 0*'s'; |
---|
67 | pidP.Parameters.alpha = 0.3; |
---|
68 | pidP.Parameters.bias = 0; |
---|
69 | pidP.Parameters.gamma = 1; |
---|
70 | pidP.Parameters.beta = 1; |
---|
71 | pidP.Options.action = -1; |
---|
72 | pidP.Options.clip = 1; |
---|
73 | pidP.Options.autoMan = 0; |
---|
74 | pidP.Parameters.intTime = 0.1*'min'; |
---|
75 | pidP.Parameters.gain = 1; |
---|
76 | pidP.Parameters.derivTime = 0.02*'min'; |
---|
77 | pidP.Ports.setPoint = (P_set-P_min)/(P_max-P_min); |
---|
78 | pidP.Ports.input = P_ad; |
---|
79 | P_ad = (batch.P-P_min)/(P_max-P_min); |
---|
80 | batch.OutletV.F = 500 * 'kmol/h' * pidP.Ports.output; |
---|
81 | |
---|
82 | SPECIFY |
---|
83 | reflux.F = 0 * 'kmol/h'; |
---|
84 | reflux.T = 328 * 'K'; |
---|
85 | reflux.P = 180 * 'kPa'; |
---|
86 | reflux.z = [0.5, 0.5]; |
---|
87 | |
---|
88 | feed.Outlet.F = 0 * 'kmol/h'; |
---|
89 | feed.Outlet.T = 328 * 'K'; |
---|
90 | feed.Outlet.P = 180 * 'kPa'; |
---|
91 | feed.Outlet.z = [0.5, 0.5]; |
---|
92 | |
---|
93 | P_set = 300 * 'kPa'; |
---|
94 | |
---|
95 | SET |
---|
96 | pidP.PID_Select = "Ideal_AWBT"; |
---|
97 | batch.V = 3 * 'm^3'; |
---|
98 | batch.Across = 1 * 'm^2'; |
---|
99 | P_max = 500 * 'kPa'; |
---|
100 | P_min = 100 * 'kPa'; |
---|
101 | |
---|
102 | INITIAL |
---|
103 | batch.T = 298 *'K'; |
---|
104 | batch.Level = 2.5 * 'm'; |
---|
105 | batch.x(2) = 0.2; |
---|
106 | |
---|
107 | OPTIONS |
---|
108 | TimeEnd = 6; |
---|
109 | TimeStep = 0.01; |
---|
110 | TimeUnit = 'min'; |
---|
111 | end |
---|