Skip to content

Additional I/O system type conversions #672

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

Merged
merged 5 commits into from
Nov 27, 2021

Conversation

murrayrm
Copy link
Member

@murrayrm murrayrm commented Nov 21, 2021

This PR adds some type conversations for algebraic operations involving I/O systems, motivated by an example I was putting together where I wanted to generate a Nyquist plot for a linearized nonlinear I/O system (type LinearIOSystem) and a simple lead compensator (type TransferFunction). Using P * C generated a type conversation error but C * P was OK as was ct.tf(P) * C. It seemed annoying to have to do the explicit typecasting, so I decided to implement some of the operations that were needed to make P * C work (generates a LinearICSystem, which is a subclass of StateSpace).

The following functionality has been added:

  • Added __sub__, so that you can write G1 - G2 for I/O systems
  • Added conversions for scalars, arrays, state space, and transfer function systems so that they can be combined with I/O systems on either the left or right.
  • Set the Numpy __array_priority__ value so that operations involving ndarrays are handled as I/O system operations and I/O system operations take precedence over LTI operations involving ndarrays.

I also did some PEP8 cleanup on iosys.py while I was at it, and put in unit tests for the code.

@murrayrm
Copy link
Member Author

Rebased on top of latest master...

@coveralls
Copy link

coveralls commented Nov 21, 2021

Coverage Status

Coverage increased (+0.04%) to 90.119% when pulling a44d1a4 on murrayrm:ios-mixedops into 56cecc0 on python-control:master.

Copy link
Contributor

@bnavigator bnavigator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@murrayrm murrayrm merged commit 20088d1 into python-control:master Nov 27, 2021
@murrayrm murrayrm deleted the ios-mixedops branch November 27, 2021 18:35
@murrayrm murrayrm added this to the 0.9.1 milestone Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants