Computer Modelling and Simulation of a Smart Water Heater Maria Kathleen Ellul University of Malta ellul_maria@yahoo.com Adrian Muscat University of Malta adrian.muscat@um.edu.mt Abstract A computational model for a typical domestic water heater is developed. The model updates the simulated temperature of the mass of water periodically where the rate of change in temperature depends on the system inputs, outputs and losses. The water heater model is validated against measured data. A user model is added to simulate the times and type of hot-water usage. A simple basic prediction algorithm based on statistics and probabilities is then developed to check the viability of such a system. Hot-water usage is detected by processing the sampled temperature. The electrical energy consumed by the water heater over a period of time is calculated to demonstrate the usefulness of a smart water heater Index Terms Smart, Water Heater, Modelling, Simulation 1. Introduction The low-cost commonly available water heater is inherently a lossy device and this means that a good percentage of the energy consumed heating water ends up being lost as heat to the surroundings. Informal measurements and practice show that if a family of four persons switches on and off the water heater just when required savings of up to 80% are recorded. In reality some people switch the water heater permanently ‘ON’, others switch it ‘ON’ say 8 hours before it being used and switch it off after each use and yet others install a timer. All these techniques suffer either, increased energy consumption or flexibility, and may require the user to learn how to adjust the timer. In this paper the viability of a ‘smart’ water heater is studied, where the user simply installs the water heater and then the embedded computer determines when to switch on the heater or not. To investigate this problem a computational model for a typical domestic water heating and usage system is developed. The system consists of the water heater, the users and the prediction algorithm. The water heater model simulates the temperature variations over time. The users model determines when users make use of hot water and the prediction algorithm calculates the next time that hot water is in demand. 2. Water Heater Physics An electric water heater consists of (a) an inner steel tank, that holds the water being heated, (b) insulation that surrounds the tank so as to decrease the amount of heat lost to the surroundings, (c) dip tube to allow cold water to enter the tank , (d) pipe to allow hot water to leave the tank, (e) thermostat that reads and controls the temperature of the water inside the tank, (f) heating element that heats the water by means of electricity, (g) drain valve to drain water during maintenance periods, (h) a pressure relief valve for safety reasons, and (i) a sacrificial anode rod that decreases corrosion of the steel tank. Water temperature inside the heater is controlled by the mechanical thermostat. The temperature may usually be set by the user somewhere in between 49 and 70OC. The heater makes use of the convection heating principle to heat the water in the tank. Hot water is less dense than cold water. So, cold water moves to the bottom of the tank while the hot water rises to the top. The heat gained or lost by the water is given as in [1]: ∆Q = mc∆θ + losses where Q is the heat gained by the water in Joules (J), m is the mass of the water, c is the specific heat capacity of the water, 4200J/kgK, ∆Q is the change in temperature experienced by the object, and losses are the heat loss experienced through the insulation and supporting studs. Also, ∆Q = Phe ∆t Where Phe is electrical power, and t is the time taken for the water to gain an energy Q. For simplicity, it will be assumed that the energy loss is negligible next to the energy gained when the water is being heated. Therefore by substitution: Phe ∆t = mc∆θ Hence the relationship between a change in temperature and a change in energy is linear. Taking into consideration heat losses from the tank, the expected temperature vs time graph is approximately exponential . Although the water heater has good insulation, heat loss is inevitable since even so the insulator has a small value of heat conductivity. Newton’s Law of cooling states: “…the rate of loss of heat is proportional to the access temperature over the surroundings”, [1], p.636) As the heat inside the water heater decreases, the temperature difference between the temperature of the water inside the water heater and the temperature of the surrounding air (ambient temperature) decreases and hence gives an exponential decreasing graph when considering temperature of the water inside the tank vs. time. Therefore considering all the facts discussed above on water heaters, the expected pattern of the temperature inside the water heater is expected to be ‘ fig.1: T were carried out on a typical 80ltr home water heater that is available from hardware stores. Two K-type thermocouples were attached in parallel to the EL–USB–TC Thermocouple Data Logger. Thermocouples in parallel give an average reading of the temperatures read at each different thermocouple [3, 4]. Since the temperature inside the water heater differs depending on the level of the water, each thermocouple was placed in two separate levels touching the water heater tank directly so as to read and store the average temperature values of the water inside the tank. One thermocouple was placed behind and held by the temperature indicator which is at the top section of the water heater while the other was placed in the lower part of the water heater next to the heating element’s terminals. The data logger was set to store readings every ten seconds. Every data set stored a total of approximately three and a half days. The results taken over a period of a few months were then studied. T T Electrical Energy in Heating Element Thermostat T Water t Fig. 1 Temperature vs. Time graph for heating and cooling water Furthermore the thermostat controls the power input such that the water temperature oscillates between a minimum and maximum temperatures defined by the thermostat settings as well as the hysteresis characteristics of the thermostat. 3. The Water Heater Model The water heater model consists of updating the water temperature by (a) energy input from the heater (b) heat loss through insulation (c) heat loss due to exchange of hot water with cold water. The losses and gains incurred and the rate of change have a big impact on the performance of the water heater and therefore a measurements of temperatures of the water inside the water heater Water Temperature out Cold in Hot out Fig. 2: The water heater model Fig.4 shows a block diagram of the water heater model. The model is designed such that the electrical energy input, the cold water in and the hot water out cause a change in the temperature. The water temperature is also a model output that will be used by the usage detection algorithm and the prediction algorithm. The thermostat action was preserved so as to act as an upper limit constraint for the water temperature. Five different events that cause a change in temperature were considered: (1), Heating the water inside the water heater, (2) Natural cooling of the water inside the water heater, (3) Cool water usage, (4) Warm water usage, and (5) Hot water usage. The heating and natural cooling of the water inside an 80ltr hot water heater was calculated by studying the results taken from the data logger when the hot water heater was switched off for approximately 8 hours and switched on again without hot water being used. The result was then plotted using Microsoft Excel and best fitting equations were found through a best curve fit. The best fit equation for heating is given below and in fig.3. Tnow = Tmax + 2 – (Tmax – T + 2)e-0.002n It may be seen that the natural cooling could be taken to be a linear function since it takes a very long time to cool to ambient temperature were the exponential curve would be seen. Tnow = 0.0032n + T heating process which is also seen to increase exponentially as seen previously. Therefore this process was divided into two as seen below. The exponential decay results from an overall averaging out of the temperature inside the water heater. This is because the cold water that would have just entered the water heater continues to cool down the overall temperature through heat convection and heat conduction. Additionally the straight line graph was calculated from the beginning of the exponential series found so as to ensure continuation. For all the following equations: Tnow = current temperature, Tmax = maximum allowable temperature, n = a time step of 10 seconds and T = starting temperature. The slow hot water flow: Tnow = -0.026n + T Tnow = 3.5e-0.008n + T – 3.5 60 T e m p e r a tu r e (D e g C ) 50 40 Series1 30 Series2 20 10 0 1 99 197 295 393 491 589 687 785 883 981 1079 1177 1275 1373 Time Step Figure 3 Heating graph: Data logger reading superimposed with equation from curve fitting; Cool, warm and hot water usages are based on three different hot water flows. These all force the temperature inside the tank to decrease drastically, but at different rates. The equations used in the simulation for the three different hot water flows were found by filling a 15 litre container with hot water using 3 different flows from the same outlet point. The time taken to fill the 15 litre container was recorded and the effect of the water flow on the temperature of the water inside the water heater was stored in the temperature data logger. The results were then studied and mathematical equations were formed using Microsoft Excel through best curve fitting. Through the studies of the three graphs resulting from the three flows, it could be seen that while the water flows, there is an approximate straight line graph, but once the flow stops, the graph decays exponentially and then starts the The medium hot water flow: Tnow = -0.029n + T Tnow = 1.75e-0.019n + T – 1.75 The high hot water flow: Tnow = -0.065n + T Tnow = 3e-0.02n + T – 3 The seasonal ambient temperature of the water going into the tank was not considered. This affects the results for forced cooling when winter and summer incoming cold water temperatures are taken into account. The tests were made on a single indoor 80ltr water heater used by a family of three people in Malta. The results found will change according to the insulation of different types of water heaters, their size and where they are installed i.e. outdoor or indoor and if it is installed in a cold or warm country. Three different hot water flows were taken into account. In reality more different types of water flows exist depending on how hot the user likes his or her bath or shower. The water flows were only tested in a shower that is always used by the owners of the tested water heater. Changing the place of hot water usage in the same home or using a different type of shower head may affect the flow of the water hence the hot water may cool down faster or slower. different times and may also turn off the water during different times of their washing experience. 53.6 T e m p e ra tu re (D e g C ) 53.4 53.2 Series1 53 Series2 52.8 52.6 52.4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Time Step Figure 4: Medium hot water flow graph 1 4. Model Validation 54 53.5 T e m p e r a tu r e (D e g C ) The results of the forced cooling were taken at different times and on different days. This may result on the input water temperatures being different and hence resulting in an error as my simulation is only based on these results. This was also tested at only one basic internal temperature and not at different inside temperatures. If the water heater temperature was raised or lowered, this may result in different readings with different overall equations. 53 52.5 Series1 52 Series2 The water heater model was validated against the measured data. Fig.8. shows the steady state temperature for the case of a thermostat controlled heater. Temperature (Deg C) 51.5 51 50.5 1 19 37 55 73 91 109 127 145 163 181 199 217 235 253 271 289 307 Time Step Figure 5 Medium hot water flow graph 2: Reading from data logger superimposed with equation from curve fitting The testing was also done in a shower one floor directly below the water heater. If the testing was done in the upstairs bathroom adjacent to the water heater, the water pressure for the hot water would have been less, since height is a factor of pressure, and hence the hot water flow would have been less. The heating element may not have the same properties as another heating element inside a different water heater. The heat lost from the pipes leading to the shower was not taken into account. The temperature data logger used to measure and record the temperature inside the heater is accurate to ± 0.5 degC. It was also not inserted directly inside the water heater but touched the tank in two separate places to take an average of the temperature inside the tank. This would have been more accurate if the temperature was taken directly from inside the water tank. A usage of hot water was considered for an average of between 1 and 10 minutes with water always running. This is not true as people take Tim e Figure 6 Heating and Natural Cooling Graph. Measured data can be superimposed on this. From the above graph, it can be seen that the temperature is kept between a minimum and maximum temperature which is taken from the average temperature set by the thermostat. The heating part is exponential while the natural cooling part is linear. This graph is a close match to measured data. The behaviour of the model during usage was also tested. The descent gradients in the graphs are steeper than that of the natural cooling. That is as expected and this feature is used to locate usage in time. The model was then tested to see how it would react when a number of usages run one after the other. A graph of one single run is seen in fig.9. The usages are circled in red. This test was done a number of times with different combinations to make sure all different combinations give good results. The results obtained matched the measured data. T e m p e r a tu r e (d e g C ) 70 60 50 40 30 20 10 0 6:00:00 a one is seen in the hot water usage tables more than once then there is a good probability that there will be a usage at that time and a usage is predicted. The predicted table would then be used to determine when the water should be heated or not depending on the series of ones and zeros. Series1 0 0 :0 0 :1 0 0 1 :2 3 :0 0 0 2 :4 5 :5 0 0 4 :0 8 :4 0 0 5 :3 1 :3 0 0 6 :5 4 :2 0 0 8 :1 7 :1 0 0 9 :4 0 :0 0 1 1 :0 2 :5 0 1 2 :2 5 :4 0 1 3 :4 8 :3 0 1 5 :1 1 :2 0 1 6 :3 4 :1 0 1 7 :5 7 :0 0 1 9 :1 9 :5 0 2 0 :4 2 :4 0 2 2 :0 5 :3 0 2 3 :2 8 :2 0 0 0 :5 1 :1 0 0 2 :1 4 :0 0 Separate tables were used for different days. A time window of 4 weeks is used when calculating the probability of occurrence. Time Figure 98 Three usages of hot water in series 5. Users’ Model The users’ model is required to generate instances of hot water uses in any one of the three intensities described in section 3.0. Informal research showed that many people follow patterns throughout the day and this includes hot water usage for example when taking showers. For example for most people interviewed hot water usage is predictable during weekdays, however during weekends hot water usage occurs at random time and is less deterministic. The users were therefore modelled by adding to the event calendar the usages at the appropriate times. A pseudo code of how this table method was implemented is given in [5]. The hot water usage detection was tested by observing that the ones and zeros in the output vector correlate to the time domain temperature plot. The operation of the basic time series prediction algorithm was observed to verify that it operated as expected. A weekday graph followed by a weekend graph with random usage times may be seen below. On weekdays, hot water usage is consistent and deterministic, therefore the adding of the ‘ON’ and ‘OFF’ events work perfectly. This may be seen in the weekday graph where the water is heated to the right temperature just before someone uses the hot water and then the water was allowed to cool after the usage when no water was going to be used within the next two hours. 6. Prediction Method The table method involves storing temperatures of the hot water heater throughout the day at equal intervals. The temperatures are then studied and another table is derived, by gradient comparisons, to show when there is hot water usage. A hot water usage is indicated by a one and a zero indicates that no hot water is being used. The hot water usage table is stored and compared to other hot water usage tables to find a pattern of hot water usage. If, for example, at T e m p e r a tu r e (d e g C ) 70 60 50 40 30 20 10 0 Series1 0 0 :0 0 :0 0 0 1 :1 3 :0 0 0 2 :2 6 :0 0 0 3 :3 9 :0 0 0 4 :5 2 :0 0 0 6 :0 5 :0 0 0 7 :1 8 :0 0 0 8 :3 1 :0 0 0 9 :4 4 :0 0 1 0 :5 7 :0 0 1 2 :1 0 :0 0 1 3 :2 3 :0 0 1 4 :3 6 :0 0 1 5 :4 9 :0 0 1 7 :0 2 :0 0 1 8 :1 5 :0 0 1 9 :2 8 :0 0 2 0 :4 1 :0 0 2 1 :5 4 :0 0 2 3 :0 7 :0 0 The smart water heater is required to learn the times when hot water is demanded. In doing so the heater can be automatically switched on say 1 or 2 hours before the time of demand. In this way the minimum required electrical energy is consumed. In this paper a simple algorithm based on statistics is used to demonstrate the feasibility of the smart water heater. This time series prediction algorithm is termed the table method in this paper. Time Figure 9 Weekday hot water usage including prediction T e m p e r a tu r e (d e g C ) 70 60 50 40 30 20 10 0 Series1 are given in [5].The system is simulated as a discrete event system in the event view as defined in [5]. The event calendar is initialised with a first event to start heating the water in the hot water heater and seven days of daily hot water usages. 0 0 :0 0 :0 0 0 1 :1 3 :0 0 0 2 :2 6 :0 0 0 3 :3 9 :0 0 0 4 :5 2 :0 0 0 6 :0 5 :0 0 0 7 :1 8 :0 0 0 8 :3 1 :0 0 0 9 :4 4 :0 0 1 0 :5 7 :0 0 1 2 :1 0 :0 0 1 3 :2 3 :0 0 1 4 :3 6 :0 0 1 5 :4 9 :0 0 1 7 :0 2 :0 0 1 8 :1 5 :0 0 1 9 :2 8 :0 0 2 0 :4 1 :0 0 2 1 :5 4 :0 0 2 3 :0 7 :0 0 9. Conclusions Time Figure 10 Weekend hot water usage including prediction On the other hand, since the weekends are inconsistent the results are not that good. Firstly it seems that a usage was predicted in the early hours of the morning as the water was heated. This area is circled in black. The actual next usages are seen circled in white. In this case there was hot water there for these usages. There is another usage circled in red that was not predicted and in this case the water was not warm as it should have been if it was predicted. Nonetheless the simple prediction algorithm is still useful in determines the viability of a ‘smart’ water heater. Better algorithms can improve the ‘smartness’ 7. Energy Saving Calculations The energy consumed by the water heater over a period of time is calculated by integrating the power supplied to the heater over time. Simulations show that for the case of a family of three people one can save about 2 hours of electricity input daily (3 kWhr units) with the table method compared to the case of manually switching the heater on and off when required. The above was calculated for a weekday and not a weekend. This is because the weekend does not yield significant savings because of the irregular times of hot water usage. When compared to the case of using a timer the energy consumed is approximately the same with the added luxury of the ‘smart’ feature. 8. Software Development The design of the Smart Water Heater was developed using the JAVA language in the Eclipse Platform Version 3.3.0. Details on this software In this paper a water heater model was developed and validated with measured data. To this model a users’ model and a prediction algorithm were added so as to carry out a feasibility study of the concept of a smart water heater. The simulation results show that with the use of a simple prediction algorithm and one temperature sensor the energy savings are comparable to that of using a timer, with the added convenience of not having to reset the timer due to weekly and seasonal changes. Nevertheless there is ample space to improve on the prediction method used resulting in more savings. The prediction algorithm should strive to supply the right amount of hot water at the right time and in the right quantity. More studies can therefore be carried out in this respect. For example the learning algorithm can also vary the maximum temperature set resulting in higher savings and studies that consider various usage patterns can be included, to be able to determine the benefits for different lifestyles and conditions. Another feature that may be desired is a dissatisfaction input through which the water heater will learn that it either missed a usage event or the water was not heated to the required temperature. [1] Eastop and McConkey, Applied Thermodynamics for Engineering Technologists, 5th Edition, 1993 (Pearson Education Ltd., Harlow) [2] Nelkon and Parker, Advanced Level Physics, 7th Edition, 1997 (Heinemann, Oxford) [3] Retrieved on 15th October 2007 from http://rabi.phys.virginia.edu/HTW/supplements/the rmometers_and_thermostats.pdf [4] Retrieved on 17th November 2007 from http://www.allaboutcircuits.com/vol_1/chpt_9/5.ht ml [5] Design of a Plug ‘n Play Smart Water Heater, Maria Kathleen Ellul, University of Malta, 2008