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

Tum misalignment model #832

Draft
wants to merge 28 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d79e2c5
Add a place-holder mit loss function
paulf81 Feb 8, 2024
3f1ec29
track new mit loss model
paulf81 Feb 8, 2024
afcb344
Add mit loss model to tests
paulf81 Feb 8, 2024
c03e250
import mit loss model
paulf81 Feb 8, 2024
135dc64
add mit loss model class
paulf81 Feb 8, 2024
96538e7
Add an example to compare loss models
paulf81 Feb 8, 2024
c098819
Update example for clarity
misi9170 Feb 9, 2024
80ed080
Placeholder tests.
misi9170 Feb 9, 2024
56ba06c
test attributes.
misi9170 Feb 9, 2024
c78107f
Update names
paulf81 Feb 9, 2024
c55e3cd
fix comment
paulf81 Feb 9, 2024
5aa21dc
New TUM misalignment model and new IEA file
sTamaroTum Mar 5, 2024
a85ba4a
Merge branch 'tum_model_2' into v4
sTamaroTum Mar 5, 2024
c805ee0
ok
sTamaroTum Mar 6, 2024
3d40302
small fix
sTamaroTum Mar 6, 2024
448ac07
removed useless lines
sTamaroTum Mar 6, 2024
1957805
Remove assertions from tests; tests will need building out. Robust pa…
misi9170 Mar 6, 2024
4511a85
set, run in example.
misi9170 Mar 6, 2024
f68ac86
Format for ruff.
misi9170 Mar 6, 2024
3efd3fe
Remove assertions on tests; tests will still need to be built.
misi9170 Mar 6, 2024
5801a2a
Merge branch 'v4' into tum_model_2
misi9170 Mar 6, 2024
7ff1425
Remove v3 generator_efficiency key (remains on power_thrust_table for…
misi9170 Mar 6, 2024
f9de335
Added an if statement in get_ct() and find_cp() functions to add a sm…
sTamaroTum Mar 7, 2024
e108522
Replaced rotor_average_velocities with rotor_effective_velocities whe…
sTamaroTum Mar 7, 2024
84e0a5d
Added some np.squeeze() to suppress warnings arising during pytest
sTamaroTum Mar 7, 2024
39b0433
Corrected incoherent interpolation method (cubic) in get_pitch() and …
sTamaroTum Mar 7, 2024
f275e85
Testing the IEA 15 MW with the tum-loss model
sTamaroTum Mar 8, 2024
9111366
Added the look-up tables of Cp and Ct for the IEAs 10MW and 15MW, and…
sTamaroTum Mar 8, 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
87 changes: 87 additions & 0 deletions examples/41_compare_yaw_loss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# 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

from floris.tools import FlorisInterface


"""
Test alternative models of loss to yawing
"""

# Parameters
N = 101 # How many steps to cover yaw range in
yaw_max = 30 # Maximum yaw to test

# Set up the yaw angle sweep
yaw_angles = np.zeros((N,1))
yaw_angles[:,0] = np.linspace(-yaw_max, yaw_max, N)
print(yaw_angles.shape)



# Now loop over the operational models to compare
op_models = ["cosine-loss", "tum-loss"]
results = {}

for op_model in op_models:

print(f"Evaluating model: {op_model}")

# Grab model of FLORIS
fi = FlorisInterface("inputs/gch.yaml")

# Initialize to a simple 1 turbine case with n_findex = N
fi.set(
layout_x=[0],
layout_y=[0],
wind_directions=270 * np.ones(N),
wind_speeds=8 * np.ones(N),
)

with open(str(
fi.floris.as_dict()["farm"]["turbine_library_path"] /
(fi.floris.as_dict()["farm"]["turbine_type"][0] + ".yaml")
)) as t:
turbine_type = yaml.safe_load(t)
turbine_type["power_thrust_model"] = op_model

# Change the turbine type
fi.set(turbine_type=[turbine_type], yaw_angles=yaw_angles)

# Calculate the power
fi.run()
turbine_power = fi.get_turbine_powers().squeeze()

# Save the results
results[op_model] = turbine_power

# Plot the results
fig, ax = plt.subplots()

colors = ["C0", "k", "r"]
linestyles = ["solid", "dashed", "dotted"]
for key, c, ls in zip(results, colors, linestyles):
central_power = results[key][yaw_angles.squeeze() == 0]
ax.plot(yaw_angles.squeeze(), results[key]/central_power, label=key, color=c, linestyle=ls)

ax.grid(True)
ax.legend()
ax.set_xlabel("Yaw angle [deg]")
ax.set_ylabel("Normalized turbine power [deg]")

plt.show()
12 changes: 12 additions & 0 deletions floris/simulation/rotor_velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ def rotor_velocity_yaw_correction(

return rotor_effective_velocities

def tum_rotor_velocity_yaw_correction(
pP: float,
yaw_angles: NDArrayFloat,
rotor_effective_velocities: NDArrayFloat,
) -> NDArrayFloat:
# Compute the rotor effective velocity adjusting for yaw settings
pW = pP / 3.0 # Convert from pP to w
# TODO: cosine loss hard coded
rotor_effective_velocities = rotor_effective_velocities * cosd(yaw_angles) ** pW

return rotor_effective_velocities

def rotor_velocity_tilt_correction(
tilt_angles: NDArrayFloat,
ref_tilt: NDArrayFloat,
Expand Down
1 change: 1 addition & 0 deletions floris/simulation/turbine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
MixedOperationTurbine,
SimpleDeratingTurbine,
SimpleTurbine,
TUMLossTurbine,
)
Loading