Skip to content

Commit 65f5502

Browse files
committed
add test for Nyquist evaluation at a pole
1 parent 71bd731 commit 65f5502

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

control/freqplot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,12 @@ def nyquist_response(
14471447
else:
14481448
contour = np.exp(splane_contour * sys.dt)
14491449

1450+
# Make sure we don't try to evaluate at a pole
1451+
if isinstance(sys, (StateSpace, TransferFunction)):
1452+
if any([pole in contour for pole in sys.poles()]):
1453+
raise RuntimeError(
1454+
"attempt to evaluate at a pole; indent required")
1455+
14501456
# Compute the primary curve
14511457
resp = sys(contour)
14521458

control/tests/nyquist_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,15 @@ def test_nyquist_frd():
517517
warnings.resetwarnings()
518518

519519

520+
def test_no_indent_pole():
521+
s = ct.tf('s')
522+
sys = ((1 + 5/s)/(1 + 0.5/s))**2 # Double-Lag-Compensator
523+
524+
with pytest.raises(RuntimeError, match="evaluate at a pole"):
525+
resp = ct.nyquist_response(
526+
sys, warn_encirclements=False, indent_direction='none')
527+
528+
520529
if __name__ == "__main__":
521530
#
522531
# Interactive mode: generate plots for manual viewing

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy