Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add merge/reduce FLORIS objects #866

Merged
merged 123 commits into from
Apr 8, 2024
Merged
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
cccc604
Rename example 1
paulf81 Mar 13, 2024
a86d752
Start example 2
paulf81 Mar 13, 2024
c0ea9fd
Update visualization examples
paulf81 Mar 13, 2024
dc87b66
Rename wind data example
paulf81 Mar 13, 2024
e6353e2
Use tindex in place of T
paulf81 Mar 13, 2024
31e3d68
Update making adjustments to set example
paulf81 Mar 14, 2024
9916024
Touching up
paulf81 Mar 14, 2024
2c0be8d
Start controls folder
paulf81 Mar 14, 2024
09d0fb5
Finish 004 example
paulf81 Mar 14, 2024
e42b508
start 005 example
paulf81 Mar 14, 2024
e5d2b6d
Add place holder
paulf81 Mar 14, 2024
c665bf4
Add todo
paulf81 Mar 14, 2024
1e777b2
minor fix
paulf81 Mar 14, 2024
02d6f7c
Add AEP example
paulf81 Mar 14, 2024
3b2e3b2
Delete old AEP example
paulf81 Mar 14, 2024
707ca5a
Ensure consistency with previous result
paulf81 Mar 14, 2024
b28d925
Add sweeping example
paulf81 Mar 14, 2024
fc807ea
Remove old sweeping examples
paulf81 Mar 14, 2024
e4b10b3
Clean out old examples
paulf81 Mar 14, 2024
143d10d
Add uncertain model example
paulf81 Mar 14, 2024
0b57641
Start wind data sub folder
paulf81 Mar 14, 2024
4b2b3f5
re-org yaw opt cases
paulf81 Mar 15, 2024
6eec5a4
first yaw opt example
paulf81 Mar 15, 2024
ffe783a
Add core property and bugfix
paulf81 Mar 15, 2024
9067920
Add 002 example optimization
paulf81 Mar 15, 2024
e88b41b
formatting
paulf81 Mar 15, 2024
7ded17b
formatting
paulf81 Mar 15, 2024
cc98379
formatting
paulf81 Mar 15, 2024
0c555b5
Move to subfolder
paulf81 Mar 15, 2024
9f31899
move files
paulf81 Mar 15, 2024
ad58dcb
Rename folder
paulf81 Mar 17, 2024
a3b9c2d
Update wind data examples
paulf81 Mar 17, 2024
77ba563
add het examples
paulf81 Mar 17, 2024
2f149f1
Add example 3
paulf81 Mar 18, 2024
e443f30
Add place holder
paulf81 Mar 18, 2024
51abc6d
sort into subfolders
paulf81 Mar 18, 2024
00b4a31
sort into subfolder
paulf81 Mar 18, 2024
aa3b481
Add details
paulf81 Mar 18, 2024
5a08977
Add example 001
paulf81 Mar 18, 2024
1f01efa
typos
paulf81 Mar 18, 2024
aa6fbf0
Remove reference to n_tindex
paulf81 Mar 18, 2024
b1165e7
Add example 3
paulf81 Mar 18, 2024
31a27c4
Start redoing 004
paulf81 Mar 18, 2024
dcc2af1
04 not done
paulf81 Mar 18, 2024
9f67d80
Merge branch 'v4' into refactor_examples
paulf81 Mar 20, 2024
63b47c8
Use set power thrust function in examples
paulf81 Mar 20, 2024
92eef3e
Remove unused imports
paulf81 Mar 20, 2024
23c7ee0
Spelling heterogeneous
paulf81 Mar 20, 2024
4d5524b
Add place holder examples
paulf81 Mar 20, 2024
2089c2d
Merge branch 'v4' into refactor_examples
paulf81 Mar 22, 2024
66f2991
Spelling
paulf81 Mar 22, 2024
99184f6
update toWindRose
paulf81 Mar 22, 2024
ae48bd1
Update function
paulf81 Mar 22, 2024
a7da89e
Update style
paulf81 Mar 22, 2024
341ce7e
Update 003 example
paulf81 Mar 22, 2024
b732894
Update example 004
paulf81 Mar 22, 2024
b2762ee
Update 005
paulf81 Mar 22, 2024
2709b23
Update example 006
paulf81 Mar 22, 2024
9216780
Update example 006
paulf81 Mar 22, 2024
c36eb52
Update example 07 and 007
paulf81 Mar 22, 2024
504ea91
Organize examples
paulf81 Mar 22, 2024
ab10b6a
Update first layout
paulf81 Mar 22, 2024
e2213fe
Merge branch 'v4' into refactor_examples
paulf81 Apr 1, 2024
867b203
move 09 to het examples
paulf81 Apr 1, 2024
df55880
Add optimize example 4
paulf81 Apr 1, 2024
8bade8b
small fixes
paulf81 Apr 1, 2024
2d895fd
Push up broken 005 example
paulf81 Apr 1, 2024
ba6e06b
Bugfix for uneven splits.
misi9170 Apr 2, 2024
1b817a1
Update examples 4 and 5
paulf81 Apr 2, 2024
631e282
Update example 6
paulf81 Apr 2, 2024
3533555
Remove old examples
paulf81 Apr 2, 2024
8c1bc1a
Merge branch 'v4' into refactor_examples
paulf81 Apr 2, 2024
d9146b7
bugfix
paulf81 Apr 2, 2024
8b536ef
Update derating example
paulf81 Apr 2, 2024
6ffc40a
Add 001 example
paulf81 Apr 2, 2024
1d19145
Add 002 example
paulf81 Apr 2, 2024
b574c29
Small bugfix
paulf81 Apr 2, 2024
3c68038
bugfix
paulf81 Apr 2, 2024
e7389d1
Update emgauss examples
paulf81 Apr 2, 2024
f4a3b7d
Update floating examples
paulf81 Apr 2, 2024
9c55655
Update get flow examples
paulf81 Apr 2, 2024
3b3ab91
Update 09 example
paulf81 Apr 2, 2024
a6e8de9
Update layout examples
paulf81 Apr 2, 2024
8edc0c6
Update multidim examples
paulf81 Apr 2, 2024
953c234
Update turbine examples
paulf81 Apr 2, 2024
d19b05f
bugfix
paulf81 Apr 2, 2024
a8c6599
Convert parallel model to nansum
paulf81 Apr 2, 2024
9b9a4a2
add ws/wd/ti/n_findex properties
paulf81 Apr 2, 2024
7d43654
Clean up 004
paulf81 Apr 2, 2024
01e4479
Clean up 005
paulf81 Apr 2, 2024
274de8d
Use property
paulf81 Apr 2, 2024
275c63f
use property
paulf81 Apr 2, 2024
840eb24
Update example 7
paulf81 Apr 3, 2024
12e4f7e
add n_turbines property
paulf81 Apr 3, 2024
b6bce5e
Add properties to uncertain model
paulf81 Apr 3, 2024
065834b
Use the properties
paulf81 Apr 3, 2024
3555f9e
Update ci to run examples in subdirectories
paulf81 Apr 3, 2024
a907a2b
Update example ci
paulf81 Apr 3, 2024
f01f4ce
bugfix
paulf81 Apr 3, 2024
298338e
bugfix
paulf81 Apr 3, 2024
1a0edee
bugfix
paulf81 Apr 3, 2024
1d815d1
remove seaborn
paulf81 Apr 3, 2024
ca43d05
switch to parallel running of examples
paulf81 Apr 3, 2024
eeddb30
back to serial
paulf81 Apr 3, 2024
c3f8ec5
bugfix
paulf81 Apr 3, 2024
9b38cdd
fix deprecated pyplot code
paulf81 Apr 3, 2024
f50ca53
rename 007
paulf81 Apr 4, 2024
30b3d6a
Add comments
paulf81 Apr 4, 2024
0441150
Fix printout
paulf81 Apr 4, 2024
787ef82
format
paulf81 Apr 4, 2024
c721b4a
fix file names
paulf81 Apr 4, 2024
df63f14
fix file names
paulf81 Apr 4, 2024
6e4ba62
Merge branch 'refactor_examples' of github.com:paulf81/floris into re…
paulf81 Apr 4, 2024
4e0a2ed
Remove empty approx example
paulf81 Apr 4, 2024
545fbd3
Improve docstrings
paulf81 Apr 4, 2024
5ec20ab
Add number
paulf81 Apr 4, 2024
80aa760
Merge branch 'v4' into refactor_examples
paulf81 Apr 4, 2024
7b2ca09
Roughly draft in merge and reduce functions
paulf81 Apr 4, 2024
4fcf9a4
Switch to a static function and remove reduce function
paulf81 Apr 5, 2024
e395e83
Merge branch 'v4' into feature/add_merge_floris
paulf81 Apr 5, 2024
c8e7c9d
Merge branch 'v4' into feature/add_merge_floris
paulf81 Apr 6, 2024
fc4079b
bugfix
paulf81 Apr 6, 2024
d127c70
fi -> fmodel; add reset_operatio().
misi9170 Apr 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions floris/floris_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1722,3 +1722,72 @@ def reinitialize(self, **_):
"The reinitialize method has been removed. Please use the set method. "
"See https://nrel.github.io/floris/upgrade_guides/v3_to_v4.html for more information."
)


