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 improve jpp by juanodecc · Pull Request #567 · python-control/python-control

Conversation

@juanodecc

@juanodecc juanodecc commented Mar 12, 2021

Copy link
Copy Markdown
Contributor

This modification improve step_info results:

Solve the issue Any plan for step_info to support negative step responses? #337
solve the issue step_info problem with non stationary systems response #564
solve the issue step_info undershoot must be "Undershoot: Percentage of undershoot" #565

I try to fullfill pep 8
Add some aditional tests to check the results

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joaoantoniocardoso reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
juanodecc added 2 commits March 12, 2021 17:41
@juanodecc
Added 5 test for step_info:
1263550
1) System Type 1 - Step response not stationary:  G(s)=1/s(s+1)
2) SISO system with under shoot response and positive final value G(s)=(-s+1)/(s²+s+1)
3) Same system that 2) with k=-1
4) example from matlab online help https://www.mathworks.com/help/control/ref/stepinfo.html G(s)=(s²+5s+5)/(s^4+1.65s^3+6.5s+2)

with stepinfo output:

        RiseTime: 3.8456
    SettlingTime: 27.9762
     SettlingMin: 2.0689
     SettlingMax: 2.6873
       Overshoot: 7.4915
      Undershoot: 0
            Peak: 2.6873
        PeakTime: 8.0530

5) example from matlab online help https://www.mathworks.com/help/control/ref/stepinfo.html
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];
sys = StateSpace(A,B,C,D,0.2);
examine the response characteristics for the response from the first input to the second output of sys.

with stepinfo output:

        RiseTime: 0.4000
    SettlingTime: 2.8000
     SettlingMin: -0.6724
     SettlingMax: -0.5188
       Overshoot: 24.6476
      Undershoot: 11.1224
            Peak: 0.6724
        PeakTime: 1
@juanodecc
Solve issue python-control#337, python-control#565 and python-control…
f964170
…#564
@coveralls

coveralls commented Mar 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 88.832% when pulling 81ae64f on juanodecc:step_info_improve_jpp into 92de12d on python-control:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnavigator
bnavigator reviewed Mar 12, 2021
View reviewed changes
Comment thread control/tests/timeresp_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/timeresp.py
Comment on lines +798 to +805
rise_time: float = np.NaN
settling_time: float = np.NaN
settling_min: float = np.NaN
settling_max: float = np.NaN
peak_value: float = np.Inf
peak_time: float = np.Inf
undershoot: float = np.NaN
overshoot: float = np.NaN

@bnavigator bnavigator Mar 12, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first use of typing in python-control?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@juanodecc juanodecc Mar 13, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, is wrong?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bnavigator bnavigator Mar 13, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all! Good thing we already ditched Python 2.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread control/timeresp.py Outdated
Comment on lines +816 to +838
if InfValue < 0.0:
# RiseTime
tr_lower_index = (np.where(yout <= RiseTimeLimits[0] * InfValue)[0])[0]
tr_upper_index = (np.where(yout <= RiseTimeLimits[1] * InfValue)[0])[0]
# SettlingTime
for i in reversed(range(T.size - 1)):
if (-yout[i] <= np.abs(inf_margin)) | (-yout[i] >= np.abs(sup_margin)):
settling_time = T[i + 1]
break
# Overshoot and Undershoot
overshoot = np.abs(100. * ((-yout).max() - np.abs(InfValue)) / np.abs(InfValue))
undershoot = np.abs(100. * (-yout).min() / np.abs(InfValue))
else:
tr_lower_index = (np.where(yout >= RiseTimeLimits[0] * InfValue)[0])[0]
tr_upper_index = (np.where(yout >= RiseTimeLimits[1] * InfValue)[0])[0]
# SettlingTime
for i in reversed(range(T.size - 1)):
if (yout[i] <= inf_margin) | (yout[i] >= sup_margin):
settling_time = T[i + 1]
break
# Overshoot and Undershoot
overshoot = np.abs(100. * (yout.max() - InfValue) / InfValue)
undershoot = np.abs(100. * yout.min() / InfValue)

@bnavigator bnavigator Mar 12, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this has a lot of duplicate code. Have you considered using a sign variable and the abs() function instead of two completely separate blocks? I think It won't turn out much more convoluted than the current InfValue < 0 part.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@juanodecc juanodecc Mar 13, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was linked to issues Mar 13, 2021
Any plan for step_info to support negative step responses? #337
Closed
step_info problem with non stationary systems response #564
Closed
step_info undershoot must be "Undershoot: Percentage of undershoot" #565
Closed
@murrayrm murrayrm added this to the 0.9.0 milestone Mar 13, 2021
@bnavigator bnavigator mentioned this pull request Mar 16, 2021
step_info error for MIMO system #574
Closed
juanodecc and others added 2 commits March 16, 2021 11:16
@juanodecc
optimize the code and solve problems with MIMO
018d128
systems converting to SISO systems from input=0 to output =0
solve problems with non stationary systems doing
SteadyStateValue= nan when  y_final is inf
@bnavigator
fix comment format
81ae64f
@bnavigator

bnavigator commented Mar 17, 2021

Copy link
Copy Markdown
Contributor

Other than the MIMO handling (#574), this looks good to me. I'll merge this. Future PRs can improve it further.

joaoantoniocardoso reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator
bnavigator merged commit 258c9c2 into python-control:master Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnavigator bnavigator bnavigator left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.9.0

Development

Successfully merging this pull request may close these issues.

step_info undershoot must be "Undershoot: Percentage of undershoot" step_info problem with non stationary systems response Any plan for step_info to support negative step responses?

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@juanodecc @coveralls @bnavigator @murrayrm
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.