Skip to content

fix gain handling in rlocus and sisotool #809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 16, 2022

Conversation

sawyerbfuller
Copy link
Contributor

@sawyerbfuller sawyerbfuller commented Dec 7, 2022

current problem is that if you want to pass an initial gain to sisotool to plot as starting point gain in the various plots, an error is raised if it is not an array. so you have to do sisotool(sys, kvect=(1.1, )) which is awkward. With this fix, you can do sisotool(sys, kvect=1.1) update: changed function call to look like sisotool(sys, initial_gain=1.1)

@coveralls
Copy link

coveralls commented Dec 7, 2022

Coverage Status

Coverage decreased (-0.02%) to 94.785% when pulling 15543ff on sawyerbfuller:kvect into 9d65bf8 on python-control:main.

@sawyerbfuller
Copy link
Contributor Author

Added some more fixes to the kvect kwarg in rlocus and sisotool. kvect was intended to let the user specify their own array of gains, but it wasn't being used that way. Two primary changes aim to make it do what I believe was its intended purpose:

  1. I deprecated kvect in sisotool, because you probably don't want to specify your own set of gains to plot in the rlocus plot in sisotool anyway. You probably want to use the ones that are computed automatically. Especially because sisotool/rlocus allows you to zoom in, and it re-computes gain points for the new zoomed root locus plot, to get a more precise click. Instead, there is now a new keyword, initial_gain that allows the user to specify the starting value of the closed-loop gain to plot in its four plots. kvect can be still given, and it reproduces the old behavior of sisotool using kvect[0] as the initial gain, and ignoring everything else in kvect. And there is now a deprecation warning.

  2. For rlocus, you might actually want to specify your own kvect if for example you only want to see where the roots go for a certain set of gains. But this wasn't what was happening: the rlocus plot ignores the kvect argument altogether and essentially always uses its own pre-computed gains. This is because any time the axis range is changed, kvect is automatically recomputed, which is basically every time the plot is created. I fixed it so that the new behavior is that if kvect is supplied to rlocus, it is no longer recomputed automatically if the plot is zoomed.

  3. Other improvements:

  • docstring fixes
  • pep8 cleanups
  • change mymat to root_array in rlocus to better describe its function

@sawyerbfuller sawyerbfuller changed the title allow sisotool to receive kvect as a singleton or an array fix gain handling in rlocus and sisotool Dec 9, 2022
Copy link
Member

@murrayrm murrayrm left a comment

Choose a reason for hiding this comment

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

LGTM

@murrayrm murrayrm linked an issue Dec 14, 2022 that may be closed by this pull request
@murrayrm murrayrm merged commit b1d55a1 into python-control:main Dec 16, 2022
@murrayrm murrayrm added this to the 0.9.3 milestone Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rlocus with kvect argument doesn't compute good limits
3 participants