~scottydelicious666/brewtarget/brewtarget

« back to all changes in this revision

Viewing changes to hoputilization.cpp

  • Committer: Philip Greggory Lee
  • Date: 2009-08-23 16:53:43 UTC
  • Revision ID: git-v1:f8d1a25135bd92f06c46c562293800e4faa42c61
Made a src/ and ui/ directory and moved everything.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    Copyright Philip Greggory Lee (rocketman768@gmail.com), 2008-2009.
3
 
    
4
 
    hoputilization.cpp is part of Brewtarget.
5
 
    
6
 
    Brewtarget is free software: you can redistribute it and/or modify
7
 
    it under the terms of the GNU General Public License as published by
8
 
    the Free Software Foundation, either version 3 of the License, or
9
 
    (at your option) any later version.
10
 
 
11
 
    Brewtarget is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
    GNU General Public License for more details.
15
 
 
16
 
    You should have received a copy of the GNU General Public License
17
 
    along with Brewtarget.  If not, see <http://www.gnu.org/licenses/>.
18
 
*/
19
 
 
20
 
// Uses a method outlined at http://www.realbeer.com/hops/research.html
21
 
 
22
 
#include <cmath>
23
 
 
24
 
double BoilTimeFactor( double minutes )
25
 
{
26
 
   return (1.0 - exp(-0.04 * minutes))/4.15;
27
 
}
28
 
 
29
 
double BignessFactor( double wort_grav )
30
 
{
31
 
   return 1.65 * pow(0.000125, (wort_grav - 1));
32
 
}
33
 
 
34
 
double AlphaAcidUtilization( double wort_grav, double minutes )
35
 
{
36
 
   return BoilTimeFactor(minutes) * BignessFactor(wort_grav);
37
 
}
38
 
 
39
 
double MaxAAConcentration_mgPerLiter(double AArating, double hops_grams, double finalVolume_liters)
40
 
{
41
 
   return (AArating * hops_grams * 1000) / finalVolume_liters;
42
 
}
43
 
 
44
 
double IBU( double AArating, double hops_grams, double finalVolume_liters, double wort_grav, double minutes)
45
 
{
46
 
   return MaxAAConcentration_mgPerLiter(AArating, hops_grams, finalVolume_liters) * AlphaAcidUtilization(wort_grav, minutes);
47
 
}
48