Skip to content

Commit

Permalink
0.0.14
Browse files Browse the repository at this point in the history
Corrected wind chill
  • Loading branch information
woessmich committed Jan 13, 2021
1 parent 373ce88 commit e4cbc4a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Further, the adapter provides a selection of useful minimum and maximum values o
The protocol sends a lightning distance of 0 when no lightning was detected. Values of 0 are modified to 999 to avoid the impression that lightning strikes are directly overhead.

## Changelog
### 0.0.14
(womi) Corrected wind chill calculation in feels like temperature calculation
### 0.0.13
(womi) Corrected precipitation duration (again); changed boolean raining behaviour
### 0.0.12
Expand Down
6 changes: 5 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"common": {
"name": "weatherflow_udp",
"version": "0.0.13",
"version": "0.0.14",
"news": {
"0.0.14": {
"en": "corrected calculation of windchill in feels like temperature",
"de": "Wind chill Temperatur korrigiert"
},
"0.0.13": {
"en": "Corrected precipitation duration; changed boolean raining behaviour",
"de": "Korrektur: Regendauer; Regenstart erkennung geändert"
Expand Down
12 changes: 7 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,14 +1032,14 @@ function beaufort(windspeed) {
}

/**
* Canvert wind speed from m/s to beauforts
* Convert wind speed from m/s to beauforts
* @param {number} temperature The local air temperature in °C
* @param {number} windspeed The current wind speed in m/s
* @param {number} humidity The local air humidity in %
* @returns {number} Feels like temperature in °C
*/
function feelsLike(temperature, windspeed, humidity) {
let feelsLikeTemperature = temperature;
let feelsLikeTemperature;
if (temperature >= 26.7 && humidity >= 40) { // heat index (https://de.wikipedia.org/wiki/Hitzeindex)
feelsLikeTemperature = (-8.784695 + 1.61139411 * temperature + 2.338549 * humidity);
feelsLikeTemperature += (-0.14611605 * temperature * humidity);
Expand All @@ -1048,10 +1048,12 @@ function feelsLike(temperature, windspeed, humidity) {
feelsLikeTemperature += (0.002211732 * (temperature ** 2) * humidity);
feelsLikeTemperature += (0.00072546 * temperature * (humidity ** 2));
feelsLikeTemperature += (-0.000003582 * (temperature ** 2) * (humidity ** 2));
} else if (temperature < 10 && windspeed > 1.4) { // wind chill (https://de.wikipedia.org/wiki/Windchill)
feelsLikeTemperature = 13.12 + 0.6215 * temperature + (((0.3965 * temperature - 11.37) * windspeed * 3.6) ** 0.16);
feelsLikeTemperature = Math.round(temperature * 10) / 10;
} else if (temperature < 10 && windspeed > (5 / 3.6)) { // wind chill (https://de.wikipedia.org/wiki/Windchill)
feelsLikeTemperature = 13.12 + 0.6215 * temperature + ((0.3965 * temperature) - 11.37) * ((windspeed * 3.6) ** 0.16);
} else {
feelsLikeTemperature = temperature;
}
feelsLikeTemperature = Math.round(feelsLikeTemperature * 10) / 10; // round to 1 decimal only

return feelsLikeTemperature;
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@
"test:package": "mocha test/package --exit",
"test:unit": "mocha test/unit --exit"
},
"version": "0.0.13"
"version": "0.0.14"
}

0 comments on commit e4cbc4a

Please sign in to comment.