"""Lab to Code — How much heat can a heat pump move per kWh? The Carnot limit.

The best possible coefficient of performance for heating is COP = T_hot / (T_hot - T_cold), temperatures in kelvin
(second law of thermodynamics; any textbook, e.g. Cengel and Boles, Thermodynamics). Real units deliver less:
up to about 3 kWh of heat per kWh of electricity in moderate climates (U.S. DOE, Solar Decathlon).
T_hot is the water you send to the house: about 35 C for floor heating, about 55 C for old radiators.
"""
SUPPLY = {"floor heating": 35, "radiators": 55}   # C

for t_out in (10, 0, -10, -20):
    cops = []
    for name, t_in in SUPPLY.items():
        th, tc = t_in + 273.15, t_out + 273.15
        cops.append(f"{name} {th / (th - tc):.1f}")
    print(f"{t_out:4} C outside: Carnot COP " + ", ".join(cops))
