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
4017f34c
There was a problem fetching the pipeline summary.
Commit
4017f34c
authored
8 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
main_body.py
parent
e9887975
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/hawc2/mainbody.py
+52
-49
52 additions, 49 deletions
wetb/hawc2/mainbody.py
wetb/hawc2/tests/test_htc_file.py
+3
-3
3 additions, 3 deletions
wetb/hawc2/tests/test_htc_file.py
with
55 additions
and
52 deletions
wetb/hawc2/mainbody.py
+
52
−
49
View file @
4017f34c
...
@@ -15,12 +15,44 @@ class MainBody():
...
@@ -15,12 +15,44 @@ class MainBody():
def
__init__
(
self
,
htc_filename
,
modelpath
,
body_name
):
def
__init__
(
self
,
htc_filename
,
modelpath
,
body_name
):
self
.
htcfile
=
htcfile
=
HTCFile
(
htc_filename
,
modelpath
)
self
.
htcfile
=
htcfile
=
HTCFile
(
htc_filename
,
modelpath
)
s
=
htcfile
.
new_htc_structure
s
=
htcfile
.
new_htc_structure
blade_name
=
htcfile
.
aero
.
link
[
2
]
main_bodies
=
{
s
[
k
].
name
[
0
]:
s
[
k
]
for
k
in
s
.
keys
()
if
s
[
k
].
name_
==
"
main_body
"
}
mainbodies
=
[
s
[
k
]
for
k
in
s
.
keys
()
if
s
[
k
].
name_
==
"
main_body
"
]
self
.
main_body
=
main_bodies
[
body_name
]
self
.
stFile
=
StFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
self
.
main_body
.
timoschenko_input
.
filename
[
0
]))
self
.
c2def
=
np
.
array
([
v
.
values
[
1
:
5
]
for
v
in
self
.
main_body
.
c2_def
if
v
.
name_
==
"
sec
"
])
self
.
concentrated_mass
=
[
cm
.
values
for
cm
in
self
.
main_body
if
cm
.
name_
.
startswith
(
'
concentrated_mass
'
)]
def
plot_xz_geometry
(
self
,
plt
=
None
):
if
plt
is
None
:
import
matplotlib.pyplot
as
plt
plt
.
figure
()
plt
.
xlabel
(
"
z
"
)
plt
.
ylabel
(
"
x
"
)
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
plt
.
plot
(
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
],
'
.-
'
,
label
=
'
Center line
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_e
(
z
),
label
=
'
Elastic center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_cg
(
z
),
label
=
'
Mass center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_sh
(
z
),
label
=
'
Shear center
'
)
for
cm
in
self
.
concentrated_mass
:
plt
.
plot
(
self
.
c2def
[
cm
[
0
]
-
1
,
2
]
+
cm
[
3
],
self
.
c2def
[
cm
[
0
]
-
1
,
0
]
+
cm
[
1
],
'
x
'
,
label
=
'
Concentrated mass
'
)
plt
.
legend
()
def
plot_yz_geometry
(
self
,
plt
=
None
):
if
plt
is
None
:
import
matplotlib.pyplot
as
plt
plt
.
figure
()
plt
.
xlabel
(
"
z
"
)
plt
.
ylabel
(
"
y
"
)
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
plt
.
plot
(
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
],
label
=
'
Center line
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_e
(
z
),
label
=
'
Elastic center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_cg
(
z
),
label
=
'
Mass center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_sh
(
z
),
label
=
'
Shear center
'
)
for
cm
in
self
.
concentrated_mass
:
plt
.
plot
(
self
.
c2def
[
cm
[
0
]
-
1
,
2
]
+
cm
[
3
],
self
.
c2def
[
cm
[
0
]
-
1
,
1
]
+
cm
[
2
],
'
x
'
,
label
=
'
Concentrated mass
'
)
plt
.
legend
()
blade_main_body
=
[
mb
for
mb
in
mainbodies
if
mb
.
name
[
0
]
==
blade_name
][
0
]
self
.
stFile
=
StFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
blade_main_body
.
timoschenko_input
.
filename
[
0
]))
self
.
c2def
=
np
.
array
([
v
.
values
[
1
:
5
]
for
v
in
blade_main_body
.
c2_def
if
v
.
name_
==
"
sec
"
])
class
BladeData
(
object
):
class
BladeData
(
object
):
def
plot_xz_geometry
(
self
,
plt
):
def
plot_xz_geometry
(
self
,
plt
):
...
@@ -93,62 +125,33 @@ class BladeData(object):
...
@@ -93,62 +125,33 @@ class BladeData(object):
class
H2BladeData
(
BladeData
):
class
Blade
(
MainBody
,
BladeData
):
def
__init__
(
self
,
htc_filename
,
modelpath
):
def
__init__
(
self
,
htc_filename
,
modelpath
,
blade_number
=
1
):
self
.
htcfile
=
htcfile
=
HTCFile
(
htc_filename
,
modelpath
)
self
.
htcfile
=
htcfile
=
HTCFile
(
htc_filename
,
modelpath
)
blade_name
=
[
link
[
2
]
for
link
in
htcfile
.
aero
if
link
.
name_
.
startswith
(
'
link
'
)
and
link
[
0
]
==
blade_number
][
0
]
MainBody
.
__init__
(
self
,
htc_filename
,
modelpath
,
blade_name
)
self
.
pcFile
=
PCFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
pc_filename
[
0
]),
self
.
pcFile
=
PCFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
pc_filename
[
0
]),
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
ae_filename
[
0
]))
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
ae_filename
[
0
]))
s
=
htcfile
.
new_htc_structure
blade_name
=
htcfile
.
aero
.
link
[
2
]
def
plot_xz_geometry
(
self
,
plt
=
None
):
mainbodies
=
[
s
[
k
]
for
k
in
s
.
keys
()
if
s
[
k
].
name_
==
"
main_body
"
]
blade_main_body
=
[
mb
for
mb
in
mainbodies
if
mb
.
name
[
0
]
==
blade_name
][
0
]
self
.
stFile
=
StFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
blade_main_body
.
timoschenko_input
.
filename
[
0
]))
self
.
c2def
=
np
.
array
([
v
.
values
[
1
:
5
]
for
v
in
blade_main_body
.
c2_def
if
v
.
name_
==
"
sec
"
])
def
plot_geometry
(
self
,
plt
=
None
):
if
plt
is
None
:
if
plt
is
None
:
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
plt
.
figure
()
MainBody
.
plot_xz_geometry
(
self
,
plt
)
BladeData
.
plot_xz_geometry
(
self
,
plt
=
plt
)
BladeData
.
plot_xz_geometry
(
self
,
plt
=
plt
)
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_e
(
z
),
label
=
'
Elastic center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_cg
(
z
),
label
=
'
Mass center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
0
])
+
self
.
stFile
.
x_sh
(
z
),
label
=
'
Shear center
'
)
plt
.
legend
()
plt
.
legend
()
plt
.
figure
()
BladeData
.
plot_yz_geometry
(
self
,
plt
=
plt
)
def
plot_geometry_yz
(
self
,
plt
=
None
):
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_e
(
z
),
label
=
'
Elastic center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_cg
(
z
),
label
=
'
Mass center
'
)
plt
.
plot
(
z
,
np
.
interp
(
z
,
self
.
c2def
[:,
2
],
self
.
c2def
[:,
1
])
+
self
.
stFile
.
y_sh
(
z
),
label
=
'
Shear center
'
)
plt
.
legend
()
plt
.
show
()
class
H2AeroBladeData
(
BladeData
):
def
__init__
(
self
,
htc_filename
,
modelpath
):
self
.
htcfile
=
htcfile
=
HTCFile
(
htc_filename
,
modelpath
)
self
.
pcFile
=
PCFile
(
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
pc_filename
[
0
]),
os
.
path
.
join
(
htcfile
.
modelpath
,
htcfile
.
aero
.
ae_filename
[
0
]))
self
.
c2def
=
np
.
array
([
v
.
values
[
1
:
5
]
for
v
in
htcfile
.
blade_c2_def
if
v
.
name_
==
"
sec
"
])
def
plot_geometry
(
self
,
plt
=
None
):
if
plt
is
None
:
if
plt
is
None
:
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
plt
.
figure
()
BladeData
.
plot_xz_geometry
(
self
,
plt
=
plt
)
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
plt
.
legend
()
plt
.
figure
()
BladeData
.
plot_yz_geometry
(
self
,
plt
=
plt
)
BladeData
.
plot_yz_geometry
(
self
,
plt
=
plt
)
z
=
np
.
linspace
(
self
.
c2def
[
0
,
2
],
self
.
c2def
[
-
1
,
2
],
100
)
MainBody
.
plot_yz_geometry
(
self
,
plt
)
plt
.
legend
()
plt
.
show
()
This diff is collapsed.
Click to expand it.
wetb/hawc2/tests/test_htc_file.py
+
3
−
3
View file @
4017f34c
...
@@ -205,9 +205,9 @@ class TestHtcFile(unittest.TestCase):
...
@@ -205,9 +205,9 @@ class TestHtcFile(unittest.TestCase):
'
./data/DTU_10MW_RWT_Towertop_st.dat
'
,
'
./data/DTU_10MW_RWT_Towertop_st.dat
'
,
'
./data/DTU_10MW_RWT_Shaft_st.dat
'
,
'
./data/DTU_10MW_RWT_Shaft_st.dat
'
,
'
./data/DTU_10MW_RWT_Hub_st.dat
'
,
'
./data/DTU_10MW_RWT_Hub_st.dat
'
,
'
data/
2Bdown-rR1.08
_blade_st.dat
'
,
'
./
data/
dtu_10mw_rwt
_blade_st.dat
'
,
'
./data/
2Bdown-rR1.08
_ae.dat
'
,
'
./data/
dtu_10mw_rwt
_ae.dat
'
,
'
./data/
2Bup_AEP095
_pc.dat
'
,
'
./data/
dtu_10mw_rwt
_pc.dat
'
,
'
./control/risoe_controller.dll
'
,
'
./control/risoe_controller.dll
'
,
'
./control/generator_servo.dll
'
,
'
./control/generator_servo.dll
'
,
'
./control/mech_brake.dll
'
,
'
./control/mech_brake.dll
'
,
...
...
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