2
$\begingroup$

I've searched around a lot and maybe I just don't know what exactly to search (and even ask here) for, but I'd like to create a simple model/function of a heater dissipating heat to surrounding air, given heater max temperature and air/ambient temperature.

Problem:

I have a heater, which is really just a small light bulb, with an attached temperature sensor and the whole thing is exposed to surrounding air. I'd like to tune my PID controller constants on the given model to achieve the set temperature in the fastest time possible without overshooting the setpoint. I already have the PID controller implemented and now I just need to implement this heater model (so that I'll be able to simulate the heater response in code and won't need to run time consuming real world tuning).

I found a very helpful post, but unfortunately the author used a transfer function in Matlab that I don't know how to implement in my code.

The data I have is as follows:

$$ \begin{align} P_{heater} & = 5W \\ T_{0} & = 25 °C - \text{starting/ambient temperature}\\ T_{100} & = 77.4 °C - \text{temperature after 100 seconds}\\ T_{max} & = 108.5 °C - \text{steady state temperature} \\ \end{align} $$ $T_{100}$ also represents a 63% of total change if that's useful data to anyone?

I believe this should be enough to make a simple model with which I could approximate light bulb behaviour. I don't think data like the bulb/heater volume or area are really needed here (or can be calculated from given data), I can however provide some more data if needed.

I'm hoping for a "simple" formula along the lines of: $$ T(t) = \frac{a}{b \cdot (-t + c)} + d $$ to get temperature as a function of time.

I'd also like to model the cooling of this bulb and I think the same model should work (just in reverse?) but I'm not really sure about that.


Update

I've plotted my "real data" (blue line), the "step response" (red line) from the formula from this link (same link as above) and my simple "1/x model" (yellow line) approximation which is a following function: $$ f(t, n) = \frac{T_{max} - T_0}{-t \frac{T_n - T_0}{(T_{max} - T_n)\cdot n} - 1} + T_{max} = \frac{83.5}{-t \frac{52.4}{(31.1)\cdot 100} - 1} + 108.5 \text{; for n = 100} $$

data plot

The step model (red line) is a good approximation of real data (blue line), but my model (yellow line) is off (much) more than I'd like.

So my question is can I just tweak the constants of my model to make it fit better or do I need a new/different model? Or if anyone can point me to a simple implementation of a step response function as used in the previous link that would work for me as well. Or maybe I have completely missed the point and are solving the problem from a wrong perspective?


Update 2

Data for cooling model is: $$ \begin{align} T_{0} & = 109 °C - \text{starting temperature} \\ T_{100} & = 58.9 °C - \text{temperature after 100 seconds} \\ T_{max} & = 25 °C - \text{steady state/ambient temperature} \\ \end{align} $$

$\endgroup$
  • $\begingroup$ For the $f(x)$ that you're looking for, do you mean $T(t)$ (temperature as a function of time), or something else? $\endgroup$ – JMac May 7 '19 at 11:46
  • $\begingroup$ It is necessary to set the geometry of the lamp, build a model of heat transfer. Find a function $f(t)$ and its appropriate expression. $\endgroup$ – Alex Trounev May 7 '19 at 12:38
  • $\begingroup$ @AlexTrounev You don't necessarily need the geometry in this case. He already has some temperature measurements that he could base a model off of instead, and then fit the relevant geometric variables based on the data he has. $\endgroup$ – JMac May 7 '19 at 14:08
  • $\begingroup$ @JMac yes, that's actually what I'd like to do. I'll edit the formula to make it more clear. $\endgroup$ – croc May 7 '19 at 14:21
  • $\begingroup$ @JMac We do not know what the heat transfer mode is. Using three points it is impossible to determine the parameters of the model. $\endgroup$ – Alex Trounev May 7 '19 at 20:36
1
$\begingroup$

Here we can use a heat transfer model with 3 parameters $$\frac {dT}{dt}=k(T_0-T)+q, T(0)=25, T(\infty )=108.5,T(100)=77.4$$ The data allows us to determine the parameters $$T_0=25, q = 0.8247, k = 0.009876$$ Temperature versus time $$T(t)=T_0+\frac {q}{k}(1-e^{-kt})$$ Figure 1 shows the temperature versus time. If there are other data, the model can be clarified. fig1

In the cooling model, we set $q = 0$, then $$\frac {dT}{dt}=k_1(T_0-T), T(0)=109, T(\infty )=25,T(100)=58.9$$ Using the data we find $$T_0=25, k_1=0.009074$$ Temperature versus time $$T(t)=T_0+(T_1-T_0)e^{-k_1t}$$ Here $T_1$ is a temperature before cooling, $T_1=109$. Now we can reproduce the heating-cooling cycle

fig2

To find the parameters of the model, we use an analytical solution and data. In the model of heating we have

$$T(0)=T_0=25, T(\infty )=108.5=T_0+\frac {q}{k},T(100)=77.4= T_0+\frac {q}{k}(1-e^{-k100})$$ From here we find $$T_0=25,\frac {q}{k}=108.5-25=83.5, k=-\ln {(1 - 52.4/83.5)}/100=0.00987639, q=0.824678$$

$\endgroup$
  • $\begingroup$ Great! This looks almost identical to the step model response that's modeled with the transfer function in Matlab. Can you just update your answer with an explanation of how you calculated the q and k values? Also, could this/such model also be used to simulate cooling of this system (with different q and/or k values probably)? $\endgroup$ – croc May 9 '19 at 7:10
  • $\begingroup$ @croc To build a cooling model, data is needed. $\endgroup$ – Alex Trounev May 9 '19 at 9:07
  • $\begingroup$ I've updated my question with some data for the cooling model, is that enough? Also, can you explain in your answer how you calculated the q and k values? $\endgroup$ – croc May 9 '19 at 15:08
  • $\begingroup$ @croc See update to my answer. $\endgroup$ – Alex Trounev May 9 '19 at 16:30
  • $\begingroup$ Great, thanks! This is what I've been looking for, a simple model/formula that I can implement in my code given a few data points :) $\endgroup$ – croc May 10 '19 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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