Target:
ItemTargetMaximum
SRM
Ca
SO4
Mg
Na
Cl
Guess Ca
Set for: Very Hoppy Hoppy Balanced Malty Very Malty
Note: calcium must be at least 50. If left blank, it will attempt to pick a good number. Clicking "Guess Ca" will do the same.
Maximum SRM is about 30. We will not go above 300 RA.
Source:
Ca:
SO4:
Mg:
Na:
Cl:
Alk:
Distilled
Paulding County
Mash Water:
Gallons:
Batch Size
Gallons:

RA Score Factor: How much to weigh RA in scoring. Generally needs to be higher for higher SRM.
Cl/SO4 Score Factor: How much to weigh Cl/SO4 ratio in scoring.


Target RA: 41
RA Range: 27 - 56

Target Cl/SO4: 1
Cl/SO4 Range: 0.875 - 1.125

Need:
Ca: 66
SO4: 75
Mg: 10
Na: 50
Cl: 75
Alk: 94

High Guess:per gallon
Calcium Chloride: 0.9
Gypsum: 1.1
Epsom: 0.75
Soda: 0.7
Chalk: 0.75

Guesses: Got 453 good guesses out of 25000 tries.
Showing top 6 guesses.
Score:306
Guess:8626
Salts:
SaltTotalMashBoil
Calcium Chloride3.62.950.65
Gypsum1.41.150.25
Epsom2.52.050.45
Soda3.052.50.55
Chalk0.550.450.1
Results:
Ca:72
SO4:83
Mg:11
Na:40
Cl:83
Alk:99
RA:41
SRM Range:9 - 13
Chloride/Sulfate:0.996 - Balanced
Score:329
Guess:15947
Salts:
SaltTotalMashBoil
Calcium Chloride3.052.50.55
Gypsum1.41.150.25
Epsom1.951.60.35
Soda2.752.250.5
Chalk0.550.450.1
Results:
Ca:65
SO4:73
Mg:9
Na:36
Cl:70
Alk:92
RA:40
SRM Range:8 - 13
Chloride/Sulfate:0.962 - Balanced
Score:421
Guess:23771
Salts:
SaltTotalMashBoil
Calcium Chloride3.62.950.65
Gypsum1.41.150.25
Epsom2.752.250.5
Soda3.052.50.55
Chalk0.550.450.1
Results:
Ca:72
SO4:88
Mg:12
Na:40
Cl:83
Alk:99
RA:41
SRM Range:9 - 13
Chloride/Sulfate:0.938 - Balanced
Score:460
Guess:15994
Salts:
SaltTotalMashBoil
Calcium Chloride3.32.70.6
Gypsum0.850.70.15
Epsom2.752.250.5
Soda3.052.50.55
Chalk000
Results:
Ca:52
SO4:74
Mg:12
Na:40
Cl:76
Alk:87
RA:42
SRM Range:9 - 13
Chloride/Sulfate:1.039 - Balanced
Score:570
Guess:6853
Salts:
SaltTotalMashBoil
Calcium Chloride3.853.150.7
Gypsum1.951.60.35
Epsom1.651.350.3
Soda3.32.70.6
Chalk0.30.250.05
Results:
Ca:77
SO4:82
Mg:7
Na:43
Cl:89
Alk:101
RA:42
SRM Range:9 - 13
Chloride/Sulfate:1.082 - Balanced
Score:583
Guess:8358
Salts:
SaltTotalMashBoil
Calcium Chloride3.62.950.65
Gypsum2.21.80.4
Epsom1.651.350.3
Soda3.32.70.6
Chalk0.30.250.05
Results:
Ca:76
SO4:90
Mg:7
Na:43
Cl:83
Alk:101
RA:42
SRM Range:9 - 13
Chloride/Sulfate:0.922 - Balanced



How it works:
This is based on a blog post by The Mad Fermentationist concerning the technique he uses for water treatment. It involves using two things: BreWater and John Palmer's RA spreadsheet. I'm fairly lazy and BreWater is Windows only, So I run it under wine, and I have to open Microsoft Excel to use the spreadsheet. Then, I have to compare numbers and copy, etc. Too Much Work.

This seeks to simplify water treatment. You just enter desired SRM and mineral profile and it will calculate what minerals you need to add. It was designed to be used with reverse osmosis water, so YMMV with other source water.

I copied John's calculations from his spreadsheet, so I could compare the two, and as of last check, they match. The script uses the SRM to calcuate the residual alkalinity (RA) - it uses the average from the spreadsheet. It also uses the Chloride/Sulfate ratio - this affects percieved hoppiness and/or maltiness. It also will always use Caccium of at least 50 ppm that is necessary for proper mashing.

So, how does it actually calculate things. It's very simple. It calculates a high "guess" value for each salt addition. It does this by, for example, assuming that you will derive Ca from only additions of Chalk. This value is then used as the highest possible value. This is calculated for each salt based on what it contributes. Then, a large number of random guesses is made. The salt additions are between 0 and the large "guess" value we calculated earlier. Each guess (or test set) is checked to ensure that the maximums are not exceeded and that the RA is within range. Then the test set is scored. The lowest score within the number of guesses, wins.

Scoring is very simple. It's easier to explain with an example. If target Cl is 50, and we guess to 48, then the score is (|50-48|)^2 (absolute value of target minus guess squared). In this case, the score is 4. THis is done for each mineral. The further off we are, the score grows exponentially. (Remember, lowest score wins.) For RA and Cl/SO4, they are weighted. The base score for them is multiplied by the "Score Factor." This is because they were the primary reason for me developing this in the first place. Finally, all of these scores are added to get a single score for a test set.