Changeset 910 for branches/gui/sample/controllers/sample_PIDIncr_MIMO.mso
 Timestamp:
 Feb 20, 2010, 1:24:41 AM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/sample/controllers/sample_PIDIncr_MIMO.mso
r735 r910 24 24 * Author: Argimiro R. Secchi 25 25 * $Id: sample_PID_MIMO.mso 313 20070714 16:45:55Z arge $ 26 * #26 **# 27 27 28 28 using "stage_separators/column"; … … 40 40 NComp as Integer; 41 41 42 Qcmin as heat_rate (Brief="Minimum Condenser Heat supplied");43 Qcmax as heat_rate (Brief="Maximum Condenser Heat supplied");44 42 Qrmin as heat_rate (Brief="Minimum Reboiler Heat supplied"); 45 43 Qrmax as heat_rate (Brief="Maximum Reboiler Heat supplied"); 46 Frmin as flow_mol (Brief="Minimum bottom flow rate");47 Frmax as flow_mol (Brief="Maximum bottom flow rate");48 Fcmin as flow_mol (Brief="Minimum reflux flow rate");49 Fcmax as flow_mol (Brief="Maximum reflux flow rate");50 Hmint as length (Brief="Minimum liquid level in top tank");51 Hmaxt as length (Brief="Maximum liquid level in top tank");52 Hminb as length (Brief="Minimum liquid level in reboiler");53 Hmaxb as length (Brief="Maximum liquid level in reboiler");54 Pmax as pressure (Brief="Maximum column pressure");55 Pmin as pressure (Brief="Minimum column pressure");56 Tmax as temperature (Brief="Maximum column temperature");57 Tmin as temperature (Brief="Minimum column temperature");58 44 RRmax as positive (Brief="Maximum reflux ratio"); 59 45 RRmin as positive (Brief="Minimum reflux ratio"); … … 62 48 Qc as energy_source (Brief="Heat rate removed from condenser"); 63 49 Qr as energy_source (Brief="Heat rate supplied to reboiler"); 64 Had_top as Real (Brief="Dimensionless condenser level");65 Had_bot as Real (Brief="Dimensionless reboiler level");66 Pad as Real (Brief="Dimensionless pressure");67 50 P_sp as pressure (Brief="Pressure setpoint"); 68 Tad as Real (Brief="Dimensionless temperature");69 51 T_sp as temperature (Brief="Condenser temperature setpoint"); 70 52 RR as positive (Brief="Reflux ratio"); 71 LC_sp as length(Brief="Condenser level setpoint");72 LR_sp as length(Brief="Reboiler level setpoint");73 xtop as fraction (Brief="Controlled top composition");74 xbot as fraction (Brief="Controlled bottom composition");53 LC_sp as fraction (Brief="Condenser level setpoint"); 54 LR_sp as fraction (Brief="Reboiler level setpoint"); 55 out xtop as fraction (Brief="Controlled top composition"); 56 out xbot as fraction (Brief="Controlled bottom composition"); 75 57 xtop_sp as fraction (Brief="Controlled top composition setpoint"); 76 58 xbot_sp as fraction (Brief="Controlled bottom composition setpoint"); … … 80 62 81 63 DEVICES 82 col as Distillation_kettle_cond; 64 col as Section_Column; 65 cond as condenser; 66 reb as reboiler; 67 sptop as splitter_column; 68 pump1 as pump; 69 # Valve_Distillate as valve_flow; 70 # Valve_Bottom as valve_flow; 83 71 feed as source; 84 zero as stream;85 72 TCcond as PIDIncr; 86 73 LCtop as PIDIncr; … … 93 80 94 81 CONNECTIONS 95 feed.Outlet to col.trays(5).Inlet; 96 zero to col.reb.Inlet; 97 zero to col.trays([1:4]).Inlet; 98 zero to col.trays([6:col.NTrays]).Inlet; 99 Qc.OutletQ to col.cond.InletQ; 100 Qr.OutletQ to col.reb.InletQ; 82 feed.Outlet to col.FeedTray; 83 Qc.OutletQ to cond.InletQ; 84 Qr.OutletQ to reb.InletQ; 85 # sptop.Distillate to Valve_Distillate.Inlet; 86 sptop.Reflux to pump1.Inlet; 87 pump1.Outlet to col.LiquidInlet; 88 col.VapourOutlet to cond.InletVapour; 89 cond.OutletLiquid to sptop.Inlet; 90 col.LiquidOutlet to reb.InletLiquid; 91 reb.OutletVapour to col.VapourInlet; 92 # reb.OutletLiquid to Valve_Bottom.Inlet; 93 cond.TI to TCcond.Input; 94 cond.PI to PC.Input; 95 cond.LI to LCtop.Input; 96 reb.LI to LCbot.Input; 97 xtop to PID11.Input; 98 xbot to PID12.Input; 99 xtop to PID21.Input; 100 xbot to PID22.Input; 101 101 102 102 EQUATIONS 103 "Temperature Controller" 104 TCcond.Parameters.tau = 0*'s'; 105 TCcond.Parameters.tauSet = 0*'s'; 106 TCcond.Parameters.alpha = 0.3; 107 TCcond.Parameters.bias = 0.5; 108 TCcond.Parameters.gamma = 1; 109 TCcond.Parameters.beta = 1; 110 TCcond.Options.action = 1; 111 TCcond.Options.clip = 1; 112 TCcond.Options.autoMan = 0; 113 TCcond.Parameters.intTime = 60*'s'; 114 TCcond.Parameters.gain = 0.6; 115 TCcond.Parameters.derivTime = 1*'s'; 116 TCcond.Ports.setPoint = (T_sp  Tmin)/(TmaxTmin); 117 TCcond.Ports.input = Tad; 118 Tad = (col.cond.OutletL.TTmin)/(TmaxTmin); 119 Qc.OutletQ.Q = Qcmin+(QcmaxQcmin)*TCcond.Ports.output; 120 121 "Pressure Controller" 122 PC.Parameters.tau = 0*'s'; 123 PC.Parameters.tauSet = 0*'s'; 124 PC.Parameters.alpha = 0.3; 125 PC.Parameters.bias = 0; 126 PC.Parameters.gamma = 1; 127 PC.Parameters.beta = 1; 128 PC.Options.action = 1; 129 PC.Options.clip = 1; 130 PC.Options.autoMan = 0; 131 PC.Parameters.intTime = 50*'s'; 132 PC.Parameters.gain = 0.5; 133 PC.Parameters.derivTime = 1*'s'; 134 PC.Ports.setPoint = (P_spPmin)/(PmaxPmin); 135 PC.Ports.input = Pad; 136 Pad = (col.cond.OutletV.PPmin)/(PmaxPmin); 137 col.cond.OutletV.F = (Fcmin+(FcmaxFcmin)*PC.Ports.output); 103 104 TCcond.SetPoint * 'K' = T_sp; 105 Qc.OutletQ = TCcond.Output * 'kJ/h'; 106 107 PC.SetPoint * 'bar' = P_sp; 108 cond.OutletVapour.F = PC.Output * 'kmol/h'; 109 110 LCtop.SetPoint = LC_sp; 111 sptop.Distillate.F = LCtop.Output * 'kmol/h'; 112 113 LCbot.SetPoint = LR_sp; 114 reb.OutletLiquid.F = LCbot.Output * 'kmol/h'; 115 116 "MIMO PID Controller" 117 PID11.SetPoint = xtop_sp; 118 PID12.SetPoint = xbot_sp; 119 120 RR = RRmin + (RRmaxRRmin) * (PID11.Output + PID12.Output); 121 122 PID21.SetPoint = xtop_sp; 123 PID22.SetPoint = xbot_sp; 124 125 Qr.OutletQ = Qrmin + (QrmaxQrmin) * (PID21.Output + PID22.Output); 126 127 RR * (cond.OutletVapour.F + sptop.Distillate.F) = sptop.Reflux.F; 128 xtop = cond.OutletLiquid.z(4); # benzene 129 xbot = reb.OutletLiquid.z(3); # propylene 130 131 if time < 1 * 'h' then 132 feed.F = 113.4 * 'kmol/h'; 133 else 134 feed.F = 120 * 'kmol/h'; 135 end 136 137 SPECIFY 138 feed.T = 291 * 'K'; 139 feed.P = 568.3 * 'kPa'; 140 feed.Composition = 1/NComp; 138 141 139 "Ttop Level Controller" 140 LCtop.Parameters.tau = 0*'s'; 141 LCtop.Parameters.tauSet = 0*'s'; 142 LCtop.Parameters.alpha = 0.3; 143 LCtop.Parameters.bias = 0.5; 144 LCtop.Parameters.gamma = 1; 145 LCtop.Parameters.beta = 1; 146 LCtop.Options.action = 1; 147 LCtop.Options.clip = 1; 148 LCtop.Options.autoMan = 0; 149 LCtop.Parameters.intTime = 20*'s'; 150 LCtop.Parameters.gain = 1; 151 LCtop.Parameters.derivTime = 0*'s'; 152 LCtop.Ports.setPoint = (LC_sp  Hmint)/(HmaxtHmint); 153 LCtop.Ports.input = Had_top; 154 Had_top = (col.cond.LevelHmint)/(HmaxtHmint); 155 col.sptop.Outlet1.F = Fcmin + (FcmaxFcmin) * LCtop.Ports.output; 156 157 "Tbottom Level Controller" 158 LCbot.Parameters.tau = 0*'s'; 159 LCbot.Parameters.tauSet = 0*'s'; 160 LCbot.Parameters.alpha = 0.3; 161 LCbot.Parameters.bias = 0.5; 162 LCbot.Parameters.gamma = 1; 163 LCbot.Parameters.beta = 1; 164 LCbot.Options.action = 1; 165 LCbot.Options.clip = 1; 166 LCbot.Options.autoMan = 0; 167 LCbot.Parameters.intTime = 100*'s'; 168 LCbot.Parameters.gain = 1; 169 LCbot.Parameters.derivTime = 0*'s'; 170 LCbot.Ports.setPoint = (LR_sp  Hminb)/(HmaxbHminb); 171 LCbot.Ports.input = Had_bot; 172 Had_bot = (col.reb.LevelHminb)/(HmaxbHminb); 173 col.reb.OutletL.F = Frmin + (FrmaxFrmin) * LCbot.Ports.output; 174 175 "MIMO PID Controller" 176 PID11.Parameters.tau = 0*'s'; 177 PID11.Parameters.tauSet = 0*'s'; 178 PID11.Parameters.alpha = 0.3; 179 PID11.Parameters.bias = 0.1; 180 PID11.Parameters.gamma = 1; 181 PID11.Parameters.beta = 1; 182 PID11.Options.action = 1; 183 PID11.Options.clip = 1; 184 PID11.Options.autoMan = 0; 185 PID11.Parameters.intTime = 60*'s'; 186 PID11.Parameters.gain = 0.6; 187 PID11.Parameters.derivTime = 0*'s'; 188 PID11.Ports.setPoint = xtop_sp; 189 PID11.Ports.input = xtop; 190 191 PID12.Parameters.tau = 0*'s'; 192 PID12.Parameters.tauSet = 0*'s'; 193 PID12.Parameters.alpha = 0.3; 194 PID12.Parameters.bias = 0.0; 195 PID12.Parameters.gamma = 1; 196 PID12.Parameters.beta = 1; 197 PID12.Options.action = 1; 198 PID12.Options.clip = 1; 199 PID12.Options.autoMan = 0; 200 PID12.Parameters.intTime = 100*'s'; 201 PID12.Parameters.gain = 0.5; 202 PID12.Parameters.derivTime = 0*'s'; 203 PID12.Ports.setPoint = xbot_sp; 204 PID12.Ports.input = xbot; 205 206 RR = RRmin + (RRmaxRRmin) * (PID11.Ports.output + PID12.Ports.output); 207 208 PID21.Parameters.tau = 0*'s'; 209 PID21.Parameters.tauSet = 0*'s'; 210 PID21.Parameters.alpha = 0.3; 211 PID21.Parameters.bias = 0.0; 212 PID21.Parameters.gamma = 1; 213 PID21.Parameters.beta = 1; 214 PID21.Options.action = 1; 215 PID21.Options.clip = 1; 216 PID21.Options.autoMan = 0; 217 PID21.Parameters.intTime = 100*'s'; 218 PID21.Parameters.gain = 0.5; 219 PID21.Parameters.derivTime = 0*'s'; 220 PID21.Ports.setPoint = xtop_sp; 221 PID21.Ports.input = xtop; 222 223 PID22.Parameters.tau = 0*'s'; 224 PID22.Parameters.tauSet = 0*'s'; 225 PID22.Parameters.alpha = 0.3; 226 PID22.Parameters.bias = 0.5; 227 PID22.Parameters.gamma = 1; 228 PID22.Parameters.beta = 1; 229 PID22.Options.action = 1; 230 PID22.Options.clip = 1; 231 PID22.Options.autoMan = 0; 232 PID22.Parameters.intTime = 60*'s'; 233 PID22.Parameters.gain = 0.6; 234 PID22.Parameters.derivTime = 0*'s'; 235 PID22.Ports.setPoint = xbot_sp; 236 PID22.Ports.input = xbot; 237 238 Qr.OutletQ.Q = Qrmin + (QrmaxQrmin) * (PID21.Ports.output + PID22.Ports.output); 239 240 RR * (col.cond.OutletV.F + col.sptop.Outlet1.F) = col.sptop.Outlet2.F; 241 xtop = col.cond.OutletL.z(4); # benzene 242 xbot = col.reb.OutletL.z(3); # propylene 243 244 if time < 1 * 'h' then 245 feed.Outlet.F = 113.4 * 'kmol/h'; 246 else 247 feed.Outlet.F = 120 * 'kmol/h'; 248 end 249 250 SPECIFY 251 feed.Outlet.T = 290 * 'K'; 252 feed.Outlet.P = 6 * 'bar'; 253 feed.Outlet.z = 1/NComp; 254 255 zero.F = 0 * 'kmol/h'; 256 zero.T = 300 * 'K'; 257 zero.P = 1 * 'atm'; 258 zero.z = 1/NComp; 259 zero.v = 0; 260 zero.h = 0 * 'J/mol'; 261 262 # Qr.OutletQ.Q = 3e6 * 'kJ/h'; 263 col.pump1.dP = 16 * 'kPa'; 264 col.trays.Emv = 1; 265 # col.sptop.Outlet2.F = 75 * 'kmol/h'; # reflux 266 col.alfaTopo = 2; 142 # Qr.OutletQ = 3e6 * 'kJ/h'; 143 pump1.Pincrease = 16 * 'kPa'; 144 # sptop.Reflux.F = 75 * 'kmol/h'; # reflux 145 col.VapourDrawOffFlow = 0 * 'kmol/h' ; 146 col.LiquidDrawOffFlow = 0 * 'kmol/h' ; 267 147 268 148 xtop_sp = 1e3; # benzene 269 xbot_sp = 5e5; # propylene270 P_sp = 5.0*'bar';149 xbot_sp = 1e5; # propylene 150 P_sp = 4.0*'bar'; 271 151 T_sp = (15+273.15) * 'K'; 272 LC_sp = 1.0 * 'm';273 LR_sp = 1.0 * 'm';152 LC_sp = 0.5; 153 LR_sp = 0.5; 274 154 275 155 SET 276 col.NTrays = 8; 277 col.cond.V = 2 * 'm^3'; 278 col.cond.Across = 1 * 'm^2'; 279 col.trays.V = 4 * 'ft^3'; 280 col.trays.Ah = 0.394 * 'ft^2'; 281 col.trays.lw = 20.94 * 'in'; 282 col.trays.hw = 0.125 * 'ft'; 283 col.trays.Q = 0 * 'kW'; 284 col.trays.beta = 0.6; 285 col.trays.alfa = 4; 286 col.trays.Ap = 3.94 * 'ft^2'; 287 col.reb.V = 2 * 'm^3'; 288 col.reb.Across = 1 * 'm^2'; 156 col.FeedTrayLocation(1) = 5; 157 col.NumberOfTrays = 8; 158 col.LiquidSideStreamLocation = 2; 159 col.VapourSideStreamLocation = 2; 160 col.WeirLength = 20.94 * 'in'; 161 col.WeirHeight = 0.125 * 'ft'; 162 col.TrayLiquidPasses = 1; 163 col.HeatSupply = 0 * 'kW' ; 164 col.AerationFraction = 0.6; 165 col.DryPdropCoeff = 4; 166 col.MurphreeEff = 1; 167 168 cond.Geometry.Lenght = 1 * 'm'; 169 cond.Geometry.Diameter = 1 * 'm'; 170 reb.Geometry.Lenght = 2 * 'm'; 171 reb.Geometry.Diameter = 1 * 'm'; 289 172 290 173 # Controllers type … … 298 181 PID22.PID_Select = "Ideal_AW"; 299 182 183 # Temperature Controller 184 TCcond.tau = 1*'s'; 185 TCcond.tauSet = 1*'s'; 186 TCcond.alpha = 0.1; 187 TCcond.bias = 0.5; 188 TCcond.gamma = 1; 189 TCcond.beta = 1; 190 TCcond.Action = "Reverse"; 191 TCcond.Clip = "Clipped"; 192 TCcond.Mode = "Automatic"; 193 TCcond.intTime = 60*'s'; 194 TCcond.gain = 0.6; 195 TCcond.derivTime = 1*'s'; 196 197 # Pressure Controller 198 PC.tau = 1*'s'; 199 PC.tauSet = 1*'s'; 200 PC.alpha = 0.1; 201 PC.bias = 0; 202 PC.gamma = 1; 203 PC.beta = 1; 204 PC.Action = "Direct"; 205 PC.Clip = "Clipped"; 206 PC.Mode = "Automatic"; 207 PC.intTime = 50*'s'; 208 PC.gain = 0.5; 209 PC.derivTime = 1*'s'; 210 211 # Ttop Level Controller 212 LCtop.tau = 1*'s'; 213 LCtop.tauSet = 1*'s'; 214 LCtop.alpha = 0.1; 215 LCtop.bias = 0.5; 216 LCtop.gamma = 1; 217 LCtop.beta = 1; 218 LCtop.Action = "Direct"; 219 LCtop.Clip = "Clipped"; 220 LCtop.Mode = "Automatic"; 221 LCtop.intTime = 20*'s'; 222 LCtop.gain = 1; 223 LCtop.derivTime = 0*'s'; 224 225 # Tbottom Level Controller 226 LCbot.tau = 1*'s'; 227 LCbot.tauSet = 1*'s'; 228 LCbot.alpha = 0.1; 229 LCbot.bias = 0.5; 230 LCbot.gamma = 1; 231 LCbot.beta = 1; 232 LCbot.Action = "Direct"; 233 LCbot.Clip = "Clipped"; 234 LCbot.Mode = "Automatic"; 235 LCbot.intTime = 100*'s'; 236 LCbot.gain = 1.5; 237 LCbot.derivTime = 0*'s'; 238 239 # MIMO PID Controller 240 PID11.tau = 1*'s'; 241 PID11.tauSet = 1*'s'; 242 PID11.alpha = 0.1; 243 PID11.bias = 0.1; 244 PID11.gamma = 1; 245 PID11.beta = 1; 246 PID11.Action = "Direct"; 247 PID11.Clip = "Clipped"; 248 PID11.Mode = "Automatic"; 249 PID11.intTime = 60*'s'; 250 PID11.gain = 0.6; 251 PID11.derivTime = 0*'s'; 252 253 PID12.tau = 1*'s'; 254 PID12.tauSet = 1*'s'; 255 PID12.alpha = 0.1; 256 PID12.bias = 0.0; 257 PID12.gamma = 1; 258 PID12.beta = 1; 259 PID12.Action = "Direct"; 260 PID12.Clip = "Clipped"; 261 PID12.Mode = "Automatic"; 262 PID12.intTime = 100*'s'; 263 PID12.gain = 0.5; 264 PID12.derivTime = 0*'s'; 265 266 PID21.tau = 1*'s'; 267 PID21.tauSet = 1*'s'; 268 PID21.alpha = 0.1; 269 PID21.bias = 0.0; 270 PID21.gamma = 1; 271 PID21.beta = 1; 272 PID21.Action = "Reverse"; 273 PID21.Clip = "Clipped"; 274 PID21.Mode = "Automatic"; 275 PID21.intTime = 100*'s'; 276 PID21.gain = 0.5; 277 PID21.derivTime = 0*'s'; 278 279 PID22.tau = 1*'s'; 280 PID22.tauSet = 1*'s'; 281 PID22.alpha = 0.1; 282 PID22.bias = 0.5; 283 PID22.gamma = 1; 284 PID22.beta = 1; 285 PID22.Action = "Direct"; 286 PID22.Clip = "Clipped"; 287 PID22.Mode = "Automatic"; 288 PID22.intTime = 60*'s'; 289 PID22.gain = 0.6; 290 PID22.derivTime = 0*'s'; 291 292 PC.MinOutput = 0; 293 PC.MaxOutput = 120; 294 PC.MinInput = 0.5; 295 PC.MaxInput = 10; 296 LCtop.MinInput = 0; 297 LCtop.MaxInput = 1; 298 LCtop.MinOutput = 0; 299 LCtop.MaxOutput = 120; 300 LCbot.MinInput = 0; 301 LCbot.MaxInput = 1; 302 LCbot.MinOutput = 0; 303 LCbot.MaxOutput = 60; 304 TCcond.MaxOutput = 5e5; 305 TCcond.MinOutput = 5e6; 306 TCcond.MaxInput = (30+273.15); 307 TCcond.MinInput = (20+273.15); 308 PID11.MinInput = 0; 309 PID12.MinInput = 0; 310 PID21.MinInput = 0; 311 PID22.MinInput = 0; 312 PID11.MaxInput = 1; 313 PID12.MaxInput = 1; 314 PID21.MaxInput = 1; 315 PID22.MaxInput = 1; 316 RRmax = 5; 317 RRmin = 0.1; 300 318 Qrmax = 5e6 * 'kJ/h'; 301 319 Qrmin = 1e6 * 'kJ/h'; 302 Frmin = 0 * 'kmol/h'; 303 Frmax = 60 * 'kmol/h'; 304 Fcmin = 0 * 'kmol/h'; 305 Fcmax = 120 * 'kmol/h'; 306 Hmint = 0 * 'm'; 307 Hmaxt = 2 * 'm'; 308 Hminb = 0 * 'm'; 309 Hmaxb = 2 * 'm'; 310 Pmin = 0.5 * 'bar'; 311 Pmax = 10 * 'bar'; 312 Qcmax = 5e5 * 'kJ/h'; 313 Qcmin = 5e6 * 'kJ/h'; 314 Tmax = (30+273.15) * 'K'; 315 Tmin = (20+273.15) * 'K'; 316 RRmax = 5; 317 RRmin = 0.1; 318 319 INITIAL 320 321 # Initial condition 320 322 # condenser 321 co l.cond.OutletL.T = 260 *'K';322 co l.cond.Level = 1 * 'm';323 co l.cond.OutletL.z([1:4]) = [0.2, 0.2, 0.4, 0.05];323 cond.Levelpercent_Initial = 0.5; 324 cond.Initial_Temperature = 260 *'K'; 325 cond.Initial_Composition = [0.2, 0.2, 0.4, 0.05, 0.15]; 324 326 325 327 # reboiler 326 col.reb.OutletL.T = 350 *'K';327 col.reb.Level = 1 * 'm';328 col.reb.OutletL.z([1:4]) = [0.1, 0.4, 0.1, 0.3];328 reb.Levelpercent_Initial = 0.5; 329 reb.Initial_Temperature = 350 *'K'; 330 reb.Initial_Composition = [0.1, 0.4, 0.1, 0.3, 0.1]; 329 331 330 332 # column trays 331 col.trays.OutletL.T = [290:(330290)/(col.NTrays1):330] * 'K'; 332 col.trays.Level = 1.2 * col.trays.hw; 333 col.trays.OutletL.z([1:4]) = [0.15, 0.3, 0.25, 0.2]; 333 col.INITIALIZATION.TopTemperature = 290 * 'K'; 334 col.INITIALIZATION.BottomTemperature = 330 * 'K'; 335 col.INITIALIZATION.LevelFraction = 0.1; 336 col.INITIALIZATION.TopComposition = [0.2, 0.2, 0.4, 0.05, 0.15]; 337 col.INITIALIZATION.BottomComposition = [0.1, 0.4, 0.1, 0.3, 0.1]; 334 338 335 339 OPTIONS 336 340 TimeStep = 0.1; 337 TimeEnd = 6;341 TimeEnd = 5; 338 342 TimeUnit = 'h'; 339 343 InitialFile = "Column_MPID.rlt"; … … 342 346 #Dynamic = false; 343 347 end 344 *# 348
Note: See TracChangeset
for help on using the changeset viewer.