Wednesday, April 15, 2015

Thermal Systems

Recently we have been using MATLAB to investigate thermal systems and how we can manipulate and simulate them using code.

For our thermal system, we are looking at the heating a cooling of a cup of coffee. First, we need to understand some basics of the system. The heat capacity, C of the coffee is defined as the ratio dE/dT, which measures the change in energy (or the energy flow) against the change in temperature, T. Now we need to look at the thermal resistance of the system, which is affected by the temperature difference (between the coffee and the air) and the heat flow. Basically, thermal resistance is asking how much the change in temperature drives the heat flow of the system, and can be written as

Rth = T-Tair/(dE/dt)

where t is time. Thus, to find the temperature change dT over the specified time dt, we get the formula:

dT = dE/C = dt* -(T-Tair)/(RthC)

Question 1
Since Rth and C both lie in the denominator of the equation for dT, by increasing them you get a small rate of change of temperature, meaning the coffee will cool more slowly over time. On the other hand, by decreasing Rth and C, you speed up the cooling process. Note that the negative sign on the lefthand side of the equation tells us that it is cooling, not heating up.

Now, suppose we add a heater to the coffee, so we are adding thermal energy into the system. In this scenario, we can write the rate of change as

dT = dE/C = ((P/C) - (T-Tair/RthC))*dt

Question 1
Now, if we want our coffee to be at 84 degrees centigrade, or 357 kelvin, we need to calculate P, the power supplied by the heater. Setting dT equal to zero, we also know that room temperature is 293 kelvin. We will use 1000 as our heat capacity and .85 as our thermal resistance. Plugging in, we get

0 = ((P/1000) - (357-293/.85(1000)))*10

64/.85 =P

P = 75.3

Below I will show you the programs on MATLAB that simulate the cooling and heating of coffee. For the heating, I will show both bang bang and proportional control of the heater, using the P value we found. 

Cooling


This code does not use P because there is no energy being put into the system, it merely simulates the temperature loss of the coffee over time as it approaches room temperature.

Heating: Bag Bang



As you can see, with bang bang control the coffee heats up the coffee quickly, supplying too much power at first, then when it reaches its ideal temperature, the heating shuts off completely. This is why the horizontal line segment of the graph looks so think, because the temperature is quickly rising and then dropping as the heat turns on and off.

Heating: Proportional Control

With proportional control heating, you will see that the curve of the graph is not as sharp as that of the bang bang heating graph. Here we implemented our P value at the desired temperature and varied it depending on the surrounding temperatures.


Proportional and Bang Bang Heating with Delay

Now we suppose that there is a 5 second delay between the time the the coffee reaches a given temperature and the time the sensor records it. To remedy this error, we will adjust our code on both the bang bang and proportional control heating codes to reflect a time recording that is five seconds earlier, so that the temperature being recorded matches the real temperature of the coffee.





As expected, these graphs record the temperature at an earlier time than on the graphs that did not account for the delay. Now the the correct temperature is recorded at the correct time.

This completes our investigation into thermal systems, but we'll continue to work with MATLAB.






No comments:

Post a Comment