Skip to content

Commit

Permalink
Merge branch 'v4' into feature/optimize_for_value
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsimley committed Apr 3, 2024
2 parents 6f23f6a + 614cffe commit 32d8e7c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions examples/40_test_derating.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(fmodel.core.as_dict()["farm"]["turbine_type"][0] + ".yaml")
)) as t:
turbine_type = yaml.safe_load(t)
turbine_type["power_thrust_model"] = "simple-derating"
turbine_type["operation_model"] = "simple-derating"

# Convert to a simple two turbine layout with derating turbines
fmodel.set(layout_x=[0, 1000.0], layout_y=[0.0, 0.0], turbine_type=[turbine_type])
Expand Down Expand Up @@ -82,7 +82,7 @@
ax.set_ylabel("Power produced (kW)")

# Second example showing mixed model use.
turbine_type["power_thrust_model"] = "mixed"
turbine_type["operation_model"] = "mixed"
yaw_angles = np.array([
[0.0, 0.0],
[0.0, 0.0],
Expand Down
2 changes: 1 addition & 1 deletion examples/41_test_disable_turbines.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
) as t:
turbine_type = yaml.safe_load(t)
turbine_type["power_thrust_model"] = "mixed"
turbine_type["operation_model"] = "mixed"
fmodel.set(turbine_type=[turbine_type])

# Consider a wind farm of 3 aligned wind turbines
Expand Down
6 changes: 3 additions & 3 deletions floris/core/turbine/turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


TURBINE_MODEL_MAP = {
"power_thrust_model": {
"operation_model": {
"simple": SimpleTurbine,
"cosine-loss": CosineLossTurbine,
"simple-derating": SimpleDeratingTurbine,
Expand Down Expand Up @@ -427,7 +427,7 @@ class Turbine(BaseClass):
hub_height: float = field()
TSR: float = field()
power_thrust_table: dict = field(default={}) # conversion to numpy in __post_init__
power_thrust_model: str = field(default="cosine-loss")
operation_model: str = field(default="cosine-loss")

correct_cp_ct_for_tilt: bool = field(default=False)
floating_tilt_table: dict[str, NDArrayFloat] | None = field(default=None)
Expand Down Expand Up @@ -469,7 +469,7 @@ def __post_init__(self) -> None:
self.power_thrust_table = floris_numeric_dict_converter(self.power_thrust_table)

def _initialize_power_thrust_functions(self) -> None:
turbine_function_model = TURBINE_MODEL_MAP["power_thrust_model"][self.power_thrust_model]
turbine_function_model = TURBINE_MODEL_MAP["operation_model"][self.operation_model]
self.thrust_coefficient_function = turbine_function_model.thrust_coefficient
self.axial_induction_function = turbine_function_model.axial_induction
self.power_function = turbine_function_model.power
Expand Down
12 changes: 6 additions & 6 deletions floris/floris_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,22 +1429,22 @@ def assign_hub_height_to_ref_height(self):

self.core.flow_field.reference_wind_height = unique_heights[0]

def get_power_thrust_model(self) -> str:
def get_operation_model(self) -> str:
"""Get the power thrust model of a FlorisModel.
Returns:
str: The power_thrust_model.
str: The operation_model.
"""
return self.core.farm.turbine_definitions[0]["power_thrust_model"]
return self.core.farm.turbine_definitions[0]["operation_model"]

def set_power_thrust_model(self, power_thrust_model: str):
def set_operation_model(self, operation_model: str):
"""Set the power thrust model of a FlorisModel.
Args:
power_thrust_model (str): The power thrust model to set.
operation_model (str): The power thrust model to set.
"""
turbine_type = self.core.farm.turbine_definitions[0]
turbine_type["power_thrust_model"] = power_thrust_model
turbine_type["operation_model"] = operation_model
self.set(turbine_type=[turbine_type])

def copy(self):
Expand Down
2 changes: 1 addition & 1 deletion floris/turbine_library/iea_10MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ turbine_type: 'iea_10MW'
hub_height: 119.0
rotor_diameter: 198.0
TSR: 8.0
power_thrust_model: cosine-loss
operation_model: cosine-loss
power_thrust_table:
ref_air_density: 1.225
ref_tilt: 6.0
Expand Down
2 changes: 1 addition & 1 deletion floris/turbine_library/iea_15MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ turbine_type: 'iea_15MW'
hub_height: 150.0
rotor_diameter: 242.24
TSR: 8.0
power_thrust_model: cosine-loss
operation_model: cosine-loss
power_thrust_table:
ref_air_density: 1.225
ref_tilt: 6.0
Expand Down
2 changes: 1 addition & 1 deletion floris/turbine_library/nrel_5MW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TSR: 8.0

###
# Model for power and thrust curve interpretation.
power_thrust_model: 'cosine-loss'
operation_model: 'cosine-loss'

###
# Cp and Ct as a function of wind speed for the turbine's full range of operating conditions.
Expand Down
2 changes: 1 addition & 1 deletion floris/turbine_library/turbine_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def build_cosine_loss_turbine_dict(
"hub_height": hub_height,
"rotor_diameter": rotor_diameter,
"TSR": TSR,
"power_thrust_model": "cosine-loss",
"operation_model": "cosine-loss",
"power_thrust_table": power_thrust_dict
}

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __init__(self):
"turbine_type": "nrel_5mw",
"rotor_diameter": 125.88,
"hub_height": 90.0,
"power_thrust_model": "cosine-loss",
"operation_model": "cosine-loss",
"power_thrust_table": {
"cosine_loss_exponent_yaw": 1.88,
"cosine_loss_exponent_tilt": 1.88,
Expand Down Expand Up @@ -532,7 +532,7 @@ def __init__(self):
"rotor_diameter": 125.88,
"hub_height": 90.0,
"generator_efficiency": 0.944,
"power_thrust_model": "cosine-loss",
"operation_model": "cosine-loss",
"pP": 1.88,
"pT": 1.88,
"ref_density_cp_ct": 1.225,
Expand Down
12 changes: 6 additions & 6 deletions tests/floris_model_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def test_disable_turbines():
)
) as t:
turbine_type = yaml.safe_load(t)
turbine_type["power_thrust_model"] = "mixed"
turbine_type["operation_model"] = "mixed"
fmodel.set(turbine_type=[turbine_type])

# Init to n-findex = 2, n_turbines = 3
Expand Down Expand Up @@ -633,12 +633,12 @@ def test_get_and_set_param():
alpha = fmodel.get_param(['wake', 'wake_velocity_parameters', 'gauss', 'alpha'])
assert alpha == 0.1

def test_get_power_thrust_model():
def test_get_operation_model():
fmodel = FlorisModel(configuration=YAML_INPUT)
assert fmodel.get_power_thrust_model() == "cosine-loss"
assert fmodel.get_operation_model() == "cosine-loss"

def test_set_power_thrust_model():
def test_set_operation_model():

fmodel = FlorisModel(configuration=YAML_INPUT)
fmodel.set_power_thrust_model("simple-derating")
assert fmodel.get_power_thrust_model() == "simple-derating"
fmodel.set_operation_model("simple-derating")
assert fmodel.get_operation_model() == "simple-derating"

0 comments on commit 32d8e7c

Please sign in to comment.