Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TopFarm2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TOPFARM
TopFarm2
Commits
e0289474
Commit
e0289474
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
read wind climate from lib file for gcl to be consistent with fuga
parent
1017769b
No related branches found
No related tags found
1 merge request
!94
Handle disabled mpi
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/irp_wind/optimization_3tb.py
+35
-11
35 additions, 11 deletions
examples/irp_wind/optimization_3tb.py
with
35 additions
and
11 deletions
examples/irp_wind/optimization_3tb.py
+
35
−
11
View file @
e0289474
...
...
@@ -7,50 +7,74 @@ from topfarm.cost_models.utils.aep_calculator import AEPCalculator
from
topfarm.cost_models.utils.wind_resource
import
WindResource
from
topfarm.plotting
import
PlotComp
from
topfarm.topfarm
import
TopFarm
from
topfarm.cost_models.fuga.lib_reader
import
read_lib
import
matplotlib.pyplot
as
plt
D
=
80.0
D2
=
2
*
D
initial_position
=
np
.
array
([(
0
,
D2
),
(
0
,
0
),
(
0
,
-
D2
)])
boundary
=
[(
-
D2
,
D2
),
(
D2
,
D2
),
(
D2
,
-
D2
),
(
-
D2
,
-
D2
)]
minSpacing
=
2.0
fuga_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
py_fuga
.
__file__
))
+
'
/Colonel/
'
def
optimize_AEP_FusedWake_GCL
():
plot_comp
=
PlotComp
()
f
=
[
1
,
0
,
0
,
0
]
A
=
[
9.176929
,
9.782334
,
9.531809
,
9.909545
]
k
=
[
2.392578
,
2.447266
,
2.412109
,
2.591797
]
f
,
A
,
k
=
read_lib
(
fuga_path
+
'
LUT/Farms/Horns Rev 1\hornsrev_north_only_pm45.lib
'
)
wr
=
WindResource
(
f
,
A
,
k
,
ti
=
np
.
zeros_like
(
f
)
+
.
1
)
wm
=
FusedWakeGCLWakeModel
(
os
.
path
.
dirname
(
__file__
)
+
"
/3tb.yml
"
)
aep_calc
=
AEPCalculator
(
wr
,
wm
)
aep_calc
(
np
.
array
([[
0
,
0
,
100
],
[
160
,
0
,
-
160
]]).
T
)
init_pos
=
initial_position
.
copy
()
init_pos
[:,
0
]
+=
[
-
50
,
0
,
50
]
print
(
aep_calc
(
np
.
array
([[
-
160
,
0
,
160
],
[
0
,
0
,
0
]]).
T
))
init_pos
[:,
0
]
+=
[
-
20
,
0
,
20
]
tf
=
TopFarm
(
init_pos
,
aep_calc
.
get_TopFarm_cost_component
(),
minSpacing
*
D
,
boundary
=
boundary
,
plot_comp
=
plot_comp
)
tf
.
evaluate
()
print
(
tf
.
get_cost
())
tf
.
optimize
()
print
(
tf
.
get_cost
())
save_plot
(
'
final_gcl.png
'
,
tf
,
False
)
plot_comp
.
show
()
def
optimize_AEP_Fuga
():
plot_comp
=
PlotComp
()
fuga_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
py_fuga
.
__file__
))
+
'
/Colonel/
'
pyFuga
=
PyFuga
(
farm_name
=
'
Horns Rev 1
'
,
turbine_model_path
=
fuga_path
+
'
LUT/
'
,
turbine_model_name
=
'
Vestas_V80_(2_MW_offshore)[h=67.00]
'
,
tb_x
=
initial_position
[:,
0
],
tb_y
=
initial_position
[:,
1
],
mast_position
=
(
0
,
0
,
70
),
z0
=
0.0001
,
zi
=
400
,
zeta0
=
0
,
farms_dir
=
fuga_path
+
'
LUT/Farms/
'
,
wind_atlas_path
=
'
Horns Rev 1\hornsrev_north_only
.lib
'
)
farms_dir
=
fuga_path
+
'
LUT/Farms/
'
,
wind_atlas_path
=
'
Horns Rev 1\hornsrev_north_only
_pm45.lib
'
,
climate_interpolation
=
False
)
init_pos
=
initial_position
.
copy
()
init_pos
[:,
0
]
+=
[
-
20
,
0
,
20
]
tf
=
TopFarm
(
init_pos
,
pyFuga
.
get_TopFarm_cost_component
(),
minSpacing
*
D
,
boundary
=
boundary
,
plot_comp
=
plot_comp
)
save_plot
(
'
initial.png
'
,
tf
,
True
)
tf
.
evaluate
()
print
(
tf
.
get_cost
())
tf
.
optimize
()
print
(
tf
.
get_cost
())
save_plot
(
'
final_fuga.png
'
,
tf
,
False
)
plot_comp
.
show
()
def
save_plot
(
filename
,
tf
,
initial
=
False
):
import
matplotlib.pyplot
as
plt
plt
.
figure
(
figsize
=
(
3
,
3
))
plt
.
axis
(
'
equal
'
)
plt
.
xlabel
(
'
Distance [m]
'
)
plt
.
ylabel
(
'
Distance [m]
'
)
if
initial
:
pos
=
tf
.
initial_positions
else
:
pos
=
tf
.
turbine_positions
plt
.
plot
(
tf
.
boundary
[:,
0
],
tf
.
boundary
[:,
1
],
label
=
'
Boundary
'
)
plt
.
plot
(
pos
[:,
0
],
pos
[:,
1
],
'
2
'
,
ms
=
15
,
label
=
'
%s turbine positions
'
%
(
'
Optimized
'
,
'
initial
'
)[
initial
])
# plt.legend(loc=1)
plt
.
tight_layout
()
plt
.
savefig
(
filename
)
plt
.
show
()
if
__name__
==
'
__main__
'
:
optimize_AEP_Fuga
()
optimize_AEP_FusedWake_GCL
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment