There was an earlier discussion regarding managing rainfall for irrigation control. For those that are interested, here is how I am doing that.
I start with an estimate of how much rainfall is required to meet my daily irrigation needs. In other words, if it rained at least
x inches/mm every day I would never water. This should be roughly the same amount of water your irrigation system delivers per week divided by 7. For my yard that was 0.33 inches.
Then, I took a guess at the maximum amount of rainfall that was useful. In other words, what would really soak into the ground and not runoff. For my area that was 3 inches. Anything above that will either run off, or evaporate before it can be used.
The rest is just a few scripts for data collection and calculation.
First, I created 8 Indigo variables:
irrRainPrevDay - Rainfall for the previous day, (00:00 - 23:59) measured at midnight
irrRainPrevDayAM - Rainfall for the previous day between 00:00 and 06:00 (when I water)
irr24HourRain - Rainfall for the 24 hour period immediately preceding the watering time (06:00 - 06:00)
irrRainResevoir - An estimate of residual water available to my yard.
irrDailyReq - The amount of water (rainfall) required per day for normal irrigation
irrRainForecastPCT - The chance of rain (%) taken from the Weather Underground forecast
Irrigation - A boolean (true or false) flag that controls the irrigation system
HaltedSprinklersDate - A timestamp set each time irrigation changes from true to false
Then, each night at 23:59 I take the rainfall for the day and save it to
irrRainPrevDay using this embedded AppleScript:
- Code: Select all
set the value of variable "irrRainPrevDay" to the (value of variable "Wunderground_Precip_today_in")
I use the Weather Underground, but you can change the source variable to whatever you use.
Next, at 06:00, just before my daily irrigation schedule runs, I first get the Wunderground forecast:
- Code: Select all
-- Change curlArgs to contain your location
set filePath to "/var/tmp/RainForecast"
set curlArgs to "-m 45 http://www.wunderground.com/US/CA/Metro_Oakland_International.html >" & filePath
-- Now, get the raw html with curl…
do shell script "/usr/bin/curl " & curlArgs
-- … and parse it for the rain forecast
set rainPct to do shell script "/usr/bin/grep -A5 -m1 fctDayConditions " & filePath & "|/usr/bin/tail -1|/usr/bin/cut -d\\> -f2|/usr/bin/cut -d% -f1"
tell application "IndigoServer"
set the value of variable "irrRainForecastPCT" to rainPct
log "Set rain forecast % to: " & rainPct using type "Rain-Forecast"
end tell
And then run the following AppleScript. It calculates the rainfall for the previous 24 hours (
irrRainPrevDay -
irrRainPrevDayAM + current day rainfall), updates the variables, and finally, determines, based on the forecast as previous rainfall, if we should water, or not.:
- Code: Select all
-- This script should run just before your daily irrigation schedule starts
set quantum to 0.01 -- for rounding to 2 decimal places
set timestamp to the (current date) as text
-- Get soma data from Indigo
-- average inches of rain required per day
tell application "IndigoServer"
-- How much water, in inches, do we use as a norm daily
set irrDailyReq to the value of variable "irrDailyReq" as real
-- Did we water yesterday?
set lastIrrigation to the value of variable "Irrigation" as boolean
-- The forecast for today
set rainForecastPCT to the value of variable "irrRainForecastPCT"
-- Rainfall management
-- - what's in the resevoir?
set irrRainResevoir to the value of variable "irrRainResevoir"
-- - has it rained since midnight?
set precipToday to the value of variable "Wunderground_Precip_today_in"
-- - how much rain had fallen since midnite at this time yesterday?
set irrRainPrevDayAM to the value of variable "irrRainPrevDayAM"
-- - how much rain did we get yeaterday?
-- - This was saved just before midnite yesterday.
set irrRainPrevDay to the value of variable "irrRainPrevDay"
-- save rainfall since midnite for use tomorrow
set the value of variable "irrRainPrevDayAM" to precipToday
-- calculate rainfall since this time yesterday
set irr24HourRain to irrRainPrevDay - irrRainPrevDayAM + precipToday
-- but don't let it go negative
if irr24HourRain < 0 then
set irr24HourRain to 0
end if
-- and save it
set the value of variable "irr24HourRain" to irr24HourRain as text
-- Now, manage the rain resevoir
set irrRainResevoir to irrRainResevoir + irr24HourRain - irrDailyReq
-- but don't let it go negative
if irrRainResevoir < 0 then
set irrRainResevoir to 0
end if
-- or get too big - can't save rain forever. 4 days at most
if irrRainResevoir > irrDailyReq * 5 then
set irrRainResevoir to irrDailyReq * 5
end if
-- and save it
set the value of variable "irrRainResevoir" to irrRainResevoir
-- And, at last, figure out if we should water today
if irrRainResevoir > irrDailyReq or rainForecastPCT > 80 then
-- Tell Indigo not to water.
set the value of variable "Irrigation" to false
-- If we have been watering up to yesterday, note that we shut the system off today
if lastIrrigation then
set the value of variable "HaltedSprinklersDate" to timestamp
end if
else
set the value of variable "Irrigation" to true
end if
end tell
That's it. This has been a pretty dry year where I live, so there hasn't been much to calculate. But, this week has been quite wet and everything is operating as expected.
Please post any questions, ideas, or your own process for handling rainfall as part of your irrigation planning.