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 86 2006-12-08 20:58:15Z paula $ |
---|
24 | *--------------------------------------------------------------------*# |
---|
25 | using "stage_separators/batch_dist"; |
---|
26 | using "controllers/PIDs"; |
---|
27 | |
---|
28 | FlowSheet TesteBatch_PID |
---|
29 | |
---|
30 | PARAMETERS |
---|
31 | PP as CalcObject(Brief="Physical Properties",File="vrpp"); |
---|
32 | NComp as Integer; |
---|
33 | P_max as pressure(Brief="Maximum Pressure on distillator"); |
---|
34 | P_min as pressure(Brief="Minimum Pressure on distillator"); |
---|
35 | |
---|
36 | VARIABLES |
---|
37 | P_ad as fraction(Brief="Dimensionless pressure"); |
---|
38 | P_set as pressure(Brief="Minimum Pressure on distillator"); |
---|
39 | |
---|
40 | SET |
---|
41 | PP.Components = [ "isobutane", "benzene" ]; |
---|
42 | PP.LiquidModel = "PR"; |
---|
43 | PP.VapourModel = "PR"; |
---|
44 | NComp = PP.NumberOfComponents; |
---|
45 | |
---|
46 | DEVICES |
---|
47 | batch as Diff_Dist; |
---|
48 | reflux as stream_therm; |
---|
49 | feed as stream_therm; |
---|
50 | pidP as PID_Ideal_AWBT; |
---|
51 | |
---|
52 | CONNECTIONS |
---|
53 | reflux to batch.InletL; |
---|
54 | feed to batch.Inlet; |
---|
55 | |
---|
56 | EQUATIONS |
---|
57 | if batch.Level > 1E-3 then |
---|
58 | batch.Q = 3.7743e6 * "kJ/h"; |
---|
59 | else |
---|
60 | batch.Q = 0 * "kJ/h"; |
---|
61 | end |
---|
62 | |
---|
63 | "Pressure Controller" |
---|
64 | pidP.Parameters.tau = 0*"s"; |
---|
65 | pidP.Parameters.tauSet = 0*"s"; |
---|
66 | pidP.Parameters.alpha = 0.3; |
---|
67 | pidP.Parameters.bias = 0; |
---|
68 | pidP.Parameters.gamma = 1; |
---|
69 | pidP.Parameters.beta = 1; |
---|
70 | pidP.Options.action = -1; |
---|
71 | pidP.Options.clip = 1; |
---|
72 | pidP.Options.autoMan = 0; |
---|
73 | pidP.Parameters.intTime = 0.1*"min"; |
---|
74 | pidP.Parameters.gain = 1; |
---|
75 | pidP.Parameters.derivTime = 0.02*"min"; |
---|
76 | pidP.Ports.setPoint = (P_set-P_min)/(P_max-P_min); |
---|
77 | pidP.Ports.input = P_ad; |
---|
78 | P_ad = (batch.P-P_min)/(P_max-P_min); |
---|
79 | batch.OutletV.F = 500 * "kmol/h" * pidP.Ports.output; |
---|
80 | |
---|
81 | SPECIFY |
---|
82 | reflux.F = 0 * "kmol/h"; |
---|
83 | reflux.T = 328 * "K"; |
---|
84 | reflux.P = 180 * "kPa"; |
---|
85 | reflux.z = [0.5, 0.5]; |
---|
86 | reflux.v = 0; |
---|
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 | |
---|
94 | P_set = 300 * "kPa"; |
---|
95 | |
---|
96 | SET |
---|
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 | relativeAccuracy = 1e-5; |
---|
109 | |
---|
110 | time = [0:0.01:6]*"min"; |
---|
111 | end |
---|