GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — I/O system class restructuring by murrayrm · Pull Request #916 · python-control/python-control

Conversation

@murrayrm

@murrayrm murrayrm commented Jun 19, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This PR restructures the input/output systems classes as described in issue #904 and summarized in the following diagram:

classes-0 10 0

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.

All reactions
murrayrm added 11 commits June 19, 2023 12:58
@murrayrm
initial refactoring of classes and modules
b881b22
@murrayrm
updated unit tests
4afda82
@murrayrm
updated documentation, examples, unit tests
31f6574
@murrayrm
iosys.py cleanup plus related subclass, docstring mods
7273e11
@murrayrm
removed unused code; added unit tests for coverage
9d426e9
@murrayrm
reorganize and clean up statesp.py
0758426
@murrayrm
add nlsys() function for creating nonlinear I/O systems
7dc92df
@murrayrm
allow bdalg fucntions (series, parallel, feedback) on general I/O sys…
e9e3a8e
…tems
@murrayrm
update time response functions to allow nonlinear systems
0ef2941
@murrayrm
remove unneeded code; clean up TODOs
4692b1e
@murrayrm
add missing links for Jupyter notebooks in doc/
55fb775
@murrayrm murrayrm mentioned this pull request Jun 19, 2023
Version 0.10 changes (tracking issue) #917
Closed
7 tasks done
@murrayrm murrayrm linked an issue Jun 19, 2023 that may be closed by this pull request
Add nonlinear system compatibility to time simulation functions #906
Closed
@murrayrm murrayrm mentioned this pull request Jun 19, 2023
Add two MRAC siso examples #914
Merged
@murrayrm
murrayrm requested review from bnavigator and sawyerbfuller June 19, 2023 21:05
@coveralls

coveralls commented Jun 19, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

coverage: 94.849%. first build when pulling 39404c4 on murrayrm:iosys_classes-19Jun2023 into bfdfbd5 on python-control:main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

murrayrm added 2 commits June 20, 2023 21:11
@murrayrm
add flatsys() factory function
9023de9
@murrayrm
fix bug in the way inputs were stored for MIMO step_response
de38612
sawyerbfuller
sawyerbfuller requested changes Jun 22, 2023
View reviewed changes

@sawyerbfuller sawyerbfuller left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
Comment thread control/bdalg.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/bdalg.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/iosys.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/sisotool.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/statesp.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/statesp.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/statesp.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/tests/type_conversion_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/timeresp.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

murrayrm added 2 commits June 26, 2023 21:09
@murrayrm
updates per @sawyerbfuller review comments
b3693dc
@murrayrm
clean up unit test warnings + ignore deprecation warning in matlab.co…
a0c7884
…nnect
@murrayrm

murrayrm commented Jun 27, 2023

Copy link
Copy Markdown
Member Author

@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).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@murrayrm
add back ss2io and tf2io, with deprecation warnings
fc19cd6
@murrayrm
murrayrm force-pushed the iosys_classes-19Jun2023 branch from 24d7309 to fc19cd6 Compare June 27, 2023 05:26
@murrayrm
set names of ct.s and ct.z to 's' and 'z'
0b3ae85
@sawyerbfuller

sawyerbfuller commented Jul 2, 2023

Copy link
Copy Markdown
Contributor

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:

  1. 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).

  1. 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@murrayrm

murrayrm commented Jul 2, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@murrayrm
fix bug in the way LinearICSystem.__call__ was implemented (with unit…
39404c4
… test)
sawyerbfuller
sawyerbfuller approved these changes Jul 2, 2023
View reviewed changes

@sawyerbfuller sawyerbfuller left a comment

Copy link
Copy Markdown
Contributor

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.

Looks good to me

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@murrayrm
murrayrm merged commit 4955691 into python-control:main Jul 2, 2023
@murrayrm murrayrm added this to the 0.10.0 milestone Mar 31, 2024
@slivingston slivingston mentioned this pull request Nov 15, 2024
AttributeError: module 'control' has no attribute 'LinearIOSystem' #1060
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sawyerbfuller sawyerbfuller sawyerbfuller approved these changes
@bnavigator bnavigator Awaiting requested review from bnavigator

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.10.0

Development

Successfully merging this pull request may close these issues.

Add nonlinear system compatibility to time simulation functions

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@murrayrm @coveralls @sawyerbfuller
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.