Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
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
wtlib
WindEnergyToolbox
Commits
602c8b2e
Commit
602c8b2e
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
implemented Weibull_IEC
parent
4d8959bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/dlc/high_level.py
+31
-1
31 additions, 1 deletion
wetb/dlc/high_level.py
wetb/dlc/tests/test_high_level.py
+5
-2
5 additions, 2 deletions
wetb/dlc/tests/test_high_level.py
with
36 additions
and
3 deletions
wetb/dlc/high_level.py
+
31
−
1
View file @
602c8b2e
...
...
@@ -44,6 +44,36 @@ def Weibull2(u, k, wsp_lst):
edges
=
np
.
r_
[
wsp_lst
[
0
]
-
(
wsp_lst
[
1
]
-
wsp_lst
[
0
])
/
2
,
(
wsp_lst
[
1
:]
+
wsp_lst
[:
-
1
])
/
2
,
wsp_lst
[
-
1
]
+
(
wsp_lst
[
-
1
]
-
wsp_lst
[
-
2
])
/
2
]
return
[
-
cdf
(
e1
)
+
cdf
(
e2
)
for
wsp
,
e1
,
e2
in
zip
(
wsp_lst
,
edges
[:
-
1
],
edges
[
1
:])]
def
Weibull_IEC
(
Vref
,
Vhub_lst
):
"""
Weibull distribution according to IEC 61400-1:2005, page 24
Parameters
----------
Vref : int or float
Vref of wind turbine class
Vhub_lst : array_like
Wind speed at hub height. Must be equally spaced.
Returns
-------
nd_array : list of probabilities
Examples
--------
>>>
Weibull_IEC
(
50
,
[
4
,
6
,
8
])
[
0.11002961
0.14116891
0.15124155
]
"""
Vhub_lst
=
np
.
array
(
Vhub_lst
)
#Average wind speed
Vave
=
.
2
*
Vref
#Rayleigh distribution
Pr
=
lambda
x
:
1
-
np
.
exp
(
-
np
.
pi
*
(
x
/
(
2
*
Vave
))
**
2
)
#Wsp bin edges: [4,6,8] -> [3,5,7,9]
wsp_bin_edges
=
np
.
r_
[
Vhub_lst
[
0
]
-
(
Vhub_lst
[
1
]
-
Vhub_lst
[
0
])
/
2
,
(
Vhub_lst
[
1
:]
+
Vhub_lst
[:
-
1
])
/
2
,
Vhub_lst
[
-
1
]
+
(
Vhub_lst
[
-
1
]
-
Vhub_lst
[
-
2
])
/
2
]
#probabilities of 3-5, 5-7, 7-9
return
np
.
array
([
-
Pr
(
e1
)
+
Pr
(
e2
)
for
e1
,
e2
in
zip
(
wsp_bin_edges
[:
-
1
],
wsp_bin_edges
[
1
:])])
class
DLCHighLevel
(
object
):
...
...
@@ -159,7 +189,7 @@ class DLCHighLevel(object):
dist
=
self
.
dlc_df
[
dist_key
][
row
]
if
str
(
dist
).
lower
()
==
"
weibull
"
or
str
(
dist
).
lower
()
==
"
rayleigh
"
:
dist
=
Weibull
2
(
self
.
vref
*
.
2
,
self
.
shape_k
,
values
)
dist
=
Weibull
_IEC
(
self
.
vref
,
values
)
else
:
def
fmt
(
v
):
if
"
#
"
in
str
(
v
):
...
...
This diff is collapsed.
Click to expand it.
wetb/dlc/tests/test_high_level.py
+
5
−
2
View file @
602c8b2e
...
...
@@ -10,7 +10,7 @@ from __future__ import absolute_import
from
future
import
standard_library
standard_library
.
install_aliases
()
import
unittest
from
wetb.dlc.high_level
import
DLCHighLevel
,
Weibull
from
wetb.dlc.high_level
import
DLCHighLevel
,
Weibull
,
Weibull_IEC
import
os
import
numpy
as
np
...
...
@@ -109,7 +109,10 @@ class TestDLCHighLevel(unittest.TestCase):
p_tot
=
np
.
array
([
value
for
key
,
value
in
weibull
.
items
()]).
sum
()
self
.
assertTrue
(
np
.
allclose
(
p_tot
,
1.0
))
def
test_weibull_IEC
(
self
):
Vref
=
50
np
.
testing
.
assert_array_almost_equal
(
Weibull_IEC
(
Vref
,
[
4
,
6
,
8
]),
[
0.11002961
,
0.14116891
,
0.15124155
])
if
__name__
==
"
__main__
"
:
#import sys;sys.argv = ['', 'Test.testName']
...
...
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