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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
toolbox
WindEnergyToolbox
Commits
27fd2915
There was a problem fetching the pipeline summary.
Commit
27fd2915
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.windenergy.dtu.dk:toolbox/WindEnergyToolbox
parents
96bf3d35
8003cc91
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CONTRIBUTING.md
+17
-0
17 additions, 0 deletions
CONTRIBUTING.md
wetb/fatigue_tools/tests/test_fatigue.py
+32
-2
32 additions, 2 deletions
wetb/fatigue_tools/tests/test_fatigue.py
wetb/prepost/tests/test_Simulations.py
+0
-31
0 additions, 31 deletions
wetb/prepost/tests/test_Simulations.py
with
49 additions
and
33 deletions
CONTRIBUTING.md
0 → 100644
+
17
−
0
View file @
27fd2915
Contributions
-------------
If you make a change in the toolbox, that others can benefit from please make a merge request.
If you can, please submit a merge request with the fix or improvements including tests.
The workflow to make a merge request is as follows:
-Create a feature branch, branch away from master
-Write tests and code
-Push the commit(s) to your fork
-Submit a merge request (MR) to the master branch of
-Link any relevant issues in the merge request description and leave a comment on them with a link back to the MR
-Your tests should run as fast as possible, and if it uses test files, these files should be as small as possible.
-Please keep the change in a single MR as small as possible. Split the functionality if you can
\ No newline at end of file
This diff is collapsed.
Click to expand it.
wetb/fatigue_tools/tests/test_fatigue.py
+
32
−
2
View file @
27fd2915
...
...
@@ -23,6 +23,36 @@ testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test fi
class
TestFatigueTools
(
unittest
.
TestCase
):
def
test_leq_1hz
(
self
):
"""
Simple test of wetb.fatigue_tools.fatigue.eq_load using a sine
signal.
"""
amplitude
=
1
m
=
1
point_per_deg
=
100
# sine signal with 10 periods (20 peaks)
nr_periods
=
10
time
=
np
.
linspace
(
0
,
nr_periods
*
2
*
np
.
pi
,
point_per_deg
*
180
)
neq
=
time
[
-
1
]
# mean value of the signal shouldn't matter
signal
=
amplitude
*
np
.
sin
(
time
)
+
5
r_eq_1hz
=
eq_load
(
signal
,
no_bins
=
1
,
m
=
m
,
neq
=
neq
)[
0
]
r_eq_1hz_expected
=
((
2
*
nr_periods
*
amplitude
**
m
)
/
neq
)
**
(
1
/
m
)
np
.
testing
.
assert_allclose
(
r_eq_1hz
,
r_eq_1hz_expected
)
# sine signal with 20 periods (40 peaks)
nr_periods
=
20
time
=
np
.
linspace
(
0
,
nr_periods
*
2
*
np
.
pi
,
point_per_deg
*
180
)
neq
=
time
[
-
1
]
# mean value of the signal shouldn't matter
signal
=
amplitude
*
np
.
sin
(
time
)
+
9
r_eq_1hz2
=
eq_load
(
signal
,
no_bins
=
1
,
m
=
m
,
neq
=
neq
)[
0
]
r_eq_1hz_expected2
=
((
2
*
nr_periods
*
amplitude
**
m
)
/
neq
)
**
(
1
/
m
)
np
.
testing
.
assert_allclose
(
r_eq_1hz2
,
r_eq_1hz_expected2
)
# 1hz equivalent load should be independent of the length of the signal
np
.
testing
.
assert_allclose
(
r_eq_1hz
,
r_eq_1hz2
)
def
test_astm1
(
self
):
...
...
@@ -59,7 +89,7 @@ class TestFatigueTools(unittest.TestCase):
# def test_windap3(self):
# data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary([2]).flatten()
# from wetb.fatigue_tools.rainflowcounting import peak_trough
# self.assertTrue(peak_trough.__file__.lower()[-4:] == ".pyd" or peak_trough.__file__.lower()[-3:] == ".so",
# self.assertTrue(peak_trough.__file__.lower()[-4:] == ".pyd" or peak_trough.__file__.lower()[-3:] == ".so",
# "not compiled, %s, %s\n%s"%(sys.executable, peak_trough.__file__, os.listdir(os.path.dirname(peak_trough.__file__))))
# np.testing.assert_array_equal(cycle_matrix(data, 4, 4, rainflow_func=rainflow_windap)[0], np.array([[ 14., 65., 39., 24.],
# [ 0., 1., 4., 0.],
...
...
@@ -73,7 +103,7 @@ class TestFatigueTools(unittest.TestCase):
[
0.
,
1.
,
4.
,
0.
],
[
0.
,
0.
,
0.
,
0.
],
[
0.
,
1.
,
2.
,
0.
]])
/
2
,
0.001
)
def
test_astm_weighted
(
self
):
data
=
Hawc2io
.
ReadHawc2
(
testfilepath
+
"
test
"
).
ReadBinary
([
2
]).
flatten
()
np
.
testing
.
assert_allclose
(
cycle_matrix
([(
1
,
data
),(
1
,
data
)],
4
,
4
,
rainflow_func
=
rainflow_astm
)[
0
],
np
.
array
([[
24.
,
83.
,
53.
,
26.
],
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/tests/test_Simulations.py
+
0
−
31
View file @
27fd2915
...
...
@@ -83,37 +83,6 @@ class TestGenerateInputs(Template):
class
TestFatigueLifetime
(
Template
):
def
test_leq_1hz
(
self
):
"""
Simple test of wetb.fatigue_tools.fatigue.eq_load using a sine
signal.
"""
amplitude
=
1
m
=
1
point_per_deg
=
100
# sine signal with 10 periods (20 peaks)
nr_periods
=
10
time
=
np
.
linspace
(
0
,
nr_periods
*
2
*
np
.
pi
,
point_per_deg
*
180
)
neq
=
time
[
-
1
]
# mean value of the signal shouldn't matter
signal
=
amplitude
*
np
.
sin
(
time
)
+
5
r_eq_1hz
=
eq_load
(
signal
,
no_bins
=
1
,
m
=
m
,
neq
=
neq
)[
0
]
r_eq_1hz_expected
=
((
2
*
nr_periods
*
amplitude
**
m
)
/
neq
)
**
(
1
/
m
)
np
.
testing
.
assert_allclose
(
r_eq_1hz
,
r_eq_1hz_expected
)
# sine signal with 20 periods (40 peaks)
nr_periods
=
20
time
=
np
.
linspace
(
0
,
nr_periods
*
2
*
np
.
pi
,
point_per_deg
*
180
)
neq
=
time
[
-
1
]
# mean value of the signal shouldn't matter
signal
=
amplitude
*
np
.
sin
(
time
)
+
9
r_eq_1hz2
=
eq_load
(
signal
,
no_bins
=
1
,
m
=
m
,
neq
=
neq
)[
0
]
r_eq_1hz_expected2
=
((
2
*
nr_periods
*
amplitude
**
m
)
/
neq
)
**
(
1
/
m
)
np
.
testing
.
assert_allclose
(
r_eq_1hz2
,
r_eq_1hz_expected2
)
# 1hz equivalent load should be independent of the length of the signal
np
.
testing
.
assert_allclose
(
r_eq_1hz
,
r_eq_1hz2
)
def
test_leq_life
(
self
):
"""
Verify if prepost.Simulation.Cases.fatigue_lifetime() returns
the expected life time equivalent load.
...
...
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