This is mainly for kegs. You can't see the liquid level in a Cornelius keg,
so most batches get recorded as "about nineteen litres". Weighing it full
and empty gives a real number.
Assumptions
20 °C, the same reference SG uses. Specific gravity is a ratio against
water, so a density in kg/L needs that water's density,
WATER_DENSITY_AT_REFERENCE_KG_PER_L. A keg straight out of a cold
conditioning fridge holds slightly denser beer, but the effect is the same
0.4 % the volume correction gives between 4 and 20 °C, which is less than
the weight of a wet disconnect.
Dissolved CO₂ is ignored. 19 L at 2.4 volumes holds 89 g of it, plus a
few grams in a sealed keg's headspace. But 89 g against ~19 kg of beer is
0.47 % of the mass, about 90 mL of apparent volume. That's below the
precision of the two weighings, so including it would be false precision.
Bad input returns zero. A net weight of zero or less means the tare was
wrong, the vessel is empty, or the two numbers were swapped. None of those
is a volume. A negative result could end up in a packaged-volume field and
corrupt every yield figure computed from it. Callers can recognise zero and
refuse to store it.
Litres of beer in a vessel, from what it weighs full and what it weighs empty.
This is mainly for kegs. You can't see the liquid level in a Cornelius keg, so most batches get recorded as "about nineteen litres". Weighing it full and empty gives a real number.
Assumptions
20 °C, the same reference SG uses. Specific gravity is a ratio against water, so a density in kg/L needs that water's density, WATER_DENSITY_AT_REFERENCE_KG_PER_L. A keg straight out of a cold conditioning fridge holds slightly denser beer, but the effect is the same 0.4 % the volume correction gives between 4 and 20 °C, which is less than the weight of a wet disconnect.
Dissolved CO₂ is ignored. 19 L at 2.4 volumes holds 89 g of it, plus a few grams in a sealed keg's headspace. But 89 g against ~19 kg of beer is 0.47 % of the mass, about 90 mL of apparent volume. That's below the precision of the two weighings, so including it would be false precision.
Bad input returns zero. A net weight of zero or less means the tare was wrong, the vessel is empty, or the two numbers were swapped. None of those is a volume. A negative result could end up in a packaged-volume field and corrupt every yield figure computed from it. Callers can recognise zero and refuse to store it.