-
Notifications
You must be signed in to change notification settings - Fork 150
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
Issue alert if calc wake needs to be run #432
Conversation
examples/make_error.py
Outdated
@@ -0,0 +1,15 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice to demonstrate, but we should remember to remove this example file before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
floris/tools/floris_interface.py
Outdated
@@ -558,12 +558,20 @@ def check_wind_condition_for_viz(self, wd=None, ws=None): | |||
if len(ws) > 1 or len(ws) < 1: | |||
raise ValueError("Wind speed input must be of length 1 for visualization. Current length is {}.".format(len(ws))) | |||
|
|||
def check_calc_wake_run(self, func_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this private, _check_calc_wake_run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, changed it
floris/tools/floris_interface.py
Outdated
@@ -558,12 +558,20 @@ def check_wind_condition_for_viz(self, wd=None, ws=None): | |||
if len(ws) > 1 or len(ws) < 1: | |||
raise ValueError("Wind speed input must be of length 1 for visualization. Current length is {}.".format(len(ws))) | |||
|
|||
def check_calc_wake_run(self, func_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make this private, _check_calc_wake_run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
floris/tools/floris_interface.py
Outdated
def get_turbine_powers(self) -> NDArrayFloat: | ||
"""Calculates the power at each turbine in the windfarm. | ||
|
||
Returns: | ||
NDArrayFloat: [description] | ||
""" | ||
|
||
self.check_calc_wake_run('get_turbine_powers') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! We also need to add it to get_farm_power
, and maybe some of the visualization functions?
floris/tools/floris_interface.py
Outdated
def get_turbine_powers(self) -> NDArrayFloat: | ||
"""Calculates the power at each turbine in the windfarm. | ||
|
||
Returns: | ||
NDArrayFloat: [description] | ||
""" | ||
|
||
self.check_calc_wake_run('get_turbine_powers') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! We also need to add it to get_farm_power
, and maybe some of the visualization functions?
# Conflicts: # floris/tools/floris_interface.py
I'm not totally convinced about this |
@rafmudaf, I'm not totally convinced on it, though not opposed either, but I've also never quite found |
I'm not tied to the |
@@ -631,6 +639,10 @@ def get_farm_power( | |||
# for turbine in self.floris.farm.turbines: | |||
# turbine.use_turbulence_correction = use_turbulence_correction | |||
|
|||
# Confirm calculate wake has been run | |||
if self.floris.state is not State.USED: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulf81 I think we do not need this here since it would be caught by self.get_turbine_powers()
. Do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that makes sense to me, maybe this could be deleted and then we can make a test we get an error if calc wake not run before get_turbine_powers?
Just a first pass at an idea to address Issue #431
@Bartdoekemeijer what do you think?
Feature or improvement description
Check a certain attribute exists to determine if calc wake needs to be run
Related issue, if one exists
Issue #431