Blog Post:

PID Controllers and Constrained SISO Systems: A Practical Control Design Challenge

Home » Blog » PID Controllers and Constrained SISO Systems: A Practical Control Design Challenge

Introduction: The Role of PID in Feedback Control Systems

Proportional-Integral-Derivative (PID) controllers are among the most widely used control systems in engineering today. They are especially effective in single-input, single-output (SISO) applications where continuous feedback is required to maintain a desired output.

Given a plant process P that maps control actuator u(t) to system action x(t), select u(t) so that x(t) achieves a reference value x_{\text{ref}}.

A classic example is the basic cruise control system you might find on your car.  The control input signal is from the vehicle’s speed from the speedometer.  The control output signal is the throttle position.  From time to time, the car may encounter hills or other disturbances that necessitate a time-varying throttle output to maintain the speed reference.

Extending the Problem: Constrained SISO Systems

Given a plant process P, and system actions x_1(t) and x_2(t), select an single control actuator output u(t) so that x_1(t) achieves a reference value x_{\text{ref}} subject to the constraint that x_2(t) \leq x_{2\text{lim}}.

For example, maybe your car is actually a racecar, and there’s a torque limit on the tires that the engine should not exceed.  In that case, the cruise control system needs to take the torque into account when setting the throttle, and there may be some situations, such as during an initial acceleration, when a normal SISO control loop wants to select throttles that would make the car exceed the torque specification.

In such a constrained-SISO problem there are three possible operating environments:

  • The x_2 limitation is not a factor: x_2(t) \ll x_{2\text{lim}}. In that case, we want the controller to perform like a pure SISO controller on x_1.
  • The x_2 limitation dominates the controller, so that it is not possible to get close to x_1 = x_{\text{1ref}}. In that case, we want the controller to perform like a pure SISO controller on x_2, with x_{2\text{lim}}.
  • In transitions between these two regimes, we want a smooth hand-off from the dynamics of one controller to the other.

In such a constrained-SISO problem there is a natural inclination to want to use PID feedback control to handle both stages.  After all, PID is intuitive and ubiquitous in industry.   The question is:  How do you combine two feedback loops that both have control of only a single output signal?  Many common approaches to the “merge problem” result in undesirable modal behaviors—where there are abrupt transients “handing off” from one loop to the other.

One Solution Approach

Here is one solution, that unfortunately I cannot take credit for:

PI controller with constraint
Figure 1: PI controller with constraint

The intuition here is as follows:  We want to control the x_1 signal, so create PID feedback loop on x_1. Most real PID controllers already have output saturation—that is, the output actuator is clipped at limits determined by the physical system[1]. To implement the constraint on x_2, we simply lower the upper control limit on the main PID loop when necessary to keep x_2 at x_{2\text{lim}}.

But what is the upper limit on u that makes x_2 = x_{2\text{lim}}? The simple answer is that if we ever get the system into a state where x_2 = x_{2\text{lim}}, and the control output happens to be u = u_{\text{lim}}, then we have found limit. We declare that the limit output is either above or below whatever the current output is, in proportion to how close x_2 is to the x_{2\text{lim}}. This estimate of the limit will be inaccurate when the controller is operating far away from the x_{2\text{lim}} condition, but it can be expected to become more and more accurate as x_2 approaches x_{2\text{lim}}.

First Solution Analysis

Looking back at Figure 1, there is an algebraic loop, where the output signal u feeds back to compute u_{\text{lim}}.

Figure 2: Algebraic loop highlighted in red
Figure 2: Algebraic loop highlighted in red

Like any good Simulink problem, we can resolve this by adding a one-frame delay block to break the loop, and it turns out that this is the key to why this solution works.

Figure 3: Breaking the algebraic loop with a delay
Figure 3: Breaking the algebraic loop with a delay

To see why, let’s work out what an actual discrete-time controller is doing here[2].  The output saturation block works like this,

u[k+1] = \begin{cases} u_{\text{PID}}[k+1], & u_{\text{PID}}[k+1] \leq u_{\text{lim}}[k] \\ u_{\text{lim}}[k+1], & u_{\text{PID}}[k+1] > u_{\text{lim}}[k] \end{cases}

And the limit output u_{\text{lim}} is computed as

