Skip to content

Erroneous time-domain sim (because of ss2tf)  #240

@hungpham2511

Description

@hungpham2511

Hi, it seems python-control has a weird bug in the pipeline for converting from MIMO transfer function to state-space form. Consider the below gist

import control as co
import numpy as np
from numpy import array

num = [[array([0.]), array([1.0])],
       [array([1.0]), array([0.0])]]


den = [[array([1.]), array([1, 1])],
       [array([  1.        , 4.0]), array([1.0])]]
sys = co.tf(num, den)
t, y = co.step_response(sys, input=0)
print("step response (output 1 from input 0) (old): {:}".format(y[1, -1]))

# slightly change the denominator
den = [[array([1.]), array([1e-10, 1, 1])],
       [array([  1.        , 4.0]), array([1.0])]]
sys = co.tf(num, den)
t, y = co.step_response(sys, input=0)
print("step response (output 1 from input 0) (changed): {:}".format(y[1, -1]))

The output on my computer is

step response (output 1 from input 0) (first): 0.24999999999982692
step response (output 1 from input 0) (second): 0.0

Clearly in the later case, there is a bug in the time-domain simulation function. The DC gain from input 1 to output 1 is 0.25, so the first simulation works alright. But in the second simulation, I obtain zero output. A preliminary investigation suggests that the problem is in the ss2tf procedure, particularly, in the slicot function.

Any suggestions would be great. Current I have to resort to matlab to do the transformation from transfer function to state-space in my application.

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