Title: Add the ability to split an input to an interconnected system · Issue #1049 · python-control/python-control · GitHub
Open Graph Title: Add the ability to split an input to an interconnected system · Issue #1049 · python-control/python-control
X Title: Add the ability to split an input to an interconnected system · Issue #1049 · python-control/python-control
Description: Discussed in #1047 Originally posted by corbinklett October 9, 2024 If I have an input that is external to an interconnected system, and I want this external input to connect into multiple systems contained within, the only way I can thi...
Open Graph Description: Discussed in #1047 Originally posted by corbinklett October 9, 2024 If I have an input that is external to an interconnected system, and I want this external input to connect into multiple systems ...
X Description: Discussed in #1047 Originally posted by corbinklett October 9, 2024 If I have an input that is external to an interconnected system, and I want this external input to connect into multiple systems ...
Opengraph URL: https://github.com/python-control/python-control/issues/1049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add the ability to split an input to an interconnected system","articleBody":"### Discussed in https://github.com/python-control/python-control/discussions/1047\r\n\r\n\u003cdiv type='discussions-op-text'\u003e\r\n\r\n\u003csup\u003eOriginally posted by **corbinklett** October 9, 2024\u003c/sup\u003e\r\nIf I have an input that is external to an interconnected system, and I want this external input to connect into multiple systems contained within, the only way I can think to do this is by using `set_input_map`. Is there a more elegant way? Even when I use `set_input_map`, I still get the \"unused input\" warning. \r\n\r\nPart of the motivation for this question is that it is difficult to understand how an external input is being used if you can only specify it in terms of the subsystem that it connects to. It might be intended for the input to connect to multiple subsystems.\r\n\r\nHere is an example of how I have implemented:\r\n\r\n```python\r\nimport numpy as np\r\nimport control as ct\r\n\r\ndef dynamics(t, x, u, p):\r\n A = np.array([[0, 1], [-p['spring_constant'], -p['damping_coefficient']]])\r\n B = np.array([[0], [1]])\r\n return A @ x + B @ u\r\n\r\ndef outputs(t, x, u, p):\r\n C = np.array([[1, 0]])\r\n D = np.array([[0]])\r\n return C @ x + D @ u\r\n\r\nsys1 = ct.nlsys(updfcn=dynamics, outfcn=outputs, states=['pos', 'vel'], inputs=['u1'], outputs=['pos'], name='sys1')\r\nsys1.params = {'spring_constant': 10, 'damping_coefficient': 0.5}\r\n\r\nsys2 = ct.nlsys(updfcn=dynamics, outfcn=outputs, states=['pos', 'vel'], inputs=['u2'], outputs=['pos'], name='sys2')\r\nsys2.params = {'spring_constant': 1, 'damping_coefficient': 1}\r\n\r\nsys = ct.interconnect(\r\n (sys1, sys2),\r\n # inplist=['u'], # only works if both subsystem inputs are named u\r\n outlist=['sys1.pos', 'sys2.pos'],\r\n outputs=['pos1', 'pos2']\r\n)\r\n\r\n# /venv/lib/python3.12/site-packages/control/nlsys.py:1192: UserWarning: Unused input(s) in InterconnectedSystem: (1, 0)=sys2.u2; (0, 0)=sys1.u1\r\n\r\nsys.set_input_map(np.array([[1],[1]]))\r\nsys.set_inputs('external_input')\r\n\r\nt = np.linspace(0, 10, 1000)\r\n\r\nu0 = lambda t: 1\r\nU = np.array([\r\n [u0(ti) for ti in t]\r\n])\r\n\r\nresults = ct.input_output_response(sys, T=t, U=U)\r\n\r\np = results.plot()\r\np.figure.show()\r\n\r\n```\u003c/div\u003e","author":{"url":"https://github.com/murrayrm","@type":"Person","name":"murrayrm"},"datePublished":"2024-10-12T02:28:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1049/python-control/issues/1049"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1cb303e8-8f70-8310-300e-645a4bf46dab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C630:33B429:165146C:1E07FC8:697A947F |
| html-safe-nonce | 3670065370d136d325bf356ab5f9a43f1cd6de62aac3d23be17e9d269816ff8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjMwOjMzQjQyOToxNjUxNDZDOjFFMDdGQzg6Njk3QTk0N0YiLCJ2aXNpdG9yX2lkIjoiNjE0MDg3NDg3MzU3MzY0MzM5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 212e7b8f175bf13ccc3e095543961fb7aa0c3691b54d708f2c370a2b69b85612 |
| hovercard-subject-tag | issue:2582419362 |
| github-keyboard-shortcuts | repository,issues,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/issues/show/python-control/python-control/1049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/768fe8462000702ea488ccbd5cfce54235bfdb8557707e47ea25048d426aef0e/python-control/python-control/issues/1049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/768fe8462000702ea488ccbd5cfce54235bfdb8557707e47ea25048d426aef0e/python-control/python-control/issues/1049 |
| og:image:alt | Discussed in #1047 Originally posted by corbinklett October 9, 2024 If I have an input that is external to an interconnected system, and I want this external input to connect into multiple systems ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | murrayrm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0912f2a9aa0160e08239520d461a4b4c4ce1caa972a8370b7442b94a38a194c5 |
| 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 | f8f5270c10a913bfa56f2dad4b864f1cda383754 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width