u_{\text{lim}}[k+1] = u[k] + k_{\text{lim}} \left( x_2[k+1] - x_{2\text{lim}} \right)

After some algebra we arrive at the following two conclusions.

When the main loop dominates the limiter loop…When the limiter loop dominates the main loop…
u_{\text{PID}}[k] \leq u_{\text{lim}}[k]u_{\text{PID}}[k] > u_{\text{lim}}[k]
u[k+1] - u[k] \leq k_{\text{lim}} \left( x_2[k+1] - x_{2\text{lim}} \right)u[k+1] - u[k] = k_{\text{lim}} \left( x_2[k+1] - x_{2\text{lim}} \right)

From this, we can see that the x_2 limiter loop has the form of a rate limit, where the rate limit is proportional to the x_2 error. If x_2 overshoots x_{2\text{lim}}, the limiter even forces u to retreat at a minimum slew rate, regardless of the main loop error[3]

\dot{u}(t) \approx \frac{1}{\delta t} \bigl(u[k+1] - u[k]\bigr) \leq \frac{k_{\text{lim}}}{\delta t} \left( x_2[k+1] - x_{2\text{lim}} \right)

We can also use this result to analyze the controller in the continuous-time Laplace domain.  When the limiter loop is dominating the main loop, we have

\delta t \cdot \dot{u}(t) = k_{\text{lim}} \left( x_2(t) - x_{2\text{lim}} \right)

And after taking the Laplace transform (neglecting the constant):

\delta t \bigl(s \cdot U(s)\bigr) = k_{\text{lim}}  X_2(s)

Which rearranges to,     

\frac{U(s)}{X_2(s)} = \frac{\frac{k_{\text{lim}}}{\delta t}}{s}

This has the form of an integral-only (I) controller, where the k_{\text{lim}} gain we specified is scaled by k_i = \frac{k_{\text{lim}}}{\delta t}.

But integral-only control is not appropriate for many plant systems.  Can we operate a PI controller instead?

To do so, we want to modify the transfer function so that it reads:

\frac{U(s)}{X_2(s)} = k_p + \frac{k_i}{s}

But from the block diagram, above we need a u_{\text{lim}}(t) signal that is related to the output signal by \delta t \cdot \dot{u}(t) = u_{\text{lim}}(t). The Laplace transform of that equation gives

\mathcal{L}\bigl(\delta t \cdot \dot{u}(t)\bigr) = \delta t \bigl(s U(s) - \dot{u}(0)\bigr) = U_{\text{lim}}(s)

Neglecting the \dot{u}(0) term, we can rearrange to show that

U(s) = \frac{U_{\text{lim}}(s)}{\delta t \cdot s},

So

\frac{U_{\text{lim}}(s)}{X_2(s)} = \delta t \cdot s \left(k_p + \frac{k_i}{s}\right) = (\delta t \cdot k_p) s + (\delta t \cdot k_i)

So to run PI control on the x_2 limiting signal using the intuitive scheme we selected, we need to compute an instantaneous derivative.  For many systems this is not practical to achieve—if you want to compute the derivative of the input signal, you need a filter or compensator to estimate the derivative, and this introduces additional poles and zeros to the controller.

We can also reach a more general conclusion from all these Laplace transforms:  The effect of breaking the algebraic loop using a delay is to apply one integrator to all control terms.  Derivative terms become proportional terms; proportional terms become integral terms; and integral terms would become double-integral terms.

Can we redraw the block diagram so that we can have PI control on the x_2 signal in the limiting case, without computing a derivative?

Let’s try it.  The simplest, naïve way to get PI control on the main x_1 signal and have a different PI control on the x_2 signal is simply to run two PI controllers and take the minimum output signal[4].

Figure 4: Double-PI controller for a SISO-with-constraint problem
Figure 4: Double-PI controller for a SISO-with-constraint problem

The question is:  Does the merge using a min operation introduce undesirable modal switching behavior?  That is, when we’re handing off from one loop to the other, do we get sudden and abrupt changes in the output signal?

To analyze this let’s look at the specific case where the main x_1 loop is the minimum loop on frame k_0, but the limiter x_2 loop is the minimum on the very next control frame, k_0 + 1.

On the first frame, the control output is given by

