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
99608fec
Commit
99608fec
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
changed from tbx,tby to turbine_positions in PyFuga
parent
cec608e0
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
topfarm/cost_models/fuga/Colonel
+1
-1
1 addition, 1 deletion
topfarm/cost_models/fuga/Colonel
topfarm/cost_models/fuga/py_fuga.py
+13
-10
13 additions, 10 deletions
topfarm/cost_models/fuga/py_fuga.py
with
14 additions
and
11 deletions
Colonel
@
6eb5b3fe
Compare
5f695353
...
6eb5b3fe
Subproject commit
5f695353b799e0e49ad78c9ba40e09e84b3c762d
Subproject commit
6eb5b3fe9c4a7654d039b1e77a92e930749a57dc
This diff is collapsed.
Click to expand it.
topfarm/cost_models/fuga/py_fuga.py
+
13
−
10
View file @
99608fec
...
...
@@ -22,7 +22,7 @@ c_int_p = POINTER(ctypes.c_int32)
class
PyFuga
(
object
):
interface_version
=
2
def
__init__
(
self
,
def
__init__
(
self
,
farm_name
=
'
Horns Rev 1
'
,
turbine_model_path
=
'
./LUT/
'
,
turbine_model_name
=
'
Vestas_V80_(2_MW_offshore)[h=67.00]
'
,
tb_x
=
[
423974
,
424033
],
tb_y
=
[
6151447
,
6150889
],
...
...
@@ -31,7 +31,7 @@ class PyFuga(object):
atexit
.
register
(
self
.
cleanup
)
with
NamedTemporaryFile
()
as
f
:
self
.
stdout_filename
=
f
.
name
+
"
.txt
"
self
.
lib
=
PascalDLL
(
os
.
path
.
dirname
(
__file__
)
+
"
/Colonel/FugaLib/FugaLib.%s
"
%
(
'
so
'
,
'
dll
'
)[
os
.
name
==
'
nt
'
])
self
.
lib
=
PascalDLL
(
os
.
path
.
dirname
(
__file__
)
+
"
/Colonel/FugaLib/FugaLib.%s
"
%
(
'
so
'
,
'
dll
'
)[
os
.
name
==
'
nt
'
])
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
))
...
...
@@ -57,7 +57,7 @@ class PyFuga(object):
def
cleanup
(
self
):
if
hasattr
(
self
,
'
lib
'
):
try
:
self
.
lib
.
Exit
()
# raises exception
self
.
lib
.
Exit
()
# raises exception
except
:
pass
del
self
.
lib
...
...
@@ -85,9 +85,10 @@ class PyFuga(object):
self
.
lib
.
MoveTurbines
(
tb_x_ctype
.
data_as
(
c_double_p
),
tb_y_ctype
.
data_as
(
c_double_p
))
def
get_aep
(
self
,
tb_x
,
tb_y
):
self
.
move_turbines
(
tb_x
,
tb_y
)
def
get_aep
(
self
,
turbine_positions
=
None
):
if
turbine_positions
is
not
None
:
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
))
...
...
@@ -96,10 +97,12 @@ class PyFuga(object):
net
,
gros
,
cap
=
[
p
.
contents
.
value
for
p
in
[
AEPNet_p
,
AEPGros_p
,
capacity_p
]]
return
(
net
,
gros
,
cap
,
net
/
gros
)
def
get_aep_gradients
(
self
,
tb_x
,
tb_y
):
self
.
move_turbines
(
tb_x
,
tb_y
)
dAEPdxyz
=
np
.
zeros
(
len
(
tb_x
)),
np
.
zeros
(
len
(
tb_x
)),
np
.
zeros
(
len
(
tb_x
))
def
get_aep_gradients
(
self
,
turbine_positions
=
None
):
if
turbine_positions
is
not
None
:
self
.
move_turbines
(
turbine_positions
[:,
0
],
turbine_positions
[:,
1
])
n_wt
=
turbine_positions
.
shape
[
0
]
dAEPdxyz
=
np
.
zeros
(
n_wt
),
np
.
zeros
(
n_wt
),
np
.
zeros
(
n_wt
)
dAEPdxyz_ctype
=
[
dAEP
.
ctypes
for
dAEP
in
dAEPdxyz
]
self
.
lib
.
GetAEPGradients
(
*
[
dAEP_ctype
.
data_as
(
c_double_p
)
for
dAEP_ctype
in
dAEPdxyz_ctype
])
#print(tb_x, tb_y, 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