To start off this assignment, Amy gave us a brief presentation of Newton's Law of Cooling and the math and physics behind thermal systems. We were then tasked with using MATLAB to examine and update a simulation of a cup of coffee being either heated or cooled. For this assignment, I worked with Rachel and Vivian who are also my final project partners.
Exercise 1
We were given the first code, which depicts the cooling of coffee. We were than told to determine how varying the parameters Rth and C would effect the program. Looking at the equation for Newton's Law of Cooling (to the right), we see that both Rth and C are inversely proportional to dT, the corresponding temperature rise. This suggests that as Rth and/or C decrease dT increases. Likewise, as Rth and/or C increase dT decreases. We tested this out by lowering Rth from .85 to .15, increasing Rth from .85 to 10, lowering C from 1k to 5, and increasing C from 1k to 1M. As we anticipated, when we decreased the value of either Rth or C, dT increased more quickly and the coffee reached it's desired temperature more quickly. When we increased either Rth or C, dT increases a much slower rate, so you can't even see the whole image on our graphs! You'd have to lengthen the tmax, duration of the simulation, in order to see when the coffee finally cools to air temperature.
Rth = .85; C = 1000 |
Rth = 10; C = 1,000 |
Rth = .15; C = 1,000 |
Rth = .85; C = 50 |
Rth = .85; C = 1,000,000 |
Exercise 2
In this next exercise, instead of cooling the cup of coffee, we explored the scenario of heating up a cup of coffee from room temperature. To do this we used a slight variation of the previous equation. Because we are now increasing the temperature of the cup we need to add thermal energy at a constant rate P. To determine a good value for P, we needed to use MATLAB. To do this we needed to isolate P onto one side of the equation and since the difference between the initial temperature and the temperature of the coffee is zero, we set dT/dt to zero. When we typed this equation into MATLAB, the program spit out an answer of roughly 75.
Exercise 2b
For the continuation of this problem, we were given the program for the heating of a cup of coffee and asked to deduce the thermal parameters of C and Rth when looking at a plot of the data.
In order to find Rth, we looked at the equation P = ΔT / Rth. By isolating Rth, we were left with ΔT / P on the other side. Plugging in the values for ΔT (357-293) and Rth (75), we calculated a Rth of .84.
In order to find C, we looked at the special circumstance of t = 0. When t = 0, for a short duration of dt, we have the equation dT/dt = P/C because we can assume the difference between the temperature of the cup and the temperature of the surroundings is negligible/really close to zero. Isolating C, we get P/(dt/dT). dt/dT is also known as the slope of the equation and can be determined by eyeballing the slope at t=0. The slope, therefore, will vary person by person. I personally think it looks like it is approximately, 20 / 250. This then gives me a value of approximately 950 for C.
In order to find Rth, we looked at the equation P = ΔT / Rth. By isolating Rth, we were left with ΔT / P on the other side. Plugging in the values for ΔT (357-293) and Rth (75), we calculated a Rth of .84.
In order to find C, we looked at the special circumstance of t = 0. When t = 0, for a short duration of dt, we have the equation dT/dt = P/C because we can assume the difference between the temperature of the cup and the temperature of the surroundings is negligible/really close to zero. Isolating C, we get P/(dt/dT). dt/dT is also known as the slope of the equation and can be determined by eyeballing the slope at t=0. The slope, therefore, will vary person by person. I personally think it looks like it is approximately, 20 / 250. This then gives me a value of approximately 950 for C.
Exercise 3
In our next exercise, we need to create a code that raises the temperature of the coffee to the desired temperature and maintain it there. To do this, we repurposed the equations above. We turned the two statements into if/else loops and put it within a greater while loop. We also needed to increase the value of P, because a P value of 75 doesn't heat up the coffee very quickly and in order for bang bang to work, we need a scenario in which there is some over and under shooting.
This gave us our desired result. When the coffee's temperature is below 357 degrees K, the if code will be initiated and the heater will turn on. When the temperature of the coffee was greater than the desired value of 357 degrees K, the else statement command would be initiated (i.e. the heater would be turned off and the coffee will cool down). This gave us our expected zig zag type plot. As a result, the cup of coffee never stays at 357 degrees, but jumps back and forth between being a little warmer and a little cooler.
time (s) v. temperature (K) graph |
a zoomed in section of the graph |
Exercise 4
This next exercise is a variation on #3. Instead of using Bang Bang control, we need to create a coding use proportional control to reach and maintain the coffee's desired temperature.
To start with, we repurposed the while loop from the heating up of the coffee. We decided to make the power of the heater proportional to the difference in temperature of the room and desired, 357 degrees K. We know that when the temperature difference is 0 or when t = 0, that the heater should be on a high power and when the temperature difference reaches 84 degrees, the heater should be on low power. So we estimated appropriate power levels and plugged them into a equation for the slope of a line. After some trial and error regarding the appropriate power levels, we decided on using 200 as the max power and 75 as the minimum. This gave us a maintained temperature 0.13 K away from the desired temperature!
Exercise 5a
For the next exercise, we needed to rewrite our bang bang control supposing there was a delay between the time the coffee reaches a given temperature and when the sensor records the temperature.
This delay made it so that our original graph gets shifted to the right.
Exercise 5b
For second part of this exercise, we needed to rewrite our proportional control supposing there was a delay.
The delay made it so that the heater didn't not turn off until well after the temperature of the cup of coffee exceeded that of the goal temperature. Therefore, this gave us an overshoot curve that you can see in our graph.
Other delays that we would expect from our thermodynamic system would include the time needed for the heater to go from x degree to y degree. This delay would have less of an impact on the proportional control code, than it would from the bang bang control, since the bang bang control, assumes the power can go from zero to maximum instantaneously.
Your graph for proportional control with delay looks so standard! it almost look like the example Amy put on the handout!
ReplyDelete