We started by modeling a simulation of a cooling cup of coffee. First, we calculated the effect the heat capacity (C) and the thermal resistance (Rth) have on the system. Given that a change in temperature can be calculated by:
dT = - ((T-Tair)/(Rth*C))dt
The change in temperature is inversely proportional to any change in either C or Rth. A larger Rth resulted in a smaller dT and a smaller Rth resulted in a larger dT.
Larger Rth Value |
Smaller Rth Value |
The same was true for the C values.
Larger C Value |
Smaller C Value |
After we explored the cooling simulation, we moved on to a warmer topic. When energy is added to the system (the coffee, in this case), the temperature of the system increases. We simulated a heating process where heat was added to the coffee at a constant rate (P) based on the equation:
dT = dE/C = [(P/C) - ((T - Tair)/RthC)]dt
When the coffee is heated to the desired temperature (the Starbucks ideal 84 degrees Celsius), the change in T is zero.
0 = [(P/100) - (64/(1000*.85))] *10
0 = [(P/100) - 0.075] *10
(P/100) = .75
P = 75
Incorporating this value into the simulation script resulted in a steady increase in temperature. The rate of the increase in temperature became smaller the closer the coffee was to its desired temperature.
Working backwards from such a graph, it is possible to deduce the values of C and Rth. Working from the following equation:
dT = dE/C = [(P/C) - ((T - Tair)/RthC)]dt
P = (T-Tair)/Rth
Rth = (T-Tair)/P
Rth = 64K/75W = .85 K/W
Working from the equation:
dE/dt = (T-Tair)/Rth
And from the deduced equation:
Rth = (T-Tair)/P
We get:
dT/dt = P/C
Which is the slop of the graph. For our graph, the initial slope was about 30K/400s, ergo:
C = P/slope
C = 75W/.075K/s
C = 1000 J/K
These were the values given to us with the initial script, so we knew that our calculations were correct.
Finally, we moved on to incorporating feedback and control into our models.We started by simulating a temperature sensor in our coffee mug that used bang-bang control to reach and maintain the desired temperature (84 degrees Celsius or 357 degrees Kelvin).
We moved on to proportional control.Unlike with the race cars, the proportional control did not work very well to heat the coffee. The P value could only fluctuate between 0 and 100. Because the temperature had to be some value between 357 and 0, by the equation:
dT = P (T-Tair)
(gain)*(error)
At most, the P value could only be .28. This resulted in a system that could not heat the coffee anywhere near 357 Kelvin. Even when the P value was raised to an unrealistically high 20, the coffee was still just under the desired temperature. Though the proportional control method maintained a constant temperature better than the bang-bang control did, it could not successfully heat the coffee to the desired temperature. For a Starbucks employee, this method would result in some very unhappy customers.
P Value .28 |
P Value 20 |
Finally, we played with the idea of applying a delay between when the time the coffee reached a certain temperature and the time when the sensor recorded that fact. This would make the system more realistic, as the computer assumes everything happens instantaneously. This effect was achieved by applying a three second delay to the program. Each measured interval (i) was set between 1 and n, and the delay was the mathematical result of multiplying T by (i-3).
delay = 3
i = 1:n
error = 357 - T(i - delay)
P = 20*(error)
When the delay was applied to the proportional control script, the result was a sine curve that diminished over time into a straight line.
For the bang-bang control, the delay script had to be altered slightly:
if T(i-delay) > 357, then P = 0
else P = 100
However, there are other delays to take into account in a thermal system. the temperature of the coffee could not be evenly distributed, so some portions may be hotter or cooler than the sensor records. This could result in coffee that is too hot or too cold, despite the added sensor. If the coffee temperature is measured in a container larger than a single cup, this kind of error is especially possible, as cooler liquid will sink to the bottom while warmer liquid will rise. There could also be a delay between when the heater turns off and on once the sensor has recorded the temperature. The temperature may be just right, and the sensor may know that, but it might take a few seconds for the heater to know that. The result could be either coffee that is too hot or too cold.
The perfect cup of coffee is harder to achieve than one would think.
I really admire how you kept the general situational goal of warming coffee in mind as you were making this. I think it gives a lot of nuance and interest to an otherwise very technical blog post.
ReplyDeleteI like your explanations and step-by-step solutions to the problems. Even if the reader did not have any knowledge about thermal systems, they would not have trouble understanding your blog post!
ReplyDelete