[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 941 2011-07-15 18:44:52Z mamuller $ |
---|
[909] | 24 | *------------------------------------------------------------------*# |
---|
[84] | 25 | |
---|
[1] | 26 | using "stage_separators/flash"; |
---|
[909] | 27 | using "pressure_changers/valve.mso"; |
---|
[1] | 28 | using "controllers/PIDIncr"; |
---|
| 29 | |
---|
| 30 | FlowSheet Flash_Dynamic |
---|
| 31 | |
---|
| 32 | PARAMETERS |
---|
[216] | 33 | PP as Plugin(Brief="Physical Properties",Type="PP", |
---|
| 34 | Components = ["n-butane", "benzene", "n-octane"], |
---|
| 35 | LiquidModel = "PR", |
---|
| 36 | VapourModel = "PR"); |
---|
[1] | 37 | NComp as Integer; |
---|
| 38 | |
---|
| 39 | VARIABLES |
---|
[312] | 40 | Q as energy_source (Brief="Heat supplied"); |
---|
[1] | 41 | |
---|
| 42 | DEVICES |
---|
[537] | 43 | pidL as PIDIncr; #Level controller |
---|
| 44 | pidP as PIDIncr; #Pressure controller |
---|
[1] | 45 | fl as flash; |
---|
[190] | 46 | s1 as source; |
---|
[909] | 47 | valve_top as valve_flow; |
---|
| 48 | valve_bot as valve_flow; |
---|
| 49 | |
---|
[1] | 50 | SET |
---|
| 51 | NComp = PP.NumberOfComponents; |
---|
| 52 | |
---|
[294] | 53 | pidL.PID_Select = "Parallel_AWBT"; |
---|
| 54 | pidP.PID_Select = "Parallel_AWBT"; |
---|
| 55 | |
---|
[537] | 56 | #Flash model parameters |
---|
[941] | 57 | fl.Lenght = 10 * 'm'; |
---|
| 58 | fl.Diameter = 1 * 'm'; |
---|
| 59 | fl.Orientation = "vertical"; |
---|
[1] | 60 | |
---|
[537] | 61 | #Maximum and minimum values |
---|
[909] | 62 | pidP.MaxInput=2.36; |
---|
| 63 | pidP.MinInput=0; |
---|
| 64 | pidL.MaxInput=2; |
---|
| 65 | pidL.MinInput=0; |
---|
| 66 | valve_top.MaxFlow=300*'kmol/h'; |
---|
| 67 | valve_top.MinFlow=0*'kmol/h'; |
---|
| 68 | valve_bot.MaxFlow=692.7*'kmol/h'; |
---|
| 69 | valve_bot.MinFlow=0*'kmol/h'; |
---|
[1] | 70 | |
---|
| 71 | CONNECTIONS |
---|
[190] | 72 | s1.Outlet to fl.Inlet; |
---|
[313] | 73 | Q.OutletQ to fl.InletQ; |
---|
[909] | 74 | fl.OutletLiquid to valve_bot.Inlet; |
---|
| 75 | fl.OutletVapour to valve_top.Inlet; |
---|
| 76 | fl.LI to pidL.Input; |
---|
| 77 | fl.PI to pidP.Input; |
---|
| 78 | pidP.Output to valve_top.FlowFraction; |
---|
| 79 | pidL.Output to valve_bot.FlowFraction; |
---|
[560] | 80 | |
---|
| 81 | SET |
---|
| 82 | #Level controller configuration |
---|
| 83 | pidL.bias=0.5; |
---|
| 84 | pidL.gain=1.1776; |
---|
| 85 | pidL.derivTime=19*'s'; |
---|
| 86 | pidL.intTime=76*'s'; |
---|
| 87 | pidL.tau=1*'s'; |
---|
| 88 | pidL.tauSet=1*'s'; |
---|
| 89 | pidL.alpha =1; |
---|
| 90 | pidL.beta =1; |
---|
| 91 | pidL.gamma =1; |
---|
| 92 | pidL.Mode = "Automatic"; |
---|
| 93 | pidL.Clip = "Clipped"; |
---|
| 94 | pidL.Action = "Direct"; |
---|
[1] | 95 | |
---|
[560] | 96 | #Pressure controller parameters |
---|
| 97 | pidP.bias=0.5; |
---|
| 98 | pidP.gain=0.9275; |
---|
| 99 | pidP.derivTime=18*'s'; |
---|
| 100 | pidP.intTime=72*'s'; |
---|
| 101 | pidP.tau=1*'s'; |
---|
| 102 | pidP.tauSet=1*'s'; |
---|
| 103 | pidP.alpha =1; |
---|
| 104 | pidP.beta =1; |
---|
| 105 | pidP.gamma =1; |
---|
| 106 | pidP.Mode = "Automatic"; |
---|
| 107 | pidP.Clip = "Clipped"; |
---|
| 108 | pidP.Action = "Direct"; |
---|
| 109 | |
---|
[909] | 110 | #Initial conditions |
---|
| 111 | fl.Levelpercent_Initial = 0.5; |
---|
| 112 | fl.Temperature_Initial = 340 * 'K'; |
---|
| 113 | fl.Composition_Initial = [0.1, 0.1, 0.8]; |
---|
| 114 | |
---|
[1] | 115 | SPECIFY |
---|
| 116 | |
---|
[560] | 117 | Q.OutletQ = 1026.32 * 'kJ/s'; |
---|
[1] | 118 | |
---|
[537] | 119 | #Level controller parameters |
---|
[909] | 120 | pidL.SetPoint=0.5; |
---|
[1] | 121 | |
---|
| 122 | EQUATIONS |
---|
[537] | 123 | #Feed stream |
---|
[578] | 124 | s1.Composition = [0.3, 0.3, 0.4]; |
---|
| 125 | s1.P = 5 * 'atm'; |
---|
[1] | 126 | |
---|
[537] | 127 | #Disturbance |
---|
| 128 | if time < 0.5*'h' then |
---|
[578] | 129 | s1.T = 338 * 'K'; |
---|
| 130 | s1.F = 496.3 * 'kmol/h'; |
---|
[1] | 131 | else |
---|
[578] | 132 | s1.T = 360 * 'K'; |
---|
| 133 | s1.F = 450 * 'kmol/h'; |
---|
[1] | 134 | end |
---|
| 135 | |
---|
[537] | 136 | #Setpoint change |
---|
| 137 | if time < 2*'h' then |
---|
[909] | 138 | pidP.SetPoint=1; |
---|
[1] | 139 | else |
---|
[909] | 140 | pidP.SetPoint=2; |
---|
[1] | 141 | end |
---|
| 142 | |
---|
| 143 | OPTIONS |
---|
[537] | 144 | TimeStep = 0.02; |
---|
| 145 | TimeEnd = 3; |
---|
| 146 | TimeUnit = 'h'; |
---|
| 147 | DAESolver(File="dassl"); |
---|
[1] | 148 | end |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | |
---|