Skip to content

Commit 211ac8b

Browse files
committed
Fix anti-windup for P controller
1 parent 9ac4d03 commit 211ac8b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/DiscretePIDs.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ function DiscretePID(;
7575
0 b 1 || throw(ArgumentError("b must be ∈ [0, 1]"))
7676
umax > umin || throw(ArgumentError("umax must be greater than umin"))
7777

78-
ar = Ts / Tt
78+
if Ti > 0
79+
ar = Ts / Tt
80+
else
81+
ar = zero(Ts / Tt)
82+
end
7983
ad = Td / (Td + N * Ts)
8084
bd = K * N * ad
8185

0 commit comments

Comments
 (0)