|
| | PIAntiWindup (const T &kp, const T &ki, const T &min, const T &max, const T &vn=std::numeric_limits< T >::lowest(), const T &vp=std::numeric_limits< T >::max()) |
| | Constructs a PI (proportional + integral) controller with anti-windup.
|
| |
| | PIAntiWindup (const PIAntiWindup &)=default |
| |
| constexpr void | kp (const T &kp) |
| | sets the proportional gain
|
| |
| constexpr const T & | kp () const |
| | returns the current gain
|
| |
| constexpr void | ki (const T &ki) |
| | sets the integral gain
|
| |
| constexpr const T & | ki () const |
| | returns the current gain
|
| |
| constexpr void | prate_limit (const T &pv) |
| | Sets the positive rate limit of the I controller.
|
| |
| constexpr const T & | prate_limit () const |
| | returns the positive rate limit
|
| |
| constexpr void | nrate_limit (const T &nv) |
| | Sets the negative rate limit of the I controller.
|
| |
| constexpr const T & | nrate_limit () const |
| | returns the negative rate limit
|
| |
| constexpr void | max_limit (const T &max) |
| | Sets the maximal value limit.
|
| |
| constexpr const T & | max_limit () const |
| | returns the maximal value limit
|
| |
| constexpr void | min_limit (const T &min) |
| | Sets the minimal value limit.
|
| |
| constexpr const T & | min_limit () const |
| | returns the minimal value limit
|
| |
| constexpr T | input (const T &u, const T &Ts) |
| | Input a new sample to the controller.
|
| |
| constexpr T | operator() (const T &u, const T &Ts) |
| | Input a new sample to the controller.
|
| |
| constexpr void | reset () |
| | resets (clears) the internal states resets the internal states ( \(u_{k-1}\), \(y_{k-1}\)) to zero
|
| |
template<class T>
class controlpp::timevar::PIAntiWindup< T >
A PI (Proportional Integral) controller with varying sample-times.
Anti-windup prevents the controller’s integrator from accumulating excessive error when the actuator cannot keep up with the commanded output. Without anti-windup protection, the integrator continues to grow—even though the actuator is saturated and unable to reflect these changes—resulting in increasingly unrealistic control signals. Once the system reaches its target, the controller must then "unwind" or de-integrate the surplus error, which leads to a delayed response and potential overshoot. Anti-windup mitigates this by limiting or adjusting the integrator during saturation, improving stability and responsiveness.
Has the transfer function:
\[
\text{PI} = k_p + \frac{k_i}{s}
\]
and the discretisation using the tustin transformation:
\[
s = \frac{2}{T_s} \frac{1 - z^{-1}}{1 + z^{-1}}
\]
resulting in the controlers time series:
\[
y_k =
\begin{cases}
\if y_k > max \text{ then } max \\
\if y_k < min \text{ then } max \\
\if \frac{y_k - y_{k-1}}{Ts} > v_p \text{ then } v_p * Ts \\
\if \frac{y_k - y_{k-1}}{Ts} < v_n \text{ then } v_n * Ts \\
\text{else } \left( \frac{k_i T}{2} + k_p \right) u_k + \left( \frac{k_i T}{2} - k_p \right) u_{k-1} + y_{k-1}
\end{cases}
\]
with:
- \(T_s\) the sample-time in seconds
- \(u_{k}\) and \(u_{k-1}\) are current and previous control inputs
- \(y_{k}\) and \(y_{k-1}\) are current and previous control outputs
- See also
- controlpp::vartime::PI
- Template Parameters
-
| T | Value type of the filter like float or double |