Description
The following snippet
import control as ctrl
G = ctrl.tf(1, [1, 1])
t, y = ctrl.step_response(G)
executed under Python 3.5.4 with SciPy 1.0, NumPy 1.13.3 and python-control 0.7 and SlyCot NOT installed fails to run.
After investigation it turns out that the problem arrises in the file statesp.py
, function _convertToStateSpace
line 641: python-control tries to solve the problem using SlyCot. Since SlyCot is not found, it falls back to the ImportError
handling in which the SciPy's lti
is called:
lti_sys = lti(squeeze(sys.num), squeeze(sys.den))
return StateSpace(lti_sys.A, lti_sys.B, lti_sys.C, lti_sys.D,
sys.dt)
In SciyPy versions PRIOR to 1.0 the lti_sys object had the attributes A, B, C, D. However, in SciPy 1.0 these attributes have been removed. Hence, the code fails to execute.
Possible workaround would be (runs using SciPy 0.19 and 1.0):
from scipy.signal import tf2ss
A, B, C, D = tf2ss(squeeze(sys.num), squeeze(sys.den))
return StateSpace(A, B, C, D, sys.dt)
What do you think? Since many Windows user do not have Slycot available by default it would be nice to get this fixed.
Jan