Title: Using a class method in a NonlinearIOSystem · python-control/python-control · Discussion #630 · GitHub
Open Graph Title: Using a class method in a NonlinearIOSystem · python-control/python-control · Discussion #630
X Title: Using a class method in a NonlinearIOSystem · python-control/python-control · Discussion #630
Description: Using a class method in a NonlinearIOSystem
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/python-control/python-control/discussions/630
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Using a class method in a NonlinearIOSystem","text":"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?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"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.
","upvoteCount":1,"url":"https://github.com/python-control/python-control/discussions/630#discussioncomment-855269"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:14ce6336-2944-0bd8-b607-faf83645c6e2 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | CCA8:2E14C0:6AE084:97087C:6979EEEC |
| html-safe-nonce | 720aa3d41f0c17f49f5e646c208a403ce7a90a8d33169c661d2c796d3e5a0348 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0E4OjJFMTRDMDo2QUUwODQ6OTcwODdDOjY5NzlFRUVDIiwidmlzaXRvcl9pZCI6IjYyNjEwOTk1NjI4NjAxMDY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 84db0b04a6272bb3c67febafe11125dfd8c987b94ec1a0d63be02063e0017013 |
| hovercard-subject-tag | discussion:3406846 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-control/python-control/630/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/1d5fb1091df9ba315c678b5655926b961254197fdc4556bc4a5df5959d110536/python-control/python-control/discussions/630 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d5fb1091df9ba315c678b5655926b961254197fdc4556bc4a5df5959d110536/python-control/python-control/discussions/630 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d518616844426fb176f4177c4776349f6e70ef1ce75f459c8c53bf9293bb6982 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 22c6ce7724007ae85d7487fce3308a1c7cea8be6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width