Skip to content

Weather adjustments

Nick Horvath edited this page May 18, 2023 · 10 revisions

Overview

The software can be configured to use weather data to make adjustments to the irrigation duration automatically. The data is retrieved from Weather Underground and uses the following parameters to adjust the duration:

  • Average humidity for the previous day.
  • Average temperature for the previous day.
  • Total precipitation for the previous day.
  • Total precipitation for the current day.

The weather adjustment formula uses a baseline of 70 F (21 C), 30% Humidity and no precipitation. See below for more details.

Configuration

Note: As of v1.2.0 you must enable a weather provider in config.h before building. It's in settings.h in versions less than 1.4.0.

The configuration options on the Settings Page will differ based on your chosen provider.

This is out of date, please see the README for current weather setup.

Bring up the settings screen:

Settings Screen

The first five parameters are used to setup the Weather Underground connection.

WUnderground IP configures the where the system should retrieve the data. This should be whatever api.wunderground.com resolves to, which currently is 38.102.136.138. This parameter will be removed and internalized in future releases of the software.

API Key is your personal API key given to you from Weather Underground. Obtain your free API key by signing up here: http://www.wunderground.com/weather/api/

WUnderground Type is the type of request you are making. Currently the system supports 5 digit zipcode OR personal weather station.

One or both of Zip or PWS ID must be filled out depending on the value of the Wunderground Type id. If you have a specific personal weather station you would like to pull data from, enter that information in PWS ID and make sure the type is set to PWS.

Once these are set, verify your parameters by going to Advanced->WUnderground Diagnostics. If your connection is properly configured you should see something like this:
Diagnostics

Using in a Schedule

Each individual schedule can be configured to use the weather adjustments, or ignore them. This is done by turning the Weather Adjust toggle to ON:
Toggle

Checking the as-run Scale

The logs contain data on how durations were adjusted due to the Weather Underground data. Simply look at the table log and notice the column called "WUnd".
logs
A 100% indicates that there was no change due to the WUnderground data. A value higher than 100 indicates that time was added to the duration. A value lower than 100 indicates that time was removed from the duration. The Runtime column tells you exactly how long the the zone ran (i.e. it is the final adjusted duration, or the as-run)

Formula for setting the Scale

The formula used to set the scale is as follows:

  • Humidity: Average humidity for the previous day above 30% is subtracted from the weather adjustment, below 30% is added to it. Example: 77% Max Humidity + 26% Min Humidity / 2 = 51% Avg Humidity, 30% - 51% Avg Humidity = -21% Humidity Adjustment
  • Temperature: +4% for each degree Fahrenheit above 70, and -4% for each degree Fahrenheit below 70.
  • Precipitation: -2% for each hundredth of an inch precipitation from today and yesterday. Example: 0.12" rain today + 0.05" rain yesterday * 100 = 17 hundredths of an inch of rain * -2 = -34% Precipitation Adjustment

The total weather adjustment will not exceed the range of 0% to 200%.

Both the Weather Adjustment (if enabled via a Schedule, see above) and the Seasonal Adjustment are used to adjust the run time for each Zone in the schedule. For example, if the Seasonal Adjustment is 50% and the Weather Adjustment is 200% , they will add to make 100% so the run times will not be changed (see "Checking the as-run Scale" above).

The actual code for making the adjustments is located in Weather.cpp in the function Weather::GetScale. It is provided below:

int Weather::GetScale(const ReturnVals & vals) const
{
	if (!vals.valid)
		return 100;
	const int humid_factor = NEUTRAL_HUMIDITY - (vals.maxhumidity + vals.minhumidity) / 2;
	const int temp_factor = (vals.meantempi - 70) * 4;
	const int rain_factor = (vals.precipi + vals.precip_today) * -2;
	const int adj = spi_min(spi_max(0, 100+humid_factor+temp_factor+rain_factor), 200);
	trace(F("Adjusting H(%d)T(%d)R(%d):%d\n"), humid_factor, temp_factor, rain_factor, adj);
	return adj;
}

Please adjust these to your heart's content. If you come up with a formula that works well, let us know over at the forum so we can incorporate it into the mainline code.