An I (integrating) controller with anti windup protection (rate and value limits), with varying smaple-time.
More...
|
| constexpr | IAntiWindup (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 an I (Integrator) controller with anti-windup controller.
|
| |
| constexpr | IAntiWindup (const IAntiWindup &)=default |
| | Default copy constructor.
|
| |
| constexpr void | set_param (const T &ki) |
| | Sets the integrator 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 void | reset () |
| | resets (clears) the internal states
|
| |
| constexpr T | input (const T &u, const T &Ts) |
| | Adds a new value input and sample time to calculate the next output.
|
| |
| constexpr T | operator() (const T &u, const T &Ts) |
| | Adds a new value input and sample time to calculate the next output.
|
| |
template<class T>
class controlpp::timevar::IAntiWindup< T >
An I (integrating) controller with anti windup protection (rate and value limits), with varying smaple-time.
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.
Its an I controller with a transfer function like:
\[
I(s) = \frac{k_i}{s}
\]
discretised with the tustin transformation:
\[
s = \frac{2}{T_s} \frac{1 - z^{-1}}{1 + z^{-1}}
\]
but with a conditional 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 } \frac{k_i T_s}{2} \left( u_k + u_{k-1} \right) + y_{k-1}
\end{cases}
\]
where:
- \(k_i\) is the integrator gain
- \(T_s\) is the sample-time in seconds
- \(u_k\) and \(u_{k-1}\) are the current and previous control inputs
- \(y_k\) and \(y_{k-1}\) are the current and previous control outputs
- \(max\) is the maximal output clamp at which positive integration stops
- \(min\) is the minimal outpout clamp at which negative integration stops
- \(v_p\) is the positive rate output speed clamp. (Limits integration speed)
- \(v_n\) is the negative rate output speed clamp. (Limits integration speed)
- Template Parameters
-
| T | the data type the controller uses, like float or double |
- See also
- controlpp::I