# Differential Equation: Trouble finding constants in PI-regulator

1. Dec 10, 2011

### Twinflower

Until now, I have come this far:

The differential equation equals the particular part, and the homogene part:
$$x = x_p + x_h$$

The homogene part equals the differential equation when set to zero
$$\frac{d^2x}{dt^2} + \frac{K_p}{A} \times \frac{dx}{dt} + \frac{K_p}{A \times T_i} \times x(t) = 0$$

Converting the derviates into lambda, and inserting values for constants it turns into this:

$$A = 1, K_p = 0,02, T_i = 200$$

$$\lambda^2 + \frac{K_p}{A} \times \lambda + \frac{K_p}{A \times T_i} = 0$$

Solving the equation with regard to lambda, I get:
$$Lambda_1 = Lambda_2 = -0.01$$

It is now time to assume the form of the solution of the homogene part, which should be like this:
$$C_1 \times e^{\lambda t} + C_2 \times t \times e^{\lambda t}$$

C1 and C2 are the constants I have trouble finding
According to what I have learned, I have to set the whole original equation = starting condition when time = 0 to find them.

Starting condition: $x(0) = 1$

Consequently:
$$x(0) = 1 = x_p + x_h$$

Inserting values for particular and homogene part
(particular part = 1) (t = 0)

$$x(0) = 1 = 1 + C_1 \times e^{\lambda 0} + C_2 \times 0 \times e^{\lambda 0}$$

When trying to solve this equation with regards to C1 and C2, I get that C2 is canceled out when multiplying with T = 0.

The real values of C1 and C2 is found when solving the derivate of the start condition with regards to C1 and C2. The first one is to find the relation between them (example: c1 = -c2 or similar)

Can someone help me out here?

Last edited: Dec 11, 2011
2. Dec 10, 2011

### I like Serena

Hi Twinflower!

Try using curly braces {} for the parts you want to keep together.
(Fixed it in your post.)

Hmm, that's not how I learned it.
I'm used to first solving for the particular solution.

For that you would have to restart with the entire differential equation, meaning the part that is dependent on t, but not on x(t), which is the inhomogeneous part.

Or don't you have such a part?

Assuming you have no inhomogeneous part, you should do it like this:

$$x(0) = 1 = C_1 \times e^{\lambda \cdot 0} + C_2 \times 0 \times e^{\lambda \cdot 0} = C_1$$

This way, you have solved one constant, but you still have the freedom of a second constant.
To find the second constant, you need another constraint.
For instance x'(0) if you have that.

3. Dec 11, 2011

### Twinflower

I'm not entirely sure about this, but maybe what you call the inhomogeneous part is what I call the particular part.

Or do you refer to the part that the entire differential equation equals to?

In that case; This is the entire differential equation after setting it up:
$$\frac{d^2x}{dt^2} + \frac{K_p}{A} \times \frac{dx}{dt} + \frac{K_p}{A \times T_i} \times x(t) = \frac{K_p}{A\times T_i} \times r$$

To put this in perspective, this case is about fluid regulation in a tank by the means of a PI-regulator.

The R is the desired level, and X = the actual level (measured in meter above the tank's floor)

4. Dec 11, 2011

### Twinflower

and yes, I think I have the x'(0):

$$x'(0) = - \frac{V}{A} = r + C_1 \lambda e^{\lambda t} + C_2 t \lambda e^{\lambda t}$$
But I am not sure if this is derivated correctly. (the last part with C2 and the 2 t's)
This will render C2 multiplied with 0 once again

Last edited: Dec 11, 2011
5. Dec 11, 2011

### I like Serena

Yes, this is what I mean.
To solve it, you need to find a particular solution to the entire differential equation (which is called an inhomogeneous differential equation).
Since the right hand side is a constant, the particular solution can be "guessed" to be a constant as well (method of undetermined coefficients).

If you fill in $x=C_0$, you should find this is indeed a solution if:
$$\frac{K_p}{A \times T_i} \times x(t) = \frac{K_p}{A \times T_i} \times C_0 = \frac{K_p}{A\times T_i} \times r$$

In other words if $C_0 = r$ and therefore $x_p = r$

After that, you can resolve your boundary conditions with x(0) and x'(0) ...

Interesting! :)
What kind of education do you do to learn about stuff like this?

Your derivative is not quite right.
You should apply the product rule for differentiation...

6. Dec 11, 2011

### Twinflower

I really appreciate that you spend so much time with detailed explanations, Serena :)

I am studying to bachelor in electrical engineering, but this problem is a large case-study created by my teacher. It is supposed to be some of the foundation for my upcoming exam.

But thanks for pointing out that I missed the product rule. I am back on track now :)

7. Dec 11, 2011

### Twinflower

Ok, so I've fixed the last derivative to this:
$$x'(0) = - \frac{V}{A} = C_1 \lambda e^{\lambda t} + C_2 t \lambda e^{\lambda t} + C_2 e^{\lambda t}$$
Inserting values; r = 1, C1 = 0, V= 0.005, A = 1

$$x'(0) = -0.005 = 0 + 0 + C_2 e^0$$

$$-0.005 = C_2$$

Now for the final solution;
C1 = 0
C2 = -0.005
Lambda = -0.01
r = 1

$$x = x_p + x_h$$

$$x = 1 - 0.005t e^{-0.01t}$$

8. Dec 11, 2011

### I like Serena

Thanks!
And I believe you are done!