Solving Laplace Transform for Arduino PID Controller

Click For Summary

Discussion Overview

The discussion revolves around deriving the Laplace transform for a PID controller implemented on an Arduino, specifically for controlling the temperature of a light bulb. Participants explore the mathematical modeling of the system, including the transfer function and its relationship to the time-domain equations.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes their system modeled by the equation Qin-Qout=V(t)^2/R-K(T(t)-T0)=C*dT(t)/dt and seeks help in deriving the transfer function.
  • Another participant suggests using Laplace transform tables to relate the transfer function G(s) to a time-domain function, indicating that it should yield an exponential form.
  • A participant provides a potential time-domain function and attempts to derive the transfer function from it, expressing uncertainty about how to eliminate certain terms.
  • Multiple participants discuss the form of the transfer function, with some suggesting that G(s) should be (T(t)-T0)/V(t) while others question the inclusion of V(t) squared in the transfer function.
  • One participant shares a detailed step-by-step approach to transforming the time function into the Laplace domain, but acknowledges that the process may not be necessary for the original poster.
  • Another participant expresses confusion about how to handle the squared term of V(t) in the transfer function and questions the validity of previous claims regarding its removal.
  • In a later post, the original poster claims to have resolved their issue, stating that the transfer function cannot eliminate the V^2 term and seeks confirmation of this conclusion.

Areas of Agreement / Disagreement

Participants exhibit disagreement regarding the proper form of the transfer function and whether the V^2 term can be removed. Some participants support the inclusion of V^2, while others question its necessity, indicating that the discussion remains unresolved.

Contextual Notes

There are limitations in the assumptions made regarding the system's behavior and the definitions of the variables involved. The discussion also reflects varying levels of familiarity with Laplace transforms among participants, which may affect the clarity of the mathematical derivations presented.

mark1234
Messages
8
Reaction score
0
Hi All,

I'm playing around with an arduino, and have build a PID controller that controls the temperature of a light bulb, measured with an NTC. All is working fine

I'm looking to get a bit more theoretical on the subject and have modeled the system in a simulink like environment. I want to be able to determine the transfer function, but am not able to do it on paper and am looking for some help on it.

The system is modeled as:

Qin-Qout=V(t)^2/R-K(T(t)-T0)=C*dT(t)/dt


K and C are determined experimentally 0.77 and 50, the resistance of the light bulb ,R, is 1 Ohm.

A transfer function G(s)=(T(s)-T0)/V(s)=1/(10s+0.154) seems to fit quite well, I'm just not sure how to get from the time based function to the transfer function.

Thanks,
 
Last edited:
Engineering news on Phys.org
Hey mark1234,

Google "laplace transform tables". You will be able to match up your G(s) to a time domain function. If i recall correctly, the transfer function you have will be an exponential in the time domain.
 
your function is

e^{(-0.0154 \cdot t)}
 
Guess i get stuck in the Laplace transform or re-writing it to the correct form.
Solving the time equation , with boundary condition T(0)=T0:

<br /> T(t)-T0={\frac{V(t)^2}{KR}} (1-e^{k*t/C})<br />

To get to the transfer function this apparently has to be rewritten in the form of:

<br /> {\frac{T(t)-T0}{V(t)}} = (e^{-k/C * t})<br />

I can get up to :

k/C=0.0154

<br /> {\frac{T(t)-T0}{V(t)}} = {\frac{V(t)}{KR}}(e^{-0.0154 * t})<br />
not quite sure how to do the last step, how to get rid of the term {\frac{V(t)}{KR}}

Any help is appreciated
 
Last edited:
I am not a LaPlace specialist, but maybe I can help, it will take me I think about 10 minutes
 
Last edited:
I don't know why it does not work with latex

I don't know where you exactly got this function, but if you can say that

<br /> f_{(t)}={\frac{T(t)-T0}{V(t)^2}}<br />

Then this way should be correct

G_{(s)} = \int^{\infty }_{0} f_{(t)} \cdot e^{(-st)} \, dt

f_{(t)}=\frac{1}{K \cdot R} \cdot (1-e^{(\frac{k}{c} \cdot t)})

