The Automatic Performance Map Creation Tutorial
You can learn to automatically analyze laboratory data in a real world scenario

Many people seeking to learn how to program in Python request practical examples, where they can learn Python through solving real world problems. It gives more context and more meaning to the process.
Look no further. This is the first post in a tutorial doing exactly that. This tutorial will teach you Python programming, giving the exact code, Data Science concepts such as multiple regression, how to automate the entire process, and do so by solving a common engineering problem.
The engineering problem that we will be solving is creating a performance map predicting the performance of heat pump water heaters as a function of the surrounding conditions. If the technical terms in that sentence don’t mean anything to you, don’t worry. The next few sections will answer your questions.
This tutorial will teach you several important concepts, such as:
- The definition of "performance map" and "heat pump water heater",
- How to write Python code that automates scientific data analysis,
- How to split data files, automatically analyze tests, check those results for errors, and validate and document a simple simulation model, and
- Multiple regression.
But first thing’s first. Let’s make sure that you understand the terms above, as they’re key to following the tutorial.
What is a heat pump?
A heat pump is essentially a device that transfers heat between two locations. The definition on Wikipedia says "A heat pump is a device that transfers heat Energy from a source of heat to what is called a heat sink." One example of heat pumps is the residential air conditioner that is common in American houses. These devices transfer heat from the source of heat, in this case the interior of the building, to the heat sink, the exterior of the building.
"A heat pump is a device that transfers heat energy from a source of heat to what is called a heat sink." – Wikipedia
But how does a heat pump do that? How does it transfer heat from a cold space to a hot one? Through the "magic" of thermodynamics. Figure 1 provides a schematic showing the general functioning of a heat pump.

A refrigerant passes through all of the devices listed in Figure 1, in the direction of the arrows. Refrigerants are heat transfer fluids that are designed to increase/decrease in temperature under specific conditions, and are extremely useful in heat pumps.
The four devices shown in Figure 1 all put the refrigerant through different processes, driving the heat pump. As it passes through the system, the refrigerant experiences the following:
- Compressor: The compressor is basically a pump. The refrigerant enters the compressor as a gas, where it is pumped to higher pressure. As it’s pumped to higher pressure, the refrigerant gets hot leading to a very high temperature gas being passed to the condenser.
- Condenser: The condenser is a heat exchanger connecting the refrigerant to the heat sink. Since the refrigerant is very high temperature at this point, it loses heat to the heat sink cooling off. In the case of our air conditioner example, the heat sink is the outside air (Yes, the refrigerant is hotter than the hot air!). The refrigerant condenses as it passes through the condenser, yielding to a high pressure, moderate temperature liquid.
- Expansion Valve: The expansion valve is a valve that directs the refrigerant into a lower pressure environment and condition on the other side, allowing the refrigerant to expand. As it expands it cools further. This yields a low temperature fluid as it’s passed to the evaporator.
- Evaporator: The evaporator is another heat exchanger, this time connected to the heat source. In the case of the air conditioner example, this is the low temperature conditions inside the house. Since the fluid is so cold it draws heat from the house, increasing the temperature of the refrigerant. As it warms up the refrigerant expands, leading to a cool gas at the compressor.
And thus the cycle begins anew.
The amount of heat transferred by the device depends on the heat transfer rates at the condenser and evaporator. And, as those who have studied heat transfer will know, the rate of heat transfer at those points is determined by the temperature of air surrounding the condenser and evaporator.
There were three different types of energy transfer in that description. The pump consumes electricity to ensure that the refrigerant passes through the cycle. Heat transfers from the refrigerant to the heat sink in the condenser. And heat transfers from the heat source to the refrigerant in the evaporator. The amount of heat transferred by the device depends on the heat transfer rates at the condenser and evaporator. And, as those who have studied heat transfer will know, the rate of heat transfer at those points is determined by the temperature of air surrounding the condenser and evaporator.
This leads to the term Coefficient of Performance. The Coefficient of Performance states the amount of heat transferred from the heat source to the heat sink relative to the energy consumed by the pump. It’s typically over one. Though, it is highly sensitive to the temperatures of the heat source and heat sink. As those temperatures get closer to the refrigerant temperature less heat will transfer, thus reducing the performance of the heat pump without changing the pumping energy required.
Now that we understand heat pumps, the next concept to explore is a heat pump water heater (HPWH).
What is a heat pump water heater?
Heat pump water heaters are a type of heat pump that are used to heat water. They employ a large storing tank, typically 55 to 80 gallons, holding hot water ready for use when needed. A heat pump transfers heat from the surrounding air (Heat source) to the water stored in the tank (Heat sink). Figure 2 shows a schematic of a heat pump water heater.

Notice that the four parts of the heat pump are the same as the ones listed in Figure 1. The only real difference here is that the condenser is located inside a hot water storage tank. In this way the hot refrigerant transfers heat to the water in the tank. Meanwhile, the evaporator is pulling heat from the surrounding space to the refrigerant. In this way it transfers heat from the air in the space to the water.
What is a performance map?
In the section introducing heat pumps, we mentioned that the Coefficient of Performance is dependent on the temperatures surrounding the condenser and evaporator. This means that the coefficient of performance will change as the surrounding temperatures will change. And those temperatures will change. The outdoor temperature isn’t constant throughout the day. The indoor temperature changes as the air conditioner operates.
One could imagine a plot or function stating the coefficient of performance as the two temperatures change.
This is a performance map. A performance map is a way of identifying the performance of a device as the conditions impacting it change. It’s a multi-variable equation expressing the performance of the device as a function of those conditions.
Creating performance maps is a common exercise in the scientific and engineering worlds. One example of this is building energy simulation. Predicting the energy consumption of new buildings, and designing new ways to reduce building energy consumption is a big field in the United States. These people use simulation models to predict the performance of the building. Those simulation models need to predict the energy consumed by the equipment installed in the building. And since heat pumps are used in buildings, those models need to predict the performance of those heat pumps. And the performance of those heat pumps is predicted by those models using, you guessed it, performance maps.
What comes next?
This post was an introduction to the background concepts needed to understand, and follow the tutorial. The coming tutorial will teach you the steps needed to take a data set of laboratory tests describing the performance of a HPWH under varying conditions and generate a performance map. It will teach you to write the Python code needed to do that automatically. It will give you the opportunity to learn these useful skills in a real-world example.
This tutorial will be useful if you simply read through the articles. You’ll be able to understand the concepts, you’ll see it all get done, and you’ll see the Python script needed to do it yourself. Where it gets really useful, however, is if you’re able to write the code, generate the results, and check the answers yourself. To assist with that, I’ve created a companion data set. If you download the data set you’ll be able to follow along, ensuring that you’re doing everything correctly and learning as much as possible.
The companion data set can be found here.
That data set contains fabricated results, emulating what you might receive from a laboratory. It contains quasi-data from three experiments, demonstrating the performance of the heat pump water heater with changes in space and water temperatures.
The first task, and the first step in the tutorial, is splitting the data set into independent files with each file providing the result of a single test. That article will be up soon.
Tutorial Table of Contents
This is a part of a series of articles teaching you all of the skills needed to automatically analyze laboratory data and develop a performance map of heat pump water heaters. The other articles in the series can be found using the following links:
Automatically Analyzing Laboratory Test Data
Checking Analyzed Laboratory Data for Errors