# Modeling Fridge Content Temperatures

## Introduction

In cold storage applications, continuously logging temperature data can help ensure the quality of refrigerated items. Due to their small size and long-lasting battery, one- or several Disruptive Technologies (DT) Wireless Temperature Sensors placed inside a fridge or freezer will provide high-resolution data for continuous monitoring and detection of anomalous events.
However, in applications where the fridge door is opened in rapid succession, the unit's ambient air temperature may not reflect that of the items stored there. While the air may see a quick rise, an item's thermal inertia will keep it chilled for quite some time. Therefore, if alarms are used to detect higher than wanted temperatures, alarm-fatigue is likely. One possible solution is to place the sensor in a proxy medium, such as water, to emulate the thermal inertia. However, this might be impractical and can be solved without the extra required hardware.
In this application note, a method for indirectly monitoring the temperatures of refrigerated items through heat-transfer modeling is explored. By actively measuring only the ambient fridge temperature, Newton's Law of Cooling is applied to provide an estimate of individual food items stored within, while requiring only a single initial condition parameter.

## Theory

Like other scientific fields, thermodynamics can be approached in a simplified manner if some approximations are made. Here, when regarding an item resting inside the fridge, thermal displacement is assumed to occur mainly through conduction with the shelf and convection to circulating air [1, 2]. This allows for the heat transfer coefficient to be regarded as a constant in each medium, reducing complexity. Also, differences in volume and surface area will, in reality, have an effect on the rate at which an item cools. However, this can be overlooked if one assumes that each storage quanta of a product is approximately equal.

### Newton's Law of Cooling

Considering the aforementioned approximations, the simple yet elegant Newton's Law of Cooling can be applied to model the heat transfer of an item in the fridge by only measuring the ambient temperature. Given by
$\frac{Q}{A} = -k(y-T_{\text{amb}}), \tag{1}$
where
$Q/A$
is the rate of heat transfer out of the body per unit area in
$W/m^2$
, or heat flux,
$k$
is a constant heat transfer coefficient,
$y$
the current estimated temperature, and
$T_{\text{amb}}$
the ambient, the law states that the temperature of a body changes at a rate proportional to the difference in temperature between the body and its surroundings [3]. When written as a transient response
$y = (y_0 - T_{\text{amb}})^{-kt} + T_{\text{amb}}, \tag{2}$
where
$y_0$
is the initial temperature, it can be seen that the change in temperature decreases exponentially as time progresses. If the environmental temperature
$T_{\text{amb}}$
is considered constant,
$k$
alone will affect the individual rate of change. Figure 2 shows a simulation for a synthetic fridge temperature for which the model is applied with several different values of
$k$
.
Figure 2: Simulations of Newton's Law of Cooling for several values of the heat transfer coefficient k , showing how the thermal inertia manifests itself as the ambient temperature quickly rises.

### Heat Transfer Coefficient

In thermodynamics, the heat transfer coefficient is defined as the proportionality constant between the heat flux and the driving force for heat flow [4]. Given by
$k = \frac{Q}{A\Delta T}, \tag{3}$
where
$Q/A$
is the same heat flux as in equation (1) and
$\Delta T$
the temperature difference between the medium and surrounding environment, it quantifies how well heat is conducted through a medium.
Though there are many mathematical approaches to finding
$k$
, by actually measuring the temperature change in a medium and fitting the model to it, an empirical solution can also be found. If it is assumed that the environment or medium does not change significantly over time, this can provide a relatively good approximation.

## Testing the Model

An experiment was performed to test the model in a real-world application. Six different items were tested using a consumer-grade refrigerator as the environment. A volume of water, yogurt, oatmeal, an apple, banana, and a slice of meat was inserted with Disruptive Technologies Wireless Temperature Sensors for reference. The ambient air temperature was measured using the Ambient Range Extender Accessory. Compared to attaching a sensor on the wall, it provides a better representation of the air temperature.
A change in temperature was forced by keeping the refrigerator door open. After cooling overnight to achieve equilibrium, the door was kept open for 1 hour to evaluate the heat transfer curves. Though this is probably longer and not representative of ordinary circumstances, it allows us to observe each item's thermal inertia for which the model is matched.
For exploratory purposes, the sensors in this test used a 30-second heartbeat. This did, however, prove to be much redundant. With its 5.5-minute heartbeat, the Wireless Temperature Sensor EN12830/330s would still collect multiple samples in the time it takes for refrigerated items to experience a change in temperature, making it suitable for this purpose.
Figure 3: Food items inserted with Disruptive Technologies Wireless Temperature Sensors to record a reference temperature towards which the model is evaluated.
When disregarding the API interfacing to download sensor data, the implementation is straightforward. When using a constant value for
$k$
, equation (1) can update the model in only a few lines of code. A pseudocode representation of the updating function is shown below.
def update_model(ambient_temperature, last_temperature, k):
# calculate dy/dt, the change in temperature
change_in_temperature = -k*(last_temperature - ambient_temperature)
# add to produce new model temperature value
new_temperature = last_temperature + change_in_temperature
The test results are shown in figure 4. For each subplot, the ambient fridge temperature, reference food-item temperature, and modeled temperature are shown. It is clear that the model quite accurately represents the thermal change in all of the tested items. As expected, the ambient temperature increases rapidly when the door is opened at 07:50. While the exact rate of change differs between the items, they all show the expected thermal inertia behavior, which is captured for both heating and cooling by the model.
Figure 4: The fridge ambient temperature, raw temperature data and modeled temperature for each food item in the test spanning a few hours. The fridge door is kept open for 1 hour to force a change in temperature.
The heat transfer coefficients used for the results presented in figure 4 are given in Table 1. These were found by mapping a model to the real data. Note that due to the approximations made in this experiment, these values should be verified or found anew when implemented.
 Medium ​$k$ [$W/(m^2 \cdot K)$] Water 0.010 Yogurt 0.015 Oatmeal 0.025 Apple 0.010 Banana 0.016 Meat 0.015
An interesting observation is the temperature offset, which can be seen in some of the graphs. The expectation is that an item would cool until an equilibrium with the ambient temperature was reached, which is also what the model assumes. However, looking at especially the meat- and water items, their equilibrium was found to be a degree or so above the ambient. This is almost certainly caused by the fridge not having a perfect homogeneous temperature environment. As the ambient is measured in a single spot, this non-uniformity may explain the effect. Commercial-grade fridges might prove better in this regard.

## Practical Application

Depending on the desired complexity, one might want to use a single general model for all items in a fridge. Fortunately, while the test shows that the model can accurately estimate each type of food, the thermal change difference between them is slight enough that an average heat transfer coefficient could be used for simplicity.
Figure 5 shows all item temperatures superimposed onto the ambient, both with- and without correcting for the temperature offset. With a few exceptions, for instance, with the oatmeal reaching a higher maximum, it can be seen that the curves overlap rather well. Therefore, if some error is acceptable, one could model a wide variety of fridge content with a single general model, reducing complexity significantly.
Figure 5: Each food item temperature data superimposed onto the fridge ambient temperature for comparison without any correction (left) and with correcting for the offset (right).