Solving Laplace Transform for Arduino PID Controller

In summary, 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, and R is 1 Ohm. 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, and R is 1 Ohm. The laplace transform G(s) would then be (T(s)-T0)/V(s)
  • #1
mark1234
8
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
  • #2
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.
 
  • #3
your function is

[tex] e^{(-0.0154 \cdot t)}[/tex]
 
  • #4
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:

[itex]
T(t)-T0={\frac{V(t)^2}{KR}} (1-e^{k*t/C})
[/itex]

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

[itex]
{\frac{T(t)-T0}{V(t)}} = (e^{-k/C * t})
[/itex]

I can get up to :

k/C=0.0154

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

Any help is appreciated
 
Last edited:
  • #5
I am not a LaPlace specialist, but maybe I can help, it will take me I think about 10 minutes
 
Last edited:
  • #6
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

[tex]
f_{(t)}={\frac{T(t)-T0}{V(t)^2}}
[/tex]

Then this way should be correct

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

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

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

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

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

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

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

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

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

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

[tex]a = \frac{k}{c}[/tex]

[tex]G_{(s)} =\frac{1}{K \cdot R} \cdot (\frac{1}{s} - \frac{1}{s -a})[/tex]

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:
  • #7
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,
 
  • #8
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
  • #9
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:

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

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

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

resulting in:

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

with [itex] K= \frac {1} {RK} [/itex] and [itex] τ = \frac {C} {K} [/itex]

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
 

1. How does the Laplace Transform work?

The Laplace Transform is a mathematical tool used to convert a function of time into a function of frequency. It involves integrating the function with an exponential term and can be used to solve differential equations, including those involved in the PID control algorithm.

2. Why is the Laplace Transform useful for solving PID control equations for Arduino?

The Laplace Transform allows us to convert the differential equations involved in PID control into algebraic equations, making them easier to solve. This is especially useful for implementing the PID control algorithm on a microcontroller like Arduino, where complex calculations may not be feasible.

3. How do I use the Laplace Transform to solve for the PID control parameters in Arduino?

The first step is to take the Laplace Transform of the differential equations involved in the PID control algorithm. This will result in algebraic equations that can then be solved for the PID parameters. Once the parameters are determined, they can be programmed into the Arduino PID library to control the system.

4. Are there any limitations to using the Laplace Transform for Arduino PID control?

While the Laplace Transform is a powerful tool for solving differential equations, it does have its limitations. It may not work for all types of systems, and it may not always provide a complete solution. Additionally, some systems may require more complex control algorithms that cannot be solved using the Laplace Transform.

5. Can I use the Laplace Transform for real-time PID control on Arduino?

Yes, it is possible to use the Laplace Transform for real-time PID control on Arduino. However, this may require a more advanced implementation and may not be suitable for all applications. It is important to consider the limitations and complexities involved before implementing the Laplace Transform for real-time control.

Similar threads

  • Differential Equations
Replies
17
Views
860
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Differential Equations
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
Replies
3
Views
2K
Replies
2
Views
1K
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
3
Views
799
Back
Top