localTime [start] new datetime dt [loop] dt = now goto loop /*************************************************************** mainsPower [start] if "Mains Output Control" state == false "Set Mash Temp" value = 0 sleep 800 "Enable HLT" state = false sleep 800 "HLT_LED" state = false "Enable RIMs" state = false sleep 800 "RIMs_LED" state = false sleep 800 endif goto start /********************************************************************* setMashTemp //Set Mash Temp script [start] new value current_target "RIMs" target = "Set Mash Temp" value current_target = "RIMs" target [loop] wait "Set Mash Temp" value != current_target call update sleep 1000 goto loop [update] "RIMs" target = "Set Mash Temp" value current_target = "RIMs" target return /**************************************************************************** setHLTtemp //Set HLT Temp script [start] new value current_target "HLT" target = "Set HLT Temp" value current_target = "HLT" target [loop] wait "Set HLT Temp" value != current_target call update sleep 1000 goto loop [update] "HLT" target = "Set HLT Temp" value current_target = "HLT" target return /******************************************************************************* pumpON [start] [loop] if "Pump Power" state == false "Recirc Pump" value = 0 "Enable RIMs" state = false "PumpRecircLED" state = false sleep 1000 else if "Recirc Pump" value < 1 "Recirc Pump" value = 50 "PumpRecircLED" state = true endif endif sleep 1000 goto loop /******************************************************************************* EnableElements [start] new value speed new value element new bool hltElement [loop] hltElement = "HLT" value if "Enable HLT" state == false "Set HLT Temp" value = 0 //sleep 2000 "HLT" enabled = false "HLT_LED" state = false if "Enable HLT" state == true if "HLT_LED" state == false if hltElement == true "HLTLED" state = true endif endif sleep 1000 //goto loop endif else if "Mains Output Control" state == false "Enable HLT" state = false "HLT" enabled = false //sleep 1000 "HLT_LED" state = false //sleep 1000 else "Enable HLT" state = true //sleep 1000 "HLT" enabled = true if hltElement == true "HLT_LED" state = true //sleep 1000 else "HLT_LED" state = false //sleep 1000 endif endif endif sleep 1000 //goto loop [RIMS] element = "RIMs" value speed = "Recirc Pump" value if speed < 20 if element > 1 "Set Mash Temp" value = 0 //sleep 2000 "Enable RIMs" state = false "RIMs_LED" state = false endif endif if "Enable RIMs" state == false "Set Mash Temp" value = 0 //sleep 2000 "RIMs" enabled = false "RIMs_LED" state = false if "Enable RIMs" state == true if "RIMs_LED" state == false if element > 1 "RIMs_LED" state = true endif endif sleep 1000 //goto loop endif else if "Mains Output Control" state == false "Enable RIMs" state = false "RIMs" enabled = false //sleep 1000 "RIMs_LED" state = false //sleep 1000 else "Enable RIMs" state = true //sleep 1000 "RIMs" enabled = true if element > 1 "RIMs_LED" state = true //sleep 1000 else "RIMs_LED" state = false //sleep 1000 endif endif endif sleep 1000 goto loop /************************************************************************************** startMash [start] "Start Mash" state = false wait "Start Mash" state == true "Start Mash" background = 2 //Change boarder to green while timer is running "Start Mash" state = false //Make sure pump is running sleep 5000 if "Recirc Pump" value < 50 "Recirc Pump" value = 50 endif sleep 2000 //Give pump time to start moving fluid across element //Enable RIMs heating element if "Enable RIMs" state != true "Enable RIMs" state = true endif "Set Mash Temp" value = "tmpMash" value //Retrieve global variable tmpMash //Start the mash timer "Mash Timer" value = "timeMash" value //Retrieve global variable timeMash start "Mash Timer" //Loop to trigger alarm at end of mash [loop] if "Mash Timer" value <= "00:00:00" "Mash Alarm" active = true goto alarm endif sleep 1000 goto loop //Reset Start Mash btn border to red, stop the timer and set to 00:00:00 [alarm] "Start Mash" background = 1 stop "Mash Timer" "Mash Timer" value = "00:00:00" //flash alarm while active, stop script when alarm is silenced [flash] if "Mash Alarm" active == true "Mash Alarm" background = 2 sleep 800 "Mash Alarm" background = 1 sleep 800 goto flash else stop "startMash" /******************************************************************************************************* heatStrike [start] "Heat Strike" state = false wait "Heat Strike" state == true //wait until button is pressed "Heat Strike" background = 2 //Change boarder to green while timer is running "Heat Strike" state = false //reset button state so it is active again //Make sure pump is running sleep 5000 if "Recirc Pump" value < 50 "Recirc Pump" value = 50 endif sleep 2000 //Give pump time to start moving fluid across element //Enable RIMs heating element if "Enable RIMs" state != true "Enable RIMs" state = true endif "Set Mash Temp" value = "tmpStrike" value //Retrieve global variable tmpStrike "Heat Strike" background = 1 goto start "heatStrike" /******************************************************************************************* sysStart [start] "Start System" state = false wait "Start System" state == true start "mainsPower" start "setMashTemp" start "EnableElements" start "localTime" start "setHLTtemp" start "startMash" start "eStop" start "heatStrike" start "ShutDown" start "pumpON" start "getMT" start "LCD" goto start /************************************************************************************ eStop [start] "ALL STOP" state = false wait "ALL STOP" state == true call "mainsPower" goto start [mainsPower] "Mains Output Control" state = false return /******************************************************************************* ShutDown [start] "Shut Down" state = false wait "Shut Down" state == true "Shut Down" background = 2 "Shut Down" state = false "Set Mash Temp" value = 0 sleep 2000 "Recirc Pump" value = 0 sleep 2000 "Enable RIMs" state = false "Set HLT Temp" value = 0 sleep 2000 "Enable HLT" state = false "Shut Down" background = 1 goto start /**************************************************************************** getMT [start] [loop] new value current_mash_temp current_mash_temp = "MT Temp" value current_mash_temp precision = 1 new value current_rims_temp current_rims_temp = "RIMs Temp" value current_rims_temp precision = 1 new value sumTemp sumTemp = current_mash_temp + current_rims_temp new value averageMT averageMT precision = 1 averageMT = sumTemp / 2 new value deltaTemp deltaTemp precision = 1 deltaTemp = current_rims_temp - current_mash_temp sleep 1000 goto loop /******************************************************************************** g_CautionBanner [start] [loop] wait "Mains Output Control" state == true "Caution" visibility = visible wait "Mains Output Control" state == false "Caution" visibility = hidden sleep 1000 goto loop /******************************************************************************** LCD [start] new string CC // declare a new string variable CC = "temp data" // set the variable to “clear display” code display "Wifi" 0 CC // clear the entire display CC = "2" display "Wifi" 0 CC sleep 2000 CC = "temp data" //display "Wifi" 0 CC sleep 2000 new string temp new string mashtemp new string rimstemp new string clrMT clrMT = "Mash Temp: " + " " new string clrRIMs clrRIMs = "RIMs Temp: " + " " [loop] mashtemp = "Mash Temp: " mashtemp += "MT Temp" DisplayText //display "Wifi" 1 clrMT sleep 2000 display "Wifi" 1 mashtemp sleep 2000 rimstemp = "RIMs Temp: " rimstemp += "RIMs Temp" DisplayText //display "Wifi" 2 clrRIMs sleep 2000 display "Wifi" 2 rimstemp sleep 1000 goto loop /********************************************************************************** clrLCD [displaycodes] new string CC // declare a new string variable CC = "temp data" // set the variable to “clear display” code display "Wifi" 0 CC // clear the entire display CC = "2" display "Wifi" 0 CC sleep 3000 CC = "temp data" //display "Wifi" 0 CC sleep 2000 stop "clrLCD" // self terminate this script /********************************************************************************** ifaceDisconnect" active = false new value count count = 0 [loop] if "Recirc Pump" connected == false "InterfaceAlarm" active = true //"InterfaceAlarm" DisplayText = "DISCONNECT" count = count + 1 stop EnableElements sleep 5000 start EnableElements sleep 2000 endif goto loop /************************************************************************************** Script shutdown [start] "btnStopScripts" state = false "btnStopScripts" background = 1 wait "btnStopScripts" state == true //wait until button is pressed "btnStopScripts" background = 2 //Change boarder to green while timer is running "btnStopScripts" state = false //reset button state so it is active again sleep 3000 stop ifaceDisconnect stop LCD stop getMT stop eStop //stop EnableElements stop pumpON stop setHLTtemp stop setMashTemp goto start /*********************************************************************************** Script start [start] "btnStartScripts" state = false "btnStartScripts" background = 1 wait "btnStartScripts" state == true //wait until button is pressed "btnStartScripts" background = 2 //Change boarder to green while timer is running "btnStartScripts" state = false //reset button state so it is active again sleep 3000 start ifaceDisconnect start LCD start getMT start eStop start EnableElements start pumpON start setHLTtemp start setMashTemp goto start