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 — add summing junction + implicit signal interconnection by murrayrm · Pull Request #517 · python-control/python-control

Conversation

@murrayrm

@murrayrm murrayrm commented Jan 23, 2021

Copy link
Copy Markdown
Member

This PR addresses the enhancement describe in issue #516 where signals with the same name are automatically interconnected by the interconnect function. It also defines a new function summation_block that addresses the request in issue #493. Together, these capabilities allow the following code to work for setting up a simple feedback system:

P = ct.ss2io(
    ct.rss(2, 1, 1, strictly_proper=True),
    inputs='u', outputs='y', name='P')
kp = ct.tf(random.uniform(1, 10), [1])
ki = ct.tf(random.uniform(1, 10), [1, 0])
C = ct.tf2io(kp + ki, inputs='e', outputs='u', name='C')
sumblk = ct.summation_block(inputs=['r', '-y'], output='e', name="sum")
Tio_sum = ct.interconnect(
    (C, P, sumblk), inplist=['r'], outlist=['y'])

Other minor changes:

  • Added code to allow the iosys.feedback function to accept a float_like for the feedback system (so that feedback(P * C, 1) now works.

Sorry, something went wrong.

Uh oh!

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

All reactions
@murrayrm
add summation_block + implicit signal interconnection
012d1d0
@murrayrm murrayrm mentioned this pull request Jan 23, 2021
Using interconnect/interconnected system #516
Closed
@murrayrm murrayrm changed the title dd summation_block and implicit signal interconnection add summation_block + implicit signal interconnection Jan 23, 2021
@coveralls

coveralls commented Jan 23, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 87.754% when pulling 791f7a6 on murrayrm:sumblk_implicit_interconnect into 1502d38 on python-control:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

This was linked to issues Jan 23, 2021
sumblk doesnt exists for connection in matlab compatibility module #493
Closed
Using interconnect/interconnected system #516
Closed
@sawyerbfuller

sawyerbfuller commented Jan 23, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Very cool!

I particularly like that it appears possible with this to leave out the ‘name’ keyword for the constitutive systems for simple interconnections like this. Am I correct in that? Nice to have that option because thst keyword is somewhat redundant and prone to errors when code gets modified.

If you give the sumblock more input names (eg 3 instead of 2), does it sum those three signals?

All reactions

Sorry, something went wrong.

Uh oh!

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

@murrayrm

murrayrm commented Jan 24, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

it appears possible with this to leave out the ‘name’ keyword for the constitutive systems for simple interconnections like this. Am I correct in that?

Correct. The following works just fine (from #516):

P = ct.tf2io(ct.tf(1, [1, 0]), inputs='u', outputs='y')
C = ct.tf2io(ct.tf(10, [1, 1]), inputs='e', outputs='u')
sumblk = ct.summation_block(inputs=['r', '-y'], output='e')
T = ct.interconnect((P, C, sumblk), inplist='r', outlist='y')

(P, C, and sumblk all have names automatically assigned, but not needed here).

If you give the sumblock more input names (eg 3 instead of 2), does it sum those three signals?

Yup. Any number of inputs can be summed together. The summation_block function does not require named signals, so you can also do ct.summation_block(7) if you want a LinearIOSystem that has 7 inputs and 1 output (sum of the inputs), for example).

Some possible tweaks:

  • I think I may use the term summing_junction (instead of summation_block) to line up with the term we use in FBS.
  • I will add a bit more documentation, both in docstrings and in the manual
  • I want to switch all examples using InterconnectedSystem to use interconnect since using the class constructor since the function provides a slightly higher level interface (eg, the class constructor still requires the explicit signal name).
All reactions

Sorry, something went wrong.

Uh oh!

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

@sawyerbfuller

sawyerbfuller commented Jan 24, 2021

Copy link
Copy Markdown
Contributor

Awesome.

New name for summer sounds better.

Hoping this will make creating simulink-like interconnected system simulations much easier. I will let you know how it goes once it’s been merged in.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bnavigator

bnavigator commented Jan 24, 2021

Copy link
Copy Markdown
Contributor

Very nice!

(Now we will have users demanding a graphical editor next 😁. Implemented as jupyter notebook widget or the like.)

All reactions

Sorry, something went wrong.

Uh oh!

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

@sawyerbfuller

sawyerbfuller commented Jan 24, 2021 via email

Copy link
Copy Markdown
Contributor
I think the first step in that direction might be to add an option in interconnect to draw a block diagram. This could be done using matplotlibs pretty good capabilities for this.
…
-- Sawyer Fuller Assistant Professor of Mechanical Engineering Adjunct, Paul G Allen School of Computer Science University of Washington http://faculty.washington.edu/~minster/ (Typed with my thumbs)
bnavigator 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
change name to summing_junction + updated documentation and examples
cd3e4b6
sawyerbfuller
sawyerbfuller reviewed Jan 26, 2021
View reviewed changes
Comment thread control/iosys.py
interconneciton map by connecting all signals with the same base names
(ignoring the system name). Specifically, for each input signal name
in the list of systems, if that signal name corresponds to the output
signal in any of the systems, it will be connected to that input (with

@sawyerbfuller sawyerbfuller Jan 26, 2021

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.

Nice that this summation effect is stated explicitly.

Sorry, something went wrong.

Uh oh!

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

All reactions
sawyerbfuller
sawyerbfuller approved these changes Jan 26, 2021
View reviewed changes
@murrayrm
TRV: docstring typo
791f7a6
@murrayrm murrayrm changed the title add summation_block + implicit signal interconnection add summing junction + implicit signal interconnection Jan 26, 2021
@murrayrm
murrayrm merged commit 122672a into python-control:master Jan 26, 2021
@murrayrm
murrayrm deleted the sumblk_implicit_interconnect branch January 31, 2021 00:13
@murrayrm murrayrm added this to the 0.9.0 milestone Mar 20, 2021
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

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.9.0

Development

Successfully merging this pull request may close these issues.

Using interconnect/interconnected system sumblk doesnt exists for connection in matlab compatibility module

Uh oh!

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

4 participants

@murrayrm @coveralls @sawyerbfuller @bnavigator
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.