Title: Possible bug: control.interconnect fails to construct a extended system with zero input and one output (D matrix shape mismatch) · Issue #1176 · python-control/python-control · GitHub
Open Graph Title: Possible bug: control.interconnect fails to construct a extended system with zero input and one output (D matrix shape mismatch) · Issue #1176 · python-control/python-control
X Title: Possible bug: control.interconnect fails to construct a extended system with zero input and one output (D matrix shape mismatch) · Issue #1176 · python-control/python-control
Description: About the problem Summary I attempted to simulate a control system with an output-feedback controller, defining a plant and a controller as subsystems. When using control.interconnect to connect these subsystems, an error occurs because ...
Open Graph Description: About the problem Summary I attempted to simulate a control system with an output-feedback controller, defining a plant and a controller as subsystems. When using control.interconnect to connect th...
X Description: About the problem Summary I attempted to simulate a control system with an output-feedback controller, defining a plant and a controller as subsystems. When using control.interconnect to connect th...
Opengraph URL: https://github.com/python-control/python-control/issues/1176
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible bug: control.interconnect fails to construct a extended system with zero input and one output (D matrix shape mismatch)","articleBody":"## About the problem\n\n### Summary\nI attempted to simulate a control system with an output-feedback controller, defining a plant and a controller as subsystems.\nWhen using `control.interconnect` to connect these subsystems, an error occurs because an extended system obtained by connecting subsystems has zero input and one output.\nIs it impossible to define a system with zero input and one output using the `control.interconnect` function?\n\n\n### Error message \n```\ncontrol.exception.ControlDimension: Incompatible dimensions of D matrix; expected (1, 0) but found (0, 0)\n```\n\n\n\n### System information\n- OS: macOS Sonoma 14.3.1\n- Python: 3.12.2\n- python-control: 0.10.2\n\n\n\n### Cause of this problem\nWhen we set the inputs and outputs of the extended system as zero input and one input, the D matrix of the extended system has `(1, 0)` dimension.\nHowever, the dimension of D matrix is converted to `(0, 0)` dimension by `_ssmatrix` function at line 218 of `statesp.py`.\nAs a result, the mismatch of the dimensions occurs.\n(When we set both inputs and outputs to zero, the error does not occur.)\n\n\n\n\n\n## To reproduce the error\n```python\nimport numpy as np\nimport control as ct\n\ndef main():\n\n # Define the coefficient matrices of plant P\n A = np.array(\n [\n [1.00, 1.00],\n [0.00, -2.0],\n ]\n )\n B = np.array(\n [\n [0.00],\n [1.00]\n ]\n )\n C = np.array(\n [\n [1.00, 0.00]\n ]\n )\n\n # Define the coefficient matrices of controller C\n A_c = np.array(\n [\n [2.25, 1.00],\n [-5.0, -0.5]\n ]\n )\n B_c = np.array(\n [\n [-1.25],\n [4.500]\n ]\n )\n C_c = np.array(\n [\n [-0.50, 1.500]\n ]\n )\n\n # Define the subsystems\n P = ct.ss(\n A,\n B,\n C,\n np.zeros([C.shape[0], B.shape[1]]),\n inputs=[f'u_p{i}' for i in range(B.shape[1])],\n outputs=[f'y_p{i}' for i in range(C.shape[0])],\n name='P',\n dt=True\n )\n C = ct.ss(\n A_c,\n B_c,\n C_c,\n np.zeros([C_c.shape[0], B_c.shape[1]]),\n inputs=[f'y_p{i}' for i in range(B_c.shape[1])],\n outputs=[f'u_p{i}' for i in range(C_c.shape[0])],\n name='C',\n dt=True\n )\n\n sys = ct.interconnect(\n [P, C],\n inplist=None,\n outlist=[f'y_p{i}' for i in range(P.C.shape[0])]\n )\n\nif __name__ == '__main__':\n main()\n```","author":{"url":"https://github.com/yuu5g0g0","@type":"Person","name":"yuu5g0g0"},"datePublished":"2025-07-27T06:35:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1176/python-control/issues/1176"}
| 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:57f4558d-02b7-4393-b851-2d2673205f0c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B448:3A860B:341A821:4903B08:69792CFD |
| html-safe-nonce | 52b5e61dae30a61c3c3beff93f9b20fe27d064546107cb57760b38ec0780ca9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDQ4OjNBODYwQjozNDFBODIxOjQ5MDNCMDg6Njk3OTJDRkQiLCJ2aXNpdG9yX2lkIjoiNjA2MzkwNjAzMTY3NzI4NzY3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d04079e970d30fed4a7a8bb742db1a7be3bf4c3c7140ee74df11d57c3b7923fb |
| hovercard-subject-tag | issue:3266767711 |
| 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/1176/issue_layout |
| twitter:image | https://opengraph.githubassets.com/03269d8c14dff11e354d46ac500830652176de450357c708f7f76c901ecffcb2/python-control/python-control/issues/1176 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/03269d8c14dff11e354d46ac500830652176de450357c708f7f76c901ecffcb2/python-control/python-control/issues/1176 |
| og:image:alt | About the problem Summary I attempted to simulate a control system with an output-feedback controller, defining a plant and a controller as subsystems. When using control.interconnect to connect th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yuu5g0g0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 15417fb272585d09f7c894f2a869ba34cc4c7ded898af9dccaa85542b9adb711 |
| 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 | 535f4866a7b2e3d762bd599bffe50a3cfb0702b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width