Skip to content

Commit acd4bdb

Browse files
authored
Merge branch 'main' into fp
2 parents cc3dc41 + bafb150 commit acd4bdb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/DiscretePIDs.jl

+5-1
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

test/runtests.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ res2 = lsim(P, ctrl, 3)
144144

145145
# plot([res, res2], plotu=true)
146146
@test maximum(res2.u) == umax
147+
@test pid.I == 0.0
147148

148149

149150
@test DiscretePID(Ts=1f0) isa DiscretePID{Float32}
150151
@test DiscretePID(Ts=1.0) isa DiscretePID{Float64}
151152

152-
153-
end
153+
end

0 commit comments

Comments
 (0)