dilution calculator improvement

Distillation methods and improvements.

Moderator: Site Moderator

dilution calculator improvement

Postby hefezelle » Mon May 21, 2018 5:28 am

Heya,

i just realized that the dilution calculators on the parent site (both the old one and Rad's new one) don't account for volume contraction that happens when mixing water and alcohol. Sure enough we could come up with a calculator that factors that in, right?

You might think that it's only a tiny error that results from neglecting volume contraction, but say (as a far fetched example, granted) you were to take half a liter of 100% water, and half a liter of 100% ethanol, and mixed them together. You would assume (and be told by the calculators) that you'd get one liter of 50% ABV. But that's not true, you'd only get 0.97 liters of liquid, which means ABV is not 500mL/1000mL=50%, but rather 500mL/970mL=51.55%. So the calculation would be off by 1.5.
If we provide a calculator, why not have it as correct as possible?
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Mon May 21, 2018 5:48 am

But it's still 50%abv. Not 51.55%. The contradiction affects both, the ethanol and the water. You will measure 50% with your alcoholmeter

This is the reason, why many scientific papers have %abw numbers. Here this problem doesn't exist.
BTW, the azeotrope number we often quote is also abw (95.6%). In abv it's 97.2%. There is a thread about: viewtopic.php?f=1&t=54724
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Mon May 21, 2018 6:30 am

der wo wrote:But it's still 50%abv. Not 51.55%. The contradiction affects both, the ethanol and the water.


No i think it's 51.55%ABV, at least if using the definition given on the english wikipedia:
It is defined as the number of millilitres (mL) of pure ethanol present in 100 mL of solution at 20 °C (68 °F). The number of millilitres of pure ethanol is the mass of the ethanol divided by its density at 20 °C, which is 0.78924 g/mL.


So the way i read this is, and please correct me if i'm wrong here, that you take 1 liter of liquid, and ask: If i were to extract all the ethanol in there, how much volume would the resulting 100% alcohol have? Which, for a mixture of equal volumes of water and ethanol, would result in the mixture having 51.55% alcohol by volume as well as 51.55% water by volume. Am i wrong on this? :crazy:
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Mon May 21, 2018 12:21 pm

2 times 51.55%... This shows how problematic it is, to use abv in science. Only for practical reasons it seems to be useful, because the contraction effect is small.
https://en.wikipedia.org/wiki/Volume_fr ... me_percent
the term "40% alcohol by volume" refers to a mixture of 40 volume units of ethanol with enough water to make a final volume of 100 units, rather than a mixture of 40 units of ethanol with 60 units of water.
So 1l 40%abv means 400ml pure ethanol and a bit more than 600ml water.

On German wikipedia I find very interesting topics about this problem. I don't know how to find it in English:
https://de.wikipedia.org/wiki/Volumenprozent
Volumenprozent oder Volumprozent, in Österreich Volumsprozent, (Abkürzung bzw. Einheitenzeichen: Vol.-%,[1] % vol, % v/v und weitere Varianten) ist eine nicht normgerechte[2][3][4] Abwandlung der Hilfsmaßeinheit Prozent in Verwendung bei dimensionslosen Verhältnisgrößen, bei denen ein Volumen auf ein anderes Volumen bezogen wird (speziell bei den Gehaltsgrößen Volumenanteil f, Volumenkonzentration s und Volumenverhältnis ? zur Angabe des Gehalts eines Stoffes in einem Gemisch). Die konkret gemeinte Größe sollte eindeutig spezifiziert werden.
This means in short: volumen% is a non normalized variety ... this measure should get defined more precisely.

The problem is, what is meant with volume percent. It's simply a matter of definition. In German wikipedia there are articles about Volumenkonzentration (concentration), Volumenverhältnis (ratio) and Volumenanteil (fraction). Those are the theoretical ways to define a vol%. Each of them gives out different results, when you say "400ml ethanol filled up to 1000ml" for example.

One example from practice. Assuming that 70% on the alcoholmeter really means 700ml pure ethanol in 1l mixture:
I have distilled a brandy, my hearts are 10l at 70%abv. Now I want to dilute it to 40%. Without contraction it means I have to add 7.5l water. Then I have 17.5l with 40%abv. How far away is this from reality?
I have found a free app for this: "Home Moonshine" from Evgeny Kurepin. It's a Russian app, the English language setting is a bit funny, but it works. It says I have to add 7746ml water to 10l 70% and get 17.497l 40%.
Assuming this calculator is right, 7.5l and 7746ml is very different. So it looks like we need a new calculator.
But a calculator without taking the contraction into account still works very well like "for diluting X liters of Y%abv to Y2%abv, fill up the volume to X2 liters". But it doesn't work well like "for diluting X liters of Y%abv to Y2%abv, add X2 liters of water."
In other words: Don't calculate the water you have to add, but calculate the final volume. This is impractical when you want to dilute a large volume, because you don't have something like a 50l measuring container. But if you want dilute to fill a bottle, it's perfect and easy.

I feel a bit unsure, perhaps I will find a mistake in my thoughts tomorrow...
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby SaltyStaves » Mon May 21, 2018 2:31 pm

A new calculator may estimate a 3% contraction for a clean neutral, but what about a heavily peated new make spirit?
Congeners, oils etc are non-contracting, but they tally on the side of ethanol unless they are used in a separate equation.

I don't really know how much influence that would have. Someone a lot smarter than me would have to say whether or not the potential for error would be greater than just using the standard V/V calculation.
SaltyStaves
Swill Maker
 
Posts: 267
Joined: Sun Jun 14, 2015 5:18 pm
Location: Auckland, New Zealand

Re: dilution calculator improvement

Postby der wo » Tue May 22, 2018 2:45 am

Most congeners have a similar SG like water or ethanol. At least the congeners our spirits have in relative great amounts. And their threshold is low. Doesn't need much to smell them. Even the (very heavy) solids in aged spirits like caramel are not measurable with normal range hydrometers. Only extreme high Sherry levels in Malt Whiskies are perhaps measurable.

A heavily peated Whisky has 50ppm phenols. This means 0.005%.
A high ester rum has 300-600g/hlpa esters. This means 0.15-0.3%. And the main ester ethylacetate has a SG between ethanol and water, so it won't affect the measurement much in a water-ethanol mixture.
No way to measure such things by gravity.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby SaltyStaves » Tue May 22, 2018 3:47 am

If we can calculate contraction as being the same (or near enough) for both a clean neutral and a heavily new make with a deep tails cut etc, then I'd be happy with a new calculator.
SaltyStaves
Swill Maker
 
Posts: 267
Joined: Sun Jun 14, 2015 5:18 pm
Location: Auckland, New Zealand

Re: dilution calculator improvement

Postby der wo » Tue May 22, 2018 5:45 am

Yes, a better calculator would be nice. It's not easy to calculate the contraction AFAIK. Perhaps there is no formula, but only some empirically determined data? Similar like the wash abv, boiling temp and vapor abv calculators?
Here someone built an app with the help of the ADI forum:
http://adiforums.com/topic/6519-is-ther ... alculator/
Now he sells it for much money...
https://www.katmarsoftware.com/alcodens.htm
195$, only a trial is free.
The Russian app is for free.
Whatever, it would be great to have such a calculator on the parent site.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby der wo » Wed May 23, 2018 1:53 am

Probably a calculator would work like this:
10 liters of 70%abv diluted to 40%abv. How much water is needed?
At first we have to calculate the %abv into %abw and the liters into kg. For this there are charts:
https://www.hamm-chemie.de/j11/j11db/et ... emisch.pdf
We need a program fed with this data, which is able also to calculate also the data between the points. It would calculate, that 70%abv is around 62.5%abw and 40%abv is around 33.3%abw. And 10 liters 70%abv around 8.87kg
Then 8.87 x 62.5 = ? x 33.3
? = 8.87 x 62.5 / 33.3
? = 16.65kg
The brandy diluted to 40%abv will weigh 16.65kg.
16.65 - 8.87 = 7.78kg = 7.78 liter water have to be added.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Mon Jun 04, 2018 3:36 am

alright, so i played around in python3 a little.

i've used the data available online here, laid a spline interpolation over it since that seemed like a good choice to me, and used the resulting function with a lot of confusing unit conversions and a newton iteration to effectively get the inverse of the spline function, so that i can relate %abv to the water volume used.

the data it produces looks ok to me at first glance, but i may very well have made a mistake somewhere. any coders, scientists or python enthusiasts here that'd like to check my work? i've done my best make it readable and understandable.

here's the output:
READ MORE:
Code: Select all
To dilute one unit of 100%ABV to 100%ABV,add 0.0000 units of water.
To dilute one unit of 100%ABV to  95%ABV,add 0.0640 units of water.
To dilute one unit of 100%ABV to  90%ABV,add 0.1310 units of water.
To dilute one unit of 100%ABV to  85%ABV,add 0.2040 units of water.
To dilute one unit of 100%ABV to  80%ABV,add 0.2840 units of water.
To dilute one unit of 100%ABV to  75%ABV,add 0.3740 units of water.
To dilute one unit of 100%ABV to  70%ABV,add 0.4750 units of water.
To dilute one unit of 100%ABV to  65%ABV,add 0.5910 units of water.
To dilute one unit of 100%ABV to  60%ABV,add 0.7250 units of water.
To dilute one unit of 100%ABV to  55%ABV,add 0.8830 units of water.
To dilute one unit of 100%ABV to  50%ABV,add 1.0700 units of water.
To dilute one unit of 100%ABV to  45%ABV,add 1.2980 units of water.
To dilute one unit of 100%ABV to  40%ABV,add 1.5810 units of water.
To dilute one unit of 100%ABV to  35%ABV,add 1.9420 units of water.
To dilute one unit of 100%ABV to  30%ABV,add 2.4200 units of water.
To dilute one unit of 100%ABV to  25%ABV,add 3.0870 units of water.
To dilute one unit of 100%ABV to  20%ABV,add 4.0850 units of water.
To dilute one unit of 100%ABV to  15%ABV,add 5.7470 units of water.
To dilute one unit of 100%ABV to  10%ABV,add 9.0750 units of water.
To dilute one unit of 100%ABV to   5%ABV,add 19.068 units of water.
To dilute one unit of  90%ABV to  90%ABV,add 0.0000 units of water.
To dilute one unit of  90%ABV to  85%ABV,add 0.0650 units of water.
To dilute one unit of  90%ABV to  80%ABV,add 0.1370 units of water.
To dilute one unit of  90%ABV to  75%ABV,add 0.2180 units of water.
To dilute one unit of  90%ABV to  70%ABV,add 0.3090 units of water.
To dilute one unit of  90%ABV to  65%ABV,add 0.4140 units of water.
To dilute one unit of  90%ABV to  60%ABV,add 0.5350 units of water.
To dilute one unit of  90%ABV to  55%ABV,add 0.6760 units of water.
To dilute one unit of  90%ABV to  50%ABV,add 0.8450 units of water.
To dilute one unit of  90%ABV to  45%ABV,add 1.0500 units of water.
To dilute one unit of  90%ABV to  40%ABV,add 1.3050 units of water.
To dilute one unit of  90%ABV to  35%ABV,add 1.6290 units of water.
To dilute one unit of  90%ABV to  30%ABV,add 2.0600 units of water.
To dilute one unit of  90%ABV to  25%ABV,add 2.6600 units of water.
To dilute one unit of  90%ABV to  20%ABV,add 3.5580 units of water.
To dilute one unit of  90%ABV to  15%ABV,add 5.0540 units of water.
To dilute one unit of  90%ABV to  10%ABV,add 8.0490 units of water.
To dilute one unit of  90%ABV to   5%ABV,add 17.043 units of water.
To dilute one unit of  80%ABV to  80%ABV,add 0.0000 units of water.
To dilute one unit of  80%ABV to  75%ABV,add 0.0720 units of water.
To dilute one unit of  80%ABV to  70%ABV,add 0.1530 units of water.
To dilute one unit of  80%ABV to  65%ABV,add 0.2460 units of water.
To dilute one unit of  80%ABV to  60%ABV,add 0.3530 units of water.
To dilute one unit of  80%ABV to  55%ABV,add 0.4790 units of water.
To dilute one unit of  80%ABV to  50%ABV,add 0.6290 units of water.
To dilute one unit of  80%ABV to  45%ABV,add 0.8110 units of water.
To dilute one unit of  80%ABV to  40%ABV,add 1.0370 units of water.
To dilute one unit of  80%ABV to  35%ABV,add 1.3260 units of water.
To dilute one unit of  80%ABV to  30%ABV,add 1.7090 units of water.
To dilute one unit of  80%ABV to  25%ABV,add 2.2420 units of water.
To dilute one unit of  80%ABV to  20%ABV,add 3.0400 units of water.
To dilute one unit of  80%ABV to  15%ABV,add 4.3710 units of water.
To dilute one unit of  80%ABV to  10%ABV,add 7.0330 units of water.
To dilute one unit of  80%ABV to   5%ABV,add 15.027 units of water.
To dilute one unit of  70%ABV to  70%ABV,add 0.0000 units of water.
To dilute one unit of  70%ABV to  65%ABV,add 0.0810 units of water.
To dilute one unit of  70%ABV to  60%ABV,add 0.1750 units of water.
To dilute one unit of  70%ABV to  55%ABV,add 0.2860 units of water.
To dilute one unit of  70%ABV to  50%ABV,add 0.4170 units of water.
To dilute one unit of  70%ABV to  45%ABV,add 0.5760 units of water.
To dilute one unit of  70%ABV to  40%ABV,add 0.7740 units of water.
To dilute one unit of  70%ABV to  35%ABV,add 1.0270 units of water.
To dilute one unit of  70%ABV to  30%ABV,add 1.3620 units of water.
To dilute one unit of  70%ABV to  25%ABV,add 1.8280 units of water.
To dilute one unit of  70%ABV to  20%ABV,add 2.5270 units of water.
To dilute one unit of  70%ABV to  15%ABV,add 3.6910 units of water.
To dilute one unit of  70%ABV to  10%ABV,add 6.0200 units of water.
To dilute one unit of  70%ABV to   5%ABV,add 13.015 units of water.
To dilute one unit of  60%ABV to  60%ABV,add 0.0000 units of water.
To dilute one unit of  60%ABV to  55%ABV,add 0.0940 units of water.
To dilute one unit of  60%ABV to  50%ABV,add 0.2070 units of water.
To dilute one unit of  60%ABV to  45%ABV,add 0.3440 units of water.
To dilute one unit of  60%ABV to  40%ABV,add 0.5130 units of water.
To dilute one unit of  60%ABV to  35%ABV,add 0.7300 units of water.
To dilute one unit of  60%ABV to  30%ABV,add 1.0170 units of water.
To dilute one unit of  60%ABV to  25%ABV,add 1.4170 units of water.
To dilute one unit of  60%ABV to  20%ABV,add 2.0160 units of water.
To dilute one unit of  60%ABV to  15%ABV,add 3.0130 units of water.
To dilute one unit of  60%ABV to  10%ABV,add 5.0100 units of water.
To dilute one unit of  60%ABV to   5%ABV,add 11.006 units of water.
To dilute one unit of  50%ABV to  50%ABV,add 0.0000 units of water.
To dilute one unit of  50%ABV to  45%ABV,add 0.1140 units of water.
To dilute one unit of  50%ABV to  40%ABV,add 0.2550 units of water.
To dilute one unit of  50%ABV to  35%ABV,add 0.4360 units of water.
To dilute one unit of  50%ABV to  30%ABV,add 0.6750 units of water.
To dilute one unit of  50%ABV to  25%ABV,add 1.0080 units of water.
To dilute one unit of  50%ABV to  20%ABV,add 1.5070 units of water.
To dilute one unit of  50%ABV to  15%ABV,add 2.3390 units of water.
To dilute one unit of  50%ABV to  10%ABV,add 4.0020 units of water.
To dilute one unit of  50%ABV to   5%ABV,add 8.9990 units of water.
To dilute one unit of  40%ABV to  40%ABV,add 0.0000 units of water.
To dilute one unit of  40%ABV to  35%ABV,add 0.1440 units of water.
To dilute one unit of  40%ABV to  30%ABV,add 0.3360 units of water.
To dilute one unit of  40%ABV to  25%ABV,add 0.6020 units of water.
To dilute one unit of  40%ABV to  20%ABV,add 1.0020 units of water.
To dilute one unit of  40%ABV to  15%ABV,add 1.6670 units of water.
To dilute one unit of  40%ABV to  10%ABV,add 2.9980 units of water.
To dilute one unit of  40%ABV to   5%ABV,add 6.9950 units of water.
To dilute one unit of  30%ABV to  30%ABV,add 0.0000 units of water.
To dilute one unit of  30%ABV to  25%ABV,add 0.2000 units of water.
To dilute one unit of  30%ABV to  20%ABV,add 0.4990 units of water.
To dilute one unit of  30%ABV to  15%ABV,add 0.9980 units of water.
To dilute one unit of  30%ABV to  10%ABV,add 1.9970 units of water.
To dilute one unit of  30%ABV to   5%ABV,add 4.9940 units of water.
To dilute one unit of  20%ABV to  20%ABV,add 0.0000 units of water.
To dilute one unit of  20%ABV to  15%ABV,add 0.3330 units of water.
To dilute one unit of  20%ABV to  10%ABV,add 0.9980 units of water.
To dilute one unit of  20%ABV to   5%ABV,add 2.9970 units of water.
To dilute one unit of  10%ABV to  10%ABV,add 0.0000 units of water.
To dilute one unit of  10%ABV to   5%ABV,add 0.9990 units of water.


and here the actual code:
READ MORE:
Code: Select all
import numpy as np
from scipy import interpolate
from scipy.optimize import newton

# resolution used in plots
resolution = 500
# tolerance in newton iteration, in unit liters
tolerance = 0.0000001

# this data comes from
# https://en.wikipedia.org/wiki/Ethanol_(data_page)
waterMolarMass = 0.01801528 #in kilograms per mole
waterDensity = 0.99708 #in kilograms per liter @25°C
waterMolarVolume = waterMolarMass/waterDensity #in liter per mol @25°C
ethanolMolarMass = 0.046069 #in kilograms per mole
ethanolDensity = 0.78506 #in kilograms per liter @25°C
ethanolMolarVolume = ethanolMolarMass/ethanolDensity #in liter per mol @25°C

# excess volume of ethanol/wather mixtures. this data comes from
# http://www.ddbst.com/en/EED/VE/VE0%20Ethanol%3BWater.php
# which cites as original source
# Grolier J.-P.E.; Wilhelm E.: Excess Volumes and Excess Heat Capacities of Water + Ethanol at 298.15 K. Fluid Phase Equilib. 6 (1981) 283-287
# excess volume of 0.000 was added for pure substances by hand.
excVolByMoles = np.array([-0.0000,
                          -0.0500,
                          -0.0880,
                          -0.1510,
                          -0.2340,
                          -0.3200,
                          -0.4090,
                          -0.4870,
                          -0.5750,
                          -0.6420,
                          -0.7500,
                          -0.8840,
                          -0.9270,
                          -0.9860,
                          -1.0600,
                          -1.0680,
                          -1.0670,
                          -0.9990,
                          -0.6780,
                          -0.4540,
                          -0.2220,
                          -0.0000])
moleFractions = np.array([0.00000,
                          0.01280,
                          0.02130,
                          0.03410,
                          0.04960,
                          0.06510,
                          0.08070,
                          0.09540,
                          0.11310,
                          0.12780,
                          0.15600,
                          0.20380,
                          0.22670,
                          0.26310,
                          0.35050,
                          0.39540,
                          0.46190,
                          0.57450,
                          0.78050,
                          0.86650,
                          0.93730,
                          1.00000])

# make a smooth curve from the data points
spline = interpolate.splrep(moleFractions, excVolByMoles, s=0)

# this just makes the smooth curve into a function
def excVol(molFrac=0.0):
    """Calculate excess volume [L/mol] of a water-ethanol mixture.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    return interpolate.splev(np.array([molFrac]), spline, der=0)[0]/1000

def molFrac(ethanolVolume=1.0, waterVolume=1.0):
    """Get the mole fraction of ethanol in a mixture of known volumina of ethanol and water.

    Keyword arguments:
    ethanolVolume -- the volume of pure ethanol (default 1.0)
    waterVolume -- the volume of pure water (default 1.0)
    """
    assert ethanolVolume is not 0 or waterVolume is not 0
    ethanolMoles = ethanolVolume/ethanolMolarVolume
    waterMoles = waterVolume/waterMolarVolume
    return ethanolMoles/(ethanolMoles+waterMoles)

def abvMolar(molFrac):
    """Calculates ABV percentage from mole fraction of ethanol in water with volume contraction.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    ethanolVolume = molFrac*ethanolMolarVolume
    waterVolume = (1-molFrac)*waterMolarVolume
    mixtureVolume = ethanolVolume + waterVolume + excVol(molFrac)
    return ethanolVolume/mixtureVolume*100

def abv(ethanolVolume=1.0, waterVolume=1.0):
    """Get the abv percentage in a mixture of known volumina of ethanol and water.

    Keyword arguments:
    ethanolVolume -- the volume of pure ethanol (default 1.0)
    waterVolume -- the volume of pure water (default 1.0)
    """
    return abvMolar(molFrac(ethanolVolume, waterVolume))

def ethanolVolume(mixtureVolume=1.0, ABV=50):
    """Return the volume of pure ethanol in a mixture.

    Keyword arguments:
    mixtureVolume -- the volume of the mixture (default 1.0)
    ABV -- the percentage of ethanol by volume (default 50)
    """
    return mixtureVolume*ABV/100

def waterVolume(mixtureVolume=1.0, ABV=50):
    """Return the volume of pure water in a mixture.

    Keyword arguments:
    mixtureVolume -- the volume of the mixture (default 1.0)
    ABV -- the percentage of ethanol by volume (default 50)
    """
    # we know for certain how much ethanol there is
    ethanolVol = ethanolVolume(mixtureVolume, ABV)

    # make a guess how much water there is approximately
    firstGuess = mixtureVolume - ethanolVol

    # generate a function that has a zero at the precise volume of water
    functionToGetZero = lambda x: abv(ethanolVol, x) - ABV

    # use newton iteration to find that volume
    return newton(functionToGetZero, firstGuess, tol=tolerance)

def dilute(originalVolume=1.0, originalABV=50, targetABV=40):
    """Returns the volume of water needed to dilute a water-ethanol mixture.

    Keyword arguments:
    originalVolume -- the volume of the original mixture (default 1.0)
    originalABV -- the abv percentage of the original mixture (default 50)
    targetABV -- the abv percentage of the mixture after dilution (default 40)
    """
    # how much water is in there already?
    originalWaterVolume = waterVolume(originalVolume, originalABV)
    # how much water is in one unit of mixture of tagetABV?
    targetWaterVolumePerUnit = waterVolume(1, targetABV)
    # how much ethanol is in one unit of mixture of tagetABV?
    targetEthanolVolumePerUnit = ethanolVolume(1, targetABV)
    # how much ethanol was in the original mixture?
    originalEthanolVolume = ethanolVolume(originalVolume, originalABV)
   
    # amount of pure ethanol is constant, so we get the number of units:
    units = originalEthanolVolume/targetEthanolVolumePerUnit
    # and with that we get the final water volume
    targetWaterVolume = targetWaterVolumePerUnit*units

    return targetWaterVolume - originalWaterVolume


for origABV in range(100,0,-10):
    for targABV in range(origABV, 0, -5):
        print("To dilute one unit of {0:>3}%ABV to {1:>3}%ABV,\
add {2:0<6} units of water.".format(origABV, targABV,
                                   round(dilute(1, origABV, targABV),3)))


i'll make this into an interactive prompt, the list is just to check whether the data makes sense at all.
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Mon Jun 04, 2018 4:40 am

Can't say anything about coding and programming. And I don't know, how you calculated those numbers from the link. But when I look at the amounts you have to add if you want to dilute to the half abv, it's a bit strange:
- From 100% to 50% add 1.07. This sounds plausible for me.
- From 60% to 30% add 1.017. The lower the abv the less contraction when you dilute it. Sounds plausible. But the difference between 1.07 and 1.017 sounds huge for me. I am unsure.
- From 20% to 10% add 0.998. What??? Negative contraction? Expansion? Sounds impossible for me.

Funny thing is, that I get the same numbers by using the Russian Moonshine app... Perhaps you are right?


But with my calculation:
20%abv is 16.25%abw and has a SG of 0.9753
10%abv is 8%abw

? = 0.9753 x 16.25 : 8 = 1.981
1.981 - 0.9753 = 1.006
So I calculate 1.006 instead of your 0.998. And this sounds plausible. Low abv diluting also has contraction, but not much.
But this doesn't mean I am necessarily right.

If noone finds information about expansion when diluting alcohol, I think your calc and the Russian app both are wrong.

Perhaps this is interesting:
http://alcbevtesting.com/wp-content/upl ... nTable.pdf
A huge expansion from 30 -> 15%: 96.7!!! But nothing at 40 -> 20% or 20 -> 10%...
Last edited by der wo on Mon Jun 04, 2018 5:21 am, edited 1 time in total.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby der wo » Mon Jun 04, 2018 5:06 am

Just for fun I have downloaded the free trial of the expensive AlcoDens app and played a bit:

2%abv diluted to 1% -> 0.99996
4% to 2% -> 0.99985
10 to 5 -> 0.9992
20 to 10 0.99766
30 to 15 0.99752
40 to 20 1.0009
50 to 25 1.0079
60 to 30 1.0172
70 to 35 1.0275
80 to 40 1.0387
90 to 45 1.0519
96 to 48 1.0626
100 to 50 1.0731

Also here is expansion at low abv... Very strange...
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Mon Jun 04, 2018 11:21 am

der wo wrote:What??? Negative contraction? Expansion? Sounds impossible for me.
[...]
Also here is expansion at low abv... Very strange...

the volume anomality is strongest in the 50-80%ABV range, and diminishes when appeoaching 0 or 100%ABV. so if you're diluting 60%ABV down to 30%ABV, you are going from fairly compressed liquid to one with a lesser anomality, which means you need less water than one would expect. it's not an expansion relative to the pure substances, but is an expansion relative to the compressed 60%ABV. that's the explanation that comes to my mind.


der wo wrote:Perhaps this is interesting:
http://alcbevtesting.com/wp-content/upl ... nTable.pdf
A huge expansion from 30 -> 15%: 96.7!!! But nothing at 40 -> 20% or 20 -> 10%...

huh, the data on diluting low ABV from that sheet simply does not agree with the data that i ended up using. the sheet states that contraction does not occur at all in low ABV, which is why i'm more inclined to believe the data from Dortmund Data Base. i had tried to dig up the paper given as source for their data, but to no avail :(
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Mon Jun 04, 2018 11:38 am

To dilute one unit of 20%ABV to 10%ABV,add 0.9980 units of water.

1 unit + 0.9980 units result in 2 units. That's expansion.
Why 2 units? Simply because this is how %abv is defined. When you have 1 unit 20%abv and fill it up to 2 units, you have 2 units 10%abv.
If you need more than 1 unit water for doing this, it's contraction. If you need less, it's expansion.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Mon Jun 04, 2018 11:57 am

der wo wrote:1 unit + 0.9980 units result in 2 units. That's expansion.
Why 2 units? Simply because this is how %abv is defined. When you have 1 unit 20%abv and fill it up to 2 units, you have 2 units 10%abv.
If you need more than 1 unit water for doing this, it's contraction. If you need less, it's expansion.

yes, it is indeed expansion. but it's a matter of what you compare it to. when diluting 20% to 10%, the resulting liquid will be more volume that expected, but only because 20% has a whole lot less volume than expected when looking at the components individually, while 10% has only somewhat less volume than the sum of its components.

what i'm trying to say is: the surprising effect of expansion stems from comparing mixtures with different levels of compression anomalities (abnormal in respect to the volume of the pure substances, that is). it seems the usual lingo is to always use the pure substances as reference points. expansion happens, but only if you start with a mixed liquid.
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby aircarbonarc » Mon Jun 04, 2018 12:02 pm

Commercial distillers by law have to use weight to dilute, I guess ethanol is lighter than water. Even that they say has a slight margin or error. I use dilution tables from some site (brewers friend I think) I found which just goes by volume. Except i have found that alcohol does contract alot so I always go a bit over than have to worry about it under. I will find the weight calculator or tables and post that. Mostly it's just caveman science I use and ad water and keep double checking with the hydrometer till I'm happy. Except the hydrometer isn't accurate unless you put temperature into the equation so there is a margin for error there. I did see an electronic proof reader at a distillery which they said also has a margin of error and isnt legal for excise records.
long live Oldsmobile Aleros
aircarbonarc
Swill Maker
 
Posts: 420
Joined: Thu Oct 08, 2015 1:11 pm
Location: Mountains ocean and rain

Re: dilution calculator improvement

Postby der wo » Mon Jun 04, 2018 12:31 pm

When diluting 20 to 10%, the resulting volume will be exactly twice. This is how abv is defined. In 1 volume 20%abv you have 0.2 volumes pure ethanol. In 2 units 10%abv you also have 0.2 volumes pure ethanol.

But yes, I begin to have an idea, where perhaps my mistake is:
Compression is zero at 0% and 100%abv of course. From 0 to X% the compression rises. Also from 100% down to X% the compression rises. Compression means that if you could seperate the ethanol from the water, the sum of both volumes would be greater than the volume of the mixture. And X% is the point where the sum of both separated volumes and the volume of the mixture show the greatest difference.
So when I am below X% and dilute further, I get expansion. (Or when I am above X% and add alcohol)
Do you know what value the X is?

Next question is, why is my calculation with abw wrong?
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Mon Jun 04, 2018 11:32 pm

der wo wrote:So when I am below X% and dilute further, I get expansion. (Or when I am above X% and add alcohol)
Do you know what value the X is?

I've plotted the volume of a mixture relative to the sum of the components' volumina, as a function of abv. I'm using the Dortmund Data Base data.
relative_volume_by_abv.png



der wo wrote:Next question is, why is my calculation with abw wrong?

Can't see anything wrong with the calculation, but i'm surprised that 10%abv is 8%abw while 20%abv is more than double the %abw. That would mean the alcohol and water don't compress the same amount.
Also, the abw conversion doesn't agree with the volume chart above. 20%abv should be more compressed than 10%abv, per molecule of ethanol you need many more ("more" compared to what you expect when mixing pure substances, where you'd assume the volumina add up) molecules water in a mixture of 20%abv, and only a little more for 10%abv. So per mass unit alcohol, the should be well over the expected mass of water in 20abv%, and only a little over the expected mass in 10%abv, so you would need to add less water than expected, not more!
Another way to look at it, is to say the liquid will expand when diluting 20%abv to 10%abv, so you'll need less water.

