Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a few new WeatherHelper functions #1941

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

pgrawehr
Copy link
Contributor

@pgrawehr pgrawehr commented Oct 2, 2022

This PR adds some new functions to the WeatherHelper class.

Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Oct 2, 2022
Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

src/devices/Common/Iot/Device/Common/WeatherHelper.cs Outdated Show resolved Hide resolved
Improve comments, add constants
if (windSpeed < Speed.FromKilometersPerHour(1))
{
// otherwise, the result is unusable, because the second and third terms of the equation are 0, resulting in a constant offset from the input temperature
windSpeed = Speed.FromKilometersPerHour(1);
Copy link
Member

@krwq krwq Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to just return temperature here instead? (might make function non-continous, you might want to check math)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because if the wind speed is low, the returned temperature is above the input temperature. This is expected and explained in the documentation. Only if the wind speed is zero or almost zero, the formula gets completely off. So this condition basically limits the output temperature to be at most about 2 degrees over the input temperature.

@pgrawehr pgrawehr merged commit 08664fa into dotnet:main Oct 7, 2022
@pgrawehr pgrawehr deleted the NewWeatherFunctions branch October 7, 2022 06:57
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants