Changeset 295 for trunk/eml/controllers/PIDs.mso
- Timestamp:
- Jun 21, 2007, 4:48:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.