コード例 #1
0
ファイル: models.py プロジェクト: egaillot/zython
 def compute_empirical_efficiency(self, collected_volume, measured_og):
     """ returns the empirical efficiency in % based on collected volume (L),
         and measured OG (specific gravity). In order to estimate your brewhouse efficiency on that particular recipe.. """
     pot_gravity = self._get_potential_gravity(l_to_gal(collected_volume))
     efficiency = 0
     if pot_gravity > 0:
         efficiency = (measured_og - 1.) / pot_gravity
     return int(efficiency * 100)
コード例 #2
0
ファイル: models.py プロジェクト: egaillot/zython
 def _get_potential_gravity(self, batch_size):
     points = []
     if not batch_size:
         batch_size = l_to_gal(self.batch_size)
     for grain in self.recipemalt_set.all():
         pounds = kg_to_lb(float(grain.amount))
         gravity = float(grain.potential_gravity - 1) * 1000.
         points.append(float(pounds) * float(gravity))
     return (float(sum(points)) / float(batch_size)) / 1000.
コード例 #3
0
ファイル: models.py プロジェクト: egaillot/zython
 def get_srm(self):
     cache_key = "%s_get_srm" % self.cache_key
     recipe_srm = cache.get(cache_key)
     if recipe_srm is None:
         grain_srm = []
         batch_size = l_to_gal(float(self.batch_size))
         for grain in self.recipemalt_set.all():
             pounds = kg_to_lb(float(grain.amount))
             lovibond = ebc_to_srm(float(grain.color))
             grain_srm.append(float(lovibond * pounds) / float(batch_size))
         recipe_mcu = float(sum(grain_srm))
         recipe_srm = 1.4922 * (recipe_mcu**0.6859)
         cache.set(cache_key, recipe_srm, 60 * 15)
     return float(recipe_srm)
コード例 #4
0
ファイル: models.py プロジェクト: egaillot/zython
 def ibu(self):
     if self.usage == "dryhop":
         return 0
     elif not self.boil_time:
         return 0
     volume = float(l_to_gal(self.recipe.batch_size))
     gravity = float(self.recipe.get_original_gravity()) - 1
     alpha = float(float(self.acid_alpha) / 100)
     mass = float(g_to_oz(self.amount))
     time = float(self.boil_time)
     mgperl = alpha * mass * 7490 / volume
     util = 1.65 * (math.pow(0.000125,
                             gravity)) * (1 - math.exp(-0.04 * time)) / 4.15
     ibu = mgperl * util
     if self.form == "pellets":
         ibu += ibu * 0.105
     if self.usage == "firsthop":
         ibu += ibu * 0.105
     return ibu
コード例 #5
0
ファイル: models.py プロジェクト: egaillot/zython
    def initial_heat(self):
        # TODO :
        # Why this doesn't work properly
        # with total grain weight ??
        # Equation doc : http://www.byo.com/stories/techniques/article/indices/45-mashing/631-feel-the-mash-heat

        Hm = 0.3822  # heat capacity of malt
        Hw = 1.0  # heat capacity of water
        Tmt = 74  # temperature of dry malt
        Tma = float(c_to_f(float(
            self.temperature)))  # temperature of mash step
        M = float(kg_to_lb(
            self.recipe.get_total_grain()))  # weight of malt in lbs
        if M == 0.0:
            M = 1.
        W = float(float(l_to_gal(self.water_added)) * M)  # weight of water
        if W == 0:
            temp = self.temperature
        else:
            temp = f_to_c(((M * Hm * (Tma - Tmt)) / (W * Hw)) + Tma)
        return temp
コード例 #6
0
ファイル: models.py プロジェクト: egaillot/zython
 def get_preboil_gravity(self):
     batch_size = l_to_gal(
         float(self.batch_size) + float(self.water_boiloff()) +
         float(self.boiler_tun_deadspace))
     return self.get_original_gravity(cache_key="_pbg",
                                      batch_size=batch_size)