@staticmethod
def merge_floris_models(fmodel_list, reference_wind_height=None):
"""Merge a list of FlorisModel objects into a single FlorisModel object. Note that it uses
the very first object specified in fmodel_list to build upon,
so it uses those wake model parameters, air density, and so on.

Args:
fmodel_list (list): Array-like of FlorisModel objects.
reference_wind_height (float, optional): Height in meters
at which the reference wind speed is assigned. If None, will assume
this value is equal to the reference wind height specified in the FlorisModel
objects. This only works if all objects have the same value
for their reference_wind_height.

Returns:
fmodel_merged (FlorisModel): The merged FlorisModel object,
merged in the same order as fmodel_list. The objects are merged
on the turbine locations and turbine types, but not on the wake parameters
or general solver settings.
"""

if not isinstance(fmodel_list[0], FlorisModel):
raise ValueError(
"Incompatible input specified. fmodel_list must be a list of FlorisModel objects."
)

# Get the turbine locations and specifications for each subset and save as a list
x_list = []
y_list = []
turbine_type_list = []
reference_wind_heights = []
for fmodel in fmodel_list:
# Remove any control setpoints that might be specified for the turbines on one fmodel
fmodel.reset_operation()

x_list.extend(fmodel.layout_x)
y_list.extend(fmodel.layout_y)

fmodel_turbine_type = fmodel.core.farm.turbine_type
if len(fmodel_turbine_type) == 1:
fmodel_turbine_type = fmodel_turbine_type * len(fmodel.layout_x)
elif not len(fmodel_turbine_type) == len(fmodel.layout_x):
raise ValueError("Incompatible format of turbine_type in fmodel.")

turbine_type_list.extend(fmodel_turbine_type)
reference_wind_heights.append(fmodel.core.flow_field.reference_wind_height)

# Derive reference wind height, if unspecified by the user
if reference_wind_height is None:
reference_wind_height = np.mean(reference_wind_heights)
if np.any(np.abs(np.array(reference_wind_heights) - reference_wind_height) > 1.0e-3):
raise ValueError(
"Cannot automatically derive a fitting reference_wind_height since they "
"substantially differ between FlorisModel objects. "
"Please specify 'reference_wind_height' manually."
)

# Construct the merged FLORIS model based on the first entry in fmodel_list
fmodel_merged = fmodel_list[0].copy()
fmodel_merged.set(
layout_x=x_list,
layout_y=y_list,
turbine_type=turbine_type_list,
reference_wind_height=reference_wind_height,
)

return fmodel_merged
Loading