An Energy Balance Model for a Small Educational Thermal Device

This paper presents a small thermal device that has been developed for collegelevel teaching purposes. The developed device is equipped with one heater and one fan. An energy balance model is used to model the device and the parameters are calculated accordingly, such as heat capacity, emissivity and heat transfer coefficient. Additionally, we also quantify how the speed of the fan affects the heat transfer coefficient by using optimization methods to identify all the unknown parameters of the model. The results show that an energy balance model, which includes convection and radiation, can fit the dynamics of the device very well with a maximum absolute error of about 9oC. However, during the validation process, the derived model gives a larger maximum absolute error of about 16oC, which happens at high temperatures. As for the fan, we find that the speed of fan and the resulting heat transfer coefficient are likely to be linearly related.


INTRODUCTION
Hands-on experiences have been considered as important for teachings university-level engineering students (Moosvi et al., 2019). In university-level educations, students in general are expected not only to understand but also to further apply, analyze and evaluate the knowledge that they have acquired from classrooms (Adams, 2015). To address these issues, many engineering programs at universities offer more simplified practical activities compared to traditional laboratory activities. Unlike traditional laboratory activities, these activities are typically performed in very small groups, if possible, individually. The devices are designed to be simple and inexpensive to allow students to buy or even to build the devices by themselves. In addition, students can bring the devices home and spend more time to perform experiments independently (Durfee et al., 2004) (Jouaneh & Palm, 2010).
Such concept is called take-home laboratory and it has been reported to give positive impacts to the overall learning processes by elaborating theory and practice in more effective ways. As the results, students will be able to intuitively connect a symbolic content to a real content, and an analytic process to a synthetic process. This is called epistemic fluency (McLaughlan & Lodge, 2019) (Zhu et al., 2019), which is very important in engineering education. In contrast, in traditional laboratory activities, it has been reported that very often student perform the experiment by simply following prepared instructions without involving significant amount of thinking phase in the process (Sokoloff & Thornton, 1997).
In control and dynamics course which is taught in electrical, mechanical, or chemical engineering, several devices have been proposed for take-home laboratory activites. Some of them are known to use a thermal system as their topics (Barbosa, 2020) (Cui et al., 2020) (Park et al., 2020) (Tran et al., 2019). The reason for selecting a thermal process is because it is relatively easy to create a device that is capable of generating heat. A resistor with flowing current is sufficient to generate heat. By adjusting the amount of current that flows in the resistor, the heat can be controlled in an almost linear fashion. Also, a thermal process is known to be a slow process. Instant heat is only possible if high amount of power is available which clearly cannot be provided by an off-the-shelf 12-Volt power supply. Thus, in such a configuration, a low-cost microcontroller-based device is sufficient to be used as its control hardware. This microcontroller is connected to a computer where the control algorithms are then implemented in few cycles per second. The algorithms can be implemented with several tools, such as C/C++, Python, and also MATLAB Simulink (MathWorks Inc., USA) .
In this research paper, we have developed our own hardware implementation of similar thermal device. The thermal device originally has two heaters and two temperature sensors. However, we remove one of the heaters and replace them with a small fan (see Fig. 1). Details on the devices that we have developed are described in Section II. In term of design of the device, this is one of the contributions that we offer from this research paper. The device that we design has flexible purposes.
For a thermal device, typically, the tasks given to the students are started with mathematical modeling of the device. The model that is used is generally a simple mathematical model, such as a first or a second order model. With the device that we have developed, we would like to bring its application further by performing more advance physical based modeling rather than the usual first or second order model. Thus, we select energy balance model (Knuiman et al., 2012) (Roques et al., 2014) and perform parameter identifications to fit the model of the developed device. Energy balance model is a topic that is discussed in thermodynamics course in mechanical and chemical engineering. Nevertheless, the topic is still relevant to electrical engineering students since the final model is analogous to a resistor-capacitor (RC) circuit. In fact, in the work by Park et al. (Park et al., 2020), they have already successfully demonstrated implementation of an energy balance model into a multiple-input-multiple-output (MIMO) thermal system with two heaters. We would like to implement the similar approach but with different system: a multiple-input-signle-output (MISO) system with one fan and one heater. Although in principal the general form of the model is still similar, how it is applied and how the parameters are identified are different.

