GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — step_info error for MIMO system · Issue #574 · python-control/python-control

step_info error for MIMO system  #574

New issue
Copy link
New issue
Copy link
Closed
#577
Closed
step_info error for MIMO system #574
#577
Copy link

Description

@juanodecc
juanodecc
opened on Mar 16, 2021
Issue body actions

I try with this MIMO system, the function broke at line 614. The step_info function convert the system to SIMO, but cannot calculate the step response characteristic parameters.

from control import ss step_response step_info

A = [[0.68, -0.34], [0.34, 0.68]];
B = [[0.18, -0.05], [0.04, 0.11]];
C = [[0, -1.53], [-1.12, -1.10]];
D = [[0, 0], [0.06, -0.37]];
m_sys = ss(A,B,C,D,0.2);
mt,my=step_response(m_sys)

step_info(m_sys)

File ".../timeresp.py", line 614, in step_info
if((yout[i] <= inf_margin) | (yout[i] >= sup_margin)):

IndexError: index 24 is out of bounds for axis 0 with size 2

Activity

  1. bnavigator commented on Mar 16, 2021

    @bnavigator
    bnavigator
    on Mar 16, 2021
    Contributor
    More actions

    Why line 614? Current master has that line at 807, Your own PR #567 duplicates it in 807 and 817.

    Can confirm with current master. The problem is the indexing of yout:

    [ben@skylab:~/src/python-control]% python3                                                                                                                       [0]
    Python 3.8.8 (default, Feb 19 2021, 16:53:21) [GCC] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from control import ss, step_response, step_info
    >>> 
    >>> A = [[0.68, -0.34], [0.34, 0.68]];
    >>> B = [[0.18, -0.05], [0.04, 0.11]];
    >>> C = [[0, -1.53], [-1.12, -1.10]];
    >>> D = [[0, 0], [0.06, -0.37]];
    >>> m_sys = ss(A,B,C,D,0.2);
    >>> mt,my=step_response(m_sys)
    >>> mt.shape
    (25,)
    >>> my.shape
    (2, 2, 25)
    >>> step_info(m_sys)
    /home/ben/src/python-control/control/statesp.py:1549: UserWarning: Converting MIMO system to SIMO system. Only input 0 is used.
      warn("Converting MIMO system to SIMO system. "
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/ben/src/python-control/control/timeresp.py", line 807, in step_info
        if((yout[i] <= inf_margin) | (yout[i] >= sup_margin)):
    IndexError: index 24 is out of bounds for axis 0 with size 2
    
  2. bnavigator commented on Mar 16, 2021

    @bnavigator
    bnavigator
    on Mar 16, 2021
    Contributor
    More actions

    Why not adjust #567 to handle MIMO systems the way MATLAB's stepinfo does:

    For a MIMO system, stepinfo returns a structure array in which each entry contains the response characteristics of the corresponding I/O channel of the system. For this example, use a two-output, two-input discrete-time system. Compute the step-response characteristics.

  3. juanodecc commented on Mar 16, 2021

    @juanodecc
    juanodecc
    on Mar 16, 2021
    ContributorAuthor
    More actions

    Why line 614? Current master has that line at 807, Your own PR #567 duplicates it in 807 and 817.

    Can confirm with current master. The problem is the indexing of yout:

    [ben@skylab:~/src/python-control]% python3                                                                                                                       [0]
    Python 3.8.8 (default, Feb 19 2021, 16:53:21) [GCC] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from control import ss, step_response, step_info
    >>> 
    >>> A = [[0.68, -0.34], [0.34, 0.68]];
    >>> B = [[0.18, -0.05], [0.04, 0.11]];
    >>> C = [[0, -1.53], [-1.12, -1.10]];
    >>> D = [[0, 0], [0.06, -0.37]];
    >>> m_sys = ss(A,B,C,D,0.2);
    >>> mt,my=step_response(m_sys)
    >>> mt.shape
    (25,)
    >>> my.shape
    (2, 2, 25)
    >>> step_info(m_sys)
    /home/ben/src/python-control/control/statesp.py:1549: UserWarning: Converting MIMO system to SIMO system. Only input 0 is used.
      warn("Converting MIMO system to SIMO system. "
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/ben/src/python-control/control/timeresp.py", line 807, in step_info
        if((yout[i] <= inf_margin) | (yout[i] >= sup_margin)):
    IndexError: index 24 is out of bounds for axis 0 with size 2
    

    yes my bad, is line 614 for version 8.4

  4. juanodecc commented on Mar 16, 2021

    @juanodecc
    juanodecc
    on Mar 16, 2021
    ContributorAuthor
    More actions

    Why not adjust #567 to handle MIMO systems the way MATLAB's stepinfo does:

    For a MIMO system, stepinfo returns a structure array in which each entry contains the response characteristics of the corresponding I/O channel of the system. For this example, use a two-output, two-input discrete-time system. Compute the step-response characteristics.

    Yes, I am trying to fix it, but I commit a partial solution for now. That improve the performance of this function

  5. juanodecc commented on Mar 16, 2021

    @juanodecc
    juanodecc
    on Mar 16, 2021
    ContributorAuthor
    More actions

    Why not adjust #567 to handle MIMO systems the way MATLAB's stepinfo does:

    For a MIMO system, stepinfo returns a structure array in which each entry contains the response characteristics of the corresponding I/O channel of the system. For this example, use a two-output, two-input discrete-time system. Compute the step-response characteristics.

    step_response have limitations, that function can solve only SIMO systems. My idea is convert the step_info into two functions: step_info4data (t, y, yfinal) for multidimentional, time and output parameters, in the other hand, keep a step_info(sys) as is, but that function can call step_info4data () with the proper input vector for MIMO systems. This can allow use the step_info4data function with time vectors and output vectors imported from externals simulation or system stimulation

  6. bnavigator commented on Mar 16, 2021

    @bnavigator
    bnavigator
    on Mar 16, 2021
    Contributor
    More actions

    I might be missing something, but the current step_response can handle MIMO. See my.shape.

  7. murrayrm
    closed this as completedin #577on Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.