6 min read

Control Engineering: P, PI, and PID Controller Tuning

This post is written as a homework/experiment for Introduction to Control Engineering course. You can find the PDF version of it (which looks better, I think) below.

Introduction

This document is intended to be the first report of the laboratory. The objective of the laboratory is to understand how a controller can be made from given equations which has three coefficients for proportion, integration, and derivation.

$$
G_c(s) = K_c + \frac{1}{T_i s} + T_ds
$$

Whenever we consider SISO system in Laplace domain, we should notice that there has to be a controller function from each input to output. In theory, we can model it mathematically:

$$
U(s) = G_c(s) \cdot E(s)
$$

$U(s)$ is the plant output, $G_c(s)$ is the controller function, and $E(s)$ is the error function according to a given reference point.

Laboratory Work

The laboratory wants us to find a model for any arbitrary second-order plant which has a transport delay. The model has to be in a form of first order lag plus time delay. The model consist of one inertia and one delaying terms.

After finding a well-approximated model for our plant, we have to construct P, PI and PID controller. This controller will get an input as error, which is subtraction of system's reference point and plant's previous response. Reference will be thought as step input -- so that, $1$.

PID's coefficients can be seen as $K_c$ for proportional, $T_i$ for integral, and $T_d$ for derivative in (1). Although there is more than one way to find optimal values for the desired control system, we are going to use the equations given in the table (1), (2), and (3).

Modelling the Plant

For my real plant, I had chosen the parameters within my name's and surname's letter count. The real plant function given below. I model it on the MATLAB with using two transfer function and one transport delay.

$$
\text{Plant} = \left(\frac{1.5}{6s+1}\right)\left(\frac{1}{8s+1}\right)\left(e^{-4s}\right)
$$

To model a plant, we have lots of methods. However, I am going to use the FOLPTD which is described in the laboratory work section. The method suggest us that any plant can be modelled into this expression.

$$
G_m(s) = \frac{k_o}{1+sT} \cdot e^{-sT_0}
$$

One can find the parameter $k_o$ directly looking for the amplitude of the plant, however, $T$ and $T_o$ can be only found with trying, and seeking on the oscilloscope. I have created a testing environment in MATLAB to find the parameters of inertia and delay. You can see the Simulink setup that I used in the Figure 1.

Figure 1: MATLAB Simulink Setup for Testing Environment of Modeling

I have been doing my experiments by changing the value of PM Transfer $s$ coefficient, and PM Delays time delay setting. End of the experiments, I have decided that choosing $12$ for coefficient of $s$ and $4$ for time delay will be enough for my plant. You can see the approximation result from the output scope's figure, which is shown in Figure 2.

Figure 2:Real Plant versus Plant Model with FOLPTD method

We’re going to use this model to tune our controllers in the next section.

Controller Tuning

All the coefficients will be tuned according to the equations (or formulas) given in the tables (1), (2), (3). One can see the Simulink test environment in the Figure 3, however, should notice that for P controller, I and D will be unconnected; for PI controller, D will be unconnected.

Figure 3: MATLAB Simulink Testing Environment for Controller Tuning

P Controller

P Controller's only thinks about now. Therefore, they never enough for getting the system into the reference point. However, if one will give the new reference point according to the error rate of P controller, the system will be stable on the point it needs to be.

For $k \approx 0%$,: $$k_c = \frac{0.3 \cdot 12}{1.5 \cdot 4} = 0.6$$

For $k \approx 20%$, $$k_c = \frac{0.7 \cdot 12}{1.5 \cdot 4} = 1.4$$

PI Controller

PI controller thinks about both now with P, and past with I. Since the integral of error give us the continues sum of previous errors, it helps the system to get into the reference point, easily.

For $k \approx 0%$,:
$$k_c = \frac{0.6 \cdot 12}{1.5 \cdot 4} = 1.2$$
$$T_i = 0.8 \cdot 4 + 0.5 \cdot 12 = 9.2$$

For $k \approx 20%$,:
$$k_c = \frac{0.7 \cdot 12}{1.5 \cdot 4} = 1.4$$
$$T_i = 1 \cdot 4 + 0.3 \cdot 12 = 7.6$$

For minimum $\int e^2(x)dx$,
$$k_c = \frac{1 \cdot 12}{1.5 \cdot 4} = 2$$
$$T_i = 1 \cdot 4 + 0.35 \cdot 12 = 8.2$$

PID Controller

PID controller is the most popular controller in the industrial history. The usable reason behind this famous method is that the controller thinks for now, past, and the future. The derivative of any measurement give us the speed of change of that result of measurement. Within this knowledge, we can speed our process to get into the line that we want. Most of the time, the difference between PI and PID controllers cannot be seen very easily.

For $k \approx 0%$,
$$k_c = \frac{0.95 \cdot 12}{1.5 \cdot 4} = 1.9$$
$$T_i = 9.6$$
$$T_d = 1.6$$

For $k \approx 20%$,
$$k_c = \frac{0.95 \cdot 12}{1.5 \cdot 4} = 2.4$$
$$T_i = 8$$
$$T_d = 1.6$$

For minimum $\int e^2(t)dt$,
$$k_c = \frac{0.95 \cdot 12}{1.5 \cdot 4} = 2.8$$
$$T_i = 1.3 \cdot 4 = 5.2$$
$$T_d = 0.5 \cdot 4 = 2$$

Conclusion

Controller design for a plant model is crucial for a stabilization purposes. To design a control system, an engineer firstly have to design the plant in the terms of mathematics language. After, he/she has to consider which type of controller that system needs, and which coefficients will make it stable.

According to the system requirements, we can think about overflow of reference point, timing of the stabilization, and the oscillation of the response. In our calculations, we had designed with requirement of non-overflow ($k\approx0%$), however, we couldn't manage it to do so -- except the first three experiments.

Also, we have learned from the experiments that using minimum $\int e^2(t)dt$ error scheme makes the system shakes more. This may cause our system to halt down, burn or broke. Therefore, we should be careful --also-- about choosing the error function we're going to use.

The reader should note all the files and the schemes can be found at https://dar.vin/Intro2ContrEng-LabOne-PIDs

References

  • Laboratory Document of First Experiment, dr. hab. Pawel Dworak, 2022
  • Handbook of PI and PID Controller Tunning Rules, Aidan O'Dwyer, Imperial College Press, 2nd Edition