DEV Community

Cover image for Humidifier Sizing in Python: Track Humidity Ratio, Not RH
Evgenii Konkin
Evgenii Konkin

Posted on

Humidifier Sizing in Python: Track Humidity Ratio, Not RH

Relative humidity is the number everyone reads and the wrong one to compute with. Heat 15°F air at 70% RH to 70°F and it drops to about 8% RH, yet not a single grain of water was added or removed. If your code stores humidity as RH and carries it through a heating step, every downstream number is wrong.

The variable that survives heating and cooling is the humidity ratio W: pounds of water per pound of dry air (or grains per pound, 7,000 grains = 1 lb). This post builds a small humidifier-sizing model around W, using the psychrometric equations from the ASHRAE Handbook of Fundamentals, and ends with a result that runs against intuition: on the coldest days a house needs less humidifier water, not more.

The model

Four functions do all the work:

  1. p_ws(t): saturation vapor pressure over water (Hyland-Wexler form from ASHRAE Fundamentals, chapter 1).
  2. humidity_ratio(t, rh): W = 0.621945 × p_w / (p − p_w).
  3. rh_from_w(t, w): the inverse, for checking what RH a given W means at a new temperature.
  4. specific_volume(t, w): ft³ of moist air per lb of dry air, so a volumetric leakage rate can be turned into a mass flow.

Then the humidifier load is just a mass balance on the air that leaks in:

water [lb/h] = dry air [lb/h] × (W_indoor − W_outdoor)
Enter fullscreen mode Exit fullscreen mode
import math

P_ATM = 14.696  # psia, sea level

def p_ws(t_f):
    """Saturation vapor pressure over liquid water, psia.
    Hyland-Wexler form, ASHRAE Handbook - Fundamentals, ch. 1."""
    T = t_f + 459.67
    C8, C9, C10, C11, C12, C13 = (-1.0440397e4, -1.1294650e1, -2.7022355e-2,
                                  1.2890360e-5, -2.4780681e-9, 6.5459673)
    return math.exp(C8/T + C9 + C10*T + C11*T**2 + C12*T**3 + C13*math.log(T))

def humidity_ratio(t_f, rh):
    """lb water per lb dry air."""
    p_w = rh * p_ws(t_f)
    return 0.621945 * p_w / (P_ATM - p_w)

def rh_from_w(t_f, w):
    p_w = w * P_ATM / (0.621945 + w)
    return p_w / p_ws(t_f)

def specific_volume(t_f, w):
    """ft3 per lb dry air."""
    return 0.370486 * (t_f + 459.67) * (1 + 1.607858 * w) / P_ATM

def humidifier_gal_per_day(volume_ft3, ach, t_out, rh_out, t_in, rh_in):
    w_out = humidity_ratio(t_out, rh_out)
    w_in = humidity_ratio(t_in, rh_in)
    dry_air_lb_h = volume_ft3 * ach / specific_volume(t_in, w_in)
    water_lb_h = dry_air_lb_h * max(w_in - w_out, 0.0)
    return water_lb_h * 24 / 8.34  # 8.34 lb per gallon

w = humidity_ratio(15, 0.70)
print(f"15F/70% outdoors: {w*7000:.1f} gr/lb")
print(f"same air at 70F: {rh_from_w(70, w):.1%} RH")

# Winter limits (max indoor RH at 70F by outdoor temp band, mncee.org table)
limits = [(30, 0.40), (15, 0.35), (5, 0.30), (-5, 0.25), (-15, 0.20)]
for t_out, rh_max in limits:
    g = humidifier_gal_per_day(16000, 0.35, t_out, 0.70, 70, rh_max)
    print(f"{t_out:>4}F  target {rh_max:.0%}  ->  {g:.1f} gal/day")
Enter fullscreen mode Exit fullscreen mode

Output:

15F/70% outdoors: 9.0 gr/lb
same air at 70F: 8.4% RH
  30F  target 40%  ->  4.5 gal/day
  15F  target 35%  ->  5.0 gal/day
   5F  target 30%  ->  4.6 gal/day
  -5F  target 25%  ->  4.0 gal/day
 -15F  target 20%  ->  3.3 gal/day
Enter fullscreen mode Exit fullscreen mode

Reading the numbers

Heating does not dry air. 15°F outdoor air at 70% RH carries 9.0 grains per pound. Heated to 70°F, the same 9.0 grains read as 8.4% RH. The humidity ratio never changed. Any simulation step that heats air should pass W through untouched and recompute RH at the new temperature, never the other way around.

Mass flow, not volume. The example house is 2,000 sq ft with 8 ft ceilings (16,000 ft³). At an assumed 0.35 air changes per hour, 5,600 ft³/h leaks in. Dividing by a specific volume of about 13.5 ft³/lb gives roughly 416 lb of dry air per hour. To hold 35% RH at 70°F (38.0 gr/lb) against 9.0 gr/lb outdoors, the humidifier must add about 29 gr/lb, or 1.7 lb/h, or about 5 gallons a day. At 0.5 ACH it is about 7.1 gallons. The infiltration rate is an assumption; a blower door test gives the real one.

The limit is condensation, not comfort. The EPA recommends indoor humidity ideally between 30% and 50% to limit mold. In winter the binding constraint is the window: indoor air at 70°F / 35% RH has a dew point of about 41°F; at 45% RH it is about 48°F, which cold glass easily falls below. That is why winter guidance lowers the setpoint as it gets colder. The limits list uses the table from the Center for Energy and Environment (Minnesota): below 40% at 20–40°F, 35% at 10–20°F, 30% at 0–10°F, 25% at −10–0°F, 20% at −20 to −10°F. Each band is evaluated at its midpoint.

The peak is not on the coldest day. With those limits, water demand peaks near 15°F (5.0 gal/day) and falls to 3.3 gal/day at −15°F, because the target RH drops faster than the outdoor air dries out. A controller that ramps the humidifier up as the outdoor temperature drops is doing the opposite of what the windows need.

Chart of humidifier water demand in gallons per day for a 2,000 sq ft house by outdoor temperature, peaking at 5.0 gallons near 15°F and falling to 3.3 gallons at minus 15°F

One more trap: mixing air streams

When you mix outdoor and return air, average the humidity ratios (weighted by dry-air mass), not the RH values. Mixing 30% outdoor air at 15°F / 70% RH with 70% return air at 70°F / 35% RH gives about 53.5°F and 48.5% RH. Averaging the two RH values gives 45.5%, three points off, and the error grows with the temperature gap.

Check your own numbers

If you want to sanity-check a W value without writing code, the CalcEngineer humidity ratio calculator takes dry-bulb temperature plus RH, wet-bulb or dew point and returns W in gr/lb and g/kg, along with dew point and saturation humidity ratio. Plug in the outdoor and indoor conditions, subtract, and multiply by the dry-air mass flow above.

Limitations of this model: sea-level pressure, steady state, infiltration only (no mechanical ventilation), and no internal moisture from people, cooking or showers, which makes the result an upper bound for the humidifier. Outdoor RH is taken relative to liquid water, the way weather services report it.

Your turn: what indoor RH do you hold in January, and at what outdoor temperature do your windows start to fog? Drop your numbers in the comments and I'll run them through the model.

Top comments (0)