One of the biggest challenges when learning a new programming language or technique is finding realistic problems to solve, so one can be confident that (s)he is learning something that will prove to be valuable. To help with that problem, I’ll provide a detailed tutorial teaching the reader to create a performance map predicting the coefficient of performance of the heat pump in heat pump water heaters . This is a task that’s often used in in the building energy simulation world to predict the amount of energy, and annual operation cost, of a building. Following the tutorial presented in this series of posts will allow the user to:
Learn the art of writing computer programs to automate laboratory data analysis,
Obtain a more in-depth understanding of previously mentioned packages commonly used in scientific data analysis, and
Understand how these skills can be used in a scientific research career.
Wait, what will we be learning to do?
This tutorial process will walk the user through the process of creating a performance map predicting the coefficient of performance of the heat pump in heat pump water heaters. There are four concepts that must be understood for this to make sense:
What is a heat pump?
A heat pump is a heating and cooling device that essentially uses a refrigerant and a pump to shift heat from one fluid to another. It operates on one fundamental principle: Pressurized refrigerants get very hot, while unpressurized refrigerants get very cold. The heat pump then operates with four stages, as shown in Figure 1 and described in the following bullet points.
The fluid enters the compressor (I.e. pump) in a cold, gaseous state.
The compressor pumps the gas, causing it to reach a much higher pressure and temperature as it approaches the condenser. To allow the heat pump to function, this temperature is higher than the temperature surrounding the condenser.
The fluid passes through a heat exchanger called a condenser, releasing heat to the surrounding environment. This cools the fluid, though not dramatically.
The hot fluid then passes through an expansion valve, returning it to a much lower pressure and temperature. To allow the heat pump to function, the temperature is colder the ambient temperature surrounding the evaporator.
The lower temperature fluid passes through another heat exchanger, called an evaporator. Since the fluid entering the evaporator is colder than the surrounding fluid, heat transfers from the surroundings to the refrigerant. As heat enters the refrigerant, it boils and converts back to a gas.
The gas then enters the compressor in a cold, gaseous state and the cycle begins anew.
Through this process, a heat pump essentially transfers heat from the cold fluid surrounding the evaporator to the hot fluid surrounding the condenser. One example of this is an air conditioner used to cool a home. The evaporator is placed inside the home, and the condenser is placed outside. The cold liquid takes heat from the ~75 °F air in the home. The compressor then pressurizes the gas, causing a higher temperature. The temperature is then so high that the hot gas rejects heat to the much higher air temperature outside the home. The expansion valve then allows the hot gas to expand, and turn into a cold liquid. At which point it re-enters the evaporator to restart the cycle.
What is a Coefficient of Performance?
Heat pumps caused a problem for our traditional understanding of efficiency. This is because they’re a very different technology from what had been used in the past. Traditional heat transfer focused on converting energy from one form to another. For example, burning natural gas to convert chemical energy to thermal energy. Or dropping an object, converting potential energy (Altitude) to kinetic energy (Motion). For any of these examples the maximum efficiency is 100%, because it’s impossible to get more energy out of a system than was present to begin with. You can’t burn gas containing 100 kBtu of thermal energy, and end up with 200 kBtu of heat for instance.
Heat pumps caused a problem due to the very nature of how they function. Electricity is input into the system to power a pump, which compresses the fluid. Thus the traditional definition of efficiency would be calculated using the motion of the fluid and the electrical input. However, in the case of heat pumps, what people really care about is the amount of heat transferred relative to the electrical input. And since no energy is input for the heat transfer directly, it’s entirely possible for the amount of heat moved from one place to the other to exceed the electricity input to the pump.
To overcome this challenge, engineers and scientists created a new term, the Coefficient of Performance (Often abbreviated as “COP”). The COP of a heat pump identifies the amount of heat transfer obtained per unit of electricity input into the pump. It typically exceeds 100%.
What is a Performance Map?
A performance map is a technical term for an equation that states how a value changes as the inputs that drive it change. One example could be how the amount of energy used to heat a house changes with the outdoor air temperature, and the indoor air temperature setpoint. A performance map would be an equation that returns the energy used to heat the building for known indoor and outdoor air temperatures.
Performance maps are important when describing heat pumps because the heat transfer at the condenser and evaporator are both uncontrolled. The heat transfer between the fluid and surrounding air is dependent on the temperature difference. Lower temperatures around the condenser, and higher temperatures around the evaporator lead to higher performance. Since these temperatures are uncontrolled, it’s important to understand how the COP of the heat pump will change as those temperatures change. Then the performance of the heat pump can be predicted, and people can make intelligent choices about what heat pumps to use.
What is a Heat Pump Water Heater?
A heat pump water heater is a type of water heater that uses a heat pump to heat the water. It does this by transferring heat from the surrounding air, to the water held in a storage tank (Typically 50 - 80 gallons). The most common form of heat pump water heater is the configuration called “Integrated” heat pump water heaters. In this case, the condenser is located in the hot water storage tank and the evaporator is located in the surrounding air. This is shown conceptually in Figure 2.
Due to the locations of the condenser and the evaporator, the COP of a heat pump water heater will increase as the temperature of the water in the tank decreases and the temperature of the air surrounding the evaporator increases. Since predicting the performance of heat pump water heaters is an important part of building energy simulation, performance maps predicting the COP as a function of these two temperatures are vital.
What We Will Cover
This tutorial will walk students through the process of using previously recorded laboratory data to create a performance map for a heat pump water heater. We will walk through each step of the process of writing a program that can perform all of these calculations automatically, thus avoiding the tedium of performing all of the calculations manually. Topics covered will include:
Splitting individual tests out of a single data file so they can each be analyzed individually,
Analyzing the data from each test, including filtering out unnecessary data, performing calculations, and plotting the results of each test,
Both automatically and manually identifying erroneous tests, and replacing them with better data,
Storing test results in a central table for later analysis,
Using those stored results to create the desired regression (In this case, the performance map of the COP of the heat pump water heater),
Validating and visualizing the regression, and
Documenting the validity, strengths, and weaknesses of the final regression.
Tutorials walking you through each of these steps will be provided for free on the blog. This will include detailed discussions of the topics, and actual code that can be used to write the desired program. When the process is complete, you should have a program capable of automatically analyzing data.
To make this process more valuable, I will create a data set and answer sheet for the process. The data set will provide sample data similar to what you should expect would come from a laboratory to be used for this process. The answer sheet will consist of the results, and plots generated when running the script, allowing you to check your answers and ensure that your code is working correctly. For those who want to make the most of this guide, those resources will be available in the 1000x Faster store.
This tutorial will assume that the user has Python 2.7, their IDE of choice, and an understanding of the basic syntax and structure of the language.
 This sentence included several technical terms, and may be confusing to many. Don’t worry, I’ll be explaining them shortly.