forked from vincentchoqueuse/python-control-plotly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (20 loc) · 716 Bytes
/
utils.py
File metadata and controls
28 lines (20 loc) · 716 Bytes
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
import control as ctl
import numpy as np
def damp(sys,display=False):
pole_list = []
m_list = []
wn_list = []
for pole in sys.pole():
pole = pole.astype(complex) # WTF: the python control "damp" function is buggy due to this missing cast !
if ctl.isctime(sys):
pole_continuous = pole
else:
pole_continuous = np.log(pole)/sys.dt
wn = np.abs(pole_continuous)
m = -np.real(pole_continuous)/wn
pole_list.append(pole)
wn_list.append(wn)
m_list.append(m)
if display:
print("pole {:.3f} : wn={:.3f} rad/s, m= {:.3f}".format(pole, wn, m))
return wn_list, m_list, pole_list