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} $$
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} $$