# Model necessary for PID control

As I am not from control theory, I do not understand - after reading the Wiki page about PID control (https://en.wikipedia.org/wiki/PID_controller) and watching some videos - whether a model of the process which is due to be controlled is necessary for a PID control or not. For example it is written on one occassion:

Control action – The mathematical model and practical loop above both use a "direct" control action for all the terms, which means an increasing positive error results in an increasing positive control output for the summed terms to apply correction.

And on another occassion it is written:

But the PID controller is broadly applicable, since it relies only on the response of the measured process variable, not on knowledge or a model of the underlying process.

If I want - for example - to control a heating system using a PID-control such that the temperature in the building in at a certain value, is it necessary to have a model of the heating system or the building that maps the fuel consumption (e.g. gas or oil) to the generated heat and the temperature?

Update: What does this transfer function (mentioned below by Marcus Müller) consists of? He wrote " I'd argue that you want your plants transfer function to be continuous, and that's already a model"

Update 2: I think my question is not too dificult and people with experience in that field should be able to answer it. Does a PID-controller need a model of the process? Unfortunately this question has not been answered yet :-( –

• You don't need a model to get a PID controller working -- millwrights do it all the time, either manually or using auto-tune controllers. But to do the best job of it in a production environment, you usually need some sort of a model. – TimWescott Mar 3 '20 at 15:18
• Thanks for your answer TimWescott. So normally a PID controller can just infer the control action without a model, right? – Question_Master Mar 3 '20 at 18:20
• well, at least without an overly explicitly stated model. I'd argue that you want your plants transfer function to be continuous, and that's already a model, if you ask me, even if it's, for most physical systems, inherent. – Marcus Müller Mar 3 '20 at 21:24
• I think "infer" is much too strong a word for something as simple as a PID controller. A PID controller has two states (integrator and derivative filter) and maybe as many as six parameters to twiddle -- that's not enough complexity to "infer" anything. – TimWescott Mar 4 '20 at 1:04
• Thanks for your answers. I am still a little bit confused. Marcus wrote that I need a transfer function (that is a model) for a PID controller. Whtat exactly is the purpose of this transfer function? Does it map input actions to outputs? In the case of a heating system this would require an explicit model, as far as I undestand – Question_Master Mar 4 '20 at 8:58

This was my recent experience where I found it was absolutely necessary to use PID control versus the PI control I would typically use: I was developing a TEC (thermo-electric cooler) oven control circuit that had extremely low frequency poles (sub Hz). With a typical PI control the response time would be limited by the lowest frequency pole. Such that in my case the resulting system with the dominant lower frequency pole would take minutes to settle: this can be estimated using the relationship for a first order system of the 10% to 90% settling time in seconds given by $$t_r = 0.35/BW$$ where $$BW$$ is the frequency in Hz of the pole. If a single pole is dominant a first order approximation will be reasonably accurate.

With the use of a PID solution, the achievable rise time can be extended out to the next higher pole, and in my case this resulted in a TEC control of under 10 seconds where the plant (TEC) on its own would take minutes.

In practice what you observe if how the "D" enables a very large overshoot of current (the TEC is current controlled), so as long as the current source can supply the needed current, the temperature is very quickly changed much more during transitions than the current that would be commanded under PI control only. This makes sense since the D is reacting to the differential change of the input.

So in summary I am giving one example where it was justified in using a PID control and what the decision factor was: I was faced with a plant that had two lower frequency poles and wanted to have a response time and settling beyond what would be limited by the lowest frequency of the two. By using PID, the response time and settling was then limited by the higher of the two frequencies resulting in a significantly improved response time.

For your last question, no a PID controller does not need a model of the process as you can experimentally determine the gain coefficients in most practical cases (specifically I outline an approach below for systems dominated by lower frequency poles). The process to experimentally set the gain coefficients is as follows:

Set P, I and D all to be zero and then monitor the step response (step the input and measure the output) while slowly increase P only.

Increase P to the threshold of instability-- this does not mean ringing but a sustained oscillation where the amplitude neither further increases or decreases. Once determined, divide P in half and use that as the gain value for P. There will be expected offset errors which is why we need I.

With P set as determined above, slowly increase I to the threshold of instability. Then divide this value in half. With a typical pole dominant system such as I have experience with, the rise time will be quite fast but there will still be a significant ring down and here we will see the benefit of adding D instead of simply reducing I to eliminate the ringing (which would also correspondingly increase the rise time).

With P and I set as above, slowly bring up D to achieve the desired step response balancing an overshoot with rise time, and final settling time. You will see that the rise time as set above will not be impacted but the ringing will be eliminated. The ideal transition that has the best compromise will typically have a 8% to 15% overshoot. At this point all values can be adjusted from these starting points to optimize given the actual response of the system.

This is a general approach that works with many real world systems dominated by low frequency poles. This will not achieve good results with a more complex system with many poles and zeros in close proximity or an unstable plant with poles in the right half plane, but it is quick to test and determine the practicality of proceeding with this experimental approach.

However, it is certainly very practical and useful to have a model of the process and be able to simulate the operation. Nyquist's approach of modeling control loops in the frequency domain is very practical for black box systems in that we needn't have a mathematical model of the plant in terms of polynomial transfer functions or pole zero locations to mathematically determine stability using the Nyquist criteria. What we do need is the magnitude and phase of the plant which we can do experimentally (when the plant itself is stable, meaning all poles in the left half plane) by sweeping the plant with a sine wave and measuring the magnitude and phase of the response compared to the input. This is the transfer function. Having that alone is sufficient to design the control loop and determine all stability factors (again when the plant is stable on its own, otherwise things get a lot more complicated which I didn't cover here). Further what is great about this approach is the transfer function needn't be limited to polynomials with pole and zero locations which means exponential factors such as true time delays can be easily incorporated and stabilized. The system may be too complex or cumbersome to try and obtain an accurate mathematical model and here we see that simply having the magnitude and phase of the black box system will suffice. This was the great achievement in Nyquist's approach as to its practical application.

For more on the Nyquist approach to determining stability see Nyquist plot interpretation when curve hits the origin

• Thanks a lot Dan Boschen for this great answer :-) – Question_Master Mar 18 '20 at 19:51