Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: If the universe was more like Perl, I would...

by blue_cowdawg (Monsignor)
on May 02, 2011 at 15:21 UTC ( #902528=note: print w/ replies, xml ) Need Help??


in reply to If the universe was more like Perl, I would...

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


Comment on Re: If the universe was more like Perl, I would...
Select or Download Code
Re^2: If the universe was more like Perl, I would...
by ChuckularOne (Parson) on May 02, 2011 at 15:44 UTC

    Are you a home brewer or a pro-brewer?

    BTW: I love the code!

      An insanely avid home brewer. I'd love to make it my profession if I had the guts to strike out on my own and open my own brewery. I'd have a blast producing Belgian style ales (think Ommegang) as well as IPAs, Porters and Stouts.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://902528]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2014-09-30 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (369 votes), past polls