Solving Laplace Transform for Arduino PID Controller

AI Thread Summary
The discussion revolves around deriving the transfer function for a PID controller controlling a light bulb's temperature using an Arduino. The user successfully modeled the system and identified the transfer function as G(s) = 1/(10s + 0.154), but struggled with the mathematical transformation from the time domain to the Laplace domain. After several exchanges, the user clarified that the correct form of the transfer function should include V^2, leading to G(s) = T(s)/V(s)^2 = K/(τs + 1), where K and τ are defined based on system parameters. Ultimately, the user confirmed that the V^2 term cannot be eliminated from the transfer function, indicating a flaw in their initial assumptions. The discussion highlights the importance of accurately interpreting system dynamics in control theory.
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 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
 
Back
Top