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 — Any plan for step_info to support negative step responses? · Issue #337 · python-control/python-control

Any plan for step_info to support negative step responses? #337

New issue
Copy link
New issue
Copy link
Closed
#567
Closed
Any plan for step_info to support negative step responses?#337
#567
Copy link
Labels
bugenhancement
Milestone
0.9.1

Description

@hgducharme
hgducharme
opened on Aug 21, 2019
Issue body actions

I have step responses that go negative and sometimes stay negative, and it breaks the settling time calculation and rise time calculation. I've been messing around with it and might open a pull request if this is something y'all would be interested in.

For example, here is my code, the step response plot, and the error

from control import tf, step_response, step_info
import matplotlib.pyplot as plt
import numpy as np

transfer_function = tf( [3.32, 0, -162.8], [1, 24.56, 186.5, 457.8, 116.2] )
time, response = step_response(transfer_function)

fig, ax = plt.subplots(1, 1)
ax.plot(time, response)
plt.show()

step_info(transfer_function)

step_response

step_info() gives the following error

Traceback (most recent call last):
  File "bug_test.py", line 14, in <module>
    step_info(transfer_function)
  File "/Users/hgducharme/Programming/pendulum/env/lib/python3.7/site-packages/control/timeresp.py", line 536, in step_info
    SettlingTime = T[i + 1]
IndexError: index 1000 is out of bounds for axis 0 with size 1000

When I run this code in MATLAB, I get the following result


Screen Shot 2019-08-20 at 8 36 44 PM

Activity

  1. murrayrm commented on Aug 21, 2019

    @murrayrm
    murrayrm
    on Aug 21, 2019
    Member
    More actions

    @joaoantoniocardoso Any interest in taking a look at this?

    Reacted by João Antônio Cardoso
  2. joaoantoniocardoso commented on Aug 21, 2019

    @joaoantoniocardoso
    joaoantoniocardoso
    on Aug 21, 2019
    Contributor
    More actions

    @murrayrm Yes, I think I can take a look at this tomorrow.

    Also I think this error is not something that happens only for negative step responses... Months ago I did a pull-request (#293 ) that fixes some cases with the same message. (That pull was closed because while fixes some cases, it breaks others)

  3. murrayrm
    added this to the 0.9.x milestone on Dec 26, 2020
  4. murrayrm
    added
    bug
    enhancement
    on Dec 26, 2020
  5. juanodecc commented on Mar 9, 2021

    @juanodecc
    juanodecc
    on Mar 9, 2021
    Contributor
    More actions

    Hi, think I solved this problem and the problem of systems with non settling time, I mean when dcgain isinf or isnan, doing:

        # Steady state value
        InfValue = sys1.dcgain()
        if InfValue < 0.0:
            yout = -yout
            InfValue = np.abs(InfValue)
    
    
    
    
        # SettlingTime
        sup_margin = (1. + SettlingTimeThreshold) * np.abs(InfValue)
        inf_margin = (1. - SettlingTimeThreshold) * np.abs(InfValue)
        # find Steady State looking for the first point out of specified limits
        if np.isnan(InfValue) or np.isinf(InfValue):
            SettlingTime = np.NaN
        else:
            for i in reversed(range(time.size-1)):
                if((np.abs(yout[i]) <= inf_margin) | (np.abs(yout[i]) >= sup_margin)):
                    SettlingTime = T[i + 1]
                    break
    
  6. joaoantoniocardoso commented on Mar 9, 2021

    @joaoantoniocardoso
    joaoantoniocardoso
    on Mar 9, 2021
    Contributor
    More actions

    Hi @juanodecc, it seems like a good solution. Could you open a PR with that, adding also a test case with a negative system and another with a system with non-settling time? Thanks

  7. juanodecc
    added a commit that references this issue on Mar 12, 2021

    Solve issue python-control#337, python-control#565 and python-control…

    f964170
  8. murrayrm
    linked a pull request that will close this issueStep info improve jpp #567on Mar 13, 2021
  9. bnavigator
    closed this as completedin #567on Mar 17, 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

    bugenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      • 0.9.1

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.