Energy Balance Model of Can Experiment

For Summer 1997 Envision-It Workshop

Our goal is to develop a Matlab model to describe the hot/cold can experiment. This type of a model is often called an energy balance model.

In an energy balance model, there can be heat flowing into or out of the system by a variety of physical processes. In the Steady State (or Equilibrium) case, these heat flows into and out of the system are equal and the temperature of the system is constant. If the heat flows are not equal (as is the case when the can is heating up or cooling down), the system will be gaining or losing energy and this will result in a temperature change.

We need to define a few terms before we can proceed with developing a mathematical model:

The Power (P) is the amount of energy flowing into/out of the system during some time period. We can write this as a mathematical equation:
(Eqn 1) P = ΔQ / Δt
where ΔQ (units of Joules or Calories) is the amount of energy flow and Δt is the time interval.

If the system absorbs a net amount of heat ΔQ the temperature of the system will change by an amount ΔT which is given by
(Eqn 2) ΔT = ΔQ / C
where C is called the heat capacity of the object. The heat capacity is the product of the m the mass of the object and c is its specific heat. For water, the specific heat is 1 cal/goC = 4186 J/kgoC

We will use the following algorithm to develop a computer simulation of a heat flow problem:

  1. Set initial conditions (such as temperature) and parameters (mass, specific heat) for the system
  2. Request user input for unknown parameters (such as the heat-loss coefficient)
  3. Set the temperature to its first value
  4. Use the current temperature to calculate the power gained (PGain) and lost (PLoss) by system
  5. The net heat flow during a time interval Δt is (PGain-PLoss)*Δt, so the change in temperature is
    (Eqn 3) ΔT = (PGain-PLoss)* Δt / C
  6. The new temperature is the old temperature plus ΔT
  7. The new temperature can be stored in an array, printed or put onto a graph of temperature vs. time.
  8. If the experiment is not over (not at the last time interval), continue from step 4 above using the new temperature to calculate the power, etc.
  9. If the experiment is over (at the last time interval), make plots of temperature vs. time and see how well they represent the data. If they do not, run the program again using a different estimate for the parameters in step 2.

For the can filled with hot water, it will lose heat by Convection, Conduction and Radiation. For an object near room temperature, we often group these together and approximate these in an equation called Newton's Law of Cooling:
(Eqn. 4) PLoss = k (T - TS)
where T is the temperature of the system, TS is the temperature of the surroundings, and k is the heat-loss coefficient. In other words, the larger the difference between the temperature of the object and its surroundings, the faster heat is lost from the object. The heat-loss coefficient, k, can sometimes be estimated from physical equations, but it is often found empirically by doing a measurement. This is what we are going to do.

If you have performed the experiment yourself, use an editor to make a file called hotcans.out which has three columns separated by spaces: Time, Temperature of Silver Can and Temperature of Black Can. If you do not have such a data set, you can use the data set (called hotcans.out) for the temperature vs. time for silver and black cans filled with water which start from a temperature of about 45oC. The situation for this data set is as follows:

The program ploss.m (which is listed below) will plot the data and calculate the model given by the equations above. To use this program you do the following As you are working on the problem, some questions you can be asking yourself: Can the model fit the data over the whole time range? (For example, the command axis([0 3600 20 50]); will allow you to display the first 3600 seconds of the data) Why or why doesn't it fit? In particular, what is the fit like in the first 15-20 minutes (make plots). What about the last few hours? When is there the largest deviation between the model and the data?
%  PLOSS.M Energy Balance Model for Hot/Cold Cans
%  This program models the rate at which a hot object loses heat.
%  Tom Huber   10-JUL-97
%  Before running this, copy the actual Temperature vs. Time into
%    timeActual and TempActual
Ts = 20.7;      % Surrounding Temperature (in Centigrade)
m  = 0.1;       % Mass of Water in can (in kg)
c  = 4186;      % Specific Heat of Water (in J/(kg*DegreeC) )
C  = m*c;       % Heat Capacity (in J/DegreeC)

dt = timeActual(2) - timeActual(1);   % Use time step of actual data
tMax = max(timeActual);               % Use the last time
t = 0:dt:tMax;          % Make array of times

Temp = 0*t;                % Initialize Temperatures to 0
Temp(1) = TempActual(1);   % Use the actual 1st temperature

k = input ('Enter Heat Loss Coefficient ');

for i=2:length(Temp)
   PLoss = k*(Temp(i-1) - Ts);   % Calculate the Power Loss
   dTemp = -PLoss*dt/C;            % Calculate the Temperature Change
   Temp(i) = Temp(i-1)+dTemp;     % Store the new temperature

hold off
plot(timeActual,TempActual,'b.')  % Plot the actual temperature
hold on                           % Allows graphs to be overlayed
plot(t,Temp,'y-');                % Plot the calculated Temperature
axis ([0 tMax min(TempActual)*.95 max(TempActual)*1.05]);
xlabel('Time (Seconds)');
ylabel('Temperature (Centigrade)');
title('Hot Can Cooling Down');

When the cold can absorbs energy from the light bulb, it will gain energy at a constant value. The terms that would physically come into play would be
PGain = Pbulb * f(SolidAngle) * (1-α)
where Modify your program to allow you to put in a constant value for PGain and try to use this to model the temperature vs. time data for cold cans heating up (either use your own data set, or you can use the file coldcans.out ). You can probably use the same heat-loss coefficient as you did from the cooling can experiment.
Electronic Copy:
Revised: 10-JUL-97 by Tom Huber, Physics Department, Gustavus Adolphus College.