Wednesday, April 3, 2013

MATLAB Madness, Part II: Cooling Coffee

In this class we worked through a long example explaining how to model the cooling and heating of a cup of coffee.  Remembering this problem from the second day of my math class last semester (fond memories!), I was eager to begin.

Question 1: How does the cooling behavior change if we vary the parameters Rth and C?  Use intuition and formulas to predict, then run simulation changing parameters.
A greater heat capacity should decrease the rate of cooling, since the energy changes more per unit temperature change, and we're looking to find the rate of temperature change per unit time.  C is in the denominator of the final equation, so greater C means smaller dT, so the coffee will cool more slowly.  Similarly, decreasing C will increase the rate of cooling, and dT will increase, so the coffee will cool faster.
A greater heat resistance should also decrease the rate of cooling, since Rth is inversely proportional to both dE/dt and dT.  Thus increasing Rth will decrease dT, so the coffee will cool more slowly; conversely, decreasing Rth will increase dT, so the coffee will cool more quickly.
MATLAB analysis confirms these answers.

Question 2: Calculate a good value for P if we want our coffee to heat up to the Starbucks ideal of 84 degrees C.
So: dT = dE/C = (P/C - (T-Tair)/(Rth*C))*dt
If C=1000 and Rth = 0.85:
dT = (P/1000 - (357 - 293)/(0.85*1000))*dt
Find where the final temperature is constant, so dT/dt = 0:
dT/dt = 0 = (P/1000 - 64/850)
P = 75
MATLAB analysis confirms that P should be 75.


Suppose you have a temperature sensor submerged in the coffee.

1) Modify the above programs to simulate a temperature controller that uses bang-bang control to reach and maintain the desired temperature. Bang-bang control is a very common approach for thermostats. Why is bang-bang control appropriate for many thermal systems? When might it be insufficient?
Bang-bang control is appropriate for many thermal systems because small fluctuations in the temperature are not particularly important (i.e., if a house thermostat fluctuates between 68 and 72 degrees F, this fluctuation is likely insignificant compared to the other fluctuations that cause a temperature gradient within the house).  Bang-bang control is insufficient when small fluctuations greatly change the system; in this case, extra effort and money must be invested in proportional control to truly keep temperature constant.
My bang-bang control program:



2) Create a program that uses proportional control to reach and maintain the desired temperature. How does this approach compare to bang-bang control?
Proportional control, as usual, creates a much smoother temperature graph, where (after the initial heating, which is completed faster) the final temperature is reached and kept almost completely constant.
My proportional control program:
3) Suppose there is a delay between the time the coffee reaches a given temperature and when the temperature sensor records that temperature. Modify both of your programs to include this effect, along the lines of the programs on the next few pages that I showed in class, which explore the effect of adding a “sensor delay” to a simulation of moving a SciBorg lego car a particular distance.  What is the impact of this “sensor delay” on your system in each case? What other delay(s) might you expect in your thermodynamic system, apart from sensor delays?
The "sensor delay" caused a much greater range of temperatures and consequently a greater variability in the final temperature; surprisingly, it seemed to affect bang-bang control less than the proportional control program.
In a thermodynamic system, I would expect a delay of heating--i.e., when a furnace first turns on, it is not immediately at the desired temperature.  There also might be delays of transferring heat (i.e., if a furnace takes time to blow hot air down into the basement, or it takes time for the heat to rise to the second floor).
Bang-bang control:

Proportional control:

No comments:

Post a Comment