DEVICE DESIGN
The device that we developed is built as a single board stacked on top of the Arduino Uno (Arduino AG, Italy). The heater itself is made of a power resistor (27Ω / 5 W) driven by a logic-level switching transistor (MOSFET IRLB 3034). As for the fan, we use a small fan that is commonly used for Raspberry Pi. The fan is also driven by the same type of a logic level transistor. Both transistors are connected to the pulse-wide-modulation (PWM) pins of the Arduino Uno (PWM pin number 9 and 10). The heater and the fan are powered by an additional power source (12 V / 2A). As for the Arduino Uno, it is powered directly by the control computer through a Universal Serial Bus (USB) port. The schematic of the developed device can be seen in Figure 1 and the assembled device can be seen in Figure 2. The dimension of the device is about 8 cm × 8 cm × 6 cm (length × width × height). Technical resources on the device have been made publicly available in (Manurung, 2020). As for the temperature sensor, we use a low-cost analog temperature sensor (LM 35). The temperature sensor is connected to the analog input channel number 0 of the Arduino Uno. The temperature sensor is not calibrated and we use the conversion number provided by the manufacturer. Considering its low price, LM 35 has very good repeatably, which is below 1 ºC and it can measure up to 150 ºC. Further, we will not model the thermal response of the temperature sensor exclusively. Its thermal response will be lumped together with the model of the overall system. The device is connected to a control computer running MATLAB Simulink software. The Arduino Uno works as an input-output unit only. All data acquisition and control processes are executed in real-time mode by the control computer with 10-Hz of sampling frequency. The jitters in the real-time control loop is less than one percent.
During the development phase, the device is designed to be as linear as possible at steadystate condition. We do this by making sure that heat is only dissipated in the power resistor. The transistor that has been selected does not dissipate heat even though it is used to drive large amount of current to the power resistor or to the fan.

PHYSICAL MODELING
In this section, we explain the strategy that we take to model the device. We start by establishing the equation for the physical model. Afterwards, we continue with identification of the unknown parameters by performing optimization processes to find the values of the unknown parameters.

Energy Balance Model
In general, the energy balance equation can be stated as follows.

Heat In = Heat Out + Heat Stored
(1) where the Heat In term represents the heat generated by the current that flows in the power resistor and can be expressed as follows.

=
( 2) where is the power delivered to the power resistor (in Watt), is the voltage across the power resistor (in Volt) and is its resistance value (27 Ω). The applied PWM signal from the Arduino Uno modifies the voltage across the power resistor from 0% to 100% of max . Thus, in Equation (1) can be written as follows.
where α is the applied PWM (0% to 100%) and max is the maximum voltage that can be supplied by the power supply. Afterwards, substituting Equation (3) to Equation (2) gives us the equation as follows.
Heat In = = β max However, since there is no calibration performed to find the relation between the actual PWM signal and the actual voltage across the power resistor, we cannot guarantee the correctness of the relationship between the dissipated power and the amount of generated heat. Thus, we need to introduce a new term β which acts as a correcting factor. It also describes the efficiency of the power resistor in turning current into heat. Here, we assume the relation between the PWM signal and the generated heat is linear.
Now that we have addressed the Heat In term in Equation 1, we then continue by addressing the next term: Heat Out. The Heat Out term represents the heat that is dissipated by the power resistor to its surroundings due to conduction, convection and radiation. Although mathematical model of conduction is more complicated than of convection and radiation, as it involves partial differential equation (PDE) in its model, the solution is actually simple when modeled as a first order PDE, which is an introduction of transport delay in the readings of the temperature sensor (see Figure 3) (Hamze et al., 2018). However, in this paper, we decided not to include conduction for clarity and simplicity.
In the convection equation, ℎ and ℎ are the heat transfer rate for normal convection and for convection rate due to the running fan, respectively. Their units are /( ). As for γ, it represents current speed of the fan (from 0 to 1, unit-less). When γ = 0, the fan is off. When γ = 1, the fan is running at its maximum speed. represents the area of the power transistor ( = 0.0008 , measured with ruler). The justification for the proposed convection equation is that there must be a base value for heat transfer rate (ℎ ). This base value changes linearly depending on the speed of the fan, thus the term γ times ℎ is introduced.
Further to the right part of Equation 5, in the radiation equation, represents emissivity (from 0 to 1, unit-less) and σ it the Stefan Boltzmann constant (5.67 × 10 /( )). For both the convection and the radiation equations, and represent the current room temperature and the temperature of the power resistor, respectively. Their units are Kelvins ( ). However, in this paper, we will consistently present all temperature data in degrees of Celsius (°C).
Finally, as for the last term: Heat Stored, it can be expressed as the following differential equation.
Heat Stored = where is the mass of the power resistor ( = 0.005 , measured with scale) and is the heat capacity of the power resistor (in /( )). As the result, Equation 1 can be expressed as follows. max = (ℎ + ℎ ) ( − ) + ( − ) + (7) 3.2 Parameter Identification From Equation 7, we provide a list of known and unknown parameters in Table 1. The known parameters are either because they are constants or because they are classified as inputs and outputs. The inputs here are α and γ, while the output is . The system itself is a multiple MISO system. The next task is to find the values of the unknown parameters by using optimization processes.

