-
Notifications
You must be signed in to change notification settings - Fork 453
Erroneous time-domain sim (because of ss2tf) #240
Copy link
Copy link
Closed
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels