-
Notifications
You must be signed in to change notification settings - Fork 438
in nyquist plots, draw contour at specified magnitude if threshold is exceeded #671
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
Conversation
Nice! Will try to look through the code in the coming days and leave any comments. |
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.
Nice idea!
control/freqplot.py
Outdated
ax.set_xlim(-maximum_magnitude*1.1, maximum_magnitude*1.1) | ||
ax.set_ylim(-maximum_magnitude*1.1, maximum_magnitude*1.1) |
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.
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.
I think (though I am not positive) that @bnavigator's system might be a pathological case because you are mostly concerned with systems cascaded with their controllers, in which case you won't have a very low loop gain as this system does.
That said, I rewrote the indentation code to add a consistent number of points at every indent, and further reduced the indent radius, which make it so everything but the most extremely low-gain systems have large contours that go outside of the plot window. This also helps with other pathological cases.
also:
- removed an indent test that confirms that no indentation happens when first omega is too large
- made the red lines have the same line style as their associated contour.
Updated after plots:
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.
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.
Do you think this would be resolved by adding a test for whether there was any maximum_magintude
contour drawn, and if there wasn't, then to let it zoom the plot by the default amount?
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.
Sounds reasonable.
…nt if omega_range_given is false
… setting it to zero; docstring improvement; old indentation method still available if omega is explicitly specified
Further updates and now ready to merge of ok'd:
|
small indentation. The portion of the Nyquist contour at infinity is not | ||
small indentation. If portions of the Nyquist plot The portion of the Nyquist contour at infinity is not |
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.
Some unintended text insertion here, I guess.
@@ -550,7 +552,9 @@ def nyquist_plot(syslist, omega=None, plot=True, omega_limits=None, | |||
If True, plot magnitude | |||
|
|||
omega : array_like | |||
Set of frequencies to be evaluated, in rad/sec. | |||
Set of frequencies to be evaluated, in rad/sec. Remark: if omega is | |||
specified, you may need to specify specify a larger `indent_radius` |
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.
double specify
@murrayrm what you suggest sounds like a reasonable explanation to me. So this is a second, unrelated reason why it might be nice to have automatic frequency vector generation code that adds more points near poles (the other being that then the shape of the bode plot can be better visualized). I have no idea what is going on with those arrows but it may be related to having discontinuous points |
A few additional comments after playing around with this a bit:
Also, I've put some preliminary code that does a better job at adding points near poles here. I'm thinking of pulling that code into the |
@murrayrm re mulitple contours: makes sense, good idea. re turning off re default value for One alternative to consider: maybe we could stick with the old way, but size each indent according to the size of the residue (or maybe there is some better formula), so that encirclements are always roughly the same size. You would probably need to further adjust the indent for each pole to avoid overlap with other indentations. This is a tricky interface issue. |
This pr was motivated by a feedback system in which the default indent radius resulted in a very small, confusing contour. In this PR, the maximum radius is specified explicitly. This also helps visualize -1 point because the nyquist plot has a standard size relative to that point. To do so, the default indent radius is reduced and an extra contour is drawn when the regular contour leaves the plot window.
Before:



(dt system)



(dt system)
After: