# Example 1 – PI Controller Design (Proportional-Integral) – Matlab

To better appreciate the effect of the PI controller, let’s look at the following example. Suppose we have the system of Figure 7-23. The direct transfer function G(s) for this system is as follows: Where K is the pre-amplifier constant.

Teh design specifications for this system are: Donde:

• ess: steady-state error due to a parabolic input
• Mp: Maximum overshoot
• Tr: Rise time
• Ts: Settling time

The first thing we are going to do is analyze the steady-state error ess of the system before compensating, and see how much it meets or not with the first design requirement.

For a parabolic input we must work with the acceleration constant Ka: This means an infinite error for a parabolic input: To improve the steady-state error we incorporate a PI controller in the direct path of the system, which will now have the following transfer function: By increasing the typology of the system from type 1 to type 2 we immediately improve the steady-state error. Now, the ess due to the parabolic input will be a constant: That is to say: This exercise we already worked with the PD controller. For that case we select a value of K=181.17 (Example 1 – PD Controller Design (Proportional-Diferential) – Matlab)

We allow ourselves the freedom to consider the same value for K in this case in order to maintain the transient response under acceptable and known conditions when applying the PD of Example 1. If necessary we will adjust the value of K later. We can appreciate that to achieve an ess as specified in the design, the larger K is, the smaller will have to be Ki, which may be convenient. With the values of K and ess we can calculate a first approximate value of Ki to meet the requirements: The next thing we will do is analyze the stability of the system because the selection of the Kp and Ki parameters depends on it. We will apply the Routh-Hurwitz criterion to calculate the limit values of the mentioned parameters in such a way that the system remains stable. For this we need the characteristic equation that arises from the transfer function of the closed loop system Gce(s): The characteristic equation of the system is: With this equation we apply the Routh-Hurwitz criterion. In this way we discovered that the system is stable for the following range of values: This result indicates that the Ki / Kp of the controller can not be very close to zero, so a value as low as Ki = 0.002215 is not convenient. Another criterion for selecting Ki / Kp is that it is convenient to select the zero added by the controller in s = -Ki / Kp so that it is located near the origin and far from the most significant poles of the system. Through the locus of the roots in Matlab we can see which are the most significant poles of the characteristic equation, assuming an acceptable relationship between the Ki and Kp parameters from the point of view of the previous stability study but relatively close to the origin, say Ki / Kp = 10, keeping Ki constant and varying Kp.

First, we reshape the characteristic equation in its form 1+G(s)H(s): Note that in this way the controller PI is adding a zero in s=-10.

We apply the following command in Matlab to obtain the locus of the roots of this compensated system:

>> s=tf(‘s’)

>> sys=(815265*(s+10))/(s^3+361.2*s^2)

>> rlocus(sys)

So we get: As it can be seen, the most significant pole of the characteristic equation is located in s=-361. Therefore, the criterion that we must use to select s=-Ki/Kp is: With this result, the direct transfer function G(s): It would be simplified as: The term Ki / Kp would be negligible compared to the magnitude of s when s assumes values along the root locus that corresponds to a convenient relative damping factor of 0.7 <ζ <0.1. Then, a zero cancels a pole at zero. The maximum overshoot must be equal to or less than 5%. This means that you want a relative damping factor ζ approximate to the following:  With the help of the locus we can locate the poles that correspond to this value of ζ: According to the graph, the value of Kp required to obtain the desired damping factor is: And so: We also observe in the previous graph that if Kp = 0.0838, then the roots of the characteristic equation (the poles of the system) are in s1 = -175 + j184 and in s2 = -175-j184 If we look around these roots we can notice that the zero added by the controller at s = -10 is very close to the origin compared to the poles of s1 and s2, practically canceling a pole at the origin, thus ratifying the approach we made earlier for the direct transfer function of this system then of the compensation: So: We can observe the response to the step according to these partial results and the comparison of the compensated and uncompensated systems, by means of the following simulation:

>> Ga=(815265)/(s*(s+361.2))

>> Gd=(68319)/(s*(s+361.2))

>> Gce1=feedback(Ga,1)

>> Gce2=feedback(Gd,1)

>> step(Gce1,Gce2) The previous graph, with the system after the compensation in red line, shows that the PI improves the steady-state error and reduces the overshoot, but at the expense of significantly increasing the rise time. The graph also shows that the maximum overshoot is 5%, therefore the requirement is met. It is necessary to note that another relationship can be selected for Ki and Kp that meets the requirement and still improve the overshoot, for example Ki / Kp = 5, or Ki / Kp = 2. You just have to pay attention to the issue of the stability of the system. With the calculated values, we re-calculate the overshoot, and we evaluate the rise time tr and the settlement time ts . The following command gives us the value of ζ and ωn, the relative damping factor and the natural frequency respectively.

>> damp(Gce2)

Pole: -1.81e+02 + 1.89e+02i /   -1.81e+02 + 1.89e+02i

Damping: 6.91e-01

Frequency: 2.61e+02

•  Maximum Overshoot (MP):  • Rise Time (Tr):

>> Gd=(68319)/(s*(s+361.2))

>> sys=feedback(Gd,1)

>> step(sys)  • Settling time (Ts):  Values that we can also see in the response to the step input graph generated previously: We can conclude that the compensated system fulfills the requirements of the design, although it exceeds a little in the settling time. The latter can be reduced slightly with a Ki / Kp = 2 ratio, but at the expense of getting too close to the unstable area of the system

Written by: Larry Francis Obando – Technical Specialist – Educational Content Writer.

Mentoring Académico / Empresarial / Emprendedores

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: España, Caracas, Quito, Guayaquil, Cuenca

WhatsApp: +34633129287