Announcement

Collapse
No announcement yet.

How to Adjust Hopping Rates Based on Alpha Acids.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Adjust Hopping Rates Based on Alpha Acids.

    I use a handy formula to change my hopping rates when my alpha acids change. I decided to post it on my blog. Please take a look at it here: http://www.magnusboner.com/?p=705 Please let me know what you think.

  • #2
    Does your blog support pasting code? Slap this bad boy in there (I just coded up what you wrote)...

    Code:
    <script>
    function aacalc_calculate() {
        var aa_old = parseFloat(document.getElementById('aacalc-aa-old').value),
            aa_new = parseFloat(document.getElementById('aacalc-aa-new').value),
            r_old = parseFloat(document.getElementById('aacalc-rate-old').value),
            round_factor = 1000;
    
        if (aa_old && aa_new && r_old) {
            document.getElementById('aacalc-rate-new').value =
                Math.round((r_old * aa_old * round_factor) / aa_new) / round_factor;
        } else {
            document.getElementById('aacalc-rate-new').value = '???';
        }
    }
    </script>
    
    <label for="aacalc-rate-old">Old Hopping Rate:*</label>
    <input style="width: 50px;" id="aacalc-rate-old" />
    <br />
    
    <label for="aacalc-aa-old">Old Alpha Acid:</label>
    <input style="width: 50px;" id="aacalc-aa-old" />%
    <br />
    
    <label for="aacalc-aa-new">New Alpha Acid:</label>
    <input style="width: 50px;" id="aacalc-aa-new" />%
    <br />
    
    <input type="button" onclick="aacalc_calculate();" value="Calculate!" />
    <br />
    
    <label for="aacalc-rate-new">New Hopping Rate:*</label>
    <input style="width: 50px;" readonly="READONLY" id="aacalc-rate-new" />
    <br />
    
    *Units (lbs/bbl, g/hL, whatever) don&rsquo;t matter, as long as you use the same units for both the old and new rates.

    Comment


    • #3
      Originally posted by feinbera View Post
      Does your blog support pasting code? Slap this bad boy in there (I just coded up what you wrote)...

      Code:
      <script>
      function aacalc_calculate() {
          var aa_old = parseFloat(document.getElementById('aacalc-aa-old').value),
              aa_new = parseFloat(document.getElementById('aacalc-aa-new').value),
              r_old = parseFloat(document.getElementById('aacalc-rate-old').value),
              round_factor = 1000;
      
          if (aa_old && aa_new && r_old) {
              document.getElementById('aacalc-rate-new').value =
                  Math.round((r_old * aa_old * round_factor) / aa_new) / round_factor;
          } else {
              document.getElementById('aacalc-rate-new').value = '???';
          }
      }
      </script>
      
      <label for="aacalc-rate-old">Old Hopping Rate:*</label>
      <input style="width: 50px;" id="aacalc-rate-old" />
      <br />
      
      <label for="aacalc-aa-old">Old Alpha Acid:</label>
      <input style="width: 50px;" id="aacalc-aa-old" />%
      <br />
      
      <label for="aacalc-aa-new">New Alpha Acid:</label>
      <input style="width: 50px;" id="aacalc-aa-new" />%
      <br />
      
      <input type="button" onclick="aacalc_calculate();" value="Calculate!" />
      <br />
      
      <label for="aacalc-rate-new">New Hopping Rate:*</label>
      <input style="width: 50px;" readonly="READONLY" id="aacalc-rate-new" />
      <br />
      
      *Units (lbs/bbl, g/hL, whatever) don&rsquo;t matter, as long as you use the same units for both the old and new rates.
      That is neat. I pasted it in, but when I hit the calculate button, nothing happens. I left it in there, so you can give it a try.

      Comment


      • #4
        Originally posted by squiggy View Post
        That is neat. I pasted it in, but when I hit the calculate button, nothing happens. I left it in there, so you can give it a try.
        The problem is that when you pasted it in, the blog rich text editor added some <p></p> tags in. For example:
        round_factor = 1000;</p>
        <p> if (aa_old && aa_new && r_old) {

        If there is an "edit HTML" button, toggle to that mode, and past the code in. Or, edit the code to remove the extra HTML tags.

        Or, if you don't have an edit HTML button, then delete the code, and paste it in, but first remove the blank line after "round_factor = 1000;". This is what caused the RTE to add an extra set of paragraph tags.

        Regards,
        Mike Sharp

        Comment

        Working...
        X