Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
315 stars 135 forks source link

Adding IBU calculation for whirlpool - request for comments in code and strategy used #414

Open marcelobarrosalmeida opened 6 years ago

marcelobarrosalmeida commented 6 years ago

Hello

After starting making NEIPAs, it was required to calculate the IBU from late hoppings, I mean, hops added during whirlpool, in flameout. I saw that beersmith calculates these hop additions but it is used a rough approximation where an utilization factor is applied. So I decided to implement the strategy described in this article.

Several (small) changes were required to this approach:

At this moment, I believe the code is working as expected. However, we have some UI issues:

Wrapping up, I would request help with:

Thanks a lot

Marcelo Barros

My repository and some screenshots:

https://github.com/marcelobarrosalmeida/brewtarget/tree/ibu_whirlpool

equp

table

pricelessbrewing commented 6 years ago

If we're going to do this, then I think a variable for whirlpool temperature should be included, ideally something step based that would include ramp time, step time, and step temp.

As well as a couple user variables to adjust the utilization curve.

Whirlpool utilization at 85C, and temperature of zero hop utilization.

Continue isomerization of boil hop additions during the whirlpool.

marcelobarrosalmeida commented 6 years ago

Hi Pricelessbrewing

Of course we ned to discuss how to create this feature, it was the original idea to create this issue. However, for flameout/whirlpool technique, people just turn the heating element off after boiling and wait sometime. During this time, hops continue to contribute to bitterness. In general, they do not use ramps.

But, time and temperature are related in whirlpool. We can specify the target temperature (above 85C, in general, some people use 82C) and your tun will take some time to reach it (it is possible to estimate this time, using tun diameter). This could be the whirlpool time. Or you can set a duration and it is possible to calculate if it is feasible or not (the duration must be smaller than the time to reach 85C).

Marcelo

pricelessbrewing commented 6 years ago

Some brewers let it cool to whirlpool temperature naturally by turning the flame off. Some brewers will use their chiller to cool to whirlpool temp then let it cool slowly during the whirlpool. Some brewers with herms/rims will cool then supply a low heat to maintain their whirlpool temp.

Additionally a ramp timer based step could be used to simulate the no chill process.

Super excited about getting this added.

marcelobarrosalmeida commented 6 years ago

Ok, so we have three different situations.

Situation 1) natural cooling after flameout (the case developed by me and with math support) Situation 2) use chiller to cool for other whirlpool temp (needs math support) Situation 3) ramps (needs math support)

Some practical questions:

Situation 1) I cited a successive update calls after calling equipment editor. Why ? Is there an update after changing each parameter in equipment editor ? I couldn't understand. Any tips @rocketman768 ? Situation 2 and 3): Is there any good reference indicating how to calculate these cases ?

How about finishing the first case while we discuss the other two ? Only this first case will make brewtarget better than the others tools in the market.

marcelobarrosalmeida commented 6 years ago

I believe I found the origin of several updates for IBU calcs. It is called for each property set in EquipmentEditor::save() .

pricelessbrewing commented 6 years ago

This covers the existing brewtarget options well. I didn't review the code in pr #415 , but if it matches the linked articles it should be fine. I would recommend adding an additional user input field for final whirlpool temp, and using that in the formula, or else to impliment a whirlpool designer. Additionally, a description will need to be added in the tooltips to indicate that this is only intended to support free fall whirlpools and not force chilled whirlpools.

Correct me if I'm wrong @marcelobarrosalmeida, I believe this currently covers only situations where the whirlpool process is as follows

  1. Boil ends
  2. Whirlpool begins, and will last for X amount of minutes (as defined in equipment editor).
  3. No chiller is used, and the wort is allowed to cool naturally in accordance with newtons law of cooling as per the article which is calculated using the kettle diameter in the equipment editor.
  4. At the end of the whirlpool, the wort is assumed to be chilled immediately.

If so, this should be covered sufficiently. I'll need to do some testing but I think that looks good.

Any additional situations, 1-3, will require a process tab similar to the Mash section, where a stepwise process is supported, which would be great, but will require a good deal more work. (Create new tab for whirlpool, allow use to add/delete steps, ramp time, target temp, duration, edit hop additions to either designate a whirlpool step integer, or else determine the addition timing based on the hop addition time and the total duration of all whirlpool steps).

In general, I'm not a fan of recipe process variable being tied to the equipment profile, as it clutters the equipment editor and requires user to create multiple duplicate equipment profiles to cover any given recipe. But this seems to be an unpopular opinion as most softwares tie these two together, although that may be due to following precedence from other softwares (beersmith/promash etc)..

Relevant online calculator for this from Alchemy overlord (linked by OP)

https://jphosom.github.io/alchemyoverlord/

marcelobarrosalmeida commented 6 years ago

Yes, the proposed situation is as you described. And I agree that should be better to have different "cooling profiles" that could be attached to the recipe. What I am proposing could be one of these profiles. However, it is necessary to understand how each cooling profile behaves (whirlpool, no chill, cooling ramps...) and go deeper in source code modifications. At his moment, I do not have all the necessary knowledge about the other processes and source code (there are some parts that I couldn't understand yet) but I can help, of course.

pricelessbrewing commented 6 years ago

Not sure if these comments belong in #418 or here, but I'm putting them here to avoid cluttering the pull request.

Fairly new to the organization, so could be getting this wrong but

Unit type of length should probably be distance, for generalization and in accordance with unit conventions. A little strange to use a Length unit type to describe a variable of diameter. This also allows it to be used elsewhere and avoid confusion.

The settings for whirlpool don't really belong in a mashtun group, since it's a kettle variable.

Suggestion: Regroup equipment according to equipment type (kettle vs mashtun).

Move grain absorption to mashtun.

Rename water and boiling to kettle.

Move kettle to fermenter losses to kettle group, rename as Post boil losses or kettle losses or similar.

Move lauter deadspace to mashtun group, rename as mashtun losses.

pricelessbrewing commented 6 years ago

@marcelobarrosalmeida I see you closed #418, can you give a quick status update when you get a chance?