Refrigerants and CoolProp¶
“Refrigerant-agnostic” is one of the headline properties of
TMHP — and this is the page that makes it concrete. The
refrigerant is a constructor argument on every released
cycle-resolved model family (ref="<name>"); state queries route through
CoolProp, which carries the
equation-of-state heavy lifting. Below: which refrigerants work
out of the box, where the cycle assumptions break, and how to read
CoolProp-related failures.
The contract¶
A CoolProp pure or pseudo-pure refrigerant whose cycle stays subcritical (condensing temperature below the critical temperature) is usable out of the box:
from tmhp import AirSourceHeatPumpBoiler
AirSourceHeatPumpBoiler(ref="R32") # difluoromethane
AirSourceHeatPumpBoiler(ref="R290") # propane
AirSourceHeatPumpBoiler(ref="R410A") # pseudo-pure blend
AirSourceHeatPumpBoiler(ref="R134a")
AirSourceHeatPumpBoiler(ref="R600a") # isobutane
The compressor’s rated speed is solved for each fluid at the model’s rating
condition (Compressor reference state), so swapping the fluid keeps the
rated capacity. A fluid with a low volumetric capacity needs a larger
compressor for the same duty, and the default displacement of every family
follows the fluid: it is the displacement a compressor catalogue gives for the
capacity at the catalogue’s rating point, with the fluid’s own suction density
and enthalpy rise (Where the defaults come from). For the 15 kW default
AirSourceHeatPumpBoiler that is 45 cm³/rev with R32, 84 with R290, 110
with R134a and 203 with R600a, and the rated speed lies between 55 and
61 rev/s for every one of them, inside the 30–110 rev/s of the data of the
default compressor maps. The default 8 kW GroundSourceHeatPumpBoiler,
rated at B0/W55, takes 24 cm³/rev with R32, 45 with R290, 59 with R134a and
108 with R600a, and is rated at 63 to 72 rev/s (R290 67). (Until November 2026
the default was one displacement for every fluid, 70 cm³/rev at 15 kW: R600a
could not reach the rated capacity on it and was refused at construction,
and R134a, R1234yf and R1234ze(E) were rated at about 90, 100 and 121 rev/s.
The ground- and water-source boilers kept that constant, 37 cm³/rev at 8 kW,
until the same month.)
Not supported¶
The cycle assumes subcritical single-stage compression. These are outside the supported set:
Refrigerants that become supercritical at DHW temperatures, notably R744 (see below).
User-defined
HEOS::mixtures: the constructor raisesValueError(the defaultT_cond_maxis not defined for a mixture), and withT_cond_max=Noneit does not return.
CoolProp returns REFPROP-grade equation-of-state values, so the same first-principles cycle calculation can be rerun with a different working fluid without per-refrigerant curve refitting.
Subcritical operation (R32, R290, R410A, R134a, …)¶
The cycle assumes a subcritical condensation pressure: condenser inlet is superheated vapour, condenser outlet is subcooled liquid, and the saturation dome is the relevant region for state-point calculations.
For refrigerants whose critical temperature is comfortably above typical condenser water temperatures (R32: ~78 °C critical, R290: ~97 °C, R134a: ~101 °C), this assumption holds across the entire DHW operating envelope.
Supercritical / transcritical operation (R744) — not supported¶
R744 (CO₂) has a critical temperature near 31 °C. For DHW heating
(condenser water at 50–65 °C) the high side would run above the
critical point — a transcritical cycle. The cycle is written against a
subcritical-condenser assumption, so R744 is not supported on the
boiler families (AirSourceHeatPumpBoiler and the ground- and
water-source counterparts). Their constructors refuse a refrigerant whose
critical temperature is not above the delivery set point T_mix_w_out,
with or without rps_rated:
AirSourceHeatPumpBoiler(ref="R744")
# ValueError: ref='R744': its critical temperature (31.0 degC) is not above
# the delivery set point T_mix_w_out=40.0 degC, so no subcritical cycle of
# R744 can heat the water; ... choose a subcritical refrigerant, for
# example R290, R32 or R134a
A rating point whose condenser would be supercritical (R744 in the
space-conditioning families, or a boiler asked for colder water than that)
fails in the reference solve with reference_capacity_inconsistent,
naming the condensing and the critical temperature
(Compressor reference state).
A faithful transcritical model would need a gas-cooler block in place of the
condenser. The cycle-closure interface (_optimize_operation) is
designed so that swapping the high-side block in is a localised
change, but no such block exists today.
Mapping CoolProp errors to failure_reason¶
CoolProp raises when state queries fall outside the EOS envelope — for example, asking for a saturation pressure above the critical point, or asking for a property at a state that crossed into two-phase by accident. These show up inside TMHP as:
failure_reason == "cycle_invalid"when the cycle couldn’t produce a coherent state at all (often the EOS itself rejected a query).failure_reason == "hx_not_converged"when the cycle produced a state but the HX iteration drifted because a property lookup was unstable near a phase boundary.
In both cases the relevant lever is the operating point:
either move T_tank_w / T0 / Q_ref_tank away from
the EOS edge, or oversize the heat exchanger so the iteration
doesn’t push so hard. See failure_reason semantics for
the branching pattern.
Why CoolProp specifically?¶
Coverage — every common refrigerant plus most blends, with the same call shape.
Quality — REFPROP-grade EOS for the major fluids, validated against the same reference data that commercial property packages use.
License — MIT, redistributable.
Cost — pure-Python wrapper over a C++ core, fast enough that 100 k state queries per simulation second are not the bottleneck.
For state-point helpers and the small wrapper layer this library adds, see Refrigerant & thermodynamics.