If you want to control the element (pump) couldn't you make a button on the other workspace and have a script in the background that looks for that button to be pushed and changes the state of the pump control on the other worksheet?
I had been planning to do just that.
I just tried it with my boil kettle purge gas valve (BK_Gas), and put a control button "Change_BKgas" on my control box status workspace, then have the script below watching it to reflect the change.
[bloop1]
wait "Change_BKgas" State == true
if "BK_Gas" State == false
"BK_Gas" State = true
else
"BK_Gas" State = false
endif
//sleep 1000
"Change_BKgas" State = false
goto bloop1
Good idea. You should have some sleep time in there to keep the cpu from running flat out.
Do you need the sleep time in it if you are using a wait statement? Does it work like a poll or an interrupt (clearly from my perspective it is an interrupt, but inside the guts I'm guessing it is more of a poll thing based on your comment)?
I just checked my system and with that script running the CPU usage is 0.7%.
No, you don't need a sleep if there is some buffer time sitting on a wait.
Peter,
Sorry to revive an old thread, just watched the full brew day with Brian and bought the Pro version the next day. I'd love to see an updated version of your scripts now that the one listed here is about 4 years old!
Bret
We actually did not use much of any scripts during the brew day - that was mostly a manual brew.
That said, the script has not really changed. I’m happy to post the most recent version of my personal rig’s script, but I sincerely encourage anyone looking to automate to build their own from the beginning. Scripts are strongly linked to the Elements of a particular configuration so it can get out of context quickly unless you take the time to fully understand the elements and their hardware.
Here is the most recent.
[setup] new value MashVol new value SpargeVol new value StrikeTemp new value MashStep1Temp new time MashStep1Time new value MashStep2Temp new time MashStep2Time new value MashStep3Temp new time MashStep3Time new value PreBoilVolume new time SteepTime new value TransferTemp new string Status MashVol = 18 SpargeVol = 18 StrikeTemp = 160 MashStep1Temp = 152 MashStep1Time = 01:00:00 MashStep2Temp = 152 MashStep2Time = 00:00:00 MashStep3Temp = 152 MashStep3Time = 00:00:00 PreBoilVolume = 30 SteepTime = 00:00:00 TransferTemp = 65 [prep] Status = "Ready to Start" "Step" Type = CountUp restart "Step" "Mash Temp" Enabled = true "Mash Level" Enabled = true "RIMS Temp" Enabled = true "Flowmeter 1" Enabled = true "Valve 1" Enabled = true "Valve 2" Enabled = true "Valve 3" Enabled = true "Valve 4" Enabled = true "Valve 5" Enabled = true "Valve 6" Enabled = true "Valve P1" Enabled = true "Valve P2" Enabled = false "RIMS Heat PID" Enabled = false "RIMS Heat Duty" Enabled = false "RIMS High Power" Enabled = true "Pump 1" Enabled = true "Pump 2" Enabled = true "RIMS Heat PID" Enabled = false "Water Input" Enabled = false "Boil Temp" Enabled = false "Boil Heat Duty" Enabled = false "Boil Heat PID" Enabled = false "Chill Temp" Enabled = false "Chill Flush" Enabled = false "Condenser" Enabled = false "Panel Alarm" Enabled = true "CONTINUE" State = false wait "CONTINUE" State == true [prep_fill] Status = "Prep Fill" restart "Step" restart "Master" "Valve 1" State = on "Valve 2" State = off "Valve 3" State = off "Valve P1" Value = 60 "RIMS High Power" State = on "Pump 1" State = off "Valve 4" State = off "Valve 5" State = off "Valve 6" State = off sleep 5000 [fill] new value PreMashVol PreMashVol = MashVol - 4 Status = "Fill" restart "Step" "Pump 1" State = on wait "Mash Level" Value >= PreMashVol "Valve P1" Value = 35 delete PreMashVol wait "Mash Level" Value >= MashVol [prep_strike] Status = "Prep Strike" restart "Step" "Pump 1" State = off "Valve 1" State = off "Valve 2" State = on "Valve P1" Value = 60 sleep 5000 "Pump 1" State = on sleep 10000 wait "Flowmeter 1" Rate > 5 "RIMS Heat Duty" DutyCycle = 100 "RIMS Heat Duty" Enabled = true [strike] Status = "Heat Strike" restart "Step" new value PreStrikeTemp PreStrikeTemp = StrikeTemp - 3 wait "Mash Temp" Value > PreStrikeTemp "RIMS Heat PID" Target = StrikeTemp + 2 "RIMS Heat PID" Enabled = true delete PreStrikeTemp [strike_loop] if "Mash Temp" Value >= StrikeTemp "Brew Alarm" Active = true "RIMS Heat PID" Target = StrikeTemp + 1 goto dough_in endif sleep 3000 goto strike_loop [dough_in] Status = "Strike Ready" restart "Step" "CONTINUE" State = false wait "CONTINUE" State == true "Brew Alarm" Active = false "RIMS Heat PID" Enabled = false "Pump 1" State = off sleep 3000 "RIMS High Power" State = off Status = "Dough In" "CONTINUE" State = false wait "CONTINUE" State == true [mash_prep] new value MashLevelFull new value MashLevelLow new value MashStep new value MashTempDelta MashStep = 1 Status = "Mash Step 1" "AutoMash" State = true sleep 5000 MashLevelFull = "Mash Level" Value - 2 MashLevelLow = MashLevelFull - 6 restart "Step" "Valve P1" Value = 40 sleep 5000 "Pump 1" State = on sleep 10000 "RIMS Heat PID" Target = MashStep1Temp + 2 "RIMS Heat PID" Enabled = true sleep 30000 [mash_loop] if "AutoMash" State == true if "Mash Level" Value < MashLevelLow if "Valve P1" Value > 30 "Valve P1" Value -= 1 endif endif if "Mash Level" Value > MashLevelFull if "Valve P1" Value < 60 "Valve P1" Value += 1 endif endif endif if MashStep == 1 if "Step" Value >= MashStep1Time Status = "Mash Step 2" restart "Step" "RIMS Heat PID" Target = MashStep2Temp + 1 MashStep = 2 endif MashTempDelta = "Mash Temp" Value - MashStep1Temp endif if MashStep == 2 if "Step" Value >= MashStep2Time Status = "Mash Step 3" restart "Step" "RIMS Heat PID" Target = MashStep3Temp + 1 MashStep = 3 endif MashTempDelta = "Mash Temp" Value - MashStep2Temp endif if MashStep == 3 if "Step" Value >= MashStep3Time goto mashout endif MashTempDelta = "Mash Temp" Value - MashStep3Temp endif sleep 5000 goto mash_loop [mashout] delete MashLevelFull delete MashLevelLow delete MashStep delete MashTempDelta Status = "Mashout" restart "Step" "RIMS Heat PID" Enabled = false "Valve P1" Value = 60 sleep 3000 "RIMS High Power" State = on sleep 3000 "RIMS Heat PID" Target = 172 "RIMS Heat PID" Enabled = true wait "Mash Temp" Value > 168 [prep_sparge] new value MinFlowRate new value MaxFlowRate new value MashTopLevel new value MashBottomLevel Status = "Prep Sparge" restart "Step" "RIMS Heat PID" Enabled = false sleep 5000 "Pump 1" State = off sleep 10000 MinFlowRate = 0.9 MaxFlowRate = 1.2 MashTopLevel = "Mash Level" Value + 1 MashBottomLevel = "Mash Level" Value - 1 "Valve P1" Value = 35 "Valve P2" Value = 30 "Valve 2" State = off "Valve 3" State = on "Valve 1" State = on "Valve 4" State = off "Valve 5" State = off "Valve 6" State = on "Pump 2" State = off "Boil Temp" Enabled = true "Flowmeter 1" Enabled = false "Boil Level" Enabled = true "Valve P2" Enabled = true sleep 5000 "Flowmeter 1" Enabled = true [sparge] Status = "Sparge" restart "Step" new value SpargeLoop new bool FlowOK new bool RIMSOff SpargeLoop = 0 RIMSOff = false "Pump 1" State = on "Pump 2" State = on sleep 5000 "RIMS Heat Duty" DutyCycle = 55 "RIMS Heat Duty" Enabled = true [sparge_loop] if "RIMS Temp" Value > 185 "RIMS Heat Duty" Enabled = false RIMSOff = true else if RIMSOff == true "RIMS Heat Duty" Enabled = true RIMSOff = false endif endif if "Flowmeter 1" Value >= SpargeVol goto drain endif if "Mash Level" Value > MashTopLevel "Valve P2" Value += 1 endif if "Mash Level" Value < MashBottomLevel "Valve P2" Value -= 1 endif if SpargeLoop >= 10 FlowOK = true if "Flowmeter 1" Rate > MaxFlowRate "Valve P1" Value -= 1 FlowOK = false endif if "Flowmeter 1" Rate < MinFlowRate "Valve P1" Value += 1 FlowOK = false endif if FlowOK == true if "RIMS Temp" Value > 175 "RIMS Heat Duty" DutyCycle -= 1 endif if "RIMS Temp" Value < 165 "RIMS Heat Duty" DutyCycle += 1 endif endif SpargeLoop = 0 endif sleep 1000 SpargeLoop += 1 goto sparge_loop [drain] delete MashTopLevel delete MashBottomLevel delete SpargeLoop delete FlowOK delete RIMSOff delete MinFlowRate delete MaxFlowRate Status = "Drain Mash" restart "Step" "RIMS Heat Duty" Enabled = false "Valve 1" State = off "Valve P1" Value = 0 "Pump 1" State = off "Valve P2" Value = 30 sleep 5000 "RIMS High Power" State = off "CONTINUE" State = false [drain_loop] if "CONTINUE" State == true "CONTINUE" State = false goto boil endif if "Boil Level" Value >= PreBoilVolume goto boil endif sleep 1000 goto drain_loop [boil] Status = "Boil Ramp" restart "Step" "Pump 2" State = off "Valve 3" State = off "Valve 6" State = on "Boil Heat Duty" DutyCycle = 100 "Boil Heat Duty" Enabled = true "Mash Temp" Enabled = false "Mash Level" Enabled = false "Flowmeter 1" Enabled = false "RIMS Temp" Enabled = false "Condenser" Enabled = true wait "Boil Temp" Value >= 211 "Brew Alarm" Active = true sleep 3000 "Brew Alarm" Active = false Status = "Boil" "Step" Type = CountDown "Step" Value = 01:00:00 "Condenser" State = on "Boil Heat Duty" DutyCycle = 75 wait "Boil Temp" Value >= 212 "Boil Heat Duty" DutyCycle = 30 wait "Step" Value <= 00:05:00 "Valve 4" State = on "Valve 5" State = on "Valve P2" Value = 100 "Chill Temp" Enabled = true sleep 5000 "Pump 2" State = on sleep 10000 "Boil Heat Duty" DutyCycle = 100 sleep 20000 wait "Boil Temp" Value >= 212 "Boil Heat Duty" DutyCycle = 40 wait "Step" Value <= 00:00:00 "Boil Heat Duty" Enabled = false [chillboil] Status = "Chill Boil Kettle" "Step" Type = CountUp restart "Step" "Chill Flush" Enabled = true [chillboil_loop] "Chill Flush" State = on sleep 10000 wait "Boil Temp" Value <= 175 "Chill Flush" State = off sleep 15000 if "Boil Temp" Value > 175 goto chillboil_loop endif [steep] Status = "Steep" restart "Step" "Condenser" State = off "Boil Heat PID" Target = 170 "Boil Heat PID" MaxOutput = 50 "Boil Heat PID" Enabled = true sleep 1000 [steep_loop] if "Step" Value >= SteepTime goto whirlpool endif sleep 30000 "Pump 2" State = on sleep 5000 "Pump 2" State = off goto steep_loop [whirlpool] Status = "Whirlpool Fast" restart "Step" "Valve P2" Value = 65 "Valve 5" State = off "Pump 2" State = on wait "Step" Value >= 00:10:00 Status = "Whirlpool Slow" "Valve P2" Value = 100 "Valve 5" State = on wait "Step" Value >= 00:15:00 [transfer_prep] new value TransferTempLow new value TransferTempHigh Status = "Transfer Ready" restart "Step" "Brew Alarm" Active = true "CONTINUE" State = false wait "CONTINUE" State == true [transfer] Status = "Transferring" "Brew Alarm" Active = false "Boil Heat PID" Enabled = false "Chill Flush" State = on "Valve P2" Value = 30 sleep 3000 "Valve 6" State = off "CONTINUE" State = false sleep 30000 [transfer_loop] TransferTempLow = TransferTemp - 2 TransferTempHigh = TransferTemp + 2 if "Chill Temp" Value < TransferTempLow "Valve P2" Value += 1 endif if "Chill Temp" Value > TransferTempHigh "Valve P2" Value -= 1 endif if "Valve P2" Value > 45 "Valve P2" Value = 45 endif if "Valve P2" Value < 25 "Valve P2" Value = 25 endif if "Boil Level" Value < 4 goto pre_shutdown endif if "CONTINUE" State == true "CONTINUE" State = false goto shutdown endif sleep 15000 goto transfer_loop [pre_shutdown] "Valve P2" Value = 0 Status = "Open P2 for Remainder" "Brew Alarm" Active = true "CONTINUE" State = false wait "CONTINUE" State == true [shutdown] start "Brew Reset" stop "Brew"
We actually did not use much of any scripts during the brew day - that was mostly a manual brew.
That said, the script has not really changed. I’m happy to post the most recent version of my personal rig’s script, but I sincerely encourage anyone looking to automate to build their own from the beginning. Scripts are strongly linked to the Elements of a particular configuration so it can get out of context quickly unless you take the time to fully understand the elements and their hardware.
Yeah, sorry, I should have been more clear. I'm actually writing it from a blank slate... I've read through the docs twice even, but sometimes I like to look at how other people wrote code to go "Ahh, that's a more clever way to accomplish that!" I appreciate you posting this!