I believe it works like all homebrewing software, i.e. it starts from the potential S.G. to calculate the values. In this case, it starts from the potential of sugar and its dilution in water to give you your O.G.
The Compleat Distiller gives the potential alcohol as 17 grams sugar per liter of solution per 1% alcohol. There are 198 grams sugar in a cup and sugar in solution reduces to about 5/8 cup. So 198 * 16 * 0.62 is is volume of sugar that the proposed wash volume is reduced by to find water volume.
Those calculators are written in javascript often. And javascript codes are open for the user. For example with firefox browser you can read the code by typing "view-source:" before the link. "view-source:https://homedistiller.org..." for example.
The estimated abv is normally calculated very simple: You need 17g/lt sugar for 1%abv.
To calculate the SG is done either by a formula or by datasets. Normally by a formula. This is the formula one of the hd claculators uses:
SG=Math.round(((258.6+(87.96*x/y))+Math.sqrt(66874+(7736.96*x*x/(y*y))+(57947*x/y)))/517.2 *1000)/1000;
x = kg sugar and y = lt total volume
Math.round means that it gives out a rounded value and Math.sqrt is the root function.
For computers of today more complicated formulas wouldn't be a problem. So it is a bit odd that such simple formulas still are used. But anyway, the success of fermentation can vary. So all in all it's all right this way.
I sent you a PM with the HTML source code. As Hugelwilli (huge Willy) said, it uses the SG equation above to calculate the approximate OG and assumes the final gravity (FG) is 1.000 to give you a "potential %ABV".
the bottle wrote: ↑Sun Feb 07, 2021 10:41 am
Thanks for all the advice & help, I was able to view the source code and reverse engineer it from there.It's not as pretty but it will do nicely.
I attached a pic if anyone else wants to create their own spreadsheet for this.
Screenshot 2021-02-07 at 1.37.07 PM.png
Having taught web design some 15+ years ago I did this a lot by reading others html code and then copy and tweeting it to fit my needs.