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 — Using a class method in a NonlinearIOSystem · python-control/python-control · Discussion #630

Using a class method in a NonlinearIOSystem #630

Answered by dkunz49
dkunz49 asked this question in Q&A
Using a class method in a NonlinearIOSystem #630
@dkunz49 dkunz49
Jun 10, 2021 · 1 comments · 2 replies
Answered by dkunz49 Return to top
Discussion options
  • Uh oh!

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

dkunz49
Jun 10, 2021

I am trying to use a class method in a NonlinearIOSystem. To test, I adapted the predator-prey example such that the predprey_rhs function becomes a method in the new predprey class. Then, I create an instance of the predprey class (pp), and create the NonlinearIOSystem using the pp.predprey_rhs method. All good to that point. When I try to calculate the open-loop response with control.input_output_response, I get "TypeError: dynamics() takes 4 positional arguments but 5 were given". The method predprey_rhs has the self argument in its definition, so that shouldn't be a problem. Anyone have any ideas?

You must be logged in to vote
All reactions
Answered by dkunz49 Jun 10, 2021

I figured it out. Apparently, "params" is required as an argument for the predprey_rhs method. Previously, I defined the parameters in init, and didn't include "params" as a predprey_rhs method. Once I added it back in, even though is wasn't used, the error went away. I still don't understand why it threw the TypeError, but no matter.

View full answer

Replies: 1 comment · 2 replies

Comment options
  • Uh oh!

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

dkunz49
Jun 10, 2021
Author

I figured it out. Apparently, "params" is required as an argument for the predprey_rhs method. Previously, I defined the parameters in init, and didn't include "params" as a predprey_rhs method. Once I added it back in, even though is wasn't used, the error went away. I still don't understand why it threw the TypeError, but no matter.

You must be logged in to vote
All reactions
2 replies
@bnavigator
Comment options
  • Uh oh!

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

bnavigator Jun 10, 2021
Collaborator

"param is an optional dict" in the doc for updfnc is a bit misleading, I think. There is code relying on the presence of the parameter, even if it not used.

All reactions
@murrayrm
Comment options
  • Uh oh!

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

murrayrm Jun 16, 2021
Maintainer

Fixed in PR #633.

All reactions
Answer selected by bnavigator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
3 participants
@dkunz49 @murrayrm @bnavigator
Converted from issue

This discussion was converted from issue #629 on June 10, 2021 19:31.

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.