A Cooling Cup of Coffee
First we simulated a hot cup of coffee cooling down.We used the equation
where dT is the change in temperature, dE is the change in thermal energy, C is the heat capacity, and Rth is the thermal resistance.
We put the equation into MATLAB and got the following script:
We predicted that by increasing the thermal resistance (Rth) or heat capacity (C), the slope of the curve would become less steep.
When we changed the Rth to 1.0, compared to the original 0.85, the curve became less steep.
Then, when the C was changed from 1000 to 2000, we got this plot:
Adding a Heater
The next part was to simulate heating up and maintaining the temperature of a pot of coffee. We calculated that in order to heat up a pot of coffee from room temperature to 84C, a good value for the power is 75.
From a given plot of temperature vs time, we deduced that C = 1000 and Rth = 0.853.
Bang-Bang
By incorporating power into a new script, we created a plot for temperature vs time when heating up a cup of coffee. We first simulated a bang-bang control heating system, so that when the temperature is at or below the desired temperature, the power is fully on, and when the temperature is above the desired temperature, the heating is turned off.
The zoomed-in plot shows that the temperature jumps up and down once it reaches close to the desired temperature.
With this bang-bang control, we see that when the desired maximum is reached, the temperature fluctuates between slightly above and slightly below the actual value. Bang-bang can be sometimes desirable, as it is easier to program compared to proportional control. However, it is not very accurate in reaching a desired value, for example temperature, as there is only the choice of having the system being completely on or completely off.
Proportional
Next, we modified the script so that the heating system uses proportional control to heat the coffee.
Delay
Lastly, we simulated a delay in the reading of the temperatures in the bang-bang and proportional control heating systems.
First, we modified the bang-bang heating script from earlier to incorporate a delay in the reading of the temperature. The plot shows that because of the delay, the system heats up the coffee past the desired temperature, and in response, stops heating and the temperature drops. Then, when the system senses that the temperature is too low, it starts heating it up again. The temperature bounces back and forth between over heated and under heated.
Next, we modified the proportional heating script to incorporate the delay. With this delay incorporated, the system never reaches the desired temperature.
Apart from sensor delays, in the bang-bang system, there could be a delay in when the power is turned on or off. There may also be delays in the change in the power setting of the proportional heating system. When the system changes the power supply of the system to account for the current temperature approaching the desired temperature, the power may not be adjusted right away.
I like how you have a dialogue for each task, such as "changing this gives us this plot." It really helps us understands your process of how you are changing the code and the results.
ReplyDelete