I_{x_1}[k_0] = I_{x_1}[k_0 - 1] + \delta t \cdot k_i \left(x_1[k_0] - x_{1\text{ref}}\right)

u[k_0] = u_{x_1}[k_0] = k_p \left(x_1[k_0] - x_{1\text{ref}}\right) + I_{x_1}[k_0]

Meanwhile, on the next frame the control output is given by

    \begin{align*}     I_{x_2}[k_0 + 1] &= I_{x_2}[k_0] + \delta t \cdot k_{i_{lim}}\left(x_2[k_0 + 1] - x_{2lim}\right) \\     u[k_0 + 1] = u_{x_2}[k_0 + 1] &= k_{p_{lim}}\left(x_2[k_0 + 1] - x_{2lim}\right) + I_{x_2}[k_0 + 1] \\     u[k_0 + 1] &= \left(k_{p_{lim}} + \delta t \cdot k_{i_{lim}}\right)\left(x_2[k_0 + 1] - x_{2lim}\right) + I_{x_2}[k_0]. \end{align*}

Now recall the same scenario with the original rate-limiting control scheme.  In the same situation where the x_2 limit takes control on frame k_0 + 1, we had

u[k_0 + 1] - u[k_0] = k_{\text{lim}} \left(x_2[k_0 + 1] - x_{2\text{lim}}\right)

u[k_0 + 1] = k_{\text{lim}} \left(x_2[k_0 + 1] - x_{2\text{lim}}\right) + u[k_0]

We can line up these two equations.  Remember that on the second equation we effectively have k_{p_{lim}} = 0 and k_{\text{lim}} = \delta t \cdot k_{i_{lim}}. After remembering that, we can find the necessary condition to ensure smooth control hand-off:

I_{x_2}[k_0] = u[k_0] = u_{x_1}[k_0]

That is, the integrator state for the x_2 loop must match up with what the main x_1 was doing on the previous frame.  Here’s a detail on how that might work.

Figure 5: Implementing the double-PI controller in discrete time
Figure 5: Implementing the double-PI controller in discrete time

Instead of computing the absolute u[k] for each PI loop, we are computing the change requested by each: u[k+1] - u[k].

Notice that this is again equivalent to computing the derivative of the input signal.  In particular the k_p term on each loop is now k_p \bigl(\epsilon[k+1] - \epsilon[k]\bigr) \approx k_p \cdot \delta t \cdot \dot{\epsilon}(t). We have fundamentally failed in our goal of not computing a derivative!

Figure 6: Each PI loop effectively computes the derivative of its input signal.
Figure 6: Each PI loop effectively computes the derivative of its input signal.

However, we do get one major benefit from implementing the discrete-time controller in this manner.  The “derivatives” that we do compute are pre-scaled by the discrete time period and by the k_p gains into control output units.  This form of computation minimizes the loss of numerical precision.

In Conclusion…

Engineering teams, including Sparx Engineering, continue to select PID controllers to solve control problems because they are easy to use, intuitive to design, and they work well on a wide variety of problems.

In this post, we looked at two non-linear extensions to the PID architecture to solve the constrained single-loop control problem.  This is a common situation that Sparx has had to deal with in diverse problem domains.  In both extensions, we found that individual P-, I-, and D- terms are effectively integrated one level into I-, II-, and P- terms.  This effect can be compensated by differentiating all controller terms, but beware of complications that may arise from computing instantaneous derivatives. 


[1] In the cruise control example, the throttle valve can never be more than 100% open or less than 0% open.

[2] For simplicity, I will set k_d = 0 (turning PID into PI), I will implement integrators with Euler’s method, and I will gloss over other saturation limits, rate limits, and other elements that might be in a real control law.

[3] When x_2 > x_{2\text{lim}}, the term k_{\text{lim}} \left(x_2[k+1] - x_{2\text{lim}}\right) becomes negative, representing a minimum negative slew rate, when k_{\text{lim}} is configured for negative feedback.

[4] Once again, I am leaving out several features that would be in a real control law, like output saturation and anti-windup protection.

Featured Image Credit: https://benchmarkpdm.com/importance-of-shaft-alignment-parallel-angular-pump-alignment/

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch

If you have a product design that you would like to discuss, a technical problem in need of a solution, or if you just wish you could add more capabilities to your existing engineering team, please contact us.