GeezerVison is showing github.com — I/O system class restructuring by murrayrm · Pull Request #916 · python-control/python-control
Conversation
murrayrm
commented
Jun 19, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This PR restructures the input/output systems classes as described in issue #904 and summarized in the following diagram:

In addition, a number of deprecated functions were removed and various other changes related to I/O systems were made.
Summary of major changes:
- The
NamedIOSystem class has been renamed InputOutputSystem and serves as the parent class for all input/output system classes.
- The
LinearIOSystems class has been merged into the StateSpace class.
- Instances of
NonlinearIOSystem can now be created using the nlsys() factory function (instead of using the class name, so more like ss and tf).
- All operations that used to work on a subset of I/O system classes should now work on all compatible I/O system classes:
- Block diagram functions (
series, parallel, feedback, append, neg) now work on all I/O system classes, including nonlinear systems.
- Simulation functions (
initial_response, step_response, forced_response) will now work for nonlinear functions (via an internal call to input_output_response).
- The
impulse_response function only works for LTI systems.
- Extraneous arguments for simulation functions have been removed (see add/cleanup documentation on simulation functions #905):
- The
impulse_response function no longer accepts the X0 keyword.
- The
initial_response function no longer accepts the input keyword.
- The
step_response function still accepts the X0 keyword (to allow for non-zero equilibrium points for nonlinear systems).
- The
__str__() method for I/O system classes now includes the name of the system and signals (via InputOutputSystem.__str__()).
- Redundant functions have been marked as deprecated:
ss2io, tf2io.
- Deprecated functions and properties have been removed:
pole, zero, LTI.{inputs,outputs, pole, zero}, timebaseEqual. (The pole() and zero() functions are still available in the MATLAB compatibility module, control.matlab.)
- The
connect function generates a DeprecationWarning (use interconnect instead).
- Configuration defaults in the
namedio module are now in the iosys module.
- Updated user documentation, docstrings, examples, and unit tests.
What you will need to change to run version 0.10.0 (this should go in the release notes):
- Replace any use of the
LinearIOSystem class with the StateSpace class.
- Replace
pole() and zero() with poles() and zeros().
Additional recommended changes:
- Replace calls to
ss2io or tf2io with calls to ss or tf, including moving signal and system naming parameters into the ss or tf call.
- Replace calls to
StateSpace, TransferFunction, and NonlinearIOSystem with calls to the equivalent factory functions: ss(), tf(), nlsys().
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coveralls
commented
Jun 19, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

coverage: 94.849%. first build when pulling 39404c4 on murrayrm:iosys_classes-19Jun2023 into bfdfbd5 on python-control:main.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
A big drop - this looks great.
My only real concern is in regards to the tf2io and ss2io functions - are they implemented somehwere with a deprecation warning?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
@sawyerbfuller I put back ss2io and tf2io. If you have a chance, try running this against some of your existing code to just confirm it works as expected (and to see what else you end up needing to change, if anything).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ok just checked through and pretty much everything I have works with this new code, bravo! (and bravo unit tests!). The two exceptions I found were:
frequency_response raises an error with LinearICSystems.
sys = ct.interconnect([ct.ss(ct.drss(3,1, 1, dt=0.2), inputs='e', outputs='u'),
ct.ss(ct.drss(3,1, 1, dt=0.2), inputs='u', outputs='y')],
inputs='e', outputs='y')
sys.frequency_response(22)
raises
StateSpace.__call__() missing 1 required positional argument: 'x'. No error is raised for sys(22).
- In constructing this code, I encountered the bug that that
drss cannot take named signals using the 'inputs' keyword. sys = ct.drss(3,1, 1, dt=0.2, inputs='e', outputs='u') raises rss() got multiple values for argument 'inputs'. Not sure if this is new or not.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
murrayrm
commented
Jul 2, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
The "bug" in the drss call is because the second and third arguments for drss are actually output and input. So Python is complaining because you used both positional arguments for input and output and keyword arguments. The correct call to create a named random system is:
sys = ct.drss(3, inputs='e', outputs='u', dt=0.2)
(note that you can also just call rss, which recognizes the dt keyword and creates a discrete time system).
Fix for #1 is on its way.
|
sawyerbfuller reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
bnavigator
Awaiting requested review from bnavigator
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
|