Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix damp method for discrete time systems with a negative real-valued pole #647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion control/lti.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def damp(self):
poles = self.pole()

if isdtime(self, strict=True):
splane_poles = np.log(poles)/self.dt
splane_poles = np.log(poles.astype(complex))/self.dt
else:
splane_poles = poles
wn = absolute(splane_poles)
Expand Down
8 changes: 8 additions & 0 deletions control/tests/lti_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def test_damp(self):
np.testing.assert_almost_equal(sys_dt.damp(), expected_dt)
np.testing.assert_almost_equal(damp(sys_dt), expected_dt)

#also check that for a discrete system with a negative real pole the damp function can extract wn and zeta.
p2_zplane = -0.2
sys_dt2 = tf(1, [1, -p2_zplane], dt)
wn2, zeta2, p2 = sys_dt2.damp()
p2_splane = -wn2 * zeta2 + 1j * wn2 * np.sqrt(1 - zeta2**2)
p2_zplane = np.exp(p2_splane * dt)
np.testing.assert_almost_equal(p2, p2_zplane)

def test_dcgain(self):
sys = tf(84, [1, 2])
np.testing.assert_allclose(sys.dcgain(), 42)
Expand Down