GeezerVison is showing github.com — make _convert_to_statespace properly pass signal and system names by sawyerbfuller · Pull Request #884 · python-control/python-control
Conversation
update: this PR has been converted to a bugfix in _convert_to_statespace to insure it copies signal and system names correctly. Found the bug by using the test suite.
Old PR description:
On some systems computers , the process of converting tf systems into LinearIOSystems in the interconnect function loses signal names -- if the transfer function is static. For example, if a system is defined as sys=tf(1, 2, inputs='a', outputs='b'), an error is raised when that system is interconnected with others because sys gets copied but loses its signal names, something along the lines of Signal 'a' not found.
But this doesn't happen on my system on Python 3.9, 3.10, or 3.11. Maybe something peculiar to windows?
This PR adds unit tests in an attempt to see if our test suite catches this bug.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…same as transfer functions. tests to track down missing names on some systems when converting to LinearIOSystem
coveralls
commented
Apr 17, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Coverage: 94.535%. Remained the same when pulling 8b5eb47 on sawyerbfuller:static-signal-names into 1e1c8eb on python-control:main.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Found it! Losing signal names when slycot is not installed.
Working on a fix.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
sawyerbfuller
changed the title
PR aimed at finding missing signal names
make _convert_to_statespace properly pass signal and system names
Apr 18, 2023
|
Found the bug and squashed it. _convert_to_statespace was not passing signal names correctly in all cases, particularly with no slycot.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@sawyerbfuller Should the system name be copied over directly or should it be modified by appending $converted or something along those lines? One reason not to change the system name is that if you use interconnect with transfer functions, it is more natural to use the same system name. But this means that you can have two objects (the original TransferFunction and a StateSpace object) both having the same name...
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@murrayrm my first thought is that the private method should keep the same system name because it is being used is internally.
But maybe if the system was changed by the user using ‘ss’, then that default should be overrided and the system should get a new name. sys$converted?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I like the idea of having "$converted" appended when you do an explicit conversion (eg, via ss applied to a TransferFunction). That way you don't end up with two explicit objects floating around that have the same name but aren't the same object.
If we do that, we should probably generate a utility function/method that renames objects, probably in namedio.py so that we get some uniformity (including use of prefix and/or suffix, setting configuration defaults, etc). That goes beyond this PR, so could be split off as a separate issue?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
HI @murrayrm that sounds good. Yes there are a few issues surrounding when to add $converted that may be outside of scope for this PR. E.g. if you call LinearIOSystem on a StateSpace system, does that get a suffix? if you call ss on a system, what method is responsible for adding $converted.
For this PR, OK if we leave it as it is, with _convert_to_statespace not changing the name? This is what you want when you are interconnecting TransferFunction and StateSpace objects and the former are being converted internally.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jun 3, 2023
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|