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

Issue alert if calc wake needs to be run #432

Merged
merged 9 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions examples/make_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed


from floris.tools import FlorisInterface


fi = FlorisInterface("inputs/gch.yaml")

# # Convert to a simple two turbine layout
# fi.reinitialize( layout=( [0, 500.], [0., 0.] ) )


# fi.calculate_wake()

# Get the turbine powers
turbine_powers = fi.get_turbine_powers()/1000.
8 changes: 8 additions & 0 deletions floris/tools/floris_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good suggestion, changed it

Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed


if not hasattr('self.floris.farm', 'turbine_type_map'):
raise AttributeError('Cant call function %s without first calling calculate_wake' % func_name)

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')
Copy link
Collaborator

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?

Copy link
Collaborator

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?


turbine_powers = power(
air_density=self.floris.flow_field.air_density,
velocities=self.floris.flow_field.u,
Expand Down