@beerwright/core
    Preparing search index...

    Function scheduleResidualCo2

    • How much CO₂ the beer still holds when the schedule ends.

      Open to atmosphere (the usual case) uses residualCo2Volumes at the schedule's peak temperature. CO₂ that a warm diacetyl rest drove off doesn't come back when the beer is crashed, because there's only air and a blow-off tube above the beer.

      Under pressure is the exception. A sealed vessel with a spunding valve has a CO₂ headspace at a known gauge pressure, so the beer is at Henry's-law equilibrium, not at whatever was left after its warmest point, and it does take gas back up as it chills. So if the last step has a pressure, we use co2VolumesFromPressure at that step's finishing temperature and ignore the peak.

      We look at the last step, not any step, because a beer that was spunded and then vented and transferred is back to the open-vessel case. A brewer records that by leaving the pressure off the last step.

      This assumes the stated pressure is actually held at the stated temperature, by a spunding valve, a gas line, or topping up the vessel. Pressure that's only trapped before a crash falls as the beer absorbs it, and the beer ends up somewhere between the two figures. This model doesn't cover that case; for a trapped-and-crashed step, the right figure is the pressure the gauge settles at, which has to be measured.

      The two fits also disagree slightly where they meet. At 20 °C and zero gauge pressure the residual curve gives 0.86 volumes and the Henry's-law fit gives 0.84, since they're independent regressions of the same tables. A step with pressurePsi: 0 would read a little lower than the same step without one, so we treat zero as no pressure.

      Parameters

      Returns ResidualCo2 | null

      null for a schedule with no steps. The caller's own default (a room-temperature ale) is a better answer there.