Skip to content

model_reduction does not preserve the sampling time (dt) of discrete-time systems #1277

Open

Description

@Kiril1Shevtsov

Description

model_reduction appears to lose the timebase of a discrete-time state-space system.

In python-control, dt=0 denotes a continuous-time system, while a nonzero dt denotes a discrete-time system. When reducing a discrete-time system, the returned model currently appears to be constructed without preserving the original system's dt.

Minimal reproducible example

import control as ct
import numpy as np

s = ct.ss(
    [[-0.2, 0], [0, -0.5]],
    np.eye(2), np.eye(2), np.zeros((2, 2)),
    dt=0.1,
)

r = ct.model_reduction(s, elim_states=[1], method='truncate')

print(s.dt, r.dt, r.isdtime(strict=True))

Observed output (from the reporter's environment):

0.1 0 False

Expected output:

0.1 0.1 True

The reduced model should preserve the original system's timebase.

Possible cause

The reduced state-space model may be constructed as StateSpace(Ar, Br, Cr, Dr) without passing sys.dt, causing it to default to continuous time. Passing the original timebase when constructing the reduced model may address the issue.

Environment

The reporter's test environment:

  • python-control: source commit bfe9380e
  • Python: 3.12.14
  • NumPy: 2.5.5
  • SciPy: 1.18.1

Related discussion: PR #1276, where opening an issue was requested to clarify the intended behavior.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions