Brewing software mash calculations

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk:

HHP

Well-Known Member
Joined
Nov 27, 2010
Messages
374
Reaction score
6
Location
Harker Heights
I have been considering writing my own brewing software, mostly just to say that I did. It might not come to fruition, but I am bored in Iraq, need something to do, and programming was something I was big into in high school.

I really don't know anything about the math that goes into calculating what beersmith or any other application calculates.

Where/what should I read to learn about this stuff, so that I can possibly write this software. I am assuming I will need quite a bit of knowledge about pretty much all steps that go into planning a brew.
 

MalFet

/bɪər nɜrd/
Lifetime Supporter
Joined
May 31, 2010
Messages
8,632
Reaction score
1,479
Location
NYC / Kathmandu
There certainly are plenty of them.

For starters, can you calculate the gravity of a beer given a grain bill, malt extract potentials, and brewhouse efficiency?

For IBUs, you'd need to be familiar with the standard estimation formulas, particularly Tinseth.

For color, the Morey equation is commonly used.

Then, if you want to get more ambitious, it's worth looking into heat capacity to understand the formulas for calculating strike water, mash step infusions, etc.

Good luck! :mug:
 

kladue

Senior Member
Lifetime Supporter
Joined
Dec 28, 2006
Messages
2,318
Reaction score
60
Location
Turner, Oregon
I don't know if this would help but here are some of the formulas I use.

maltBTU = ((RecipeObject.maltQty * SettingsObject.maltBtuLb) * (RecipeObject.st1tmp - 70));
// Malt BTU's to reach mash step temp = (Malt Pounds * Malt BTU/Lb) * mash step 1 temperature - ambient temp

systemBTU = ((RecipeObject.st1tmp - 70) * SettingsObject.sysbtufac);
// System BTU's to reach mash step temp = (Mash step 1 temperature - Ambient temp) * System BTU's per deg F. change

maltWaterAbs = (RecipeObject.maltQty * SettingsObject.maltwtrabs);
//Malt water absorption = malt Lbs X Malt absorption rate

strikeVol = (((RecipeObject.maltQty * RecipeObject.waterratio) / 4));
// Strike water volume in gallons = Malt Lbs X Water Ratio / 4

RecipeObject.swv = (((int)(strikeVol * 100) / 100.00));
// long way to get there format method for strike water volume setting

strikeBTU = (maltBTU + systemBTU + (strikeVol * 8.45) * (RecipeObject.st1tmp - 50));
//total strike water btu's =( malt BTU's + System BTU's) + Strike Water volume *Lb's Gallon of water) *(mash step 1 temp - boiler water inlet temp)

strikeTempSet = ((int)((strikeBTU / (strikeVol * 8.45)) + 50));

RecipeObject.swt = (strikeTempSet);
//Strike Water Temperature = (Strike water BTU's / (Strike water gall X 8.45)) + Boiler inlet temp

netWortVol = ((RecipeObject.swv - (maltWaterAbs) + SettingsObject.mashTunDeadspaceSetting + SettingsObject.otherDeadspaceSetting));
//Strike Water-(Malt water abs.+Mash tun dead space+system dead space)

sparge = (1.03 * ((RecipeObject.batch - (netWortVol) + ((RecipeObject.boiloff * RecipeObject.bltim) / 60) + SettingsObject.boilKettleDeadspaceSetting)));
//sparge water needed = Batch size -(Net Wort to kettle+boil Kettle losses and cooling loss of 4%)

spargeVolSet = ((int)(sparge * 100)) / 100.0;
RecipeObject.spv = (spargeVolSet);
// long way to get there format method for sparge water volume setting

preBoilVol = (((int)((netWortVol + spargeVolSet) * 100)) / 100.00);
RecipeObject.prboilg = (preBoilVol);
//Pre boil Gallons = Net wort + Sparge Water

RecipeObject.ptboilg = (((int)((((preBoilVol - (RecipeObject.boiloff * (RecipeObject.bltim / 60))) * .98) - SettingsObject.boilKettleDeadspaceSetting) * 100)) / 100.00);
//Post boil Gallons = PreBoilVolume - (boil off * (boil time / 60))) * .98) - boil Kettle Deadspace Setting)

spargeFlow1 = ((int)(((netWortVol + spargeVolSet) / RecipeObject.spdur) * 100.00) / 100.00);
// Sparge flow rate = (net wort volume + Sparge volume)/ sparge duration in minutes

if (spargeFlow1 < SettingsObject.spargeWaterFlowSetting)
// Sets sparge flow to minimum default flow rate if lower than minimum flow
{
spargeFlow1 = SettingsObject.spargeWaterFlowSetting;
}
RecipeObject.spf = (spargeFlow1);
// Sparge flow rate in gpm


boilLoss = (RecipeObject.boiloff * (RecipeObject.bltim / 60));
RecipeObject.boilLoss = boilLoss;
// Boiling loss = ( Boil off rate * Boil time)/60

