This is a self test script for my pool fill valve.
- Code: Select all
using terms from application "IndigoServer"
tell application "IndigoServer"
log "Sprinkler Valve Test running now. 1. Is if there is water running despite valve being off. Measure any flow in initial state. 2. Is valve is opening correctly? Measure zero flow then some flow while open. 3. Are lines tight? See if flow stops once dead space in lines are full. If continued water flow, either lines have a leak or the pool is filling. 4. Is the valve is closing correctly? Observe for any flow following valve closure."
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "false"
set value of variable "Water_Test_Pool_Sprinkler_Success" to "false"
set value of variable "Water_Use_Pool_System_Tight" to "false"
set waterFlow0Seconds to value of variable "WaterUsePool_01_Today" as string
delay 20
set waterFlow5seconds to value of variable "WaterUsePool_01_Today" as string
set waterFlowYes to (waterFlow5seconds - waterFlow0Seconds)
log "initial flow with valve closed is " & waterFlowYes
if waterFlowYes is greater than 0 then
log "Pool House Sprinkler Valve is not open at all but water flow is detected. Valve may be stuck open, with " & waterFlowYes & " tenths of a gallon measured."
else
log "Pool House Sprinkler Valve appears tight with no initial flow."
end if
delay 1
set waterFlow0Seconds to value of variable "WaterUsePool_01_Today" as string
execute group "Water Valve Pool Sprinkler Weekly Valve Test Supply Open"
delay 5
set waterFlow5seconds to value of variable "WaterUsePool_01_Today" as string
set waterFlowYes to (waterFlow5seconds - waterFlow0Seconds)
log "initial flow is " & waterFlowYes
if waterFlowYes is greater than 0 then
log "Pool House Sprinkler Valve is opening correctly and water is flowing, with " & waterFlowYes & " tenths of a gallon measured."
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "true"
set value of variable "Water_Test_Pool_SprinklerValve_Works_TimStmp" to value of variable "RFX_Outside_Temp_Obs_Time"
else
set value of variable "Water_Test_Pool_Sprinkler_Success" to "false"
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "false"
log "The Pool Fill/Sprinkler valve might not be opening as there was zero flow. Turn on pool sprinklers and re-run test to see if flow is active. If not, valve may be malfunctioning."
execute group "Water Pool Sprinkler Valve Test Failed due to Zero Flow"
end if
if waterFlowYes is greater than 0 then
delay 20 --this is 10 seconds and should be enough time for the pipes to fill. Note that the pool fill valve does not appear to close fully. Need a different one.
log "Pool Sprinkler Fill Valve Test Running"
set Water_Test_Pool_Sprinkler_ON to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_ON") as string
delay 5
set Water_Test_Pool_Sprinkler_OFF to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_OFF") as string
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is equal to 0 then
set value of variable "Water_Test_Pool_Sprinkler_Success" to "true"
set value of variable "Water_Use_Pool_System_Tight" to "true"
set value of variable "Water_Test_Pool_Sprinkler_Success_TimeStamp" to value of variable "RFX_Outside_Temp_Obs_Time"
log "Pool Sprinkler Valve On then Off shows Valve is functioning and lines are tight. Best case achieved." as string
--This result is our best case.
end if
end if
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is not equal to 0 then
log "First Test Failed. Could be just refilling the pipes, or slowly filling the pool. Pool Sprinkler Fill Valve Test Running A Second Time"
set Water_Test_Pool_Sprinkler_ON to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_ON") as string
delay 10
set Water_Test_Pool_Sprinkler_OFF to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_OFF") as string
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is equal to 0 then
set value of variable "Water_Test_Pool_Sprinkler_Success" to "true"
set value of variable "Water_Use_Pool_System_Tight" to "true"
set value of variable "Water_Test_Pool_Sprinkler_Success_TimeStamp" to value of variable "RFX_Outside_Temp_Obs_Time"
log "While lines took longer to fill, Pool Sprinkler Valve On then Off shows Valve is functioning and lines are tight. Best case achieved." as string
--This result is our second best case.
else
set value of variable "Water_Use_Pool_System_Tight" to "false"
log "The Pool Fill/Sprinkler lines may have a leak, or the pool level is low and it is filling. Go check."
execute group "Water Pool Sprinkler Valve Test Failed"
end if
end if
end tell
end using terms from