Changeset 377
- Timestamp:
- 02/27/2006 11:47:53 AM (3 years ago)
- Location:
- Modelica/trunk/Blocks
- Files:
-
- 2 modified
-
Continuous.mo (modified) (1 diff)
-
Nonlinear.mo (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Modelica/trunk/Blocks/Continuous.mo
r371 r377 286 286 " y = " + String(y) + ", outMin = " + String(outMin) + ", outMax = " + String(outMax)); 287 287 else 288 der(y) = if y < outMin and u < 0 or y > outMax and u > 0 then 0 else k*u;288 der(y) = smooth(0,if y < outMin and u < 0 or y > outMax and u > 0 then 0 else k*u); 289 289 end if; 290 290 end LimIntegrator; -
Modelica/trunk/Blocks/Nonlinear.mo
r371 r377 110 110 " u = " + String(u) + ", uMin = " + String(uMin) + ", uMax = " + String(uMax)); 111 111 else 112 y = if u > uMax then uMax else if u < uMin then uMin else u;112 y = smooth(0,if u > uMax then uMax else if u < uMin then uMin else u); 113 113 end if; 114 114 end Limiter; … … 194 194 " u = " + String(u) + ", uMin = " + String(uMin) + ", uMax = " + String(uMax)); 195 195 else 196 y = if u > uMax then uMax else if u < uMin then uMin else u;196 y = smooth(0,if u > uMax then uMax else if u < uMin then uMin else u); 197 197 end if; 198 198 end VariableLimiter; … … 200 200 block DeadZone "Provide a region of zero output" 201 201 parameter Real uMax=1 "Upper limits of dead zones"; 202 parameter Real uMin (max=uMax) =-uMax "Lower limits of dead zones";202 parameter Real uMin=-uMax "Lower limits of dead zones"; 203 203 parameter Boolean deadZoneAtInit = true 204 204 "= false, if dead zone is ignored during initializiation (i.e., y=u)"; … … 264 264 style(color=10)))); 265 265 equation 266 assert(uMax >= uMin, "DeadZone: Limits must be consistent. However, uMax (=" + String(uMax) + 267 ") < uMin (=" + String(uMin) + ")"); 268 266 269 if initial() and not deadZoneAtInit then 267 270 y = u; 268 271 else 269 y = if u > uMax then u - uMax else if u < uMin then u - uMin else 0;272 y = smooth(0,if u > uMax then u - uMax else if u < uMin then u - uMin else 0); 270 273 end if; 271 274 end DeadZone;