Unknown Parameters Known Parameters
Since there is at least one unknown parameter in every term of the equation, initial guesses for the unknown parameters may become crucial. Selecting different initial guesses may lead to different parameters as the results. To increase the accuracy of the optimization process, we start by neglecting all parameters related to the fan from Equation 7, which are γ and ℎ . Thus, instead of having a MISO system, we now have a SISO system. After acquiring the optimized values of the remaining parameters, we repeat the optimization process once more. This time, we include all the unknown parameters. The parameter values that we have already acquired from the first optimization process are reused as initial guesses for the second optimization process. The optimization is performed by using MATLAB built-in fminsearch command, which is based on Nelder-Mead simplex method (Lagarias et al., 1998), to minimize the root mean square (RMS) error between the model and the actual system. Prior to the optimization process, data sets need to be prepared. The device is stimulated with pulse signals of random amplitudes. The two inputs and the output response are then recorded. For the first stage optimization process, only PWM signal which heats the power resistor is stimulated (see Figure 4a). For the second stage optimization process, PWM signal which heats the power resistor and PWM signal which controls the fan are both stimulated (see Figure 4b).
The optimized parameters are presented in Table 2. The maximum absolute error during the first stage optimization process is less than 7 ºC (see Figure 5 left). As for the second stage, the maximum absolute error becomes less than 9 ºC (see Figure 5 right).

MODEL VALIDATION
After the model has been successfully derived, we then validate the model by using different data sets from the ones used for parameter identification. Therefore, we repeat the experiment of stimulating both inputs of the system while recording the generated output at the same time. The similar stimulus signals are also sent to the two inputs of the model and then its simulated output is recorded as well. Afterwards, we compare the simulated output and the actual output by calculating the absolute errors at all data point. The results from the validation process is presented in Figure 7. The maximum absolute error is found to be less than 16 ºC. This maximum absolute error is larger than the those obtained from the previous optimization processes. However, we can see that from all data sets, larger error almost certainly occurs at temperature higher than 100 ºC. The most probable cause for this behaviour is that the nonlinearity in the temperature response increases at higher temperature value. This nonlinearity may also come from the fan that is used. As there is no speed sensor in the fan, we can not generate the map between the applied PWM signal to the fan and its resulting speed.

CONCLUSIONS
In this research paper, we first briefly discuss the educational thermal device that we have developed. Afterwards, we propose a data-driven method to physically model the developed device. The steps for performing physical modeling that we propose is straightforward and empirical. The main principle is to relax the constrains by first reducing the number of the unknown parameters and then continue by gradually increasing the numbers of the unknown parameters. Our aim here is to achieve good estimates by providing better initial guesses. In general, the proposed method can be applied into a system with more than two stages. However, for the system that we have developed, we can only apply the optimization in two stages: first stage as a SISO system and the second stage as a MISO system. In the model that we propose, the nonlinear term of the system is contributed by the radiation process only, which is insignificant when compared to other terms. In reality, this is not true since from observation we notice that the device nonlinearities can be signifcant at certain conditions. More complex modeling by including as many as possible the device nonlinearities, such as process time delay, will increase the accuracy of the model. By visual observation only, there is about 10 seconds of noticeable delay in the the temperature response due to the conduction that occurs between the power resistor and the temperature sensor. Time delay is crucial to be included in the model if we plan to control the system since time delay can contribute to system instability. In the device that we have developed, we predict time delays occur only in the PWM input to the power resistor. PWM input to the fan should not experience any delay because the fan contributes to convection term only. It is also necessary to consider that components that we use in the device are left uncalibrated. The individual behaviour of each component has not yet been investigated. For example, we assume that the PWM signals sent to the fan is linearly related to the speed of the fan. Similarly, we assume that the PWM signals sent to the power resistor is linearly related to the changes in the temperature as well. However, we have not yet proven those assumptions. These issues will also need to be addressed in the future. Nevertheless, regardless its limitations, the device is still an excellent tool for teaching various engineering courses.