Class: Procedures
- Inherits:
-
Object
- Object
- Procedures
- Defined in:
- lib/procedures.rb
Instance Attribute Summary collapse
-
#brewer ⇒ Object
Returns the value of attribute brewer.
-
#com ⇒ Object
Returns the value of attribute com.
-
#recipe ⇒ Object
Returns the value of attribute recipe.
Instance Method Summary collapse
- #boil ⇒ Object
- #boot ⇒ Object
-
#dough_in ⇒ Object
:nocov:.
- #get_recipe_vars ⇒ Object
- #get_strike_temp ⇒ Object
-
#heat_strike_water ⇒ Object
:nocov:.
-
#initialize ⇒ Procedures
constructor
A new instance of Procedures.
- #mash ⇒ Object
- #mashout ⇒ Object
- #master ⇒ Object
- #sparge ⇒ Object
- #top_off ⇒ Object
Constructor Details
#initialize ⇒ Procedures
9 10 11 12 13 |
# File 'lib/procedures.rb', line 9 def initialize @brewer = Brewer.new @com = Communicator.new @recipe = {} end |
Instance Attribute Details
#brewer ⇒ Object
Returns the value of attribute brewer.
7 8 9 |
# File 'lib/procedures.rb', line 7 def brewer @brewer end |
#com ⇒ Object
Returns the value of attribute com.
7 8 9 |
# File 'lib/procedures.rb', line 7 def com @com end |
#recipe ⇒ Object
Returns the value of attribute recipe.
7 8 9 |
# File 'lib/procedures.rb', line 7 def recipe @recipe end |
Instance Method Details
#boil ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/procedures.rb', line 231 def boil @com.ping("starting boil procedure") @brewer.wait(to_seconds(5)) @com.ping("Add boil hops") @brewer.wait(to_seconds(40)) @com.ping("Add flovering hops") @brewer.wait(to_seconds(13)) @com.ping("Add finishing hops") @brewer.wait(30) @com.ping("Done.") puts Rainbow("Done.").green end |
#boot ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/procedures.rb', line 65 def boot puts Rainbow("booting...").yellow @brewer.pid(0) @brewer.pump(0) @brewer.rims_to('mash') @brewer.hlt_to('mash') @brewer.all_relays_status puts @brewer.pid @brewer.clear puts Rainbow("Boot finished!").green @brewer.out.unshift("successful boot at #{Time.now}") @com.ping("🍺 boot finished 🍺") true end |
#dough_in ⇒ Object
:nocov:
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/procedures.rb', line 143 def dough_in # turn pump off @brewer.pump(0) # turn PID off @brewer.pid(0) @brewer.wait(3) @com.ping("Ready to dough in") puts Rainbow("Ready to dough in").green # pour in grain print Rainbow("Confirm when you're done with dough-in (y): ").yellow confirm ? nil : abort true end |
#get_recipe_vars ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/procedures.rb', line 15 def get_recipe_vars puts "Variables for heating strike water ---" get_strike_temp puts "Variables for mash ---" print "Enter mash temperature: " @recipe['mash_temp'] = gets.chomp.to_f print "Enter mash time in minutes: " @recipe['mash_time'] = to_seconds(gets.chomp.to_f) puts "Variables for mashout ---" print "Enter mashout temp: " @recipe['mashout_temp'] = gets.chomp.to_f end |
#get_strike_temp ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/procedures.rb', line 30 def get_strike_temp print "Input amount of water in quarts: " @recipe['water'] = gets.chomp.to_f print "Input amount of grain in lbs: " @recipe['grain'] = gets.chomp.to_f print "Input current grain temp (#{pv.to_s} F): " @recipe['grain_temp'] = gets.chomp.to_f if @recipe['grain_temp'] == "" @recipe['grain_temp'] = pv end print "Input desired mash temp (150 F): " @recipe['desired_mash_temp'] = gets.chomp if @recipe['desired_mash_temp'] == "" @recipe['desired_mash_temp'] = 150 end @recipe['desired_mash_temp'] @recipe['strike_water_temp'] = script('get_strike_temp', "#{water} #{grain} #{grain_temp} #{@recipe['desired_mash_temp']}").to_f end |
#heat_strike_water ⇒ Object
:nocov:
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/procedures.rb', line 82 def heat_strike_water puts "heat-strike-water procedure started" # Confirm strike water is in the mash tun print Rainbow("Is the strike water in the mash tun? ").yellow # -> response confirm ? nil : abort # confirm return manifold is in the mash tun print Rainbow("Is the return manifold in the mash tun? ").yellow # -> response confirm ? nil : abort print Rainbow("Is the mash tun valve open? ").yellow confirm ? nil : abort # confirm RIMS relay is on @brewer.rims_to('mash') puts "RIMS-to-mash relay is now on" # turn on pump @brewer.pump(1) puts "Pump is now on" puts Rainbow("Is the pump running properly? ").yellow # TODO: Test this until confirm puts "restarting pump" @brewer.pump(0) @brewer.wait(2) @brewer.pump(1) end # confirm that strike water is circulating well print Rainbow("Is the strike water circulating well? ").yellow # -> response confirm ? nil : abort # calculate strike temp & set PID to strike temp # this sets PID SV to calculated strike temp automagically @brewer.sv(@recipe['strike_water_temp']) puts "SV has been set to calculated strike water temp" # turn on RIMS heater @brewer.pid(1) # measure current strike water temp and save @recipe['starting_strike_temp'] = @brewer.pv puts "current strike water temp is #{@brewer.pv}. Saved." puts "Heating to #{@brewer.sv}" @com.ping("Strike water beginning to heat. This may take a few minutes.") # when strike temp is reached, @com.ping slack @brewer.watch @com.ping("Strike water heated to #{@brewer.pv}. Maintaining temperature.") puts Rainbow("Strike water heated. Maintaining temp.").green true end |
#mash ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/procedures.rb', line 159 def mash @brewer.sv(@recipe['mash_temp']) puts Rainbow("mash stated. This will take a while.").green @com.ping("Mash started. This will take a while.") @brewer.rims_to('mash') @brewer.pump(1) @brewer.pid(1) @brewer.watch @com.ping("Mash temp (#{@brewer.pv} F) reached. Starting timer for #{@recipe['mash_time']} minutes.") @brewer.wait(@recipe['mash_time']) @com.ping("🍺 Mash complete 🍺. Check for starch conversion.") puts Rainbow("Mash complete").green puts "Check for starch conversion" end |
#mashout ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/procedures.rb', line 178 def mashout @com.ping("Start heating sparge water") @brewer.sv(@recipe['mashout_temp']) @brewer.pump(1) @brewer.pid(1) @com.ping("Heating to #{@brewer.sv}... this could take a few minutes.") @brewer.watch @com.ping("Mashout temperature (#{@brewer.pv}) reached. Mashout complete.") end |
#master ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/procedures.rb', line 53 def master get_recipe_vars boot heat_strike_water dough_in mash mashout sparge top_off boil end |
#sparge ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/procedures.rb', line 191 def sparge print Rainbow("Is the sparge water heated to the correct temperature? ").yellow confirm ? nil : abort @brewer.hlt_to('mash') @brewer.hlt(1) print "Waiting for 10 seconds. " puts Rainbow("Regulate sparge balance.").yellow puts "(ctrl-c to abort proccess)" @brewer.wait(30) @brewer.rims_to('boil') @brewer.pump(1) @com.ping("Please check the sparge balance and ignite boil tun burner") puts Rainbow("Waiting until intervention to turn off pump (y): ").yellow confirm ? nil : abort @brewer.pid(0) @brewer.pump(0) @brewer.hlt(0) end |
#top_off ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/procedures.rb', line 217 def top_off @brewer.hlt_to('boil') @brewer.hlt(1) print Rainbow("waiting for intervention to turn off hlt (y): ").yellow confirm ? nil : abort @brewer.hlt(0) @com.ping('Topping off complete') puts Rainbow("Topping off complete").green end |