GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — ENH: add `linform` to compute linear system L-infinity norm by roryyorke · Pull Request #729 · python-control/python-control Conversation
Contributor
linfnorm requires Slycot routine ab13dd, which does the actual work. Added tests for SISO and MIMO continuous- and discrete-time. MIMO The MIMO tests rely, unfortunately, on circular logic: the very function being tested has been used to generate test data. I could scour the various textbooks I have for independent examples, but I'm more-or-less assuming that SLICOT's Below are the MIMO test cases for review; everything looks OK to me. The left-hand figures are continuous-time, the right-hand discrete time. While doing this rather hacky test-generation, I found that
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Coverage increased (+0.006%) to 94.312% when pulling 02b3451 on roryyorke:rory/linfnorm into 46b3c53 on python-control:master. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Oops, missed that. At least it's passing now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Some small comments.
The method of generating test cases is a bit nonstandard. Do we need to check correctness of the algorithm itself (versus the processing of arguments, etc)? Seems like we can assume slycot is working and just do a few simple unit tests??
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ------- | ||
| gpeak : non-negative scalar | ||
| L-infinity norm | ||
| fpeak : non-negatie scalar |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
negatie → negative
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| For systems with an undefined time base (i.e., sys.dt is None), a | ||
| ValueError is raised. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Normally we allow dt=None to be treat as either continuous or discrete time, with default being continuous. Should we do that here? This is not a major issue since dt=0 by default, but there are situations where a constant system can be converted to a state space or transfer function with dt=None (since it works as either discrete or continuous).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'll drop the ValueError, and use .isctime() as suggested below; this will treat these as continuous-time.
One case where dt=None by default is static gains (this is from observation, not from reading the code); and, in this case, it doesn't matter what the time base is.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if sys.dt is None: | ||
| raise ValueError('unspecified time base') | ||
| dico = 'C' if sys.dt==0 else 'D' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Alternatively:
dico = 'C' if sys.isctime() else 'D'
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if n == 0: | ||
| # ab13dd doesn't accept empty A, B, C, D; | ||
| # static gain case is easy enough to compute | ||
| gpeak = scipy.linalg.svdvals(d)[0] | ||
| # max svd is constant with freq; arbitrarily choose 0 as peak | ||
| fpeak = 0 | ||
| return gpeak, fpeak |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Note that this will return a value even if sys.dt == None, contrary to the documentation.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fair enough, I did get a bit carried away. We do need to test at least for:
What do you think about keeping one continuous-time SISO test (a slightly underdamped system?), an equivalent SISO discrete-time test, and one continuous-time MIMO test (probably duplicating the SISO test as a 2x2 diagonal system) ? Also one static-gain test. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
All points addressed. If the tests pass, I'll squash the PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
linfnorm requires Slycot routine ab13dd, which does the actual work. Added tests to check that wrapping of ab13dd is correct, that static systems are handled, and that discrete-time system frequencies are scaled correctly.
514e323 to
02b3451
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.