# HG changeset patch # User Michiel Broek # Date 1542018736 -3600 # Node ID 0a39cbdcf085a19ce21c2ab616feb486a0c25d78 # Parent 7f1d0abe557147a5ccf72e0f605fe5560ac74df2 Added ABV clculation. diff -r 7f1d0abe5571 -r 0a39cbdcf085 www/import/from_brouwhulp.php --- a/www/import/from_brouwhulp.php Sun Nov 11 23:15:46 2018 +0100 +++ b/www/import/from_brouwhulp.php Mon Nov 12 11:32:16 2018 +0100 @@ -837,6 +837,8 @@ $sql .= "', est_og='" . floatval($og); $fg = estimate_fg($pSugar, $pCara, 0, 0, 0, $svg, $og); $sql .= "', est_fg='" . floatval($fg); + $abv = abvol($og, $fg); + $sql .= "', est_abv='" . floatval($abv); $sql .= "';"; if (! $result = mysqli_query($db, $sql)) { diff -r 7f1d0abe5571 -r 0a39cbdcf085 www/includes/formulas.php --- a/www/includes/formulas.php Sun Nov 11 23:15:46 2018 +0100 +++ b/www/includes/formulas.php Mon Nov 12 11:32:16 2018 +0100 @@ -163,12 +163,19 @@ $AttBeer = 0.00825 * $attenuation + 0.00817 * $BD - 0.00684 * $Temp + 0.00026 * $TotTme - 0.00356 * $percCara + 0.00553 * $percSugar + 0.547; $fg = 1 + (1 - $AttBeer) * ($og - 1); -// echo $percSugar.' '.$percCara.' '.$attenuation.' attn '.$AttBeer.' FG '.$fg.PHP_EOL; return $fg; } +function abvol($og, $fg) { + if ((4.749804 - $fg) <> 0) + return 486.8693 * ($og - $fg) / (4.749804 - $fg); + return 0; +} + + + /* Brouwhulp data.pas diff -r 7f1d0abe5571 -r 0a39cbdcf085 www/rec_print.php --- a/www/rec_print.php Sun Nov 11 23:15:46 2018 +0100 +++ b/www/rec_print.php Mon Nov 12 11:32:16 2018 +0100 @@ -408,6 +408,7 @@ $this->Cell(25,5,'('.sprintf("%.3f",$row['st_fg_min']).' - '.sprintf("%.3f",$row['st_fg_max']).')',0,0,'L',true); $this->Ln(); + $row['est_abv'] = abvol($row['est_og'], $row['est_fg']); $this->SetX($this->TableX); $this->Cell(35,5,'Geschat alcohol',0,0,'L',true); $this->Cell(25,5,sprintf("%.1f",$row['est_abv']).'%',0,0,'L',true);