# Electronic – Design of a PI controller

pid controller

If I have a process which is approximated by a first order system

$$H(s)\ = \frac{K}{s+a}e^{-sT}$$

How can I design a PI controller with a rising time < 2 and an overshoot that is less than 10%

I know a typical PI controller is given as

$$G_{c}(s) = K_{p}+ \frac{K_{I}}{s}$$

So how do I find KP and KI given my specifications?

I don't need it solved completely just the steps that are needed.

#### Best Answer

Here is an Outline of the steps you should follow for solving, almost, every analog control system.

1) draw your block diagram with the feedback controller in place.

2) draw the closed loop system. (i.e., calculate the closed loop equation keeping Kd and Kp)

Substitute:

$$e^{-st}(s) = \frac{1-sT}{1+sT}$$ Source: http://users.ece.utexas.edu/~buckman/H3.pdf

Essentially a time delay can be modeled as an all pass filter. It has a flat frequency response and only introduces delay.

http://en.wikipedia.org/wiki/All-pass_filter

When all the math is solved out you should have a 3rd order equation in the denominator and a second order in the numerator.

This means that you need to introduce a filter before the summing junction in the system eliminate the pole. (it should be the inverse of the numerator)

3) Calculate the desired equation for your closed loop system

It should be a second order system with your desired characteristics and a a first order system with a non-dominant poll. (i.e., 4 or more times larger than the magnitude of your 2nd order polls)

4) using equation calculated at 2, select Kp and Kd that would make your desired equation match your existing one. (Match them term by term, so look at the S^3 term, S^2 term)

Solving The Priblem

Lets start out by inserting the substitution mentioned above: $$e^{-st}(s) = \frac{1-sT}{1+sT}$$

This means our system

$$H_O(s) = \frac{k}{s+a}\frac{1-sT}{1+st}$$

and (with a little math magic) rewriting our controller

$$G(s) = \frac{K_Ps+K_I} {s}$$

This leads to the closed loop system:

$$H_C(s) =\frac{ \frac{k}{s+a}\frac{1-sT}{1+sT}} {1+\frac{k}{s+a}\frac{1-sT}{1+sT}\frac{K_Ps+K_I} {s}}$$

To simplify the equation (I apologies if there are any math errors its all algebraic) by doing the following steps:

1) multiply the numerator and denominator by $$((s+a)(1+sT)(s))$$

2) Multiply out all the factors together

3) group similar terms together (all the S^3, S^2, S etc...)

4) normalize the largest powered term in the denominator (should divide by T if i did it correctly)

your closed loop should look like this (again, algebra if there are errors please tell me)

$$\frac{\frac{K}{T}(1-sT)(s)} { s^3 + (\frac{1}{T} + a - KK_p)s^2 + (\frac{a}{T} + \frac{KK_P}{T} +K_I)s+\frac{KK_I}{T}}$$

We can clearly see that we have a third order system where each term can be controlled by setting Kp and Kd.

Designing Controller Parameters

While we cannot directly select the Kp and KI parameters because we don't have the numbers for the transfer function of the system, we can still get 99% of the way be knowing what system equation transfer function we want.

Requirements:

1. Overshoot Less than 10%
2. Rise time of 2 seconds or less

Initial Design Considerations:

Now, assume we introduced a filter at the input of the control system to eliminate the numerator (so the numerator is now 1) (there are issues with this since the poll is unstable, will be discussed at end)

We can accurately design this sort of system with a third order transfer function. It consists of a dominant pole second orders system and a non-dominant pole first order system.

It should look like this:

$$\frac{1}{(s^2 + 2 \omega_n \zeta *s + \omega_n ^2)(s+\alpha) }$$

The overshoot is controlled by the damping coefficient which is a number between (0 and 1) (you typically can't calculate this easily off the top of your head...you can however set it high to have low over shoot and over damp the system.

(In most systems, you look at the phase margin and use the damping coefficient that will give you a phase margin of about 65 degrees)

The damping coefficient can be calculated by:

Where PO is the percentage overshoot

for 10% overshoot you end up with a damping coefficient a little less than 0.6

the design specifications said it has to be less than 10% so larger is better, lets choose 0.6 for an easier number to work with:

$$\zeta = 0.6$$

1. now for our second order system we need w_n to finish the equation:
2. We need to look at the second requirement: Rise time of 2 seconds
3. this means that the steady state value should be reached in approximately 2 seconds.

Our pole is located at w_ndampingcoeff/2 (use quadratic equation and you'll see it)

The steady state is reached in 4 times the pole location. $$4\frac{\omega_n\zeta}{2} = 2 seconds$$

Which leads to

$$\omega_n = 1.66666666666$$

smaller value leads to faster rise time (rise time requirement is LESS than 2seconds)

lets choose 1.6 for simplicity

now we need to choose our non dominant poll (that is to select the Alpha term), it must be 4-5 times larger than the smallest dominant poll in the system.

$$\alpha = 6.4$$

Finally, we have our desired transfer function:

$$\frac{1}{(s^2 + 2(1.6)(0.6)s + (1.6)^2)(s+6.4) }$$

How to Use the Controller to Get the Desired Closed Loop Transfer Function

multiply out the terms in our desired control system.

$$\frac{1}{(s^3 + 8.325s^2 + 14.8485s+16.384) }$$

Scrolling all the way back up to the top of the page we have our system transfer function:

$$\frac{1} { s^3 + (\frac{1}{T} + a - KK_p)s^2 + (\frac{a}{T} + \frac{KK_P}{T} +K_I)s+\frac{KK_I}{T}}$$

(Remember You needed to normalize the transfer function)

Now all you need to do is match like terms in both equations with each other and get the system of equations to match:

for example:

the S^2 term:

$$(\frac{1}{T} + a - KK_p) = 8.325$$

the S term:

$$(\frac{KK_P}{T} +K_I) = 14.8485$$

The constant term $$\frac{KK_I}{T} = 16.384$$

using these equations you can solve for the parameters K_I and K_P and you've just designed your control system.

Issues with Unstable Pre-filter

Remember I mentioned a stability issue:

$$\frac{\frac{K}{T}(1-sT)(s)} { s^3 + (\frac{1}{T} + a - KK_p)s^2 + (\frac{a}{T} + \frac{KK_P}{T} +K_I)s+\frac{KK_I}{T}}$$

if we filter out the numerator that means we are using a pre-filter circuit that does:

$$P_f(s) = \frac{1} {\frac{K}{T}(1-sT)(s)}$$

This filter block is placed BEFORE (or after, both would technically work, though traditionally its before)

The problem comes from here:

$$\frac{1}{1-sT} = \frac{-\frac{1}{T}}{s-\frac{1}{T}}$$

This means we have a POSITIVE pole in the system. This means, for a step response input: The system will fly off to infinity. So its a serious design consideration for whats actually happening.

How to deal with it....not sure...will research.