Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2024-03-28 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found