Introduction: Homebrewing Calculations Using Python!
I am an avid home brewer and Python programming enthusiast so I created a simple Python script to help me make my brew day calculations. The script will calculate many useful variables such as strike water temp, strike water volume, and absorption to name a few. You will need Python installed on your computer to be able to run this script. I am not writing this to show how to use Python so I am expecting you have enough knowledge to install Python and run a Python script. I use Python 2.7.8. I also write/run my scripts from Notepad++ using the PyNPP plugin because I hate using IDLE. All of the formulas were adapted from the documentation on the Brew365 website.
The following are the references they used for their calculations:
• Designing Great Beers by Ray Daniels.
• Cheap and Easy Batch Sparging by Denny Conn3.
• BYO Magazine - Managing Mash Thickness by Tom Flores4.
• BYO Magazine - How do you account for evaporation loss during an aggressive boil?
Step 1: Parameters
The following list is the parameters that the Mash class takes in order to make it's calculations and a short description of valid values:
- ratio - This is the ratio of water per pound of grain to be used at mash in. The measurement is in Quarts/Pound. I generally use 1.25 - 1.5 quarts per pound of grain.
- targetTemp - This is the target temp that you would like to mash at in degrees Fahrenheit. I generally mash at around 152 degrees for a single infusion mash.
- grainWeight - This is the total weight of your recipes grain bill in pounds
- grainTemp - This is the temp of your grain before you mash in Fahrenheit. If it has been sitting out in your home it would be whatever your room temp is, e.g. 70°.
- boilTime - This is the length of your boil time in Minutes.
- batchSize - This is the volume of your beer batch size in gallons. It is usually 5 gallons.
- trubLoss - This is the volume lost from what is left in the boil kettle after transferring to the fermenter in gallons. I set this to 0 if unknown.
- tunLoss - This is the volume lost in the bottom of your mash tun in gallons during your normal brew day. If you don't have a dip tube this could be a bigger factor.
You can create a Mash object by the following as seen in the script:
batchSize = 5
ratio = 1.25
mashTemp = 152
grainWeight = 11
grainTemp = 70
boilTime = 60
trubLoss = 0
tunLoss = 0
mash = Mash(ratio, mashTemp, grainWeight, grainTemp, boilTime, batchSize, trubLoss, tunLoss)
Now you can access the different methods within the mash object.
Step 2: Methods
After creating your Mash object you can access different variables using the following methods:
strikeTemp() - returns the temp your strike water will need to be in Fahrenheit
strikeVol() - returns the volume of water in gallons that you need for the strike
spargeVol() - retruns the volume in gallons needed for your sparge water
totalWaterNeeded() - returns the total volume of water needed for your brew day.
There are other private methods that can be accessed that are used in the calculations:
_absorbtion() - returns the total volume of water lost to absorption by the grain in gallons
_mashTunLoss() - returns the total volume of water lost in the bottom of the mash tun after transfer to boil kettle in gallons.
_evaporationRate() - returns the total volume of water to lost to evaporation during the boil. the default evaporation rate is set to 10% (0.10) per hour
_shrinkLoss() - returns the total volume of water lost due to shrinking after cooling the wort. it is set to 4%.
_preBoilVol() - returns the volume of water that should be in your boil kettle after sparging and before boil
Here are a few examples for how to access those methods with your mash object:
To access one of your variables:
Step 3: Results
If you run my code with the default parameters below line 70 in the attached script it will return some variables and descriptions to the console which will look like the above screenshots depending if you run from IDLE or Terminal. I have attached the script to this Instructable for anyone's use or adaptation. Happy brewing and programming!
We have a be nice policy.
Please be positive and constructive.