BeerBrewHelpers
API - Planning tools
BeerBrewHelpers.SpecificGravity
— TypeSpecificGravity
Store specific gravity in its scientific form (e.g 1.050). Can be constructed either by SpecificGravity(1.050)
or SpecificGravity(1050)
.
The alias SG
can be used.
Examples
julia> SpecificGravity(1050)
SG 1050
julia> SpecificGravity(1.050)
SG 1050
julia> SG(1.050)
SG 1050
BeerBrewHelpers.setprintmode
— Functionsetprintmode(mode)
Set the printing of SG
to either "SG 1000" or "SG 1.000" form. See Examples for details. Default is 0.
Examples
julia> SG(1234)
SG 1.2340
julia> setprintmode(0)
Print mode is set to SG 1.0000
julia> SG(1234)
SG 1.2340
julia> setprintmode(1)
Print mode is set to SG 1000
julia> SG(1234)
SG 1234
BeerBrewHelpers.plato2sg
— Functionplato2sg(plato)
Convert Plato° to specific gravity.
Examples
julia> plato2sg(12)
SG 1048
BeerBrewHelpers.sg2plato
— Functionsg2plato(sg::Number)
Convert specific gravity to Plato°. This method accepts numbers.
Examples
julia> sg2plato(1.050)
12.38764712500003
sg2plato(sg::SG)
A method for converting specific gravity to Plato°, that accepts SpecificGravity
.
Examples
julia> sg2plato(SG(1050))
12.38764712500003
BeerBrewHelpers.gravitycorrection
— Functiongravitycorrection(currentg::SG, targetg::SG, currentvol; boiloffr=nothing)
Calculate the needed correction to achieve targetg
gravity.
If boiloffr
boil-off rate is given, and wort should be boiled off, the needed boil time is also calculated.
Arguments
currentg::SG
: current specific gravity.targetg::SG
: target specific gravity.currentvol
: current volume in L.boiloffr=nothing
: boil-off rate in L/h (ornothing
).
Examples
julia> gravitycorrection(SG(1050), SG(1025), 1)
Dilute with 1.00L water.
1.0000000000000089
julia> gravitycorrection(SG(1050), SG(1075), 1)
Boil off 0.33L water.
-0.33333333333333237
julia> gravitycorrection(SG(1050), SG(1075), 1, boiloffr=2.5)
Boil off 0.33L water. With 2.5L/h: 0.13 hours (8 minutes).
-0.33333333333333237
BeerBrewHelpers.mixwort
— Functionmixwort(sg1::SG, v1, sg2::SG, v2)
Calculate the resulting wort's gravity when mixing the given the liquids.
Arguments
sg1::SG
: specific gravity of liquid 1.v1
: volume (in L) of liquid 1.sg2::SG
: specific gravity of liquid 2.v2
: volume (in L) of liquid 2.
Examples
julia> mixwort(SG(1050), 1, SG(1000), 1)
(sg = SG 1025, vol = 2)
julia> mixwort(SG(1050), 1, SG(1100), 1)
(sg = SG 1075, vol = 2)
julia> mixwort(SG(1080), 10, SG(1200), 5)
(sg = SG 1120, vol = 15)
BeerBrewHelpers.gristratio
— Functiongristratio(maltweights)
For an array of weights, print the ratio of every malt. Use the same unit, but only the value is needed.
Examples
julia> gristratio([3500, 500])
3500 --> 87.5%
500 --> 12.5%
julia> gristratio([7700, 1200])
7700 --> 86.5%
1200 --> 13.5%
BeerBrewHelpers.mdwort
— Functionmdwort(sg::SpecificGravity, vwort, vwater)
mdwort
is a shorthand for measure diluted wort. In the calculation only the ratio of the volumes of the liquids matter, so it's sufficient to pass their ratio to the function.
Arguments
sg::SpecificGravity
: specific gravity of the measured wortvwort
: volume of the wort to be diluted.vwater
: volume of water used for diluting.
Examples
julia> mdwort(SG(1025), 1, 2)
SG 1.0750
julia> mixwort(SG(1.075), 1, SG(1), 2) # check back
(sg = SG 1.0250, vol = 3)
BeerBrewHelpers.kettlevol
— Functionkettlevol(kd, kh, mh; unit=:cm)
Calculate the volume of wort in the kettle. All arguments must have the same unit. Returns the volume in m^3, and prints it in liters.
Arguments
kd
: (inner) kettle diameter.kh
: (inner) kettle height.mh
: (inner) measured "height" of the wort: from the top of the kettle to the top of the wort.unit=:cm
: can be:mm
,:cm
,:dm
,:m
.
Examples
julia> kettlevol(2.5, 3, 2, unit=:dm)
Wort volume: 4.91l
0.0049087385212340535
BeerBrewHelpers.dme2sugar
— Functiondme2sugar(dme)
Calculate the "equivalent" of dme
gramms of DME in gramms of sucrose.
Examples
julia> dme2sugar(1)
0.9565217391304348
julia> 44/46
0.9565217391304348
BeerBrewHelpers.sgvol2sugar
— Functionsgvol2sugar(sg::SG, vol)
How much sugar (sucrose) is needed to get vol
liters of liquid with sg
gravity. Result is in gramms.
Examples
julia> sgvol2sugar(SG(1384), 1) # sucrose pkl is 384, so this should be 1000
999.9999999999997
BeerBrewHelpers.raisesgbysugar
— Functionraisesgbysugar(sgpoints, vol)
How much sugar (sucrose) is needed to raise the gravity of vol
volume liquid by sgpoints
points. Result is in gramms.
Examples
julia> raisesgbysugar(384, 1)
1000.0
BeerBrewHelpers.sgofsugarliq
— Functionsgofsugarliq(sugar, vol)
Calculate the SG of a liquid mixed from vol
liters of water and sugar
gramms of sugar (sucrose).
Examples
julia> sgofsugarliq(1000, 1)
SG 1384
julia> sgofsugarliq(1000, 0.5)
SG 1768
BeerBrewHelpers.info
— Functioninfo()
Print the available functions.
Examples
julia> info()
The following functions are available for use:
SG(1050) and setprintmode(0)
plato2sg(5.5)
sg2plato(SG(1050)) and sg2plato(1050)
gravitycorrection(SG(1050), SG(1025), 1)
mixwort(SG(1050), 1, SG(1000), 1)
gristratio([3500, 500])
mdwort(SG(1025), 1, 2)
kettlevol(2.5, 3, 2, unit=:dm)
dme2sugar(), sgvol2sugar(), raisesgbysugar() and sgofsugarliq()
info(): this help
API - iSpindel log process
These functions process logs from ispindel-tracked fermentations.
BeerBrewHelpers.processlogfile
— Functionprocesslogfile(fname)
Process a logfile. Return with a NamedTuple
with keys: "date", "sg", "temperature", "angle", "battery", "plato"
. Log entries without an "angle" field will be filtered.
BeerBrewHelpers.processtuyalogfile
— Functionprocesstuyalogfile(fname)
Process a Tuya-Inkbird logfile. Return with a NamedTuple
with keys: "date", "temperature", "set_temperature"
. Log entries without an "cur_temp" field will be filtered.
BeerBrewHelpers.masg
— Functionmasg(dates, sg, stepsize)
Moving average of gravity. A pretty stupid implementation.
BeerBrewHelpers.promasg
— Functionpromasg(logfiletuple::NamedTuple, window::Hour)
Moving average of gravity. A different implementation, but I think still doesn't comply with moving average's definition. But it's smarter: goes through the data in window
-sized steps and calculates the mean of the window
before every step.