Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Definitely "other" but inspired by use More::Beer (sorta.) This code is actually some psuedo-code written in Perl syntax for the logic flow of how I wanted a brewery controller I was designing to work. (Wanted??? still thinking it through...)

#!/usr/bin/perl -w #################################################################### use Brewery; use Brewing::Burner; use Water; use Water::Filter; use Time::HiRes qw/ get_timeofday tv_interval /; my $brewery => new Brewery("really.. my normal brewery..."); my $recipe = $brewery-> lookup_recipe("Bosun's Madness Belgian Trippe +l", { size => '10 gallons' } ); my $hot_liquor_tank = $brewery->setup_hot_liquor_tank(); my $mash_tun = $brewery->setup_mash_tun(); my $brewpot = $brewery->setup_brewpot(); my $rims_heater = $brewery->setup_rims_heater(); $hot_liquor_tank -> add_water ( (new Water::Filter(new Water())) -> get_qty($recipe->dough_in_water_qty())); my $hlt_heater = new Brewing::Burner(); $hlt_heater->on(); my $water_temp = $hot_liquor_tank -> get_temp(); while( $water_temp < $recipe->strike_temp() ) { $water_temp = $hot_liquor_tank -> get_temp(); } $hlt_heater->off(); $mash_tun -> add($recipe->grain_bill()); my $mash_temp = $recipe->mash_temp(); my $infusion_time = $recipe->infusion_time(); # as a tv my $t1 = [ gettimeofday() ]; # # mash grain until saccaranification is complete... while ( tv_interval( $t1,$infusion_time) > 0 ) { if ( $rims_heater->status() eq 'OFF' ) { if ( $mash_tun -> get_temp() < $mash_temp ) { $rims_heater->on(); } } else { if ( $mash_tun -> get_temp() >= $mash_temp ) { $rims_heater->off(); } } } $rims_heater->on(); while($mash_tun->get_temp() < $recipe->mashout()){}; $rims_heater->off(); $mash_tun->begin_worlauf(); while( $mash_tun->check_grant()->runnings() ne 'CLEAR' ){ $mash_tun->worlauf()->pump()->recirculate(); } $brewpot->recieve($mash_tun->pump()->wort()); $brewery->boiler_heater->on(); while($brewpot->boiling() ne 'TRUE') { } # Wait until comes to a boil my $start_boil = [ gettimeofday()]; my $currtime=$start_boil; my $stop_boil = $recipe->get_boil_time(); while ( my $time_left=tv_interval($currtime,$stop_boil)){ # Hops are added at 90, 60, 45, 30 and 15 minute to boil # time intervals, typically. (Not all 5 intervals though!) if ( $recipe->hop_time($time_left) ) { $brewpot->add_hops($recipe->scheduled_hops($time_left)); } # # Adjuncts such as candi sugar, irish moss (and other finings) and + # spices get added at certain times of the schedule if ( $recipe->adjunct_time($time_left) ) { $brewpot->add_adjuncts($recipe->scheduled_adjuncts($time_left)); } } $brewery->boiler_heater->off(); $brewery->fermenter->recieve( $brewery->wort_chiller(new Water(),$brewpot->wort_out) ); $brewery->fermenter->add_yeast($recipe->yeast());

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: If the universe was more like Perl, I would... by blue_cowdawg
in thread If the universe was more like Perl, I would... by cavac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (6)
    As of 2014-09-03 03:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (35 votes), past polls