From: Richard M. <mu...@cd...> - 2011-04-15 14:33:52
|
Roberto, The problem may be that control.Lti objects are no longer compatible with scipy.signal.lti objects, which the scipy.signal.step() function expects. A couple of fixes: * Instead of using scipy.signal.step(), use the control.matlab.step() function. You can do this by just getting rid of the scipy.signal import statement. Note that we don't have a step2() to function yet, so you may get warnings if you pass a system with a pole at the origin and you don't give a time interval (because it can't figure out the default time scale to use). * You can get the signal.lti object from a control.Lti object using the returnScipySignalLti() method. Note that this returns a 2-dimensional set of scipy.signal.lti objects, even for SISO systems (this will eventually be under the control of the toSISO and toMIMO keywords, which I hope to make part of the v0.4c release). Also, it would be nice to hear how you are implementing the discrete time modifications. I think the cleanest way to do this may be to create a separate class, derived from Lti, for discrete-time systems (transfer functions and state space). -richard On 15 Apr 2011, at 5:04 , Roberto Bucher wrote: > Hi Richard > > I've finally found some time to look the new modifications for your control > toolbox. With few modifications I've reached to put the sampling time in the > new matlab.py, statesp.py and xferfcn.py files. > > My examples run correctly again, but I have some problems with the step and > step2 functions. Here is the code: > > #------------------------------------------------------- > from matplotlib.pylab import * > from control.matlab import * > from scipy.signal import step, step2 > > # Motor parameters > Kt = 126e-6 > Jm = 1.3024e-3 > Dm = 857.4e-6 > > # Transfer function > g=tf([Kt/Jm],[1,Dm/Jm,0]) > > # Continous state space form > a=[[0,1],[0,-Dm/Jm]] > b=[[0],[1]] > c=[[Kt/Jm,0]]; > d=[0]; > sysc=ss(a,b,c,d) > > t1,y1 = step(g) > t2,y2 = step(sysc) > t1,y1 = step2(g) > t2,y2 = step2(sysc) > #--------------------------------------------------------- > I have some problems with the step and step2 functions (linalg problems or > > 695 sys = system > 696 else: > --> 697 sys = lti(*system) > 698 if N is None: > 699 N = 100 > > TypeError: type object argument after * must be a sequence, not instance > > Any Idea? > > Thanks in advance > > Roberto > > -- > ----------------------------------------------------------------------------- > Great spirits have always encountered violent opposition > from mediocre minds (A. Einstein) > ---------------------------------------------------------------------------- > University of Applied Sciences of Southern Switzerland > Dept. Innovative Technologies > CH-6928 Lugano-Manno > http://web.dti.supsi.ch/~bucher |