This blog post is relevant for those who are interested in learning about implementing auto-tuners for PID controllers into a simulated environment. In Modelon’s upcoming 2017.2 software release, an auto-tuner will be included in the Modelon Base Library and therefore accessible in all libraries.

Using Modelon libraries, students successfully developed and implemented a tuning method for PID controllers in a simulated environment. This practical application is based on research from the Control department at Lund University. The students’ methodology and results below will be included in the upcoming Thermal Power Library release 1.15


In varying industries today, auto-tuners are used widely to assist with choosing optimal parameters for proportional–integral–derivative controllers (PID controllers). Student researchers from Lund University set out to understand whether or not optimal parameters for PID controllers can be useful in a simulated environment.

Auto-tuning is based on the idea of automatically obtaining suitable parameters for a PID controller, which is the most common kind of controller in industry today. If the parameters are tuned properly, PID controllers can be used to solve various kinds of control problems. Because finding suitable parameter values can be difficult, a tool for solving it automatically holds high value. Although auto-tuners are mostly implemented in industrial systems, they could also be useful in simulation. An auto-tuner could help modelers with limited control experience to quickly tune the controllers in their models. The simulated environment also enables use of the tool on processes not normally considered suitable for automatic tuning, due to e.g. infeasibility of performing experiments on the real process.

During the thesis work [3], an auto-tuner has been implemented in the modelling language Modelica in order to understand and validate the potential of the method in a simulation environment.


As auto-tuners have advanced, there are many different structures to choose from. The aim with this thesis is to investigate one specific variant (presented in [2]) – the asymmetric relay auto-tuner. To investigate its usefulness, it is tested within different areas where the complexity varies. For instance, does the number of control loop in a model have an impact? Is the auto-tuner able to generate good parameter values even if it is used in several loops during the same simulation?

The experiment performed by the auto-tuner consists of several consecutive steps, with the final result being the parameter values K, Ti and Td, which can be used in a PID controller. A typical example of the input and output signals during an experiment is given in Figure 1. Relay switching of the input makes the process oscillate and by adjusting the input signal, a limit cycle of desired amplitude is reached. Based on the characteristics of the limit cycle, a low order model is obtained. This order reduction of the model simplifies the task of finding control parameters, as it enables the use of existing tuning rules.

Relay and process output during an auto-tuner experiment

Figure 1. Relay and process output during an auto-tuner experiment

The low order model is either called an FOTD model (first order time delay model) or an ITD model (integrated time delay model); as represented with the parametrizations given in equations (1) and (2). Which model that is chosen depends on the parameter Τ, which is the normalized time delay. That parameter is related to the curvature of the process output during relay control. The normalized value is between 0 and 1. A low value on tau indicates that an ITD model is the best choice otherwise an FOTD model is the best choice to estimate the process with [2].

Verifying auto tuning

Based on the estimated models in (1) and (2), PID parameters can be derived. The choice of tuning rule has in this thesis been the Approximate M-constrained Integral Gain Optimization (AMIGO) method [1]. However, it is also possible to use other tuning rules with this auto-tuner since the model generates information about the estimated model as well as PID parameters.


The results do validate the potential of auto-tuners when working in a simulation environment. Three processes from Modelon’s libraries were used during the evaluation of the method and in each case the control performance was compared with standard tuning methods and existing control parametrizations. In each case, the implemented auto-tuner performed at least as good as the other tuning methods, generally outclassing the controllers implemented in the models today. In Figure 2, one experiment setup is displayed; a steam temperature controller from Thermal Power Library. In Figures 3 and 4 the control performance of the auto-tuned parameters is compared with other PID parametrizations.

Verifying auto tuning
Figure 2. Auto-tuner used on the steam temperature example in ThermalPower Library

Verifying auto tuning
Figure 3. Output response for a step disturbance with various PID parametrizations

Verifying auto tuning
Figure 4. Step response with various PID parametrizations

The most challenging of the tested processes was an aircraft model, containing three control loops. Parametrizations for the different controllers in that model were obtained by introducing the auto-tuner in two ways. Firstly, it was done in one loop at the time, secondly in all the three simultaneously. The two parameter set-ups resulted in similar control behavior, in both cases resulting in significant improvements compared to the existing control method.

To summarize, the auto-tuner can be a helpful tool not only in industry but also in a simulation environment, as it is an easy to use and quick method for finding PID parametrizations with excellent performance.



[1] K. J. Åström and T. Hägglund. Advanced PID Control. pp. 64-69, 73, 76-78, 159-163, 186-189, 225-241. ISA – The Instrumentation, Systems and Automation Society, 2006.

[2] J. Berner. Automatic Tuning of PID Controllers based on Asymmetric Relay Feedback’. Licentiate Thesis, SwePub, EBSCOhost, viewed 8 February 2017. 2015.

[3] M. Björk and R. Levenhammar. Relay Auto-tuners in Modelica. Master’s Thesis, Department of Automatic Control, LTH, Lund University. 2017.