Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


Sidebar

tips:windchill

Calculating Wind Chill

Wind-chill is the perceived decrease in air temperature felt by the body on exposed skin due to the flow of air. So this tells you how cold a day “feels”.

Examples

Fahrenheit

 Text:  ({wt}>50 and {wt} or {wws}<3.1 and {wt} or math.floor(35.74+(0.6215*{wt})-(35.75*({wws}^0.16))+(0.4275*({wt}*({wws}^0.16)))+.5)) .. "ᵒF"

Celsius

 Text:  ({wt}>10 and {wt} or {wws}<3.1 and {wt} or math.floor(13.12+(0.6215*{wt})-(11.37*(({wws}*1.61)^0.16))+(0.3965*({wt}*(({wws}*1.61)^0.16)))+.5)) .. "ᵒC"

Explanation

The examples show the text fields of a text object displaying wind chill in the following formats: 12ᵒF or 1ᵒC

This is done by first calculating wind chill using the current temperature ({wt}) and the wind speed in MPH ({wws}). Please note that while WatchMaker says it's outputting wind speed in Meters per Second (mps), it's always shown in MPH. Thus, we must also convert that to Km/h in the Celsius formula. Also note that Wind Chill is only calculated if the temperature is equal to or less than 50ᵒF (10ᵒC) and wind speed is greater than 3 MPH.

Once we've done the calculation, we need to concatenate the “ᵒF” or “ᵒC” to the formula. To do this, we need to fool LUA into thinking that we're dealing exclusively with strings (for some stupid reason… LUA isn't the smartest of languages sometimes). We do this by encapsulating the entire formula within a single set of parentheses. So, yes, the first and last parentheses are required. Then, we simply add the concatenation symbol “..” followed by the desired display in quotes (“ᵒF”, “ᵒC”, or even just “ᵒ”). Just be sure to include a single space on either side of the concatenation symbol.

tips/windchill.txt · Last modified: 2015/01/27 21:59 by jt3