G_{(s)} =\frac{1}{K \cdot R} \cdot \int^{\infty }_{0} (1-e^{(\frac{k}{c} \cdot t)}) \cdot e^{(-st)} \, dt

G_{(s)} =\frac{1}{K \cdot R} \cdot \int^{\infty }_{0} (1-e^{(\frac{k}{c} \cdot t)}) \cdot e^{(-st)} \, dt

G_{(s)} =\frac{1}{K \cdot R} \cdot \int^{\infty }_{0} e^{(-st)} -e^{(\frac{k}{c} \cdot t)} \cdot e^{(-st)} \, dt

G_{(s)} =\frac{1}{K \cdot R} \cdot \int^{\infty }_{0} e^{(-st)} -e^{(\frac{k}{c}-s) \cdot t} \, dt

G_{(s)} =\frac{1}{K \cdot R} \cdot [-\frac{e^{(-st)}}{s} -\frac{e^{(\frac{k}{c}-s) \cdot t}}{(\frac{k}{c}-s)}] (now using the limits)[/tex]

<br /> G_{(s)} =\frac{1}{K \cdot R} \cdot [0 -0 - (-\frac{1}{s} - \frac{1}{\frac{k}{c}-s}]

G_{(s)} =\frac{1}{K \cdot R} \cdot [0 -0 - (-\frac{1}{s} + \frac{1}{s -\frac{k}{c}}]

G_{(s)} =\frac{1}{K \cdot R} \cdot (\frac{1}{s} - \frac{1}{s -\frac{k}{c}}]

a = \frac{k}{c}

G_{(s)} =\frac{1}{K \cdot R} \cdot (\frac{1}{s} - \frac{1}{s -a})

I wanted to show how you can transform f(t) in F(s)
But you don't have to do the whole procedure
If you look at the formula f(t) you see that first you have a constant before the brackets

You can simply use the table. 1 for 1/s and e^(k/c * t) = e^(a * t) is 1/(s-a)
 
Last edited:
Buell,

Thanks for your efforts.
In the time function there is a squared function of V(t) present. How did you get rid of that?
The transfer function, G(s) = (T(t)-T0)/V(t)

Thanks,
 
mark1234 said:
Buell,

Thanks for your efforts.
In the time function there is a squared function of V(t) present. How did you get rid of that?
The transfer function, G(s) = (T(t)-T0)/V(t)

Thanks,

Are you sure, that you are right with your function G(s) = (T(t)-T0)/V(t)^2.
Isn't there any mistake you might have made?

G(s) = (T(t)-T0)/V(t)^2 does not make any sense for me
G(s) is a LaPlace transformed function
can not include T(t), V(t)
 
Last edited:
  • Like
Likes   Reactions: 1 person
The laplace transform G(s) would then be (T(s)-T0)/V(s)

I'll check if there's an error in my simulink model, or interpretation of it.
 
  • #10
Attached is the simulink model of both the time series and the transfer function.

https://dl.dropboxusercontent.com/u/75646341/Knipsel.JPG

and the result of the simulation:

https://dl.dropboxusercontent.com/u/75646341/Knipsel2.JPG

The transfer function of V(t)^2/R-K(T(t)-T0)=C*dT(t)/dt thus appears to be 1/(10s+0.154)
I'm still not able to transform the first to the second on paper.
Or am i making an interpretation error somewhere?

Thanks
 
Last edited by a moderator:
  • #11
Ok, so i solved my problem:

C \frac{\partial T(t)}{\partial t} + K(T(t)-T0) = \frac {V(t)^2} {R}

use boundary condition T(0)=T0=0, Laplace transform gives :

T(s).(Cs-K)= \frac {V(s)^2} {R}

resulting in:

G(s) = \frac {T(s)} {V(s)^2} = \frac {1/R} {Cs+K} = \frac {K} {τs+1}

with K= \frac {1} {RK} and τ = \frac {C} {K}

and thus leaving the V^2 in the transfer function. In my simulation (post above) the transfer function i used as just a function of V and not V^2 appeard to be flawed and only correct for one value of V.

Am i correct in stating the the V^2 can not be removed from the G(s) function?

Thanks
 

Similar threads

Replies
1
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 27 ·
Replies
27
Views
7K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K