Skip to content

Commit

Permalink
typefix
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Mar 7, 2024
1 parent 6fbc334 commit 2927113
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/DiscretePIDs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ mutable struct DiscretePID{T} <: Function
yold::T
end

floattype(K) = float(typeof(K))

"""
DiscretePID(; K = 1, Ti = false, Td = false, Tt = √(Ti*Td), N = 10, b = 1, umin = -Inf, umax = Inf, Ts, I = 0, D = 0, yold = 0)
Expand Down Expand Up @@ -79,15 +77,15 @@ function DiscretePID(;
K::T = 1f0,
Ti = false,
Td = false,
Tt = Ti > 0 && Td > 0 ? floattype(K)((Ti*Td)) : floattype(K)(10),
N = floattype(K)(10),
b = floattype(K)(1),
umin = typemin(floattype(K)),
umax = typemax(floattype(K)),
Tt = Ti > 0 && Td > 0 ? typeof(K)((Ti*Td)) : typeof(K)(10),
N = typeof(K)(10),
b = typeof(K)(1),
umin = typemin(typeof(K)),
umax = typemax(typeof(K)),
Ts,
I = zero(floattype(K)),
D = zero(floattype(K)),
yold = zero(floattype(K)),
I = zero(typeof(K)),
D = zero(typeof(K)),
yold = zero(typeof(K)),
) where T
if Ti > 0
bi = K * Ts / Ti
Expand Down

0 comments on commit 2927113

Please sign in to comment.