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
eca70404
Commit
eca70404
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
ignore fuga test if lib missing
parent
b9e38bee
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
tests/test_fuga/test_pyfuga.py
+4
-0
4 additions, 0 deletions
tests/test_fuga/test_pyfuga.py
topfarm/cost_models/fuga/py_fuga.py
+10
-6
10 additions, 6 deletions
topfarm/cost_models/fuga/py_fuga.py
with
14 additions
and
6 deletions
tests/test_fuga/test_pyfuga.py
+
4
−
0
View file @
eca70404
...
...
@@ -45,12 +45,14 @@ class Test(unittest.TestCase):
farms_dir
=
fuga_path
+
'
LUT/Farms/
'
,
wind_atlas_path
=
'
Horns Rev 1/hornsrev_north_only.lib
'
,
climate_interpolation
=
False
)
def
testCheckVersion
(
self
):
if
self
.
lib_missing
():
return
lib
=
PascalDLL
(
fuga_path
+
"
FugaLib/FugaLib.%s
"
%
(
'
so
'
,
'
dll
'
)[
os
.
name
==
'
nt
'
])
self
.
assertRaisesRegex
(
Exception
,
"
This version of FugaLib supports interface version
"
,
lib
.
CheckInterfaceVersion
,
1
)
pyFuga
=
self
.
get_fuga
()
# check that current interface version match
pyFuga
.
cleanup
()
def
testSetup
(
self
):
if
self
.
lib_missing
():
return
pyFuga
=
self
.
get_fuga
()
self
.
assertEqual
(
pyFuga
.
get_no_tubines
(),
2
)
self
.
assertIn
(
"
Loading
"
,
pyFuga
.
log
)
...
...
@@ -61,11 +63,13 @@ class Test(unittest.TestCase):
pyFuga
.
cleanup
()
def
testAEP_one_tb
(
self
):
if
self
.
lib_missing
():
return
pyFuga
=
self
.
get_fuga
([
0
],
[
0
])
np
.
testing
.
assert_array_almost_equal
(
pyFuga
.
get_aep
(
np
.
array
([[
0
],
[
0
]]).
T
),
[
7.44121
,
7.44121
,
0.424962
,
1.
])
pyFuga
.
cleanup
()
def
testAEP
(
self
):
if
self
.
lib_missing
():
return
pyFuga
=
self
.
get_fuga
()
np
.
testing
.
assert_array_almost_equal
(
pyFuga
.
get_aep
(
np
.
array
([[
0
,
200
],
[
0
,
0
]]).
T
),
[
14.848055
,
14.882419
,
0.423981
,
0.997691
])
...
...
This diff is collapsed.
Click to expand it.
topfarm/cost_models/fuga/py_fuga.py
+
10
−
6
View file @
eca70404
...
...
@@ -31,8 +31,12 @@ class PyFuga(object):
atexit
.
register
(
self
.
cleanup
)
with
NamedTemporaryFile
()
as
f
:
self
.
stdout_filename
=
f
.
name
+
"
pyfuga.txt
"
self
.
lib
=
PascalDLL
(
os
.
path
.
dirname
(
__file__
)
+
"
/Colonel/FugaLib/FugaLib.%s
"
%
(
'
so
'
,
'
dll
'
)[
os
.
name
==
'
nt
'
])
lib_path
=
os
.
path
.
dirname
(
__file__
)
+
"
/Colonel/FugaLib/FugaLib.%s
"
%
(
'
so
'
,
'
dll
'
)[
os
.
name
==
'
nt
'
]
if
os
.
path
.
isfile
(
lib_path
):
raise
Exception
(
"
Fuga lib cannot be found:
'
%s
'"
%
lib_path
)
self
.
lib
=
PascalDLL
(
lib_path
)
self
.
lib
.
CheckInterfaceVersion
(
self
.
interface_version
)
self
.
lib
.
Setup
(
self
.
stdout_filename
,
float
(
mast_position
[
0
]),
float
(
mast_position
[
1
]),
float
(
mast_position
[
2
]),
float
(
z0
),
float
(
zi
),
float
(
zeta0
))
...
...
@@ -93,8 +97,8 @@ class PyFuga(object):
def
get_aep
(
self
,
turbine_positions
=
None
):
if
turbine_positions
is
not
None
:
self
.
move_turbines
(
turbine_positions
[:,
0
],
turbine_positions
[:,
1
])
self
.
move_turbines
(
turbine_positions
[:,
0
],
turbine_positions
[:,
1
])
AEPNet_p
=
c_double_p
(
c_double
(
0
))
AEPGros_p
=
c_double_p
(
c_double
(
0
))
capacity_p
=
c_double_p
(
c_double
(
0
))
...
...
@@ -105,8 +109,8 @@ class PyFuga(object):
def
get_aep_gradients
(
self
,
turbine_positions
=
None
):
if
turbine_positions
is
not
None
:
self
.
move_turbines
(
turbine_positions
[:,
0
],
turbine_positions
[:,
1
])
self
.
move_turbines
(
turbine_positions
[:,
0
],
turbine_positions
[:,
1
])
n_wt
=
self
.
get_no_tubines
()
dAEPdxyz
=
np
.
zeros
(
n_wt
),
np
.
zeros
(
n_wt
),
np
.
zeros
(
n_wt
)
dAEPdxyz_ctype
=
[
dAEP
.
ctypes
for
dAEP
in
dAEPdxyz
]
...
...
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