Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I/O system class restructuring#916

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

murrayrm
Copy link
Member

@murrayrmmurrayrm commentedJun 19, 2023
edited
Loading

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:

  • TheNamedIOSystem class has been renamedInputOutputSystem and serves as the parent class for all input/output system classes.
  • TheLinearIOSystems class has been merged into theStateSpace class.
  • Instances ofNonlinearIOSystem can now be created using thenlsys() factory function (instead of using the class name, so more likess andtf).
  • 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 toinput_output_response).
    • Theimpulse_response function only works forLTI systems.
  • Extraneous arguments for simulation functions have been removed (seeadd/cleanup documentation on simulation functions #905):
    • Theimpulse_response function no longer accepts theX0 keyword.
    • Theinitial_response function no longer accepts theinput keyword.
    • Thestep_response function still accepts theX0 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 (viaInputOutputSystem.__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. (Thepole() andzero() functions are still available in the MATLAB compatibility module,control.matlab.)
  • Theconnect function generates aDeprecationWarning (useinterconnect instead).
  • Configuration defaults in thenamedio module are now in theiosys 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 theLinearIOSystem class with theStateSpace class.
  • Replacepole() andzero() withpoles() andzeros().

Additional recommended changes:

  • Replace calls toss2io ortf2io with calls toss ortf, including moving signal and system naming parameters into thess ortf call.
  • Replace calls toStateSpace,TransferFunction, andNonlinearIOSystem with calls to the equivalent factory functions:ss(),tf(),nlsys().

@coveralls
Copy link

coveralls commentedJun 19, 2023
edited
Loading

Coverage Status

coverage: 94.849%. first build when pulling39404c4 on murrayrm:iosys_classes-19Jun2023 intobfdfbd5 on python-control:main.

Copy link
Contributor

@sawyerbfullersawyerbfuller left a 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 thetf2io andss2io functions - are they implemented somehwere with a deprecation warning?

@murrayrm
Copy link
MemberAuthor

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

@murrayrmmurrayrmforce-pushed theiosys_classes-19Jun2023 branch from24d7309 tofc19cd6CompareJune 27, 2023 05:26
@sawyerbfuller
Copy link
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 withLinearICSystems.
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 forsys(22).

  1. In constructing this code, I encountered the bug that thatdrss cannot take named signals using the 'inputs' keyword.sys = ct.drss(3,1, 1, dt=0.2, inputs='e', outputs='u') raisesrss() got multiple values for argument 'inputs'. Not sure if this is new or not.

@murrayrm
Copy link
MemberAuthor

murrayrm commentedJul 2, 2023
edited
Loading

The "bug" in thedrss call is because the second and third arguments fordrss are actuallyoutput andinput. So Python is complaining because you used both positional arguments forinput andoutput 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 callrss, which recognizes thedt keyword and creates a discrete time system).

Fix for#1 is on its way.

sawyerbfuller reacted with thumbs up emoji

Copy link
Contributor

@sawyerbfullersawyerbfuller left a 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

@murrayrmmurrayrm merged commit4955691 intopython-control:mainJul 2, 2023
@murrayrmmurrayrm added this to the0.10.0 milestoneMar 31, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sawyerbfullersawyerbfullersawyerbfuller approved these changes

@bnavigatorbnavigatorAwaiting requested review from bnavigator

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
3 participants
@murrayrm@coveralls@sawyerbfuller

[8]ページ先頭

©2009-2025 Movatter.jp