- Timestamp:
- Jun 21, 2007, 4:48:17 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/eml/controllers/PIDIncr.mso
r294 r295 57 57 Pallete = false; 58 58 Brief = "Model of Ports to be used with incremental PIDs."; 59 59 60 VARIABLES 60 61 … … 70 71 Pallete = false; 71 72 Brief = "Model of Internal Variables to be used with incremental PIDs."; 73 72 74 VARIABLES 73 75 -
trunk/eml/controllers/PIDs.mso
r243 r295 12 12 * EMSO is distributed under the therms of the ALSOC LICENSE as 13 13 * available at http://www.enq.ufrgs.br/alsoc. 14 *15 *-------------------------------------------------------------------16 * Model of PIDs17 *--------------------------------------------------------------------18 * - Inputs19 * - a scaled processs variable20 * - a scaled bias21 * - a scaled setpoint22 *23 * - Outputs24 * - a scaled output25 *26 *27 14 *-------------------------------------------------------------------- 28 15 * Author: Tiago Osório … … 33 20 Model MParameters 34 21 22 ATTRIBUTES 23 Pallete = false; 24 Brief = "Model of Parameters to be used with PIDs."; 25 35 26 VARIABLES 36 27 … … 49 40 Model MOptions 50 41 42 ATTRIBUTES 43 Pallete = false; 44 Brief = "Model of Options to be used with PIDs."; 45 51 46 VARIABLES 52 47 … … 59 54 Model MPorts 60 55 56 ATTRIBUTES 57 Pallete = false; 58 Brief = "Model of Ports to be used with PIDs."; 59 61 60 VARIABLES 62 61 … … 68 67 69 68 Model MInternal_Variables 69 70 ATTRIBUTES 71 Pallete = false; 72 Brief = "Model of Internal Variables to be used with PIDs."; 70 73 71 74 VARIABLES … … 85 88 end 86 89 87 Model PID_basic 88 90 Model PID 91 92 ATTRIBUTES 93 Pallete = true; 94 Icon = "PID"; 95 Brief = "Model of PIDs."; 96 Info = 97 " 98 - Inputs 99 * - a scaled processs variable. 100 * - a scaled bias. 101 * - a scaled setpoint. 102 103 - Outputs 104 * - a scaled output. 105 "; 106 107 PARAMETERS 108 PID_Select as Switcher (Brief="Type of PID", Valid=["Ideal","Parallel","Series","Ideal_AWBT","Parallel_AWBT","Series_AWBT","Ideal_AW","Parallel_AW","Series_AW"], Default = "Ideal"); 109 89 110 VARIABLES 90 111 Parameters as MParameters; … … 92 113 Internal as MInternal_Variables; 93 114 Ports as MPorts; 115 AWFactor as Real (Brief="Integral term multiplier used in anti-reset windup"); 116 117 INITIAL 118 Internal.intTerm = 0; 119 diff(Internal.dFilt) = 0/'s'; 120 diff(Internal.inputFilt) = 0/'s'; 121 diff(Internal.setPointFilt) = 0/'s'; 94 122 95 123 EQUATIONS … … 157 185 end 158 186 159 INITIAL 160 Internal.intTerm = 0; 161 diff(Internal.dFilt) = 0/'s'; 162 diff(Internal.inputFilt) = 0/'s'; 163 diff(Internal.setPointFilt) = 0/'s'; 164 end 165 166 167 Model PID_Ideal_AW as PID_basic 168 169 VARIABLES 170 AWFactor as Real (Brief="Integral term multiplier used in anti-reset windup"); 171 172 EQUATIONS 187 switch PID_Select 188 189 case "Ideal_AW": 173 190 174 191 "Calculate integral term with anti-windup" … … 185 202 AWFactor=1; 186 203 end 187 end 188 189 Model PID_Parallel_AW as PID_basic 190 191 VARIABLES 192 AWFactor as Real (Brief="Integral term multiplier used in anti-reset windup"); 193 194 EQUATIONS 204 205 case "Parallel_AW": 195 206 196 207 "Calculate integral term with anti-windup" … … 207 218 AWFactor=1; 208 219 end 209 end 210 211 Model PID_Series_AW as PID_basic 212 213 VARIABLES 214 AWFactor as Real (Brief="Integral term multiplier used in anti-reset windup"); 215 216 EQUATIONS 217 220 221 222 case "Series_AW": 223 218 224 "Calculate integral term with anti-windup" 219 225 Parameters.intTime*diff(Internal.intTerm) = AWFactor*Internal.errorI; … … 229 235 AWFactor=1; 230 236 end 231 end 232 233 Model PID_Ideal as PID_basic 234 235 EQUATIONS 237 238 case "Ideal": 236 239 237 240 "Calculate integral term" … … 241 244 Internal.outp = Parameters.bias + Options.action*Parameters.gain*(Internal.propTerm + Internal.intTerm + Internal.derivTerm); 242 245 243 end 244 245 Model PID_Parallel as PID_basic 246 247 EQUATIONS 246 "Calculate AWFactor - Not in use in this mode" 247 AWFactor=1; 248 249 case "Parallel": 248 250 249 251 "Calculate integral term" … … 253 255 Internal.outp = Parameters.bias + Options.action*(Parameters.gain*Internal.propTerm + Internal.intTerm + Internal.derivTerm); 254 256 255 end 256 257 Model PID_Series as PID_basic 258 259 EQUATIONS 257 "Calculate AWFactor - Not in use in this mode" 258 AWFactor=1; 259 260 case "Series": 260 261 261 262 "Calculate integral term" … … 264 265 "Sum of proportional, integral and derivative terms" 265 266 Internal.outp = Parameters.bias + Options.action*(Parameters.gain*(Internal.propTerm + Internal.intTerm)*(1 + Internal.derivTerm)); 266 267 end 268 269 Model PID_Ideal_AWBT as PID_basic 270 271 EQUATIONS 267 268 "Calculate AWFactor - Not in use in this mode" 269 AWFactor=1; 270 271 case "Ideal_AWBT": 272 272 273 273 "Calculate integral term with anti-windup and bumpless transfer" … … 276 276 "Sum of proportional, integral and derivative terms" 277 277 Internal.outp = Parameters.bias + Options.action*Parameters.gain*(Internal.propTerm + Internal.intTerm + Internal.derivTerm); 278 279 end 280 281 Model PID_Parallel_AWBT as PID_basic 282 283 EQUATIONS 278 279 "Calculate AWFactor - Not in use in this mode" 280 AWFactor=1; 281 282 case "Parallel_AWBT": 284 283 285 284 "Calculate integral term with anti-windup and bumpless transfer" … … 288 287 "Sum of proportional, integral and derivative terms" 289 288 Internal.outp = Parameters.bias + Options.action*(Parameters.gain*Internal.propTerm + Internal.intTerm + Internal.derivTerm); 290 291 end 292 293 Model PID_Series_AWBT as PID_basic 294 295 EQUATIONS 289 290 "Calculate AWFactor - Not in use in this mode" 291 AWFactor=1; 292 293 case "Series_AWBT": 296 294 297 295 "Calculate integral term with anti-windup and bumpless transfer" … … 301 299 Internal.outp = Parameters.bias + Options.action*(Parameters.gain*(Internal.propTerm + Internal.intTerm)*(1 + Internal.derivTerm)); 302 300 303 end 301 "Calculate AWFactor - Not in use in this mode" 302 AWFactor=1; 303 304 end 305 306 end -
trunk/sample/controllers/CSTR_noniso_pid.mso
r257 r295 102 102 FEED as corrente; 103 103 CSTR1 as CSTR; 104 PIDL as PID _Ideal_AWBT;105 PIDT as PID _Ideal_AWBT;104 PIDL as PID; 105 PIDT as PID; 106 106 107 107 VARIABLES … … 129 129 CSTR1.A = 8 * 'm^2'; 130 130 CSTR1.At = 25 * 'm^2'; 131 132 PIDL.PID_Select = "Ideal_AWBT"; 133 PIDT.PID_Select = "Ideal_AWBT"; 131 134 132 135 EQUATIONS -
trunk/sample/controllers/sample_tanks_pid.mso
r294 r295 30 30 DEVICES 31 31 Tanque1 as tank; 32 PID as PIDIncr;32 PIDc as PIDIncr; 33 33 34 34 PARAMETERS … … 45 45 h_max = 2 * 'm'; 46 46 h_min = 0 * 'm'; 47 PID .PID_Select = "Ideal_AWBT";47 PIDc.PID_Select = "Ideal_AWBT"; 48 48 49 49 EQUATIONS 50 PID .Parameters.tau = 1*'s';51 PID .Parameters.tauSet = 1*'s';52 PID .Parameters.alpha = 0.3;53 PID .Parameters.bias = 0;54 PID .Parameters.gamma = 1;55 PID .Parameters.beta = 1;56 PID .Options.action = -1;57 PID .Options.clip=1;58 PID .Options.autoMan = 0;59 PID .Parameters.intTime=5000*'s';60 PID .Parameters.gain = 3.5;61 PID .Parameters.derivTime=1*'s';62 PID .Ports.input = h_ad;50 PIDc.Parameters.tau = 1*'s'; 51 PIDc.Parameters.tauSet = 1*'s'; 52 PIDc.Parameters.alpha = 0.3; 53 PIDc.Parameters.bias = 0; 54 PIDc.Parameters.gamma = 1; 55 PIDc.Parameters.beta = 1; 56 PIDc.Options.action = -1; 57 PIDc.Options.clip=1; 58 PIDc.Options.autoMan = 0; 59 PIDc.Parameters.intTime=5000*'s'; 60 PIDc.Parameters.gain = 3.5; 61 PIDc.Parameters.derivTime=1*'s'; 62 PIDc.Ports.input = h_ad; 63 63 h_ad = (Tanque1.h-h_min)/(h_max-h_min); 64 Tanque1.k = 8*'m^2.5/h'*PID .Ports.output;64 Tanque1.k = 8*'m^2.5/h'*PIDc.Ports.output; 65 65 66 66 #Perturbação servo 67 67 #Nível desejado=1*'m' 68 PID .Ports.setPoint=0.5;68 PIDc.Ports.setPoint=0.5; 69 69 70 70 #Perturbação regulatória … … 89 89 DEVICES 90 90 Tanque1 as tank; 91 PID as PID_Ideal_AWBT;91 PIDx as PID; 92 92 93 93 PARAMETERS … … 104 104 h_max = 2 * 'm'; 105 105 h_min = 0 * 'm'; 106 106 PIDx.PID_Select = "Ideal_AWBT"; 107 107 108 EQUATIONS 108 PID .Parameters.tau = 1*'s';109 PID .Parameters.tauSet = 1*'s';110 PID .Parameters.alpha = 0.3;111 PID .Parameters.bias = 0;112 PID .Parameters.gamma = 1;113 PID .Parameters.beta = 1;114 PID .Parameters.intTime=5000*'s';115 PID .Parameters.gain =3.5;116 PID .Parameters.derivTime=1*'s';117 PID .Options.action = -1;118 PID .Options.clip=1;119 PID .Options.autoMan = 0;120 PID .Ports.input = h_ad;109 PIDx.Parameters.tau = 1*'s'; 110 PIDx.Parameters.tauSet = 1*'s'; 111 PIDx.Parameters.alpha = 0.3; 112 PIDx.Parameters.bias = 0; 113 PIDx.Parameters.gamma = 1; 114 PIDx.Parameters.beta = 1; 115 PIDx.Parameters.intTime=5000*'s'; 116 PIDx.Parameters.gain =3.5; 117 PIDx.Parameters.derivTime=1*'s'; 118 PIDx.Options.action = -1; 119 PIDx.Options.clip=1; 120 PIDx.Options.autoMan = 0; 121 PIDx.Ports.input = h_ad; 121 122 h_ad = (Tanque1.h-h_min)/(h_max-h_min); 122 Tanque1.k = 8*'m^2.5/h'*PID .Ports.output;123 Tanque1.k = 8*'m^2.5/h'*PIDx.Ports.output; 123 124 124 125 #Perturbação servo 125 126 #Nível desejado=1*'m' 126 PID .Ports.setPoint=0.5;127 PIDx.Ports.setPoint=0.5; 127 128 128 129 #Perturbação regulatória
Note: See TracChangeset
for help on using the changeset viewer.