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
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
wtlib
WindEnergyToolbox
Commits
abdefd26
Commit
abdefd26
authored
8 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
matrix reader for HS2, rename hs2_control_tuning to ReadControlTuning
parent
fe350d51
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wetb/prepost/h2_vs_hs2.py
+1
-1
1 addition, 1 deletion
wetb/prepost/h2_vs_hs2.py
wetb/prepost/hawcstab2.py
+64
-7
64 additions, 7 deletions
wetb/prepost/hawcstab2.py
wetb/prepost/tests/test_hawcstab2.py
+3
-3
3 additions, 3 deletions
wetb/prepost/tests/test_hawcstab2.py
with
68 additions
and
11 deletions
wetb/prepost/h2_vs_hs2.py
+
1
−
1
View file @
abdefd26
...
...
@@ -442,7 +442,7 @@ class Sims(object):
"""
Read a HAWCStab2 controller tuning file and return as tags
"""
tuning
=
hs2
.
hs2_c
ontrol
_t
uning
()
tuning
=
hs2
.
ReadC
ontrol
T
uning
()
tuning
.
read_parameters
(
fpath
)
tune_tags
=
{}
...
...
This diff is collapsed.
Click to expand it.
wetb/prepost/hawcstab2.py
+
64
−
7
View file @
abdefd26
...
...
@@ -15,9 +15,6 @@ from future import standard_library
standard_library
.
install_aliases
()
from
builtins
import
object
import
unittest
import
os
import
re
...
...
@@ -28,8 +25,8 @@ from wetb.prepost import mplutils
class
dummy
(
object
):
def
__init__
(
self
):
pass
def
__init__
(
self
,
name
=
'
dummy
'
):
self
.
__name__
=
name
def
ReadFileHAWCStab2Header
(
fname
,
widths
):
...
...
@@ -172,6 +169,66 @@ class results(object):
'
T_aero
'
]
self
.
operation
=
pd
.
DataFrame
(
operation
,
columns
=
cols
)
def
load_matrices
(
self
,
fpath
,
basename
,
operating_point
=
1
,
control_mat
=
False
,
local_wind_mat
=
False
):
"""
Load HAWCStab2 State Space system matrices
The general file name format is:
BASENAMETYPE_ase_ops_OPERATING_POINT_NUMBER.dat
Where TYPE can be of the following:
* amat, bmat, bvmat, cmat, dmat, dvmat, emat, fmat, fvmat
Additionally, when including the control matrices:
* BASENAMETYPE_ops_OPERATING_POINT_NUMBER.dat
* TYPE: acmat, bcmat, ccmat, dcmat
Or when including local wind speed
* BASENAMETYPE_ase_ops_OPERATING_POINT_NUMBER.dat
* TYPE: bvmat_loc_v, dvmat_loc_v, fvmat_loc_v
Parameters
----------
fpath : str
basename : str
operating_point : int, default=1
Returns
-------
matrices : dict
"""
mnames
=
[
'
amat
'
,
'
bmat
'
,
'
bvmat
'
,
'
cmat
'
,
'
dmat
'
,
'
dvmat
'
,
'
emat
'
,
'
fmat
'
,
'
fvmat
'
]
mnames_c
=
[
'
acmat
'
,
'
bcmat
'
,
'
ccmat
'
,
'
dcmat
'
]
mnames_v
=
[
'
bvmat_loc_v
'
,
'
dvmat_loc_v
'
,
'
fvmat_loc_v
'
]
if
control_mat
:
mnames
+=
mnames_c
if
local_wind_mat
:
mnames
+=
mnames_v
matrices
=
{}
ase_template
=
'
{:s}{:s}_ase_ops_{:d}.dat
'
ops_template
=
'
{:s}{:s}_ops_{:d}.dat
'
for
mname
in
mnames
:
rpl
=
(
basename
,
mname
,
operating_point
)
template
=
ase_template
if
mname
in
mnames_c
:
template
=
ops_template
fname
=
os
.
path
.
join
(
fpath
,
template
.
format
(
*
rpl
))
matrices
[
mname
]
=
np
.
loadtxt
(
fname
)
return
matrices
def
write_ae_sections_h2
(
self
):
"""
Get the aerosection positions from the HS2 ind result file and
...
...
@@ -237,7 +294,7 @@ class results(object):
print
(
'
done!
'
)
class
hs2_c
ontrol
_t
uning
(
object
):
class
ReadC
ontrol
T
uning
(
object
):
def
__init__
(
self
):
"""
...
...
@@ -293,4 +350,4 @@ class hs2_control_tuning(object):
if
__name__
==
'
__main__
'
:
unittest
.
main
()
pass
This diff is collapsed.
Click to expand it.
wetb/prepost/tests/test_hawcstab2.py
+
3
−
3
View file @
abdefd26
...
...
@@ -15,7 +15,7 @@ import os
import
numpy
as
np
from
wetb.prepost.hawcstab2
import
results
,
hs2_c
ontrol
_t
uning
from
wetb.prepost.hawcstab2
import
results
,
ReadC
ontrol
T
uning
class
Tests
(
unittest
.
TestCase
):
...
...
@@ -49,7 +49,7 @@ class Tests(unittest.TestCase):
def
test_linear_file
(
self
):
hs2
=
hs2_c
ontrol
_t
uning
()
hs2
=
ReadC
ontrol
T
uning
()
hs2
.
read_parameters
(
self
.
fpath_linear
)
self
.
assertEqual
(
hs2
.
pi_gen_reg1
.
K
,
0.108313E+07
)
...
...
@@ -69,7 +69,7 @@ class Tests(unittest.TestCase):
def
test_quadratic_file
(
self
):
hs2
=
hs2_c
ontrol
_t
uning
()
hs2
=
ReadC
ontrol
T
uning
()
hs2
.
read_parameters
(
self
.
fpath_quad
)
self
.
assertEqual
(
hs2
.
pi_gen_reg1
.
K
,
0.108313E+07
)
...
...
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