[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 578 2008-07-25 22:24:26Z bicca $ |
---|
| 24 | *------------------------------------------------------------------*# |
---|
| 25 | |
---|
[1] | 26 | using "stage_separators/flash"; |
---|
| 27 | using "controllers/PIDIncr"; |
---|
| 28 | |
---|
| 29 | FlowSheet 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; |
---|
[560] | 84 | |
---|
| 85 | SET |
---|
| 86 | #Level controller configuration |
---|
| 87 | pidL.bias=0.5; |
---|
| 88 | pidL.gain=1.1776; |
---|
| 89 | pidL.derivTime=19*'s'; |
---|
| 90 | pidL.intTime=76*'s'; |
---|
| 91 | pidL.tau=1*'s'; |
---|
| 92 | pidL.tauSet=1*'s'; |
---|
| 93 | pidL.alpha =1; |
---|
| 94 | pidL.beta =1; |
---|
| 95 | pidL.gamma =1; |
---|
| 96 | pidL.Mode = "Automatic"; |
---|
| 97 | pidL.Clip = "Clipped"; |
---|
| 98 | pidL.Action = "Direct"; |
---|
[1] | 99 | |
---|
[560] | 100 | #Pressure controller parameters |
---|
| 101 | pidP.bias=0.5; |
---|
| 102 | pidP.gain=0.9275; |
---|
| 103 | pidP.derivTime=18*'s'; |
---|
| 104 | pidP.intTime=72*'s'; |
---|
| 105 | pidP.tau=1*'s'; |
---|
| 106 | pidP.tauSet=1*'s'; |
---|
| 107 | pidP.alpha =1; |
---|
| 108 | pidP.beta =1; |
---|
| 109 | pidP.gamma =1; |
---|
| 110 | #Pressure controller configuration |
---|
| 111 | pidP.Mode = "Automatic"; |
---|
| 112 | pidP.Clip = "Clipped"; |
---|
| 113 | pidP.Action = "Direct"; |
---|
| 114 | |
---|
[1] | 115 | SPECIFY |
---|
| 116 | |
---|
[560] | 117 | Q.OutletQ = 1026.32 * 'kJ/s'; |
---|
[1] | 118 | |
---|
[537] | 119 | #Level controller parameters |
---|
| 120 | pidL.Ports.setPoint=0.5; |
---|
[1] | 121 | |
---|
[560] | 122 | |
---|
[1] | 123 | EQUATIONS |
---|
[537] | 124 | #Feed stream |
---|
[578] | 125 | s1.Composition = [0.3, 0.3, 0.4]; |
---|
| 126 | s1.P = 5 * 'atm'; |
---|
[1] | 127 | |
---|
[537] | 128 | #Disturbance |
---|
| 129 | if time < 0.5*'h' then |
---|
[578] | 130 | s1.T = 338 * 'K'; |
---|
| 131 | s1.F = 496.3 * 'kmol/h'; |
---|
[1] | 132 | else |
---|
[578] | 133 | s1.T = 360 * 'K'; |
---|
| 134 | s1.F = 450 * 'kmol/h'; |
---|
[1] | 135 | end |
---|
| 136 | |
---|
[537] | 137 | #Control variables: fl.Level and fl.OutletV.P |
---|
| 138 | #Normalized control variables |
---|
[1] | 139 | L_ad*(LMax-LMin)=fl.Level-LMin; |
---|
| 140 | P_ad*(PMax-PMin)=fl.OutletV.P-PMin; |
---|
| 141 | |
---|
[537] | 142 | #Controllers input ports |
---|
[1] | 143 | pidL.Ports.input=L_ad; |
---|
| 144 | pidP.Ports.input=P_ad; |
---|
| 145 | |
---|
[537] | 146 | #Setpoint change |
---|
| 147 | if time < 2*'h' then |
---|
[1] | 148 | pidP.Ports.setPoint=0.501822; |
---|
| 149 | else |
---|
| 150 | pidP.Ports.setPoint=0.8474576; |
---|
| 151 | end |
---|
| 152 | |
---|
[537] | 153 | #Controllers output ports |
---|
| 154 | #Manipulated variables: fl.OutletV.F (pressure control) and fl.OutletL.F (level control) |
---|
[1] | 155 | fl.OutletV.F = pidP.Ports.output*(FVMax-FVMin)+FVMin; |
---|
| 156 | fl.OutletL.F = pidL.Ports.output*(FLMax-FLMin)+FLMin; |
---|
| 157 | |
---|
| 158 | INITIAL |
---|
[190] | 159 | fl.OutletL.T = 340 *'K'; |
---|
| 160 | fl.Level = 1* 'm'; |
---|
[1] | 161 | fl.OutletL.z(1) = 0.1; |
---|
| 162 | fl.OutletL.z(2) = 0.1; |
---|
| 163 | |
---|
| 164 | OPTIONS |
---|
[537] | 165 | TimeStep = 0.02; |
---|
| 166 | TimeEnd = 3; |
---|
| 167 | TimeUnit = 'h'; |
---|
| 168 | DAESolver(File="dassl"); |
---|
[1] | 169 | end |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | |
---|