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
46ca5177
Commit
46ca5177
authored
6 years ago
by
Mikkel Friis-Møller
Committed by
Mads M. Pedersen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
added workshop notebook and utility functions
parent
15c742e7
No related branches found
Branches containing commit
Tags
v2.0.4
Tags containing commit
No related merge requests found
Pipeline
#6856
failed
6 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.coveragerc
+1
-0
1 addition, 0 deletions
.coveragerc
examples/workshop/workshop_competition.ipynb
+398
-0
398 additions, 0 deletions
examples/workshop/workshop_competition.ipynb
topfarm/workshop.py
+66
-0
66 additions, 0 deletions
topfarm/workshop.py
with
465 additions
and
0 deletions
.coveragerc
+
1
−
0
View file @
46ca5177
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
omit =
omit =
*/Colonel/*
*/Colonel/*
topfarm/tests/*
topfarm/tests/*
topfarm/workshop.py
[report]
[report]
fail_under = 95
fail_under = 95
\ No newline at end of file
This diff is collapsed.
Click to expand it.
examples/workshop/workshop_competition.ipynb
0 → 100644
+
398
−
0
View file @
46ca5177
This diff is collapsed.
Click to expand it.
topfarm/workshop.py
0 → 100644
+
66
−
0
View file @
46ca5177
from
urllib.request
import
urlopen
,
Request
from
urllib.parse
import
urlencode
import
time
from
_collections
import
defaultdict
import
matplotlib.pyplot
as
plt
import
numpy
as
np
def
report_result
(
name
,
method
=
''
):
def
wrap1
(
f
):
def
wrap
(
*
args
,
**
kwargs
):
t
=
time
.
time
()
res
=
f
(
*
args
,
**
kwargs
)
ref
=
365.8015799324624
cost
=
-
list
(
res
)[
0
]
duration
=
time
.
time
()
-
t
print
(
"
%s improved AEP to %f.4fGWh (%+.4f%%) in %.3fs
"
%
(
name
,
cost
,
(
cost
-
ref
)
/
ref
*
100
,
duration
))
url
=
"
http://tools.windenergy.dtu.dk/topfarm_ex/insert_result.asp
"
values
=
{
'
user
'
:
name
,
'
time
'
:
duration
,
'
aep
'
:
cost
,
'
comment
'
:
method
,
}
data
=
urlencode
(
values
).
encode
(
"
utf-8
"
)
req
=
Request
(
url
,
data
)
urlopen
(
req
)
return
res
return
wrap
return
wrap1
def
plot_result
():
url
=
"
http://tools.windenergy.dtu.dk/topfarm_ex/view_result.asp
"
req
=
Request
(
url
)
s
=
urlopen
(
req
).
read
().
decode
()
res_dict
=
defaultdict
(
list
)
for
r
in
s
.
split
(
"
<br>
"
)[:
-
1
]:
name
,
duration
,
aep
,
comment
=
r
.
split
(
"
;
"
)
res_dict
[
name
].
append
((
duration
,
aep
,
comment
))
fig
=
plt
.
figure
(
figsize
=
(
25
,
10
))
ref_aep
=
365.8015799324624
duration_lst
=
[]
for
i
,
name
in
enumerate
(
sorted
(
res_dict
.
keys
())):
duration
=
np
.
array
([
res
[
0
]
for
res
in
res_dict
[
name
]],
dtype
=
np
.
float
)
duration_lst
.
extend
(
duration
)
aep
=
np
.
array
([
res
[
1
]
for
res
in
res_dict
[
name
]],
dtype
=
np
.
float
)
marker
=
"
v^<>.ospP*X
"
[
i
//
10
]
plt
.
plot
(
duration
,
(
aep
-
ref_aep
)
/
ref_aep
*
100
,
'
^
'
,
label
=
name
,
marker
=
marker
)
plt
.
plot
([
min
(
duration_lst
),
max
(
duration_lst
)],
[
0
,
0
],
'
gray
'
)
best
=
(
418.9244064
-
ref_aep
)
/
ref_aep
*
100
plt
.
plot
([
min
(
duration_lst
),
max
(
duration_lst
)],
[
best
,
best
],
'
gray
'
)
plt
.
xlabel
(
'
Time [s]
'
)
plt
.
ylabel
(
'
AEP improvement [%]
'
)
plt
.
legend
()
return
fig
def
reset_results
():
url
=
"
http://tools.windenergy.dtu.dk/topfarm_ex/reset_results.asp
"
req
=
Request
(
url
)
urlopen
(
req
)
if
__name__
==
'
__main__
'
:
fig
=
plot_result
()
plt
.
show
()
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