forked from OpenFAST/python-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex1a_OneLinFile_SimpleEigenAnalysis.py
43 lines (34 loc) · 1.5 KB
/
ex1a_OneLinFile_SimpleEigenAnalysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
- Open a lin file generated by OpenFAST
- Perform a simple eigenvalue analysis of the A matrix (not performing MBC)
- Example on how to extract submatrices of the A,B,C,D
"""
import os
import numpy as np
from pyFAST.tools.eva import eigA
from pyFAST.input_output.fast_linearization_file import FASTLinearizationFile
scriptDir = os.path.dirname(__file__)
# --- Open lin File
linFile = os.path.join(scriptDir, '../../../data/NREL5MW/5MW_Land_Lin_BladeOnly/Main.1.lin')
lin = FASTLinearizationFile(linFile)
print('Keys available:',lin.keys())
# --- Perform eigenvalue analysis
fd, zeta, Q, f0 = eigA(lin['A'])
print('Nat. freq. [Hz], Damping ratio [%]')
print(np.column_stack((np.around(f0,4),np.around(zeta*100,4))))
# --- Using dataframes instead of numpy arrays for convenient indexing of variables
dfs = lin.toDataFrame()
print('Dataframe available:',dfs.keys())
A = dfs['A']
print(A.columns)
# --- Extract sub matrix for tower degrees of freedom
#EDdof = ['qt1FA_[m]' ,'qt1SS_[m]' ,'qt2FA_[m]' ,'qt2SS_[m]']
#EDvel = ['d_qt1FA_[m/s]','d_qt1SS_[m/s]','d_qt2FA_[m/s]','d_qt2SS_[m/s]']
#print(A.loc[EDvel,EDdof]) # - M^{-1}K (stiffness)
#print(A.loc[EDvel,EDvel]) # - M^{-1}D (damping)
if __name__=='__main__':
np.testing.assert_almost_equal(fd[:3], [0.672, 1.079,1.981],3)
np.testing.assert_almost_equal(zeta[:3]*100, [0.474, 0.471,0.489],3)
if __name__=='__test__':
np.testing.assert_almost_equal(fd[:3], [0.672, 1.079,1.981],3)
np.testing.assert_almost_equal(zeta[:3]*100, [0.474, 0.471,0.489],3)