# How to control a nonlinear system with a PID controller

Is the design of a PID controller for a nonlinear system different from for a linear system?

[I think math.stackexchange.com is the most suited SE.]

This question has no single answer and really it comes down to how optimal the system control needs to be and how nonlinear the system is.

A lot of the relevant information about PID in different circumstances is given on the wiki page so that will be worth a look. Basically the crux of the matter is that PID is linear and symmetric with constant parameters. For a linear system this is fine, for a system that has different behaviour in different operating regions (a non-linear system) the control will be sub-optimal. This suboptimality may be so slight as to be unnoticeable or it could be severe enough to make your systems tear itself apart and crash/explode etc.

Therefore we initially have two clear options:

1) Apply PID as if for linear system

2) Do something more sophisticated

Option 1) will apply whenever we have weak nonlinearities which do not compromise our ability to control the system to within some specified tolerances (that will be specific to each aplication).

Assuming the nonlinearities are more than the system can cope with reasonably what will option 2) entail? A common approach at this point is to apply what is called $gain~ scheduling$, in this control strategy we essentially linearise our problem about different operating points (think taylor expansion) and make a family of PID controllers (one for each point about which the linearisations are made) and tuning each of them to be optimal for the linearisation about which they are defined. We then switch between these linear models while operating our system in order to have the best linear control for our current operating point. An example of this would be a plane changing between different PID controllers for sub-sonic and supersonic flight speeds (as the behaviour of the plane changes drastically in these two scenarios).

This is just one example of a nonlinear control strategy that uses PID, it is in some ways not a PID controller, rather a family of them embedded in some sort of switching system.

In conclusion, you $can$ use a single PID controller for a nonlinear system as you would a linear system (I guess using a linear model of the system to tune it on), it just might not control the system very well. If this isn't good enough then you need to implement more sophisticated control strategies which may well include PID controllers, but will have extra control structure in then aswell.

I know its long time since the question was published. However, I would like to add a comment since it is well-referenced post on searching engines.

1. You can assume that the system is close to a linear one as previously mentioned. It does the job very well for many cases and this approach is used frequently.
2. You can use multiple PID or more complex control systems as previously mentioned and one again, it works very well in numerous circumstances (especially with systems that are characterised by very different behaviours depending on the state of the system).
3. A third solution and interesting one is to add a mathematics transformation on the input data. I like this one since you can use a classic PID on very non-linear systems.

For instance, if you want to control a reverse pendulum (the mass is above the pivot and so it is a meta-stable system) and you know the position of the mass in an Eulerian (x/y) referential, then you have different solutions.

1. Suppose that your system is linear. It works only if you are close to vertical position and variations around this point (due to perturbations) are minimal. The control will use the horizontal position (x-position) to determine the angular momentum to add to the pendulum. And once again, it works for little or slow perturbations.
2. You can use other types of control command systems as a state-space control command for non-linear systems, or multiple PIDs managed by a state machine.
3. Or simply, you add a transformation. Since, it is an inverse pendulum, you can compute whenever the angular position of the pendulum and add a control on it.

Obviously, this is a very simple example but it shows the general idea. Using a mathematical transformation on input data can simplify a lot the system and its control system. It is an elegant solution, however, depending on the hardware to control the system, it can be power/time consuming. The solution is really depending on your requirements.

Well, although there are linear models of systems, keep in mind that no real system is actually linear.

The actual design of a PID controller is the same: what you do is first linearize the system around a fix-point (equilibrium point), then do your standard PID design around the linearised model.

The drawback here is that the linearised model will only be accurate near the fix-point. If this isn't giving you good enough results, it's time to move to more advanced techniques, such as gain-scheduling mentioned by Ed, or doing trajectory-optimization etc.

Note also that optimal control is a new step even for linear systems. In fact the most commonly used optimal controller is the Linear Quadratic Regulator (LQR), which assumes a linear system, and quadratic cost. This is generally more powerful than PID because it guarantees stability, but at the same time is still only valid near the fix-point around which you linearized your system.