diff --git a/examples/18_check_turbine.py b/examples/18_check_turbine.py index 5c061bf5b..2289b9e35 100644 --- a/examples/18_check_turbine.py +++ b/examples/18_check_turbine.py @@ -47,6 +47,11 @@ if t.suffix == ".yaml" and ("multi_dim" not in t.stem) ] +# TEMPORARY +print(turbines) +turbines = turbines[1:] +# END TEMPORARY + # Declare a set of figures for comparing cp and ct across models fig_cp_ct, axarr_cp_ct = plt.subplots(2,1,sharex=True,figsize=(10,10)) @@ -66,14 +71,14 @@ ) axarr_cp_ct[0].grid(True) axarr_cp_ct[0].legend() - axarr_cp_ct[0].set_ylabel('Cp') + axarr_cp_ct[0].set_ylabel('Power (kW)') axarr_cp_ct[1].plot( fi.floris.farm.turbine_map[0].power_thrust_table["wind_speed"], - fi.floris.farm.turbine_map[0].power_thrust_table["thrust"],label=t + fi.floris.farm.turbine_map[0].power_thrust_table["thrust_coefficient"],label=t ) axarr_cp_ct[1].grid(True) axarr_cp_ct[1].legend() - axarr_cp_ct[1].set_ylabel('Ct') + axarr_cp_ct[1].set_ylabel('Ct (-)') axarr_cp_ct[1].set_xlabel('Wind Speed (m/s)') # Create a figure diff --git a/examples/24_floating_turbine_models.py b/examples/24_floating_turbine_models.py index 18df4a631..863b896a4 100644 --- a/examples/24_floating_turbine_models.py +++ b/examples/24_floating_turbine_models.py @@ -26,7 +26,7 @@ is computed for each turbine based on effective velocity. This tilt angle is then passed on to the respective wake model. -The value of the parameter ref_tilt_cp_ct is the value of tilt at which the ct/cp curves +The value of the parameter ref_tilt is the value of tilt at which the ct/cp curves have been defined. If `correct_cp_ct_for_tilt` is True, then the difference between the current tilt as diff --git a/examples/29_floating_vs_fixedbottom_farm.py b/examples/29_floating_vs_fixedbottom_farm.py index 3e6716df1..e525f8c96 100644 --- a/examples/29_floating_vs_fixedbottom_farm.py +++ b/examples/29_floating_vs_fixedbottom_farm.py @@ -29,7 +29,7 @@ turbine based on effective velocity. This tilt angle is then passed on to the respective wake model. -The value of the parameter ref_tilt_cp_ct is the value of tilt at which the +The value of the parameter ref_tilt is the value of tilt at which the ct/cp curves have been defined. With `correct_cp_ct_for_tilt` True, the difference between the current diff --git a/examples/32_specify_turbine_power_curve.py b/examples/33_specify_turbine_power_curve.py similarity index 71% rename from examples/32_specify_turbine_power_curve.py rename to examples/33_specify_turbine_power_curve.py index 9eb1e3e13..8d80db8a6 100644 --- a/examples/32_specify_turbine_power_curve.py +++ b/examples/33_specify_turbine_power_curve.py @@ -16,8 +16,8 @@ import matplotlib.pyplot as plt import numpy as np -from floris.tools import FlorisInterface -from floris.turbine_library.turbine_utilities import build_turbine_dict +from floris.simulation import turbine +from floris.tools import build_turbine_dict, FlorisInterface """ @@ -30,24 +30,27 @@ """ # Generate an example turbine power and thrust curve for use in the FLORIS model +powers_orig = np.array([0, 30, 200, 500, 1000, 2000, 4000, 4000, 4000, 4000, 4000]) +wind_speeds = np.array([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]) +power_coeffs = powers_orig[1:]/(0.5*126.**2*np.pi/4*1.225*wind_speeds[1:]**3) turbine_data_dict = { - "wind_speed":[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20], - "power_absolute":[0, 30, 200, 500, 1000, 2000, 4000, 4000, 4000, 4000, 4000], + "wind_speed":list(wind_speeds), + "power_coefficient":[0]+list(power_coeffs), "thrust_coefficient":[0, 0.9, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.25, 0.2] } turbine_dict = build_turbine_dict( turbine_data_dict, "example_turbine", - file_path=None, + file_name=None, generator_efficiency=1, hub_height=90, pP=1.88, pT=1.88, rotor_diameter=126, TSR=8, - air_density=1.225, - ref_tilt_cp_ct=5 + ref_air_density=1.225, + ref_tilt=5 ) fi = FlorisInterface("inputs/gch.yaml") @@ -57,18 +60,25 @@ fi.reinitialize( layout_x=[0], layout_y=[0], - wind_speeds=wind_speeds, wind_directions=wind_directions, + wind_speeds=wind_speeds, turbine_type=[turbine_dict] ) fi.calculate_wake() powers = fi.get_farm_power() -fig, ax = plt.subplots(1,1) +specified_powers = ( + np.array(turbine_data_dict["power_coefficient"]) + *0.5*turbine_dict["ref_air_density"] + *turbine_dict["rotor_diameter"]**2*np.pi/4 + *np.array(turbine_data_dict["wind_speed"])**3 +)/1000 + +fig, ax = plt.subplots(1,1,sharex=True) ax.scatter(wind_speeds, powers/1000, color="C0", s=5, label="Test points") -ax.scatter(turbine_data_dict["wind_speed"], turbine_data_dict["power_absolute"], +ax.scatter(turbine_data_dict["wind_speed"], specified_powers, color="red", s=20, label="Specified points") ax.grid() diff --git a/examples/inputs/cc.yaml b/examples/inputs/cc.yaml index 922fadd05..eafd0a7de 100644 --- a/examples/inputs/cc.yaml +++ b/examples/inputs/cc.yaml @@ -1,7 +1,7 @@ name: CC description: Three turbines using Cumulative Gauss Curl model -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs/emgauss.yaml b/examples/inputs/emgauss.yaml index f984f421d..7faac7a7e 100644 --- a/examples/inputs/emgauss.yaml +++ b/examples/inputs/emgauss.yaml @@ -1,7 +1,7 @@ name: Emperical Gaussian description: Three turbines using emperical Gaussian model -floris_version: v3.x +floris_version: v4.x logging: console: diff --git a/examples/inputs/gch.yaml b/examples/inputs/gch.yaml index 220fafeac..110591193 100644 --- a/examples/inputs/gch.yaml +++ b/examples/inputs/gch.yaml @@ -12,7 +12,7 @@ description: Three turbines using Gauss Curl Hybrid model ### # The earliest verion of FLORIS this input file supports. # This is not currently only for the user's reference. -floris_version: v3.0.0 +floris_version: v4.x ### # Configure the logging level and where to show the logs. diff --git a/examples/inputs/gch_heterogeneous_inflow.yaml b/examples/inputs/gch_heterogeneous_inflow.yaml index d7cffa0d5..74e0075a1 100644 --- a/examples/inputs/gch_heterogeneous_inflow.yaml +++ b/examples/inputs/gch_heterogeneous_inflow.yaml @@ -1,6 +1,6 @@ name: GCH description: Three turbines using Gauss Curl Hybrid model -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs/gch_multi_dim_cp_ct.yaml b/examples/inputs/gch_multi_dim_cp_ct.yaml index 8709fbcc7..62088ca9f 100644 --- a/examples/inputs/gch_multi_dim_cp_ct.yaml +++ b/examples/inputs/gch_multi_dim_cp_ct.yaml @@ -1,7 +1,7 @@ name: GCH multi dimensional Cp/Ct description: Three turbines using GCH model -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs/gch_multiple_turbine_types.yaml b/examples/inputs/gch_multiple_turbine_types.yaml index ca2d86ea5..9f758c2a4 100644 --- a/examples/inputs/gch_multiple_turbine_types.yaml +++ b/examples/inputs/gch_multiple_turbine_types.yaml @@ -1,7 +1,7 @@ name: GCH description: Three turbines using Gauss Curl Hybrid model -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs/jensen.yaml b/examples/inputs/jensen.yaml index abb889e0a..d326376ea 100644 --- a/examples/inputs/jensen.yaml +++ b/examples/inputs/jensen.yaml @@ -1,7 +1,7 @@ name: Jensen-Jimenez description: Three turbines using Jensen / Jimenez models -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs/turbopark.yaml b/examples/inputs/turbopark.yaml index 85bda5fef..2de667cd7 100644 --- a/examples/inputs/turbopark.yaml +++ b/examples/inputs/turbopark.yaml @@ -1,7 +1,7 @@ name: TurbOPark description: Three turbines using TurbOPark model -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/emgauss_fixed.yaml b/examples/inputs_floating/emgauss_fixed.yaml index 9d0b23960..38803aa22 100644 --- a/examples/inputs_floating/emgauss_fixed.yaml +++ b/examples/inputs_floating/emgauss_fixed.yaml @@ -1,7 +1,7 @@ name: Emperical Gaussian description: Example of single fixed-bottom turbine -floris_version: v3.x +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/emgauss_floating.yaml b/examples/inputs_floating/emgauss_floating.yaml index 1fd66d217..56dfc52d4 100644 --- a/examples/inputs_floating/emgauss_floating.yaml +++ b/examples/inputs_floating/emgauss_floating.yaml @@ -1,7 +1,7 @@ name: Emperical Gaussian description: Example of single floating turbine -floris_version: v3.x +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/emgauss_floating_fixedtilt15.yaml b/examples/inputs_floating/emgauss_floating_fixedtilt15.yaml index dfb4e3155..bec65faca 100644 --- a/examples/inputs_floating/emgauss_floating_fixedtilt15.yaml +++ b/examples/inputs_floating/emgauss_floating_fixedtilt15.yaml @@ -1,7 +1,7 @@ name: Emperical Gaussian floating description: Single turbine using emperical Gaussian model for floating -floris_version: v3.x +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/emgauss_floating_fixedtilt5.yaml b/examples/inputs_floating/emgauss_floating_fixedtilt5.yaml index 67be5dfd3..18b4d7c65 100644 --- a/examples/inputs_floating/emgauss_floating_fixedtilt5.yaml +++ b/examples/inputs_floating/emgauss_floating_fixedtilt5.yaml @@ -1,7 +1,7 @@ name: Emperical Gaussian floating description: Single turbine using emperical Gaussian model for floating -floris_version: v3.x +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/gch_fixed.yaml b/examples/inputs_floating/gch_fixed.yaml index 497cecc95..5e3049944 100644 --- a/examples/inputs_floating/gch_fixed.yaml +++ b/examples/inputs_floating/gch_fixed.yaml @@ -1,7 +1,7 @@ name: GCH description: Example of single fixed-bottom turbine -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/gch_floating.yaml b/examples/inputs_floating/gch_floating.yaml index 31ff7c606..fb78a2123 100644 --- a/examples/inputs_floating/gch_floating.yaml +++ b/examples/inputs_floating/gch_floating.yaml @@ -2,7 +2,7 @@ name: GCH description: Example of single floating turbine -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/gch_floating_defined_floating.yaml b/examples/inputs_floating/gch_floating_defined_floating.yaml index 3096e4c2a..67f9fbe09 100644 --- a/examples/inputs_floating/gch_floating_defined_floating.yaml +++ b/examples/inputs_floating/gch_floating_defined_floating.yaml @@ -1,7 +1,7 @@ name: GCH description: Example of single floating turbine where the cp/ct is calculated with floating tilt included -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/examples/inputs_floating/turbine_files/nrel_5MW_fixed.yaml b/examples/inputs_floating/turbine_files/nrel_5MW_fixed.yaml index b1755ab6c..6dbc17450 100644 --- a/examples/inputs_floating/turbine_files/nrel_5MW_fixed.yaml +++ b/examples/inputs_floating/turbine_files/nrel_5MW_fixed.yaml @@ -5,165 +5,147 @@ pP: 1.88 pT: 1.88 rotor_diameter: 126.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 5.0 +ref_air_density: 1.225 +ref_tilt: 5.0 correct_cp_ct_for_tilt: True # Apply tilt correction to cp/ct power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 floating_tilt_table: tilt: diff --git a/examples/inputs_floating/turbine_files/nrel_5MW_floating.yaml b/examples/inputs_floating/turbine_files/nrel_5MW_floating.yaml index cf3bc3049..9f44fcfc7 100644 --- a/examples/inputs_floating/turbine_files/nrel_5MW_floating.yaml +++ b/examples/inputs_floating/turbine_files/nrel_5MW_floating.yaml @@ -5,165 +5,147 @@ pP: 1.88 pT: 1.88 rotor_diameter: 126.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 5.0 +ref_air_density: 1.225 +ref_tilt: 5.0 correct_cp_ct_for_tilt: True # Apply tilt correction to cp/ct power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 floating_tilt_table: tilt: diff --git a/examples/inputs_floating/turbine_files/nrel_5MW_floating_defined_floating.yaml b/examples/inputs_floating/turbine_files/nrel_5MW_floating_defined_floating.yaml index 4fa506e25..c9f491864 100644 --- a/examples/inputs_floating/turbine_files/nrel_5MW_floating_defined_floating.yaml +++ b/examples/inputs_floating/turbine_files/nrel_5MW_floating_defined_floating.yaml @@ -5,165 +5,147 @@ pP: 1.88 pT: 1.88 rotor_diameter: 126.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 5.0 +ref_air_density: 1.225 +ref_tilt: 5.0 correct_cp_ct_for_tilt: False # Do not apply tilt correction to cp/ct power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 floating_tilt_table: tilt: diff --git a/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt15.yaml b/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt15.yaml index da0d15a37..f3be753af 100644 --- a/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt15.yaml +++ b/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt15.yaml @@ -5,165 +5,147 @@ pP: 1.88 pT: 1.88 rotor_diameter: 126.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 5.0 +ref_air_density: 1.225 +ref_tilt: 5.0 correct_cp_ct_for_tilt: True # Apply tilt correction to cp/ct power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 floating_tilt_table: tilt: diff --git a/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt5.yaml b/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt5.yaml index b1755ab6c..6dbc17450 100644 --- a/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt5.yaml +++ b/examples/inputs_floating/turbine_files/nrel_5MW_floating_fixedtilt5.yaml @@ -5,165 +5,147 @@ pP: 1.88 pT: 1.88 rotor_diameter: 126.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 5.0 +ref_air_density: 1.225 +ref_tilt: 5.0 correct_cp_ct_for_tilt: True # Apply tilt correction to cp/ct power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 floating_tilt_table: tilt: diff --git a/floris/simulation/farm.py b/floris/simulation/farm.py index 12b2b478e..0b58cc936 100644 --- a/floris/simulation/farm.py +++ b/floris/simulation/farm.py @@ -115,11 +115,11 @@ class Farm(BaseClass): pTs: NDArrayFloat = field(init=False, factory=list) pTs_sorted: NDArrayFloat = field(init=False, factory=list) - ref_density_cp_cts: NDArrayFloat = field(init=False, factory=list) - ref_density_cp_cts_sorted: NDArrayFloat = field(init=False, factory=list) + ref_air_densities: NDArrayFloat = field(init=False, factory=list) + ref_air_densities_sorted: NDArrayFloat = field(init=False, factory=list) - ref_tilt_cp_cts: NDArrayFloat = field(init=False, factory=list) - ref_tilt_cp_cts_sorted: NDArrayFloat = field(init=False, factory=list) + ref_tilts: NDArrayFloat = field(init=False, factory=list) + ref_tilts_sorted: NDArrayFloat = field(init=False, factory=list) correct_cp_ct_for_tilt: NDArrayFloat = field(init=False, factory=list) correct_cp_ct_for_tilt_sorted: NDArrayFloat = field(init=False, factory=list) @@ -261,14 +261,14 @@ def construct_turbine_pPs(self): def construct_turbine_pTs(self): self.pTs = np.array([turb['pT'] for turb in self.turbine_definitions]) - def construct_turbine_ref_density_cp_cts(self): - self.ref_density_cp_cts = np.array([ - turb['ref_density_cp_ct'] for turb in self.turbine_definitions + def construct_turbine_ref_air_densities(self): + self.ref_air_densities = np.array([ + turb['ref_air_density'] for turb in self.turbine_definitions ]) - def construct_turbine_ref_tilt_cp_cts(self): - self.ref_tilt_cp_cts = np.array( - [turb['ref_tilt_cp_ct'] for turb in self.turbine_definitions] + def construct_turbine_ref_tilts(self): + self.ref_tilts = np.array( + [turb['ref_tilt'] for turb in self.turbine_definitions] ) def construct_turbine_correct_cp_ct_for_tilt(self): @@ -348,13 +348,13 @@ def expand_farm_properties(self, n_findex: int, sorted_coord_indices): sorted_coord_indices, axis=1 ) - self.ref_density_cp_cts_sorted = np.take_along_axis( - self.ref_density_cp_cts * template_shape, + self.ref_air_densities_sorted = np.take_along_axis( + self.ref_air_densities * template_shape, sorted_coord_indices, axis=1 ) - self.ref_tilt_cp_cts_sorted = np.take_along_axis( - self.ref_tilt_cp_cts * template_shape, + self.ref_tilts_sorted = np.take_along_axis( + self.ref_tilts * template_shape, sorted_coord_indices, axis=1 ) @@ -396,11 +396,11 @@ def set_yaw_angles(self, n_findex: int): def set_tilt_to_ref_tilt(self, n_findex: int): self.tilt_angles = ( np.ones((n_findex, self.n_turbines)) - * self.ref_tilt_cp_cts + * self.ref_tilts ) self.tilt_angles_sorted = ( np.ones((n_findex, self.n_turbines)) - * self.ref_tilt_cp_cts + * self.ref_tilts ) def calculate_tilt_for_eff_velocities(self, rotor_effective_velocities): @@ -450,13 +450,13 @@ def finalize(self, unsorted_indices): unsorted_indices[:,:,0,0], axis=1 ) - self.ref_density_cp_cts = np.take_along_axis( - self.ref_density_cp_cts_sorted, + self.ref_air_densities = np.take_along_axis( + self.ref_air_densities_sorted, unsorted_indices[:,:,0,0], axis=1 ) - self.ref_tilt_cp_cts = np.take_along_axis( - self.ref_tilt_cp_cts_sorted, + self.ref_tilts = np.take_along_axis( + self.ref_tilts_sorted, unsorted_indices[:,:,0,0], axis=1 ) diff --git a/floris/simulation/floris.py b/floris/simulation/floris.py index f1fab63ea..70d64554d 100644 --- a/floris/simulation/floris.py +++ b/floris/simulation/floris.py @@ -100,8 +100,8 @@ def __attrs_post_init__(self) -> None: self.farm.construct_turbine_TSRs() self.farm.construct_turbine_pPs() self.farm.construct_turbine_pTs() - self.farm.construct_turbine_ref_density_cp_cts() - self.farm.construct_turbine_ref_tilt_cp_cts() + self.farm.construct_turbine_ref_air_densities() + self.farm.construct_turbine_ref_tilts() self.farm.construct_turbine_tilt_interps() self.farm.construct_turbine_correct_cp_ct_for_tilt() self.farm.set_yaw_angles(self.flow_field.n_findex) @@ -166,23 +166,23 @@ def check_deprecated_inputs(self): # Check for missing values add in version 3.2 and 3.4 for turbine in self.farm.turbine_definitions: - if "ref_density_cp_ct" not in turbine.keys(): + if "ref_air_density" not in turbine.keys(): error_messages.append( - "From FLORIS v3.2, the turbine definition must include 'ref_density_cp_ct'. " + "From FLORIS v3.2, the turbine definition must include 'ref_air_density'. " "This value represents the air density at which the provided Cp and Ct " "curves are defined. Previously, this was assumed to be 1.225 kg/m^3, " "and other air density values applied were assumed to be a deviation " "from the defined level. FLORIS now requires the user to explicitly " - "define the reference density. Add 'ref_density_cp_ct' to your " + "define the reference density. Add 'ref_air_density' to your " "turbine definition and try again. For a description of the turbine inputs, " "see https://nrel.github.io/floris/input_reference_turbine.html." ) - if "ref_tilt_cp_ct" not in turbine.keys(): + if "ref_tilt" not in turbine.keys(): error_messages.append( - "From FLORIS v3.4, the turbine definition must include 'ref_tilt_cp_ct'. " + "From FLORIS v3.4, the turbine definition must include 'ref_tilt'. " "This value represents the tilt angle at which the provided Cp and Ct " - "curves are defined. Add 'ref_tilt_cp_ct' to your turbine definition and " + "curves are defined. Add 'ref_tilt' to your turbine definition and " "try again. For a description of the turbine inputs, " "see https://nrel.github.io/floris/input_reference_turbine.html." ) diff --git a/floris/simulation/solver.py b/floris/simulation/solver.py index 35c48384d..54872d88a 100644 --- a/floris/simulation/solver.py +++ b/floris/simulation/solver.py @@ -105,7 +105,7 @@ def sequential_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -121,7 +121,7 @@ def sequential_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -280,8 +280,8 @@ def full_flow_sequential_solver( turbine_grid_farm.construct_turbine_TSRs() turbine_grid_farm.construct_turbine_pPs() turbine_grid_farm.construct_turbine_pTs() - turbine_grid_farm.construct_turbine_ref_density_cp_cts() - turbine_grid_farm.construct_turbine_ref_tilt_cp_cts() + turbine_grid_farm.construct_turbine_ref_air_densities() + turbine_grid_farm.construct_turbine_ref_tilts() turbine_grid_farm.construct_turbine_tilt_interps() turbine_grid_farm.construct_turbine_correct_cp_ct_for_tilt() turbine_grid_farm.set_tilt_to_ref_tilt(flow_field.n_findex) @@ -335,7 +335,7 @@ def full_flow_sequential_solver( velocities=turbine_grid_flow_field.u_sorted, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -349,7 +349,7 @@ def full_flow_sequential_solver( velocities=turbine_grid_flow_field.u_sorted, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -496,7 +496,7 @@ def cc_solver( turb_avg_vels, farm.yaw_angles_sorted, farm.tilt_angles_sorted, - farm.ref_tilt_cp_cts_sorted, + farm.ref_tilts_sorted, farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -509,7 +509,7 @@ def cc_solver( turb_avg_vels, farm.yaw_angles_sorted, farm.tilt_angles_sorted, - farm.ref_tilt_cp_cts_sorted, + farm.ref_tilts_sorted, farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -527,7 +527,7 @@ def cc_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -682,8 +682,8 @@ def full_flow_cc_solver( turbine_grid_farm.construct_turbine_TSRs() turbine_grid_farm.construct_turbine_pPs() turbine_grid_farm.construct_turbine_pTs() - turbine_grid_farm.construct_turbine_ref_density_cp_cts() - turbine_grid_farm.construct_turbine_ref_tilt_cp_cts() + turbine_grid_farm.construct_turbine_ref_air_densities() + turbine_grid_farm.construct_turbine_ref_tilts() turbine_grid_farm.construct_turbine_tilt_interps() turbine_grid_farm.construct_turbine_correct_cp_ct_for_tilt() turbine_grid_farm.set_tilt_to_ref_tilt(flow_field.n_findex) @@ -741,7 +741,7 @@ def full_flow_cc_solver( velocities=turb_avg_vels, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -755,7 +755,7 @@ def full_flow_cc_solver( velocities=turbine_grid_flow_field.u_sorted, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -892,7 +892,7 @@ def turbopark_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -905,7 +905,7 @@ def turbopark_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -921,7 +921,7 @@ def turbopark_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -979,7 +979,7 @@ def turbopark_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -1174,7 +1174,7 @@ def empirical_gauss_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -1190,7 +1190,7 @@ def empirical_gauss_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=farm.turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -1321,8 +1321,8 @@ def full_flow_empirical_gauss_solver( turbine_grid_farm.construct_turbine_TSRs() turbine_grid_farm.construct_turbine_pPs() turbine_grid_farm.construct_turbine_pTs() - turbine_grid_farm.construct_turbine_ref_density_cp_cts() - turbine_grid_farm.construct_turbine_ref_tilt_cp_cts() + turbine_grid_farm.construct_turbine_ref_air_densities() + turbine_grid_farm.construct_turbine_ref_tilts() turbine_grid_farm.construct_turbine_tilt_interps() turbine_grid_farm.construct_turbine_correct_cp_ct_for_tilt() turbine_grid_farm.set_tilt_to_ref_tilt(flow_field.n_findex) @@ -1377,7 +1377,7 @@ def full_flow_empirical_gauss_solver( velocities=turbine_grid_flow_field.u_sorted, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -1391,7 +1391,7 @@ def full_flow_empirical_gauss_solver( velocities=turbine_grid_flow_field.u_sorted, yaw_angle=turbine_grid_farm.yaw_angles_sorted, tilt_angle=turbine_grid_farm.tilt_angles_sorted, - ref_tilt_cp_ct=turbine_grid_farm.ref_tilt_cp_cts_sorted, + ref_tilt=turbine_grid_farm.ref_tilts_sorted, fCt=turbine_grid_farm.turbine_fCts, tilt_interp=turbine_grid_farm.turbine_tilt_interps, correct_cp_ct_for_tilt=turbine_grid_farm.correct_cp_ct_for_tilt_sorted, @@ -1512,7 +1512,7 @@ def sequential_multidim_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=downselect_turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, @@ -1528,7 +1528,7 @@ def sequential_multidim_solver( velocities=flow_field.u_sorted, yaw_angle=farm.yaw_angles_sorted, tilt_angle=farm.tilt_angles_sorted, - ref_tilt_cp_ct=farm.ref_tilt_cp_cts_sorted, + ref_tilt=farm.ref_tilts_sorted, fCt=downselect_turbine_fCts, tilt_interp=farm.turbine_tilt_interps, correct_cp_ct_for_tilt=farm.correct_cp_ct_for_tilt_sorted, diff --git a/floris/simulation/turbine.py b/floris/simulation/turbine.py index 1f39bad65..d7306ada5 100644 --- a/floris/simulation/turbine.py +++ b/floris/simulation/turbine.py @@ -49,7 +49,7 @@ def _rotor_velocity_yaw_correction( def _rotor_velocity_tilt_correction( turbine_type_map: NDArrayObject, tilt_angle: NDArrayFloat, - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, pT: float, tilt_interp: NDArrayObject, correct_cp_ct_for_tilt: NDArrayBool, @@ -67,7 +67,7 @@ def _rotor_velocity_tilt_correction( tilt_angle = np.where(correct_cp_ct_for_tilt, tilt_angle, old_tilt_angle) # Compute the rotor effective velocity adjusting for tilt - relative_tilt = tilt_angle - ref_tilt_cp_ct + relative_tilt = tilt_angle - ref_tilt rotor_effective_velocities = rotor_effective_velocities * cosd(relative_tilt) ** (pT / 3.0) return rotor_effective_velocities @@ -106,11 +106,11 @@ def compute_tilt_angles_for_floating_turbines( def rotor_effective_velocity( air_density: float, - ref_density_cp_ct: float, + ref_air_density: float, velocities: NDArrayFloat, yaw_angle: NDArrayFloat, tilt_angle: NDArrayFloat, - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, pP: float, pT: float, tilt_interp: NDArrayObject, @@ -131,7 +131,7 @@ def rotor_effective_velocity( velocities = velocities[:, ix_filter] yaw_angle = yaw_angle[:, ix_filter] tilt_angle = tilt_angle[:, ix_filter] - ref_tilt_cp_ct = ref_tilt_cp_ct[:, ix_filter] + ref_tilt = ref_tilt[:, ix_filter] pP = pP[:, ix_filter] pT = pT[:, ix_filter] turbine_type_map = turbine_type_map[:, ix_filter] @@ -144,7 +144,7 @@ def rotor_effective_velocity( method=average_method, cubature_weights=cubature_weights ) - rotor_effective_velocities = (air_density/ref_density_cp_ct)**(1/3) * average_velocities + rotor_effective_velocities = (air_density/ref_air_density)**(1/3) * average_velocities # Compute the rotor effective velocity adjusting for yaw settings rotor_effective_velocities = _rotor_velocity_yaw_correction( @@ -155,7 +155,7 @@ def rotor_effective_velocity( rotor_effective_velocities = _rotor_velocity_tilt_correction( turbine_type_map, tilt_angle, - ref_tilt_cp_ct, + ref_tilt, pT, tilt_interp, correct_cp_ct_for_tilt, @@ -166,7 +166,6 @@ def rotor_effective_velocity( def power( - ref_density_cp_ct: float, rotor_effective_velocities: NDArrayFloat, power_interp: dict[str, interp1d], turbine_type_map: NDArrayObject, @@ -176,9 +175,8 @@ def power( given in Watts. Args: - ref_density_cp_cts (NDArrayFloat[wd, ws, turbines]): The reference density for each turbine rotor_effective_velocities (NDArrayFloat[wd, ws, turbines]): The rotor - effective velocities at a turbine. + effective velocities at a turbine. Includes the air density correction. power_interp (dict[str, interp1d]): A dictionary of power interpolation functions for each turbine type. turbine_type_map: (NDArrayObject[wd, ws, turbines]): The Turbine type definition for @@ -215,14 +213,14 @@ def power( # type to the main thrust coefficient array p += power_interp[turb_type](rotor_effective_velocities) * (turbine_type_map == turb_type) - return p * ref_density_cp_ct + return p def Ct( velocities: NDArrayFloat, yaw_angle: NDArrayFloat, tilt_angle: NDArrayFloat, - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, fCt: dict, tilt_interp: NDArrayObject, correct_cp_ct_for_tilt: NDArrayBool, @@ -241,7 +239,7 @@ def Ct( a turbine. yaw_angle (NDArrayFloat[findex, turbines]): The yaw angle for each turbine. tilt_angle (NDArrayFloat[findex, turbines]): The tilt angle for each turbine. - ref_tilt_cp_ct (NDArrayFloat[findex, turbines]): The reference tilt angle for each turbine + ref_tilt (NDArrayFloat[findex, turbines]): The reference tilt angle for each turbine that the Cp/Ct tables are defined at. fCt (dict): The thrust coefficient interpolation functions for each turbine. Keys are the turbine type string and values are the interpolation functions. @@ -270,7 +268,7 @@ def Ct( velocities = velocities[:, ix_filter] yaw_angle = yaw_angle[:, ix_filter] tilt_angle = tilt_angle[:, ix_filter] - ref_tilt_cp_ct = ref_tilt_cp_ct[:, ix_filter] + ref_tilt = ref_tilt[:, ix_filter] turbine_type_map = turbine_type_map[:, ix_filter] correct_cp_ct_for_tilt = correct_cp_ct_for_tilt[:, ix_filter] @@ -302,7 +300,7 @@ def Ct( * (turbine_type_map == turb_type) ) thrust_coefficient = np.clip(thrust_coefficient, 0.0001, 0.9999) - effective_thrust = thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt_cp_ct) + effective_thrust = thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt) return effective_thrust @@ -310,7 +308,7 @@ def axial_induction( velocities: NDArrayFloat, # (findex, turbines, grid, grid) yaw_angle: NDArrayFloat, # (findex, turbines) tilt_angle: NDArrayFloat, # (findex, turbines) - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, fCt: dict, # (turbines) tilt_interp: NDArrayObject, # (turbines) correct_cp_ct_for_tilt: NDArrayBool, # (findex, turbines) @@ -327,7 +325,7 @@ def axial_induction( (number of turbines, ngrid, ngrid), or (ngrid, ngrid) for a single turbine. yaw_angle (NDArrayFloat[findex, turbines]): The yaw angle for each turbine. tilt_angle (NDArrayFloat[findex, turbines]): The tilt angle for each turbine. - ref_tilt_cp_ct (NDArrayFloat[findex, turbines]): The reference tilt angle for each turbine + ref_tilt (NDArrayFloat[findex, turbines]): The reference tilt angle for each turbine that the Cp/Ct tables are defined at. fCt (dict): The thrust coefficient interpolation functions for each turbine. Keys are the turbine type string and values are the interpolation functions. @@ -358,7 +356,7 @@ def axial_induction( velocities, yaw_angle, tilt_angle, - ref_tilt_cp_ct, + ref_tilt, fCt, tilt_interp, correct_cp_ct_for_tilt, @@ -372,15 +370,15 @@ def axial_induction( if ix_filter is not None: yaw_angle = yaw_angle[:, ix_filter] tilt_angle = tilt_angle[:, ix_filter] - ref_tilt_cp_ct = ref_tilt_cp_ct[:, ix_filter] + ref_tilt = ref_tilt[:, ix_filter] return ( 0.5 / (cosd(yaw_angle) - * cosd(tilt_angle - ref_tilt_cp_ct)) + * cosd(tilt_angle - ref_tilt)) * ( 1 - np.sqrt( - 1 - thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt_cp_ct) + 1 - thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt) ) ) ) @@ -477,8 +475,8 @@ class Turbine(BaseClass): TSR (float): The Tip Speed Ratio of the turbine. generator_efficiency (float): The efficiency of the generator used to scale power production. - ref_density_cp_ct (float): The density at which the provided Cp and Ct curves are defined. - ref_tilt_cp_ct (float): The implicit tilt of the turbine for which the Cp and Ct + ref_air_density (float): The density at which the provided Cp and Ct curves are defined. + ref_tilt (float): The implicit tilt of the turbine for which the Cp and Ct curves are defined. This is typically the nacelle tilt. power_thrust_table (dict[str, float]): Contains power coefficient and thrust coefficient values at a series of wind speeds to define the turbine performance. @@ -506,8 +504,8 @@ class Turbine(BaseClass): pT: float = field() TSR: float = field() generator_efficiency: float = field() - ref_density_cp_ct: float = field() - ref_tilt_cp_ct: float = field() + ref_air_density: float = field() + ref_tilt: float = field() power_thrust_table: dict[str, NDArrayFloat] = field(converter=floris_numeric_dict_converter) correct_cp_ct_for_tilt: bool = field(default=False) @@ -544,22 +542,11 @@ def _initialize_power_thrust_interpolation(self) -> None: # self.wind_speed = self.wind_speed[duplicate_filter] wind_speeds = self.power_thrust_table["wind_speed"] - cp_interp = interp1d( - wind_speeds, - self.power_thrust_table["power"], - fill_value=(0.0, 1.0), - bounds_error=False, - ) self.power_interp = interp1d( wind_speeds, - ( - 0.5 * self.rotor_area - * cp_interp(wind_speeds) - * self.generator_efficiency - * wind_speeds ** 3 - ), + self.power_thrust_table["power"] * 1e3, # Convert to W + fill_value=0.0, bounds_error=False, - fill_value=0 ) """ @@ -574,7 +561,7 @@ def _initialize_power_thrust_interpolation(self) -> None: """ self.fCt_interp = interp1d( wind_speeds, - self.power_thrust_table["thrust"], + self.power_thrust_table["thrust_coefficient"], fill_value=(0.0001, 0.9999), bounds_error=False, ) @@ -606,23 +593,29 @@ def check_power_thrust_table(self, instance: attrs.Attribute, value: dict) -> No Verify that the power and thrust tables are given with arrays of equal length to the wind speed array. """ - if len(value.keys()) != 3 or set(value.keys()) != {"wind_speed", "power", "thrust"}: + if (len(value.keys()) != 3 or + set(value.keys()) != {"wind_speed", "power", "thrust_coefficient"}): raise ValueError( """ power_thrust_table dictionary must have the form: { "wind_speed": List[float], "power": List[float], - "thrust": List[float], + "thrust_coefficient": List[float], } """ ) - if any(e.ndim > 1 for e in (value["power"], value["thrust"], value["wind_speed"])): - raise ValueError("power, thrust, and wind_speed inputs must be 1-D.") + if any(e.ndim > 1 for e in + (value["power"], value["thrust_coefficient"], value["wind_speed"]) + ): + raise ValueError("power, thrust_coefficient, and wind_speed inputs must be 1-D.") - if len( {value["power"].size, value["thrust"].size, value["wind_speed"].size} ) > 1: - raise ValueError("power, thrust, and wind_speed tables must be the same size.") + if (len( {value["power"].size, value["thrust_coefficient"].size, value["wind_speed"].size} ) + > 1): + raise ValueError( + "power, thrust_coefficient, and wind_speed tables must be the same size." + ) @rotor_diameter.validator def reset_rotor_diameter_dependencies(self, instance: attrs.Attribute, value: float) -> None: diff --git a/floris/simulation/turbine_multi_dim.py b/floris/simulation/turbine_multi_dim.py index ff993f0d0..3248ff4e4 100644 --- a/floris/simulation/turbine_multi_dim.py +++ b/floris/simulation/turbine_multi_dim.py @@ -42,7 +42,7 @@ def power_multidim( - ref_density_cp_ct: float, + ref_air_density: float, rotor_effective_velocities: NDArrayFloat, power_interp: NDArrayObject, ix_filter: NDArrayInt | Iterable[int] | None = None, @@ -51,7 +51,7 @@ def power_multidim( Cp/Ct values, adjusted for yaw and tilt. Value given in Watts. Args: - ref_density_cp_cts (NDArrayFloat[wd, ws, turbines]): The reference density for each turbine + ref_air_densities (NDArrayFloat[wd, ws, turbines]): The reference density for each turbine rotor_effective_velocities (NDArrayFloat[wd, ws, turbines, grid1, grid2]): The rotor effective velocities at a turbine. power_interp (NDArrayObject[wd, ws, turbines]): The power interpolation function @@ -85,14 +85,14 @@ def power_multidim( for j, turb in enumerate(findex): p[i, j] = power_interp[i, j](rotor_effective_velocities[i, j]) - return p * ref_density_cp_ct + return p * ref_air_density def Ct_multidim( velocities: NDArrayFloat, yaw_angle: NDArrayFloat, tilt_angle: NDArrayFloat, - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, fCt: list, tilt_interp: NDArrayObject, correct_cp_ct_for_tilt: NDArrayBool, @@ -112,7 +112,7 @@ def Ct_multidim( a turbine. yaw_angle (NDArrayFloat[wd, ws, turbines]): The yaw angle for each turbine. tilt_angle (NDArrayFloat[wd, ws, turbines]): The tilt angle for each turbine. - ref_tilt_cp_ct (NDArrayFloat[wd, ws, turbines]): The reference tilt angle for each turbine + ref_tilt (NDArrayFloat[wd, ws, turbines]): The reference tilt angle for each turbine that the Cp/Ct tables are defined at. fCt (list): The thrust coefficient interpolation functions for each turbine. tilt_interp (Iterable[tuple]): The tilt interpolation functions for each @@ -140,7 +140,7 @@ def Ct_multidim( velocities = velocities[:, ix_filter] yaw_angle = yaw_angle[:, ix_filter] tilt_angle = tilt_angle[:, ix_filter] - ref_tilt_cp_ct = ref_tilt_cp_ct[:, ix_filter] + ref_tilt = ref_tilt[:, ix_filter] fCt = fCt[:, ix_filter] turbine_type_map = turbine_type_map[:, ix_filter] correct_cp_ct_for_tilt = correct_cp_ct_for_tilt[:, ix_filter] @@ -168,7 +168,7 @@ def Ct_multidim( for j, turb in enumerate(findex): thrust_coefficient[i, j] = fCt[i, j](average_velocities[i, j]) thrust_coefficient = np.clip(thrust_coefficient, 0.0001, 0.9999) - effective_thrust = thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt_cp_ct) + effective_thrust = thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt) return effective_thrust @@ -176,7 +176,7 @@ def axial_induction_multidim( velocities: NDArrayFloat, # (wind directions, wind speeds, turbines, grid, grid) yaw_angle: NDArrayFloat, # (wind directions, wind speeds, turbines) tilt_angle: NDArrayFloat, # (wind directions, wind speeds, turbines) - ref_tilt_cp_ct: NDArrayFloat, + ref_tilt: NDArrayFloat, fCt: list, # (turbines) tilt_interp: NDArrayObject, # (turbines) correct_cp_ct_for_tilt: NDArrayBool, # (wind directions, wind speeds, turbines) @@ -193,7 +193,7 @@ def axial_induction_multidim( (number of turbines, ngrid, ngrid), or (ngrid, ngrid) for a single turbine. yaw_angle (NDArrayFloat[wd, ws, turbines]): The yaw angle for each turbine. tilt_angle (NDArrayFloat[wd, ws, turbines]): The tilt angle for each turbine. - ref_tilt_cp_ct (NDArrayFloat[wd, ws, turbines]): The reference tilt angle for each turbine + ref_tilt (NDArrayFloat[wd, ws, turbines]): The reference tilt angle for each turbine that the Cp/Ct tables are defined at. fCt (list): The thrust coefficient interpolation functions for each turbine. tilt_interp (Iterable[tuple]): The tilt interpolation functions for each @@ -223,7 +223,7 @@ def axial_induction_multidim( velocities, yaw_angle, tilt_angle, - ref_tilt_cp_ct, + ref_tilt, fCt, tilt_interp, correct_cp_ct_for_tilt, @@ -237,15 +237,15 @@ def axial_induction_multidim( if ix_filter is not None: yaw_angle = yaw_angle[:, ix_filter] tilt_angle = tilt_angle[:, ix_filter] - ref_tilt_cp_ct = ref_tilt_cp_ct[:, ix_filter] + ref_tilt = ref_tilt[:, ix_filter] return ( 0.5 / (cosd(yaw_angle) - * cosd(tilt_angle - ref_tilt_cp_ct)) + * cosd(tilt_angle - ref_tilt)) * ( 1 - np.sqrt( - 1 - thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt_cp_ct) + 1 - thrust_coefficient * cosd(yaw_angle) * cosd(tilt_angle - ref_tilt) ) ) ) @@ -396,7 +396,7 @@ class TurbineMultiDimensional(Turbine): tilt angle to power. generator_efficiency (:py:obj: float): The generator efficiency factor used to scale the power production. - ref_density_cp_ct (:py:obj: float): The density at which the provided + ref_air_density (:py:obj: float): The density at which the provided cp and ct is defined power_thrust_table (PowerThrustTable): A dictionary containing the following key-value pairs: diff --git a/floris/tools/__init__.py b/floris/tools/__init__.py index 6a2cca91b..4242e7be1 100644 --- a/floris/tools/__init__.py +++ b/floris/tools/__init__.py @@ -39,6 +39,7 @@ from .floris_interface import FlorisInterface from .floris_interface_legacy_reader import FlorisInterfaceLegacyV2 from .parallel_computing_interface import ParallelComputingInterface +from .turbine_utilities import build_turbine_dict, check_smooth_power_curve from .uncertainty_interface import UncertaintyInterface from .visualization import ( plot_rotor_values, diff --git a/floris/tools/convert_turbine_v3_to_v4.py b/floris/tools/convert_turbine_v3_to_v4.py new file mode 100644 index 000000000..21067ac93 --- /dev/null +++ b/floris/tools/convert_turbine_v3_to_v4.py @@ -0,0 +1,85 @@ +# Copyright 2021 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 + +""" +This script is intended to be called with an argument and converts a turbine +yaml file specified for FLORIS v3 to one specified for FLORIS v4. + +Usage: +python convert_turbine_yaml_v3_to_v4.py .yaml + +The resulting turbine is placed in the same directory as the original yaml, +and is appended _v4. +""" + +import sys +from ipaddress import v4_int_to_packed +from pathlib import Path + +from floris.tools import build_turbine_dict, check_smooth_power_curve +from floris.utilities import load_yaml + + +if len(sys.argv) != 2: + raise Exception("Usage: python convert_turbine_yaml_v3_to_v4.py .yaml") + +input_yaml = sys.argv[1] + +# Handling the path and new filename +input_path = Path(input_yaml) +split_input = input_path.parts +[filename_v3, extension] = split_input[-1].split(".") +filename_v4 = filename_v3 + "_v4" +split_output = list(split_input[:-1]) + [filename_v4+"."+extension] +output_path = Path(*split_output) + +# Load existing v3 model +v3_turbine_dict = load_yaml(input_yaml) + +# Split into components expected by build_turbine_dict +power_thrust_table = v3_turbine_dict["power_thrust_table"] +power_thrust_table["power_coefficient"] = power_thrust_table["power"] +power_thrust_table["thrust_coefficient"] = power_thrust_table["thrust"] +power_thrust_table.pop("power") +power_thrust_table.pop("thrust") + +valid_properties = [ + "generator_efficiency", + "hub_height", + "pP", + "pT", + "rotor_diameter", + "TSR", + "ref_air_density", + "ref_tilt" +] + +turbine_properties = {k:v for k,v in v3_turbine_dict.items() if k in valid_properties} +turbine_properties["ref_air_density"] = v3_turbine_dict["ref_density_cp_ct"] +if "ref_tilt_cp_ct" in v3_turbine_dict: + turbine_properties["ref_tilt"] = v3_turbine_dict["ref_tilt_cp_ct"] + +# Convert to v4 and print new yaml +v4_turbine_dict = build_turbine_dict( + power_thrust_table, + v3_turbine_dict["turbine_type"], + output_path, + **turbine_properties +) + +if not check_smooth_power_curve(v4_turbine_dict["power_thrust_table"]["power"], tolerance=0.001): + print( + "Non-smoothness detected in output power curve. ", + "Check above-rated power in generated v4 yaml file." + ) diff --git a/floris/tools/floris_interface.py b/floris/tools/floris_interface.py index 1b4951506..07e2eeb71 100644 --- a/floris/tools/floris_interface.py +++ b/floris/tools/floris_interface.py @@ -605,7 +605,6 @@ def get_turbine_powers(self) -> NDArrayFloat: self.logger.warning("Some rotor effective velocities are negative.") turbine_powers = power( - ref_density_cp_ct=self.floris.farm.ref_density_cp_cts, rotor_effective_velocities=self.turbine_effective_velocities, power_interp=self.floris.farm.turbine_power_interps, turbine_type_map=self.floris.farm.turbine_type_map, @@ -637,7 +636,7 @@ def get_turbine_powers_multidim(self) -> NDArrayFloat: ) turbine_powers = power_multidim( - ref_density_cp_ct=self.floris.farm.ref_density_cp_cts, + ref_air_density=self.floris.farm.ref_air_densities, rotor_effective_velocities=self.turbine_effective_velocities, power_interp=turbine_power_interps, ) @@ -648,7 +647,7 @@ def get_turbine_Cts(self) -> NDArrayFloat: velocities=self.floris.flow_field.u, yaw_angle=self.floris.farm.yaw_angles, tilt_angle=self.floris.farm.tilt_angles, - ref_tilt_cp_ct=self.floris.farm.ref_tilt_cp_cts, + ref_tilt=self.floris.farm.ref_tilts, fCt=self.floris.farm.turbine_fCts, tilt_interp=self.floris.farm.turbine_tilt_interps, correct_cp_ct_for_tilt=self.floris.farm.correct_cp_ct_for_tilt, @@ -663,7 +662,7 @@ def get_turbine_ais(self) -> NDArrayFloat: velocities=self.floris.flow_field.u, yaw_angle=self.floris.farm.yaw_angles, tilt_angle=self.floris.farm.tilt_angles, - ref_tilt_cp_ct=self.floris.farm.ref_tilt_cp_cts, + ref_tilt=self.floris.farm.ref_tilts, fCt=self.floris.farm.turbine_fCts, tilt_interp=self.floris.farm.turbine_tilt_interps, correct_cp_ct_for_tilt=self.floris.farm.correct_cp_ct_for_tilt, @@ -685,11 +684,11 @@ def turbine_average_velocities(self) -> NDArrayFloat: def turbine_effective_velocities(self) -> NDArrayFloat: rotor_effective_velocities = rotor_effective_velocity( air_density=self.floris.flow_field.air_density, - ref_density_cp_ct=self.floris.farm.ref_density_cp_cts, + ref_air_density=self.floris.farm.ref_air_densities, velocities=self.floris.flow_field.u, yaw_angle=self.floris.farm.yaw_angles, tilt_angle=self.floris.farm.tilt_angles, - ref_tilt_cp_ct=self.floris.farm.ref_tilt_cp_cts, + ref_tilt=self.floris.farm.ref_tilts, pP=self.floris.farm.pPs, pT=self.floris.farm.pTs, tilt_interp=self.floris.farm.turbine_tilt_interps, diff --git a/floris/tools/floris_interface_legacy_reader.py b/floris/tools/floris_interface_legacy_reader.py index 83f0ef7e7..300b3566c 100644 --- a/floris/tools/floris_interface_legacy_reader.py +++ b/floris/tools/floris_interface_legacy_reader.py @@ -188,7 +188,7 @@ def _convert_v24_dictionary_to_v3(dict_legacy): "rotor_diameter": tp["rotor_diameter"], "TSR": tp["TSR"], "power_thrust_table": tp["power_thrust_table"], - "ref_density_cp_ct": 1.225 # This was implicit in the former input file + "ref_air_density": 1.225 # This was implicit in the former input file } return dict_floris, dict_turbine diff --git a/floris/turbine_library/turbine_utilities.py b/floris/tools/turbine_utilities.py similarity index 57% rename from floris/turbine_library/turbine_utilities.py rename to floris/tools/turbine_utilities.py index c862c21bd..65664b163 100644 --- a/floris/turbine_library/turbine_utilities.py +++ b/floris/tools/turbine_utilities.py @@ -1,3 +1,17 @@ +# Copyright 2021 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 os.path import numpy as np @@ -7,15 +21,15 @@ def build_turbine_dict( turbine_data_dict, turbine_name, - file_path=None, + file_name=None, generator_efficiency=1.0, hub_height=90.0, pP=1.88, pT=1.88, rotor_diameter=126.0, TSR=8.0, - air_density=1.225, - ref_tilt_cp_ct=5.0 + ref_air_density=1.225, + ref_tilt=5.0 ): """ Tool for formatting a full turbine dict from data formatted as a @@ -45,17 +59,17 @@ def build_turbine_dict( turbine as a function of wind speed. Described in more detail above. turbine_name (string): Name of the turbine, which will be used for the turbine_type field as well as the filename. - file_path (): Path for placement of the produced yaml. Defaults to None, - in which case no yaml is written. + file_name (): Name for the produced yaml, including possibly path. + Defaults to None, in which case no yaml is written. generator_efficiency (float): Generator efficiency [-]. Defaults to 1.0. hub_height (float): Hub height [m]. Defaults to 90.0. pP (float): Cosine exponent for power loss to yaw [-]. Defaults to 1.88. pT (float): Cosine exponent for thrust loss to yaw [-]. Defaults to 1.88. rotor_diameter (float). Rotor diameter [m]. Defaults to 126.0. TSR (float). Turbine optimal tip-speed ratio [-]. Defaults to 8.0. - air_density (float). Air density used to specify power and thrust + ref_air_density (float). Air density used to specify power and thrust curves [kg/m^3]. Defaults to 1.225. - ref_tilt_cp_ct (float). Rotor tilt (due to shaft tilt and/or platform + ref_tilt (float). Rotor tilt (due to shaft tilt and/or platform tilt) used when defining the power and thrust curves [deg]. Defaults to 5.0. @@ -70,49 +84,48 @@ def build_turbine_dict( A = np.pi * rotor_diameter**2/4 # Construct the Cp curve - if "power_coefficient" in turbine_data_dict: - if "power_absolute" in turbine_data_dict: + if "power" in turbine_data_dict: + if "power_coefficient" in turbine_data_dict: print( - "Found both power_absolute and power_coefficient." - "Ignoring power_absolute." + "Found both power and power_coefficient. " + "Ignoring power_coefficient." ) - Cp = np.array(turbine_data_dict["power_coefficient"]) + p = np.array(turbine_data_dict["power"]) - elif "power_absolute" in turbine_data_dict: - P = np.array(turbine_data_dict["power_absolute"]) - if _find_nearest_value_for_wind_speed(P, u, 10) > 20000 or \ - _find_nearest_value_for_wind_speed(P, u, 10) < 1000: + elif "power_coefficient" in turbine_data_dict: + Cp = np.array(turbine_data_dict["power_coefficient"]) + if _find_nearest_value_for_wind_speed(Cp, u, 10) > 16.0/27.0 or \ + _find_nearest_value_for_wind_speed(Cp, u, 10) < 0.0: print( - "Unusual power value detected. Please check that power_absolute", - "is specified in kW." + "Unusual power coefficient detected. Check that power coefficients" + "are physical." ) - validity_mask = (P != 0) | (u != 0) - Cp = np.zeros_like(P, dtype=float) + validity_mask = (Cp != 0) | (u != 0) + p = np.zeros_like(Cp, dtype=float) - Cp[validity_mask] = (P[validity_mask]*1000) / \ - (0.5*air_density*A*u[validity_mask]**3) + p[validity_mask] = Cp[validity_mask]*0.5*ref_air_density*A*u[validity_mask]**3 / 1000 else: raise KeyError( - "Either power_absolute or power_coefficient must be specified." + "Either power or power_coefficient must be specified." ) # Construct Ct curve if "thrust_coefficient" in turbine_data_dict: - if "thrust_absolute" in turbine_data_dict: + if "thrust" in turbine_data_dict: print( - "Found both thrust_absolute and thrust_coefficient." - "Ignoring thrust_absolute." + "Found both thrust and thrust_coefficient. " + "Ignoring thrust." ) Ct = np.array(turbine_data_dict["thrust_coefficient"]) - elif "thrust_absolute" in turbine_data_dict: - T = np.array(turbine_data_dict["thrust_absolute"]) + elif "thrust" in turbine_data_dict: + T = np.array(turbine_data_dict["thrust"]) if _find_nearest_value_for_wind_speed(T, u, 10) > 3000 or \ _find_nearest_value_for_wind_speed(T, u, 10) < 100: print( - "Unusual thrust value detected. Please check that thrust_absolute", + "Unusual thrust value detected. Please check that thrust", "is specified in kN." ) @@ -120,18 +133,18 @@ def build_turbine_dict( Ct = np.zeros_like(T) Ct[validity_mask] = (T[validity_mask]*1000)/\ - (0.5*air_density*A*u[validity_mask]**2) + (0.5*ref_air_density*A*u[validity_mask]**2) else: raise KeyError( - "Either thrust_absolute or thrust_coefficient must be specified." + "Either thrust or thrust_coefficient must be specified." ) # Build the turbine dict power_thrust_dict = { "wind_speed": u.tolist(), - "power": Cp.tolist(), - "thrust": Ct.tolist() + "power": p.tolist(), + "thrust_coefficient": Ct.tolist() } turbine_dict = { @@ -142,21 +155,20 @@ def build_turbine_dict( "pT": pT, "rotor_diameter": rotor_diameter, "TSR": TSR, - "ref_density_cp_ct": air_density, - "ref_tilt_cp_ct": ref_tilt_cp_ct, + "ref_air_density": ref_air_density, + "ref_tilt": ref_tilt, "power_thrust_table": power_thrust_dict } # Create yaml file - if file_path is not None: - full_name = os.path.join(file_path, turbine_name+".yaml") + if file_name is not None: yaml.dump( turbine_dict, - open(full_name, "w"), + open(file_name, "w"), sort_keys=False ) - print(full_name, "created.") + print(file_name, "created.") return turbine_dict @@ -164,3 +176,23 @@ def _find_nearest_value_for_wind_speed(test_vals, ws_vals, ws): errs = np.absolute(ws_vals-ws) idx = errs.argmin() return test_vals[idx] + +def check_smooth_power_curve(power, tolerance=0.001): + """ + Check whether there are "wiggles" in the power signal. + """ + + if power[-1] < 0.95*max(power): # Cut-out or shutdown included + expected_changes = 2 + else: # Shutdown appears not to be included + expected_changes = 1 + + dirs = np.where( + np.abs(np.diff(power)) > tolerance, + np.sign(np.diff(power)), + np.zeros(len(power)-1) + ) + dir_changes = np.sum(np.abs(np.diff(dirs))) + is_smooth = dir_changes <= expected_changes + + return is_smooth diff --git a/floris/turbine_library/__init__.py b/floris/turbine_library/__init__.py index 933615b0c..828c50eb2 100644 --- a/floris/turbine_library/__init__.py +++ b/floris/turbine_library/__init__.py @@ -1,2 +1 @@ from floris.turbine_library.turbine_previewer import TurbineInterface, TurbineLibrary -from floris.turbine_library.turbine_utilities import build_turbine_dict diff --git a/floris/turbine_library/converted_from_v3/iea_10MW_v4converted.yaml b/floris/turbine_library/converted_from_v3/iea_10MW_v4converted.yaml new file mode 100644 index 000000000..7258b388b --- /dev/null +++ b/floris/turbine_library/converted_from_v3/iea_10MW_v4converted.yaml @@ -0,0 +1,178 @@ +turbine_type: iea_10MW +generator_efficiency: 1.0 +hub_height: 119.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 198.0 +TSR: 8.0 +ref_air_density: 1.225 +ref_tilt: 6.0 +power_thrust_table: + wind_speed: + - 0.0 + - 2.9 + - 3.0 + - 4.0 + - 4.5147 + - 5.0008 + - 5.4574 + - 5.8833 + - 6.2777 + - 6.6397 + - 6.9684 + - 7.2632 + - 7.5234 + - 7.7484 + - 7.9377 + - 8.0909 + - 8.2077 + - 8.2877 + - 8.3308 + - 8.337 + - 8.3678 + - 8.4356 + - 8.5401 + - 8.6812 + - 8.8585 + - 9.0717 + - 9.3202 + - 9.6035 + - 9.921 + - 10.272 + - 10.6557 + - 10.7577 + - 11.5177 + - 11.9941 + - 12.4994 + - 13.0324 + - 13.592 + - 14.1769 + - 14.7859 + - 15.4175 + - 16.0704 + - 16.7432 + - 17.4342 + - 18.1421 + - 18.8652 + - 19.6019 + - 20.3506 + - 21.1096 + - 21.8773 + - 22.6519 + - 23.4317 + - 24.215 + - 25.01 + - 25.02 + - 50.0 + power: + - 0.0 + - 0.0 + - 37.68094958908877 + - 392.3948496148231 + - 652.8777029978363 + - 949.7874838458624 + - 1273.9701534366477 + - 1624.53736790407 + - 1994.1716868646631 + - 2369.9141552410333 + - 2742.7863681556505 + - 3105.823526184341 + - 3451.7173408365657 + - 3770.7597566998656 + - 4053.935262364495 + - 4293.221213633668 + - 4481.848670501228 + - 4614.183183672742 + - 4686.546075837561 + - 4697.017416780224 + - 4749.267597733971 + - 4865.648149450861 + - 5048.724054152798 + - 5303.127287084259 + - 5634.732904516438 + - 6051.44102592321 + - 6562.487084906048 + - 7179.28820897481 + - 7915.149369234113 + - 8799.632659018345 + - 10000.004148840422 + - 10000.010118342427 + - 9999.986697903953 + - 10000.00900096281 + - 10000.010994188466 + - 9999.985254153351 + - 10000.01026748458 + - 10000.005066662203 + - 10000.02018584477 + - 10000.017032649757 + - 10000.030351494535 + - 10000.023814906699 + - 10000.036965698706 + - 10000.045823704839 + - 10000.005313131529 + - 9999.992881648563 + - 9999.96325689038 + - 9999.976811614484 + - 10000.028061758208 + - 9999.89737385537 + - 10000.082694480527 + - 10000.014032855759 + - 10011.87188590296 + - 0.0 + - 0.0 + thrust_coefficient: + - 0.0 + - 0.0 + - 0.7701 + - 0.7701 + - 0.7763 + - 0.7824 + - 0.782 + - 0.7802 + - 0.7772 + - 0.7719 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7675 + - 0.7651 + - 0.7587 + - 0.5056 + - 0.431 + - 0.3708 + - 0.3209 + - 0.2788 + - 0.2432 + - 0.2128 + - 0.1868 + - 0.1645 + - 0.1454 + - 0.1289 + - 0.1147 + - 0.1024 + - 0.0918 + - 0.0825 + - 0.0745 + - 0.0675 + - 0.0613 + - 0.0559 + - 0.0512 + - 0.047 + - 0.0 + - 0.0 diff --git a/floris/turbine_library/converted_from_v3/iea_15MW_v4converted.yaml b/floris/turbine_library/converted_from_v3/iea_15MW_v4converted.yaml new file mode 100644 index 000000000..66a7161cc --- /dev/null +++ b/floris/turbine_library/converted_from_v3/iea_15MW_v4converted.yaml @@ -0,0 +1,172 @@ +turbine_type: iea_15MW +generator_efficiency: 1.0 +hub_height: 150.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 242.24 +TSR: 8.0 +ref_air_density: 1.225 +ref_tilt: 6.0 +power_thrust_table: + wind_speed: + - 0.0 + - 3.0 + - 3.54953237 + - 4.067900771 + - 4.553906848 + - 5.006427063 + - 5.424415288 + - 5.806905228 + - 6.153012649 + - 6.461937428 + - 6.732965398 + - 6.965470002 + - 7.158913742 + - 7.312849418 + - 7.426921164 + - 7.500865272 + - 7.534510799 + - 7.541241633 + - 7.58833327 + - 7.675676842 + - 7.803070431 + - 7.970219531 + - 8.176737731 + - 8.422147605 + - 8.70588182 + - 9.027284445 + - 9.385612468 + - 9.780037514 + - 10.20964776 + - 10.67345004 + - 10.86770694 + - 11.17037214 + - 11.6992653 + - 12.25890683 + - 12.84800295 + - 13.46519181 + - 14.10904661 + - 14.77807889 + - 15.470742 + - 16.18543466 + - 16.92050464 + - 17.67425264 + - 18.44493615 + - 19.23077353 + - 20.02994808 + - 20.8406123 + - 21.66089211 + - 22.4888912 + - 23.32269542 + - 24.1603772 + - 25.0 + - 25.02 + - 50.0 + power: + - 0.0 + - 37.62161892251866 + - 283.1896270728138 + - 593.2728560522313 + - 959.9819840653767 + - 1372.9939673445779 + - 1820.2824213031413 + - 2288.234638675552 + - 2762.402356940621 + - 3227.9317849259483 + - 3670.23524006855 + - 4075.3355492549404 + - 4424.289670276729 + - 4712.31145096999 + - 4933.478791318434 + - 5080.411002639729 + - 5148.20416793432 + - 5161.8373266616445 + - 5257.877358155053 + - 5439.0905873988 + - 5710.644642926693 + - 6080.1808123220335 + - 6557.896472825747 + - 7156.656114121487 + - 7892.096068144686 + - 8782.7485712001 + - 9850.132658272489 + - 11118.833728910668 + - 12616.55466282621 + - 14395.650060011094 + - 15180.873696159935 + - 15180.878025972781 + - 15180.846427684693 + - 15180.874525641515 + - 15180.873081482694 + - 15180.868180147516 + - 15180.964634095619 + - 15180.928211309449 + - 15180.909227363609 + - 15180.898248776428 + - 15180.890850809097 + - 15180.885382324133 + - 15180.881159484874 + - 15180.877937975014 + - 15180.875500759283 + - 15180.873891022644 + - 15180.894816053498 + - 15180.873173416821 + - 15180.873965755092 + - 15180.875620174738 + - 15180.87762584068 + - 0.0 + - 0.0 + thrust_coefficient: + - 0.0 + - 0.817533319 + - 0.792115292 + - 0.786401899 + - 0.788898744 + - 0.790774576 + - 0.79208669 + - 0.79185809 + - 0.7903853 + - 0.788253035 + - 0.785845184 + - 0.783367164 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.781531069 + - 0.758935311 + - 0.614478855 + - 0.498687801 + - 0.416354609 + - 0.351944846 + - 0.299832337 + - 0.256956606 + - 0.221322169 + - 0.19150758 + - 0.166435523 + - 0.145263684 + - 0.127319849 + - 0.11206048 + - 0.099042189 + - 0.087901155 + - 0.078337446 + - 0.07010295 + - 0.062991402 + - 0.056831647 + - 0.05148062 + - 0.046818787 + - 0.0 + - 0.0 diff --git a/floris/turbine_library/converted_from_v3/nrel_5MW_v4converted.yaml b/floris/turbine_library/converted_from_v3/nrel_5MW_v4converted.yaml new file mode 100644 index 000000000..0dba7d187 --- /dev/null +++ b/floris/turbine_library/converted_from_v3/nrel_5MW_v4converted.yaml @@ -0,0 +1,166 @@ +turbine_type: nrel_5MW +generator_efficiency: 1.0 +hub_height: 90.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 126.0 +TSR: 8.0 +ref_air_density: 1.225 +ref_tilt: 5.0 +power_thrust_table: + wind_speed: + - 0.0 + - 2.0 + - 2.5 + - 3.0 + - 3.5 + - 4.0 + - 4.5 + - 5.0 + - 5.5 + - 6.0 + - 6.5 + - 7.0 + - 7.5 + - 8.0 + - 8.5 + - 9.0 + - 9.5 + - 10.0 + - 10.5 + - 11.0 + - 11.5 + - 12.0 + - 12.5 + - 13.0 + - 13.5 + - 14.0 + - 14.5 + - 15.0 + - 15.5 + - 16.0 + - 16.5 + - 17.0 + - 17.5 + - 18.0 + - 18.5 + - 19.0 + - 19.5 + - 20.0 + - 20.5 + - 21.0 + - 21.5 + - 22.0 + - 22.5 + - 23.0 + - 23.5 + - 24.0 + - 24.5 + - 25.0 + - 25.01 + - 25.02 + - 50.0 + power: + - 0.0 + - 0.0 + - 0.0 + - 36.722155848902254 + - 94.65678115354163 + - 170.596391826316 + - 267.74933496419163 + - 387.64681352354114 + - 533.9617151673435 + - 707.4062402827329 + - 909.9965782677073 + - 1142.7197798534328 + - 1407.4994184495558 + - 1707.1272243371227 + - 2047.3355806543098 + - 2430.5778091805637 + - 2858.3081150622215 + - 3329.100627354195 + - 3842.9755943182267 + - 4403.86140594055 + - 4999.993508066915 + - 4999.99850473839 + - 4999.997854617397 + - 5000.00304890274 + - 5000.002113339491 + - 4999.997282778227 + - 5000.002243172759 + - 5000.000360590384 + - 5000.009074693787 + - 4999.987262704901 + - 5000.007345811091 + - 5000.006875165497 + - 4999.994990648268 + - 4999.97705933755 + - 4999.983698972648 + - 4999.991318085188 + - 5000.024022703328 + - 5000.016589748782 + - 5000.025709581146 + - 4999.944891236294 + - 5000.035324880168 + - 4999.967955734346 + - 5000.013248451465 + - 5000.063199891701 + - 5000.068982245371 + - 4999.9325188896555 + - 5000.011035557985 + - 5000.012771123277 + - 4717.243379938609 + - 0.0 + - 0.0 + thrust_coefficient: + - 0.0 + - 0.0 + - 0.0 + - 0.99 + - 0.99 + - 0.97373036 + - 0.92826162 + - 0.89210543 + - 0.86100905 + - 0.835423 + - 0.81237673 + - 0.79225789 + - 0.77584769 + - 0.7629228 + - 0.76156073 + - 0.76261984 + - 0.76169723 + - 0.75232027 + - 0.74026851 + - 0.72987175 + - 0.70701647 + - 0.54054532 + - 0.45509459 + - 0.39343381 + - 0.34250785 + - 0.30487242 + - 0.27164979 + - 0.24361964 + - 0.21973831 + - 0.19918151 + - 0.18131868 + - 0.16537679 + - 0.15103727 + - 0.13998636 + - 0.1289037 + - 0.11970413 + - 0.11087113 + - 0.10339901 + - 0.09617888 + - 0.09009926 + - 0.08395078 + - 0.0791188 + - 0.07448356 + - 0.07050731 + - 0.06684119 + - 0.06345518 + - 0.06032267 + - 0.05741999 + - 0.05472609 + - 0.0 + - 0.0 diff --git a/floris/turbine_library/iea_10MW.yaml b/floris/turbine_library/iea_10MW.yaml index eaa04d81b..9328982ba 100644 --- a/floris/turbine_library/iea_10MW.yaml +++ b/floris/turbine_library/iea_10MW.yaml @@ -1,3 +1,5 @@ +# Data based on: +# https://github.com/NREL/turbine-models/blob/master/Offshore/IEA_10MW_198_RWT.csv turbine_type: 'iea_10MW' generator_efficiency: 1.0 hub_height: 119.0 @@ -5,174 +7,81 @@ pP: 1.88 pT: 1.88 rotor_diameter: 198.0 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 6.0 +ref_air_density: 1.225 +ref_tilt: 6.0 power_thrust_table: power: - 0.000000 - 0.000000 - - 0.074 - - 0.325100 - - 0.376200 - - 0.402700 - - 0.415600 - - 0.423000 - - 0.427400 - - 0.429300 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.429800 - - 0.430500 - - 0.438256 - - 0.425908 - - 0.347037 - - 0.307306 - - 0.271523 - - 0.239552 - - 0.211166 - - 0.186093 - - 0.164033 - - 0.144688 - - 0.127760 - - 0.112969 - - 0.100062 - - 0.088800 - - 0.078975 - - 0.070401 - - 0.062913 - - 0.056368 - - 0.050640 - - 0.045620 - - 0.041216 - - 0.037344 - - 0.033935 + - 37.874 + - 440.49 + - 1074.369 + - 1973.429 + - 3152.143 + - 4723.686 + - 6734.924 + - 7863.971 + - 9057.796 + - 10309.687 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.3 + - 10638.301 - 0.0 - 0.0 - thrust: + thrust_coefficient: - 0.0 - 0.0 - - 0.7701 - - 0.7701 - - 0.7763 - - 0.7824 - - 0.7820 - - 0.7802 - - 0.7772 - - 0.7719 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7768 - - 0.7675 - - 0.7651 - - 0.7587 - - 0.5056 - - 0.4310 - - 0.3708 - - 0.3209 - - 0.2788 - - 0.2432 - - 0.2128 - - 0.1868 - - 0.1645 - - 0.1454 - - 0.1289 - - 0.1147 - - 0.1024 - - 0.0918 - - 0.0825 - - 0.0745 - - 0.0675 - - 0.0613 - - 0.0559 - - 0.0512 - - 0.0470 + - 0.915 + - 0.926 + - 0.921 + - 0.895 + - 0.885 + - 0.873 + - 0.827 + - 0.789 + - 0.754 + - 0.721 + - 0.591 + - 0.49 + - 0.418 + - 0.318 + - 0.251 + - 0.203 + - 0.167 + - 0.119 + - 0.088 + - 0.049 - 0.0 - 0.0 wind_speed: - 0.0000 - 2.9 - 3.0 - - 4.0000 - - 4.5147 - - 5.0008 - - 5.4574 - - 5.8833 - - 6.2777 - - 6.6397 - - 6.9684 - - 7.2632 - - 7.5234 - - 7.7484 - - 7.9377 - - 8.0909 - - 8.2077 - - 8.2877 - - 8.3308 - - 8.3370 - - 8.3678 - - 8.4356 - - 8.5401 - - 8.6812 - - 8.8585 - - 9.0717 - - 9.3202 - - 9.6035 - - 9.9210 - - 10.2720 - - 10.6557 - - 10.7577 - - 11.5177 - - 11.9941 - - 12.4994 - - 13.0324 - - 13.5920 - - 14.1769 - - 14.7859 - - 15.4175 - - 16.0704 - - 16.7432 - - 17.4342 - - 18.1421 - - 18.8652 - - 19.6019 - - 20.3506 - - 21.1096 - - 21.8773 - - 22.6519 - - 23.4317 - - 24.2150 - - 25.010 - - 25.020 + - 4.0 + - 5.0 + - 6.0 + - 7.0 + - 8.0 + - 9.0 + - 9.5 + - 10.0 + - 10.5 + - 11.0 + - 11.5 + - 12.0 + - 13.0 + - 14.0 + - 15.0 + - 16.0 + - 18.0 + - 20.0 + - 25.0 + - 25.01 - 50.0 diff --git a/floris/turbine_library/iea_15MW.yaml b/floris/turbine_library/iea_15MW.yaml index 0350cd9c4..45d48b525 100644 --- a/floris/turbine_library/iea_15MW.yaml +++ b/floris/turbine_library/iea_15MW.yaml @@ -1,3 +1,6 @@ +# Data based on: +# https://github.com/IEAWindTask37/IEA-15-240-RWT/blob/master/Documentation/ +# IEA-15-240-RWT_tabular.xlsx turbine_type: 'iea_15MW' generator_efficiency: 1.0 hub_height: 150.0 @@ -5,120 +8,123 @@ pP: 1.88 pT: 1.88 rotor_diameter: 242.24 TSR: 8.0 -ref_density_cp_ct: 1.225 -ref_tilt_cp_ct: 6.0 +ref_air_density: 1.225 +ref_tilt: 6.0 power_thrust_table: power: - 0.000000 - - 0.049361236 - - 0.224324252 - - 0.312216418 - - 0.36009987 - - 0.38761204 - - 0.404010164 - - 0.413979324 - - 0.420083692 - - 0.423787764 - - 0.425977895 - - 0.427193272 - - 0.427183505 - - 0.426860928 - - 0.426617959 - - 0.426458783 - - 0.426385957 - - 0.426371389 - - 0.426268826 - - 0.426077456 - - 0.425795302 - - 0.425420049 - - 0.424948854 - - 0.424379028 - - 0.423707714 - - 0.422932811 - - 0.422052556 - - 0.421065815 - - 0.419972455 - - 0.419400676 - - 0.418981957 - - 0.385839135 - - 0.335840083 - - 0.29191329 - - 0.253572514 - - 0.220278082 - - 0.191477908 - - 0.166631343 - - 0.145236797 - - 0.126834289 - - 0.111011925 - - 0.097406118 - - 0.085699408 - - 0.075616912 - - 0.066922115 - - 0.059412477 - - 0.052915227 - - 0.04728299 - - 0.042390922 - - 0.038132739 - - 0.03441828 + - 0.000000 + - 42.733312 + - 292.585981 + - 607.966543 + - 981.097693 + - 1401.98084 + - 1858.67086 + - 2337.575997 + - 2824.097302 + - 3303.06456 + - 3759.432328 + - 4178.637714 + - 4547.19121 + - 4855.342682 + - 5091.537139 + - 5248.453137 + - 5320.793207 + - 5335.345498 + - 5437.90563 + - 5631.253025 + - 5920.980626 + - 6315.115602 + - 6824.470067 + - 7462.846389 + - 8238.359448 + - 9167.96703 + - 10285.211 + - 11617.23699 + - 13194.41511 + - 15000.0 + - 15000.00129 + - 14999.97096 + - 15000.00934 + - 15000.00063 + - 15000.00011 + - 14999.94712 + - 15000.08082 + - 15000.05209 + - 15000.03592 + - 15000.02562 + - 15000.01835 + - 15000.01281 + - 15000.00835 + - 15000.00488 + - 15000.00233 + - 15000.00066 + - 14999.87148 + - 15000.00047 + - 15000.00194 + - 15000.00417 + - 15000.00688 - 0.0 - 0.0 - thrust: + thrust_coefficient: + - 0.000000 - 0.000000 - - 0.817533319 - - 0.792115292 - - 0.786401899 - - 0.788898744 - - 0.790774576 - - 0.79208669 - - 0.79185809 - - 0.7903853 - - 0.788253035 - - 0.785845184 - - 0.783367164 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.77853469 - - 0.781531069 - - 0.758935311 - - 0.614478855 - - 0.498687801 - - 0.416354609 - - 0.351944846 - - 0.299832337 - - 0.256956606 - - 0.221322169 - - 0.19150758 - - 0.166435523 - - 0.145263684 - - 0.127319849 - - 0.11206048 - - 0.099042189 - - 0.087901155 - - 0.078337446 - - 0.07010295 - - 0.062991402 - - 0.056831647 - - 0.05148062 - - 0.046818787 + - 0.80742173 + - 0.784655297 + - 0.781771245 + - 0.785377072 + - 0.788045584 + - 0.789922119 + - 0.790464625 + - 0.789868339 + - 0.788727582 + - 0.787359348 + - 0.785895402 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.778275899 + - 0.77176172 + - 0.747149663 + - 0.562338457 + - 0.463477777 + - 0.389083718 + - 0.329822385 + - 0.281465071 + - 0.241494345 + - 0.208180574 + - 0.180257568 + - 0.156747535 + - 0.136877529 + - 0.120026379 + - 0.105689427 + - 0.093453742 + - 0.082979637 + - 0.073986457 + - 0.066241166 + - 0.059552107 + - 0.053756866 + - 0.048721662 + - 0.044334197 - 0.0 - 0.0 wind_speed: - 0.000 - - 3 + - 2.9 + - 3.0 - 3.54953237 - 4.067900771 - 4.553906848 diff --git a/floris/turbine_library/legacy_v3/iea_10MW.yaml b/floris/turbine_library/legacy_v3/iea_10MW.yaml new file mode 100644 index 000000000..eaa04d81b --- /dev/null +++ b/floris/turbine_library/legacy_v3/iea_10MW.yaml @@ -0,0 +1,178 @@ +turbine_type: 'iea_10MW' +generator_efficiency: 1.0 +hub_height: 119.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 198.0 +TSR: 8.0 +ref_density_cp_ct: 1.225 +ref_tilt_cp_ct: 6.0 +power_thrust_table: + power: + - 0.000000 + - 0.000000 + - 0.074 + - 0.325100 + - 0.376200 + - 0.402700 + - 0.415600 + - 0.423000 + - 0.427400 + - 0.429300 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.429800 + - 0.430500 + - 0.438256 + - 0.425908 + - 0.347037 + - 0.307306 + - 0.271523 + - 0.239552 + - 0.211166 + - 0.186093 + - 0.164033 + - 0.144688 + - 0.127760 + - 0.112969 + - 0.100062 + - 0.088800 + - 0.078975 + - 0.070401 + - 0.062913 + - 0.056368 + - 0.050640 + - 0.045620 + - 0.041216 + - 0.037344 + - 0.033935 + - 0.0 + - 0.0 + thrust: + - 0.0 + - 0.0 + - 0.7701 + - 0.7701 + - 0.7763 + - 0.7824 + - 0.7820 + - 0.7802 + - 0.7772 + - 0.7719 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7768 + - 0.7675 + - 0.7651 + - 0.7587 + - 0.5056 + - 0.4310 + - 0.3708 + - 0.3209 + - 0.2788 + - 0.2432 + - 0.2128 + - 0.1868 + - 0.1645 + - 0.1454 + - 0.1289 + - 0.1147 + - 0.1024 + - 0.0918 + - 0.0825 + - 0.0745 + - 0.0675 + - 0.0613 + - 0.0559 + - 0.0512 + - 0.0470 + - 0.0 + - 0.0 + wind_speed: + - 0.0000 + - 2.9 + - 3.0 + - 4.0000 + - 4.5147 + - 5.0008 + - 5.4574 + - 5.8833 + - 6.2777 + - 6.6397 + - 6.9684 + - 7.2632 + - 7.5234 + - 7.7484 + - 7.9377 + - 8.0909 + - 8.2077 + - 8.2877 + - 8.3308 + - 8.3370 + - 8.3678 + - 8.4356 + - 8.5401 + - 8.6812 + - 8.8585 + - 9.0717 + - 9.3202 + - 9.6035 + - 9.9210 + - 10.2720 + - 10.6557 + - 10.7577 + - 11.5177 + - 11.9941 + - 12.4994 + - 13.0324 + - 13.5920 + - 14.1769 + - 14.7859 + - 15.4175 + - 16.0704 + - 16.7432 + - 17.4342 + - 18.1421 + - 18.8652 + - 19.6019 + - 20.3506 + - 21.1096 + - 21.8773 + - 22.6519 + - 23.4317 + - 24.2150 + - 25.010 + - 25.020 + - 50.0 diff --git a/floris/turbine_library/legacy_v3/iea_15MW.yaml b/floris/turbine_library/legacy_v3/iea_15MW.yaml new file mode 100644 index 000000000..0350cd9c4 --- /dev/null +++ b/floris/turbine_library/legacy_v3/iea_15MW.yaml @@ -0,0 +1,172 @@ +turbine_type: 'iea_15MW' +generator_efficiency: 1.0 +hub_height: 150.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 242.24 +TSR: 8.0 +ref_density_cp_ct: 1.225 +ref_tilt_cp_ct: 6.0 +power_thrust_table: + power: + - 0.000000 + - 0.049361236 + - 0.224324252 + - 0.312216418 + - 0.36009987 + - 0.38761204 + - 0.404010164 + - 0.413979324 + - 0.420083692 + - 0.423787764 + - 0.425977895 + - 0.427193272 + - 0.427183505 + - 0.426860928 + - 0.426617959 + - 0.426458783 + - 0.426385957 + - 0.426371389 + - 0.426268826 + - 0.426077456 + - 0.425795302 + - 0.425420049 + - 0.424948854 + - 0.424379028 + - 0.423707714 + - 0.422932811 + - 0.422052556 + - 0.421065815 + - 0.419972455 + - 0.419400676 + - 0.418981957 + - 0.385839135 + - 0.335840083 + - 0.29191329 + - 0.253572514 + - 0.220278082 + - 0.191477908 + - 0.166631343 + - 0.145236797 + - 0.126834289 + - 0.111011925 + - 0.097406118 + - 0.085699408 + - 0.075616912 + - 0.066922115 + - 0.059412477 + - 0.052915227 + - 0.04728299 + - 0.042390922 + - 0.038132739 + - 0.03441828 + - 0.0 + - 0.0 + thrust: + - 0.000000 + - 0.817533319 + - 0.792115292 + - 0.786401899 + - 0.788898744 + - 0.790774576 + - 0.79208669 + - 0.79185809 + - 0.7903853 + - 0.788253035 + - 0.785845184 + - 0.783367164 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.77853469 + - 0.781531069 + - 0.758935311 + - 0.614478855 + - 0.498687801 + - 0.416354609 + - 0.351944846 + - 0.299832337 + - 0.256956606 + - 0.221322169 + - 0.19150758 + - 0.166435523 + - 0.145263684 + - 0.127319849 + - 0.11206048 + - 0.099042189 + - 0.087901155 + - 0.078337446 + - 0.07010295 + - 0.062991402 + - 0.056831647 + - 0.05148062 + - 0.046818787 + - 0.0 + - 0.0 + wind_speed: + - 0.000 + - 3 + - 3.54953237 + - 4.067900771 + - 4.553906848 + - 5.006427063 + - 5.424415288 + - 5.806905228 + - 6.153012649 + - 6.461937428 + - 6.732965398 + - 6.965470002 + - 7.158913742 + - 7.312849418 + - 7.426921164 + - 7.500865272 + - 7.534510799 + - 7.541241633 + - 7.58833327 + - 7.675676842 + - 7.803070431 + - 7.970219531 + - 8.176737731 + - 8.422147605 + - 8.70588182 + - 9.027284445 + - 9.385612468 + - 9.780037514 + - 10.20964776 + - 10.67345004 + - 10.86770694 + - 11.17037214 + - 11.6992653 + - 12.25890683 + - 12.84800295 + - 13.46519181 + - 14.10904661 + - 14.77807889 + - 15.470742 + - 16.18543466 + - 16.92050464 + - 17.67425264 + - 18.44493615 + - 19.23077353 + - 20.02994808 + - 20.8406123 + - 21.66089211 + - 22.4888912 + - 23.32269542 + - 24.1603772 + - 25 + - 25.020 + - 50.0 diff --git a/floris/turbine_library/legacy_v3/nrel_5MW.yaml b/floris/turbine_library/legacy_v3/nrel_5MW.yaml new file mode 100644 index 000000000..653ef14c7 --- /dev/null +++ b/floris/turbine_library/legacy_v3/nrel_5MW.yaml @@ -0,0 +1,212 @@ + +### +# An ID for this type of turbine definition. +# This is not currently used, but it will be enabled in the future. This should typically +# match the root name of the file. +turbine_type: 'nrel_5MW' + +### +# Setting for generator losses to power. +generator_efficiency: 1.0 + +### +# Hub height. +hub_height: 90.0 + +### +# Cosine exponent for power loss due to yaw misalignment. +pP: 1.88 + +### +# Cosine exponent for power loss due to tilt. +pT: 1.88 + +### +# Rotor diameter. +rotor_diameter: 126.0 + +### +# Tip speed ratio defined as linear blade tip speed normalized by the incoming wind speed. +TSR: 8.0 + +### +# The air density at which the Cp and Ct curves are defined. +ref_density_cp_ct: 1.225 + +### +# The tilt angle at which the Cp and Ct curves are defined. This is used to capture +# the effects of a floating platform on a turbine's power and wake. +ref_tilt_cp_ct: 5.0 + +### +# Cp and Ct as a function of wind speed for the turbine's full range of operating conditions. +power_thrust_table: + power: + - 0.0 + - 0.000000 + - 0.000000 + - 0.178085 + - 0.289075 + - 0.349022 + - 0.384728 + - 0.406059 + - 0.420228 + - 0.428823 + - 0.433873 + - 0.436223 + - 0.436845 + - 0.436575 + - 0.436511 + - 0.436561 + - 0.436517 + - 0.435903 + - 0.434673 + - 0.433230 + - 0.430466 + - 0.378869 + - 0.335199 + - 0.297991 + - 0.266092 + - 0.238588 + - 0.214748 + - 0.193981 + - 0.175808 + - 0.159835 + - 0.145741 + - 0.133256 + - 0.122157 + - 0.112257 + - 0.103399 + - 0.095449 + - 0.088294 + - 0.081836 + - 0.075993 + - 0.070692 + - 0.065875 + - 0.061484 + - 0.057476 + - 0.053809 + - 0.050447 + - 0.047358 + - 0.044518 + - 0.041900 + - 0.039483 + - 0.0 + - 0.0 + thrust: + - 0.0 + - 0.0 + - 0.0 + - 0.99 + - 0.99 + - 0.97373036 + - 0.92826162 + - 0.89210543 + - 0.86100905 + - 0.835423 + - 0.81237673 + - 0.79225789 + - 0.77584769 + - 0.7629228 + - 0.76156073 + - 0.76261984 + - 0.76169723 + - 0.75232027 + - 0.74026851 + - 0.72987175 + - 0.70701647 + - 0.54054532 + - 0.45509459 + - 0.39343381 + - 0.34250785 + - 0.30487242 + - 0.27164979 + - 0.24361964 + - 0.21973831 + - 0.19918151 + - 0.18131868 + - 0.16537679 + - 0.15103727 + - 0.13998636 + - 0.1289037 + - 0.11970413 + - 0.11087113 + - 0.10339901 + - 0.09617888 + - 0.09009926 + - 0.08395078 + - 0.0791188 + - 0.07448356 + - 0.07050731 + - 0.06684119 + - 0.06345518 + - 0.06032267 + - 0.05741999 + - 0.05472609 + - 0.0 + - 0.0 + wind_speed: + - 0.0 + - 2.0 + - 2.5 + - 3.0 + - 3.5 + - 4.0 + - 4.5 + - 5.0 + - 5.5 + - 6.0 + - 6.5 + - 7.0 + - 7.5 + - 8.0 + - 8.5 + - 9.0 + - 9.5 + - 10.0 + - 10.5 + - 11.0 + - 11.5 + - 12.0 + - 12.5 + - 13.0 + - 13.5 + - 14.0 + - 14.5 + - 15.0 + - 15.5 + - 16.0 + - 16.5 + - 17.0 + - 17.5 + - 18.0 + - 18.5 + - 19.0 + - 19.5 + - 20.0 + - 20.5 + - 21.0 + - 21.5 + - 22.0 + - 22.5 + - 23.0 + - 23.5 + - 24.0 + - 24.5 + - 25.0 + - 25.01 + - 25.02 + - 50.0 + +### +# A boolean flag used when the user wants FLORIS to use the user-supplied multi-dimensional +# Cp/Ct information. +multi_dimensional_cp_ct: False + +### +# The path to the .csv file that contains the multi-dimensional Cp/Ct data. The format of this +# file is such that any external conditions, such as wave height or wave period, that the +# Cp/Ct data is dependent on come first, in column format. The last three columns of the .csv +# file must be ``ws``, ``Cp``, and ``Ct``, in that order. An example of fictional data is given +# in ``floris/turbine_library/iea_15MW_multi_dim_Tp_Hs.csv``. +power_thrust_data_file: '../floris/turbine_library/iea_15MW_multi_dim_Tp_Hs.csv' diff --git a/floris/turbine_library/x_20MW.yaml b/floris/turbine_library/legacy_v3/x_20MW.yaml similarity index 100% rename from floris/turbine_library/x_20MW.yaml rename to floris/turbine_library/legacy_v3/x_20MW.yaml diff --git a/floris/turbine_library/nrel_5MW.yaml b/floris/turbine_library/nrel_5MW.yaml index 653ef14c7..bac8d5e71 100644 --- a/floris/turbine_library/nrel_5MW.yaml +++ b/floris/turbine_library/nrel_5MW.yaml @@ -1,201 +1,183 @@ - ### -# An ID for this type of turbine definition. -# This is not currently used, but it will be enabled in the future. This should typically -# match the root name of the file. +# NREL 5MW reference turbine model for FLORIS v4.x. +# Data based on: +# https://github.com/NREL/turbine-models/blob/master/Offshore/NREL_5MW_126_RWT.csv turbine_type: 'nrel_5MW' ### -# Setting for generator losses to power. +# Setting for generator losses to power [-]. generator_efficiency: 1.0 ### -# Hub height. +# Hub height [m]. hub_height: 90.0 ### -# Cosine exponent for power loss due to yaw misalignment. +# Cosine exponent for power loss due to yaw misalignment [-]. pP: 1.88 ### -# Cosine exponent for power loss due to tilt. +# Cosine exponent for power loss due to tilt [-]. pT: 1.88 ### -# Rotor diameter. +# Rotor diameter [m]. rotor_diameter: 126.0 ### -# Tip speed ratio defined as linear blade tip speed normalized by the incoming wind speed. +# Tip speed ratio defined as linear blade tip speed normalized by the incoming wind speed [-]. TSR: 8.0 ### -# The air density at which the Cp and Ct curves are defined. -ref_density_cp_ct: 1.225 +# The air density at which the power_thrust_table curves are defined [kg/m^3]. +ref_air_density: 1.225 ### -# The tilt angle at which the Cp and Ct curves are defined. This is used to capture -# the effects of a floating platform on a turbine's power and wake. -ref_tilt_cp_ct: 5.0 +# The tilt angle at which the the power_thrust_table curves are defined. This is used to capture +# the effects of a floating platform on a turbine's power and wake [deg]. +ref_tilt: 5.0 ### -# Cp and Ct as a function of wind speed for the turbine's full range of operating conditions. +# Absolute power [kW] and thrust coefficient [-] as a function of wind speed [m/s] for the turbine's +# full range of operating conditions. power_thrust_table: power: - 0.0 - - 0.000000 - - 0.000000 - - 0.178085 - - 0.289075 - - 0.349022 - - 0.384728 - - 0.406059 - - 0.420228 - - 0.428823 - - 0.433873 - - 0.436223 - - 0.436845 - - 0.436575 - - 0.436511 - - 0.436561 - - 0.436517 - - 0.435903 - - 0.434673 - - 0.433230 - - 0.430466 - - 0.378869 - - 0.335199 - - 0.297991 - - 0.266092 - - 0.238588 - - 0.214748 - - 0.193981 - - 0.175808 - - 0.159835 - - 0.145741 - - 0.133256 - - 0.122157 - - 0.112257 - - 0.103399 - - 0.095449 - - 0.088294 - - 0.081836 - - 0.075993 - - 0.070692 - - 0.065875 - - 0.061484 - - 0.057476 - - 0.053809 - - 0.050447 - - 0.047358 - - 0.044518 - - 0.041900 - - 0.039483 - 0.0 + - 40.5 + - 177.7 + - 403.9 + - 737.6 + - 1187.2 + - 1771.1 + - 2518.6 + - 3448.41 + - 3552.15 + - 3657.95 + - 3765.16 + - 3873.95 + - 3984.49 + - 4096.56 + - 4210.69 + - 4326.15 + - 4443.41 + - 4562.51 + - 4683.43 + - 4806.18 + - 4929.92 + - 5000.37 + - 5000.02 + - 5000.0 + - 4999.99 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 + - 5000.0 - 0.0 - thrust: - 0.0 + thrust_coefficient: - 0.0 - 0.0 - - 0.99 - - 0.99 - - 0.97373036 - - 0.92826162 - - 0.89210543 - - 0.86100905 - - 0.835423 - - 0.81237673 - - 0.79225789 - - 0.77584769 - - 0.7629228 - - 0.76156073 - - 0.76261984 - - 0.76169723 - - 0.75232027 - - 0.74026851 - - 0.72987175 - - 0.70701647 - - 0.54054532 - - 0.45509459 - - 0.39343381 - - 0.34250785 - - 0.30487242 - - 0.27164979 - - 0.24361964 - - 0.21973831 - - 0.19918151 - - 0.18131868 - - 0.16537679 - - 0.15103727 - - 0.13998636 - - 0.1289037 - - 0.11970413 - - 0.11087113 - - 0.10339901 - - 0.09617888 - - 0.09009926 - - 0.08395078 - - 0.0791188 - - 0.07448356 - - 0.07050731 - - 0.06684119 - - 0.06345518 - - 0.06032267 - - 0.05741999 - - 0.05472609 + - 2.497990147 + - 1.766833378 + - 1.408360153 + - 1.201348494 + - 1.065133759 + - 0.977936955 + - 0.936281559 + - 0.905425262 + - 0.902755344 + - 0.90016155 + - 0.895745235 + - 0.889630636 + - 0.883651878 + - 0.877788261 + - 0.872068513 + - 0.866439424 + - 0.860930874 + - 0.855544522 + - 0.850276473 + - 0.845148048 + - 0.840105118 + - 0.811165614 + - 0.764009698 + - 0.728584172 + - 0.698944675 + - 0.672754103 + - 0.649082557 + - 0.627368152 + - 0.471373796 + - 0.372703289 + - 0.30290131 + - 0.251235686 + - 0.211900735 + - 0.181210571 + - 0.156798163 + - 0.137091212 + - 0.120753164 + - 0.106941036 + - 0.095319286 + - 0.085631997 + - 0.077368152 - 0.0 - 0.0 wind_speed: - 0.0 - - 2.0 - - 2.5 + - 2.9 - 3.0 - - 3.5 - 4.0 - - 4.5 - 5.0 - - 5.5 - 6.0 - - 6.5 - 7.0 - - 7.5 - 8.0 - - 8.5 - 9.0 - - 9.5 - 10.0 + - 10.1 + - 10.2 + - 10.3 + - 10.4 - 10.5 + - 10.6 + - 10.7 + - 10.8 + - 10.9 - 11.0 + - 11.1 + - 11.2 + - 11.3 + - 11.4 - 11.5 + - 11.6 + - 11.7 + - 11.8 + - 11.9 - 12.0 - - 12.5 - 13.0 - - 13.5 - 14.0 - - 14.5 - 15.0 - - 15.5 - 16.0 - - 16.5 - 17.0 - - 17.5 - 18.0 - - 18.5 - 19.0 - - 19.5 - 20.0 - - 20.5 - 21.0 - - 21.5 - 22.0 - - 22.5 - 23.0 - - 23.5 - 24.0 - - 24.5 - 25.0 - 25.01 - - 25.02 - 50.0 ### diff --git a/floris/turbine_library/turbine_previewer.py b/floris/turbine_library/turbine_previewer.py index 207a3ba22..447954726 100644 --- a/floris/turbine_library/turbine_previewer.py +++ b/floris/turbine_library/turbine_previewer.py @@ -139,7 +139,7 @@ def power_curve( } power_mw = { k: power_multidim( - ref_density_cp_ct=np.full(shape, self.turbine.ref_density_cp_ct), + ref_air_density=np.full(shape, self.turbine.ref_air_density), rotor_effective_velocities=wind_speeds.reshape(shape), power_interp=power_interps[k], ).flatten() / 1e6 @@ -147,7 +147,6 @@ def power_curve( } else: power_mw = power( - ref_density_cp_ct=np.full(shape, self.turbine.ref_density_cp_ct), rotor_effective_velocities=wind_speeds.reshape(shape), power_interp={self.turbine.turbine_type: self.turbine.power_interp}, turbine_type_map=np.full(shape, self.turbine.turbine_type) @@ -183,8 +182,8 @@ def Ct_curve( k: Ct_multidim( velocities=wind_speeds.reshape(shape), yaw_angle=np.zeros(shape), - tilt_angle=np.full(shape, self.turbine.ref_tilt_cp_ct), - ref_tilt_cp_ct=np.full(shape_single, self.turbine.ref_tilt_cp_ct), + tilt_angle=np.full(shape, self.turbine.ref_tilt), + ref_tilt=np.full(shape_single, self.turbine.ref_tilt), fCt=fCt_interps[k], tilt_interp=[(self.turbine.turbine_type, self.turbine.tilt_interp)], correct_cp_ct_for_tilt=np.zeros(shape_single, dtype=bool), @@ -196,8 +195,8 @@ def Ct_curve( ct_curve = Ct( velocities=wind_speeds.reshape(shape), yaw_angle=np.zeros(shape), - tilt_angle=np.full(shape, self.turbine.ref_tilt_cp_ct), - ref_tilt_cp_ct=np.full(shape, self.turbine.ref_tilt_cp_ct), + tilt_angle=np.full(shape, self.turbine.ref_tilt), + ref_tilt=np.full(shape, self.turbine.ref_tilt), fCt={self.turbine.turbine_type: self.turbine.fCt_interp}, tilt_interp=[(self.turbine.turbine_type, self.turbine.tilt_interp)], correct_cp_ct_for_tilt=np.zeros(shape, dtype=bool), diff --git a/tests/conftest.py b/tests/conftest.py index eab7063cd..911e579c4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -206,158 +206,149 @@ def __init__(self): "pP": 1.88, "pT": 1.88, "generator_efficiency": 1.0, - "ref_density_cp_ct": 1.225, - "ref_tilt_cp_ct": 5.0, + "ref_air_density": 1.225, + "ref_tilt": 5.0, "power_thrust_table": { "power": [ - 0.000000, - 0.000000, - 0.178085, - 0.289075, - 0.349022, - 0.384728, - 0.406059, - 0.420228, - 0.428823, - 0.433873, - 0.436223, - 0.436845, - 0.436575, - 0.436511, - 0.436561, - 0.436517, - 0.435903, - 0.434673, - 0.433230, - 0.430466, - 0.378869, - 0.335199, - 0.297991, - 0.266092, - 0.238588, - 0.214748, - 0.193981, - 0.175808, - 0.159835, - 0.145741, - 0.133256, - 0.122157, - 0.112257, - 0.103399, - 0.095449, - 0.088294, - 0.081836, - 0.075993, - 0.070692, - 0.065875, - 0.061484, - 0.057476, - 0.053809, - 0.050447, - 0.047358, - 0.044518, - 0.041900, - 0.039483, + 0.0, + 0.0, + 40.5, + 177.7, + 403.9, + 737.6, + 1187.2, + 1771.1, + 2518.6, + 3448.41, + 3552.15, + 3657.95, + 3765.16, + 3873.95, + 3984.49, + 4096.56, + 4210.69, + 4326.15, + 4443.41, + 4562.51, + 4683.43, + 4806.18, + 4929.92, + 5000.37, + 5000.02, + 5000.0, + 4999.99, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 5000.0, + 0.0, + 0.0 ], - "thrust": [ + "thrust_coefficient": [ 0.0, 0.0, - 0.99, - 0.99, - 0.97373036, - 0.92826162, - 0.89210543, - 0.86100905, - 0.835423, - 0.81237673, - 0.79225789, - 0.77584769, - 0.7629228, - 0.76156073, - 0.76261984, - 0.76169723, - 0.75232027, - 0.74026851, - 0.72987175, - 0.70701647, - 0.54054532, - 0.45509459, - 0.39343381, - 0.34250785, - 0.30487242, - 0.27164979, - 0.24361964, - 0.21973831, - 0.19918151, - 0.18131868, - 0.16537679, - 0.15103727, - 0.13998636, - 0.1289037, - 0.11970413, - 0.11087113, - 0.10339901, - 0.09617888, - 0.09009926, - 0.08395078, - 0.0791188, - 0.07448356, - 0.07050731, - 0.06684119, - 0.06345518, - 0.06032267, - 0.05741999, - 0.05472609, + 2.497990147, + 1.766833378, + 1.408360153, + 1.201348494, + 1.065133759, + 0.977936955, + 0.936281559, + 0.905425262, + 0.902755344, + 0.90016155, + 0.895745235, + 0.889630636, + 0.883651878, + 0.877788261, + 0.872068513, + 0.866439424, + 0.860930874, + 0.855544522, + 0.850276473, + 0.845148048, + 0.840105118, + 0.811165614, + 0.764009698, + 0.728584172, + 0.698944675, + 0.672754103, + 0.649082557, + 0.627368152, + 0.471373796, + 0.372703289, + 0.30290131, + 0.251235686, + 0.211900735, + 0.181210571, + 0.156798163, + 0.137091212, + 0.120753164, + 0.106941036, + 0.095319286, + 0.085631997, + 0.077368152, + 0.0, + 0.0 ], "wind_speed": [ - 2.0, - 2.5, + 0.0, + 2.9, 3.0, - 3.5, 4.0, - 4.5, 5.0, - 5.5, 6.0, - 6.5, 7.0, - 7.5, 8.0, - 8.5, 9.0, - 9.5, 10.0, + 10.1, + 10.2, + 10.3, + 10.4, 10.5, + 10.6, + 10.7, + 10.8, + 10.9, 11.0, + 11.1, + 11.2, + 11.3, + 11.4, 11.5, + 11.6, + 11.7, + 11.8, + 11.9, 12.0, - 12.5, 13.0, - 13.5, 14.0, - 14.5, 15.0, - 15.5, 16.0, - 16.5, 17.0, - 17.5, 18.0, - 18.5, 19.0, - 19.5, 20.0, - 20.5, 21.0, - 21.5, 22.0, - 22.5, 23.0, - 23.5, 24.0, - 24.5, 25.0, - 25.5, + 25.01, + 50.0 ], }, "TSR": 8.0 @@ -491,5 +482,5 @@ def __init__(self): }, "name": "conftest", "description": "Inputs used for testing", - "floris_version": "v3.0.0", + "floris_version": "v4.0", } diff --git a/tests/data/input_full_v3.yaml b/tests/data/input_full_v4.yaml similarity index 98% rename from tests/data/input_full_v3.yaml rename to tests/data/input_full_v4.yaml index 5cace12df..af7452823 100644 --- a/tests/data/input_full_v3.yaml +++ b/tests/data/input_full_v4.yaml @@ -1,7 +1,7 @@ name: test_input description: Single turbine for testing -floris_version: v3.0.0 +floris_version: v4.x logging: console: diff --git a/tests/data/nrel_5MW_v3legacy.yaml b/tests/data/nrel_5MW_v3legacy.yaml new file mode 100644 index 000000000..5fdef28ad --- /dev/null +++ b/tests/data/nrel_5MW_v3legacy.yaml @@ -0,0 +1,166 @@ +turbine_type: 'nrel_5MW_FLORISv3' +generator_efficiency: 1.0 +hub_height: 90.0 +pP: 1.88 +pT: 1.88 +rotor_diameter: 126.0 +TSR: 8.0 +ref_density_cp_ct: 1.225 +ref_tilt_cp_ct: 5.0 +power_thrust_table: + power: + - 0.0 + - 0.000000 + - 0.000000 + - 0.178085 + - 0.289075 + - 0.349022 + - 0.384728 + - 0.406059 + - 0.420228 + - 0.428823 + - 0.433873 + - 0.436223 + - 0.436845 + - 0.436575 + - 0.436511 + - 0.436561 + - 0.436517 + - 0.435903 + - 0.434673 + - 0.433230 + - 0.430466 + - 0.378869 + - 0.335199 + - 0.297991 + - 0.266092 + - 0.238588 + - 0.214748 + - 0.193981 + - 0.175808 + - 0.159835 + - 0.145741 + - 0.133256 + - 0.122157 + - 0.112257 + - 0.103399 + - 0.095449 + - 0.088294 + - 0.081836 + - 0.075993 + - 0.070692 + - 0.065875 + - 0.061484 + - 0.057476 + - 0.053809 + - 0.050447 + - 0.047358 + - 0.044518 + - 0.041900 + - 0.039483 + - 0.0 + - 0.0 + thrust: + - 0.0 + - 0.0 + - 0.0 + - 0.99 + - 0.99 + - 0.97373036 + - 0.92826162 + - 0.89210543 + - 0.86100905 + - 0.835423 + - 0.81237673 + - 0.79225789 + - 0.77584769 + - 0.7629228 + - 0.76156073 + - 0.76261984 + - 0.76169723 + - 0.75232027 + - 0.74026851 + - 0.72987175 + - 0.70701647 + - 0.54054532 + - 0.45509459 + - 0.39343381 + - 0.34250785 + - 0.30487242 + - 0.27164979 + - 0.24361964 + - 0.21973831 + - 0.19918151 + - 0.18131868 + - 0.16537679 + - 0.15103727 + - 0.13998636 + - 0.1289037 + - 0.11970413 + - 0.11087113 + - 0.10339901 + - 0.09617888 + - 0.09009926 + - 0.08395078 + - 0.0791188 + - 0.07448356 + - 0.07050731 + - 0.06684119 + - 0.06345518 + - 0.06032267 + - 0.05741999 + - 0.05472609 + - 0.0 + - 0.0 + wind_speed: + - 0.0 + - 2.0 + - 2.5 + - 3.0 + - 3.5 + - 4.0 + - 4.5 + - 5.0 + - 5.5 + - 6.0 + - 6.5 + - 7.0 + - 7.5 + - 8.0 + - 8.5 + - 9.0 + - 9.5 + - 10.0 + - 10.5 + - 11.0 + - 11.5 + - 12.0 + - 12.5 + - 13.0 + - 13.5 + - 14.0 + - 14.5 + - 15.0 + - 15.5 + - 16.0 + - 16.5 + - 17.0 + - 17.5 + - 18.0 + - 18.5 + - 19.0 + - 19.5 + - 20.0 + - 20.5 + - 21.0 + - 21.5 + - 22.0 + - 22.5 + - 23.0 + - 23.5 + - 24.0 + - 24.5 + - 25.0 + - 25.01 + - 25.02 + - 50.0 diff --git a/tests/farm_unit_test.py b/tests/farm_unit_test.py index a4c196c82..09a0e1824 100644 --- a/tests/farm_unit_test.py +++ b/tests/farm_unit_test.py @@ -59,14 +59,14 @@ def test_farm_init_homogenous_turbines(): def test_asdict(sample_inputs_fixture: SampleInputs): farm = Farm.from_dict(sample_inputs_fixture.farm) farm.construct_hub_heights() - farm.construct_turbine_ref_tilt_cp_cts() + farm.construct_turbine_ref_tilts() farm.set_yaw_angles(N_FINDEX) farm.set_tilt_to_ref_tilt(N_FINDEX) dict1 = farm.as_dict() new_farm = farm.from_dict(dict1) new_farm.construct_hub_heights() - new_farm.construct_turbine_ref_tilt_cp_cts() + new_farm.construct_turbine_ref_tilts() new_farm.set_yaw_angles(N_FINDEX) new_farm.set_tilt_to_ref_tilt(N_FINDEX) dict2 = new_farm.as_dict() @@ -94,12 +94,12 @@ def test_check_turbine_type(sample_inputs_fixture: SampleInputs): # All list of strings from internal library farm_data = deepcopy(sample_inputs_fixture.farm) - farm_data["turbine_type"] = ["nrel_5MW", "iea_10MW", "iea_15MW", "x_20MW", "nrel_5MW"] - farm_data["layout_x"] = np.arange(0, 500, 100) - farm_data["layout_y"] = np.zeros(5) + farm_data["turbine_type"] = ["nrel_5MW", "iea_10MW", "iea_15MW", "nrel_5MW"] + farm_data["layout_x"] = np.arange(0, 400, 100) + farm_data["layout_y"] = np.zeros(4) farm = Farm.from_dict(farm_data) - assert len(farm.turbine_type) == 5 - assert len(farm.turbine_definitions) == 5 + assert len(farm.turbine_type) == 4 + assert len(farm.turbine_definitions) == 4 # String not found in internal library farm_data = deepcopy(sample_inputs_fixture.farm) @@ -116,7 +116,7 @@ def test_check_turbine_type(sample_inputs_fixture: SampleInputs): farm_data["turbine_type"] = [turbine_def] * 5 farm_data["layout_x"] = np.arange(0, 500, 100) farm_data["layout_y"] = np.zeros(5) - Farm.from_dict(farm_data) + farm = Farm.from_dict(farm_data) assert len(farm.turbine_type) == 5 assert len(farm.turbine_definitions) == 5 diff --git a/tests/floris_interface_test.py b/tests/floris_interface_test.py index 0196af5fc..700ac5106 100644 --- a/tests/floris_interface_test.py +++ b/tests/floris_interface_test.py @@ -6,7 +6,7 @@ TEST_DATA = Path(__file__).resolve().parent / "data" -YAML_INPUT = TEST_DATA / "input_full_v3.yaml" +YAML_INPUT = TEST_DATA / "input_full_v4.yaml" def test_read_yaml(): diff --git a/tests/floris_unit_test.py b/tests/floris_unit_test.py index 05c01f022..34dfb31ce 100644 --- a/tests/floris_unit_test.py +++ b/tests/floris_unit_test.py @@ -26,7 +26,7 @@ TEST_DATA = Path(__file__).resolve().parent / "data" -YAML_INPUT = TEST_DATA / "input_full_v3.yaml" +YAML_INPUT = TEST_DATA / "input_full_v4.yaml" DICT_INPUT = yaml.load(open(YAML_INPUT, "r"), Loader=yaml.SafeLoader) diff --git a/tests/reg_tests/cumulative_curl_regression_test.py b/tests/reg_tests/cumulative_curl_regression_test.py index 6e8eebf13..4d0b3da53 100644 --- a/tests/reg_tests/cumulative_curl_regression_test.py +++ b/tests/reg_tests/cumulative_curl_regression_test.py @@ -38,27 +38,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [5.4838164, 0.8620156, 529225.9172271, 0.3142687], - [5.0221433, 0.8907283, 394126.6156555, 0.3347186], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [6.1855213, 0.9999000, 821010.3573560, 0.4950000], + [6.5766692, 0.9999000, 996870.4607268, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [6.1712539, 0.8275295, 776795.0248898, 0.2923521], - [5.6500663, 0.8533298, 586018.0719934, 0.3085123], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [6.3672533, 0.9999000, 902717.0786337, 0.4950000], + [7.1601204, 0.9999000, 1280694.2756887, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [6.8779113, 0.7971705, 1085894.0434488, 0.2748170], - [6.2985764, 0.8216609, 828383.6208269, 0.2888489], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [6.8881606, 0.9999000, 1136916.9967716, 0.4950000], + [7.8983008, 0.9868048, 1711717.8333551, 0.4425648], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [7.6258784, 0.7725938, 1482932.7552807, 0.2615643], - [6.9611771, 0.7938200, 1124649.7898263, 0.2729648], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [7.4533498, 0.9999000, 1451910.9662493, 0.4950000], + [8.6688034, 0.9500777, 2271030.5285020, 0.3882835], ], ] ) @@ -67,27 +67,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.5274362, 0.8596051, 543479.0426304, 0.3126534], - [5.0310723, 0.8901730, 396739.4832795, 0.3342992], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [6.1323952, 0.9999000, 797124.8800625, 0.4950000], + [6.5576585, 0.9999000, 988323.2532518, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.2202711, 0.8252701, 796655.8471824, 0.2909965], - [5.6617378, 0.8527326, 590066.7909898, 0.3081228], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.3859880, 0.9999000, 911140.1993942, 0.4950000], + [7.1757587, 0.9999000, 1289825.5029521, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [6.9317633, 0.7950036, 1110959.2451850, 0.2736173], - [6.3125748, 0.8210156, 834055.5094286, 0.2884673], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.9282136, 0.9999000, 1154924.8287232, 0.4950000], + [7.9229004, 0.9846598, 1726081.5253628, 0.4380722], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [7.6832308, 0.7711112, 1517301.5142304, 0.2607884], - [6.9761726, 0.7932167, 1131629.3899797, 0.2726328], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.5113768, 0.9999000, 1485792.9252531, 0.4950000], + [8.7000408, 0.9487765, 2294380.4707073, 0.3868369], ], ] ) @@ -96,27 +96,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.5431146, 0.8588028, 548917.6953551, 0.3121189], - [5.0453462, 0.8892852, 400916.4566323, 0.3336309], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [6.1456227, 0.9999000, 803071.9448300, 0.4950000], + [6.5702990, 0.9999000, 994006.4183463, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.2378520, 0.8244598, 803779.2831349, 0.2905124], - [5.6785118, 0.8518742, 595885.4921489, 0.3075644], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.4067726, 0.9999000, 920484.9815659, 0.4950000], + [7.1927543, 0.9999000, 1299749.2415466, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [6.9507085, 0.7942413, 1119777.2268361, 0.2731968], - [6.3312183, 0.8201563, 841609.4907163, 0.2879601], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.9527397, 0.9999000, 1165951.7893705, 0.4950000], + [7.9418189, 0.9830102, 1737128.0650149, 0.4348275], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [7.7025449, 0.7706119, 1528875.6023356, 0.2605276], - [6.9954994, 0.7924390, 1140624.9700319, 0.2722057], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.5379866, 0.9999000, 1501330.3805241, 0.4950000], + [8.7195249, 0.9479649, 2308944.8541921, 0.3859439], ], ] ) @@ -125,27 +125,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.5274367, 0.8596051, 543479.2092235, 0.3126534], - [5.0364358, 0.8898394, 398309.0269631, 0.3340477], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [6.1323955, 0.9999000, 797125.0304716, 0.4950000], + [6.5577405, 0.9999000, 988360.1351227, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.2202717, 0.8252701, 796656.0654567, 0.2909965], - [5.6680298, 0.8524106, 592249.4291781, 0.3079132], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.3859886, 0.9999000, 911140.4602184, 0.4950000], + [7.1758472, 0.9999000, 1289877.1876272, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [6.9317639, 0.7950036, 1110959.5162103, 0.2736173], - [6.3196140, 0.8206912, 836907.6633514, 0.2882756], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.9282143, 0.9999000, 1154925.1453971, 0.4950000], + [7.9229953, 0.9846515, 1726136.9828614, 0.4380555], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [7.6832314, 0.7711112, 1517301.8723625, 0.2607884], - [6.9837299, 0.7929126, 1135146.9152189, 0.2724657], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.5113776, 0.9999000, 1485793.3842104, 0.4950000], + [8.7001390, 0.9487724, 2294453.9295100, 0.3868324], ], ] ) @@ -180,11 +180,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -195,14 +195,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -211,7 +210,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -230,6 +229,7 @@ def test_regression_tandem(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) @@ -342,11 +342,11 @@ def test_regression_yaw(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -357,14 +357,13 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -373,7 +372,7 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -392,6 +391,7 @@ def test_regression_yaw(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yawed_baseline) @@ -432,11 +432,11 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -447,14 +447,13 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -463,7 +462,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -482,6 +481,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yaw_added_recovery_baseline) @@ -521,11 +521,11 @@ def test_regression_secondary_steering(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -536,14 +536,13 @@ def test_regression_secondary_steering(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -552,7 +551,7 @@ def test_regression_secondary_steering(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -571,6 +570,7 @@ def test_regression_secondary_steering(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], secondary_steering_baseline) @@ -620,11 +620,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -632,7 +632,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/reg_tests/empirical_gauss_regression_test.py b/tests/reg_tests/empirical_gauss_regression_test.py index 2eea96166..ff04a44ff 100644 --- a/tests/reg_tests/empirical_gauss_regression_test.py +++ b/tests/reg_tests/empirical_gauss_regression_test.py @@ -40,27 +40,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [5.8890878, 0.8410986, 668931.9953790, 0.3006878], - [5.9448342, 0.8382459, 688269.8273350, 0.2989067], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [5.2046715, 0.9999000, 472198.8758032, 0.4950000], + [5.7136814, 0.9999000, 642055.4951124, 0.4950000], ], - # 9m/s + # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [6.6288143, 0.8071935, 969952.7378773, 0.2804513], - [6.7440713, 0.8025559, 1023598.6805729, 0.2778266], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [6.0115808, 0.9999000, 742806.7294206, 0.4950000], + [6.4133522, 0.9999000, 923443.1633840, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [7.4019251, 0.7790665, 1355562.9527211, 0.2649822], - [7.5493339, 0.7745724, 1437063.0620195, 0.2626039], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [6.8042905, 0.9999000, 1099209.0117558, 0.4950000], + [7.1242759, 0.9999000, 1259764.7000394, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [8.2349756, 0.7622827, 1867008.5657835, 0.2562187], - [8.3523516, 0.7619629, 1946873.1634864, 0.2560548], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [7.6979621, 0.9999000, 1594740.0672673, 0.4950000], + [7.8374017, 0.9921150, 1676158.8729466, 0.4556013], ], ] ) @@ -69,27 +69,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.9257102, 0.8392246, 681635.9273649, 0.2995159], - [5.9615388, 0.8373911, 694064.4542077, 0.2983761], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.2698169, 0.9999000, 493937.9033545, 0.4950000], + [5.7366585, 0.9999000, 649722.9378426, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.6698959, 0.8055405, 989074.0018995, 0.2795122], - [6.7631531, 0.8017881, 1032480.2286024, 0.2773950], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.0771873, 0.9999000, 772303.4290066, 0.4950000], + [6.4385758, 0.9999000, 934783.6598709, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.4463751, 0.7776077, 1379101.8806016, 0.2642075], - [7.5701211, 0.7740351, 1449519.8581580, 0.2623212], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.8714929, 0.9999000, 1129423.1865848, 0.4950000], + [7.1496008, 0.9999000, 1274551.9264645, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.2809317, 0.7621575, 1898277.8462234, 0.2561545], - [8.3710828, 0.7619119, 1959618.1795131, 0.2560286], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.7629015, 0.9986112, 1632658.1906972, 0.4813666], + [7.8628245, 0.9898982, 1691003.2288593, 0.4497462], ], ] ) @@ -98,27 +98,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.9343009, 0.8387850, 684615.9328740, 0.2992420], - [5.9680241, 0.8370593, 696314.1525222, 0.2981704], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.2891896, 0.9999000, 500402.5860890, 0.4950000], + [5.7509719, 0.9999000, 654499.3198080, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.6795240, 0.8051531, 993555.3595338, 0.2792927], - [6.7704684, 0.8014937, 1035885.1172753, 0.2772298], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.0953302, 0.9999000, 780460.4375453, 0.4950000], + [6.4514885, 0.9999000, 940589.2185194, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.4567077, 0.7772686, 1384573.5845651, 0.2640278], - [7.5779862, 0.7738318, 1454233.0717541, 0.2622143], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.8894072, 0.9999000, 1137477.4728394, 0.4950000], + [7.1620262, 0.9999000, 1281807.0692217, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.2914104, 0.7621290, 1905407.7287412, 0.2561399], - [8.3784336, 0.7618919, 1964619.7950752, 0.2560184], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.7794078, 0.9971719, 1642296.2082994, 0.4734100], + [7.8766059, 0.9886965, 1699050.1689108, 0.4468411], ], ] ) @@ -153,11 +153,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -168,14 +168,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -184,7 +183,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -318,11 +317,11 @@ def test_regression_yaw(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -333,14 +332,13 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -349,7 +347,7 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -409,11 +407,11 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -424,14 +422,13 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -440,7 +437,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -483,11 +480,11 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -498,14 +495,13 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -514,7 +510,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -584,11 +580,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -596,7 +592,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/reg_tests/floris_interface_regression_test.py b/tests/reg_tests/floris_interface_regression_test.py index 65f122b6d..7bf76864c 100644 --- a/tests/reg_tests/floris_interface_regression_test.py +++ b/tests/reg_tests/floris_interface_regression_test.py @@ -38,27 +38,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], ], ] ) @@ -93,11 +93,11 @@ def test_calculate_no_wake(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( fi.floris.flow_field.air_density, - fi.floris.farm.ref_density_cp_cts, + fi.floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - fi.floris.farm.ref_tilt_cp_cts, + fi.floris.farm.ref_tilts, fi.floris.farm.pPs, fi.floris.farm.pTs, fi.floris.farm.turbine_tilt_interps, @@ -108,14 +108,13 @@ def test_calculate_no_wake(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - fi.floris.farm.ref_tilt_cp_cts, + fi.floris.farm.ref_tilts, fi.floris.farm.turbine_fCts, fi.floris.farm.turbine_tilt_interps, fi.floris.farm.correct_cp_ct_for_tilt, fi.floris.farm.turbine_type_map, ) farm_powers = power( - fi.floris.farm.ref_density_cp_cts, farm_eff_velocities, fi.floris.farm.turbine_power_interps, fi.floris.farm.turbine_type_map, @@ -124,7 +123,7 @@ def test_calculate_no_wake(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - fi.floris.farm.ref_tilt_cp_cts, + fi.floris.farm.ref_tilts, fi.floris.farm.turbine_fCts, fi.floris.farm.turbine_tilt_interps, fi.floris.farm.correct_cp_ct_for_tilt, @@ -143,6 +142,7 @@ def test_calculate_no_wake(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) diff --git a/tests/reg_tests/gauss_regression_test.py b/tests/reg_tests/gauss_regression_test.py index adcbf39ab..bca6a5fff 100644 --- a/tests/reg_tests/gauss_regression_test.py +++ b/tests/reg_tests/gauss_regression_test.py @@ -38,27 +38,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [5.9535039, 0.8378023, 691277.2666766, 0.2986311], - [6.0197522, 0.8345126, 715409.4436445, 0.2965993], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [5.7795499, 0.9999000, 664035.7863938, 0.4950000], + [6.1947301, 0.9999000, 825150.6752464, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [6.6995977, 0.8043454, 1002898.6210841, 0.2788357], - [6.8102318, 0.7998937, 1054392.8363310, 0.2763338], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [6.4832797, 0.9999000, 954882.5544405, 0.4950000], + [6.8943114, 0.9999000, 1139682.4011080, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [7.4637061, 0.7770389, 1388279.6564701, 0.2639062], - [7.5999706, 0.7732635, 1467407.3821931, 0.2619157], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [7.2224117, 0.9999000, 1317066.2170520, 0.4950000], + [7.6218311, 0.9999000, 1550287.1538867, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [8.2622911, 0.7622083, 1885594.4958198, 0.2561805], - [8.3719551, 0.7619095, 1960211.6949745, 0.2560274], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [8.0067501, 0.9776558, 1776145.7337219, 0.4252601], + [8.2634442, 0.9669631, 1968024.5508651, 0.4091197], ], ] ) @@ -67,27 +67,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.9856445, 0.8361576, 702426.4817361, 0.2976127], - [6.0238963, 0.8343216, 717088.5782753, 0.2964819], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.8141607, 0.9999000, 675585.4120668, 0.4950000], + [6.1898776, 0.9999000, 822968.9823021, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.7356851, 0.8028933, 1019695.3621240, 0.2780165], - [6.8150684, 0.7996991, 1056644.0444495, 0.2762251], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.5273781, 0.9999000, 974709.2138505, 0.4950000], + [6.8956437, 0.9999000, 1140281.4127700, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.5030787, 0.7757681, 1409344.3206494, 0.2632343], - [7.6053686, 0.7731239, 1470642.1508821, 0.2618425], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [7.2712495, 0.9999000, 1345582.5619236, 0.4950000], + [7.6247552, 0.9999000, 1551994.5413634, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.3037405, 0.7620954, 1913797.3425937, 0.2561227], - [8.3759415, 0.7618987, 1962924.0966747, 0.2560219], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [8.0580672, 0.9755181, 1814505.2545657, 0.4217666], + [8.2651595, 0.9668916, 1969306.7558759, 0.4090215], ], ] ) @@ -158,27 +158,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [6.0012497, 0.8353654, 707912.6031236, 0.2971241], - [6.0458168, 0.8333112, 725970.3069204, 0.2958623], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.8400871, 0.9999000, 684237.0639043, 0.4950000], + [6.2143862, 0.9999000, 833988.0462950, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.7531826, 0.8021893, 1027839.4859975, 0.2776204], - [6.8391301, 0.7987309, 1067843.4584263, 0.2756849], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.5548369, 0.9999000, 987054.6548899, 0.4950000], + [6.9234726, 0.9999000, 1152793.2736290, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.5219279, 0.7752809, 1420639.8615893, 0.2629772], - [7.6309661, 0.7724622, 1485981.5768983, 0.2614954], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [7.2999207, 0.9999000, 1362323.6787555, 0.4950000], + [7.6552772, 0.9999000, 1569816.3464249, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.3229930, 0.7620429, 1926897.0262401, 0.2560958], - [8.4021717, 0.7618272, 1980771.5704442, 0.2559853], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [8.0861582, 0.9743480, 1835503.2543527, 0.4199188], + [8.2981760, 0.9655163, 1993986.5760188, 0.4071511], ], ] ) @@ -187,27 +187,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [6.0012490, 0.8353654, 707912.3201655, 0.2971241], - [6.0404040, 0.8335607, 723777.1688957, 0.2960151], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.8400860, 0.9999000, 684236.6839679, 0.4950000], + [6.2098526, 0.9999000, 831949.7284759, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.7531818, 0.8021893, 1027839.1215598, 0.2776204], - [6.8331381, 0.7989720, 1065054.4872236, 0.2758193], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.5548356, 0.9999000, 987054.1060453, 0.4950000], + [6.9179354, 0.9999000, 1150303.7536816, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.5219271, 0.7752809, 1420639.3564230, 0.2629773], - [7.6244680, 0.7726302, 1482087.5389477, 0.2615835], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [7.2999194, 0.9999000, 1362322.9313611, 0.4950000], + [7.6489634, 0.9999000, 1566129.7331370, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.3229921, 0.7620429, 1926896.4413586, 0.2560958], - [8.3952439, 0.7618461, 1976057.7564083, 0.2559949], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [8.0861569, 0.9743481, 1835502.3137484, 0.4199189], + [8.2904931, 0.9658364, 1988243.5851511, 0.4075829], ], ] ) @@ -216,27 +216,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [5.9856452, 0.8361576, 702426.7279908, 0.2976127], - [6.0294010, 0.8340678, 719318.9574833, 0.2963261], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.8141618, 0.9999000, 675585.8015652, 0.4950000], + [6.1945000, 0.9999000, 825047.1999144, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.7356859, 0.8028933, 1019695.7325708, 0.2780165], - [6.8211610, 0.7994540, 1059479.8255425, 0.2760882], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.5273794, 0.9999000, 974709.7756786, 0.4950000], + [6.9012912, 0.9999000, 1142820.5035353, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.5030795, 0.7757681, 1409344.8339510, 0.2632343], - [7.6119726, 0.7729532, 1474599.5989813, 0.2617529], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [7.2712508, 0.9999000, 1345583.3260702, 0.4950000], + [7.6311934, 0.9999000, 1555753.8395838, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.3037414, 0.7620954, 1913797.9363787, 0.2561227], - [8.3829757, 0.7618795, 1967710.2678086, 0.2560120], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [8.0580685, 0.9755181, 1814506.2143490, 0.4217665], + [8.2729805, 0.9665658, 1975152.9374677, 0.4085750], ], ] ) @@ -271,11 +271,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -286,14 +286,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -302,7 +301,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -321,6 +320,7 @@ def test_regression_tandem(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) @@ -433,11 +433,11 @@ def test_regression_yaw(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -448,14 +448,13 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -464,7 +463,7 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -483,6 +482,7 @@ def test_regression_yaw(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yawed_baseline) @@ -520,11 +520,11 @@ def test_regression_gch(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -535,14 +535,13 @@ def test_regression_gch(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -551,7 +550,7 @@ def test_regression_gch(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -603,11 +602,11 @@ def test_regression_gch(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -618,14 +617,13 @@ def test_regression_gch(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -634,7 +632,7 @@ def test_regression_gch(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -653,6 +651,7 @@ def test_regression_gch(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], gch_baseline) @@ -693,11 +692,11 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -708,14 +707,13 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -724,7 +722,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -743,6 +741,7 @@ def test_regression_yaw_added_recovery(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yaw_added_recovery_baseline) @@ -782,11 +781,11 @@ def test_regression_secondary_steering(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -797,14 +796,13 @@ def test_regression_secondary_steering(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -813,7 +811,7 @@ def test_regression_secondary_steering(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -832,6 +830,7 @@ def test_regression_secondary_steering(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], secondary_steering_baseline) @@ -881,11 +880,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -893,7 +892,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/reg_tests/jensen_jimenez_regression_test.py b/tests/reg_tests/jensen_jimenez_regression_test.py index 06be35372..7d828ac23 100644 --- a/tests/reg_tests/jensen_jimenez_regression_test.py +++ b/tests/reg_tests/jensen_jimenez_regression_test.py @@ -39,27 +39,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [6.1528670, 0.8283770, 769344.9989547, 0.2928630], - [5.6590323, 0.8528710, 589128.2717851, 0.3082130], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [4.9280682, 0.9999000, 387629.0162668, 0.4950000], + [4.0693808, 0.9999000, 193393.9317100, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [6.9262647, 0.7952248, 1108399.9545223, 0.2737395], - [6.5033542, 0.8122418, 911557.7945732, 0.2833446], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [5.9801510, 0.9999000, 730976.4052839, 0.4950000], + [4.6800193, 0.9999000, 331520.3579674, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [7.7391355, 0.7696661, 1550802.6855981, 0.2600344], - [7.3444882, 0.7809516, 1325146.7113373, 0.2659870], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [6.8922613, 0.9999000, 1138760.6938954, 0.4950000], + [5.2528921, 0.9999000, 488290.0920728, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [8.6200527, 0.7618150, 2139354.1087623, 0.2559790], - [8.1422116, 0.7625354, 1803890.3447532, 0.2563483], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [7.9304836, 0.9839986, 1730509.3806710, 0.4367516], + [6.3781995, 0.9999000, 907638.4974973, 0.4950000], ], ] ) @@ -68,27 +68,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [6.1670027, 0.8277254, 775072.5021192, 0.2924701], - [5.6650398, 0.8525636, 591212.2253601, 0.3080128], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [5.0031262, 0.9999000, 404943.2096855, 0.4950000], + [4.0877214, 0.9999000, 197542.5727513, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.9420997, 0.7945877, 1115770.2903095, 0.2733878], - [6.5099782, 0.8119752, 914640.8879238, 0.2831909], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [6.0241988, 0.9999000, 748479.8024325, 0.4950000], + [4.6896722, 0.9999000, 333703.8593142, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.7560617, 0.7692286, 1560945.8383104, 0.2598066], - [7.3508004, 0.7807445, 1328489.3723384, 0.2658764], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [6.9296764, 0.9999000, 1155582.5123097, 0.4950000], + [5.2605730, 0.9999000, 490853.1991956, 0.4950000], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.6371187, 0.7618512, 2152434.8973815, 0.2559975], - [8.1465243, 0.7625236, 1806824.8092631, 0.2563423], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [7.9606249, 0.9813703, 1748108.9014399, 0.4317547], + [6.4297072, 0.9999000, 930796.3570195, 0.4950000], ], ] ) @@ -122,11 +122,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -137,14 +137,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -153,7 +152,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -172,6 +171,7 @@ def test_regression_tandem(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) @@ -284,11 +284,11 @@ def test_regression_yaw(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -299,14 +299,13 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -315,7 +314,7 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -334,6 +333,7 @@ def test_regression_yaw(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yawed_baseline) @@ -383,11 +383,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -395,7 +395,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/reg_tests/none_regression_test.py b/tests/reg_tests/none_regression_test.py index 5a8ecd007..6a87c6cdf 100644 --- a/tests/reg_tests/none_regression_test.py +++ b/tests/reg_tests/none_regression_test.py @@ -40,31 +40,32 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], ], ] ) +""" yawed_baseline = np.array( [ # 8 m/s @@ -97,6 +98,7 @@ # Note: compare the yawed vs non-yawed results. The upstream turbine # power should be lower in the yawed case. The following turbine # powers should higher in the yawed case. +""" def test_regression_tandem(sample_inputs_fixture): @@ -123,11 +125,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -138,14 +140,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -154,7 +155,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -173,6 +174,7 @@ def test_regression_tandem(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) @@ -318,11 +320,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -330,7 +332,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/reg_tests/turbopark_regression_test.py b/tests/reg_tests/turbopark_regression_test.py index 5d138cdc3..e71b904d9 100644 --- a/tests/reg_tests/turbopark_regression_test.py +++ b/tests/reg_tests/turbopark_regression_test.py @@ -39,27 +39,27 @@ [ # 8 m/s [ - [7.9736330, 0.7636044, 1691326.6483808, 0.2568973], - [6.0583922, 0.8327316, 731065.6226282, 0.2955077], - [5.4067009, 0.8668116, 506659.6232808, 0.3175251], + [7.9736330, 0.9802361, 1755704.3055424, 0.4297079], + [6.7151843, 0.9999000, 1059146.8565455, 0.4950000], + [6.8184778, 0.9999000, 1105587.6223554, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7625570, 2407841.6718785, 0.2563594], - [6.8171892, 0.7996138, 1057631.1392858, 0.2761774], - [6.0917181, 0.8311955, 744568.6379292, 0.2945709], + [8.9703371, 0.9375172, 2496426.9963900, 0.3750172], + [7.0397157, 0.9999000, 1210390.0246292, 0.4950000], + [7.2470207, 0.9999000, 1331435.3804590, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7529384, 3298067.1555604, 0.2514735], - [7.5908545, 0.7734991, 1461944.4626519, 0.2620395], - [6.7995666, 0.8003229, 1049428.7626183, 0.2765738], + [9.9670412, 0.9064422, 3417764.6183773, 0.3470639], + [7.6483624, 0.9999000, 1565778.8192291, 0.4950000], + [7.9169796, 0.9851761, 1722624.3881717, 0.4391232], ], # 11 m/s [ - [10.9637454, 0.7306256, 4363191.9880631, 0.2404936], - [8.3975139, 0.7618399, 1977602.3128807, 0.2559918], - [7.5196816, 0.7753389, 1419293.7479312, 0.2630079], + [10.9637454, 0.8574973, 4519330.7327692, 0.3112524], + [8.2847975, 0.9660736, 1983986.1649899, 0.4079044], + [7.8740779, 0.9889170, 1697574.0914617, 0.4473620], ], ] ) @@ -69,27 +69,27 @@ [ # 8 m/s [ - [7.9736330, 0.7606986, 1679924.0721706, 0.2549029], - [6.0772917, 0.8318604, 738723.3410291, 0.2949759], - [5.4215054, 0.8658908, 510991.8557577, 0.3168954], + [7.9736330, 0.9765060, 1744593.9143866, 0.4191177], + [6.6588666, 0.9999000, 1033826.4024924, 0.4950000], + [6.7775548, 0.9999000, 1087188.6519965, 0.4950000], ], # 9 m/s [ - [8.9703371, 0.7596552, 2391434.0080674, 0.2543734], - [6.8384389, 0.7987587, 1067521.7514783, 0.2757004], - [6.1089600, 0.8304008, 751554.7217137, 0.2940879], + [8.9703371, 0.9339496, 2480425.7212356, 0.3694929], + [7.0359610, 0.9999000, 1208197.6518290, 0.4950000], + [7.2560848, 0.9999000, 1336727.8980709, 0.4950000], ], # 10 m/s [ - [9.9670412, 0.7500732, 3275671.6727516, 0.2495630], - [7.6142906, 0.7728933, 1475988.7044752, 0.2617214], - [6.8186733, 0.7995541, 1058321.9413265, 0.2761440], + [9.9670412, 0.9029930, 3395649.2030651, 0.3428407], + [7.6585724, 0.9999000, 1571740.4125599, 0.4950000], + [7.9402480, 0.9831471, 1736210.8307124, 0.4350907], ], # 11 m/s [ - [10.9637454, 0.7278454, 4333842.6695283, 0.2387424], - [8.4226213, 0.7617715, 1994685.7970084, 0.2559567], - [7.5392355, 0.7748335, 1431011.5054545, 0.2627414], + [10.9637454, 0.8542343, 4488170.1670616, 0.3081595], + [8.3069368, 0.9651514, 2000535.2514727, 0.4066611], + [7.8881534, 0.9876896, 1705792.7650019, 0.4445239], ], ] ) @@ -124,11 +124,11 @@ def test_regression_tandem(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -139,14 +139,13 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -155,7 +154,7 @@ def test_regression_tandem(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -174,6 +173,7 @@ def test_regression_tandem(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], baseline) @@ -287,11 +287,11 @@ def test_regression_yaw(sample_inputs_fixture): ) farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -302,14 +302,13 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, @@ -318,7 +317,7 @@ def test_regression_yaw(sample_inputs_fixture): velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.turbine_fCts, floris.farm.turbine_tilt_interps, floris.farm.correct_cp_ct_for_tilt, @@ -337,6 +336,7 @@ def test_regression_yaw(sample_inputs_fixture): farm_cts, farm_powers, farm_axial_inductions, + max_findex_print=4 ) assert_results_arrays(test_results[0:4], yawed_baseline) @@ -381,11 +381,11 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): farm_eff_velocities = rotor_effective_velocity( floris.flow_field.air_density, - floris.farm.ref_density_cp_cts, + floris.farm.ref_air_densities, velocities, yaw_angles, tilt_angles, - floris.farm.ref_tilt_cp_cts, + floris.farm.ref_tilts, floris.farm.pPs, floris.farm.pTs, floris.farm.turbine_tilt_interps, @@ -393,7 +393,6 @@ def test_regression_small_grid_rotation(sample_inputs_fixture): floris.farm.turbine_type_map, ) farm_powers = power( - floris.farm.ref_density_cp_cts, farm_eff_velocities, floris.farm.turbine_power_interps, floris.farm.turbine_type_map, diff --git a/tests/turbine_multi_dim_unit_test.py b/tests/turbine_multi_dim_unit_test.py index 068c183df..a4af63040 100644 --- a/tests/turbine_multi_dim_unit_test.py +++ b/tests/turbine_multi_dim_unit_test.py @@ -122,7 +122,7 @@ def test_ct(): velocities=wind_speed * np.ones((1, 1, 3, 3)), yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt=np.array([[turbine.fCt_interp[(2, 1)]]]), tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False]]), @@ -137,7 +137,7 @@ def test_ct(): velocities=np.ones((N_TURBINES, 3, 3)) * WIND_CONDITION_BROADCAST, # 16 x 4 x 3 x 3 yaw_angle=np.zeros((1, N_TURBINES)), tilt_angle=np.ones((1, N_TURBINES)) * 5.0, - ref_tilt_cp_ct=np.ones((1, N_TURBINES)) * 5.0, + ref_tilt=np.ones((1, N_TURBINES)) * 5.0, fCt=np.tile( [turbine.fCt_interp[(2, 1)]], ( @@ -189,7 +189,7 @@ def test_power(): # Single turbine wind_speed = 10.0 p = power_multidim( - ref_density_cp_ct=AIR_DENSITY, + ref_air_density=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1, 3, 3)), power_interp=np.array([[turbine.power_interp[(2, 1)]]]), ) @@ -209,7 +209,7 @@ def test_power(): # Multiple turbines with ix filter rotor_effective_velocities = np.ones((N_TURBINES, 3, 3)) * WIND_CONDITION_BROADCAST p = power_multidim( - ref_density_cp_ct=AIR_DENSITY, + ref_air_density=AIR_DENSITY, rotor_effective_velocities=rotor_effective_velocities, power_interp=np.tile( [turbine.power_interp[(2, 1)]], @@ -244,7 +244,7 @@ def test_axial_induction(): velocities=wind_speed * np.ones((1, 1, 3, 3)), yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt=np.array([[turbine.fCt_interp[(2, 1)]]]), tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False]]), @@ -257,7 +257,7 @@ def test_axial_induction(): velocities=np.ones((N_TURBINES, 3, 3)) * WIND_CONDITION_BROADCAST, # 16 x 4 x 3 x 3 yaw_angle=np.zeros((1, N_TURBINES)), tilt_angle=np.ones((1, N_TURBINES)) * 5.0, - ref_tilt_cp_ct=np.ones((1, N_TURBINES)) * 5.0, + ref_tilt=np.ones((1, N_TURBINES)) * 5.0, fCt=np.tile( [turbine.fCt_interp[(2, 1)]], ( diff --git a/tests/turbine_unit_test.py b/tests/turbine_unit_test.py index e7fcbf989..2ad2307fd 100644 --- a/tests/turbine_unit_test.py +++ b/tests/turbine_unit_test.py @@ -36,7 +36,7 @@ cubic_cubature, simple_cubature, ) -from floris.turbine_library import build_turbine_dict +from floris.tools import build_turbine_dict from tests.conftest import SampleInputs, WIND_SPEEDS @@ -57,8 +57,8 @@ def test_turbine_init(): assert turbine.pT == turbine_data["pT"] assert turbine.TSR == turbine_data["TSR"] assert turbine.generator_efficiency == turbine_data["generator_efficiency"] - assert turbine.ref_density_cp_ct == turbine_data["ref_density_cp_ct"] - assert turbine.ref_tilt_cp_ct == turbine_data["ref_tilt_cp_ct"] + assert turbine.ref_air_density == turbine_data["ref_air_density"] + assert turbine.ref_tilt == turbine_data["ref_tilt"] assert np.array_equal( turbine.power_thrust_table["wind_speed"], turbine_data["power_thrust_table"]["wind_speed"] @@ -68,8 +68,8 @@ def test_turbine_init(): turbine_data["power_thrust_table"]["power"] ) assert np.array_equal( - turbine.power_thrust_table["thrust"], - turbine_data["power_thrust_table"]["thrust"] + turbine.power_thrust_table["thrust_coefficient"], + turbine_data["power_thrust_table"]["thrust_coefficient"] ) assert turbine.rotor_radius == turbine.rotor_diameter / 2.0 assert turbine.rotor_area == np.pi * turbine.rotor_radius ** 2.0 @@ -195,7 +195,7 @@ def test_ct(): velocities=wind_speed * np.ones((1, 1, 3, 3)), yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt={turbine.turbine_type: turbine.fCt_interp}, tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False]]), @@ -203,7 +203,10 @@ def test_ct(): ) truth_index = turbine_data["power_thrust_table"]["wind_speed"].index(wind_speed) - np.testing.assert_allclose(thrust, turbine_data["power_thrust_table"]["thrust"][truth_index]) + np.testing.assert_allclose( + thrust, + turbine_data["power_thrust_table"]["thrust_coefficient"][truth_index] + ) # Multiple turbines with index filter # 4 turbines with 3 x 3 grid arrays @@ -211,7 +214,7 @@ def test_ct(): velocities=np.ones((N_TURBINES, 3, 3)) * WIND_CONDITION_BROADCAST, # 12 x 4 x 3 x 3 yaw_angle=np.zeros((1, N_TURBINES)), tilt_angle=np.ones((1, N_TURBINES)) * 5.0, - ref_tilt_cp_ct=np.ones((1, N_TURBINES)) * 5.0, + ref_tilt=np.ones((1, N_TURBINES)) * 5.0, fCt={turbine.turbine_type: turbine.fCt_interp}, tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False] * N_TURBINES]), @@ -224,7 +227,7 @@ def test_ct(): truth_index = turbine_data["power_thrust_table"]["wind_speed"].index(WIND_SPEEDS[0]) np.testing.assert_allclose( thrusts[0, i], - turbine_data["power_thrust_table"]["thrust"][truth_index] + turbine_data["power_thrust_table"]["thrust_coefficient"][truth_index] ) # Single floating turbine; note that 'tilt_interp' is not set to None @@ -232,7 +235,7 @@ def test_ct(): velocities=wind_speed * np.ones((1, 1, 3, 3)), # One findex, one turbine yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt={turbine.turbine_type: turbine_floating.fCt_interp}, tilt_interp={turbine_floating.turbine_type: turbine_floating.tilt_interp}, correct_cp_ct_for_tilt=np.array([[True]]), @@ -242,12 +245,12 @@ def test_ct(): truth_index = turbine_floating_data["power_thrust_table"]["wind_speed"].index(wind_speed) np.testing.assert_allclose( thrust, - turbine_floating_data["power_thrust_table"]["thrust"][truth_index] + turbine_floating_data["power_thrust_table"]["thrust_coefficient"][truth_index] ) def test_power(): - AIR_DENSITY = 1.225 + # AIR_DENSITY = 1.225 # Test that power is computed as expected for a single turbine n_turbines = 1 @@ -257,30 +260,20 @@ def test_power(): turbine_type_map = np.array(n_turbines * [turbine.turbine_type]) turbine_type_map = turbine_type_map[None, :] test_power = power( - ref_density_cp_ct=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1)), # 1 findex, 1 turbine power_interp={turbine.turbine_type: turbine.power_interp}, turbine_type_map=turbine_type_map[:,0] ) - # Recompute using the provided Cp table + # Recompute using the provided power truth_index = turbine_data["power_thrust_table"]["wind_speed"].index(wind_speed) - cp_truth = turbine_data["power_thrust_table"]["power"][truth_index] - baseline_power = ( - 0.5 - * cp_truth - * AIR_DENSITY - * turbine.rotor_area - * wind_speed ** 3 - * turbine.generator_efficiency - ) + baseline_power = turbine_data["power_thrust_table"]["power"][truth_index] * 1000 assert np.allclose(baseline_power, test_power) # At rated, the power calculated should be 5MW since the test data is the NREL 5MW turbine wind_speed = 18.0 rated_power = power( - ref_density_cp_ct=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1, 1)), power_interp={turbine.turbine_type: turbine.power_interp}, turbine_type_map=turbine_type_map[:,0] @@ -291,7 +284,6 @@ def test_power(): # At wind speed = 0.0, the power should be 0 based on the provided Cp curve wind_speed = 0.0 zero_power = power( - ref_density_cp_ct=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1, 1)), power_interp={turbine.turbine_type: turbine.power_interp}, turbine_type_map=turbine_type_map[:,0] @@ -307,7 +299,6 @@ def test_power(): turbine_type_map = np.array(n_turbines * [turbine.turbine_type]) turbine_type_map = turbine_type_map[None, :] test_4_power = power( - ref_density_cp_ct=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1, n_turbines)), power_interp={turbine.turbine_type: turbine.power_interp}, turbine_type_map=turbine_type_map @@ -323,7 +314,6 @@ def test_power(): turbine_type_map = np.array(n_turbines * [turbine.turbine_type]) turbine_type_map = turbine_type_map[None, :] test_grid_power = power( - ref_density_cp_ct=AIR_DENSITY, rotor_effective_velocities=wind_speed * np.ones((1, 1, n_turbines, 3, 3)), power_interp={turbine.turbine_type: turbine.power_interp}, turbine_type_map=turbine_type_map[:,0] @@ -344,7 +334,10 @@ def test_axial_induction(): turbine_type_map = np.array(N_TURBINES * [turbine.turbine_type]) turbine_type_map = turbine_type_map[None, :] - baseline_ai = 0.25116283939089806 + baseline_ct = turbine.power_thrust_table["thrust_coefficient"][ + turbine.power_thrust_table["wind_speed"] == 10. + ][0] + baseline_ai = 0.5 * (1-np.sqrt(1-baseline_ct)) # Single turbine wind_speed = 10.0 @@ -352,7 +345,7 @@ def test_axial_induction(): velocities=wind_speed * np.ones((1, 1, 3, 3)), # 1 findex, 1 Turbine yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt={turbine.turbine_type: turbine.fCt_interp}, tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False]]), @@ -365,7 +358,7 @@ def test_axial_induction(): velocities=np.ones((N_TURBINES, 3, 3)) * WIND_CONDITION_BROADCAST, # 12 x 4 x 3 x 3 yaw_angle=np.zeros((1, N_TURBINES)), tilt_angle=np.ones((1, N_TURBINES)) * 5.0, - ref_tilt_cp_ct=np.ones((1, N_TURBINES)) * 5.0, + ref_tilt=np.ones((1, N_TURBINES)) * 5.0, fCt={turbine.turbine_type: turbine.fCt_interp}, tilt_interp={turbine.turbine_type: None}, correct_cp_ct_for_tilt=np.array([[False] * N_TURBINES]), @@ -383,7 +376,7 @@ def test_axial_induction(): velocities=wind_speed * np.ones((1, 1, 3, 3)), yaw_angle=np.zeros((1, 1)), tilt_angle=np.ones((1, 1)) * 5.0, - ref_tilt_cp_ct=np.ones((1, 1)) * 5.0, + ref_tilt=np.ones((1, 1)) * 5.0, fCt={turbine.turbine_type: turbine_floating.fCt_interp}, tilt_interp={turbine_floating.turbine_type: turbine_floating.tilt_interp}, correct_cp_ct_for_tilt=np.array([[True]]), @@ -448,7 +441,7 @@ def test_rotor_velocity_tilt_correction(): tilt_corrected_velocities = _rotor_velocity_tilt_correction( turbine_type_map=np.array([turbine_type_map[:, 0]]), tilt_angle=5.0*np.ones((1, 1)), - ref_tilt_cp_ct=np.array([turbine.ref_tilt_cp_ct]), + ref_tilt=np.array([turbine.ref_tilt]), pT=np.array([turbine.pT]), tilt_interp={turbine.turbine_type: turbine.tilt_interp}, correct_cp_ct_for_tilt=np.array([[False]]), @@ -461,7 +454,7 @@ def test_rotor_velocity_tilt_correction(): tilt_corrected_velocities = _rotor_velocity_tilt_correction( turbine_type_map=turbine_type_map, tilt_angle=5.0*np.ones((1, N_TURBINES)), - ref_tilt_cp_ct=np.array([turbine.ref_tilt_cp_ct] * N_TURBINES), + ref_tilt=np.array([turbine.ref_tilt] * N_TURBINES), pT=np.array([turbine.pT] * N_TURBINES), tilt_interp={turbine.turbine_type: turbine.tilt_interp}, correct_cp_ct_for_tilt=np.array([[False] * N_TURBINES]), @@ -474,7 +467,7 @@ def test_rotor_velocity_tilt_correction(): tilt_corrected_velocities = _rotor_velocity_tilt_correction( turbine_type_map=np.array([turbine_type_map[:, 0]]), tilt_angle=5.0*np.ones((1, 1)), - ref_tilt_cp_ct=np.array([turbine_floating.ref_tilt_cp_ct]), + ref_tilt=np.array([turbine_floating.ref_tilt]), pT=np.array([turbine_floating.pT]), tilt_interp={turbine_floating.turbine_type: turbine_floating.tilt_interp}, correct_cp_ct_for_tilt=np.array([[True]]), @@ -487,7 +480,7 @@ def test_rotor_velocity_tilt_correction(): tilt_corrected_velocities = _rotor_velocity_tilt_correction( turbine_type_map, tilt_angle=5.0*np.ones((1, N_TURBINES)), - ref_tilt_cp_ct=np.array([turbine_floating.ref_tilt_cp_ct] * N_TURBINES), + ref_tilt=np.array([turbine_floating.ref_tilt] * N_TURBINES), pT=np.array([turbine_floating.pT] * N_TURBINES), tilt_interp={turbine_floating.turbine_type: turbine_floating.tilt_interp}, correct_cp_ct_for_tilt=np.array([[True] * N_TURBINES]), @@ -588,88 +581,3 @@ def test_cubic_cubature(): # Check if the result matches the expected output np.testing.assert_allclose(result, expected_output) - -def test_build_turbine_dict(): - - orig_file_path = Path(__file__).resolve().parent / "data" / "nrel_5MW_custom.yaml" - test_turb_name = "test_turbine_export" - test_file_path = "." - - in_dict = yaml.safe_load( open(orig_file_path, "r") ) - - # Mocked up turbine data - turbine_data_dict = { - "wind_speed":in_dict["power_thrust_table"]["wind_speed"], - "power_coefficient":in_dict["power_thrust_table"]["power"], - "thrust_coefficient":in_dict["power_thrust_table"]["thrust"] - } - - build_turbine_dict( - turbine_data_dict, - test_turb_name, - file_path=test_file_path, - generator_efficiency=in_dict["generator_efficiency"], - hub_height=in_dict["hub_height"], - pP=in_dict["pP"], - pT=in_dict["pT"], - rotor_diameter=in_dict["rotor_diameter"], - TSR=in_dict["TSR"], - air_density=in_dict["ref_density_cp_ct"], - ref_tilt_cp_ct=in_dict["ref_tilt_cp_ct"] - ) - - test_dict = yaml.safe_load( - open(os.path.join(test_file_path, test_turb_name+".yaml"), "r") - ) - - # Correct intended difference for test; assert equal - test_dict["turbine_type"] = in_dict["turbine_type"] - assert list(in_dict.keys()) == list(test_dict.keys()) - assert in_dict == test_dict - - # Now, in absolute values - Cp = np.array(in_dict["power_thrust_table"]["power"]) - Ct = np.array(in_dict["power_thrust_table"]["thrust"]) - ws = np.array(in_dict["power_thrust_table"]["wind_speed"]) - - P = 0.5 * in_dict["ref_density_cp_ct"] * (np.pi * in_dict["rotor_diameter"]**2/4) \ - * Cp * ws**3 - T = 0.5 * in_dict["ref_density_cp_ct"] * (np.pi * in_dict["rotor_diameter"]**2/4) \ - * Ct * ws**2 - - turbine_data_dict = { - "wind_speed":in_dict["power_thrust_table"]["wind_speed"], - "power_absolute": P/1000, - "thrust_absolute": T/1000 - } - - build_turbine_dict( - turbine_data_dict, - test_turb_name, - file_path=test_file_path, - generator_efficiency=in_dict["generator_efficiency"], - hub_height=in_dict["hub_height"], - pP=in_dict["pP"], - pT=in_dict["pT"], - rotor_diameter=in_dict["rotor_diameter"], - TSR=in_dict["TSR"], - air_density=in_dict["ref_density_cp_ct"], - ref_tilt_cp_ct=in_dict["ref_tilt_cp_ct"] - ) - - test_dict = yaml.safe_load( - open(os.path.join(test_file_path, test_turb_name+".yaml"), "r") - ) - - test_dict["turbine_type"] = in_dict["turbine_type"] - assert list(in_dict.keys()) == list(test_dict.keys()) - for k in in_dict.keys(): - if type(in_dict[k]) is dict: - for k2 in in_dict[k].keys(): - assert np.allclose(in_dict[k][k2], test_dict[k][k2]) - elif type(in_dict[k]) is str: - assert in_dict[k] == test_dict[k] - else: - assert np.allclose(in_dict[k], test_dict[k]) - - os.remove( os.path.join(test_file_path, test_turb_name+".yaml") ) diff --git a/tests/turbine_utilities_unit_test.py b/tests/turbine_utilities_unit_test.py new file mode 100644 index 000000000..fb0220b1e --- /dev/null +++ b/tests/turbine_utilities_unit_test.py @@ -0,0 +1,115 @@ +# Copyright 2021 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 os +from pathlib import Path + +import numpy as np +import yaml + +from floris.tools import build_turbine_dict, check_smooth_power_curve + + +def test_build_turbine_dict(): + + v3_file_path = Path(__file__).resolve().parent / "data" / "nrel_5MW_v3legacy.yaml" + v4_file_path = Path(__file__).resolve().parent / "data" / "nrel_5MW.yaml" + test_turb_name = "test_turbine_export" + test_file_path = "." + + in_dict_v3 = yaml.safe_load( open(v3_file_path, "r") ) + + # Mocked up turbine data + turbine_data_dict = { + "wind_speed":in_dict_v3["power_thrust_table"]["wind_speed"], + "power_coefficient":in_dict_v3["power_thrust_table"]["power"], + "thrust_coefficient":in_dict_v3["power_thrust_table"]["thrust"] + } + + test_dict = build_turbine_dict( + turbine_data_dict, + test_turb_name, + file_name=os.path.join(test_file_path, test_turb_name+".yaml"), + generator_efficiency=in_dict_v3["generator_efficiency"], + hub_height=in_dict_v3["hub_height"], + pP=in_dict_v3["pP"], + pT=in_dict_v3["pT"], + rotor_diameter=in_dict_v3["rotor_diameter"], + TSR=in_dict_v3["TSR"], + ref_air_density=in_dict_v3["ref_density_cp_ct"], + ref_tilt=in_dict_v3["ref_tilt_cp_ct"] + ) + + # Directly compute power, thrust values + Cp = np.array(in_dict_v3["power_thrust_table"]["power"]) + Ct = np.array(in_dict_v3["power_thrust_table"]["thrust"]) + ws = np.array(in_dict_v3["power_thrust_table"]["wind_speed"]) + + P = 0.5 * in_dict_v3["ref_density_cp_ct"] * (np.pi * in_dict_v3["rotor_diameter"]**2/4) \ + * Cp * ws**3 + T = 0.5 * in_dict_v3["ref_density_cp_ct"] * (np.pi * in_dict_v3["rotor_diameter"]**2/4) \ + * Ct * ws**2 + + # Compare direct computation to those generated by build_turbine_dict + assert np.allclose(Ct, test_dict["power_thrust_table"]["thrust_coefficient"]) + assert np.allclose(P/1000, test_dict["power_thrust_table"]["power"]) + + # Check that dict keys match the v4 structure + in_dict_v4 = yaml.safe_load( open(v4_file_path, "r") ) + assert set(in_dict_v4.keys()) >= set(test_dict.keys()) + + # Check thrust conversion from absolute value + turbine_data_dict = { + "wind_speed":in_dict_v3["power_thrust_table"]["wind_speed"], + "power": P/1000, + "thrust": T/1000 + } + + test_dict_2 = build_turbine_dict( + turbine_data_dict, + test_turb_name, + file_name=os.path.join(test_file_path, test_turb_name+".yaml"), + generator_efficiency=in_dict_v4["generator_efficiency"], + hub_height=in_dict_v4["hub_height"], + pP=in_dict_v4["pP"], + pT=in_dict_v4["pT"], + rotor_diameter=in_dict_v4["rotor_diameter"], + TSR=in_dict_v4["TSR"], + ref_air_density=in_dict_v4["ref_air_density"], + ref_tilt=in_dict_v4["ref_tilt"] + ) + assert np.allclose(Ct, test_dict_2["power_thrust_table"]["thrust_coefficient"]) + + +def test_check_smooth_power_curve(): + + p1 = np.array([0, 1, 2, 3, 3, 3, 3, 2, 1], dtype=float)*1000 # smooth + p2 = np.array([0, 1, 2, 3, 2.99, 3.01, 3, 2, 1], dtype=float)*1000 # non-smooth + + p3 = p1.copy() + p3[5] = p3[5] + 9e-4 # just smooth enough + + p4 = p1.copy() + p4[5] = p4[5] + 1.1e-3 # just not smooth enough + + # Without a shutdown region + p5 = p1[:-3] # smooth + p6 = p2[:-3] # non-smooth + + assert check_smooth_power_curve(p1) + assert not check_smooth_power_curve(p2) + assert check_smooth_power_curve(p3) + assert not check_smooth_power_curve(p4) + assert check_smooth_power_curve(p5) + assert not check_smooth_power_curve(p6)