Fix carbonation equation, add tests and metric/imperial unit switch - #25
Merged
Merged
Conversation
The original Vail/Glass equation constants were wrong and produced negative equilibrium pressures for typical targets (e.g. -0.34 bar for 2.5 vol at 4 C, when the correct answer is ~0.76 bar / 11 psi). Replaces the formula with a metric polynomial derived from the standard ASBC / Zahm & Nagel carbonation equation. Values now match published brewing carbonation charts to within ~0.5 psi across 0-20 C and 1-5 vol. Adds 34 unit tests covering: rule-of-thumb brewing chart values, altitude correction, quadratic inverse round-trip, exponential absorption model edge cases, shaking method, and vessel presets. Also adds a metric/imperial SegmentedControl in the header. Internal state stays metric; display values, slider ranges and input conversion switch at the UI boundary so the math is unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.