mtFillPercent = (((int)((((RecipeObject.maltQty * 0.078125) + RecipeObject.swv) / 12.5) * 1000)) / 10.0);
// Mash Tun fill percentage = ((((Malt quantity * 0.078125) + Strike water volume) / Mash tun capacity) / 10)
 
OP
HHP

HHP

Well-Known Member
Joined
Nov 27, 2010
Messages
374
Reaction score
6
Location
Harker Heights
Malfet- I can calculate gravity points/efficiency etc...

Kladue- Damn. Did you just pull those out of some java app or something? That gives me a good idea of what I am looking at.

Like I said, I am not sure I will actually write this, I'm just looking into it.

This stuff has to be written in a book, or several books right? I mean, we didn't always have brewing software...
 

MalFet

/b&#618;&#601;r n&#604;rd/
Lifetime Supporter
Joined
May 31, 2010
Messages
8,632
Reaction score
1,479
Location
NYC / Kathmandu
Malfet- I can calculate gravity points/efficiency etc...

Kladue- Damn. Did you just pull those out of some java app or something? That gives me a good idea of what I am looking at.

Like I said, I am not sure I will actually write this, I'm just looking into it.

This stuff has to be written in a book, or several books right? I mean, we didn't always have brewing software...
You'll have to give us a better sense of what kinds of calculations you are looking for. It is all written down in various places, but once you've got gravity, hops utilization, color, and temperature, you've already got a lot of it.
 

kladue

Senior Member
Lifetime Supporter
Joined
Dec 28, 2006
Messages
2,318
Reaction score
60
Location
Turner, Oregon
The calculations were lifted from the C# version of the auto control application, the color and IBU calculations involve SQL table use so they are not as easy to extract. If there are other calculation formulas that you need code examples of I can pull additional ones out of either the Java or C# applications. The C# application is just a conversion of the original Java application built to operate an almost totally automated PLC controlled brewing system with synthesized voice prompts for alarms and manual steps added for convenience.
 
OP
HHP

HHP

Well-Known Member
Joined
Nov 27, 2010
Messages
374
Reaction score
6
Location
Harker Heights
I'm really not sure what I need.

I started making my tables for ingredients, and then figured i would have a table with a bunch of different mash profiles, so that they can be dynamically updated, changed and added and I realized i had no idea what I was doing. I have no real idea how to represent this stuff in a mysql table and regurgitate it in a meaningful way.

When I brew, I have one method I follow pretty much every time, 1.25qt/lb ratio, mash for 60-90 minutes depending on temp, sparge and boil. I guess there probably are a limited number of different 'mash profiles' to choose from, and they all follow the same basic equation: certain temp for certain time, different temp, etc...

I guess my ultimate goal is to produce a fully featured product, and perhaps I am fretting over the little stuff right now?

kladue-that makes sense, java and c# are almost the same language

MalFet- Yeah i guess you are right, im not at a sticking point, but eventually I will want/need to put temperature, volume calculations in and I am really not sure where to start ... maybe I'll read the wiki more... :p
 

MalFet

/b&#618;&#601;r n&#604;rd/
Lifetime Supporter
Joined
May 31, 2010
Messages
8,632
Reaction score
1,479
Location
NYC / Kathmandu
I'm really not sure what I need.

I started making my tables for ingredients, and then figured i would have a table with a bunch of different mash profiles, so that they can be dynamically updated, changed and added and I realized i had no idea what I was doing. I have no real idea how to represent this stuff in a mysql table and regurgitate it in a meaningful way.

When I brew, I have one method I follow pretty much every time, 1.25qt/lb ratio, mash for 60-90 minutes depending on temp, sparge and boil. I guess there probably are a limited number of different 'mash profiles' to choose from, and they all follow the same basic equation: certain temp for certain time, different temp, etc...

I guess my ultimate goal is to produce a fully featured product, and perhaps I am fretting over the little stuff right now?

kladue-that makes sense, java and c# are almost the same language

MalFet- Yeah i guess you are right, im not at a sticking point, but eventually I will want/need to put temperature, volume calculations in and I am really not sure where to start ... maybe I'll read the wiki more... :p
Start small. First build something that will simply calculate a grain bill, and slowly add features to it as you need them. If you properly encapsulate your data, everything you do should be reasonably expandable.
 

kladue

Senior Member
Lifetime Supporter
Joined
Dec 28, 2006
Messages
2,318
Reaction score
60
Location
Turner, Oregon
I am using 28 MySql tables in the brewing control applications that I have running, so if you need help in that area I can offer some suggestions or code examples. One thing to consider is the ability to enter and edit information during run time through the use of dialog panes with both bound and unbound data grid view tables. Creation of calculator and keyboard dialog panes is a way of editing and entering either number or character information into the application easily without having to embed them in each data editing dialog pane. Having spent an insane amount of time working on this these applications as a means to utilize time off from work when away from home, I have learned enough Java and C# programming to get by. My next goal is to create a web interface for the applications, something else to learn while on the road and burn time.
 

Latest posts

Top