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
59bd9e38
Commit
59bd9e38
authored
7 months ago
by
Rasmus Sode Lund
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: Add handling of periodicity in the projected_extremes() routine
parent
dae19d5f
No related branches found
No related tags found
1 merge request
!276
Bugfix: Add handling of periodicity in the projected_extremes() routine
Pipeline
#62257
passed
7 months ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/utils/envelope.py
+28
-16
28 additions, 16 deletions
wetb/utils/envelope.py
with
28 additions
and
16 deletions
wetb/utils/envelope.py
+
28
−
16
View file @
59bd9e38
...
...
@@ -349,31 +349,43 @@ def projected_extremes(
extremes
=
np
.
zeros
(
shape
=
(
len
(
angles
),
3
))
# rearrange angles to (-pi; pi]
angles
[
angles
>
180
]
-=
360
angles
[
angles
>
np
.
pi
]
-=
2
*
np
.
pi
angles
[
angles
<=
-
np
.
pi
]
+=
2
*
np
.
pi
# Calculate the angle of the signal in the time-series
signal_angles
=
np
.
a
rctan2
(
signal
[:,
1
],
signal
[:,
0
])
signal_angles
=
np
.
a
ngle
(
signal
[:,
0
]
+
1j
*
signal
[:,
1
])
for
index
,
angle
in
enumerate
(
angles
):
# Project signal into the desired angle, saving only the first component of the 2D load for extremes analysis
projected_signal
=
signal
@
projection_2d
(
angle
,
degrees
=
False
)
if
sweep_angle
:
# Remove the loads not covered by the main angle +/- the sweep angle
projected_signal
=
(
projected_signal
*
(
signal_angles
>
(
angle
-
sweep_angle
))
*
(
signal_angles
<
(
angle
+
sweep_angle
))
)
if
all
(
(
signal_angles
>
(
angle
-
sweep_angle
))
*
(
signal_angles
<
(
angle
+
sweep_angle
))
==
False
):
# If no loads exist within the swept area, set idx to nan, and value to 0
idx
=
np
.
nan
val
=
0
else
:
lower_bound
=
angle
-
sweep_angle
if
lower_bound
<-
np
.
pi
:
lower_bound
+=
2
*
np
.
pi
upper_bound
=
angle
+
sweep_angle
if
upper_bound
>
np
.
pi
:
upper_bound
-=
2
*
np
.
pi
if
upper_bound
>
lower_bound
:
# If lower bound is below upper bound, and the range is thus monotone, use the intersection of angles above lower- and below upper bound.
projected_signal
=
(
projected_signal
*
(
signal_angles
>
lower_bound
)
*
(
signal_angles
<
upper_bound
)
)
else
:
# If lower bound is above upper bound, use the union of angles above lower- and below upper bounds.
projected_signal
=
(
projected_signal
*
(
signal_angles
>
lower_bound
)
+
projected_signal
*
(
signal_angles
<
upper_bound
)
)
if
(
projected_signal
.
any
())
==
True
:
# Save the larges projected load that satisfies the angle+sweep criteria
idx
=
np
.
argmax
(
projected_signal
)
val
=
projected_signal
[
idx
]
else
:
# If no loads exist within the swept area, set idx to nan, and value to 0
idx
=
np
.
nan
val
=
0
else
:
# If no sweep angle is defined, simply get the maximum value of the projected vector
idx
=
np
.
argmax
(
projected_signal
)
...
...
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