src/Utils.cpp

changeset 208
615afedbcd25
parent 195
9887278c4fbe
child 212
8b84dd3579ef
equal deleted inserted replaced
207:3b164a0aea90 208:615afedbcd25
340 return round((og * 1000 - fg * 1000) * factor * 100) / 100; 340 return round((og * 1000 - fg * 1000) * factor * 100) / 100;
341 } 341 }
342 342
343 343
344 double Utils::toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha, 344 double Utils::toIBU(int Use, int Form, double SG, double Volume, double Amount, double Boiltime, double Alpha,
345 int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6) 345 int Method, double Whirlpool9, double Whirlpool7, double Whirlpool6, double Fulltime)
346 { 346 {
347 double fmoment = 1.0, pfactor = 1.0, ibu = 0, boilfactor; 347 double fmoment = 1.0, pfactor = 1.0, ibu = 0, boilfactor;
348 double sgfactor, AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation; 348 double sgfactor, AddedAlphaAcids, Bigness_factor, BoilTime_factor, utiisation;
349 349
350 double gravity = SG; 350 double gravity = SG;
351 double liters = Volume; 351 double liters = Volume;
352 double alpha = Alpha / 100.0; 352 double alpha = Alpha / 100.0;
353 double mass = Amount * 1000.0; 353 double mass = Amount * 1000.0;
354 double time = Boiltime; 354 double time = Boiltime;
355 355
356 if ((Use == 3) || (Use == 4) || (Use == 5)) { // Aroma, Whirlpool or Dry hop. 356 if ((Use == HOP_USEAT_AROMA) || (Use == HOP_USEAT_WHIRLPOOL) || (Use == HOP_USEAT_DRY_HOP)) {
357 fmoment = 0.0; 357 fmoment = 0.0;
358 } else if (Use == 0) { // Mash 358 } else if (Use == HOP_USEAT_MASH) {
359 fmoment += my_factor_mashhop / 100.0; // Brouwhulp 359 fmoment += my_factor_mashhop / 100.0; // Brouwhulp
360 } else if (Use == 1) { // First wort 360 time = Fulltime; // Take the full boiltime
361 fmoment += my_factor_fwh / 100.0; // Brouwhulp, Louis, Ozzie 361 } else if (Use == HOP_USEAT_FWH) {
362 } 362 fmoment += my_factor_fwh / 100.0; // Brouwhulp, Louis, Ozzie
363 363 time = Fulltime;
364 if (Form == 0) { // Pellet 364 }
365
366 if (Form == HOP_FORMS_PELLET) {
365 pfactor += my_factor_pellet / 100.0; 367 pfactor += my_factor_pellet / 100.0;
366 } else if (Form == 1) { // Plug 368 } else if (Form == HOP_FORMS_PLUG) {
367 pfactor += my_factor_plug / 100.0; 369 pfactor += my_factor_plug / 100.0;
368 } else if (Form == 3) { // Wet leaf 370 } else if (Form == HOP_FORMS_LEAF_WET) {
369 pfactor += my_factor_wethop / 100.0; // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py 371 pfactor += my_factor_wethop / 100.0; // From https://github.com/chrisgilmerproj/brewday/blob/master/brew/constants.py
370 } else if (Form == 4) { // Cryo hop 372 } else if (Form == HOP_FORMS_CRYO) {
371 pfactor += my_factor_cryohop / 100.0; 373 pfactor += my_factor_cryohop / 100.0;
372 } 374 }
373 375
374 // Ideas from Zymurgy March-April 2018. These are not exact formulas! 376 // Ideas from Zymurgy March-April 2018. These are not exact formulas!
375 double whirlibus = 0.0; 377 double whirlibus = 0.0;
376 if (Use == 3 || Use == 4) { // Flameout or any whirlpool 378 if (Use == HOP_USEAT_AROMA || Use == HOP_USEAT_WHIRLPOOL) { // Flameout or any whirlpool
377 379
378 if (Whirlpool9) { 380 if (Whirlpool9) {
379 // 20 mg/l/50 min 381 // 20 mg/l/50 min
380 whirlibus += (alpha * mass * 20) / liters * (Whirlpool9 / 50.0); 382 whirlibus += (alpha * mass * 20) / liters * (Whirlpool9 / 50.0);
381 qDebug() << "Whirlpool9" << alpha * mass * 20 << " liter:" << liters << " time:" << Whirlpool9 << " ibu" << (alpha * mass * 20) / liters * (Whirlpool9 / 50.0); 383 qDebug() << "Whirlpool9" << alpha * mass * 20 << " liter:" << liters << " time:" << Whirlpool9 << " ibu" << (alpha * mass * 20) / liters * (Whirlpool9 / 50.0);

mercurial