Skip to content

Preserve timebase in model_reduction - #1276

Closed
Kiril1Shevtsov wants to merge 1 commit into
python-control:mainfrom
Kiril1Shevtsov:fix-model-reduction-timebase
Closed

Kiril1Shevtsov wants to merge 1 commit into
python-control:mainfrom
Kiril1Shevtsov:fix-model-reduction-timebase

Conversation

@Kiril1Shevtsov

Copy link
Copy Markdown

Problem.

model_reduction creates a reduced StateSpace object without passing the original system’s timebase. For a discrete-time model, this can cause the reduced system to lose its original sampling time and be treated as a continuous-time system.

Change.

The change passes sys.dt when constructing the reduced StateSpace object. This preserves the timebase of the input system in the reduced model.

Tests.

The regression tests cover four timebase values (0, None, True and 0.1) across four reduction scenarios. On the original code, 12 of the 16 new cases failed; after the change, all 16 passed.

The modelsimp test module passed with 46 tests passed and 3 skipped. A broader run of the modelsimp, statesp and lti modules reported 1,025 passed, 236 skipped and one expected failure. Ruff also passed.

AI disclosure.

OpenAI tools were used for code review, as well as for writing part of the routine code. All code was reviewed by me personally.

@slivingston

Copy link
Copy Markdown
Member

@Kiril1Shevtsov Is there an associated issue? If not, please open an issue first to get confirmation that it is indeed an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants