This project is a heat pump performance model with a Python graphical user interface (Tkinter).
It calculates heating power, electrical power, and COP maps based on operating parameters and refrigerants.
It provides a flexible, interactive, and accurate tool for simulating heat pump performance under customizable operating conditions.
- Python 3.7 or higher
- CoolProp
- numpy
- pandas
- plotly
- tkinter (usually included with Python)
You can install dependencies easily with:
pip install CoolProp numpy pandas plotlyStart the GUI with:
python gui.pyA window will appear for entering parameters and calculating performance maps.
Results (CSV files and interactive HTML plots) will be saved in the results folder at the root of the project.
gui.py: main graphical user interface using Tkinter
calc.py: thermodynamic calculation functions and compressor models
results.py: saving results and generating interactive plots
results/: folder where output files are saved (auto-created)
When the program is fed up with the following parameters
The ouptut files are in the example_results/ folder in this repository.
This project simulates the thermal and electrical performance of a vapor compression heat pump across a wide range of operating conditions, defined by the user. The simulation includes calculations of:
- Heating Power Output
- Electrical Power Consumption
- Coefficient of Performance (COP)
It does so by modeling a simplified thermodynamic cycle using real refrigerant properties and empirical efficiency correlations. The following sections describe the physical and mathematical principles used in the computation.
The core of the model is based on the idealized vapor-compression cycle, which consists of four main processes:
-
Evaporation (low pressure, low temperature):
The refrigerant absorbs heat and evaporates, entering the compressor as superheated vapor. -
Compression (isentropic idealized):
The vapor is compressed, increasing its pressure and temperature. -
Condensation (high pressure):
The hot vapor releases heat and condenses into liquid. -
Expansion (isenthalpic, not modeled explicitly here):
The liquid refrigerant undergoes expansion before re-entering the evaporator.
The user provides:
- Refrigerant Type (e.g., R134a, R290, R410A, etc.)
- Superheat & Subcooling (in Kelvin)
- Compressor Displacement (in cc/rev)
- Compressor Speed (in rev/s)
- Envelope Polygon: 8 user-defined points representing (Evaporation Temp °C, Condensation Temp °C)
- Volumetric Efficiency Curve: 4 user-defined points for fitting a 4th-degree polynomial
- Isentropic Efficiency Curve: same as above
For each point within the polygonal envelope, the tool calculates:
where:
-
$V_{dot}$ is the volumetric flow rate -
$V_{disp}$ is the compressor displacement (m³/rev) -
$n$ is the compressor speed (rev/s) -
$eta_v$ is the volumetric efficiency
where:
-
$m_{dot}$ is the mass flow rate -
$ρ_{inlet}$ is the vapor density at compressor inlet
Thermodynamic states are calculated using CoolProp:
-
h1: superheated vapor (evaporator outlet) -
h2s: isentropic outlet after compression -
h2: real outlet after compression (η_s considered) -
h3: subcooled liquid after condenser with$h2 = h1 + (h2s - h1) / η_s$
Both volumetric and isentropic efficiencies are modeled as 4th-degree polynomials of the compression ratio:
The coefficients are estimated via least squares from user-defined points using NumPy's polyfit().
The working envelope is discretized into a regular grid of points (T_evap, T_cond) using shapely. Only points that lie inside the polygon are considered for simulation.
Each valid point undergoes a full thermodynamic simulation. Results are saved as:
.csvfiles (heating power, electrical power, COP).htmlinteractive heatmaps using Plotly
- CoolProp – thermodynamic properties
- Tkinter – GUI interface
- Plotly – interactive plotting
- NumPy – numerical computing
- Pandas – data handling
- Shapely – polygon geometry and grid generation
This tool relies on user-fitted polynomial curves to model volumetric and isentropic efficiencies as a function of the compression ratio. While this approach works reasonably well across typical operating ranges, the accuracy degrades significantly at low pressure ratios (close to 1), especially near the diagonal of the (T_evap, T_cond) map. This inaccuracy can lead to unrealistically high heating power or COP
- Implement dynamic curve fitting using more robust models (e.g. logarithmic or rational functions)
- Validate results against experimental data or manufacturer datasheets
- Add visual warnings when the compression ratio is outside a "safe" range