Something else:
According to the graph, significant expansion should take place when diluting from 50%abv to 25%abv, but my text output says to pretty much add the same amount of water, which doesn't make sense. I think there's still something wrong with my code :(
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Tue Jun 05, 2018 1:46 am

All calcs say there is contraction from 50 to 25%. So perhaps there is a mistake before you made this graph? Perhaps something with calculating mol-numbers into abv-numbers?
mol should be easy to calculate into abw. But into abv?
Did you count in the temperature and pressure of the data?
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Tue Jun 05, 2018 3:01 am

der wo wrote:All calcs say there is contraction from 50 to 25%.

Huh, interesting. Might well be that there's a nasty misconception in my head that's telling me it should expand during dilution.


der wo wrote: So perhaps there is a mistake before you made this graph? Perhaps something with calculating mol-numbers into abv-numbers?

Could be, i'm looking into my conversions, testing them and simplifying where possible. At least one graph i get looks a lot like one that's on wikipedia made from the same data, so it seems the interpolation works fine. Don't yet know whether there's a bug at all or i'm just confused about the expansion :econfused:
Here's my graph that should be the same as the one on wikipedia. "X"es mark given data points, the curve is how i interpolate:
excess_volume_by_mole_fraction.png



der wo wrote:Did you count in the temperature and pressure of the data?

The data that my entire calculation hinges on, is for 25°C (as are therefor my results), and without a pressure statement, so i'm assuming it's for atmospheric pressure.


Simply because i made it, have another graph, that shows the volumes of pure water and pure alc to get to a unit volume of mixture. Difficult to see the contraction here, it shows how subtle of an effect it is:
component_volumes_by_abv.png


For anyone wanting to have a look at the code, i've restructured and simplified it, so i'll post the current state.
READ MORE:
Code: Select all
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
from scipy.optimize import newton

# resolution used in plots
resolution = 1000
# tolerance in newton iteration, in unit liters
tolerance = 0.0000001

# this data comes from
# https://en.wikipedia.org/wiki/Ethanol_(data_page)
waterMolarMass = 0.01801528 #in kilograms per mole
waterDensity = 0.99708 #in kilograms per liter @25°C
waterMolarVolume = waterMolarMass/waterDensity #in liter per mol @25°C
ethanolMolarMass = 0.046069 #in kilograms per mole
ethanolDensity = 0.78506 #in kilograms per liter @25°C
ethanolMolarVolume = ethanolMolarMass/ethanolDensity #in liter per mol @25°C

# excess volume of ethanol/wather mixtures. this data comes from
# http://www.ddbst.com/en/EED/VE/VE0%20Ethanol%3BWater.php
# which cites as original source
# Grolier J.-P.E.; Wilhelm E.: Excess Volumes and Excess Heat Capacities of Water + Ethanol at 298.15 K. Fluid Phase Equilib. 6 (1981) 283-287
# excess volume of 0.000 was added for pure substances by hand.
molarExcessVolumeInLiters = np.array([-0.0000,
                                      -0.0500,
                                      -0.0880,
                                      -0.1510,
                                      -0.2340,
                                      -0.3200,
                                      -0.4090,
                                      -0.4870,
                                      -0.5750,
                                      -0.6420,
                                      -0.7500,
                                      -0.8840,
                                      -0.9270,
                                      -0.9860,
                                      -1.0600,
                                      -1.0680,
                                      -1.0670,
                                      -0.9990,
                                      -0.6780,
                                      -0.4540,
                                      -0.2220,
                                      -0.0000])
moleFractions = np.array([0.00000,
                          0.01280,
                          0.02130,
                          0.03410,
                          0.04960,
                          0.06510,
                          0.08070,
                          0.09540,
                          0.11310,
                          0.12780,
                          0.15600,
                          0.20380,
                          0.22670,
                          0.26310,
                          0.35050,
                          0.39540,
                          0.46190,
                          0.57450,
                          0.78050,
                          0.86650,
                          0.93730,
                          1.00000])

# make a smooth curve from the data points
spline = interpolate.splrep(moleFractions, molarExcessVolumeInLiters, s=0)

# this just makes the smooth curve into a function
def excessMolarVolumeFromMoleFraction(molFrac=0.0):
    """Calculate excess volume [L/mol] of a water-ethanol mixture.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    return interpolate.splev(molFrac, spline, der=0)/1000

def individualVolumesFromMoleFraction(molFrac=0.0):
    """Returns the list [a, b] where a is the volume [L] of pure ethanol
and b the volume [L] of pure water in 1mol of mixture.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    ethanolVolume = ethanolMolarVolume*molFrac
    waterVolume = waterMolarVolume*(1-molFrac)
    return [ethanolVolume, waterVolume]

def totalVolumeFromMoleFraction(molFrac=0.0):
    """Calculate molar volume [L/mol] of a water-ethanol mixture.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    ethanolVolume, waterVolume = individualVolumesFromMoleFraction(molFrac)
    return ethanolVolume + waterVolume + excessMolarVolumeFromMoleFraction(molFrac)

def totalVolumeFromABV(ABV=0):
    return totalVolumeFromMoleFraction(moleFractionFromABV(ABV))

def relativeVolumeFromMoleFraction(molFrac=0.0):
    """Calculate volume [%] of a water-ethanol mixture, relative to the sum of volumes of the components.

    Keyword arguments:
    molFrac -- the mole fraction of ethanol in the mixture (default 0.0)
    """
    return totalVolumeFromMoleFraction(molFrac)/sum(individualVolumesFromMoleFraction(molFrac))*100

def moleFractionFromVolumes(ethanolVolume=1.0, waterVolume=1.0):
    ethanolMoles = ethanolVolume/ethanolMolarVolume
    waterMoles = waterVolume/waterMolarVolume
    return ethanolMoles/(ethanolMoles+waterMoles)

def moleFractionFromABW(ABW=0):
    ethanolMoles = ABW/ethanolMolarMass
    waterMoles = (100-ABW)/waterMolarMass
    return ethanolMoles/(ethanolMoles+waterMoles)

def moleFractionFromABV(ABV=0):
    ethanolVolume = pureEthanolVolumeFromABV(ABV)
    waterVolume = pureWaterVolumeFromABV(ABV)
    return moleFractionFromVolumes(ethanolVolume, waterVolume)

def abwFromMoleFraction(molFrac=0.0):
    ethanolMass = ethanolMolarMass*molFrac
    waterMass = waterMolarMass*(1-molFrac)
    return ethanolMass/(ethanolMass+waterMass)*100

def abwFromABV(ABV=0):
    return abwFromMoleFraction(moleFractionFromABV(ABV))

def abwFromVolumes(ethanolVolume=1.0, waterVolume=1.0):
    return abvFromMoleFraction(moleFractionFromVolumes(ethanolVolume, waterVolume))

def abvFromMoleFraction(molFrac=0.0):
    return individualVolumesFromMoleFraction(molFrac)[0]/totalVolumeFromMoleFraction(molFrac)*100

def abvFromABW(ABW=0):
    return abvFromMoleFraction(moleFractionFromABW(ABW))

def abvFromVolumes(ethanolVolume=1.0, waterVolume=1.0):
    return abvFromMoleFraction(moleFractionFromVolumes(ethanolVolume, waterVolume))

def pureEthanolVolumeFromABV(ABV=0):
    return ABV/100

def pureWaterVolumeFromABV(ABV=0):
    # we know for certain how much ethanol there is
    ethanolVol = pureEthanolVolumeFromABV(ABV)

    # make a guess how much water there is approximately
    firstGuess = 1 - ethanolVol

    # generate a function that has a zero at the precise volume of water
    functionToGetZero = lambda x: abvFromVolumes(ethanolVol, x) - ABV

    # use newton iteration to find that volume
    return newton(functionToGetZero, firstGuess, tol=tolerance)

def dilute(originalABV=50, targetABV=40):
    """Returns the volume of water needed to dilute a unit volume of water-ethanol mixture.

    Keyword arguments:
    originalABV -- the abv percentage of the original mixture (default 50)
    targetABV -- the abv percentage of the mixture after dilution (default 40)
    """
    # how much water is in there already?
    originalWaterVolume = pureWaterVolumeFromABV(originalABV)
    # how much water is in one unit volume of mixture of tagetABV?
    targetWaterVolumePerUnit = pureWaterVolumeFromABV(targetABV)
    # how much ethanol is in one unit volume of mixture of tagetABV?
    targetEthanolVolumePerUnit = pureEthanolVolumeFromABV(targetABV)
    # how much ethanol was in the original mixture?
    originalEthanolVolume = pureEthanolVolumeFromABV(originalABV)
   
    # amount of pure ethanol is constant, so we get the number of units:
    units = originalEthanolVolume/targetEthanolVolumePerUnit
    # and with that we get the final water volume
    targetWaterVolume = targetWaterVolumePerUnit*units

    return targetWaterVolume - originalWaterVolume

##for i in range(0,101):
##    print("abv:", i, "abv->mol->abv error:",abvFromMoleFraction(moleFractionFromABV(i))-i,
##          "abv->abw-abv error:", abvFromABW(abwFromABV(i))-i)


##for origABV in range(100,0,-10):
##    for targABV in range(origABV, 0, -5):
##        print("To dilute one unit of {0:>3}%ABV to {1:>3}%ABV,\
## add {2:0<6} units of water.".format(origABV, targABV,
##                                   round(dilute(origABV, targABV),3)))

xGrid = np.arange(0, 100, 100/resolution)
wVol = [pureWaterVolumeFromABV(x) for x in xGrid]
eVol = [pureEthanolVolumeFromABV(x) for x in xGrid]

ax = plt.subplot(111)
plt.plot(xGrid, wVol, label="pure water volume")
plt.plot(xGrid, eVol, label="pure ethanol volume")
plt.xlabel("ABV [%]")
plt.ylabel("component volume")
plt.title("unit volume ethanol/water mixture @25°C")
ax.legend()
plt.show()
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Tue Jun 05, 2018 3:44 am

A 20%abv solution is contracted a bit. Now we add water. The water is uncontracted of course.
By adding the water the 20% solution gets expanded and the added water gets contracted. Which effect is stronger?
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Tue Jun 05, 2018 4:18 am

der wo wrote:A 20%abv solution is contracted a bit. Now we add water. The water is uncontracted of course.
By adding the water the 20% solution gets expanded and the added water gets contracted. Which effect is stronger?

Thank you, that's exactly what i wasn't thinking of. Yes, now it makes perfect sense that contraction can happen when diluting. So it was a fundamental misconception that i had after all, thanks for pointing it out! :thumbup:
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby der wo » Tue Jun 05, 2018 5:55 am

Didn't thought it would help much. At least I am very confused.

I tried to find a similar thing like my pdf with the SG-abw-abv, but no chance. I found some abw-abv calculators for brewers. But most of them calculate bullshit when feeding them with high% numbers. For example here:
http://www.beertutor.com/tools/abv_calculator.shtml
96%abv is 76.8%abw :lol:

This calc sounds better:
https://www.omnicalculator.com/other/alcohol-by-volume
96.1%abv = 95.11%abw, my pdf says 94%abw
80.4 = 76.4, my pdf 74
59.8 = 54, my pdf 52
39.6 = 34.09, my pdf 33
19.7 = 16.22, my pdf 16
10 = 8.06, my pdf 8.06

Strong differences. I don't see any method to find out, if the calculator or the pdf is wrong.


I found this in German language:
http://pxp-wien.pharmxplorer.at/uebunge ... ck0105.php
And there are a few interesting links:
http://pxp-wien.pharmxplorer.at/uebunge ... lg_XXX.pdf
http://pxp-wien.pharmxplorer.at/uebunge ... g_XXXI.pdf
The abv-abw data looks like the same like my pdf. The abw-SG data is a bit different, but very similar.
And here a calculator based on those datas:
http://pxp-wien.pharmxplorer.at/uebunge ... 0105a1.php

For me it looks like in those links are all the answers. There are a few calculation examples, which exactly cover our topic.
Sorry for my bad English!
agitator, rummager, no more scorching grain
I often write about using chemicals like for example sulfuric acid. Some are very dangerous. Before you use them, inform yourself about what you can do to work safely with them.
User avatar
der wo
Master Distiller
 
Posts: 3749
Joined: Mon Apr 13, 2015 2:40 am
Location: Germany

Re: dilution calculator improvement

Postby hefezelle » Tue Jun 05, 2018 12:43 pm

der wo wrote:This calc sounds better:
https://www.omnicalculator.com/other/alcohol-by-volume
96.1%abv = 95.11%abw, my pdf says 94%abw
80.4 = 76.4, my pdf 74
59.8 = 54, my pdf 52
39.6 = 34.09, my pdf 33
19.7 = 16.22, my pdf 16
10 = 8.06, my pdf 8.06

Strong differences. I don't see any method to find out, if the calculator or the pdf is wrong.

Running the numbers you used through my calculator, i get abw percentages that are pretty much identical to the ones in your pdf. I did some more testing and error checking on my calculator, and am now convinced that my method and calculations are correct. So the values i get should be as dependable and correct as the original data i derive them from.



Nice links, thank you. Over the next few days my plan is to compare that data with the one from Dortmund Data Base, and to combine them should they agree, or otherwise provide another calculation based on Österreichisches Arzneibuch. It's a pretty neat pdf by the way, if you're into pharmaceutical products and the standardized processes used in testing them. It can be found online here, but for people not capable of reading german, only some tables might be of value, such as the ones you posted.
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)

Re: dilution calculator improvement

Postby hefezelle » Thu Jul 12, 2018 12:04 am

I still have to play around with the other, more extensive data set, haven't come around to doing that.

But i have expanded my conversion calculator a fair bit, to a point where it might be of use not just for dilution, but also for unit conversions. It now has a command line interface, have a look at a typical use:
alculator_screenshot.png

The difficult thing is, you need python3 with the scipy addon to run it. I tried compiling the code to a standalone .exe, but that proves to be complicated. Does anyone know if there is a way to get a command line tool to be useful, for example by running it on the server and making it accessible in-browser? The other two options, a) have everyone who wants to use it install 500MB of python, or b) i rewrite the whole damn thing in C, those options both don't look too good to me.
Everything should be made as simple as possible, but not simpler.
I am writing the Tried And True Recipe Book pdf and appreciate critique!
hefezelle
Novice
 
Posts: 37
Joined: Tue Mar 06, 2018 3:24 am
Location: Austria (as in Mozart, not Koalas!)


Return to Research and Theory



Who is online

Users browsing this forum: No registered users and 2 guests