src/global.h

changeset 158
24bc2de721d9
parent 154
1af9f7b7f317
child 159
231f5c8002e3
equal deleted inserted replaced
157:771b0b00092a 158:24bc2de721d9
2 #define _GLOBAL_H 2 #define _GLOBAL_H
3 3
4 #include <QList> 4 #include <QList>
5 #include <QString> 5 #include <QString>
6 #include <QTranslator> 6 #include <QTranslator>
7 #include <QDate>
7 8
8 9
9 #define Ka1 0.0000004445 10 #define Ka1 0.0000004445
10 #define Ka2 0.0000000000468 11 #define Ka2 0.0000000000468
11 12
27 #define MMCaOH2 74.06268 28 #define MMCaOH2 74.06268
28 29
29 #define SpecificHeatWater 1.0 30 #define SpecificHeatWater 1.0
30 #define SpecificHeatMalt 0.399 //cal/g.°C 31 #define SpecificHeatMalt 0.399 //cal/g.°C
31 #define SlakingHeat 10.318 //cal/g.°C 32 #define SlakingHeat 10.318 //cal/g.°C
32 #define eq_tun_weight 2.0 // 2 Kg pot 33 #define equip_tun_weight 2.0 // 2 Kg pot
33 #define eq_tun_specific_heat 0.110 34 #define equip_tun_specific_heat 0.110
34 35
35 36
36 struct Acid 37 struct Acid
37 { 38 {
38 QString name_en; 39 QString name_en;
44 double AcidSG; 45 double AcidSG;
45 double AcidPrc; 46 double AcidPrc;
46 }; 47 };
47 48
48 extern QList<Acid> my_acids; 49 extern QList<Acid> my_acids;
50
51 /*
52 * Fermentables, Hops, Miscs, Yeasts and Mashs are stored in the
53 * database in json arrays. These are the QList structures.
54 */
55 struct Fermentables
56 {
57 QString f_name;
58 QString f_origin;
59 QString f_supplier;
60 double f_amount;
61 double f_cost;
62 int f_type;
63 double f_yield;
64 double f_color;
65 double f_coarse_fine_diff;
66 double f_moisture;
67 double f_diastatic_power;
68 double f_protein;
69 double f_dissolved_protein;
70 double f_max_in_batch;
71 int f_graintype;
72 int f_added;
73 bool f_recommend_mash;
74 bool f_add_after_boil;
75 bool f_adjust_to_total_100;
76 double f_percentage;
77 double f_di_ph;
78 double f_acid_to_ph_57;
79 double f_inventory; ///< In product, current inventory.
80 bool f_avail; ///< Product available in database.
81 };
82
83
84 struct Hops
85 {
86 QString h_name;
87 QString h_origin;
88 double h_amount;
89 double h_cost;
90 int h_type;
91 int h_form;
92 int h_useat;
93 double h_time;
94 double h_alpha;
95 double h_beta;
96 double h_hsi;
97 double h_humulene;
98 double h_caryophyllene;
99 double h_cohumulone;
100 double h_myrcene;
101 double h_total_oil;
102 double h_inventory; ///< In product, current inventory.
103 bool h_avail; ///< Product available in database.
104 };
105
106
107 struct Miscs
108 {
109 QString m_name;
110 double m_amount;
111 int m_type;
112 int m_use_use;
113 double m_time;
114 bool m_amount_is_weight;
115 double m_cost;
116 double m_inventory; ///< In product, current inventory.
117 bool m_avail; ///< Product available in database.
118 };
119
120
121 struct Yeasts
122 {
123 QString y_name;
124 QString y_laboratory;
125 QString y_product_id;
126 double y_amount;
127 int y_type;
128 int y_form;
129 double y_min_temperature;
130 double y_max_temperature;
131 int y_flocculation;
132 double y_attenuation;
133 double y_cells;
134 double y_tolerance;
135 int y_use;
136 bool y_sta1;
137 bool y_bacteria;
138 bool y_harvest_top;
139 int y_harvest_time;
140 double y_pitch_temperature;
141 bool y_pofpos;
142 int y_zymocide;
143 int y_gr_hl_lo;
144 double y_sg_lo;
145 int y_gr_hl_hi;
146 double y_sg_hi;
147 double y_cost;
148 double y_inventory; ///< In product, current inventory.
149 bool y_avail; ///< Product available in database.
150 };
151
152
153 struct Mashs
154 {
155 QString step_name;
156 int step_type;
157 double step_volume; ///< The water volume upto this step.
158 double step_infuse_amount; ///< Infuse/decoction volume this step.
159 double step_infuse_temp; ///< Infuse/decoction temperature.
160 double step_temp; ///< Start tmperature this step.
161 double step_time; ///< Step rest time.
162 double ramp_time; ///< Estimated ramp time to this step.
163 double end_temp; ///< End temperature this step.
164 double step_wg_ratio; ///< Current water/grain ratio.
165 double step_ph; ///< In product, measured pH.
166 double step_sg; ///< In product, measured SG.
167 };
168
169
170 /*
171 * The main recipe record stored in the database.
172 */
173 struct Recipe
174 {
175 int record;
176 QString uuid;
177 bool locked;
178 QString st_name;
179 QString st_letter;
180 QString st_guide;
181 QString st_category;
182 int st_category_number;
183 int st_type;
184 double st_og_min;
185 double st_og_max;
186 double st_fg_min;
187 double st_fg_max;
188 double st_ibu_min;
189 double st_ibu_max;
190 double st_color_min;
191 double st_color_max;
192 double st_carb_min;
193 double st_carb_max;
194 double st_abv_min;
195 double st_abv_max;
196
197 QString name;
198 QString notes;
199 int type;
200 double batch_size;
201 double boil_size;
202 double boil_time;
203 double efficiency;
204 double est_og;
205 double est_fg;
206 double est_abv;
207 double est_color;
208 int color_method;
209 double est_ibu;
210 int ibu_method;
211 double est_carb;
212
213 double sparge_temp;
214 double sparge_ph;
215 double sparge_volume;
216 int sparge_source;
217 int sparge_acid_type;
218 double sparge_acid_perc;
219 double sparge_acid_amount;
220 double mash_ph;
221 QString mash_name;
222 bool calc_acid;
223
224 QString w1_name; ///< Water source 1
225 double w1_amount;
226 double w1_calcium;
227 double w1_sulfate;
228 double w1_chloride;
229 double w1_sodium;
230 double w1_magnesium;
231 double w1_total_alkalinity;
232 double w1_ph;
233 double w1_cost;
234 QString w2_name; ///< Water source 2
235 double w2_amount;
236 double w2_calcium;
237 double w2_sulfate;
238 double w2_chloride;
239 double w2_sodium;
240 double w2_magnesium;
241 double w2_total_alkalinity;
242 double w2_ph;
243 double w2_cost;
244 double wg_amount; ///< Mixed water
245 double wg_calcium;
246 double wg_sulfate;
247 double wg_chloride;
248 double wg_sodium;
249 double wg_magnesium;
250 double wg_total_alkalinity;
251 double wg_ph;
252 double wb_calcium; ///< Treated water
253 double wb_sulfate;
254 double wb_chloride;
255 double wb_sodium;
256 double wb_magnesium;
257 double wb_total_alkalinity;
258 double wb_ph;
259 int wa_acid_name;
260 double wa_acid_perc;
261 int wa_base_name;
262
263 QList<Fermentables> fermentables;
264 QList<Hops> hops;
265 QList<Miscs> miscs;
266 QList<Yeasts> yeasts;
267 QList<Mashs> mashs;
268
269 /*
270 * These are not in the MySL database, but are global variables
271 * that belong with the loaded recipe data and are present to
272 * make things easier.
273 */
274 int fermentables_row; ///< Current row, -1 is invalid.
275 bool fermentables_use100; ///< Use percentages instead of amount
276 int hops_row;
277 int miscs_row;
278 int yeasts_row;
279 int mashs_row;
280 double mashs_kg; ///< Kg fermentables in the mash.
281 int mashs_time; ///< Total mash time.
282 double preboil_sg;
283 };
284
285
286 /*
287 * The main product record stored in the database.
288 */
289 struct Product
290 {
291 int record;
292 QString uuid;
293 QString name;
294 QString code;
295 QDate birth;
296 int stage;
297 QString notes;
298 bool log_brew;
299 bool log_fermentation;
300 bool log_ispindel;
301 bool log_co2pressure;
302 int inventory_reduced;
303 bool locked;
304
305 QString eq_name;
306 QString eq_notes;
307 double eq_boil_size;
308 double eq_batch_size;
309 double eq_tun_volume;
310 double eq_tun_weight;
311 double eq_tun_specific_heat;
312 int eq_tun_material;
313 double eq_tun_height;
314 double eq_top_up_water;
315 double eq_trub_chiller_loss;
316 double eq_evap_rate;
317 double eq_boil_time;
318 bool eq_calc_boil_volume;
319 double eq_top_up_kettle;
320 double eq_hop_utilization;
321 double eq_lauter_volume;
322 double eq_lauter_height;
323 double eq_lauter_deadspace;
324 double eq_kettle_volume;
325 double eq_kettle_height;
326 double eq_mash_volume;
327 double eq_mash_max;
328 double eq_efficiency;
329
330 QDateTime brew_date_start;
331 double brew_mash_ph;
332 double brew_mash_sg;
333 double brew_mash_efficiency;
334 double brew_sparge_temperature;
335 double brew_sparge_volume;
336 double brew_sparge_est;
337 double brew_sparge_ph;
338 double brew_preboil_volume;
339 double brew_preboil_sg;
340 double brew_preboil_ph;
341 double brew_preboil_efficiency;
342 double brew_aboil_volume;
343 double brew_aboil_sg;
344 double brew_aboil_ph;
345 double brew_aboil_efficiency;
346 int brew_cooling_method;
347 double brew_cooling_time;
348 double brew_cooling_to;
349 double brew_whirlpool9;
350 double brew_whirlpool7;
351 double brew_whirlpool6;
352 double brew_whirlpool2;
353 double brew_fermenter_volume;
354 double brew_fermenter_extrawater;
355 double brew_fermenter_tcloss;
356 double brew_aeration_time;
357 double brew_aeration_speed;
358 int brew_aeration_type;
359 double brew_fermenter_sg;
360 double brew_fermenter_ibu;
361 double brew_fermenter_color;
362 QDateTime brew_date_end;
363
364 double og;
365 double fg;
366 double primary_start_temp;
367 double primary_max_temp;
368 double primary_end_temp;
369 double primary_end_sg;
370 QDate primary_end_date;
371 double secondary_temp;
372 double secondary_end_sg;
373 QDate secondary_end_date;
374 double tertiary_temp;
375
376 QDate package_date;
377 double package_volume;
378 double package_infuse_amount;
379 double package_infuse_abv;
380 double package_infuse_notes;
381 double package_abv;
382 double package_ph;
383 double bottle_amount;
384 double bottle_carbonation;
385 int bottle_priming_sugar;
386 double bottle_priming_amount;
387 double bottle_priming_water;
388 double bottle_carbonation_temp;
389 double keg_amount;
390 double keg_carbonation;
391 int keg_priming_sugar;
392 double keg_priming_amount;
393 double keg_priming_water;
394 double keg_carbonation_temp;
395 bool keg_forced_carb;
396 double keg_pressure;
397
398 QString taste_notes;
399 double taste_rate;
400 QDate taste_date;
401 QString taste_color;
402 QString taste_transparency;
403 QString taste_head;
404 QString taste_aroma;
405 QString taste_taste;
406 QString taste_mouthfeel;
407 QString taste_aftertaste;
408
409 QString st_name;
410 QString st_letter;
411 QString st_guide;
412 QString st_category;
413 int st_category_number;
414 int st_type;
415 double st_og_min;
416 double st_og_max;
417 double st_fg_min;
418 double st_fg_max;
419 double st_ibu_min;
420 double st_ibu_max;
421 double st_color_min;
422 double st_color_max;
423 double st_carb_min;
424 double st_carb_max;
425 double st_abv_min;
426 double st_abv_max;
427
428 int type;
429 double batch_size;
430 double boil_size;
431 double boil_time;
432 double efficiency;
433 double est_og;
434 double est_og3;
435 double est_fg;
436 double est_abv;
437 double est_color;
438 int color_method;
439 double est_ibu;
440 int ibu_method;
441 double est_carb;
442
443 double sparge_temp;
444 double sparge_ph;
445 double sparge_volume;
446 int sparge_source;
447 int sparge_acid_type;
448 double sparge_acid_perc;
449 double sparge_acid_amount;
450 double mash_ph;
451 QString mash_name;
452 bool calc_acid;
453
454 QString w1_name; ///< Water source 1
455 double w1_amount;
456 double w1_calcium;
457 double w1_sulfate;
458 double w1_chloride;
459 double w1_sodium;
460 double w1_magnesium;
461 double w1_total_alkalinity;
462 double w1_ph;
463 double w1_cost;
464 QString w2_name; ///< Water source 2
465 double w2_amount;
466 double w2_calcium;
467 double w2_sulfate;
468 double w2_chloride;
469 double w2_sodium;
470 double w2_magnesium;
471 double w2_total_alkalinity;
472 double w2_ph;
473 double w2_cost;
474 double wg_amount; ///< Mixed water
475 double wg_calcium;
476 double wg_sulfate;
477 double wg_chloride;
478 double wg_sodium;
479 double wg_magnesium;
480 double wg_total_alkalinity;
481 double wg_ph;
482 double wb_calcium; ///< Treated water
483 double wb_sulfate;
484 double wb_chloride;
485 double wb_sodium;
486 double wb_magnesium;
487 double wb_total_alkalinity;
488 double wb_ph;
489 int wa_acid_name;
490 double wa_acid_perc;
491 int wa_base_name;
492
493 bool starter_enable;
494 int starter_type;
495 double starter_sg;
496 int starter_viability;
497 QDate yeast_prod_date;
498 double yeast_pitchrate;
499 int prop1_type;
500 double prop1_volume;
501 int prop2_type;
502 double prop2_volume;
503 int prop3_type;
504 double prop3_volume;
505 int prop4_type;
506 double prop4_volume;
507
508 int divide_type;
509 double divide_size;
510 double divide_factor;
511 int divide_parts;
512 int divide_part;
513
514 QList<Fermentables> fermentables;
515 QList<Hops> hops;
516 QList<Miscs> miscs;
517 QList<Yeasts> yeasts;
518 QList<Mashs> mashs;
519
520 /*
521 * These are not in the MySL database, but are global variables
522 * that belong with the loaded product data and are present to
523 * make things easier.
524 */
525 int fermentables_row; ///< Current row, -1 is invalid.
526 bool fermentables_use100; ///< Use percentages instead of amount
527 int hops_row;
528 int miscs_row;
529 int yeasts_row;
530 int mashs_row;
531 double mashs_kg; ///< Kg fermentables in the mash.
532 int mashs_time; ///< Total mash time.
533 double preboil_sg;
534 };
535
536
537 extern Recipe *recipe;
49 538
50 extern QString my_brewery_name; 539 extern QString my_brewery_name;
51 extern QByteArray my_logoByteArray; 540 extern QByteArray my_logoByteArray;
52 extern int my_factor_mashhop; 541 extern int my_factor_mashhop;
53 extern int my_factor_fwh; 542 extern int my_factor_fwh;

mercurial