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

Wind direction generation / tweaks of windpower #27772

Merged
merged 16 commits into from Jan 24, 2019
Merged

Wind direction generation / tweaks of windpower #27772

merged 16 commits into from Jan 24, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jan 22, 2019

Summary

SUMMARY: Content "Generates wind direction and improves wind strength random-ness'"

Purpose of change

Currently Wind Strength is generated quite simply : W = std::max( 0, 1020 - static_cast<int>( P ) );
Literally the difference between a number and the current pressure.
This produces some strange results.
I've also added wind direction generation based on real-life data from Boston and surrounding New England area for prevailing winds.
Nothing uses this yet, but sailboats, hot air balloons, sheltering from wind, aerodynamics etc could all potentially use this.

I've made use of data from websites like :

https://www.windfinder.com/windstatistics/boston_logan_airport
https://weatherspark.com/y/26197/Average-Weather-in-Boston-Massachusetts-United-States-Year-Round

Describe the solution

This is currently the wind strength measured per hour from the game code, in Winter.

It goes over 90mph... and it's very random, there is none of the continuity you would see from weather fronts.

image

After the change this is Winter wind speed per hour.

image

You can see there are peaks ( much lower - as per real data ) the seasonal averages match up quite well to real life seasonal averages measured per hour.
The peaks are indicative of generally windy days, they rise and subside, weakly correlated with air pressure in the area.

Conversely, in-game the daily ( per minute ) measurements had no noise to them, because they followed a pressure value,

Here is in-game day ( per minute )

image

after the change it is more like this :

image

you can see it is moving towards a new value , with noise, on the way.

The wind direction describes the direction it is blowing from and has a raw angle ( for converting to vectors for vehicles etc ) and a string that prints out from the weather reader CBM ( or for a GUI element )

the distribution has random-ness but a typical winter might look like this :

image

Throughout the year, the prevailing wind is West to East, though Easterly winds also are quite common, there are seasonal variations, but Northerly and Southerly winds are less common.

Describe alternatives you've considered

Tried many different things.

Additional context

As with my previous PRs, I'm using this as a C++ learning exercise, so I may have committed some cardinal sins. Apologies if so.
The weather test code currently uses a RNG to set the seed, I used the same seed for all tests however.

For comparison , here is the Summer wind graph - more dead-wind days, solar power would be better here instead of wind turbines!

image

@ghost ghost changed the title WIP Wind direction generation / tweaks of windpower Wind direction generation / tweaks of windpower Jan 22, 2019
@nexusmrsep
Copy link
Contributor

Looks nice. I love how you delivered the statistics to visualize the effect. It would be nice if the constants (seed data) would be moved into JSON files for modability (simulation of regions other then NE), but since its kinda true for the whole weather system, it can be done anytime in the future.

src/weather_gen.cpp Outdated Show resolved Hide resolved
src/weather.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Weather Rain, snow, portal storms and non-temperature environment labels Jan 22, 2019
@kevingranade kevingranade merged commit e64e832 into CleverRaven:master Jan 24, 2019
@ghost ghost deleted the weather_test branch January 27, 2019 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Mechanics: Weather Rain, snow, portal storms and non-temperature environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants