DiscretePIDs.DiscretePID
— TypeDiscretePID{T}
DiscretePIDs.DiscretePID
— MethodDiscretePID(; K = 1, Ti = false, Td = false, Tt = √(Ti*Td), N = 10, b = 1, umin = -Inf, umax = Inf, Ts, I = 0, D = 0, yold = 0)
A discrete-time PID controller with set-point weighting and integrator anti-windup. The controller is implemented on the standard form
\[u = K \left( e + \dfrac{1}{Ti} \int e dt + T_d \dfrac{de}{dt} \right)\]
\[U(s) = K \left( bR(s) - Y(s) + \dfrac{1}{sT_i} \left( R(s) Y(s) \right) - \dfrac{sT_d}{1 + s T_d / N}Y(s)\]
Call the controller like this
u = pid(r, y, uff) # uff is optional
u = calculate_control!(pid, r, y, uff) # Equivalent to the above
Arguments:
K
: Proportional gainTi
: Integral timeTd
: Derivative timeTt
: Reset time for anti-windupN
: Maximum derivative gainb
: Fraction of set point in proportional termumin
: Low output limitumax
: High output limitTs
: Sampling periodI
: Integral partD
: Derivative partyold
: Last measurement signal
See also calculate_control!
, set_K!
, set_Ti!
, set_Td!
DiscretePIDs.calculate_control!
— Methodu = calculate_control!(pid::DiscretePID, r, y, uff=0)
(pid)(r, y, uff=0) # Alternative syntax
Calculate the control output from the PID controller when r
is the reference (set point), y
is the latest measurement and uff
is the feed-forward contribution. If the type of the input arguments differ from the numeric type used by the PID controller, they will be converted before computations are performed.
DiscretePIDs.set_K!
— Methodset_K!(pid::DiscretePID, K, r, y)
Update K
in the PID controller. This function takes the current reference and measurement as well in order to provide bumpless transfer. This is realized by updating the internal state I
.
DiscretePIDs.set_Td!
— Methodset_Td!(pid::DiscretePID, Td)
Update Td
in the PID controller.
DiscretePIDs.set_Ti!
— Methodset_Ti!(pid::DiscretePID, Ti)
Update Ti
in the PID controller.