Skip to content
Snippets Groups Projects
Commit a6db5c55 authored by mads's avatar mads Committed by David Verelst
Browse files

renamed mset_nr to mset

parent 38b4dd82
No related merge requests found
...@@ -42,16 +42,16 @@ class StFile(object): ...@@ -42,16 +42,16 @@ class StFile(object):
The autogenerated methods have the following structure The autogenerated methods have the following structure
def xxx(radius=None, mset_nr=1, set_nr=1): def xxx(radius=None, mset=1, set=1):
Parameters: Parameters:
----------- -----------
radius : int, float, array_like or None, optional radius : int, float, array_like or None, optional
Radius/radii of interest\n Radius/radii of interest\n
If int, float or array_like: values are interpolated to requested radius/radii If int, float or array_like: values are interpolated to requested radius/radii
If None (default): Values of all radii specified in st file returned If None (default): Values of all radii specified in st file returned
mset_nr : int, optional mset : int, optional
Main set number Main set number
set_nr : int, optional set : int, optional
Sub set number Sub set number
...@@ -60,9 +60,9 @@ class StFile(object): ...@@ -60,9 +60,9 @@ class StFile(object):
>>> stfile = StFile(r"tests/test_files/DTU_10MW_RWT_Blade_st.dat") >>> stfile = StFile(r"tests/test_files/DTU_10MW_RWT_Blade_st.dat")
>>> print (stfile.m()) # Interpolated mass at radius 36 >>> print (stfile.m()) # Interpolated mass at radius 36
[ 1189.51054664 1191.64291781 1202.76694262 ... 15.42438683] [ 1189.51054664 1191.64291781 1202.76694262 ... 15.42438683]
>>> print (st.E(radius=36, mset_nr=1, set_nr=1)) # Elasticity interpolated to radius 36m >>> print (st.E(radius=36, mset=1, set=1)) # Elasticity interpolated to radius 36m
8722924514.652649 8722924514.652649
>>> print (st.E(radius=36, mset_nr=1, set_nr=2)) # Same for stiff blade set >>> print (st.E(radius=36, mset=1, set=2)) # Same for stiff blade set
8.722924514652648e+17 8.722924514652648e+17
""" """
def __init__(self, filename): def __init__(self, filename):
...@@ -83,7 +83,7 @@ class StFile(object): ...@@ -83,7 +83,7 @@ class StFile(object):
self.main_data_sets[mset_nr] = set_data_dict self.main_data_sets[mset_nr] = set_data_dict
for i, name in enumerate("r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e".split()): for i, name in enumerate("r m x_cg y_cg ri_x ri_y x_sh y_sh E G I_x I_y I_p k_x k_y A pitch x_e y_e".split()):
setattr(self, name, lambda radius=None, mset_nr=1, set_nr=1, column=i: self._value(radius, column, mset_nr, set_nr)) setattr(self, name, lambda radius=None, mset=1, set=1, column=i: self._value(radius, column, mset, set))
def _value(self, radius, column, mset_nr=1, set_nr=1): def _value(self, radius, column, mset_nr=1, set_nr=1):
st_data = self.main_data_sets[mset_nr][set_nr] st_data = self.main_data_sets[mset_nr][set_nr]
...@@ -91,8 +91,8 @@ class StFile(object): ...@@ -91,8 +91,8 @@ class StFile(object):
radius = self.radius(None, mset_nr, set_nr) radius = self.radius(None, mset_nr, set_nr)
return np.interp(radius, st_data[:, 0], st_data[:, column]) return np.interp(radius, st_data[:, 0], st_data[:, column])
def radius(self, radius=None, mset_nr=1, set_nr=1): def radius(self, radius=None, mset=1, set=1):
r = self.main_data_sets[mset_nr][set_nr][:, 0] r = self.main_data_sets[mset][set][:, 0]
if radius is None: if radius is None:
return r return r
return r[np.argmin(np.abs(r - radius))] return r[np.argmin(np.abs(r - radius))]
...@@ -102,8 +102,8 @@ class StFile(object): ...@@ -102,8 +102,8 @@ class StFile(object):
if __name__ == "__main__": if __name__ == "__main__":
st = StFile(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\data/DTU_10MW_RWT_Blade_st.dat") st = StFile(r"C:\mmpe\HAWC2\models\DTU10MWRef6.0\data/DTU_10MW_RWT_Blade_st.dat")
print (st.m()) print (st.m())
print (st.E(radius=36, mset_nr=1, set_nr=1)) # Elastic blade print (st.E(radius=36, mset=1, set=1)) # Elastic blade
print (st.E(radius=36, mset_nr=1, set_nr=2)) # stiff blade print (st.E(radius=36, mset=1, set=2)) # stiff blade
#print (st.radius()) #print (st.radius())
xyz = np.array([st.x_e(), st.y_e(), st.r()]).T[:40] xyz = np.array([st.x_e(), st.y_e(), st.r()]).T[:40]
n = 2 n = 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment