Skip to content

Commit 9172157

Browse files
authored
Replace custom clamp function with Base.clamp
1 parent 0e75c63 commit 9172157

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Blocks/nonlinear.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
_clamp(u, u_min, u_max) = max(min(u, u_max), u_min)
21
_dead_zone(u, u_min, u_max) = ifelse(u > u_max, u - u_max, ifelse(u < u_min, u - u_min, 0))
32

43
"""
@@ -25,7 +24,7 @@ Limit the range of a signal.
2524
description="Minimum allowed output of Limiter $name"
2625
]
2726
eqs = [
28-
y ~ _clamp(u, y_min, y_max)
27+
y ~ clamp(u, y_min, y_max)
2928
]
3029
extend(System(eqs, t, [], pars; name = name), siso)
3130
end
@@ -111,7 +110,7 @@ Initial value of state `Y` can be set with `int.y`
111110
@unpack y, u = siso
112111

113112
eqs = [
114-
D(y) ~ max(min((u - y) / Td, rising), falling)
113+
D(y) ~ clamp((u - y) / Td, falling, rising)
115114
]
116115

117116
initialization_eqs = [

0 commit comments

Comments
 (0)