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 try/except to wind rose loader #874

Merged
merged 53 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d4785fb
Placeholder for Helix turbine operation model with test.
misi9170 Jan 11, 2024
6936fa8
Ruff.
misi9170 Jan 11, 2024
7bf692e
Merge branch 'v4' into v4-ms/helix-op-model
misi9170 Jan 19, 2024
80fc0ad
Placeholder for wake effect of Helix.
misi9170 Feb 8, 2024
2bc7f02
Merging v4 branch with derating model.
misi9170 Feb 8, 2024
9067470
Added helix wake mixing and created two examples.
jfrederik-nrel Mar 6, 2024
e714d63
Added examples
jfrederik-nrel Mar 6, 2024
bec8785
Latest file updates
Mar 13, 2024
e515243
Merge helix branch with v4 branch
Mar 13, 2024
823fc9d
Updated v4 to work with helix
jfrederik-nrel Mar 13, 2024
ca459f1
Make helix parameters tunable
jfrederik-nrel Mar 13, 2024
1e47380
Enabling helix tuning parameters
jfrederik-nrel Mar 13, 2024
672ffe1
Conform with ruff formatting reqs.
misi9170 Mar 13, 2024
52bed5b
Isort, end of file fixes.
misi9170 Mar 13, 2024
4e71bc3
helix_amplitudes into tests.
misi9170 Mar 13, 2024
e8af1b7
Take out actual tests of Helix to allow testing to pass; still to do …
misi9170 Mar 13, 2024
3d49dda
Update example input files with enable_helix_added_recovery flag.
misi9170 Mar 13, 2024
79c5ae9
Added helix turbine tests
jfrederik-nrel Mar 14, 2024
3454ced
Merge branch 'v4-jf/helix-op-model' of https://github.com/jfrederik-n…
jfrederik-nrel Mar 14, 2024
1736c7f
Added helix flow regression test
jfrederik-nrel Mar 14, 2024
ca8cc4e
Minor reorganize and cleanup of Helix tests.
misi9170 Mar 15, 2024
e361114
Added helix mixing to visualization tools
jfrederik-nrel Mar 17, 2024
2ad07c2
Added example showcasing helix functionality
jfrederik-nrel Mar 17, 2024
f19132a
Updated helix example
jfrederik-nrel Mar 17, 2024
30bda94
Deleted old helix examples
jfrederik-nrel Mar 18, 2024
cec8dcb
Added default helix tuning parameters for 5, 10 and 15MW turbine
jfrederik-nrel Mar 20, 2024
5c244c9
Merge branch 'v4' into v4-jf/helix-op-model
jfrederik-nrel Mar 21, 2024
67c27d2
Update floris_model.py
jfrederik-nrel Mar 21, 2024
f58dc22
Formatting.
misi9170 Mar 22, 2024
d9dfcef
Final tweaks to helix example
jfrederik-nrel Mar 22, 2024
3136870
Merge branch 'v4' into v4-jf/helix-op-model
jfrederik-nrel Mar 22, 2024
1674f05
Fix merge error.
misi9170 Mar 25, 2024
b3497c6
Remove carry-over from old package structure.
misi9170 Mar 26, 2024
8637cd7
Name change from `helix` to `awc`, addition of `awc_modes`.
jfrederik-nrel Mar 29, 2024
733a8ba
bug fix
jfrederik-nrel Mar 29, 2024
db6aed9
Sort imports.
misi9170 Mar 29, 2024
c958a4d
Remove extra mixing from awc in downstream turbines' wakes.
misi9170 Apr 1, 2024
494ee1c
Updates to helix example, tests, and input files based on feedback
jfrederik-nrel Apr 1, 2024
05f4e0c
Minor changes to helix example
jfrederik-nrel Apr 2, 2024
24a047d
Bug fix
jfrederik-nrel Apr 4, 2024
2363559
Minor changes
jfrederik-nrel Apr 4, 2024
59bec9b
Resolving final comments
jfrederik-nrel Apr 4, 2024
61271e5
Deleted commented code
jfrederik-nrel Apr 4, 2024
ed51adc
Merge branch 'v4' into v4-jf/helix-op-model
misi9170 Apr 5, 2024
3df4075
Update example to use new set_operation_model method.
misi9170 Apr 5, 2024
fe7814e
Merge v4, bring in examples refactor.
misi9170 Apr 5, 2024
6c11e45
Helix example moved to examples_control_types
misi9170 Apr 5, 2024
a942e61
Added warnings when models other than EmGauss are used
jfrederik-nrel Apr 5, 2024
c630ce8
Bugfix in check of awc and vel_model.
misi9170 Apr 5, 2024
a82973c
Handling for case when operation_model not specified; move tilt defle…
misi9170 Apr 5, 2024
517092f
Merge pull request #842 from jfrederik-nrel/v4-jf/helix-op-model
misi9170 Apr 5, 2024
403e5b6
Add try/except to wind rose loader
paulf81 Apr 5, 2024
56f332a
Merge branch 'v4' into feature/help_load_csv_windows
paulf81 Apr 5, 2024
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
160 changes: 160 additions & 0 deletions examples/examples_control_types/004_helix_active_wake_mixing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Copyright 2024 NREL

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# See https://floris.readthedocs.io for documentation

import matplotlib.pyplot as plt
import numpy as np
import yaml

import floris.flow_visualization as flowviz
from floris import FlorisModel


"""
Example to test out using helix wake mixing of upstream turbines.
Helix wake mixing is turned on at turbine 1, off at turbines 2 to 4;
Turbine 2 is in wake turbine 1, turbine 4 in wake of turbine 3.
"""

# Grab model of FLORIS and update to awc-enabled turbines
fmodel = FlorisModel("../inputs/emgauss_helix.yaml")
fmodel.set_operation_model("awc")

# Set the wind directions and speeds to be constant over N different helix amplitudes
N = 1
awc_modes = np.array(["helix", "baseline", "baseline", "baseline"]).reshape(4, N).T
awc_amplitudes = np.array([2.5, 0, 0, 0]).reshape(4, N).T

# Create 4 WT WF layout with lateral offset of 3D and streamwise offset of 4D
D = 240
fmodel.set(
layout_x=[0.0, 4*D, 0.0, 4*D],
layout_y=[0.0, 0.0, -3*D, -3*D],
wind_directions=270 * np.ones(N),
wind_speeds=8.0 * np.ones(N),
turbulence_intensities=0.06*np.ones(N),
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
fmodel.run()
turbine_powers = fmodel.get_turbine_powers()

# Plot the flow fields for T1 awc_amplitude = 2.5
horizontal_plane = fmodel.calculate_horizontal_plane(
x_resolution=200,
y_resolution=100,
height=150.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

y_plane_baseline = fmodel.calculate_y_plane(
x_resolution=200,
z_resolution=100,
crossstream_dist=0.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
y_plane_helix = fmodel.calculate_y_plane(
x_resolution=200,
z_resolution=100,
crossstream_dist=-3*D,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

cross_plane = fmodel.calculate_cross_plane(
y_resolution=100,
z_resolution=100,
downstream_dist=720.0,
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)

# Create the plots
fig, ax_list = plt.subplots(2, 2, figsize=(10, 8), tight_layout=True)
ax_list = ax_list.flatten()
flowviz.visualize_cut_plane(
horizontal_plane,
ax=ax_list[0],
label_contours=True,
title="Horizontal"
)
flowviz.visualize_cut_plane(
cross_plane,
ax=ax_list[2],
label_contours=True,
title="Spanwise profile at 3D"
)

# fig2, ax_list2 = plt.subplots(2, 1, figsize=(10, 8), tight_layout=True)
# ax_list2 = ax_list2.flatten()
flowviz.visualize_cut_plane(
y_plane_baseline,
ax=ax_list[1],
label_contours=True,
title="Streamwise profile, helix"
)
flowviz.visualize_cut_plane(
y_plane_helix,
ax=ax_list[3],
label_contours=True,
title="Streamwise profile, baseline"
)

# Calculate the effect of changing awc_amplitudes
N = 50
awc_amplitudes = np.array([
np.linspace(0, 5, N),
np.zeros(N), np.zeros(N), np.zeros(N)
]).reshape(4, N).T

# Reset FlorisModel for different helix amplitudes
fmodel.set(
wind_directions=270 * np.ones(N),
wind_speeds=8 * np.ones(N),
turbulence_intensities=0.06*np.ones(N),
awc_modes=awc_modes,
awc_amplitudes=awc_amplitudes
)
fmodel.run()
turbine_powers = fmodel.get_turbine_powers()

# Plot the power as a function of helix amplitude
fig_power, ax_power = plt.subplots()
ax_power.fill_between(
awc_amplitudes[:, 0],
0,
turbine_powers[:, 0]/1000,
color='C0',
label='Turbine 1'
)
ax_power.fill_between(
awc_amplitudes[:, 0],
turbine_powers[:, 0]/1000,
turbine_powers[:, :2].sum(axis=1)/1000,
color='C1',
label='Turbine 2'
)
ax_power.plot(
awc_amplitudes[:, 0],
turbine_powers[:,:2].sum(axis=1)/1000,
color='k',
label='Farm'
)

ax_power.set_xlabel("Upstream turbine helix amplitude [deg]")
ax_power.set_ylabel("Power [kW]")
ax_power.legend()

flowviz.show()
1 change: 1 addition & 0 deletions examples/inputs/cc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/emgauss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ wake:

enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_active_wake_mixing: false
enable_transverse_velocities: false

wake_deflection_parameters:
Expand Down
109 changes: 109 additions & 0 deletions examples/inputs/emgauss_helix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

name: Emperical Gaussian
description: Three turbines using empirical Gaussian model
floris_version: v4.0

logging:
console:
enable: true
level: WARNING
file:
enable: false
level: WARNING

solver:
type: turbine_grid
turbine_grid_points: 3

farm:
layout_x:
- 0.0
- 630.0
- 1260.0
layout_y:
- 0.0
- 0.0
- 0.0
turbine_type:
- iea_15MW

flow_field:
air_density: 1.225
reference_wind_height: -1 # -1 is code for use the hub height
turbulence_intensities:
- 0.06
wind_directions:
- 270.0
wind_shear: 0.12
wind_speeds:
- 8.0
wind_veer: 0.0

wake:
model_strings:
combination_model: sosfs
deflection_model: empirical_gauss
turbulence_model: wake_induced_mixing
velocity_model: empirical_gauss

enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_active_wake_mixing: true
enable_transverse_velocities: false

wake_deflection_parameters:
gauss:
ad: 0.0
alpha: 0.58
bd: 0.0
beta: 0.077
dm: 1.0
ka: 0.38
kb: 0.004
jimenez:
ad: 0.0
bd: 0.0
kd: 0.05
empirical_gauss:
horizontal_deflection_gain_D: 3.0
vertical_deflection_gain_D: -1
deflection_rate: 30
mixing_gain_deflection: 0.0
yaw_added_mixing_gain: 0.0

wake_velocity_parameters:
cc:
a_s: 0.179367259
b_s: 0.0118889215
c_s1: 0.0563691592
c_s2: 0.13290157
a_f: 3.11
b_f: -0.68
c_f: 2.41
alpha_mod: 1.0
gauss:
alpha: 0.58
beta: 0.077
ka: 0.38
kb: 0.004
jensen:
we: 0.05
empirical_gauss:
wake_expansion_rates:
- 0.023
- 0.008
breakpoints_D:
- 10
sigma_0_D: 0.28
smoothing_length_D: 2.0
mixing_gain_velocity: 2.0
awc_wake_exp: 1.2
awc_wake_denominator: 400
wake_turbulence_parameters:
crespo_hernandez:
initial: 0.1
constant: 0.5
ai: 0.8
downstream: -0.32
wake_induced_mixing:
atmospheric_ti_gain: 0.0
4 changes: 4 additions & 0 deletions examples/inputs/gch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ wake:
# Can be "true" or "false".
enable_yaw_added_recovery: true

###
# Can be "true" or "false".
enable_active_wake_mixing: false

###
# Can be "true" or "false".
enable_transverse_velocities: true
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_heterogeneous_inflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_multi_dim_cp_ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/gch_multiple_turbine_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/jensen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs/turbopark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: false
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating_fixedtilt15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/emgauss_floating_fixedtilt5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: false
enable_yaw_added_recovery: true
enable_transverse_velocities: false
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/gch_fixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
1 change: 1 addition & 0 deletions examples/inputs_floating/gch_floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ wake:
enable_secondary_steering: true
enable_yaw_added_recovery: true
enable_transverse_velocities: true
enable_active_wake_mixing: false

wake_deflection_parameters:
gauss:
Expand Down
Loading
Loading