2
\$\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 infinity and then find the values for the terms k_1, k_2 and 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_2 and k_3 and k_1(?) 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\$ That inverse Laplace does not seem correct, specially due to those \$ \frac{1}{t} \$ terms \$\endgroup\$
    – jDAQ
    Jan 8, 2020 at 7:33
  • \$\begingroup\$ Also, this problem will lead to many local minima and I am not sure you will be able to find the global one analytically. \$\endgroup\$
    – jDAQ
    Jan 8, 2020 at 10:30

1 Answer 1

1
\$\begingroup\$

Doing that analytically will be really hard, even if you find an expression for \$ Q \$ there will be many local minima and you will have to test each of them to find the actual global one. But numerically you can find an approximate (or at least a local minimum). Do it like this using Octave (should be easy to adapt to Matlab),

pkg load control;

function e = opt(x)
G    = tf([1],[1 6 5 0]);
C    = pid(x(1),x(2),x(3));

%all resolutions
  %these make sure that it is stable
[y1,t]= step(feedback(G*C),100);
[y2,t]= step(feedback(G*C),10);
  %these make sure it minimizes the transient 
[y3,t]= step(feedback(G*C),1);
[y4,t]= step(feedback(G*C),0.1);
y = [y1;y2;y3;y4];

%ISE
e = (y-1)'*(y-1);
endfunction


x = [1 1 3];
[best_x, fval] = fminsearch (@opt, x);

%your plant
G    = tf([1],[1 6 5 0]);
%best controller
C    = pid(best_x(1),best_x(2),best_x(3));
step(feedback(G*C),5)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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