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
3096c13d
Commit
3096c13d
authored
7 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
aep_calculator.py and wind_resource.py now working
parent
baaff94c
No related branches found
No related tags found
1 merge request
!94
Handle disabled mpi
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
topfarm/cost_models/utils/aep_calculator.py
+30
-7
30 additions, 7 deletions
topfarm/cost_models/utils/aep_calculator.py
topfarm/cost_models/utils/wind_resource.py
+23
-11
23 additions, 11 deletions
topfarm/cost_models/utils/wind_resource.py
with
53 additions
and
18 deletions
topfarm/cost_models/utils/aep_calculator.py
+
30
−
7
View file @
3096c13d
...
@@ -3,18 +3,41 @@ Created on 19/04/2018
...
@@ -3,18 +3,41 @@ Created on 19/04/2018
@author: Mads
@author: Mads
'''
'''
import
os
from
fusedwake
import
fusedwake
import
numpy
as
np
import
numpy
as
np
from
topfarm.cost_models.fused_wake_wrappers
import
FusedWakeGCLWakeModel
from
topfarm.cost_models.utils.wind_resource
import
WindResource
class
AEPCalculator
(
object
):
class
AEPCalculator
(
object
):
def
__init__
(
self
,
wdir
=
np
.
arange
(
360
),
wsp
=
np
.
arange
(
3
,
25
),
wind_resource
,
wake_model
):
def
__init__
(
self
,
wind_resource
,
wake_model
,
wdir
=
np
.
arange
(
360
),
wsp
=
np
.
arange
(
3
,
25
)):
self
.
wdir
=
wdir
"""
self
.
wsp
=
wsp
wind_resource: f(turbine_positions, wdir, wsp) -> WS[nWT,nWdir,nWsp], TI[nWT,nWdir,nWsp), Weight[nWdir,nWsp]
wake_model: f(turbine_positions, WS[nWT,nWdir,nWsp], TI[nWT,nWdir,nWsp) -> power[nWdir,nWsp]
"""
self
.
wind_resource
=
wind_resource
self
.
wind_resource
=
wind_resource
self
.
wake_model
=
wake_model
self
.
wake_model
=
wake_model
self
.
wdir
=
wdir
self
.
wsp
=
wsp
def
calculate_aep
(
self
,
turbine_positions
):
def
__call__
(
self
,
turbine_positions
):
no_wake_wsp
,
no_wake_ti
,
weight
=
self
.
wind_resource
(
turbine_positions
,
self
.
wdir
,
self
.
wsp
)
no_wake_WD
,
no_wake_WS
,
no_wake_TI
,
weight
=
self
.
wind_resource
(
turbine_positions
,
self
.
wdir
,
self
.
wsp
)
wake_wsp
,
power
,
ct
=
self
.
wake_model
(
turbine_positions
,
no_wake_wsp
,
no_wake_ti
)
power_GW
=
self
.
wake_model
(
turbine_positions
,
no_wake_WD
,
no_wake_WS
,
no_wake_TI
)
/
1e9
return
np
.
sum
(
power
*
weight
)
*
24
*
365
return
np
.
sum
(
power_GW
*
weight
)
*
24
*
365
if
__name__
==
'
__main__
'
:
f
=
np
.
array
(
"
3.597152 3.948682 5.167395 7.000154 8.364547 6.43485 8.643194 11.77051 15.15757 14.73792 10.01205 5.165975
"
.
split
(),
dtype
=
np
.
float
)
A
=
np
.
array
(
"
9.176929 9.782334 9.531809 9.909545 10.04269 9.593921 9.584007 10.51499 11.39895 11.68746 11.63732 10.08803
"
.
split
(),
dtype
=
np
.
float
)
k
=
np
.
array
(
"
2.392578 2.447266 2.412109 2.591797 2.755859 2.595703 2.583984 2.548828 2.470703 2.607422 2.626953 2.326172
"
.
split
(),
dtype
=
np
.
float
)
wr
=
WindResource
(
f
/
100
,
A
,
k
,
ti
=
np
.
zeros_like
(
f
)
+
.
1
)
hornsrev_yml
=
os
.
path
.
dirname
(
fusedwake
.
__file__
)
+
"
/../examples/hornsrev.yml
"
hornsrev_yml_2tb
=
"
../../example_data/hornsrev_2tb.yml
"
wm
=
FusedWakeGCLWakeModel
(
hornsrev_yml_2tb
)
aep_calc
=
AEPCalculator
(
wr
,
wm
)
print
(
aep_calc
(
wm
.
wf
.
pos
))
This diff is collapsed.
Click to expand it.
topfarm/cost_models/utils/wind_resource.py
+
23
−
11
View file @
3096c13d
...
@@ -8,18 +8,30 @@ import numpy as np
...
@@ -8,18 +8,30 @@ import numpy as np
class
WindResource
(
object
):
class
WindResource
(
object
):
def
__init__
(
self
,
f
,
a
,
k
,
ti
):
def
__init__
(
self
,
f
,
a
,
k
,
ti
):
self
.
f
=
f
wdir
=
np
.
linspace
(
0
,
360
,
len
(
f
),
endpoint
=
False
)
self
.
a
=
a
indexes
=
np
.
argmin
((
np
.
broadcast_to
(
np
.
arange
(
360
),
(
len
(
f
),
360
)).
T
-
wdir
)
%
360
,
1
)
self
.
k
=
k
self
.
f
=
f
[
indexes
]
/
(
360
/
len
(
f
))
self
.
ti
=
ti
self
.
a
=
a
[
indexes
]
self
.
k
=
k
[
indexes
]
self
.
ti
=
ti
[
indexes
]
def
weibull_weight
(
self
,
ws
):
def
weibull_weight
(
self
,
WS
,
A
,
k
):
cdf
=
lambda
ws
,
A
=
self
.
A
,
k
=
self
.
k
:
1
-
np
.
exp
(
-
(
ws
/
A
)
**
k
)
cdf
=
lambda
ws
,
A
=
A
,
k
=
k
:
1
-
np
.
exp
(
-
(
ws
/
A
)
**
k
)
d
ws
=
np
.
diff
(
ws
,
0
)
/
2
d
WS
=
np
.
diff
(
WS
[:
2
],
1
,
0
)
/
2
return
cdf
(
ws
+
d
ws
)
-
cdf
(
ws
-
d
ws
)
return
cdf
(
WS
+
d
WS
)
-
cdf
(
WS
-
d
WS
)
def
__call__
(
self
,
turbine_positions
,
wdir
,
wsp
):
def
__call__
(
self
,
turbine_positions
,
wdir
,
wsp
):
# f(turbine_positions, wdir, wsp) -> WS[nWT,nWdir,nWsp], TI[nWT,nWdir,nWsp), Weight[nWdir,nWsp]
WD
,
WS
=
np
.
meshgrid
(
wdir
,
wsp
)
weight
=
self
.
weibull_weight
(
WS
,
self
.
a
[
WD
],
self
.
k
[
WD
])
*
self
.
f
[
wdir
]
return
WD
,
WS
,
self
.
ti
[
WD
],
weight
WS
=
np
.
broadcast_to
(
wsp
,
(
len
(
turbine_positions
),
len
(
wdir
),
len
(
wsp
)))
weight
=
self
.
weibull_weight
(
self
.
a
,
self
.
k
,
WS
)
*
self
.
f
if
__name__
==
'
__main__
'
:
return
WS
,
np
.
zeros_like
(
WS
)
+
self
.
ti
,
weight
f
=
np
.
array
(
"
3.597152 3.948682 5.167395 7.000154 8.364547 6.43485 8.643194 11.77051 15.15757 14.73792 10.01205 5.165975
"
.
split
(),
dtype
=
np
.
float
)
A
=
np
.
array
(
"
9.176929 9.782334 9.531809 9.909545 10.04269 9.593921 9.584007 10.51499 11.39895 11.68746 11.63732 10.08803
"
.
split
(),
dtype
=
np
.
float
)
k
=
np
.
array
(
"
2.392578 2.447266 2.412109 2.591797 2.755859 2.595703 2.583984 2.548828 2.470703 2.607422 2.626953 2.326172
"
.
split
(),
dtype
=
np
.
float
)
ti
=
np
.
zeros_like
(
f
)
+
.
1
wr
=
WindResource
(
f
,
A
,
k
,
ti
)
print
(
wr
((
0
,
0
),
[
0
,
30
,
60
],
[
4
,
5
]))
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