Thu, 30 Jun 2022 10:38:03 +0200
Translated to English.
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | #ifndef _UTILS_H |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | #define _UTILS_H |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | |
57
75d11cc05ce4
Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
42
diff
changeset
|
4 | #include <QString> |
95
ef6048186cb3
Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
5 | #include <QColor> |
57
75d11cc05ce4
Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
42
diff
changeset
|
6 | |
134
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
7 | // #define Ka1 0.0000004445 |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
8 | // #define Ka2 0.0000000000468 |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
9 | |
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | /** |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * @namespace Utils |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * @brief Global math functions. |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | */ |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | namespace Utils { |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | double lintner_to_kolbach(double lintner); |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | double kolbach_to_lintner(double kolbach); |
42
88e827ea7172
Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
20 | double ebc_to_srm(double ebc); |
88e827ea7172
Fixed recommend mash checkmark in fermentable editor. Added fermentables XML export.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
21 | double srm_to_ebc(double srm); |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
22 | double get_kt(int ebc); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
23 | double plato_to_sg(double plato); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
24 | double sg_to_plato(double sg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
25 | double brix_to_sg(double brix); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
26 | double sg_to_brix(double sg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
27 | double brix_to_fg(double o_plato, double refracto); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
28 | double calc_svg(double og, double fg); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
29 | double estimate_sg(double sugars, double batch_size); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
30 | double estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
31 | double kw_to_srm(int colormethod, double c); |
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
32 | double kw_to_ebc(int colormethod, double c); |
168
4bc92122d001
Added kw_to_newebc function to debug EBC differences.
Michiel Broek <mbroek@mbse.eu>
parents:
135
diff
changeset
|
33 | double kw_to_newebc(int colormethod, double c); |
102
b017001850df
Almost finished calcFermentables()
Michiel Broek <mbroek@mbse.eu>
parents:
98
diff
changeset
|
34 | double abvol(double og, double fg); |
125
2e79e0975e58
Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
35 | double toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha, |
208
615afedbcd25
Fixed 0 IBU for First Wort Hop or Mashhop is used.
Michiel Broek <mbroek@mbse.eu>
parents:
168
diff
changeset
|
36 | int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime); |
125
2e79e0975e58
Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
37 | double hopFlavourContribution(double bt, double vol, int use, double amount); |
2e79e0975e58
Start hops table display. The calculated preboil_sg value is stored global in memory. Added calculations for IBU, hop flavour and aroma.
Michiel Broek <mbroek@mbse.eu>
parents:
102
diff
changeset
|
38 | double hopAromaContribution(double bt, double vol, int use, double amount); |
57
75d11cc05ce4
Added profile fermentation tables and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
42
diff
changeset
|
39 | QString hours_to_string(int hours); |
212
8b84dd3579ef
Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents:
208
diff
changeset
|
40 | double kettle_cm(double volume, double kettle_volume, double kettle_height); |
8b84dd3579ef
Added calculation tools to measure volume in the boil kettle using measured centimeters.
Michiel Broek <mbroek@mbse.eu>
parents:
208
diff
changeset
|
41 | double kettle_vol(double cm, double kettle_volume, double kettle_height); |
98
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
42 | |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
43 | /** |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
44 | * @brief Map SRM color to RGB and return as QColor. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
45 | * @param srm The srm value. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
46 | * @return QColor |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
47 | */ |
95
ef6048186cb3
Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
48 | QColor srm_to_color(int srm); |
98
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
49 | |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
50 | /** |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
51 | * @brief Map EBC color to RGB and return as QColor. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
52 | * @param ebc The ebc value. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
53 | * @return QColor |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
54 | */ |
95
ef6048186cb3
Added part of a beercolor plugin that needs a lot of work. Added some rangesliders in the recipe editor. Added EBC and SRM color mapping to QColor.
Michiel Broek <mbroek@mbse.eu>
parents:
57
diff
changeset
|
55 | QColor ebc_to_color(int ebc); |
98
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
56 | |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
57 | /** |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
58 | * @brief Map SRM color to a QString for stylesheets. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
59 | * @param srm The srm value. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
60 | * @return A QString with stylesheet colors. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
61 | */ |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
62 | QString srm_to_style(int ebc); |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
63 | |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
64 | /** |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
65 | * @brief Map EBC color to a QString for stylesheets. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
66 | * @param ebc The ebc value. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
67 | * @return A QString with stylesheet colors. |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
68 | */ |
1425bf3e18ed
Solved the segmentation fault when viewing recipes twice. Set colored display for the EBC color fields using a modified dynamic stylesheet.
Michiel Broek <mbroek@mbse.eu>
parents:
95
diff
changeset
|
69 | QString ebc_to_style(int srm); |
134
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
70 | |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
71 | /** |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
72 | * @brief Mix water volumes and ingredients. |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
73 | * |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
74 | */ |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
75 | double mix(double v1, double v2, double c1, double c2); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
76 | |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
77 | /** |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
78 | * @brief Return mg/l as CaCO3 |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
79 | */ |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
80 | double ResidualAlkalinity(double total_alkalinity, double calcium, double magnesium); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
81 | |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
82 | double PartCO3(double pH); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
83 | |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
84 | double PartHCO3(double pH); |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
85 | |
5099df8ba6c6
Moved the mix function to Utils. Added some calculations to Utils. Added defines to global.h.
Michiel Broek <mbroek@mbse.eu>
parents:
133
diff
changeset
|
86 | double Charge(double pH); |
135
e68b27ad8a40
Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
87 | |
e68b27ad8a40
Added dutch translations to the internal acids array. Added slot for calc_acid checkbox. Added more water calculations. The miscs amount fields now have two decimal digits. Show treated waters and good/bad indicators.
Michiel Broek <mbroek@mbse.eu>
parents:
134
diff
changeset
|
88 | double CalcFrac(double TpH, double pK1, double pK2, double pK3); |
20
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | } |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | |
fcbbddcc22c1
Completed the Fermentables editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | #endif |