Changeset 909 for branches/gui/sample/controllers
 Timestamp:
 Feb 19, 2010, 7:08:11 PM (13 years ago)
 Location:
 branches/gui/sample/controllers
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/sample/controllers/CSTR_noniso_pid.mso
r735 r909 18 18 * Author: Argimiro R. Secchi 19 19 * $Id$ 20 * #20 **# 21 21 22 22 using "controllers/PIDs"; … … 113 113 114 114 VARIABLES 115 L_ad as Real;116 Lmin as length;117 Lmax as length;118 T_ad as Real;119 Tmin as temperature;120 Tmax as temperature;121 115 Lsp as length; 122 116 Tsp as temperature; 123 117 out LI as control_signal (Brief="Level Indicator"); 118 out TI as control_signal (Brief="Temperature Indicator"); 119 124 120 CONNECTIONS 125 121 FEED to CSTR1.Inlet; 122 LI to PIDL.Input; 123 TI to PIDT.Input; 126 124 127 125 SET … … 140 138 PIDT.PID_Select = "Ideal_AWBT"; 141 139 140 # Level control: PID parameters 141 PIDL.bias=0; 142 PIDL.alpha=0.1; 143 PIDL.Action="Direct"; 144 PIDL.gamma=1; 145 PIDL.beta=1; 146 PIDL.Clip="Clipped"; 147 PIDL.Mode="Automatic"; 148 PIDL.gain=1; 149 PIDL.intTime=2.5*'h'; 150 PIDL.derivTime=0*'s'; 151 PIDL.tau=1*'s'; 152 PIDL.tauSet=1*'s'; 153 154 # Temperature control: PID parameters 155 PIDT.bias = 0; 156 PIDT.alpha=0.1; 157 PIDT.Action="Reverse"; 158 PIDT.gamma=1; 159 PIDT.beta=1; 160 PIDT.Clip="Clipped"; 161 PIDT.Mode="Automatic"; 162 PIDT.gain=1; 163 PIDT.intTime=2.5*'h'; 164 PIDT.derivTime=1*'h'; 165 PIDT.tau=1*'s'; 166 PIDT.tauSet=1*'s'; 167 168 # Operating range for control variables 169 PIDL.MaxInput=5; 170 PIDL.MinInput=0; 171 PIDT.MaxInput=700; 172 PIDT.MinInput=230; 173 PIDT.MaxOutput=700; 174 PIDT.MinOutput=230; 175 142 176 EQUATIONS 143 177 144 "Dimensionless level to connect PID" 145 L_ad*(LmaxLmin)=CSTR1.hLmin; 146 PIDL.Ports.input=L_ad; 147 148 "Dimensionless temperature to connect PID" 149 T_ad*(TmaxTmin)=CSTR1.TTmin; 150 PIDT.Ports.input=T_ad; 151 178 "Level sensor" 179 LI * 'm' = CSTR1.h; 180 181 "Temperature sensor" 182 TI * 'K' = CSTR1.T; 183 184 "Setpoints" 185 PIDL.SetPoint * 'm' = Lsp; 186 PIDT.SetPoint * 'K' = Tsp; 187 152 188 "Manipulated Variables" 153 CSTR1.x = PIDL.Ports.output; 154 CSTR1.Tw = PIDT.Ports.output*(TmaxTmin)+Tmin; 155 156 # Level control: PID parameters 157 PIDL.Parameters.bias=0; 158 PIDL.Parameters.alpha=0.1; 159 PIDL.Options.action=1; 160 PIDL.Parameters.gamma=1; 161 PIDL.Parameters.beta=1; 162 PIDL.Options.clip=1; 163 PIDL.Options.autoMan=0; 164 PIDL.Parameters.gain=1; 165 PIDL.Parameters.intTime=2.5*'h'; 166 PIDL.Parameters.derivTime=0*'s'; 167 PIDL.Ports.setPoint=(Lsp  Lmin)/(Lmax  Lmin); 168 PIDL.Parameters.tau=1*'s'; 169 PIDL.Parameters.tauSet=1*'s'; 170 171 # Temperature control: PID parameters 172 PIDT.Parameters.bias = 0; 173 PIDT.Parameters.alpha=0.1; 174 PIDT.Options.action=1; 175 PIDT.Parameters.gamma=1; 176 PIDT.Parameters.beta=1; 177 PIDT.Options.clip=1; 178 PIDT.Options.autoMan=0; 179 PIDT.Parameters.gain=1; 180 PIDT.Parameters.intTime=2.5*'h'; 181 PIDT.Parameters.derivTime=1*'h'; 182 PIDT.Ports.setPoint=(Tsp  Tmin)/(Tmax  Tmin); 183 PIDT.Parameters.tau=1*'s'; 184 PIDT.Parameters.tauSet=1*'s'; 185 186 "Operating range for control variables" 187 Lmax=5*'m'; 188 Lmin=0*'m'; 189 Tmax=700*'K'; 190 Tmin=230*'K'; 189 CSTR1.x = PIDL.Output; 190 CSTR1.Tw = PIDT.Output * 'K'; 191 191 192 192 "Feed Stream" 
branches/gui/sample/controllers/Sample_flash_pid.mso
r735 r909 22 22 * Author: Rafael de Pelegrini Soares 23 23 * $Id$ 24 * #24 **# 25 25 26 26 using "stage_separators/flash"; 27 using "pressure_changers/valve.mso"; 27 28 using "controllers/PIDIncr"; 28 29 … … 35 36 VapourModel = "PR"); 36 37 NComp as Integer; 37 #Maximum and minimum vapor and liquid flow rates38 FVMin as flow_mol;39 FVMax as flow_mol;40 FLMax as flow_mol;41 FLMin as flow_mol;42 #Maximum and minimum pressure43 PMin as pressure;44 PMax as pressure;45 #Maximum and minimum level46 LMax as length;47 LMin as length;48 38 49 39 VARIABLES 50 L_ad as Real (Brief="Dimensionless level");51 P_ad as Real (Brief="Dimensionless pressure");52 40 Q as energy_source (Brief="Heat supplied"); 53 41 … … 57 45 fl as flash; 58 46 s1 as source; 59 47 valve_top as valve_flow; 48 valve_bot as valve_flow; 49 60 50 SET 61 51 NComp = PP.NumberOfComponents; … … 65 55 66 56 #Flash model parameters 67 fl. V = 10 * 'm^3';68 fl. diameter = 0.5* 'm';69 fl. orientation = "vertical";57 fl.Geometry.Lenght = 10 * 'm'; 58 fl.Geometry.Diameter = 1 * 'm'; 59 fl.Geometry.Orientation = "vertical"; 70 60 71 61 #Maximum and minimum values 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';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'; 80 70 81 71 CONNECTIONS 82 72 s1.Outlet to fl.Inlet; 83 73 Q.OutletQ to fl.InletQ; 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; 84 80 85 81 SET … … 108 104 pidP.beta =1; 109 105 pidP.gamma =1; 110 #Pressure controller configuration111 106 pidP.Mode = "Automatic"; 112 107 pidP.Clip = "Clipped"; 113 108 pidP.Action = "Direct"; 109 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 114 115 115 SPECIFY … … 118 118 119 119 #Level controller parameters 120 pidL.Ports.setPoint=0.5; 121 120 pidL.SetPoint=0.5; 122 121 123 122 EQUATIONS … … 134 133 s1.F = 450 * 'kmol/h'; 135 134 end 136 137 #Control variables: fl.Level and fl.OutletV.P138 #Normalized control variables139 L_ad*(LMaxLMin)=fl.LevelLMin;140 P_ad*(PMaxPMin)=fl.OutletV.PPMin;141 142 #Controllers input ports143 pidL.Ports.input=L_ad;144 pidP.Ports.input=P_ad;145 135 146 136 #Setpoint change 147 137 if time < 2*'h' then 148 pidP. Ports.setPoint=0.501822;138 pidP.SetPoint=1; 149 139 else 150 pidP. Ports.setPoint=0.8474576;140 pidP.SetPoint=2; 151 141 end 152 142 153 #Controllers output ports154 #Manipulated variables: fl.OutletV.F (pressure control) and fl.OutletL.F (level control)155 fl.OutletV.F = pidP.Ports.output*(FVMaxFVMin)+FVMin;156 fl.OutletL.F = pidL.Ports.output*(FLMaxFLMin)+FLMin;157 158 INITIAL159 fl.OutletL.T = 340 *'K';160 fl.Level = 1* 'm';161 fl.OutletL.z(1) = 0.1;162 fl.OutletL.z(2) = 0.1;163 164 143 OPTIONS 165 144 TimeStep = 0.02;
Note: See TracChangeset
for help on using the changeset viewer.