4
$\begingroup$

The problem

The problem is to find the coefficients for the P, I and D terms of a PID controller used to regulate the object that minimize the the integral of the squared error (ISE):

$$Q = \int_0^\infty \epsilon^2(t) \ dt $$

The object being controlled is described by the transfer function: $$ G(s) = \frac{1}{s^3 + 6s^2 + 5s} $$

My attempt

My idea was to find to find the expression for error in the s-domain, then perform an inverse Laplace transform to get the expression for the error in the time domain, then integrate the error from $0$ to $\infty$ and then find the values for the terms $K_1, K_2, K_3$ that will minimize the function. I apologize for the mistakes if I've made any as my knowledge of control theory is very basic.

What I managed to do:

The transfer function of a PID controller is:

$$ K(s) = k_1 + \frac{k_2}{s} + k_3 s $$

If $H(s)$ is the overall transfer function, $W(s)$ is the input, let's say it's the unit step function, the expression for error in the s-domain is, if I'm correct:

$$E(s) = W(s) - H(s)W(s)$$ $$E(s) = W(s)[1 - H(s)]$$ $$E(S) = \frac{1}{s}[1 - H(s)]$$

The overall transfer function will be given by:

$$ H(s) = \frac{K(s)G(s)}{1 + K(s)G(s)} $$

After substitution and simplification:

$$ H(s) = \frac{k_3 s^2 + k_1 s + k_2}{k_3 s^2 + k_1 s + k_2 + s^4 + 6 s^3 + 5 s^2} $$

Then, substituting for the expression for error:

$$E(S) = \frac{1}{s}[1 - \frac{k_3 s^2 + k_1 s + k_2}{k_3 s^2 + k_1 s + k_2 + s^4 + 6 s^3 + 5 s^2}]$$

I used Matlab ilaplace command to calculate the inverse Laplace transform of $E(s)$ and got:

$$ \epsilon(t) = \frac{\delta(t)}{t} - \frac{(exp[(- k_2 - t^2 k_3 - 5t^2 - 6t^3 - t^4)(t^2 + 6t + 5)]}{t} $$

I don't know if I've arrived at the correct result, what seems weird to me is that the resulting expression for $\epsilon(t)$ doesn't contain any $k_1$ term. But assuming this is correct, I would finish by finding the values of parameters $k_1$, $k_2$ and $k_3$ that minimize this integral: $Q = \int_0^\infty \epsilon^2(t) \ dt $

Question

Now, I would be grateful if you could verify whether my approach and solution is correct and describe how you would find the values of the parameters that minimize this integral using Matlab i.e. what commands and how you would use them. I'm wondering if lack of closed-form solution to the integral would make finding the parameters impossible.

Or maybe, there is a simpler method of solving this problem, perhaps by avoiding computing the integral.

$\endgroup$
2
  • $\begingroup$ Is this out of a book? What is the book's recommended method? If not, have you dug into the subject of optimal control (which is the sort of problem this is)? At the very least you don't need to compute $\epsilon(t)$: you can appeal to Parseval's Theorem to integrate $E(j\omega)$ for $-\infty < \omega < \infty$. $\endgroup$
    – TimWescott
    Jan 6 '20 at 21:20
  • $\begingroup$ Do you suppose that the input of the system is a step function ? $\endgroup$ Mar 21 '20 at 0:18
1
$\begingroup$

In general, the problem of finding a controller that minimizes some objective function falls under an extremely deep field of control theory called “optimal control”. Optimal control theory deals with minimizing functions of the state and controls (in your case it’s the squared error, which would fall under state) subject to some dynamics (in your case the transfer function), and constraints on the system.

There are many methods to solve these kinds of problems, such as Hamilton-Jacobi-Bellman (HJB) equations, dynamic programming, Pontryagin’s Maximum Principle (PMP) and many others.

$\endgroup$
1
$\begingroup$

Mm, I can't show you in matlab, but I can show some basic things with just plain math and a little script in mathematica.

If we do a Partial division, we see that:

$$\frac{1}{s^3+6 s^2+5 s} = -\frac{1}{4 (s+1)}+\frac{1}{20 (s+5)}+\frac{1}{5 s}$$

So we see our poles are at -5, -1, and 0, you have a majorly slow and dominant poll at -1, seeing that we have integral action already in our system, we already can just assume we don't need an i, so we can start with a PD controller immediately.

Looking at the root locus plot:

enter image description here

We see a poll fly off into infinity and our 2 oscillating imaginary poles aswell.

Adding any i value probably isn't going to help.

Using a script I wrote, I can manually adjust the PID values to get the response I prefer.

plot

Which also verifies that a PD controller is fine with i = 0, particularly since the system is so slow anyways.

Replacing my found values in the feedback Transferfunction gives me:

$$\frac{s (11 s+10)}{\left(s^2+6 s+5\right) s^2+11 s^2+10 s}$$

A similar script in matlab also exists, namely "pidtuner"

You can use fancy algorithms to find optimal solutions like "lqi" for a Linear quadratic integral optimal controller or others...but just looking at the poles of your system can show you some immediate dynamics and prevent you wasting time on trying to find or implement things like that, when plain ole classical analysis works fine.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.