Skip to content

Commit

Permalink
excluding non-impacting grains from the pH calc, couple other bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-mcl committed Jun 25, 2021
1 parent ac370b7 commit 1f43d38
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
31 changes: 28 additions & 3 deletions src/main/java/mclachlan/brewday/math/Equations.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,23 @@ public static Water calcBrewingSaltAddition(WaterAddition wa,
*/
public static PhUnit calcMashPhMpH(
WaterAddition mashWater,
List<FermentableAddition> grainBill,
List<FermentableAddition> allAdditions,
List<MiscAddition> miscAdditions)
{
// sum up the grist distilled pH and buffering capacity
List<FermentableAddition> grainBill = new ArrayList<>();

// filter out stuff that won't impact the pH
for (FermentableAddition fa : allAdditions)
{
Fermentable f = fa.getFermentable();
if (f.getBufferingCapacity() != null && f.getBufferingCapacity().get() > 0 &&
f.getDistilledWaterPh() != null && f.getDistilledWaterPh().get() > 0)
{
grainBill.add(fa);
}
}

// sum up the grist distilled pH and buffering capacity
WeightUnit weightUnit = calcTotalGrainWeight(grainBill);
double totalGrainWeight = weightUnit.get(KILOGRAMS);
double total_phi_bi = 0D;
Expand Down Expand Up @@ -374,9 +386,22 @@ public static VolumeUnit calcMashAcidAdditionMpH(
*/
public static PhUnit calcMashPhEzWater(
WaterAddition mashWater,
List<FermentableAddition> grainBill,
List<FermentableAddition> allAdditions,
List<MiscAddition> miscAdditions)
{
List<FermentableAddition> grainBill = new ArrayList<>();

// filter out stuff that won't impact the pH
for (FermentableAddition fa : allAdditions)
{
Fermentable f = fa.getFermentable();
if (f.getBufferingCapacity() != null && f.getBufferingCapacity().get() > 0 &&
f.getDistilledWaterPh() != null && f.getDistilledWaterPh().get() > 0)
{
grainBill.add(fa);
}
}

// sum up the grist impact on distilled water ph
// also detect any acid malt
WeightUnit weightUnit = calcTotalGrainWeight(grainBill);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mclachlan/brewday/util/CreateProdDb.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public static void main(String[] args) throws IOException
do
{
key = styles.readLine();
System.out.println("key = [" + key + "]");
if (key != null)
{
Style obj = testDb.getStyles().get(key.trim());
Expand All @@ -183,7 +182,6 @@ public static void main(String[] args) throws IOException
}
}
while (key != null);
System.out.println("prodDb = " + prodDb.getStyles().size());

// equipmentProfile
BufferedReader equipmentProfiles = new BufferedReader(new FileReader(new File("src/dist/equipmentprofiles.prod"), StandardCharsets.UTF_8));
Expand Down
5 changes: 5 additions & 0 deletions stufftodo.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
bug: forced carbonation doesn't prevent low carbonation warning
bug: ClassCastException selecting force carbonation and then another process step
bug: prevent inventory addition without weight
bug: ref fermentable delete fails if it's in a recipe or your inventory
---------------------
rename process steps
generic "export as csv" from any table
---------------------
Expand Down
2 changes: 1 addition & 1 deletion test_data/test_db/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"backend.google.drive.directory.name": "brewday_data",
"backend.google.drive.directory.id": "1isNhil9ESxEyMgNqtZ69kRUyUURqCdDR",
"ui.theme": "jmetro.light",
"last.import.directory": "E:\\temp\\brewday\\brewday_v0.5\\data\\db",
"last.import.directory": "E:\\temp\\brewday\\brewday_v0.6\\data\\db",
"feature.batches": "true",
"feature.inventory": "true",
"feature.remote.backends": "false",
Expand Down

0 comments on commit 1f43d38

Please sign in to comment.