-
Notifications
You must be signed in to change notification settings - Fork 438
Fixed InterconnectedSystems name bugs. #400
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
Fixed InterconnectedSystems name bugs. #400
Conversation
Co-authored-by: Ben Greiner <code@bnavigator.de>
Co-authored-by: Ben Greiner <code@bnavigator.de>
Only the outlist specification I am not sure. First, why can subsystem inputs be connected to system outputs? Then, why was the specification and code in __init__ different from that for the inplist? I changed it to match inplist, but left the weird subsystem input configuration. Check comment that starts with "Convert the output list to a matrix".
…hon-control into interconnectedsystems
Here's a short code snippet to visualize the signal names for different Connections:
And the output after my last push:
|
@samlaf Can you add some unit tests to cover your new code and show that things are working? The examples that you have in your comment from 20 May would probably be fine. You might also try mixing named systems and named signals with unnamed systems/signals to make sure that nothing funny happens. And, as a harder test, try creating a system/signal with a name that would conflict with the default name (eg, create a system whose name is |
Should I be enforcing sys/signals names here? Wouldn't this render the API a bit too rigid (in case people want to change the naming conventions later, etc.) |
states = [] | ||
for sys in sysobj_list: | ||
states += [sys.name + '.' + statename for statename in sys.state_index.keys()] | ||
|
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.
@murrayrm This is the part that would break if you add a named signal with a generic 'sys[i]' that will cause a conflict (it's no different from having two systems with the same name). The only "bad" thing that happens is that the system will be missing the state names of the systems with conflicting names (only the first 'sys[i].states' will be present).
Right now we are only raising a warning. As I mention in the comment, users can use sys.copy() first to create a unique name. Is this ok?
Edit: see the comment above this snippet of code... I'm new to this and not sure how to include it in the comment.
Co-authored-by: Ben Greiner <code@bnavigator.de>
Co-authored-by: Ben Greiner <code@bnavigator.de>
…hon-control into interconnectedsystems
Unit tests are failing because
no longer works. It seems like it should be possible to take two copies of a system and put them in series (which is what this does) without generating an error. |
Co-authored-by: Ben Greiner <code@bnavigator.de>
…est conversation.
…hon-control into interconnectedsystems
Thank you for pointing this out @murrayrm, and thanks a lot to both of you two for your patience... newbie at work here. The system naming convention code should be fine now. Still need to write the signal name convention unit test though. |
Looks like git got confused by the new unit test. I don't see any actual conflicts, but you may need to fiddle with things to allow the automatic merge check to work. |
It seems like a conflict between my branch and master branch? |
That's what it's saying, but what's odd is that I don't see the conflict. You added in a test and it shouldn't conflict with other tests. If you agree, I can try to fix it via the web interface and we'll see if that gets things running again. |
Sure, please do. I wouldn't know what to try anyways and would be scared to break other things. |
I added the last unit tests. This is ready to be reviewed and hopefully should be close to done. |
The changes remove test coverage of the functions In fact, those functions are not used by the whole package anymore. But they are public API. So a unit test for them should be present. (I would personally prefer that they are created in the style of #438. |
Sure I can do that. |
Yes, that is correct. The unit tests should make sure that using those functions results in the documented behavior. Previously, this was more or less implicit by the tests when |
revert this commit when merging into or with python-control#400 and python-control#431
revert this commit when merging into or with python-control#400 and python-control#431
Hi @bnavigator, I was planning on doing these, but I got major neck pain recently, and am spending some time away from the keyboard. Are you waiting on me to merge the other PRs? I'm not sure when I'll have time to write these, but if it's not a hurry I will eventually get to them. |
No hurry, get well soon! As I wrote, I removed the dependency in my PR so your PR can be merged later. Whenever you can get to it. You will have to rebase. |
revert this commit when merging into or with python-control#400 and python-control#431
revert this commit when merging into or with python-control#400 and python-control#431
revert this commit when merging into or with python-control#400 and python-control#431
3 fixes to InterconnectedSystem's init:
For example, if we Interconnected these two systems
we would get
Now instead, we get