Skip to content

Commit

Permalink
Fix anti-windup for P controller
Browse files Browse the repository at this point in the history
  • Loading branch information
CasBex committed Jun 29, 2023
1 parent 9ac4d03 commit 211ac8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/DiscretePIDs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ function DiscretePID(;
0 b 1 || throw(ArgumentError("b must be ∈ [0, 1]"))
umax > umin || throw(ArgumentError("umax must be greater than umin"))

ar = Ts / Tt
if Ti > 0
ar = Ts / Tt
else
ar = zero(Ts / Tt)
end
ad = Td / (Td + N * Ts)
bd = K * N * ad

Expand Down

0 comments on commit 211ac8b

Please sign in to comment.