.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/09_tds_control_manual/example_2_12.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_09_tds_control_manual_example_2_12.py: Example 2.12 - Stability analysis of a Smith predictor with delay mismatch ========================================================================== We will follow example 2.12 from :cite:`appeltans2023analysis` Section 2.6.2. In there, for given plant and controller .. math:: H(s) = \frac{1}{s + 1}e^{-s\tau} , C(s) = \frac{s}{2} + 2, the classical smith predictor is constructed. Assuming the delay mismatch :math:`\delta` we arrive at the quasipolynomial .. math:: D_{cl}(s) = \frac{3}{2} s + 3 + (\frac{s}{2} + 2) e^{-s\tau} + (\frac{-s}{2} - 2) e^{-s(\tau + \delta)}, which we will analyse for stability in :math:`(\tau, \delta)`-parameter space. .. GENERATED FROM PYTHON SOURCE LINES 27-73 .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/tdcpy/tdcpy/src/tdcpy/common/quasipoly.py:136: SyntaxWarning: invalid escape sequence '\d' \dot{x}(t) = A_0*x(t - hA_0) + ... + A_{mA}*x(t - hA_{mA}) | .. code-block:: Python import numpy as np import tdcpy import tdcpy.plot import matplotlib.pyplot as plt from tdcpy.common.quasipoly import qp_to_ndde from tdcpy.common.quasipoly import compress_qp, qp_to_ndde tau, delta = 1., 0.5 coeffs = np.array([[3.,1.5],[2.0,0.5],[-2.0,-0.5]]) delays = np.array([0.,tau,tau+delta]) A, hA, H, hH = qp_to_ndde(coeffs,delays,ascending=True) ndde = tdcpy.NDDE(A=A,hA=hA,H=H,hH=hH) tau_grid = np.linspace(0, 8, 201) delta_grid = np.linspace(-8, 10, 451) Z = np.zeros((len(delta_grid), len(tau_grid))) # for i2 in range(0,len(tau_grid)-1): # tau = tau_grid[i2] # for i1 in range(0,len(delta_grid)): # delta = delta_grid[i1] # if np.abs(tau+delta)<1e-8: # # case: tau+delta = 0 # if np.abs(tau)<1e-8: # tau = 1e-8 # hH[0],hH[1] = tau, 1e-8 # hA[1],hA[2] = tau, 1e-8 # ndde = tdcpy.NDDE(H=H,hH=hH,A=A,hA=hA) # Z[i1,i2] = tdcpy.strong_spectral_abscissa(ndde) # elif tau + delta < 0: # # case: "real" delay cannot be negative # Z[i1,i2] = -np.inf # else: # hH[0], hH[1] = tau, tau+delta # hA[1], hA[2] = tau, tau+delta # ndde = tdcpy.NDDE(H=H,hH=hH,A=A,hA=hA) # Z[i1,i2] = tdcpy.strong_spectral_abscissa(ndde) # X, Y = np.meshgrid(tau_grid,delta_grid) # plt.contour(X,Y,Z,[0]) # plt.plot(plt.xlim(),[0,0],'k-.') # plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.003 seconds) .. _sphx_glr_download_auto_examples_09_tds_control_manual_example_2_12.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_2_12.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_2_12.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_2_12.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_