Skip to content

Commit

Permalink
Partially connect yaw to foxes
Browse files Browse the repository at this point in the history
  • Loading branch information
rafmudaf committed Mar 21, 2024
1 parent 89a76e9 commit 042df6d
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ wind_farm: !include wind_farm.yaml
attributes:
analyses:
yaw_angles:
- 12.0
- 10.0
wake_model:
velocity:
name: bastankhah2016
parameters:
alpha: 0.58
beta: 0.077
k: 0.38
k: 0.022
deflection:
name: bastankhah2016_deflection
parameters:
ad: 0.0
bd: 0.0
alpha: 0.58
beta: 0.077
ka: 0.38
kb: 0.004
k: 0.022
47 changes: 35 additions & 12 deletions examples/torque2024_1turbine.ipynb

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions examples/wesc2023_demo.ipynb

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions wcomp/floris_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@
"bastankhah2016_deflection": {
"model_ref": "gauss",
"parameters": {
"ad": "ad",
"bd": "bd",
"alpha": "alpha",
"beta": "beta",
"ka": "ka",
"kb": "kb",
"ka": "k",
"kb": "k",
}
},
}
Expand Down
25 changes: 25 additions & 0 deletions wcomp/foxes_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import foxes
from foxes.algorithms.downwind import Downwind
from foxes.core import WindFarm, WakeModel
from foxes.input.farm_layout import add_from_df
Expand Down Expand Up @@ -78,6 +79,7 @@
"parameters": {
"alpha": "alpha",
"beta": "beta",
"k": "k",
}
},
}
Expand Down Expand Up @@ -314,6 +316,8 @@ def read_analyses(self, analyses, mbook, farm, states, keymap={}, **algo_pars):
The algorithm
"""
yaw_angles = np.array([analyses["yaw_angles"]])

wes_analysis = analyses
_velocity_model_mapping = WAKE_MODEL_MAPPING[wes_analysis["wake_model"]["velocity"]["name"]]
_velocity_model = _velocity_model_mapping["model_ref"]
Expand All @@ -322,6 +326,26 @@ def read_analyses(self, analyses, mbook, farm, states, keymap={}, **algo_pars):
for k, v in _velocity_model_mapping["parameters"].items()
}

if wes_analysis["wake_model"]["deflection"]["name"] is not None:
# NOTE: foxes supports only one deflection model, so there's no need to parse the
# deflection model settings from windIO.
# Check the name, and error if it isn't Bastankhah2016
if wes_analysis["wake_model"]["deflection"]["name"] != "bastankhah2016_deflection":
raise ValueError("foxes supports only Bastankhah2016 for the deflection model.")

# _deflection_model_mapping = WAKE_MODEL_MAPPING[wes_analysis["wake_model"]["deflection"]["name"]]
# _deflection_model = _deflection_model_mapping["model_ref"]
# _deflection_model_parameters = {
# k: wes_analysis["wake_model"]["deflection"]["parameters"][v]
# for k, v in _deflection_model_mapping["parameters"].items()
# }
# _deflection_model = _deflection_model(**_deflection_model_parameters)
mbook.turbine_models["set_yawm"] = foxes.models.turbine_models.SetFarmVars()
mbook.turbine_models["set_yawm"].add_var(FV.YAWM, yaw_angles)
wake_frame="yawed"
else:
wake_frame="rotor_wd"

temp_model_name = "this_model"
mbook.wake_models[temp_model_name] = _velocity_model(
**_velocity_model_parameters,
Expand All @@ -335,6 +359,7 @@ def read_analyses(self, analyses, mbook, farm, states, keymap={}, **algo_pars):
verbosity=0,
rotor_model="grid16",
wake_models=[temp_model_name],
wake_frame=wake_frame,
**algo_pars
)

Expand Down

0 comments on commit 042df6d

Please sign in to comment.